forked from xuos/xiuos
fix MountUsb function error
This commit is contained in:
parent
9a818b1ef4
commit
696c9f6fe0
|
@ -35,9 +35,11 @@ menu "aiit-arm32-board feature"
|
|||
|
||||
menu "config board peripheral"
|
||||
config MOUNT_SDCARD
|
||||
bool "mount sd card"
|
||||
bool
|
||||
default n
|
||||
config MOUNT_USB
|
||||
bool
|
||||
default n
|
||||
select BSP_USING_SDIO
|
||||
endmenu
|
||||
endmenu
|
||||
endmenu
|
||||
|
|
|
@ -51,7 +51,6 @@ extern int HwSramInit(void);
|
|||
extern int Stm32HwAdcInit(void);
|
||||
extern int Stm32HwDacInit(void);
|
||||
extern int Stm32HwLcdInit(void);
|
||||
extern int STM32USBHostRegister(void);
|
||||
extern int Stm32HwUsbInit(void);
|
||||
|
||||
static void ClockConfiguration()
|
||||
|
@ -151,7 +150,6 @@ struct InitSequenceDesc _board_init[] =
|
|||
#endif
|
||||
#ifdef BSP_USING_USB
|
||||
#ifdef BSP_USING_STM32_USBH
|
||||
{ "STM32USBHostRegister", STM32USBHostRegister },
|
||||
{ "hw usb", Stm32HwUsbInit },
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
config BSP_USING_STM32_USBH
|
||||
bool "Using usb host"
|
||||
default y
|
||||
default n
|
||||
if BSP_USING_STM32_USBH
|
||||
config USB_BUS_NAME
|
||||
string "usb bus name"
|
||||
|
@ -11,5 +11,15 @@ config BSP_USING_STM32_USBH
|
|||
config USB_DEVICE_NAME
|
||||
string "usb bus device name"
|
||||
default "usb_dev"
|
||||
config MOUNT_USB_FS
|
||||
bool "mount usb file system"
|
||||
default y
|
||||
select MOUNT_USB
|
||||
|
||||
if MOUNT_USB_FS
|
||||
config MOUNT_USB_FS_TYPE
|
||||
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
uint32 UdiskRead_new_api(void *dev, struct BusBlockReadParam *read_param);
|
||||
uint32 UdiskWirte_new_api(void *dev, struct BusBlockWriteParam *write_param);
|
||||
|
||||
#ifdef MOUNT_USB
|
||||
int MountUsb(void)
|
||||
{
|
||||
STM32USBHostRegister();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32 UdiskOpenNewApi(void *dev)
|
||||
{
|
||||
return EOK;
|
||||
|
|
|
@ -71,7 +71,7 @@ extern int HwCh376Init(void);
|
|||
* @description: Mount USB
|
||||
* @return 0
|
||||
*/
|
||||
int MountUSB(void)
|
||||
int MountUsb(void)
|
||||
{
|
||||
if (MountFilesystem(USB_BUS_NAME, USB_DEVICE_NAME, USB_DRIVER_NAME, FSTYPE_CH376, "/") == 0)
|
||||
KPrintf("usb mount to '/'");
|
||||
|
|
|
@ -68,7 +68,7 @@ extern int HwSpiInit(void);
|
|||
* @description: Mount USB
|
||||
* @return 0
|
||||
*/
|
||||
int MountUSB(void)
|
||||
int MountUsb(void)
|
||||
{
|
||||
if (MountFilesystem(USB_BUS_NAME, USB_DEVICE_NAME, USB_DRIVER_NAME, FSTYPE_CH376, "/") == 0)
|
||||
KPrintf("usb mount to '/'\n");
|
||||
|
|
|
@ -42,7 +42,10 @@ menu "ok1052-c feature"
|
|||
|
||||
menu "config board peripheral"
|
||||
config MOUNT_SDCARD
|
||||
bool "mount sd card"
|
||||
bool
|
||||
default n
|
||||
config MOUNT_USB
|
||||
bool
|
||||
default n
|
||||
endmenu
|
||||
|
||||
|
|
|
@ -11,5 +11,15 @@ config BSP_USING_NXP_USBH
|
|||
config USB_DEVICE_NAME
|
||||
string "usb bus device name"
|
||||
default "usb_dev"
|
||||
config MOUNT_USB_FS
|
||||
bool "mount usb file system"
|
||||
default y
|
||||
select MOUNT_USB
|
||||
|
||||
if MOUNT_USB_FS
|
||||
config MOUNT_USB_FS_TYPE
|
||||
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ Modification:
|
|||
extern usb_host_msd_command_instance_t g_MsdCommandInstance;
|
||||
usb_host_handle g_HostHandle;
|
||||
|
||||
static void UsbHostTask(void* parameter);
|
||||
|
||||
extern usb_status_t USB_HostMsdReadApi(usb_host_msd_command_instance_t *msdCommandInstance, uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
extern usb_status_t USB_HostMsdWriteApi(usb_host_msd_command_instance_t *msdCommandInstance, const uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
|
||||
|
@ -148,6 +150,22 @@ void UsbUnmountFileSystem()
|
|||
{
|
||||
UnmountFileSystem(UDISK_MOUNTPOINT);
|
||||
}
|
||||
|
||||
#ifdef MOUNT_USB
|
||||
int MountUsb(void)
|
||||
{
|
||||
int32 usb_host_task = 0;
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static uint32 UsbHostOpen(void *dev)
|
||||
|
@ -258,7 +276,6 @@ static int BoardUsbDevBend(void)
|
|||
int Imxrt1052HwUsbHostInit(void)
|
||||
{
|
||||
x_err_t ret = EOK;
|
||||
int32 usb_host_task = 0;
|
||||
|
||||
static struct UsbBus usb_bus;
|
||||
memset(&usb_bus, 0, sizeof(struct UsbBus));
|
||||
|
@ -280,15 +297,6 @@ int Imxrt1052HwUsbHostInit(void)
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,14 @@ menu "stm32f407-st-discovery feature"
|
|||
default 0x20000000
|
||||
endmenu
|
||||
|
||||
menu "config board peripheral"
|
||||
config MOUNT_SDCARD
|
||||
bool
|
||||
default n
|
||||
config MOUNT_USB
|
||||
bool
|
||||
default n
|
||||
endmenu
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -50,7 +50,6 @@ extern int Stm32HwRtcInit();
|
|||
extern int HwSdioInit();
|
||||
extern int Stm32HwAdcInit(void);
|
||||
extern int Stm32HwDacInit(void);
|
||||
extern int STM32USBHostRegister(void);
|
||||
extern int Stm32HwUsbInit(void);
|
||||
#ifdef BSP_USING_LWIP
|
||||
extern int ETH_BSP_Config();
|
||||
|
@ -143,7 +142,6 @@ struct InitSequenceDesc _board_init[] =
|
|||
#endif
|
||||
#ifdef BSP_USING_USB
|
||||
#ifdef BSP_USING_STM32_USBH
|
||||
{ "STM32USBHostRegister", STM32USBHostRegister },
|
||||
{ "hw usb", Stm32HwUsbInit },
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
config BSP_USING_STM32_USBH
|
||||
bool "Using usb host"
|
||||
default y
|
||||
default n
|
||||
if BSP_USING_STM32_USBH
|
||||
config USB_BUS_NAME
|
||||
string "usb bus name"
|
||||
default "usb"
|
||||
|
@ -9,4 +10,15 @@ config BSP_USING_STM32_USBH
|
|||
default "usb_drv"
|
||||
config USB_DEVICE_NAME
|
||||
string "usb bus device name"
|
||||
default "usb_dev"
|
||||
default "usb_dev"
|
||||
config MOUNT_USB_FS
|
||||
bool "mount usb file system"
|
||||
default y
|
||||
select MOUNT_USB
|
||||
|
||||
if MOUNT_USB_FS
|
||||
config MOUNT_USB_FS_TYPE
|
||||
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
uint32 UdiskRead_new_api(void *dev, struct BusBlockReadParam *read_param);
|
||||
uint32 UdiskWirte_new_api(void *dev, struct BusBlockWriteParam *write_param);
|
||||
|
||||
#ifdef MOUNT_USB
|
||||
int MountUsb(void)
|
||||
{
|
||||
STM32USBHostRegister();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32 UdiskOpenNewApi(void *dev)
|
||||
{
|
||||
return EOK;
|
||||
|
|
|
@ -42,7 +42,10 @@ menu "xidatong-arm32 feature"
|
|||
|
||||
menu "config board peripheral"
|
||||
config MOUNT_SDCARD
|
||||
bool "mount sd card"
|
||||
bool
|
||||
default n
|
||||
config MOUNT_USB
|
||||
bool
|
||||
default n
|
||||
endmenu
|
||||
|
||||
|
|
|
@ -11,5 +11,15 @@ config BSP_USING_NXP_USBH
|
|||
config USB_DEVICE_NAME
|
||||
string "usb bus device name"
|
||||
default "usb_dev"
|
||||
config MOUNT_USB_FS
|
||||
bool "mount usb file system"
|
||||
default y
|
||||
select MOUNT_USB
|
||||
|
||||
if MOUNT_USB_FS
|
||||
config MOUNT_USB_FS_TYPE
|
||||
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ Modification:
|
|||
extern usb_host_msd_command_instance_t g_MsdCommandInstance;
|
||||
usb_host_handle g_HostHandle;
|
||||
|
||||
static void UsbHostTask(void* parameter);
|
||||
|
||||
extern usb_status_t USB_HostMsdReadApi(usb_host_msd_command_instance_t *msdCommandInstance, uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
extern usb_status_t USB_HostMsdWriteApi(usb_host_msd_command_instance_t *msdCommandInstance, const uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
|
||||
|
@ -148,6 +150,22 @@ void UsbUnmountFileSystem()
|
|||
{
|
||||
UnmountFileSystem(UDISK_MOUNTPOINT);
|
||||
}
|
||||
|
||||
#ifdef MOUNT_USB
|
||||
int MountUsb(void)
|
||||
{
|
||||
int32 usb_host_task = 0;
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static uint32 UsbHostOpen(void *dev)
|
||||
|
@ -258,7 +276,6 @@ static int BoardUsbDevBend(void)
|
|||
int Imxrt1052HwUsbHostInit(void)
|
||||
{
|
||||
x_err_t ret = EOK;
|
||||
int32 usb_host_task = 0;
|
||||
|
||||
static struct UsbBus usb_bus;
|
||||
memset(&usb_bus, 0, sizeof(struct UsbBus));
|
||||
|
@ -280,15 +297,6 @@ int Imxrt1052HwUsbHostInit(void)
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ extern int HwWdtInit(void);
|
|||
* @description: Mount USB
|
||||
* @return 0
|
||||
*/
|
||||
int MountUSB(void)
|
||||
int MountUsb(void)
|
||||
{
|
||||
if (MountFilesystem(USB_BUS_NAME, USB_DEVICE_NAME, USB_DRIVER_NAME, FSTYPE_CH376, "/") == 0)
|
||||
KPrintf("usb mount to '/'\n");
|
||||
|
|
|
@ -42,7 +42,10 @@ menu "xiwangtong-arm32 feature"
|
|||
|
||||
menu "config board peripheral"
|
||||
config MOUNT_SDCARD
|
||||
bool "mount sd card"
|
||||
bool
|
||||
default n
|
||||
config MOUNT_USB
|
||||
bool
|
||||
default n
|
||||
endmenu
|
||||
|
||||
|
|
|
@ -11,5 +11,15 @@ config BSP_USING_NXP_USBH
|
|||
config USB_DEVICE_NAME
|
||||
string "usb bus device name"
|
||||
default "usb_dev"
|
||||
config MOUNT_USB_FS
|
||||
bool "mount usb file system"
|
||||
default y
|
||||
select MOUNT_USB
|
||||
|
||||
if MOUNT_USB_FS
|
||||
config MOUNT_USB_FS_TYPE
|
||||
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ Modification:
|
|||
extern usb_host_msd_command_instance_t g_MsdCommandInstance;
|
||||
usb_host_handle g_HostHandle;
|
||||
|
||||
static void UsbHostTask(void* parameter);
|
||||
|
||||
extern usb_status_t USB_HostMsdReadApi(usb_host_msd_command_instance_t *msdCommandInstance, uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
extern usb_status_t USB_HostMsdWriteApi(usb_host_msd_command_instance_t *msdCommandInstance, const uint8_t *buffer, uint32_t pos, uint32_t block_size, uint32_t block_num);
|
||||
|
||||
|
@ -148,6 +150,22 @@ void UsbUnmountFileSystem()
|
|||
{
|
||||
UnmountFileSystem(UDISK_MOUNTPOINT);
|
||||
}
|
||||
|
||||
#ifdef MOUNT_USB
|
||||
int MountUsb(void)
|
||||
{
|
||||
int32 usb_host_task = 0;
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static uint32 UsbHostOpen(void *dev)
|
||||
|
@ -258,7 +276,6 @@ static int BoardUsbDevBend(void)
|
|||
int Imxrt1052HwUsbHostInit(void)
|
||||
{
|
||||
x_err_t ret = EOK;
|
||||
int32 usb_host_task = 0;
|
||||
|
||||
static struct UsbBus usb_bus;
|
||||
memset(&usb_bus, 0, sizeof(struct UsbBus));
|
||||
|
@ -280,15 +297,6 @@ int Imxrt1052HwUsbHostInit(void)
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
usb_host_task = KTaskCreate("usbh", UsbHostTask, NONE,
|
||||
USB_HOST_STACK_SIZE, 8);
|
||||
if(usb_host_task < 0) {
|
||||
KPrintf("usb_host_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
StartupKTask(usb_host_task);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ extern int Lwext4Init(void);
|
|||
extern int LibcSystemInit(void);
|
||||
extern int RtcNtpSyncInit(void);
|
||||
extern int MountSDCard(void);
|
||||
extern int MountUSB(void);
|
||||
extern int MountUsb(void);
|
||||
extern int DfsMountTable(void);
|
||||
extern int userShellInit(void);
|
||||
extern int STM32USBHostRegister(void);
|
||||
|
|
|
@ -117,7 +117,7 @@ struct InitSequenceDesc env_init[] =
|
|||
{ "MountSDCard", MountSDCard },
|
||||
#endif
|
||||
#ifdef MOUNT_USB
|
||||
{ "MountUSB", MountUSB },
|
||||
{ "MountUsb", MountUsb },
|
||||
#endif
|
||||
#ifdef FS_VFS_MNTTABLE
|
||||
{ "DfsMountTable", DfsMountTable },
|
||||
|
|
Loading…
Reference in New Issue