FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
AIO Message Queue Examples

The AIO message queue library works around opening a message queue with a specific name whose incoming traffic is then handled by the handler function specified. Sending to the message queue is simple through the use of the queue's name. More...

Functions

int xCreateMessageQueueTasks (void)
 Creates the demo message queue task found in async_message_queues.c. More...
 
void vDeleteMessageQueueTasks (void)
 Deletes the demo message queue task found in async_message_queues.c. More...
 

Variables

const char * mq_one_name
 
const char * mq_two_name
 
aIO_handle_t mq_one
 
aIO_handle_t mq_two
 
TaskHandle_t MQDemoTask
 

Detailed Description

The AIO message queue library works around opening a message queue with a specific name whose incoming traffic is then handled by the handler function specified. Sending to the message queue is simple through the use of the queue's name.

Opening a queue

void vMQDemoTask(void *pvParameters)
{
while (1)
{
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
aIO_handle_t aIOOpenMessageQueue(const char *name, long max_msg_num, long max_msg_size, void(*callback)(size_t, char *, void *), void *args)
Definition: AsyncIO.c:361
void MQHandlerOne(size_t read_size, char *buffer, void *args)
Definition: async_message_queues.c:44
#define MSG_QUEUE_BUFFER_SIZE
Definition: async_message_queues.c:33
void vMQDemoTask(void *pvParameters)
Definition: async_message_queues.c:54
void MQHanderTwo(size_t read_size, char *buffer, void *args)
Definition: async_message_queues.c:49
#define MSG_QUEUE_MAX_MSG_COUNT
Definition: async_message_queues.c:34
aIO_handle_t mq_one
Definition: async_message_queues.c:39
const char * mq_one_name
Definition: async_message_queues.c:36
const char * mq_two_name
Definition: async_message_queues.c:37
aIO_handle_t mq_two
Definition: async_message_queues.c:40

Message handler

void MQHandlerOne(size_t read_size, char *buffer, void *args)
{
prints("MQ Recv in first handler: %s\n", buffer);
}
void MQHanderTwo(size_t read_size, char *buffer, void *args)
{
prints("MQ Recv in second handler: %s\n", buffer);
}
void prints(const char *__format,...)
Prints a formatted string to stdout
Definition: gfx_print.c:104

Putting to message queue

if (mq_one) {
aIOMessageQueuePut(mq_one_name, "Hello MQ one");
}
if (mq_two) {
aIOMessageQueuePut(mq_two_name, "Hello MQ two");
}
int aIOMessageQueuePut(const char *mq_name, char *buffer)
Sends the data stored in buffer to the message queue with the provided name.
Definition: AsyncIO.c:258

Function Documentation

◆ vDeleteMessageQueueTasks()

void vDeleteMessageQueueTasks ( void  )

Deletes the demo message queue task found in async_message_queues.c.

◆ xCreateMessageQueueTasks()

int xCreateMessageQueueTasks ( void  )

Creates the demo message queue task found in async_message_queues.c.

Returns
0 on success

Variable Documentation

◆ mq_one

aIO_handle_t mq_one
extern

◆ mq_one_name

const char* mq_one_name
extern

◆ mq_two

aIO_handle_t mq_two
extern

◆ mq_two_name

const char* mq_two_name
extern

◆ MQDemoTask

TaskHandle_t MQDemoTask
extern