void OS_Application_Startup(void) { uint32 status; OS_API_Init(); OS_printf("OS Application Startup\n"); status = OS_QueueCreate( &msgq_id, "MsgQ", MSGQ_DEPTH, MSGQ_SIZE, 0); if ( status != OS_SUCCESS ) { OS_printf("Error creating Message Queue\n"); } /* ** Create a timer */ status = OS_TimerCreate(&timer_id, "Timer 1", &timer_accuracy, &(TimerFunction)); if ( status != OS_SUCCESS ) { OS_printf("Error creating OS Timer\n"); } else { OS_printf("Timer ID = %d\n", (int)timer_id); OS_printf("Timer Accuracy = %d microseconds \n",(int)timer_accuracy); } /* ** Create the "consumer" task. */ status = OS_TaskCreate( &task_1_id, "Task 1", task_1, task_1_stack, TASK_1_STACK_SIZE, TASK_1_PRIORITY, 0); if ( status != OS_SUCCESS ) { OS_printf("Error creating Task 1\n"); } else { OS_printf("Created Task 1\n"); } /* ** Start the timer */ status = OS_TimerSet(timer_id, timer_start, timer_interval); if ( status != OS_SUCCESS ) { OS_printf("Error calling OS_TimerSet: ID = %d\n", (int)timer_id); } else { OS_printf("Timer programmed\n"); } }
static void nasa_osal_test_002_003_execute(void) { uint32 tid; unsigned i; /* [2.3.1] Creataing a queue with depth 4 and message size 20.*/ test_set_step(1); { int32 err; err = OS_QueueCreate(&qid, "test queue", 4, MESSAGE_SIZE, 0); test_assert(err == OS_SUCCESS, "queue creation failed"); } /* [2.3.2] Creating the writer task.*/ test_set_step(2); { int32 err; err = OS_TaskCreate(&tid, "writer task", test_task_writer, (uint32 *)wa_test1, sizeof wa_test1, TASKS_BASE_PRIORITY, 0); test_assert(err == OS_SUCCESS, "writer task creation failed"); } /* [2.3.3] Reading messages from the writer task.*/ test_set_step(3); { for (i = 0; i < WRITER_NUM_MESSAGES; i++) { int32 err; char data[MESSAGE_SIZE]; uint32 copied; err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_Milli2Ticks(200)); test_assert(err == OS_SUCCESS, "timed out"); test_assert(strncmp(data, "Hello World", sizeof (data)) == 0, "wrong message"); } } /* [2.3.4] Waiting for task termination then checking for errors.*/ test_set_step(4); { (void) OS_TaskWait(tid); tid = 0; test_assert_sequence("", "queue write errors occurred"); } }
void OS_Application_Startup(void) { uint32 status; printf("********If You see this, we got into OS_Application_Startup****\n"); status = OS_QueueCreate( &msgq_id, "MsgQ", MSGQ_DEPTH, MSGQ_SIZE, 0); if ( status != OS_SUCCESS ) { printf("Error creating Message Queue\n"); } status = OS_MutSemCreate( &mutex_id, "Mutex", 0); if ( status != OS_SUCCESS ) { printf("Error creating mutex\n"); } else { printf("MutexSem ID = %d\n",mutex_id); } status = OS_TaskCreate( &task_1_id, "Task 1", task_1, task_1_stack, TASK_1_STACK_SIZE, TASK_1_PRIORITY, 0); if ( status != OS_SUCCESS ) { printf("Error creating Task 1\n"); } status = OS_TaskCreate( &task_2_id, "Task 2", task_2, task_2_stack, TASK_2_STACK_SIZE, TASK_2_PRIORITY, 0); if ( status != OS_SUCCESS ) { printf("Error creating Task 2\n"); } status = OS_TaskCreate( &task_3_id, "Task 3", task_3, task_3_stack, TASK_3_STACK_SIZE, TASK_3_PRIORITY, 0); if ( status != OS_SUCCESS ) { printf("Error creating Task 3\n"); } }
static void nasa_osal_test_002_001_execute(void) { /* [2.1.1] OS_QueueCreate() is invoked with queue_id set to NULL, an error is expected.*/ test_set_step(1); { int32 err; err = OS_QueueCreate(NULL, /* Error.*/ "failing queue", 4, 128, 0); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.1.2] OS_QueueCreate() is invoked with task_name set to NULL, an error is expected.*/ test_set_step(2); { int32 err; uint32 qid; err = OS_QueueCreate(&qid, NULL, /* Error.*/ 4, 128, 0); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.1.3] OS_QueueCreate() is invoked with a very long task name, an error is expected.*/ test_set_step(3); { int32 err; uint32 qid; err = OS_QueueCreate(&qid, "very very long queue name", /* Error.*/ 4, 128, 0); test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected"); } /* [2.1.4] OS_QueueDelete() is invoked with queue_id set to -1, an error is expected.*/ test_set_step(4); { int32 err; err = OS_QueueDelete((uint32)-1); test_assert(err == OS_ERR_INVALID_ID, "wrong queue id not detected"); } /* [2.1.5] OS_QueueCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_QueueDelete().*/ test_set_step(5); { int32 err; uint32 qid1, qid2; err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0); test_assert(err == OS_SUCCESS, "queue creation failed"); err = OS_QueueCreate(&qid2, "my queue", 4, 128, 0); test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected"); err = OS_QueueDelete(qid1); test_assert(err == OS_SUCCESS, "queue deletion failed"); } }
static void nasa_osal_test_002_004_setup(void) { qid = 0; (void) OS_QueueCreate(&qid, "test queue", 2, MESSAGE_SIZE, 0); }
int32 MEMSSIM_HWIF_Init(void) { /* Create a queue for HWIO<-->HWSIM communication */ return OS_QueueCreate(&g_memsio_q_id, "memsio_q", 20, sizeof(mem_veh_msg_t)-sizeof(CFE_SB_TlmHdr_t), 0); }