reflow-oven-control-sw/stm-firmware/include/uart/dma-ring-buffer.h

25 lines
666 B
C
Raw Normal View History

#ifndef __DMA_RING_BUFFER_H__
#define __DMA_RING_BUFFER_H__
#include <stdbool.h>
#include <stm32f4xx.h>
#include <stddef.h>
struct dma_ring_buffer {
char *data_ptr;
size_t buffer_count;
DMA_Stream_TypeDef *dma;
size_t get_idx;
uint8_t base_dma_id;
};
int dma_ring_buffer_initialize(struct dma_ring_buffer *dma_buffer, uint8_t base_dma_id, DMA_Stream_TypeDef *dma_stream, size_t buffer_element_count, char *data_buffer, void *src_reg, uint8_t dma_trigger_channel);
int dma_ring_buffer_get_data(struct dma_ring_buffer *buff, const char **data_buff, size_t *len);
void dma_ring_buffer_stop(struct dma_ring_buffer *buff);
#endif /* __DMA_RING_BUFFER_H__ */