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

📄 buf.h

📁 Bycore是一个嵌入式操作系统内核。Bycore包括内存管理、任务管理、中断管理、任务互斥、同步与通信管理等功能。Bycore全部由C语言完成
💻 H
字号:
/** *  buf.h - A shared buffer and related calls. * *  Copyright (C) 2008  ZhangHu *  All rights reserved. *  E-MAIL: anmnmnly@gmail.com * *  This program is free software: you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation, either version 3 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program.  If not, see <http://www.gnu.org/licenses/>. */#ifndef __BUF_H__#define __BUF_H__#include "include/types.h"/* define some status */#define BUF_OK 0x00         /* Operation is Ok */#define BUF_NOT_EXIST 0x01  /* Shared buffer is not exist */#define BUF_FULL 0x02       /* Shared buffer is full */#define BUF_EMPTY 0x03      /* Shared buffer is empty */typedef struct buffer {    uword_t size;    /* size of shared buffer */    uword_t used;    /* used space of shared buffer */    char_t *start;   /* pointer to start postion of shared buffer */    char_t *end;     /* pointer to end postion of shared buffer */    char_t *inpos;   /* pointer to postion where new data will be writen */    char_t *outpos;  /* pointer to postion where data will read */}buf_t;/* APIs for operating buffer. */buf_t *bufInit(uword_t BufSize);word_t bufSend(buf_t *pBuf, char_t ch, uword_t *err);uword_t bufSendStr(buf_t *pBuf, char_t *Buf, uword_t *err);char_t bufRev(buf_t *pBuf, uword_t *err);uword_t bufRevStr(buf_t *pBuf, char_t *Buf, uword_t *err);word_t bufGetUsed(buf_t *pBuf);void bufDel(buf_t *pBuf);void bufClear(buf_t *pBuf);#endif

⌨️ 快捷键说明

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