source: azure_iot_hub_f767zi/trunk/asp_baseplatform/lwip/contrib-2.1.0/ports/unix/port/include/netif/fifo.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 1.7 KB
Line 
1#ifndef FIFO_H
2#define FIFO_H
3
4#include "lwip/sys.h"
5
6/** How many bytes in fifo */
7#define FIFOSIZE 2048
8
9/** fifo data structure, this one is passed to all fifo functions */
10typedef struct fifo_t {
11 u8_t data[FIFOSIZE+10]; /* data segment, +10 is a hack probably not needed.. FIXME! */
12 int dataslot; /* index to next char to be read */
13 int emptyslot; /* index to next empty slot */
14 int len; /* len probably not needed, may be calculated from dataslot and emptyslot in conjunction with FIFOSIZE */
15
16 sys_sem_t sem; /* semaphore protecting simultaneous data manipulation */
17 sys_sem_t getSem; /* sepaphore used to signal new data if getWaiting is set */
18 u8_t getWaiting; /* flag used to indicate that fifoget is waiting for data. fifoput is suposed to clear */
19 /* this flag prior to signaling the getSem semaphore */
20} fifo_t;
21
22
23/**
24* Get a character from fifo
25* Blocking call.
26* @param fifo pointer to fifo data structure
27* @return character read from fifo
28*/
29u8_t fifoGet(fifo_t * fifo);
30
31/**
32* Get a character from fifo
33* Non blocking call.
34* @param fifo pointer to fifo data structure
35* @return character read from fifo, or < zero if non was available
36*/
37s16_t fifoGetNonBlock(fifo_t * fifo);
38
39/**
40* fifoput is called by the signalhandler when new data has arrived (or some other event is indicated)
41* fifoput reads directly from the serialport and is thus highly dependent on unix arch at this moment
42* @param fifo pointer to fifo data structure
43* @param fd unix file descriptor
44*/
45void fifoPut(fifo_t * fifo, int fd);
46
47/**
48* fifoinit initiate fifo
49* @param fifo pointer to fifo data structure, allocated by the user
50*/
51void fifoInit(fifo_t * fifo);
52
53#endif
54
Note: See TracBrowser for help on using the repository browser.