GeMRTOS
mq.h
Go to the documentation of this file.
1 
21 /******************************************************************************
22 * *
23 * License Agreement *
24 * Copyright (c) Ricardo L. Cayssials *
25 * All rights reserved. *
26 * *
27 ******************************************************************************/
28 
29 // Check https://stackoverflow.com/questions/1154709/how-can-i-hide-the-declaration-of-a-struct-in-c
30 
31 #ifndef MQ_H_
32 #define MQ_H_
33 
34 
35 
42  void *MQ_PBuffer;
50  struct gs_tcb *MQ_CUR_TCB ;
51 };
52 
53 //*************************************************************************************************
55 
58 struct queue_buffer {
66 };
67 
69 #define BUFFER_status_READ 1u
70 #define BUFFER_status_NOT_READ 2u
71 
72 G_RCB *gu_queue_create(void *pbuffer, INT32 buffer_length);
73 GS_ECB *gu_queue_consume(G_RCB *presource, void *pbuffer, INT32 buffer_length, gt_time timeout);
74 INT32 gk_check_consume(GS_ECB * pbuffer);
75 INT32 gk_MQ_move_to_consumer(GS_RRDS *pbuffer_consumer, INT32 start_byte_id, INT32 bytes_count);
78 INT32 gk_MQ_send(G_RCB *prcb, void *pmsg, INT32 msg_length, gt_time timeout);
79 INT32 gu_MQ_receive(GS_ECB *pevent);
83 
84 
85 
86 #endif /* MQ_H__H_ */
Resource::gk_timeout_ECB_MQ_send
INT32 gk_timeout_ECB_MQ_send(GS_ECB *peventime)
This function is called from the timed IRQ when a send timeout G_ECBType_MESSAGE_SEND_WAIT happens.
Definition: mq.c:371
INT32
unsigned INT32
Definition: gemrtos_core.h:62
Resource::gk_timeout_ECB_MQ_consume
INT32 gk_timeout_ECB_MQ_consume(GS_ECB *peventime)
This function is called from the timed IRQ when a consume timeout G_ECBType_MESSAGE_CONSUME_WAIT happ...
Definition: mq.c:386
T_QUEUE_RESOURCE::MQ_priority_send
INT32 MQ_priority_send
Priority for the next ECB to send (to put last)
Definition: mq.h:47
queue_buffer::BUFFER_priority
TIMEPRIORITY BUFFER_priority
Priority assigned to the consumed TCB
Definition: mq.h:64
Resource::gk_MQ_send
INT32 gk_MQ_send(G_RCB *prcb, void *pmsg, INT32 msg_length, gt_time timeout)
Sends a message to all the consumers. The function returns when the message was delivered to all the ...
Definition: mq.c:99
gt_time
unsigned long long gt_time
Definition: gemrtos_core.h:65
queue_buffer::BUFFER_timeout
TIMEPRIORITY BUFFER_timeout
Timeout assigned to the waiting for message
Definition: mq.h:65
queue_buffer
BUFFER CONTROL BLOCK FOR UNION WITH RRDS STRUCT.
Definition: mq.h:58
queue_buffer::BUFFER_pbuffer
void* BUFFER_pbuffer
pointer to the buffer of the message to transmit
Definition: mq.h:60
queue_buffer::BUFFER_buffer_length
INT32 BUFFER_buffer_length
current index to the byte to transfer to resource buffer
Definition: mq.h:61
queue_buffer::BUFFER_msg_seq
INT32 BUFFER_msg_seq
Byte index in the RCB buffer copied
Definition: mq.h:63
gs_tcb
gs_tcb Task Control Block (TCB) structure
Definition: gemrtos_core.h:439
gk_MQ_Read_Sender
INT32 gk_MQ_Read_Sender(void)
T_QUEUE_RESOURCE::MQ_Count_deliver
INT32 MQ_Count_deliver
Number of times a message has to be delivered
Definition: mq.h:43
gu_queue_create
G_RCB* gu_queue_create(void *pbuffer, INT32 buffer_length)
Create a Resource for Queue with default settings.
Definition: mq.c:185
GS_RRDS
struct gs_rrds GS_RRDS
Definition: gemrtos_core.h:53
gk_QUEUE_granted_kill
INT32 gk_QUEUE_granted_kill(GS_ECB *pevent)
Definition: mq.c:396
Resource::gu_queue_consume
GS_ECB* gu_queue_consume(G_RCB *presource, void *pbuffer, INT32 buffer_length, gt_time timeout)
Creates an ECB to consume from a Message Queue.
Definition: mq.c:229
T_QUEUE_RESOURCE
Message Queue Resource.
Definition: mq.h:41
TIMEPRIORITY
union timepriority TIMEPRIORITY
T_QUEUE_RESOURCE::MQ_Buffer_Length
INT32 MQ_Buffer_Length
Length of the buffer
Definition: mq.h:45
queue_buffer::BUFFER_current_byte_index
INT32 BUFFER_current_byte_index
current index to the byte transfered to the buffer
Definition: mq.h:62
T_QUEUE_RESOURCE::MQ_priority_consume
INT32 MQ_priority_consume
Priority for the next ECB to cons (to put last)
Definition: mq.h:48
queue_buffer::BUFFER_status
INT32 BUFFER_status
EMPTY, NEW_MESSAGE, END_OF_MESSAGE, MIDDLE_OF_MESSAGE.
Definition: mq.h:59
GS_ECB
struct gs_ecb GS_ECB
Definition: gemrtos_core.h:51
Resource::gk_check_consume
INT32 gk_check_consume(GS_ECB * pevent)
Transfer message from the resource to the consumer.
Definition: mq.c:285
T_QUEUE_RESOURCE::MQ_PBuffer
void* MQ_PBuffer
Pointer to the buffer
Definition: mq.h:42
G_RCB
struct g_rgb G_RCB
Definition: gemrtos_core.h:54
T_QUEUE_RESOURCE::MQ_CUR_TCB
struct gs_tcb* MQ_CUR_TCB
Pointer to the task of the TCB that send cur msg.
Definition: mq.h:50
gk_MQ_move_to_consumer
INT32 gk_MQ_move_to_consumer(GS_RRDS *pbuffer_consumer, INT32 start_byte_id, INT32 bytes_count)
gu_MQ_consumer_mark_read
INT32 gu_MQ_consumer_mark_read(GS_ECB * pevent)
Mark the current buffer as read.
Definition: mq.c:331
T_QUEUE_RESOURCE::MQ_msg_seq
INT32 MQ_msg_seq
Number of sequence of the current message
Definition: mq.h:49
T_QUEUE_RESOURCE::MQ_consumer_count
INT32 MQ_consumer_count
Number of times a message was delivered
Definition: mq.h:44
gu_MQ_receive
INT32 gu_MQ_receive(GS_ECB *pevent)
T_QUEUE_RESOURCE::MQ_msg_Length
INT32 MQ_msg_Length
Length of the current message
Definition: mq.h:46