1234567891011121314151617181920212223242526272829 |
- /*
- * fifo.h
- *
- * Created on: Jan 17, 2022
- * Author: radioman
- */
- #ifndef INC_FIFO_H_
- #define INC_FIFO_H_
- #include <stdint.h>
- typedef enum { FIFO_EMPTY, FIFO_READY, FIFO_FULL } FIFO_StateTypeDef;
- typedef struct {
- uint32_t head;
- uint32_t tail;
- uint32_t size;
- FIFO_StateTypeDef state;
- uint8_t *data;
- } FIFO_HandleTypeDef;
- void fifo_init(FIFO_HandleTypeDef *fifo, uint8_t *buffer, uint32_t size);
- FIFO_StateTypeDef fifo_state(FIFO_HandleTypeDef *fifo);
- int fifo_read(FIFO_HandleTypeDef *fifo, uint8_t *buf, uint32_t len);
- int fifo_write(FIFO_HandleTypeDef *fifo, uint8_t *data, uint32_t len);
- int fifo_size(FIFO_HandleTypeDef *fifo);
- #endif /* INC_FIFO_H_ */
|