-
Notifications
You must be signed in to change notification settings - Fork 3
/
fifo_test.c
47 lines (40 loc) · 895 Bytes
/
fifo_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* =====================================================================================
*
* Filename: fifo_test.c
*
*
* Version: 1.0
* Created: 2017年02月14日 10时07分25秒
*
* Author: wangzhiqiang (), [email protected]
*
* Description:
*
* =====================================================================================
*/
#include <stdio.h>
#include "kfifo.h"
struct message{
int id;
int type;
};
static DECLARE_KFIFO(fifo,struct message,128);
int main()
{
INIT_KFIFO(fifo);
int buffer[] = {
1,2,
3,4,
5,6,
};
__kfifo_in(&fifo.kfifo,buffer,sizeof(buffer));
struct message m1;
kfifo_get(&fifo,&m1);
printf("m1.id=%d,m1.type=%d\n",m1.id,m1.type);
kfifo_get(&fifo,&m1);
printf("m1.id=%d,m1.type=%d\n",m1.id,m1.type);
kfifo_get(&fifo,&m1);
printf("m1.id=%d,m1.type=%d\n",m1.id,m1.type);
return 0;
}