コード例 #1
0
static void USB_Init_Host(uint8_t corenum)
{
	// uint8_t i;

	// for(i=0;i<PIPE_TOTAL_PIPES;i++) PipeInfo[i].PipeHandle=0;

	pipeselected[corenum] = PIPE_CONTROLPIPE;

	USB_HostState[corenum]   = HOST_STATE_Unattached;
	USB_Host_ControlPipeSize[corenum] = PIPE_CONTROLPIPE_DEFAULT_SIZE;

	if (HcdInitDriver(corenum) == HCD_STATUS_OK) {
		USB_IsInitialized = true;
		HAL_EnableUSBInterrupt(corenum);
	}
	else {
		USB_IsInitialized = false;
		HcdDeInitDriver(corenum);
	}

}
コード例 #2
0
ファイル: bsp_NGX.c プロジェクト: magoroku15/nxpUSBlib
uint32_t MassStorage_Cache_Flush(bool appcall)
{
	SPIFIopers opers;
	int res;
	if(cache_update_flag)
	{
		if(appcall) HAL_DisableUSBInterrupt();
		opers.length = CACHE_SIZE;
		opers.scratch = (char*)0;
		opers.protect = 0;
		opers.options = 0;
		/* Write */
		opers.dest = (char *)((disk_block*CACHE_SIZE) + Spifi_obj.base);

		if (res = pSpifi->spifi_program (&Spifi_obj, (char *)disk_cache, &opers)) {
			/*TODO: Program fail */
			while(res);
		}
		cache_update_flag = 0;
		if(appcall) HAL_EnableUSBInterrupt();
	}
	return 0;
}
コード例 #3
0
static void USB_Init_Device(uint8_t corenum)
{
	USB_DeviceState[corenum]          = DEVICE_STATE_Unattached;
	USB_Device_ConfigurationNumber  = 0;

	#if !defined(NO_DEVICE_REMOTE_WAKEUP)
	USB_Device_RemoteWakeupEnabled  = false;
	#endif

	#if !defined(NO_DEVICE_SELF_POWER)
	USB_Device_CurrentlySelfPowered = false;
	#endif

	#if defined(USB_DEVICE_ROM_DRIVER)
	UsbdRom_Init(corenum);
	#else
	Endpoint_ConfigureEndpoint(corenum, ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
							   ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
							   ENDPOINT_BANK_SINGLE);
	#endif
	HAL_EnableUSBInterrupt(corenum);
	HAL_USBConnect(corenum, 1);
}
コード例 #4
0
static void USB_Init_Host(void)
{
	//uint8_t i;

	//for(i=0;i<PIPE_TOTAL_PIPES;i++) PipeInfo[i].PipeHandle=0;

	pipeselected = PIPE_CONTROLPIPE;

	USB_Memory_Init(USBRAM_BUFFER_SIZE); /* TODO currently Memory Management for Host only */

	if(HcdInitDriver(USBPortNum)==HCD_STATUS_OK)
	{
		USB_IsInitialized = true;
		HAL_EnableUSBInterrupt();
	}
	else
	{
		USB_IsInitialized = false;
		HcdDeInitDriver(USBPortNum);
	}

	USB_HostState       = HOST_STATE_Unattached;
	USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
}