Ejemplo n.º 1
0
/**
 * Invoked when the configuration of the device changes. Resets the mass
 * storage driver.
 * \param  pMsdDriver  Pointer to MSDDriver instance.
 * \param  cfgnum      New configuration number.
 */
void MSDDriver_ConfigurationChangeHandler(
	uint8_t cfgnum)
{
	USBDDriver *pUsbd = USBD_GetDriver();
	USBConfigurationDescriptor *pDesc;

	if (cfgnum) {
		pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
		MSDFunction_Configure((USBGenericDescriptor *)pDesc,
							  pDesc->wTotalLength);
	}
}
Ejemplo n.º 2
0
/**
 * Invoked whenever the configuration value of a device is changed by the host
 * \param cfgnum Configuration number.
 */
void HIDMSDDriver_ConfigurationChangedHandler(uint8_t cfgnum)
{
    USBDDriver *pUsbd = USBD_GetDriver();
    USBConfigurationDescriptor *pDesc;
    if (cfgnum > 0) {
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
        /* HID */
        HIDDKeyboard_ConfigureFunction((USBGenericDescriptor*)pDesc,
                                        pDesc->wTotalLength);
        /* MSD */
        MSDFunction_Configure((USBGenericDescriptor*)pDesc,
                              pDesc->wTotalLength);
    }
}
Ejemplo n.º 3
0
/**
 * Invoked whenever the configuration value of a device is changed by the host
 * \param cfgnum Configuration number.
 */
void CDCMSDDriver_ConfigurationChangedHandler(unsigned char cfgnum)
{
    USBDDriver *pUsbd = USBD_GetDriver();
    USBConfigurationDescriptor *pDesc;
    if (cfgnum > 0) {
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
        /* CDC */
        CDCDSerial_ConfigureFunction((USBGenericDescriptor*)pDesc,
                                      pDesc->wTotalLength);
        /* MSD */
        MSDFunction_Configure((USBGenericDescriptor*)pDesc,
                              pDesc->wTotalLength);
    }
}
Ejemplo n.º 4
0
/**
 * Handles configureation changed event.
 * \param cfgnum New configuration number
 */
void HIDDMouseDriver_ConfigurationChangedHandler(uint8_t cfgnum)
{
    HIDDMouseDriver * pMouse = &hiddMouseDriver;
    HIDDFunction * pHidd = &pMouse->hidDrv;
    USBDDriver * pUsbd = pHidd->pUsbd;
    USBConfigurationDescriptor *pDesc;

    if (cfgnum > 0) {

        /* Parse endpoints for reports */
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
        HIDDFunction_ParseInterface(pHidd,
                                    (USBGenericDescriptor*)pDesc,
                                    pDesc->wTotalLength);
    }
}
Ejemplo n.º 5
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);
        }
    }
}