Beispiel #1
0
/* 
    main
    
    Note:
        Program entry, do nessary initialization and lanuch scheduler, in baremetal OSA, it simplely call all tasks in sequence
*/
int main(void)
{
    OSA_Init();
    hardware_init();
    dbg_uart_init();
    comm_init();
	audio_init();
    usb_init();
    OS_Task_create(usb_user_task, NULL, 9L, 3000L, "usb task", NULL);
    OSA_Start();
    
    return 1;
}
Beispiel #2
0
/*FUNCTION*-------------------------------------------------------------
 *
 *  Function Name  : _usb_otg_task_create
 *  Returned Value : error or USB_OK
 *  Comments       :
 *  
 *END*-----------------------------------------------------------------*/
static usb_status _usb_otg_task_create(usb_otg_handle otg_handle)
{
    int32_t task_id;
    task_id = OS_Task_create(USB_OTG_TASK_ADDRESS,
        (void*) otg_handle,
        (uint32_t) USBCFG_OTG_TASK_PRIORITY,
        USB_OTG_TASK_STACKSIZE,
        USB_OTG_TASK_NAME,
        NULL);

    if (task_id == OS_TASK_ERROR)
    {
        return USBERR_UNKNOWN_ERROR;
    }
    g_otg_task_id = task_id;
    return USB_OK;
}
Beispiel #3
0
int main(void)
#endif
{
    hardware_init();
    OSA_Init();
    dbg_uart_init();

#if !(USE_RTOS)
    APP_init();
#endif

    OS_Task_create(Task_Start, NULL, 4L, 3000L, "task_start", NULL);
    OSA_Start();
#if !defined(FSL_RTOS_MQX)
    return 1;
#endif
}
Beispiel #4
0
/*FUNCTION*-------------------------------------------------------------
*
*  Function Name  : _usb_task_create
*  Returned Value : error or USB_OK
*  Comments       :
*        Create devcie task
*END*-----------------------------------------------------------------*/
static usb_status _usb_dev_task_create
(
    usb_device_handle handle
)
{
    //USB_STATUS status;
    //task_id = _task_create_blocked(0, 0, (uint32_t)&task_template);
    usb_dev_state_struct_t*           usb_dev_ptr;
    
    usb_dev_ptr = (usb_dev_state_struct_t*)handle;
    usb_dev_ptr->task_id = OS_Task_create(USB_DEVICE_TASK_ADDRESS, (void*)handle, (uint32_t)USB_DEVICE_TASK_PRIORITY, USB_DEVICE_TASK_STACKSIZE, USB_DEVICE_TASK_NAME, NULL);
    
    if (usb_dev_ptr->task_id == (uint32_t)OS_TASK_ERROR) {
        return USBERR_ERROR;
    }
    
    //_task_ready(_task_get_td(task_id));
    //OS_Task_resume(task_id);

    return USB_OK;
}
Beispiel #5
0
void main(void)
#endif

#endif
{
    hardware_init();
    OSA_Init();
    dbg_uart_init();

#if !(USE_RTOS)
    APP_init();
#endif
    

    OS_Task_create(Task_Start, NULL, 4L, 1000L, "task_start", NULL);

    OSA_Start();
#if (!defined(FSL_RTOS_MQX))&(defined(__CC_ARM) || defined(__GNUC__))
    return 1;
#endif
}
Beispiel #6
0
void APP_init(void)
{
    usb_status status = USB_OK;
    uint32_t opt = 0;

    status = usb_host_init(CONTROLLER_ID, usb_host_board_init, &g_host_handle);
    if (status != USB_OK)
    {
        USB_PRINTF("\r\nUSB Host Initialization failed! STATUS: 0x%x", status);
        return;
    }
    /*
     ** since we are going to act as the host driver, register the driver
     ** information for wanted class/subclass/protocols
     */
    status = usb_host_register_driver_info(g_host_handle, (void *) DriverInfoTable);
    if (status != USB_OK)
    {
        USB_PRINTF("\r\nUSB Initialization driver info failed! STATUS: 0x%x", status);
        return;
    }

    status = usb_host_register_unsupported_device_notify(g_host_handle, usb_host_hid_unsupported_device_event);
    if (status != USB_OK)
    {
        USB_PRINTF("\r\nUSB Initialization driver info failed! STATUS: 0x%x", status);
        return;
    }

    mouse_usb_event = OS_Event_create(0);/* manually clear */
    if (mouse_usb_event == NULL)
    {
        USB_PRINTF("mouse_usb_event create failed\r\n");
        return;
    }
    mouse_hid_com = (hid_command_t*) OS_Mem_alloc_zero(sizeof(hid_command_t));
    if (mouse_hid_com == NULL)
    {
        USB_PRINTF("mouse_hid_com create failed\r\n");
        return;
    }

    kbd_usb_event = OS_Event_create(0);/* manually clear */
    if (kbd_usb_event == NULL)
    {
        USB_PRINTF("kbd_usb_event create failed\r\n");
        return;
    }
    OS_Event_set(kbd_usb_event, USB_EVEN_INIT);
    kbd_hid_com = (hid_command_t*) OS_Mem_alloc_zero(sizeof(hid_command_t));
    if (kbd_hid_com == NULL)
    {
        USB_PRINTF("kbd_hid_com create failed\r\n");
        return;
    }

    if ((uint32_t) OS_TASK_ERROR == OS_Task_create(USB_KEYBOARD_TASK_ADDRESS, (void*) g_host_handle, (uint32_t) USB_KEYBOARD_TASK_PRIORITY, USB_KEYBOARD_TASK_STACKSIZE, USB_KEYBOARD_TASK_NAME, &opt))
    {
        USB_PRINTF("keyboard task create failed\r\n");
        return;
    }

    if ((uint32_t) OS_TASK_ERROR == OS_Task_create(USB_MOUSE_TASK_ADDRESS, (void*) g_host_handle, (uint32_t) USB_MOUSE_TASK_PRIORITY, USB_MOUSE_TASK_STACKSIZE, USB_MOUSE_TASK_NAME, &opt))
    {
        USB_PRINTF("mouse task create failed\r\n");
        return;
    }
    time_init();
    USB_PRINTF("\fUSB HID Mouse+Keyboard\r\nWaiting for USB Mouse or Keyboard to be attached...\r\n");
}