Code compiles
This commit is contained in:
parent
7a74273ca7
commit
2aa08f20a0
118 changed files with 119250 additions and 34 deletions
51
lib/crc_handler.h
Normal file
51
lib/crc_handler.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* interrupt.h
|
||||
*
|
||||
* Created on: Aug 29, 2019
|
||||
* Author: abody
|
||||
*/
|
||||
|
||||
#ifndef CRC_HANDLER_H_
|
||||
#define CRC_HANDLER_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <dma_helper.h>
|
||||
#include "config.h"
|
||||
|
||||
#ifndef CRCTASKCOUNT
|
||||
#define CRCTASKCOUNT 8
|
||||
#endif
|
||||
|
||||
struct crcstatus_t {
|
||||
DMAINFO dmaInfo;
|
||||
volatile uint8_t activeSlot;
|
||||
struct crctask_t {
|
||||
void *address;
|
||||
uint16_t wordCount;
|
||||
void (*callback)(void*, uint32_t, uint8_t);
|
||||
void *callbackParam;
|
||||
} volatile crcTasks[CRCTASKCOUNT];
|
||||
};
|
||||
|
||||
//#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) {
|
||||
return status->activeSlot;
|
||||
}
|
||||
static inline uint8_t IsSlotQueued(struct crcstatus_t *status, uint8_t slot) {
|
||||
return status->crcTasks[slot].address != NULL;
|
||||
}
|
||||
static inline uint8_t IsSlotActive(struct crcstatus_t *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,
|
||||
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,
|
||||
uint8_t *address, uint16_t len,
|
||||
void (*callback)(void*, uint32_t, uint8_t), void* callbackParam);
|
||||
void HandleCrcDmaIrq(struct crcstatus_t *status);
|
||||
|
||||
#endif /* CRC_HANDLER_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue