cleaning up

This commit is contained in:
Attila Body 2019-11-19 23:31:48 +01:00
parent 491062cac6
commit c439c48643
9 changed files with 63 additions and 100 deletions

View file

@ -16,15 +16,11 @@
#include "f4ll_c/dma_helper.h"
#ifndef CRCTASKCOUNT
#define CRCTASKCOUNT 2
#endif
struct crcslottask_t {
void * volatile address;
uint16_t wordCount;
void (* volatile callback)(void*, uint32_t, uint8_t);
void * volatile callbackParam;
uint16_t wordCount;
void (*callback)(void*, uint32_t, uint8_t);
void *callbackParam;
};
struct crcslotlistitem_t {
@ -35,21 +31,20 @@ struct crcslotlistitem_t {
struct crcstatus_t {
DMAINFO dmaInfo;
struct crcslotlistitem_t * volatile activeSlot;
uint8_t volatile activeTask;
struct crcslotlistitem_t *activeSlot;
uint8_t activeTask;
struct crcslotlistitem_t *first;
};
void InitCrcStatus(struct crcstatus_t *status, DMA_TypeDef *dma, uint32_t stream);
uint8_t GetActiveSlot(struct crcslotlistitem_t **slot_out, struct crcstatus_t *status);
uint8_t GetActiveTask(struct crcslotlistitem_t **slot_out, struct crcstatus_t volatile *status);
static inline uint8_t IsSlotQueued(struct crcslotlistitem_t *slot, uint8_t task) {
static inline uint8_t IsSlotQueued(struct crcslotlistitem_t volatile *slot, uint8_t task) {
return slot->tasks[task].address != NULL;
}
static inline uint8_t IsSlotActive(struct crcslotlistitem_t *slot, uint8_t task) {
static inline uint8_t IsSlotActive(struct crcslotlistitem_t volatile *slot, uint8_t task) {
return slot->tasks[task].callback != NULL || slot->tasks[task].callbackParam != NULL;
}