📄 pipe.h
字号:
/** * pipe.h - Related routines and structs of pipe. * * 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 __PIPE_H__#define __PIPE_H__#include "include/types.h"#include "include/sem.h"#define PIPE_OK 0x00#define PIPE_FALSE 0x01#define PIPE_ID_NOT_MATCH 0x02#define PIPE_FULL 0x04#define PIPE_EMPTY 0x08typedef struct pipe { uword_t send_id; /* ID of task that sends data to pipe */ uword_t rev_id; /* ID of task that receives data from pipe */ uword_t size; /* The size of pipe */ uword_t used; /* The number of used space of pipe */ void **start; /* Pointer to the start address of pipe */ void **end; /* Pointer to the end address of pipe */ void **in; /* Pointer to the write position of pipe */ void **out; /* Pointer to the read position pipe */} pipe_t;/* pipeInit - It creates a new pipe */pipe_t *pipeInit(uword_t SendID, /* ID of sending task */ uword_t RevID, /* ID of receiving task */ uword_t Size); /* The size of pipe *//* pipeSend - Sending a message to a pipe */uword_t pipeSend(pipe_t *pPipe, /* Pointer to the pipe */ void *pMsg, /* Pointer to the message */ uword_t *err); /* Return reasons about 'pipeSend()' */void *pipeRev(pipe_t *pPipe, /* Pointer to the pipe */ uword_t *err); /* Return reasons about 'pipeSend()' *//* Clear a pipe */void pipeClear(pipe_t *pPipe);/* Delete a pipe */void pipeDel(pipe_t *pPipe);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -