Fine-tuning "libs" API
This commit is contained in:
parent
ffec0e2b57
commit
e8cff640ac
18 changed files with 244 additions and 204 deletions
|
@ -9,14 +9,18 @@
|
|||
#define CRC_HANDLER_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <dma_helper.h>
|
||||
|
||||
#ifdef HAVE_CONFIG
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG
|
||||
|
||||
#include <dma_helper.h>
|
||||
|
||||
#ifndef CRCTASKCOUNT
|
||||
#define CRCTASKCOUNT 8
|
||||
#define CRCTASKCOUNT 2
|
||||
#endif
|
||||
|
||||
struct crcstatus_t {
|
||||
typedef struct {
|
||||
DMAINFO dmaInfo;
|
||||
volatile uint8_t activeSlot;
|
||||
struct crctask_t {
|
||||
|
@ -25,27 +29,25 @@ struct crcstatus_t {
|
|||
void (*callback)(void*, uint32_t, uint8_t);
|
||||
void *callbackParam;
|
||||
} volatile crcTasks[CRCTASKCOUNT];
|
||||
};
|
||||
} CRCSTATUS;
|
||||
|
||||
//#define CRCTASKCOUNT (sizeof(((struct crcstatus_t*)0)->crcTasks)/sizeof(struct crctask_t))
|
||||
|
||||
void InitCrcStatus(struct crcstatus_t *status, DMA_TypeDef *dma, uint32_t stream);
|
||||
static inline uint8_t GetActiveSlot(struct crcstatus_t *status) {
|
||||
void InitCrcStatus(CRCSTATUS *status, DMA_TypeDef *dma, uint32_t stream);
|
||||
static inline uint8_t GetActiveSlot(CRCSTATUS *status) {
|
||||
return status->activeSlot;
|
||||
}
|
||||
static inline uint8_t IsSlotQueued(struct crcstatus_t *status, uint8_t slot) {
|
||||
static inline uint8_t IsSlotQueued(CRCSTATUS *status, uint8_t slot) {
|
||||
return status->crcTasks[slot].address != NULL;
|
||||
}
|
||||
static inline uint8_t IsSlotActive(struct crcstatus_t *status, uint8_t slot) {
|
||||
static inline uint8_t IsSlotActive(CRCSTATUS *status, uint8_t slot) {
|
||||
return status->crcTasks[slot].callback != NULL || status->crcTasks[slot].callbackParam != NULL;
|
||||
}
|
||||
uint8_t EnqueueCrcTask(struct crcstatus_t *crcStatus, uint8_t slot, uint8_t *address, uint16_t len,
|
||||
uint8_t EnqueueCrcTask(CRCSTATUS *crcStatus, uint8_t slot, uint8_t *address, uint16_t len,
|
||||
void (*callback)(void*, uint32_t, uint8_t), void* callbackParam);
|
||||
void WaitCrcResults(struct crcstatus_t *status, uint8_t slot);
|
||||
uint32_t ComputeCrc(struct crcstatus_t *status, uint8_t slot, uint8_t *address, uint16_t len);
|
||||
void ComputeCrcAsync(struct crcstatus_t *status, uint8_t slot,
|
||||
void WaitCrcResults(CRCSTATUS *status, uint8_t slot);
|
||||
uint32_t ComputeCrc(CRCSTATUS *status, uint8_t slot, uint8_t *address, uint16_t len);
|
||||
void ComputeCrcAsync(CRCSTATUS *status, uint8_t slot,
|
||||
uint8_t *address, uint16_t len,
|
||||
void (*callback)(void*, uint32_t, uint8_t), void* callbackParam);
|
||||
void HandleCrcDmaIrq(struct crcstatus_t *status);
|
||||
void HandleCrcDmaIrq(CRCSTATUS *status);
|
||||
|
||||
#endif /* CRC_HANDLER_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue