Revision f3ac1c96 core/inc/aos_iostream.h
core/inc/aos_iostream.h | ||
---|---|---|
32 | 32 |
#include <stdarg.h> |
33 | 33 |
|
34 | 34 |
|
35 |
/******************************************************************************/ |
|
36 |
/* CONSTANTS */ |
|
37 |
/******************************************************************************/ |
|
35 | 38 |
|
36 | 39 |
/** |
37 | 40 |
* @brief Channel flag to indicate whether the channel is attached to a stream. |
38 | 41 |
*/ |
39 |
#define AOS_IOCHANNEL_ATTACHED (1 << 0)
|
|
42 |
#define AOS_IOCHANNEL_ATTACHED ((aos_iochannelflag_t)(1 << 0))
|
|
40 | 43 |
|
41 | 44 |
/** |
42 | 45 |
* @brief Channel flag to indicate whether the channel is set as input. |
43 | 46 |
*/ |
44 |
#define AOS_IOCHANNEL_INPUT_ENABLE (1 << 1)
|
|
47 |
#define AOS_IOCHANNEL_INPUT_ENABLE ((aos_iochannelflag_t)(1 << 1))
|
|
45 | 48 |
|
46 | 49 |
/** |
47 | 50 |
* @brief Channel flag to indicate whether the channel is set as output. |
48 | 51 |
*/ |
49 |
#define AOS_IOCHANNEL_OUTPUT_ENABLE (1 << 2)
|
|
52 |
#define AOS_IOCHANNEL_OUTPUT_ENABLE ((aos_iochannelflag_t)(1 << 2))
|
|
50 | 53 |
|
51 |
/* |
|
52 |
* forward definitions |
|
53 |
*/ |
|
54 |
typedef struct aos_iochannel AosIOChannel; |
|
55 |
typedef struct aos_ostream AosIOStream; |
|
54 |
/******************************************************************************/ |
|
55 |
/* SETTINGS */ |
|
56 |
/******************************************************************************/ |
|
57 |
|
|
58 |
/******************************************************************************/ |
|
59 |
/* CHECKS */ |
|
60 |
/******************************************************************************/ |
|
61 |
|
|
62 |
/******************************************************************************/ |
|
63 |
/* DATA STRUCTURES AND TYPES */ |
|
64 |
/******************************************************************************/ |
|
65 |
|
|
66 |
typedef uint8_t aos_iochannelflag_t; |
|
56 | 67 |
|
57 | 68 |
/** |
58 |
* @brief AosI=Channel specific methods.
|
|
69 |
* @brief AosIOChannel specific methods.
|
|
59 | 70 |
*/ |
60 | 71 |
#define _aos_iochannel_methods \ |
61 | 72 |
_base_asynchronous_channel_methods |
... | ... | |
67 | 78 |
/* pointer to a BaseAsynchronousChannel object */ \ |
68 | 79 |
BaseAsynchronousChannel* asyncchannel; \ |
69 | 80 |
/* pointer to the next channel in a AosIOStream */ \ |
70 |
AosIOChannel* next; \
|
|
81 |
struct aos_iochannel* next; \
|
|
71 | 82 |
/* flags related to the channel */ \ |
72 |
uint8_t flags;
|
|
83 |
aos_iochannelflag_t flags;
|
|
73 | 84 |
|
74 | 85 |
/** |
75 | 86 |
* @extends BaseAsynchronousChannelVMT |
... | ... | |
86 | 97 |
* @brief I/O Channel class. |
87 | 98 |
* @details This class implements an asynchronous I/O channel. |
88 | 99 |
*/ |
89 |
struct aos_iochannel { |
|
100 |
typedef struct aos_iochannel {
|
|
90 | 101 |
/** @brief Virtual Methods Table. */ |
91 | 102 |
const struct AosIOChannelVMT* vmt; |
92 | 103 |
_aos_iochannel_data |
93 |
}; |
|
104 |
} AosIOChannel;
|
|
94 | 105 |
|
95 | 106 |
/** |
96 | 107 |
* @brief AosIOStream methods. |
... | ... | |
121 | 132 |
* @details This class implements an base sequential stream. |
122 | 133 |
* @todo So far only output but no input is supported. |
123 | 134 |
*/ |
124 |
struct aos_ostream { |
|
135 |
typedef struct aos_ostream {
|
|
125 | 136 |
const struct AosIOStreamVMT* vmt; |
126 | 137 |
_aos_iostream_data |
127 |
}; |
|
138 |
} AosIOStream; |
|
139 |
|
|
140 |
/******************************************************************************/ |
|
141 |
/* MACROS */ |
|
142 |
/******************************************************************************/ |
|
143 |
|
|
144 |
/******************************************************************************/ |
|
145 |
/* EXTERN DECLARATIONS */ |
|
146 |
/******************************************************************************/ |
|
128 | 147 |
|
129 | 148 |
#ifdef __cplusplus |
130 | 149 |
extern "C" { |
... | ... | |
141 | 160 |
} |
142 | 161 |
#endif |
143 | 162 |
|
163 |
/******************************************************************************/ |
|
164 |
/* INLINE FUNCTIONS */ |
|
165 |
/******************************************************************************/ |
|
166 |
|
|
144 | 167 |
#endif /* AMIROOS_IOSTREAM_H */ |
145 | 168 |
|
146 | 169 |
/** @} */ |
Also available in: Unified diff