add ch376 usb and sd card demo on xidatong-riscv64

This commit is contained in:
wgzAIIT 2022-10-12 12:40:33 +08:00
parent 0f1d2a4868
commit b073c38035
3 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,11 @@ config CH376_SD_FUNCTION
bool "select ch376 sd function" bool "select ch376 sd function"
endchoice endchoice
config CH376_WORK_MODE
hex "ch376 work mode set:0x03 sd,0x06 u-disk"
default 0x03 if CH376_SD_FUNCTION
default 0x06 if CH376_USB_FUNCTION
endif # BSP_USING_CH376 endif # BSP_USING_CH376
menuconfig BSP_USING_CH438 menuconfig BSP_USING_CH438

View File

@ -31,11 +31,13 @@ void CH376Demo(void)
s = mInitCH376Host(); s = mInitCH376Host();
printf ("ch376 init stat=0x%02x\n",(uint16_t)s); printf ("ch376 init stat=0x%02x\n",(uint16_t)s);
#ifdef CONFIG_CH376_USB_FUNCTION
printf( "Wait Udisk/SD\n" ); printf( "Wait Udisk/SD\n" );
while ( CH376DiskConnect( ) != USB_INT_SUCCESS ) while ( CH376DiskConnect( ) != USB_INT_SUCCESS )
{ {
up_mdelay( 100 ); up_mdelay( 100 );
} }
#endif
for ( s = 0; s < 10; s ++ ) for ( s = 0; s < 10; s ++ )
{ {

View File

@ -107,7 +107,7 @@ UINT8 mInitCH376Host(void)
if ( res != 0x9A ) return( ERR_USB_UNKNOWN ); if ( res != 0x9A ) return( ERR_USB_UNKNOWN );
xWriteCH376Cmd(CMD11_SET_USB_MODE); /* SET USB MODE */ xWriteCH376Cmd(CMD11_SET_USB_MODE); /* SET USB MODE */
xWriteCH376Data(0x06); xWriteCH376Data(CONFIG_CH376_WORK_MODE);
up_udelay(20); up_udelay(20);
res = xReadCH376Data(); res = xReadCH376Data();
xEndCH376Cmd(); xEndCH376Cmd();