subrepo: subdir: "components/f4ll_c" merged: "5d26fdc" upstream: origin: "git@git.pcmuhely.hu:compi/f4ll_c.git" branch: "master" commit: "5d26fdc" git-subrepo: version: "0.4.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "5d6aba9"
83 lines
2.2 KiB
C
83 lines
2.2 KiB
C
/*
|
|
* interrupt.h
|
|
*
|
|
* Created on: Aug 29, 2019
|
|
* Author: abody
|
|
*/
|
|
|
|
#ifndef CRC_HANDLER_H_
|
|
#define CRC_HANDLER_H_
|
|
|
|
#include <inttypes.h>
|
|
|
|
#ifdef HAVE_CONFIG
|
|
#include "config.h"
|
|
#endif // HAVE_CONFIG
|
|
|
|
#include <platform/crc_ll.h>
|
|
#include <f4ll_c/dmahelper.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct crcslottask_t {
|
|
void * volatile address;
|
|
uint16_t wordCount;
|
|
void (*callback)(void*, uint32_t, uint8_t);
|
|
void *callbackParam;
|
|
};
|
|
|
|
struct crcslotlistitem_t {
|
|
uint16_t count;
|
|
struct crcslotlistitem_t *next;
|
|
struct crcslottask_t *tasks;
|
|
};
|
|
|
|
struct crcstatus_t {
|
|
CRC_TypeDef *crcUnit;
|
|
struct dmainfo_t dmaInfo;
|
|
struct crcslotlistitem_t *activeSlot;
|
|
uint8_t activeTask;
|
|
struct crcslotlistitem_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_IsSlotQueued(struct crcslotlistitem_t *slot, uint8_t task);
|
|
|
|
uint8_t Crc_IsSlotBusy(struct crcslotlistitem_t *slot, uint8_t task);
|
|
|
|
void Crc_WaitResults(struct crcstatus_t *status, struct crcslotlistitem_t *slot, uint8_t task);
|
|
|
|
void Crc_AttachTask(struct crcstatus_t *status, struct crcslotlistitem_t *slot, struct crcslottask_t *tasks, uint8_t taskCount);
|
|
|
|
uint8_t Crc_Enqueue(struct crcstatus_t *status, struct crcslotlistitem_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);
|
|
void Crc_HandleDmaIrq(struct crcstatus_t *status);
|
|
|
|
// !!!PRIVATE!!! exposed only to make mocking possible
|
|
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_WaitResults);
|
|
DECLARE_MOCK(Crc_AttachTask);
|
|
DECLARE_MOCK(Crc_Enqueue);
|
|
DECLARE_MOCK(Crc_Compute);
|
|
DECLARE_MOCK(Crc_HandleDmaIrq);
|
|
DECLARE_MOCK(Crc_StartNextTask);
|
|
#endif // UNITTEST
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CRC_HANDLER_H_ */
|