Changes requested during the initial review
This commit is contained in:
parent
53e65e566a
commit
c4c6ac8bb3
8 changed files with 186 additions and 89 deletions
|
@ -21,42 +21,42 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct crcslottask_t {
|
||||
struct crctask_t {
|
||||
void * volatile address;
|
||||
uint16_t wordCount;
|
||||
void (*callback)(void*, uint32_t, uint8_t);
|
||||
void *callbackParam;
|
||||
};
|
||||
|
||||
struct crcslotlistitem_t {
|
||||
struct crcslot_t {
|
||||
uint16_t count;
|
||||
struct crcslotlistitem_t *next;
|
||||
struct crcslottask_t *tasks;
|
||||
struct crcslot_t *next;
|
||||
struct crctask_t *tasks;
|
||||
};
|
||||
|
||||
struct crcstatus_t {
|
||||
CRC_TypeDef *crcUnit;
|
||||
struct dmainfo_t dmaInfo;
|
||||
struct crcslotlistitem_t *activeSlot;
|
||||
struct crcslot_t *activeSlot;
|
||||
uint8_t activeTask;
|
||||
struct crcslotlistitem_t *firstSlot;
|
||||
struct crcslot_t *firstSlot;
|
||||
};
|
||||
|
||||
void Crc_InitStatus(struct crcstatus_t *status, CRC_TypeDef *crcUnit, DMA_TypeDef *dma, uint32_t stream);
|
||||
|
||||
uint8_t Crc_GetActiveTask(struct crcslotlistitem_t **slot_out, struct crcstatus_t volatile *status);
|
||||
uint8_t Crc_GetActiveTask(struct crcslot_t **slot_out, struct crcstatus_t volatile *status);
|
||||
|
||||
uint8_t Crc_IsSlotQueued(struct crcslotlistitem_t *slot, uint8_t task);
|
||||
uint8_t Crc_IsTaskQueued(struct crcslot_t *slot, uint8_t task);
|
||||
|
||||
uint8_t Crc_IsSlotBusy(struct crcslotlistitem_t *slot, uint8_t task);
|
||||
uint8_t Crc_IsTaskBusy(struct crcslot_t *slot, uint8_t task);
|
||||
|
||||
void Crc_WaitResults(struct crcstatus_t *status, struct crcslotlistitem_t *slot, uint8_t task);
|
||||
void Crc_WaitResults(struct crcstatus_t *status, struct crcslot_t *slot, uint8_t task);
|
||||
|
||||
void Crc_AttachTask(struct crcstatus_t *status, struct crcslotlistitem_t *slot, struct crcslottask_t *tasks, uint8_t taskCount);
|
||||
void Crc_AttachTasks(struct crcstatus_t *status, struct crcslot_t *slot, struct crctask_t *tasks, uint8_t taskCount);
|
||||
|
||||
uint8_t Crc_Enqueue(struct crcstatus_t *status, struct crcslotlistitem_t *slot, uint8_t task,
|
||||
uint8_t Crc_Enqueue(struct crcstatus_t *status, struct crcslot_t *slot, uint8_t task,
|
||||
void *address, uint16_t len, void (*callback)(void*, uint32_t, uint8_t), void* callbackParam);
|
||||
uint32_t Crc_Compute(struct crcstatus_t *status, struct crcslotlistitem_t *slot, uint8_t task, void *address, uint16_t len);
|
||||
uint32_t Crc_Compute(struct crcstatus_t *status, struct crcslot_t *slot, uint8_t task, void *address, uint16_t len);
|
||||
void Crc_HandleDmaIrq(struct crcstatus_t *status);
|
||||
|
||||
// !!!PRIVATE!!! exposed only to make mocking possible
|
||||
|
@ -66,10 +66,10 @@ void Crc_StartNextTask(struct crcstatus_t *status);
|
|||
#ifdef UNITTEST
|
||||
DECLARE_MOCK(Crc_InitStatus);
|
||||
DECLARE_MOCK(Crc_GetActiveTask);
|
||||
DECLARE_MOCK(Crc_IsSlotQueued);
|
||||
DECLARE_MOCK(Crc_IsSlotBusy);
|
||||
DECLARE_MOCK(Crc_IsTaskQueued);
|
||||
DECLARE_MOCK(Crc_IsTaskBusy);
|
||||
DECLARE_MOCK(Crc_WaitResults);
|
||||
DECLARE_MOCK(Crc_AttachTask);
|
||||
DECLARE_MOCK(Crc_AttachTasks);
|
||||
DECLARE_MOCK(Crc_Enqueue);
|
||||
DECLARE_MOCK(Crc_Compute);
|
||||
DECLARE_MOCK(Crc_HandleDmaIrq);
|
||||
|
|
|
@ -104,8 +104,8 @@ struct usartstatus_t {
|
|||
struct dmainfo_t rxDmaInfo;
|
||||
struct dmainfo_t txDmaInfo;
|
||||
struct crcstatus_t *crcStatus;
|
||||
struct crcslotlistitem_t crcSlot;
|
||||
struct crcslottask_t crcTasks[2];
|
||||
struct crcslot_t crcSlot;
|
||||
struct crctask_t crcTasks[2];
|
||||
|
||||
uint8_t rxSerial;
|
||||
uint8_t txSerial;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue