This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Typedefs | |
typedef void * | rtlnml_t |
typedef rtlnml_t | rtainml_t |
Enumerations | |
enum | RTLNML_SPECIAL_READ_RETURN_VALUES { RTLNML_READ_OLD = 0, RTLNML_READ_ERROR = -1, RTLNML_SPLIT_READ_ERROR = -2 } |
enum | RTLNML_SPECIAL_WRITE_RETURN_VALUES { RTLNML_WRITE_ERROR = -1, RTLNML_WRITE_OK = 0 } |
Functions | |
void | rtlnml_init (void) |
rtlnml_t | rtlnml_open (const char *name, const char *processname, const char *filename, unsigned long size, int master) |
int | rtlnml_get_direct_pointer_for_read (rtlnml_t, void **) |
int | rtlnml_release_direct_pointer_for_read (rtlnml_t, void **) |
int | rtlnml_get_direct_pointer_for_write (rtlnml_t, void **) |
int | rtlnml_release_direct_pointer_for_write (rtlnml_t, void **, long msg_type, unsigned long msg_size) |
long | rtlnml_read (rtlnml_t) |
long | rtlnml_write (rtlnml_t, void *data, long msg_type, unsigned long) |
void * | rtlnml_get_local_pointer (rtlnml_t) |
void | rtlnml_set_local_pointer (rtlnml_t, void *) |
void | rtlnml_close (rtlnml_t, const char *bufname) |
void | rtlnml_exit (void) |
|
|
|
|
|
Definition at line 115 of file rtlnml.h. 00116 { 00117 RTLNML_READ_OLD = 0, 00118 RTLNML_READ_ERROR = -1, 00119 RTLNML_SPLIT_READ_ERROR = -2 00120 }; |
|
Definition at line 122 of file rtlnml.h. 00123 { 00124 RTLNML_WRITE_ERROR = -1, 00125 RTLNML_WRITE_OK = 0 00126 }; |
|
Definition at line 114 of file rtlnml.c. 00115 { 00116 } |
|
Definition at line 145 of file rtlnml.c. Referenced by RTLMEM::RTLMEM().
00158 { 00159 int i; 00160 struct RTLNML *r = NULL; 00161 00162 r = (struct RTLNML *) rtlnml_malloc (sizeof (struct RTLNML)); 00163 if (NULL == r) 00164 { 00165 return NULL; 00166 } 00167 r->header = NULL; 00168 r->mbuff_address = NULL; 00169 r->direct_data_pointer = NULL; 00170 r->local_pointer = NULL; 00171 r->rtlnml_allocated_local_pointer = 0; 00172 r->max_message_size = 0; 00173 r->last_id_read = 0; 00174 00175 #ifdef rtai 00176 r->mbuff_address = rtai_kmalloc (key, size + 16); 00177 r->key = key; 00178 #else 00179 #ifdef linux_rtai 00180 r->mbuff_address = rtai_malloc (key, size + 16); 00181 r->key = key; 00182 #else 00183 r->mbuff_address = mbuff_alloc (name, size + 16); 00184 #endif 00185 #endif 00186 if (NULL == r->mbuff_address) 00187 { 00188 rtlnml_free (r); 00189 return NULL; 00190 } 00191 00192 if (master) 00193 { 00194 for (i = 0; i < size + 16; i++) 00195 { 00196 ((char *) (r->mbuff_address))[i] = 0; 00197 } 00198 } 00199 r->local_pointer = rtlnml_malloc (size); 00200 r->rtlnml_allocated_local_pointer = 1; 00201 r->direct_data_pointer = (void *) (((char *) r->mbuff_address) + 16); 00202 r->header = (struct RTLNML_HEADER *) r->mbuff_address; 00203 r->max_message_size = size; 00204 return r; 00205 } |
|
Definition at line 217 of file rtlnml.c. 00218 { 00219 if (r->last_id_read == r->header->first_message_count) 00220 { 00221 return RTLNML_READ_OLD; 00222 } 00223 if (r->header->first_message_count != r->header->second_message_count) 00224 { 00225 return RTLNML_SPLIT_READ_ERROR; 00226 } 00227 r->last_id_read = r->header->first_message_count; 00228 *p = r->direct_data_pointer; 00229 return r->header->message_type; 00230 } |
|
Definition at line 233 of file rtlnml.c. 00234 { 00235 *p = NULL; 00236 if (r->header->second_message_count != r->last_id_read) 00237 { 00238 return RTLNML_SPLIT_READ_ERROR; 00239 } 00240 return r->header->message_type; 00241 } |
|
Definition at line 244 of file rtlnml.c. 00245 { 00246 r->header->first_message_count++; 00247 *p = r->direct_data_pointer; 00248 return (0); 00249 } |
|
Definition at line 252 of file rtlnml.c. 00254 { 00255 *p = NULL; 00256 r->header->message_type = msg_type; 00257 r->header->message_size = msg_size; 00258 r->header->second_message_count = r->header->first_message_count; 00259 if (msg_size <= r->max_message_size && msg_size > 0) 00260 { 00261 return (-1); 00262 } 00263 return (0); 00264 } |
|
Definition at line 271 of file rtlnml.c. Referenced by RTLMEM::read().
00272 { 00273 long orig_last_id_read = r->last_id_read; 00274 long msg_type; 00275 if (r->last_id_read == r->header->first_message_count) 00276 { 00277 return RTLNML_READ_OLD; 00278 } 00279 if (r->header->first_message_count != r->header->second_message_count) 00280 { 00281 return RTLNML_SPLIT_READ_ERROR; 00282 } 00283 if (r->header->message_size <= 0 00284 || r->header->message_size > r->max_message_size) 00285 { 00286 return RTLNML_READ_ERROR; 00287 } 00288 r->last_id_read = r->header->first_message_count; 00289 msg_type = r->header->message_type; 00290 #ifdef USE_BCOPY 00291 bcopy (r->direct_data_pointer, r->local_pointer, r->header->message_size); 00292 #else 00293 memcpy (r->local_pointer, r->direct_data_pointer, r->header->message_size); 00294 #endif /* ] */ 00295 if (r->last_id_read != r->header->second_message_count) 00296 { 00297 r->last_id_read = orig_last_id_read; 00298 return RTLNML_SPLIT_READ_ERROR; 00299 } 00300 return msg_type; 00301 } |
|
Definition at line 307 of file rtlnml.c. 00310 { 00311 if (msg_size <= 0 || msg_size > r->max_message_size) 00312 { 00313 return RTLNML_WRITE_ERROR; 00314 } 00315 r->header->first_message_count++; 00316 #ifdef USE_BCOPY 00317 bcopy (data, r->direct_data_pointer, msg_size); 00318 #else 00319 memcpy (r->direct_data_pointer, data, msg_size); 00320 #endif 00321 r->header->message_size = msg_size; 00322 r->header->message_type = msg_type; 00323 r->header->second_message_count = r->header->first_message_count; 00324 return (RTLNML_WRITE_OK); 00325 } |
|
Definition at line 330 of file rtlnml.c. 00331 { 00332 return r->local_pointer; 00333 } |
|
Definition at line 337 of file rtlnml.c. Referenced by RTLMEM::RTLMEM().
00338 { 00339 if (NULL != r->local_pointer && r->rtlnml_allocated_local_pointer) 00340 { 00341 rtlnml_free (r->local_pointer); 00342 } 00343 r->rtlnml_allocated_local_pointer = 0; 00344 r->local_pointer = p; 00345 } |
|
Definition at line 349 of file rtlnml.c. Referenced by RTLMEM::~RTLMEM().
00350 { 00351 if (NULL != r) 00352 { 00353 if (NULL != r->mbuff_address) 00354 { 00355 #ifdef rtai 00356 rtai_kfree (r->key); 00357 #else 00358 #ifdef linux_rtai 00359 rtai_free (r->key, r->mbuff_address); 00360 #else 00361 mbuff_free (bufname, r->mbuff_address); 00362 #endif 00363 #endif 00364 r->mbuff_address = NULL; 00365 } 00366 if (NULL != r->local_pointer && r->rtlnml_allocated_local_pointer) 00367 { 00368 rtlnml_free (r->local_pointer); 00369 r->local_pointer = NULL; 00370 } 00371 rtlnml_free (r); 00372 } 00373 } |
|
Definition at line 378 of file rtlnml.c. 00379 { 00380 } |