#ifndef __ICQ_TASK_H #define __ICQ_TASK_H #include #include "system.h" #include "icq_queue.h" #include "icq_configuration.h" #include "icq_task_report.h" struct icq_task_t { rtems_id task_id; rtems_id msg_queue_id; rtems_id timer_id; char name[4]; #ifdef ICQ_SINGLE_QUEUE icq_queue_t *intercore_queue; #endif #ifdef ICQ_MULTI_QUEUE icq_queue_t *intercore_queue[CONFIGURE_MAXIMUM_PROCESSORS]; #endif struct icq_task_t *receiver_tasks[CONFIGURE_ICQ_MAXIMUM_RECEIVERTASKS]; uint32_t msg_sent[CONFIGURE_ICQ_MAXIMUM_RECEIVERTASKS]; uint32_t receiver_counter; uint32_t period; uint32_t cpu; icq_task_report_t *task_report; }; typedef struct icq_task_t icq_task_t; icq_task_t* icq_task_init(char name[4], uint32_t period, uint32_t cpu, uint32_t receiver, void* func); uint32_t icq_task_add_receiver(char senderName[4], char receiverName[4]); uint32_t icq_task_send_message(char receiverTask[4]); icq_task_t* icq_task_get_by_id(rtems_id task_id); icq_task_t* icq_task_get_by_name(char task_name[4]); void icq_task_launch_application(void); #define DEFINE_ICQ_PROCESS_BEGINNING(icq_process) \ rtems_task icq_process(rtems_task_argument argument){\ icq_message_t msg;\ size_t msg_size;\ icq_task_t* task_self = icq_task_get_by_id(rtems_task_self());\ do{\ rtems_status_code status =rtems_message_queue_receive(argument, &msg, &msg_size, RTEMS_WAIT, RTEMS_NO_TIMEOUT);\ icq_task_report_add_event(task_self->task_report, EXECUTING);\ #define DEFINE_ICQ_PROCESS_ENDING(icq_process) \ icq_task_report_add_event(task_self->task_report, STOPPED);\ }while(1);\ }\ #endif