// #ifndef __PLATFROM_QUEUE_H // #define __PLATFROM_QUEUE_H // #include "stdio.h" // #define MAX_QSIZE (60u) /* 最大队列长度 */ // typedef unsigned long long uint64_t; // typedef struct // { // struct // { // uint8_t ide; // uint8_t rtr; // uint8_t dlc; // } reg; // union // { // uint32_t r; // struct // { // uint8_t sa : 8; // uint8_t ps : 8; // uint8_t pf : 8; // uint8_t dp : 1; // uint8_t r : 1; // uint8_t p : 3; // } b; // } id; // union // { // uint8_t u8_buf[8]; // uint16_t u16_buf[4]; // uint32_t u32_buf[2]; // uint64_t u64_buf; // } data; // } pdu_tag, *p_pdu_tag; // typedef struct // { // uint16_t head; // uint16_t tail; // uint16_t count; // pdu_tag can_message[MAX_QSIZE]; // } can_queue_tag, *p_can_queue_tag; // typedef enum // { // DATEQUEUE = 0, // TASKQUEUE = 1, // } queuemode_e; // typedef struct // { // #define QUEUE_BUFFER_SUM 2 // #define DATA_BUFF_NUM 5 // uint8_t full[QUEUE_BUFFER_SUM]; // uint8_t length[QUEUE_BUFFER_SUM]; // uint8_t ret, lock, idle, mode; // pdu_tag *head[QUEUE_BUFFER_SUM]; // pdu_tag *tail[QUEUE_BUFFER_SUM]; // pdu_tag buff[QUEUE_BUFFER_SUM][DATA_BUFF_NUM]; // } t_queue; // void queue_mode(t_queue *this, uint8_t mode); // void push_queue(t_queue *this, pdu_tag **head, pdu_tag **tail, pdu_tag (*buff)[DATA_BUFF_NUM], uint8_t len, pdu_tag *data, uint8_t data_len); // void pull_queue(t_queue *this, pdu_tag **head, pdu_tag **tail, pdu_tag (*buff)[DATA_BUFF_NUM], uint8_t len, pdu_tag *data); // #define queue_update(this) length_queue(&this, this.head, this.tail, sizeof((this).buff[0])) // #define empty_queue(this) queue_empty(&this, this.head, this.tail, this.buff) // #define empty_one_queue(this, lock) queue_empty_one(&this, this.head, this.tail, this.buff, (lock)) // #define en_queue(this, data, data_len) push_queue(&this, this.head, this.tail, this.buff, sizeof((this).buff[0]), (data), (data_len)) // #define de_queue(this, data) pull_queue(&this, this.head, this.tail, this.buff, sizeof((this).buff[0]), (data)) // #define mode_queue(this, mode) queue_mode(&this, (mode)); // extern t_queue can_tx; // extern t_queue can_rx; // void can_queue_init(void); // #endif