mirror of
https://gitee.com/moluo-tech/AT-Command
synced 2025-06-18 08:27:51 +00:00
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
![]() |
/******************************************************************************
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ο<EFBFBD>linux/kfifo)
|
|||
|
*
|
|||
|
* Copyright (c) 2016~2020, <morro_luo@163.com>
|
|||
|
*
|
|||
|
* SPDX-License-Identifier: Apache-2.0
|
|||
|
*
|
|||
|
* Change Logs:
|
|||
|
* Date Author Notes
|
|||
|
* 2016-05-30 Morro <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
******************************************************************************/
|
|||
|
|
|||
|
#ifndef _RING_BUF_H_
|
|||
|
#define _RING_BUF_H_
|
|||
|
|
|||
|
#include <stdbool.h>
|
|||
|
|
|||
|
#ifdef __cplusplus
|
|||
|
extern "C" {
|
|||
|
#endif
|
|||
|
|
|||
|
/*<2A><><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
typedef struct {
|
|||
|
unsigned char *buf; /*<2A><><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
unsigned int size; /*<2A><><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
unsigned int front; /*ͷָ<CDB7><D6B8> */
|
|||
|
unsigned int rear; /*βָ<CEB2><D6B8> */
|
|||
|
}ring_buf_t;
|
|||
|
|
|||
|
bool ring_buf_init(ring_buf_t *r,unsigned char *buf,unsigned int size);
|
|||
|
|
|||
|
void ring_buf_clr(ring_buf_t *r);
|
|||
|
|
|||
|
unsigned int ring_buf_len(ring_buf_t *r);
|
|||
|
|
|||
|
unsigned int ring_buf_put(ring_buf_t *r,unsigned char *buf,unsigned int len);
|
|||
|
|
|||
|
unsigned int ring_buf_get(ring_buf_t *r,unsigned char *buf,unsigned int len);
|
|||
|
|
|||
|
|
|||
|
#ifdef __cplusplus
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
#endif
|