summaryrefslogtreecommitdiffstats
path: root/c/src/exec/itron/include/itronsys/msgbuffer.h
blob: 7b58a6392497095431b0590753f3bdcd99fe7681 (plain) (blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */

#ifndef __ITRON_MESSAGEBUFFER_h_
#define __ITRON_MESSAGEBUFFER_h_

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  Create Message Buffer (cre_mbf) Structure
 */

typedef struct t_cmbf {
  VP    exinf;    /* extended information */
  ATR   mbfatr;   /* messagebuffer attributes */
  INT   bufsz;    /* messagebuffer size */
  INT   maxmsz;   /* maximum size of messages */
  /* additional information may be included depending on the implementation */
} T_CMBF;

/*
 *  mbfatr
 */

#define TA_TFIFO   0x00   /* tasks waiting to receive messages are handled
                                 by FIFO */
#define TA_TPRI    0x01   /* tasks waiting to receive messages are handled
                                 by priority */

/*
 *  mbfid
 */

#define TMBF_OS   (-4)   /* messagebuffer used for OS error log */
#define TMBF_DB   (-3)   /* messagebuffer used for debugging */

/*
 *  Reference Message Buffer (ref_mbf) Structure
 */

typedef struct t_rmbf {
  VP        exinf;     /* extended information */
  BOOL_ID   wtsk;      /* indicates whether or not there is a */
                       /* task waiting to receive a message */
  BOOL_ID   stsk;      /* indicates whether or not there is a */
                       /* task waiting to send a message */
  INT       msgsz;     /* size of message to be sent next */
  INT       frbufsz;   /* size of free buffer */
  /* additional information may be included depending on the implementation */
} T_RMBF;

/*
 *  Message Buffer Functions
 */

/*
 *  cre_mbf - Create MessageBuffer
 */

ER cre_mbf(
  ID mbfid,
  T_CMBF *pk_cmbf
);

/*
 *  del_mbf - Delete MessageBuffer
 */

ER del_mbf(
  ID mbfid
);

/*
 *  snd_mbf - Send Message to MessageBuffer
 */

ER snd_mbf(
  ID mbfid,
  VP msg,
  INT msgsz
);

/*
 *  psnd_mbf - Poll and Send Message to MessageBuffer
 */

ER psnd_mbf(
  ID mbfid,
  VP msg,
  INT msgsz
);

/*
 *  tsnd_mbf - Send Message to MessageBuffer with Timeout
 */

ER tsnd_mbf(
  ID mbfid,
  VP msg,
  INT msgsz,
  TMO tmout
);

/*
 *  rcv_mbf - Receive Message from MessageBuffer
 */

ER rcv_mbf(
  VP msg,
  INT *p_msgsz,
  ID mbfid
);

/*
 *  prcv_mbf - Poll and Receive Message from MessageBuffer
 */

ER prcv_mbf(
  VP msg,
  INT *p_msgsz,
  ID mbfid
);

/*
 *  trcv_mbf - Receive Message from MessageBuffer with Timeout
 */

ER trcv_mbf(
  VP msg,
  INT *p_msgsz,
  ID mbfid,
  TMO tmout
);

/*
 *  ref_mbf - Reference MessageBuffer Status
 */

ER ref_mbf(
  T_RMBF *pk_rmbf,
  ID mbfid
);

#ifdef __cplusplus
}
#endif

#endif
/* end of include file */