Revision f3ac1c96 core/src/aos_iostream.c

View differences:

core/src/aos_iostream.c
27 27

  
28 28
#include <aos_iostream.h>
29 29

  
30
#include <aos_debug.h>
31
#include <chprintf.h>
30
/******************************************************************************/
31
/* LOCAL DEFINITIONS                                                          */
32
/******************************************************************************/
33

  
34
/******************************************************************************/
35
/* EXPORTED VARIABLES                                                         */
36
/******************************************************************************/
37

  
38
/******************************************************************************/
39
/* LOCAL TYPES                                                                */
40
/******************************************************************************/
41

  
42
/******************************************************************************/
43
/* LOCAL VARIABLES                                                            */
44
/******************************************************************************/
45

  
46
/*
47
 * forward declarations
48
 */
49
static size_t _channelwrite(void *instance, const uint8_t *bp, size_t n);
50
static size_t _channelread(void *instance, uint8_t *bp, size_t n);
51
static msg_t _channelput(void *instance, uint8_t b);
52
static msg_t _channelget(void *instance);
53
static msg_t _channelputt(void *instance, uint8_t b, sysinterval_t time);
54
static msg_t _channelgett(void *instance, sysinterval_t time);
55
static size_t _channelwritet(void *instance, const uint8_t *bp, size_t n, sysinterval_t time);
56
static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, sysinterval_t time);
57
static msg_t _channelctl(void *instance, unsigned int operation, void *arg);
58
static size_t _streamwrite(void *instance, const uint8_t *bp, size_t n);
59
static size_t _stremread(void *instance, uint8_t *bp, size_t n);
60
static msg_t _streamput(void *instance, uint8_t b);
61
static msg_t _streamget(void *instance);
62

  
63
/**
64
 * @brief   Virtual methods table for all AosIOChannel objects.
65
 */
66
static const struct AosIOChannelVMT _channelvmt = {
67
  (size_t) 0,
68
  _channelwrite,
69
  _channelread,
70
  _channelput,
71
  _channelget,
72
  _channelputt,
73
  _channelgett,
74
  _channelwritet,
75
  _channelreadt,
76
  _channelctl,
77
};
78

  
79
/**
80
 * @brief   Virtual methods table for all AosIOStream objects.
81
 */
82
static const struct AosIOStreamVMT _streamvmt = {
83
  (size_t) 0,
84
  _streamwrite,
85
  _stremread,
86
  _streamput,
87
  _streamget,
88
};
89

  
90
/******************************************************************************/
91
/* LOCAL FUNCTIONS                                                            */
92
/******************************************************************************/
32 93

  
33 94
/**
34 95
 * @brief   Implementation of the BaseAsynchronousChannel write() method (inherited from BaseSequentialStream).
......
139 200
}
140 201

  
141 202
/**
142
 * @brief   Virtual methods table for all AosIOChannel objects.
143
 */
144
static const struct AosIOChannelVMT _channelvmt = {
145
  (size_t) 0,
146
  _channelwrite,
147
  _channelread,
148
  _channelput,
149
  _channelget,
150
  _channelputt,
151
  _channelgett,
152
  _channelwritet,
153
  _channelreadt,
154
  _channelctl,
155
};
156

  
157
/**
158 203
 * @brief   Implementation of the BaseSequentialStream write() method.
159 204
 */
160 205
static size_t _streamwrite(void *instance, const uint8_t *bp, size_t n)
......
219 264
  return 0;
220 265
}
221 266

  
222
/**
223
 * @brief   Virtual methods table for all AosIOStream objects.
224
 */
225
static const struct AosIOStreamVMT _streamvmt = {
226
  (size_t) 0,
227
  _streamwrite,
228
  _stremread,
229
  _streamput,
230
  _streamget,
231
};
267
/******************************************************************************/
268
/* EXPORTED FUNCTIONS                                                         */
269
/******************************************************************************/
232 270

  
233 271
/**
234 272
 * @brief   Initializes an aos_iostream_t object.

Also available in: Unified diff