/* This function will create an usb alternate setting object. */
ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size)
/* This function will create an usb alternate setting object. */
ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size)
{
    ualtsetting_t setting;
    LOG_D("rt_usbd_altsetting_new");
    RT_ASSERT(desc_size > 0);
    setting = (ualtsetting_t)rt_malloc(sizeof(struct ualtsetting));
    if(setting == RT_NULL)
    {
        rt_kprintf("alloc memory failed\n");
        return RT_NULL;
    }
    setting->desc = rt_malloc(desc_size);
    if (setting->desc == RT_NULL)
    {
        rt_kprintf("alloc desc memory failed\n");
        rt_free(setting);
        return RT_NULL;
    }
    setting->desc_size = desc_size;
    setting->intf_desc = RT_NULL;
    rt_list_init(&setting->ep_list);
    return setting;
}