⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circ.h

📁 DM642支持4个串口的驱动代码
💻 H
字号:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.10.00.23 07-02-03 (ddk-b12)" */
/*
 *  ======== circ.h ========
 */

#ifndef CIRC_
#define CIRC_

#ifdef __cplusplus
extern "C" {
#endif

#define CIRC_BUFSIZE    32      /* must be ^2! */

typedef struct CIRC_Obj {
    Uns         writeIndex;     /* write pointer for the buffer */
    Uns         readIndex;      /* read pointer fro the buffer */
    Uns         charCount;      /* buffer character count */
    Uns         size;
    char        buf[CIRC_BUFSIZE];      /* circular buffer */
} CIRC_Obj, *CIRC_Handle;

extern Void CIRC_new(CIRC_Handle circ);
extern Char CIRC_readChar(CIRC_Handle circ);
extern Void CIRC_writeChar(CIRC_Handle circ, Char c);

#define CIRC_fullCount(circ)            ((circ)->charCount)
#define CIRC_emptyCount(circ)           ((circ)->size - (circ)->charCount)
#define CIRC_nextIndex(circ,index)      (((index) + 1) & ((circ)->size - 1))
#define CIRC_prevIndex(circ,index)      (((index) - 1) & ((circ)->size - 1))
#define CIRC_reset(circ)            {(circ)->charCount = 0; (circ)->readIndex = (circ)->writeIndex; }
#define CIRC_isFull(circ)           ((circ)->charCount == CIRC_BUFSIZE)

#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /* CIRC_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -