Добавил в список команд ответ BUZY если следующая команда пришла до того как выполнилась предыдущая.

This commit is contained in:
Eugene 2023-11-29 08:45:19 +03:00
parent e7802cd4ac
commit 79501cdead

View File

@ -33,6 +33,7 @@
#define WRONG_LENGHT 0x15
#define WRONG_ADDR 0x16
#define WRONG_ID 0x17
#define BUSY 0x18
#define COMMAND_ACCEPTED 0x20
#define DONE_SUCCESS 0x21
@ -109,8 +110,8 @@ void clear_BlockWasErased(void)
}
}
//#define Internal_flash_lib_Program Internal_flash_Program_DataOnlyECCOnly
#define Internal_flash_lib_Program Internal_flash_Program_AutoECC
//#define Internal_flash_Program Internal_flash_Program_DataOnlyECCOnly
#define Internal_flash_Program Internal_flash_Program_AutoECC
void getMessage_from_Cm_Flash(void)
@ -147,7 +148,7 @@ void getMessage_from_Cm_Flash(void)
}
if(FlashSektorEnd == FlashSektorStart) //åñëè çàêàí÷èâàåì â ýòîì æå ñåêòîðå ÷òî è íà÷àëè, òî ïðîñòî ïèøåì åãî
{
MemOperationError = Internal_flash_lib_Program(FactAddressFlash, InData);
MemOperationError = Internal_flash_Program(FactAddressFlash, InData);
if(MemOperationError) {IPC_sendCommand(IPC_CPU1_L_CM_R, MemOperationError, INT_FLASH, 0, 0); return;}//åñëè îøèáêà -- îòïðàâëÿåì ñîîáùåíèå è çàâåðøàåì
}
else //åñëè íà÷àëè â îäíîì ñåêòîðå, à çàêàí÷èâàåì â äðóãîì òî
@ -160,9 +161,9 @@ void getMessage_from_Cm_Flash(void)
}
block1 = internal_flash_FlashBankStartAddr(FlashSektorEnd)-FactAddressFlash; //âû÷èñëÿåì ðàçìåð ïåðâîãî êóñêà
block2 = InData - block1; //è ðàçìåð êóñêà äëÿ âòîðîãî ñåêòîðà
MemOperationError = Internal_flash_lib_Program(FactAddressFlash, block1); // è ïèøåì ñïåðâà êóñîê â ïåðâûé ñåêòîð,
MemOperationError = Internal_flash_Program(FactAddressFlash, block1); // è ïèøåì ñïåðâà êóñîê â ïåðâûé ñåêòîð,
if(MemOperationError) {IPC_sendCommand(IPC_CPU1_L_CM_R, MemOperationError, INT_FLASH, 0, 0); return;}//åñëè îøèáêà -- îòïðàâëÿåì ñîîáùåíèå è çàâåðøàåì
MemOperationError = Internal_flash_lib_Program(internal_flash_FlashBankStartAddr(FlashSektorEnd), block2); // ïîòîì êóñîê âî âòîðîé
MemOperationError = Internal_flash_Program(internal_flash_FlashBankStartAddr(FlashSektorEnd), block2); // ïîòîì êóñîê âî âòîðîé
if(MemOperationError) {IPC_sendCommand(IPC_CPU1_L_CM_R, MemOperationError, INT_FLASH, 0, 0); return;}//åñëè îøèáêà -- îòïðàâëÿåì ñîîáùåíèå è çàâåðøàåì
}
IPC_sendCommand(IPC_CPU1_L_CM_R, DONE_SUCCESS, INT_FLASH, 0, 0);
@ -319,6 +320,7 @@ __interrupt void IPC_ISR0()
IPC_ackFlagRtoL(IPC_CPU1_L_CM_R, (1<<0));
PieCtrlRegs.PIEACK.all = PIEACK_GROUP11;
if(ReadFromCm == 0) ReadFromCm = 1;
else IPC_sendCommand(IPC_CPU1_L_CM_R, BUSY, ZD24C02A_2K_I2C, 0, 0);
}