POK
buffer.h
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #ifdef POK_NEEDS_ARINC653_BUFFER
19 
20 
21 /*----------------------------------------------------------------*/
22 /* */
23 /* BUFFER constant and type definitions and management services */
24 /* */
25 /*----------------------------------------------------------------*/
26 
27 #ifndef APEX_BUFFER
28 #define APEX_BUFFER
29 
30 #ifndef POK_NEEDS_ARINC653_PROCESS
31 #define POK_NEEDS_ARINC653_PROCESS
32 #endif
33 
34 #include <arinc653/types.h>
35 #include <arinc653/process.h>
36 
37 #define MAX_NUMBER_OF_BUFFERS SYSTEM_LIMIT_NUMBER_OF_BUFFERS
38 
39 typedef NAME_TYPE BUFFER_NAME_TYPE;
40 
41 typedef APEX_INTEGER BUFFER_ID_TYPE;
42 
43 typedef struct {
44  MESSAGE_RANGE_TYPE NB_MESSAGE;
45  MESSAGE_RANGE_TYPE MAX_NB_MESSAGE;
46  MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE;
47  WAITING_RANGE_TYPE WAITING_PROCESSES;
49 
50 
51 
52 extern void CREATE_BUFFER (
53  /*in */ BUFFER_NAME_TYPE BUFFER_NAME,
54  /*in */ MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE,
55  /*in */ MESSAGE_RANGE_TYPE MAX_NB_MESSAGE,
56  /*in */ QUEUING_DISCIPLINE_TYPE QUEUING_DISCIPLINE,
57  /*out*/ BUFFER_ID_TYPE *BUFFER_ID,
58  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
59 
60 extern void SEND_BUFFER (
61  /*in */ BUFFER_ID_TYPE BUFFER_ID,
62  /*in */ MESSAGE_ADDR_TYPE MESSAGE_ADDR, /* by reference */
63  /*in */ MESSAGE_SIZE_TYPE LENGTH,
64  /*in */ SYSTEM_TIME_TYPE TIME_OUT,
65  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
66 
67 extern void RECEIVE_BUFFER (
68  /*in */ BUFFER_ID_TYPE BUFFER_ID,
69  /*in */ SYSTEM_TIME_TYPE TIME_OUT,
70  /*out*/ MESSAGE_ADDR_TYPE MESSAGE_ADDR,
71  /*out*/ MESSAGE_SIZE_TYPE *LENGTH,
72  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
73 
74 extern void GET_BUFFER_ID (
75  /*in */ BUFFER_NAME_TYPE BUFFER_NAME,
76  /*out*/ BUFFER_ID_TYPE *BUFFER_ID,
77  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
78 
79 extern void GET_BUFFER_STATUS (
80  /*in */ BUFFER_ID_TYPE BUFFER_ID,
81  /*out*/ BUFFER_STATUS_TYPE *BUFFER_STATUS,
82  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
83 
84 #endif
85 #endif