common.c 425 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <printk.h>
#include "system.h"

void die(int task_no, unsigned exitCode)
{
    rtems_status_code status = RTEMS_SUCCESSFUL;

    exitCode = exitCode << 31;
    exitCode |= task_no;
    status = rtems_message_queue_send(Q_id, &exitCode, 4);
    if (status != RTEMS_SUCCESSFUL) {
        printk("[TASK %d] Failed to rtems_message_queue_send, status: %d\n", task_no, status);
    }
    rtems_task_delete(RTEMS_SELF);
}