void EventB ( uint32_t parameter ) { _mqx_uint event_result; void *Event1_handle; /* open connection to event event.Event1 */ event_result = _event_open("event.Event1",&Event1_handle); if (event_result != MQX_OK) { /* could not open event.Event1 */ } /* endif */ /* ** LOOP - */ while ( TRUE ) { /* wait on event event.Event1 */ event_result = _event_wait_all_ticks(Event1_handle, 1, NO_TIMEOUT); if (event_result != MQX_OK) { /* waiting on event event.Event1 failed */ } /* clear the event bits after processing event */ event_result = _event_clear(Event1_handle, 1); } /* endwhile */ } /*end of task*/
static void event(void) { #if MQX_USE_EVENTS IF_TINIEST(pointer handle=0); IF_TINIEST(_mqx_uint value=0); IF_SMALL(_event_create_component(1, 1, 1)); IF_SMALL(_event_create_fast(1)); IF_SMALL(_event_create_fast_auto_clear(1)); IF_SMALL(_event_open("e", &handle)); IF_SMALL(_event_set(handle, 0)); IF_SMALL(_event_clear(handle, 0)); IF_SMALL(_event_wait_all(handle, 0, 0)); IF_TYPICAL(_event_close(handle)); IF_TYPICAL(_event_create("e")); IF_MAX(_event_create_auto_clear("e")); IF_TYPICAL(_event_destroy("e")); IF_MAX(_event_destroy_fast(1)); IF_MAX(_event_get_value(handle, &value)); IF_MAX(_event_get_wait_count(handle)); IF_MAX(_event_open_fast(1, &handle)); IF_MAX(_event_test(&handle)); IF_MAX(_event_wait_all_for(handle, 0, NULL)); IF_TYPICAL(_event_wait_all_ticks(handle, 0, 0)); IF_MAX(_event_wait_all_until(handle, 0, NULL)); IF_MAX(_event_wait_any(handle, 0, 0)); IF_MAX(_event_wait_any_for(handle, 0, NULL)); IF_TYPICAL(_event_wait_any_ticks(handle, 0, 0)); IF_MAX(_event_wait_any_until(handle, 0, NULL)); #endif }
void service_task ( uint32_t initial_data ) { void *event_ptr; _task_id second_task_id; /* Set up an event group */ if (_event_create("event.global") != MQX_OK) { printf("\nMake event failed"); _task_block(); } if (_event_open("event.global", &event_ptr) != MQX_OK) { printf("\nOpen event failed"); _task_block(); } /* Create the ISR task */ second_task_id = _task_create(0, ISR_TASK, 0); if (second_task_id == MQX_NULL_TASK_ID) { printf("Could not create simulated_ISR_task \n"); _task_block(); } while (TRUE) { if (_event_wait_all_ticks(event_ptr, 0x01, 0) != MQX_OK) { printf("\nEvent Wait failed"); _task_block(); } if (_event_clear(event_ptr,0x01) != MQX_OK) { printf("\nEvent Clear failed"); _task_block(); } printf(" Tick \n"); } }