message.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:4k
- /*
- * message.h
- *
- * Copyright (C) SGS-THOMSON Microelectronics Ltd. 1997
- *
- * Message passing.
- */
- #ifndef __os20_message_h
- #define __os20_message_h
- #include "semaphor.h" /* Needed for semaphore_t */
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifndef __size_t
- #define __size_t 1
- typedef unsigned int size_t;
- #endif
- struct message_queue_class_s;
- typedef struct message_hdr_s
- {
- struct message_hdr_s* message_hdr_next;
- } message_hdr_t;
- typedef struct message_half_s
- {
- message_hdr_t* message_half_head;
- message_hdr_t* message_half_tail;
- semaphore_t message_half_sem;
- } message_half_t;
- typedef struct message_queue_s
- {
- const struct message_queue_class_s* message_queue_class;
- struct message_queue_s* message_queue_next;
- message_half_t message_queue_free;
- message_half_t message_queue_queue;
- void* message_queue_memory;
- } message_queue_t;
- #define MESSAGE_MEMSIZE_QUEUE(maxMessageSize, maxMessages)
- (((((maxMessageSize) + 3) & ~3) + sizeof(message_hdr_t)) * (maxMessages))
- #ifdef __CORE__
- #pragma ST_translate(message_send, "message_send%os")
- #pragma ST_translate(message_receive, "message_receive%os")
- #pragma ST_translate(message_receive_timeout, "message_receive_timeout%os")
- #pragma ST_translate(message_claim, "message_claim%os")
- #pragma ST_translate(message_claim_timeout, "message_claim_timeout%os")
- #pragma ST_translate(message_release, "message_release%os")
- #pragma ST_translate(message_init_queue, "message_init_queue%os")
- #pragma ST_translate(message_create_queue, "message_create_queue%os")
- #pragma ST_translate(message_init_queue_timeout, "message_init_queue_timeout%os")
- #pragma ST_translate(message_create_queue_timeout, "message_create_queue_timeout%os")
- #pragma ST_translate(message_delete_queue, "message_delete_queue%os")
- #else
- #pragma IMS_translate(message_send, "message_send%os")
- #pragma IMS_translate(message_receive, "message_receive%os")
- #pragma IMS_translate(message_receive_timeout, "message_receive_timeout%os")
- #pragma IMS_translate(message_claim, "message_claim%os")
- #pragma IMS_translate(message_claim_timeout, "message_claim_timeout%os")
- #pragma IMS_translate(message_release, "message_release%os")
- #pragma IMS_translate(message_init_queue, "message_init_queue%os")
- #pragma IMS_translate(message_create_queue, "message_create_queue%os")
- #pragma IMS_translate(message_init_queue_timeout, "message_init_queue_timeout%os")
- #pragma IMS_translate(message_create_queue_timeout, "message_create_queue_timeout%os")
- #pragma IMS_translate(message_delete_queue, "message_delete_queue%os")
- #endif
- void message_send (message_queue_t* MessageQueue, void* Message);
- void* message_receive (message_queue_t* MessageQueue);
- void* message_receive_timeout (message_queue_t* MessageQueue,
- const clock_t* time);
- void* message_claim (message_queue_t* MessageQueue);
- void* message_claim_timeout (message_queue_t* MessageQueue,
- const clock_t* time);
- void message_release (message_queue_t* MessageQueue, void* Message);
- void message_init_queue(message_queue_t* MessageQueue, void* memory,
- size_t ElementSize, unsigned int NoElements);
- message_queue_t* message_create_queue (size_t ElementSize,
- unsigned int NoElements);
- void message_init_queue_timeout(message_queue_t* MessageQueue,
- void* memory, size_t ElementSize, unsigned int NoElements);
- message_queue_t* message_create_queue_timeout(size_t ElementSize,
- unsigned int NoElements);
- void message_delete_queue(message_queue_t* MessageQueue);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __os20_message_h */