예제 #1
0
파일: CDCDSerial.c 프로젝트: modul/iris
/**
 * Invoked whenever the device is changed by the
 * host.
 * \pDescriptors Pointer to the descriptors for function configure.
 * \wLength      Length of descriptors in number of bytes.
 */
void CDCDSerial_ConfigureFunction(USBGenericDescriptor *pDescriptors,
                                  uint16_t wLength)
{
    CDCDSerialPort *pCdcd = &cdcdSerial;
    CDCDSerialPort_ParseInterfaces(pCdcd,
                                   (USBGenericDescriptor*)pDescriptors,
                                   wLength);
}
예제 #2
0
/**
 * Invoked whenever the active configuration of device is changed by the
 * host.
 * \param cfgnum Configuration number.
 */
void DUALCDCDDriver_ConfigurationChangeHandler(uint8_t cfgnum)
{
    CDCDSerialPort *pCdcd = &dualcdcdDriver.cdcdSerialPort[0];
    USBDDriver *pUsbd = pCdcd->pUsbd;
    USBConfigurationDescriptor *pDesc;
    USBGenericDescriptor *pD;
    uint32_t i, len;

    if (cfgnum > 0) {

        /* Parse endpoints for data & notification */
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);

        pD = (USBGenericDescriptor *)pDesc;
        len = pDesc->wTotalLength;

        for (i = 0; i < NUM_PORTS; i ++) {
            pCdcd = &dualcdcdDriver.cdcdSerialPort[i];
            pD = CDCDSerialPort_ParseInterfaces(pCdcd, pD, len);
            len = pDesc->wTotalLength - ((uint32_t)pD - (uint32_t)pDesc);
        }
    }
}