void main(void) { USB_STATUS status = USB_OK; /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */ _bsp_platform_init(); sci1_init(); sci2_init(); IIC_ModuleInit(); TimerInit(); DisableInterrupts; /* enable interrupt OTG module */ Int_Ctl_int_init(IRQ3_INT_CNTL, IRQ3_ISR_SRC, 2,2, TRUE); MCF_EPORT_EPPAR |= MCF_EPORT_EPPAR_EPPA3_FALLING; /* falling edge */ MCF_EPORT_EPDDR &= ~MCF_EPORT_EPDDR_EPDD3; /* set input*/ MCF_EPORT_EPIER |= MCF_EPORT_EPIER_EPIE3; /* enable interrupts IRQ 3 */ /* set VHost pin ( PUC3) */ MCF_GPIO_DDRUC |= MCF_GPIO_DDRUC_DDRUC3; /* set output */ MCF_GPIO_PUCPAR |= MCF_GPIO_PUCPAR_UCTS2_GPIO; /* set as GPIO */ ENABLE_USB_5V; status = _usb_otg_init(0, (OTG_INIT_STRUCT*)&otg_init, &otg_handle); if(status == USB_OK) { status = _usb_otg_register_callback(otg_handle, App_OtgCallback); } EnableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_en(); #endif printf("\n\rInitialization passed. Plug-in MSD device to USB port"); printf("\n\rPress P to print the menu:"); for(;;) { _usb_otg_task(); if(dev_stack_active) { App_PeripheralTask(); } if(host_stack_active) { App_Host_Task(); } App_HandleUserInput(); __RESET_WATCHDOG(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave main */ }
/************************************************************************** * Function Name : sci_init * Returned Value : None * Comments : Initialize Serial Communication Interface * **************************************************************************/ void sci_init(void) { uart_init(1, SYSTEM_CLOCK_KHZ, kBaud115200); MCF_UART1_UIMR = MCF_UART_UIMR_FFULL_RXRDY; Int_Ctl_int_init(UART1_INT_CNTL , UART1_ISR_SRC , 1 , 1 , TRUE ); }