drivers/usbdev/gadget/f_acm_desc.c
int16_t cdcacm_mkcfgdesc(uint8_t *buf, struct usbdev_devinfo_s *devinfo)
{
  int16_t total_len = 0;
  int16_t len = USB_CONFIG_DESC_SIZE;
  errno_t ret;

  g_cdcacm_hs_func_desc.ifcad.bFirstInterface = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.ifcd.bInterfaceNumber = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.cdc_union_desc.bMasterInterface0 = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.ifdd.bInterfaceNumber = (uint8_t)devinfo->ifnobase + 1;
  g_cdcacm_hs_func_desc.cdc_union_desc.bSlaveInterface0 = (uint8_t)devinfo->ifnobase + 1;
  g_cdcacm_hs_func_desc.cdc_call_desc.bDataInterface = (uint8_t)devinfo->ifnobase + 1;

  /* Copy Serial device configure descriptor. */

  ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (const void *)&g_cdcacm_hs_config_desc, (uint32_t)len);
  if (ret != EOK)
    {
      usb_err("memcpy_s fail, ret:%d\n", ret);
      return -1;
    }
  total_len += len;

  /* Copy Serial device function descriptor. */

  buf += USB_CONFIG_DESC_SIZE;
  len = sizeof(g_cdcacm_hs_func_desc);
  ret = memcpy_s(buf, (USB_COMP_EP0_BUFSIZ - total_len), (const void *)&g_cdcacm_hs_func_desc, (uint32_t)len);
  if (ret != EOK)
    {
      usb_err("memcpy_s fail, ret:%d\n", ret);
      return -1;
    }
  total_len += len;

  return total_len;
}
/* ***************************************************************************
 * Name: cdcacm_mkcfgdesc
 *
 * Description:
 *   Construct the configuration descriptor
 *
 * ***************************************************************************
 */
cdcacm_mkcfgdesc
Description:
Construct the configuration descriptor
cdcacm_mkcfgdesc Description : Construct the configuration descriptor
int16_t cdcacm_mkcfgdesc(uint8_t *buf, struct usbdev_devinfo_s *devinfo)
{
  int16_t total_len = 0;
  int16_t len = USB_CONFIG_DESC_SIZE;
  errno_t ret;
  g_cdcacm_hs_func_desc.ifcad.bFirstInterface = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.ifcd.bInterfaceNumber = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.cdc_union_desc.bMasterInterface0 = (uint8_t)devinfo->ifnobase;
  g_cdcacm_hs_func_desc.ifdd.bInterfaceNumber = (uint8_t)devinfo->ifnobase + 1;
  g_cdcacm_hs_func_desc.cdc_union_desc.bSlaveInterface0 = (uint8_t)devinfo->ifnobase + 1;
  g_cdcacm_hs_func_desc.cdc_call_desc.bDataInterface = (uint8_t)devinfo->ifnobase + 1;
  ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (const void *)&g_cdcacm_hs_config_desc, (uint32_t)len);
  if (ret != EOK)
    {
      usb_err("memcpy_s fail, ret:%d\n", ret);
      return -1;
    }
  total_len += len;
  buf += USB_CONFIG_DESC_SIZE;
  len = sizeof(g_cdcacm_hs_func_desc);
  ret = memcpy_s(buf, (USB_COMP_EP0_BUFSIZ - total_len), (const void *)&g_cdcacm_hs_func_desc, (uint32_t)len);
  if (ret != EOK)
    {
      usb_err("memcpy_s fail, ret:%d\n", ret);
      return -1;
    }
  total_len += len;
  return total_len;
}
int16_t cdcacm_mkcfgdesc ( uint8_t * buf , struct usbdev_devinfo_s * devinfo ) { int16_t total_len = 0 ; int16_t len = USB_CONFIG_DESC_SIZE ; errno_t ret ; g_cdcacm_hs_func_desc . ifcad . bFirstInterface = ( uint8_t ) devinfo -> ifnobase ; g_cdcacm_hs_func_desc . ifcd . bInterfaceNumber = ( uint8_t ) devinfo -> ifnobase ; g_cdcacm_hs_func_desc . cdc_union_desc . bMasterInterface0 = ( uint8_t ) devinfo -> ifnobase ; g_cdcacm_hs_func_desc . ifdd . bInterfaceNumber = ( uint8_t ) devinfo -> ifnobase + 1 ; g_cdcacm_hs_func_desc . cdc_union_desc . bSlaveInterface0 = ( uint8_t ) devinfo -> ifnobase + 1 ; g_cdcacm_hs_func_desc . cdc_call_desc . bDataInterface = ( uint8_t ) devinfo -> ifnobase + 1 ; ret = memcpy_s ( buf , USB_COMP_EP0_BUFSIZ , ( const void * ) & g_cdcacm_hs_config_desc , ( uint32_t ) len ) ; if ( ret != EOK ) { usb_err ( " \n " , ret ) ; return -1 ; } total_len += len ; buf += USB_CONFIG_DESC_SIZE ; len = sizeof ( g_cdcacm_hs_func_desc ) ; ret = memcpy_s ( buf , ( USB_COMP_EP0_BUFSIZ - total_len ) , ( const void * ) & g_cdcacm_hs_func_desc , ( uint32_t ) len ) ; if ( ret != EOK ) { usb_err ( " \n " , ret ) ; return -1 ; } total_len += len ; return total_len ; }
Name: cdcacm_mkcfgdesc
 Description:
   Construct the configuration descriptor
Name : cdcacm_mkcfgdesc Description : Construct the configuration descriptor
/* Copy Serial device configure descriptor. */ /* Copy Serial device function descriptor. */