cleaning up
This commit is contained in:
parent
491062cac6
commit
c439c48643
9 changed files with 63 additions and 100 deletions
|
@ -12,28 +12,27 @@
|
|||
#include "f4ll_c/dma_helper.h"
|
||||
#include "f4ll_c/crc_handler.h"
|
||||
|
||||
struct _usart_status;
|
||||
typedef struct _usart_status USARTSTATUS;
|
||||
struct usart_buffer;
|
||||
struct usartstatus_t;
|
||||
|
||||
typedef void (*PACKETRECEIVEDCALLBACK)(void *userParam, struct usart_buffer *buffer);
|
||||
|
||||
void InitUartStatus(
|
||||
USARTSTATUS *st, USART_TypeDef *usart, DMA_TypeDef *dma,
|
||||
struct usartstatus_t *st, USART_TypeDef *usart, DMA_TypeDef *dma,
|
||||
uint32_t stream_rx, uint32_t stream_tx,
|
||||
struct crcstatus_t *crcStatus,
|
||||
PACKETRECEIVEDCALLBACK packetReceivedCallback, void * packetReceivedCallbackParam);
|
||||
|
||||
uint8_t* GetTxBuffer(USARTSTATUS *status);
|
||||
uint8_t* GetTxBuffer(struct usartstatus_t *status);
|
||||
|
||||
uint8_t PostPacket(USARTSTATUS *status, uint8_t const *payload, uint16_t length, struct crcstatus_t *crcStatus, uint8_t waitForCrcQueue);
|
||||
void SetupReceive(USARTSTATUS *status);
|
||||
uint8_t PostPacket(struct usartstatus_t *status, uint8_t const *payload, uint16_t length, struct crcstatus_t *crcStatus, uint8_t waitForCrcQueue);
|
||||
void SetupReceive(struct usartstatus_t *status);
|
||||
void SetupTransmit(USART_TypeDef *usart, DMA_TypeDef* dma, uint32_t stream, void *buffer, uint32_t length);
|
||||
void ConsumePacket(USARTSTATUS *status, uint8_t packetIndex);
|
||||
void ConsumePacket(struct usartstatus_t *status, uint8_t packetIndex);
|
||||
|
||||
void HandleUsartRxDmaIrq(USARTSTATUS *status);
|
||||
void HandleUsartTxDmaIrq(USARTSTATUS *status);
|
||||
void HandleUsartIrq(USARTSTATUS *status);
|
||||
void HandleUsartRxDmaIrq(struct usartstatus_t *status);
|
||||
void HandleUsartTxDmaIrq(struct usartstatus_t *status);
|
||||
void HandleUsartIrq(struct usartstatus_t *status);
|
||||
|
||||
/******************************************************************************************
|
||||
*
|
||||
|
@ -55,30 +54,30 @@ struct usart_stats {
|
|||
uint32_t skiped;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct usartpacketheader_t {
|
||||
uint8_t startByte;
|
||||
uint8_t serial;
|
||||
uint8_t payloadLength;
|
||||
uint8_t hash;
|
||||
} USARTPACKETHEADER;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
USARTPACKETHEADER header;
|
||||
struct usartpacket_t {
|
||||
struct usartpacketheader_t header;
|
||||
//!!! should start on word offset !!!
|
||||
uint8_t payload[256+sizeof(uint32_t)]; // extra room for crc32
|
||||
} __attribute__((aligned)) USARTPACKET;
|
||||
uint8_t payload[256+sizeof(uint32_t)]; // extra room for crc32
|
||||
} __attribute__((aligned));
|
||||
|
||||
struct usart_buffer {
|
||||
USARTPACKET packet;
|
||||
struct usartpacket_t packet;
|
||||
//transfer area ends here
|
||||
volatile uint8_t busy;
|
||||
volatile uint8_t error;
|
||||
uint16_t requestedLength;
|
||||
uint32_t errorInfo;
|
||||
USARTSTATUS *usartStatus;
|
||||
struct usartstatus_t *usartStatus;
|
||||
};
|
||||
|
||||
struct _usart_status {
|
||||
struct usartstatus_t {
|
||||
USART_TypeDef *usart;
|
||||
DMAINFO rxDmaInfo;
|
||||
DMAINFO txDmaInfo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue