Пример #1
0
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
                                    const uint8_t UECFG0XData,
                                    const uint8_t UECFG1XData)
{
#if defined(CONTROL_ONLY_DEVICE)
	Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
	Endpoint_EnableEndpoint();

	UECFG1X = 0;
	UECFG0X = UECFG0XData;
	UECFG1X = UECFG1XData;

	return Endpoint_IsConfigured();
#else
	uint8_t UECFG0XTemp[ENDPOINT_TOTAL_ENDPOINTS];
	uint8_t UECFG1XTemp[ENDPOINT_TOTAL_ENDPOINTS];
	
	for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		Endpoint_SelectEndpoint(EPNum);
		UECFG0XTemp[EPNum] = UECFG0X;
		UECFG1XTemp[EPNum] = UECFG1X;
	}
	
	UECFG0XTemp[Number] = UECFG0XData;
	UECFG1XTemp[Number] = UECFG1XData;
	
	for (uint8_t EPNum = 1; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		Endpoint_SelectEndpoint(EPNum);	
		UEIENX  = 0;
		UEINTX  = 0;
		UECFG1X = 0;
		Endpoint_DisableEndpoint();
	}

	for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		if (!(UECFG1XTemp[EPNum] & (1 << ALLOC)))
		  continue;
		
		Endpoint_SelectEndpoint(EPNum);		
		Endpoint_EnableEndpoint();

		UECFG0X = UECFG0XTemp[EPNum];
		UECFG1X = UECFG1XTemp[EPNum];
		
		if (!(Endpoint_IsConfigured()))
		  return false;
	}
	
	Endpoint_SelectEndpoint(Number);
	return true;
#endif
}
Пример #2
0
void Endpoint_ClearEndpoints(void)
{
	for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		Endpoint_SelectEndpoint(EPNum);
		(&AVR32_USBB.uecfg0)[EPNum]    = 0;
		(&AVR32_USBB.uecon0clr)[EPNum] = -1;
		USB_Endpoint_FIFOPos[EPNum]    = &AVR32_USBB_SLAVE[EPNum * 0x10000];
		Endpoint_DisableEndpoint();
	}
}
Пример #3
0
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
                                    const uint8_t UECFG0XData,
                                    const uint8_t UECFG1XData)
{
#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG)
	Endpoint_SelectEndpoint(Number);
	Endpoint_EnableEndpoint();

//	UECFG1X = 0;
//	UECFG0X = UECFG0XData;
//	UECFG1X = UECFG1XData;

	return Endpoint_IsConfigured();
#else	
	for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
//		uint8_t UECFG0XTemp;
//		uint8_t UECFG1XTemp;
//		uint8_t UEIENXTemp;

		Endpoint_SelectEndpoint(EPNum);
		
		if (EPNum == Number)
		{
//			UECFG0XTemp = UECFG0XData;
//			UECFG1XTemp = UECFG1XData;
//			UEIENXTemp  = 0;
		}
		else
		{
//			UECFG0XTemp = UECFG0X;
//			UECFG1XTemp = UECFG1X;
//			UEIENXTemp  = UEIENX;
		}

//		if (!(UECFG1XTemp & (1 << ALLOC)))
//		  continue;

		Endpoint_DisableEndpoint();
//		UECFG1X &= ~(1 << ALLOC);

		Endpoint_EnableEndpoint();
//		UECFG0X = UECFG0XTemp;
//		UECFG1X = UECFG1XTemp;
//		UEIENX  = UEIENXTemp;
			
		if (!(Endpoint_IsConfigured()))
		  return false;			
	}
	
	Endpoint_SelectEndpoint(Number);
	return true;
#endif
}
Пример #4
0
void Endpoint_ClearEndpoints(uint8_t corenum)
{
	//	UEINT = 0;

	for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS(corenum); EPNum++) {
		Endpoint_SelectEndpoint(corenum, EPNum);
		//		UEIENX  = 0;
		//		UEINTX  = 0;
		//		UECFG1X = 0;
		Endpoint_DisableEndpoint();
	}
}
Пример #5
0
void Endpoint_ClearEndpoints(void)
{
	UEINT = 0;

	for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		Endpoint_SelectEndpoint(EPNum);	
		UEIENX = 0;
		UEINTX = 0;
		Endpoint_DeallocateMemory();
		Endpoint_DisableEndpoint();
	}
}
Пример #6
0
void Endpoint_ClearEndpoints(void)
{
	UEINT = 0;
	uint8_t EPNum;
	
	for ( EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		Endpoint_SelectEndpoint(EPNum);	
		UEIENX  = 0;
		UEINTX  = 0;
		UECFG1X = 0;
		Endpoint_DisableEndpoint();
	}
}
Пример #7
0
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
                                    const uint32_t UECFG0Data)
{
	USB_Endpoint_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];

#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG)
	Endpoint_SelectEndpoint(Number);
	Endpoint_EnableEndpoint();

	(&AVR32_USBB.uecfg0)[Number] = 0;
	(&AVR32_USBB.uecfg0)[Number] = UECFG0Data;

	return Endpoint_IsConfigured();
#else
	for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
	{
		uint32_t UECFG0Temp;

		Endpoint_SelectEndpoint(EPNum);

		if (EPNum == Number)
		{
			UECFG0Temp = UECFG0Data;
		}
		else
		{
			UECFG0Temp = (&AVR32_USBB.uecfg0)[EPNum];
		}

		if (!(UECFG0Temp & AVR32_USBB_ALLOC_MASK))
		  continue;

		Endpoint_DisableEndpoint();
		(&AVR32_USBB.uecfg0)[EPNum] &= ~AVR32_USBB_ALLOC_MASK;

		Endpoint_EnableEndpoint();
		(&AVR32_USBB.uecfg0)[EPNum] = UECFG0Temp;

		if (!(Endpoint_IsConfigured()))
		  return false;
	}

	Endpoint_SelectEndpoint(Number);
	return true;
#endif
}