static void install_timer_interrupt ( void ) { LPM_REGISTRATION_STRUCT registration; uint32_t dummy_handle; uint32_t result; /* Install the timer */ result = hwtimer_init(&lpttimer, &lpt_devif, 0, 2); if (MQX_OK != result) { printf ("\nError during installation of timer interrupt!\n"); _task_block(); } result = hwtimer_set_period(&lpttimer, CM_CLOCK_SOURCE_LPO, 10*1000000); if (MQX_OK != result) { hwtimer_deinit(&lpttimer); printf ("\nError during installation of timer interrupt!\n"); _task_block(); } result = hwtimer_callback_reg(&lpttimer,(HWTIMER_CALLBACK_FPTR)timer_wakeup_isr, NULL); if (MQX_OK != result) { hwtimer_deinit(&lpttimer); printf ("\nError during installation of timer interrupt!\n"); _task_block(); } result = hwtimer_stop(&lpttimer); if (MQX_OK != result) { hwtimer_deinit(&lpttimer); printf ("\nError during installation of timer interrupt!\n"); _task_block(); } /* Registration of timer at LPM for clock frequency changes handling */ registration.CLOCK_CONFIGURATION_CALLBACK = timer_clock_frequency_change; registration.OPERATION_MODE_CALLBACK = NULL; registration.DEPENDENCY_LEVEL = 10; _lpm_register_driver (®istration, (void *)0, &dummy_handle); }
_mqx_uint _io_serial_int_install ( /* [IN] A string that identifies the device for fopen */ char_ptr identifier, /* [IN] The I/O init function */ _mqx_uint (_CODE_PTR_ init)(pointer, char _PTR_), /* [IN] The enable interrupts function */ _mqx_uint (_CODE_PTR_ enable_ints)(pointer), /* [IN] The I/O de-init function */ _mqx_uint (_CODE_PTR_ deinit)(pointer, pointer), /* [IN] The output function */ void (_CODE_PTR_ putc)(pointer, char), /* [IN] The I/O ioctl function */ _mqx_uint (_CODE_PTR_ ioctl)(pointer, _mqx_uint, pointer), /* [IN] The I/O init data pointer */ pointer init_data_ptr, /* [IN] The I/O queue size to use */ _mqx_uint queue_size ) { /* Body */ IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr; uint_32 result; int_io_dev_ptr = _mem_alloc_system_zero( (_mem_size)sizeof(IO_SERIAL_INT_DEVICE_STRUCT)); #if MQX_CHECK_MEMORY_ALLOCATION_ERRORS if (int_io_dev_ptr == NULL) { return(MQX_OUT_OF_MEMORY); } /* Endif */ #endif _mem_set_type(int_io_dev_ptr,MEM_TYPE_IO_SERIAL_INT_DEVICE_STRUCT); int_io_dev_ptr->DEV_INIT = init; int_io_dev_ptr->DEV_ENABLE_INTS = enable_ints; int_io_dev_ptr->DEV_DEINIT = deinit; int_io_dev_ptr->DEV_PUTC = putc; int_io_dev_ptr->DEV_IOCTL = ioctl; int_io_dev_ptr->DEV_INIT_DATA_PTR = init_data_ptr; int_io_dev_ptr->QUEUE_SIZE = queue_size; result = _io_dev_install(identifier, _io_serial_int_open, _io_serial_int_close, _io_serial_int_read, _io_serial_int_write, _io_serial_int_ioctl, (pointer)int_io_dev_ptr); #if MQX_ENABLE_LOW_POWER if (MQX_OK == result) { LPM_REGISTRATION_STRUCT registration; registration.CLOCK_CONFIGURATION_CALLBACK = _io_serial_int_clock_configuration_callback; registration.OPERATION_MODE_CALLBACK = _io_serial_int_operation_mode_callback; registration.DEPENDENCY_LEVEL = BSP_LPM_DEPENDENCY_LEVEL_SERIAL_INT; result = _lpm_register_driver (®istration, int_io_dev_ptr, &(int_io_dev_ptr->LPM_INFO.REGISTRATION_HANDLE)); if (MQX_OK == result) { _lwsem_create (&(int_io_dev_ptr->LPM_INFO.LOCK), 1); int_io_dev_ptr->LPM_INFO.FLAGS = 0; } } #endif return result; } /* Endbody */