DCLibraries/include/sendWRcmd.h
2023-11-14 08:35:53 +01:00

49 lines
1.6 KiB
C

#ifndef SENDWRCMDS_DEFS_H
#define SENDWRCMDS_DEFS_H
#include <stdint.h>
#include "tslib.h"
#include <QString>
// wait for resonse before send next!
bool sendWRcmd_setSendBlock160(uint8_t leng, uint8_t *buf);
uint8_t sendWRcmd_getSendBlock160(uint8_t *leng, uint8_t *buf);
// retval = *leng
void sendWRcmd_INI(void);
// #define FDCMD_STACKDEPTH 16 / 32
// short and long commands are queued into the same stack to guaranty right order
void sendFDcmd_clrStack(void);
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
// write Command to memory, wait for transport
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
uint8_t check4usedFDstack(void);
// returns number of waiting command, maxFDCMD_STACKDEPTH
uint8_t checkNextFDcmd(void);
// return 0: no command waiting
// 1: short cmd
// 2: long cmd
uint8_t check4freeFDstack(void);
// returns number of free places in FD-command stack
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, QByteArray *data);
// write Command to memory, wait for transport
// data buffer size always 64! data[64], padded with 0
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
#endif