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 */ }
void main(void) #endif { 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(); #ifdef MCU_MK70F12 sci2_init(); #else sci1_init(); #endif TimerInit(); /* Init polling global variable */ POLL_init(); DisableInterrupts; status = _usb_host_init(HOST_CONTROLLER_NUMBER, /* Use value in header file */ MAX_FRAME_SIZE, /* Frame size per USB spec */ &host_handle); /* Returned pointer */ if(status != USB_OK) { printf("\nUSB Host Initialization failed! STATUS: 0x%x",(unsigned int) status); fflush(stdout); exit(1); } /* ** Since we are going to act as the host driver, register the driver ** information for wanted class/subclass/protocols */ status = _usb_host_driver_info_register(host_handle, (void *)DriverInfoTable); if(status != USB_OK) { printf("\nUSB Initialization driver info failed! STATUS: 0x%x", status); fflush(stdout); exit(1); } EnableInterrupts; printf("\nUSB Printer Host Demo\nWaiting for USB printer to be attached...\n"); fflush(stdout); for(;;) { Poll(); Printer_Task(NULL); __RESET_WATCHDOG(); /* feeds the dog */ } /* Loop forever */ /* Please make sure that you never leave main */ #ifdef __GNUC__ return 0; #endif }
void main(void) #endif { /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */ _bsp_platform_init(); #ifdef MCU_MK70F12 sci2_init(); #else sci1_init(); #endif TimerInit(); /* Init polling global variable */ POLL_init(); /* event for USB callback signaling */ _usb_event_init(&USB_Event); DisableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_dis(); #endif ApplicationInit(); EnableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_en(); #endif fflush(stdout); /* ** Infinite loop, waiting for events requiring action */ for(;;) { Poll(); Main_App_Task(); __RESET_WATCHDOG(); /* feeds the dog */ } #ifdef __GNUC__ return 0; #endif }
void main(void) #endif { USB_STATUS status = USB_OK; _usb_host_handle host_handle; /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */ _bsp_platform_init(); #ifdef MCU_MK70F12 sci2_init(); #else sci1_init(); #endif TimerInit(); /* Init polling global variable */ POLL_init(); DisableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_dis(); #endif status = _usb_host_init (HOST_CONTROLLER_NUMBER, /* Use value in header file */ MAX_FRAME_SIZE, /* Frame size per USB spec */ &host_handle); /* Returned pointer */ if (status != USB_OK) { printf("\nUSB Host Initialization failed. STATUS: 0x%x", (unsigned int) status); } /* Endif */ /* ** Since we are going to act as the host driver, register ** the driver information for wanted class/subclass/protocols */ status = _usb_host_driver_info_register(host_handle, (void *)DriverInfoTable); if (status != USB_OK) { printf("\nDriver Registration failed. STATUS: 0x%x", (unsigned int)status); } EnableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_en(); #endif pCmd.CBW_PTR = (CBW_STRUCT_PTR)USB_mem_alloc_word_aligned(sizeof(CBW_STRUCT)); if (pCmd.CBW_PTR == NULL) { printf ("\nUnable to allocate Command Block Wrapper!"); } memset(pCmd.CBW_PTR, 0, sizeof(CBW_STRUCT)); pCmd.CSW_PTR = (CSW_STRUCT_PTR)USB_mem_alloc_word_aligned(sizeof(CSW_STRUCT)); if (pCmd.CSW_PTR == NULL) { printf ("\nUnable to allocate Command Status Wrapper!"); } memset(pCmd.CSW_PTR, 0, sizeof(CSW_STRUCT)); printf("\nUSB MSD Command test\nWaiting for USB mass storage to be attached...\n"); for(;;) { Main_Task(); Poll(); __RESET_WATCHDOG(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave main */ #ifdef __GNUC__ return 0; #endif }
void main_usb(void) #endif { USB_STATUS status = USB_OK; _usb_host_handle host_handle; /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */ _bsp_platform_init(); #if 0 /* << EST */ #ifdef MCU_MK70F12 sci2_init(); #else sci1_init(); #endif TimerInit(); #endif /* Init polling global variable */ POLL_init(); DisableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_dis(); #endif /* ** It means that we are going to act like host, so we initialize the ** host stack. This call will allow USB system to allocate memory for ** data structures, it uses later (e.g pipes etc.). */ status = _usb_host_init ( HOST_CONTROLLER_NUMBER, /* Use value in header file */ MAX_FRAME_SIZE, /* Frame size per USB spec */ &host_handle); /* Returned pointer */ if (status != USB_OK) { #if 0 /* << EST */ printf("\nUSB Host Initialization failed. STATUS: %%x",(unsigned int) status); fflush(stdout); #endif exit(3); } status = _usb_host_driver_info_register ( host_handle, (void *)DriverInfoTable ); if (status != USB_OK) { #if 0 /* << EST */ printf("\nDriver Registration failed. STATUS: %%x", (unsigned int)status); fflush(stdout); #endif exit(4); } EnableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_en(); #endif #if 0 /* << EST */ printf("\fInitialization passed. Plug-in CDC device to USB port.\nUse ttyb: as the in/out port for CDC device data.\n"); #endif _usb_event_init(&device_registered); uart2usb_num = usb2uart_num = 0; /* reset number of bytes in buffers */ #if 0 /* << EST */ f_usb = (FILE_CDC_PTR)malloc(sizeof(FILE_CDC)); memset(f_usb, 0, sizeof(FILE_CDC)); #else f_usb = (FILE_CDC_PTR)USB_mem_alloc_zero(sizeof(FILE_CDC)); #endif f_usb->DEV_PTR = (IO_DEVICE_STRUCT_PTR)USB_mem_alloc_word_aligned(sizeof(IO_DEVICE_STRUCT)); for(;;) { Poll(); CDC_Task(); #if 0 /* << EST */ __RESET_WATCHDOG(); /* feeds the dog */ #endif } /* loop forever */ /* please make sure that you never leave main */ #ifdef __GNUC__ return 0; #endif }
void main(void) #endif { USB_STATUS status = USB_OK; _usb_host_handle host_handle; boolean send = TRUE; /* Initialize the current platform. Call for the _bsp_platform_init which is specific to each processor family */ _bsp_platform_init(); #ifdef MCU_MK70F12 sci2_init(); #else sci1_init(); #endif TimerInit(); /* Init polling global variable */ POLL_init(); #if (defined(_MCF51MM256_H) || (defined _MCF51JE256_H)) cmt_init(); Mcu_Init(); Kbi_Init(); pwm_init(); #endif #if (defined(__MCF52259_H__) || (defined (__MCF52221_H__)) ||(defined (_MK_xxx_H_)) ) GPIO_Init(); pit0_init(); pwm_init(); #endif #if (defined MCU_mcf51jf128) GPIO_Init(); mtim_init(); pwm_init(); #endif DisableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_dis(); #endif /* ** It means that we are going to act like host, so we initialize the ** host stack. This call will allow USB system to allocate memory for ** data structures, it uses later (e.g pipes etc.). */ status = _usb_host_init ( HOST_CONTROLLER_NUMBER, /* Use value in header file */ MAX_FRAME_SIZE, /* Frame size per USB spec */ &host_handle); /* Returned pointer */ if (status != USB_OK) { printf("\nUSB Host Initialization failed! STATUS: 0x%x", (unsigned int) status); fflush(stdout); exit(3); } status = _usb_host_driver_info_register ( host_handle, (pointer)DriverInfoTable ); if (status != USB_OK) { printf("\nDriver Registration failed! STATUS: 0x%x",(unsigned int) status); fflush(stdout); exit(4); } EnableInterrupts; #if (defined _MCF51MM256_H) || (defined _MCF51JE256_H) usb_int_en(); #endif printf("USB Host Audio Demo\r\nWaitting for USB Audio Device to be attached...\r\n"); _usb_event_init(&USB_Event); for(;;) { Poll(); Audio_Task(); __RESET_WATCHDOG(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave main */ #ifdef __GNUC__ return 0; #endif }