Added check4freeFDshortCmd.

This commit is contained in:
Gerhard Hoffmann 2023-04-18 12:22:23 +02:00
parent a95e174356
commit cb4412779f

View File

@ -563,11 +563,17 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
uint8_t check4FDshortCmd(void)
{
// returns number of waiting command
// returns number of waiting command, max FDCMD_STACKDEPTH
return p_nextFDcmdsInQueue;
}
uint8_t check4freeFDshortCmd(void)
{
// returns number of free places in short-command stack
return FDCMD_STACKDEPTH - p_nextFDcmdsInQueue;
}
// long command, 64 data bytes
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
@ -602,7 +608,7 @@ bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
uint8_t nn;
if (p_longFDcmdsInQueue>=FDLONG_STACKDEPTH)
{
qCritical() << "cannot save cmd because stack is full";
qDebug() << "cannot save cmd because stack is full";
return false; // not possible
}
longFDwrCmd[p_longFDcmdsInQueue]=nextWrCmd;
@ -613,7 +619,6 @@ bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
longFDpara[p_longFDcmdsInQueue][nn]=data[nn];
p_longFDcmdsInQueue++;
return true; // ok, will be sent
}
@ -659,5 +664,10 @@ uint8_t check4FDlongCmd(void)
return p_longFDcmdsInQueue;
}
uint8_t check4freeFDlongCmd(void)
{
// returns number of free places in command stack
return FDLONG_STACKDEPTH - p_longFDcmdsInQueue;
}