diff --git a/examples/usb-pdf-logger-none-os-ch592/include/peripheral.h b/examples/usb-pdf-logger-none-os-ch592/include/peripheral.h index 516c649..3fdc08d 100644 --- a/examples/usb-pdf-logger-none-os-ch592/include/peripheral.h +++ b/examples/usb-pdf-logger-none-os-ch592/include/peripheral.h @@ -58,8 +58,8 @@ typedef struct uint8_t pdf_data_buf[PDF_TMP_BUF_LEN_MAX+PDF_TMP_BUF_LEN_EXT]; uint8_t UDisk_Down_Buffer[DEF_FLASH_SECTOR_SIZE]; uint8_t UDisk_Pack_Buffer[DEF_UDISK_PACK_64]; - uint8_t DISK_BASE_BUF[DISK_BASE_BUF_LEN]; /* ÍⲿRAMµÄ´ÅÅÌÊý¾Ý»º³åÇø,»º³åÇø³¤¶ÈΪһ¸öÉÈÇøµÄ³¤¶È */ - uint8_t DISK_FAT_BUF[ DISK_BASE_BUF_LEN ]; /* ÍⲿRAMµÄ´ÅÅÌFATÊý¾Ý»º³åÇø,»º³åÇø³¤¶ÈΪһ¸öÉÈÇøµÄ³¤¶È */ + uint8_t DISK_BASE_BUF[DISK_BASE_BUF_LEN]; /* �ⲿRAM�Ĵ������ݻ�����,����������Ϊһ�������ij��� */ + uint8_t DISK_FAT_BUF[ DISK_BASE_BUF_LEN ]; /* �ⲿRAM�Ĵ���FAT���ݻ�����,����������Ϊһ�������ij��� */ }PDF_BUFFER_t; diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/include/internal_flash.h b/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/include/internal_flash.h index 5fadb89..f98b32f 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/include/internal_flash.h +++ b/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/include/internal_flash.h @@ -1,5 +1,5 @@ /********************************** (C) COPYRIGHT ******************************* - * File Name : Internal_Flash.h + * File Name : internal_flash.h * Author : WCH * Version : V1.0.0 * Date : 2022/08/08 diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/internal_flash.c b/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/internal_flash.c index 27881f3..f1fb479 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/internal_flash.c +++ b/examples/usb-pdf-logger-none-os-ch592/lib/FLASH/internal_flash.c @@ -9,7 +9,7 @@ * Attention: This software (modified or not) and binary are used for * microcontroller manufactured by Nanjing Qinheng Microelectronics. *******************************************************************************/ -#include "Internal_Flash.h" +#include "internal_flash.h" #include "CH59x_common.h" #include "pdfFile.h" #include "sw_udisk.h" diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/PDF/pdfFile.c b/examples/usb-pdf-logger-none-os-ch592/lib/PDF/pdfFile.c index e256213..64daad6 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/PDF/pdfFile.c +++ b/examples/usb-pdf-logger-none-os-ch592/lib/PDF/pdfFile.c @@ -1,7 +1,7 @@ #include "string.h" #include "pdfFile.h" -#include "SW_UDISK.h" -#include "Internal_Flash.h" +#include "sw_udisk.h" +#include "internal_flash.h" #include "CHRV3UFI.h" #include "usbfs_device.h" #include "spi_flash.h" @@ -185,9 +185,9 @@ void write_file( uint8_t *pData ) #if FUN_FILE_CREATE uint8_t s; - mCmdParam.Write.mSectorCount = 1; //дÈëËùÓÐÉÈÇøµÄÊý¾Ý - mCmdParam.Write.mDataBuffer = pData; //Ö¸ÏòÎļþÊý¾Ý»º³åÇøµÄÆðʼµØÖ· - s = CHRV3FileWrite( ); //ÏòÎļþдÈëÊý¾Ý + mCmdParam.Write.mSectorCount = 1; //��������������� + mCmdParam.Write.mDataBuffer = pData; //ָ���ļ����ݻ���������ʼ��ַ + s = CHRV3FileWrite( ); //���ļ�д������ mStopIfError( s ); #endif } diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/USB/include/sw_udisk.h b/examples/usb-pdf-logger-none-os-ch592/lib/USB/include/sw_udisk.h index a9cbe0d..6e5358e 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/USB/include/sw_udisk.h +++ b/examples/usb-pdf-logger-none-os-ch592/lib/USB/include/sw_udisk.h @@ -1,5 +1,5 @@ /********************************** (C) COPYRIGHT ******************************* - * File Name : SW_UDISK.h + * File Name : sw_udisk.h * Author : WCH * Version : V1.0.0 * Date : 2022/08/08 diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/USB/sw_udisk.c b/examples/usb-pdf-logger-none-os-ch592/lib/USB/sw_udisk.c index d12d381..98c8b1e 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/USB/sw_udisk.c +++ b/examples/usb-pdf-logger-none-os-ch592/lib/USB/sw_udisk.c @@ -15,7 +15,7 @@ #include "sw_udisk.h" #include "spi_flash.h" #include "usbfs_device.h" -#include "Internal_Flash.h" +#include "internal_flash.h" #include "pdfFile.h" #include "peripheral.h" diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/USB/usbfs_device.c b/examples/usb-pdf-logger-none-os-ch592/lib/USB/usbfs_device.c index 48da794..8f0b1e6 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/USB/usbfs_device.c +++ b/examples/usb-pdf-logger-none-os-ch592/lib/USB/usbfs_device.c @@ -11,7 +11,7 @@ *******************************************************************************/ #include "usbfs_device.h" -#include "SW_UDISK.h" +#include "sw_udisk.h" #include "usb_desc.h" #include "pdfFile.h" @@ -57,7 +57,7 @@ __attribute__((aligned(4))) uint8_t TxBuffer[MAX_PACKET_SIZE]; // OUT, must even /********************************************************************* * @fn USB_DeviceInit * - * @brief USBÉ豸¹¦Äܳõʼ»¯£¬4¸ö¶Ëµã£¬8¸öͨµÀ¡£ + * @brief USB�豸���ܳ�ʼ����4���˵㣬8��ͨ���� * * @param none * @@ -78,10 +78,10 @@ void USBFS_DeviceInit(void) R8_UEP3_CTRL = UEP_R_RES_ACK; R8_USB_DEV_AD = 0x00; - R8_USB_CTRL = RB_UC_DEV_PU_EN | RB_UC_INT_BUSY | RB_UC_DMA_EN; // Æô¶¯USBÉ豸¼°DMA£¬ÔÚÖжÏÆÚ¼äÖжϱê־δÇå³ýÇ°×Ô¶¯·µ»ØNAK - R16_PIN_ANALOG_IE |= RB_PIN_USB_IE | RB_PIN_USB_DP_PU; // ·ÀÖ¹USB¶Ë¿Ú¸¡¿Õ¼°ÉÏÀ­µç×è - R8_USB_INT_FG = 0xFF; // ÇåÖжϱêÖ¾ - R8_UDEV_CTRL = RB_UD_PD_DIS | RB_UD_PORT_EN; // ÔÊÐíUSB¶Ë¿Ú + R8_USB_CTRL = RB_UC_DEV_PU_EN | RB_UC_INT_BUSY | RB_UC_DMA_EN; // ����USB�豸��DMA�����ж��ڼ��жϱ�־δ���ǰ�Զ�����NAK + R16_PIN_ANALOG_IE |= RB_PIN_USB_IE | RB_PIN_USB_DP_PU; // ��ֹUSB�˿ڸ��ռ��������� + R8_USB_INT_FG = 0xFF; // ���жϱ�־ + R8_UDEV_CTRL = RB_UD_PD_DIS | RB_UD_PORT_EN; // ����USB�˿� R8_USB_INT_EN = RB_UIE_SUSPEND | RB_UIE_BUS_RST | RB_UIE_TRANSFER; } @@ -215,7 +215,7 @@ uint8_t USBFS_Endp_DataUp(uint8_t endp, uint8_t *pbuf, uint16_t len, uint8_t mod /********************************************************************* * @fn USB_DevTransProcess * - * @brief USB ´«Êä´¦Àíº¯Êý + * @brief USB ���䴦������ * * @return none */ @@ -228,10 +228,10 @@ void USB_DevTransProcess(void) if(intflag & RB_UIF_TRANSFER) { - if((R8_USB_INT_ST & MASK_UIS_TOKEN) != MASK_UIS_TOKEN) // ·Ç¿ÕÏÐ + if((R8_USB_INT_ST & MASK_UIS_TOKEN) != MASK_UIS_TOKEN) // �ǿ��� { switch(R8_USB_INT_ST & (MASK_UIS_TOKEN | MASK_UIS_ENDP)) - // ·ÖÎö²Ù×÷ÁîÅƺͶ˵ãºÅ + // �����������ƺͶ˵�� { /* end-point 0 data in interrupt */ case UIS_TOKEN_IN | DEF_UEP0: @@ -239,12 +239,12 @@ void USB_DevTransProcess(void) switch(USBFS_SetupReqCode) { case USB_GET_DESCRIPTOR: - len = USBFS_SetupReqLen >= DEF_USBD_UEP0_SIZE ? DEF_USBD_UEP0_SIZE : USBFS_SetupReqLen; // ±¾´Î´«Ê䳤¶È - pdf_memcpy(pEP0_DataBuf, pUSBFS_Descr, len); /* ¼ÓÔØÉÏ´«Êý¾Ý */ + len = USBFS_SetupReqLen >= DEF_USBD_UEP0_SIZE ? DEF_USBD_UEP0_SIZE : USBFS_SetupReqLen; // ���δ��䳤�� + pdf_memcpy(pEP0_DataBuf, pUSBFS_Descr, len); /* �����ϴ����� */ USBFS_SetupReqLen -= len; pUSBFS_Descr += len; R8_UEP0_T_LEN = len; - R8_UEP0_CTRL ^= RB_UEP_T_TOG; // ·­×ª + R8_UEP0_CTRL ^= RB_UEP_T_TOG; // ��ת break; case USB_SET_ADDRESS: @@ -253,7 +253,7 @@ void USB_DevTransProcess(void) break; default: - R8_UEP0_T_LEN = 0; // ״̬½×¶ÎÍê³ÉÖжϻòÕßÊÇÇ¿ÖÆÉÏ´«0³¤¶ÈÊý¾Ý°ü½áÊø¿ØÖÆ´«Êä + R8_UEP0_T_LEN = 0; // ״̬�׶�����жϻ�����ǿ���ϴ�0�������ݰ��������ƴ��� R8_UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK; break; } @@ -273,7 +273,7 @@ void USB_DevTransProcess(void) case UIS_TOKEN_OUT | DEF_UEP3: if(R8_USB_INT_ST & RB_UIS_TOG_OK) - { // ²»Í¬²½µÄÊý¾Ý°ü½«¶ªÆú + { // ��ͬ�������ݰ������� R8_UEP3_CTRL ^= RB_UEP_R_TOG; len = R8_USB_RX_LEN; R8_UEP3_CTRL = (R8_UEP3_CTRL & ~MASK_UEP_R_RES) | UEP_R_RES_NAK; @@ -288,7 +288,7 @@ void USB_DevTransProcess(void) R8_USB_INT_FG = RB_UIF_TRANSFER; } - if(R8_USB_INT_ST & RB_UIS_SETUP_ACT) // Setup°ü´¦Àí + if(R8_USB_INT_ST & RB_UIS_SETUP_ACT) // Setup������ { R8_UEP0_CTRL = RB_UEP_R_TOG | RB_UEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_NAK; /* Store All Setup Values */ @@ -327,10 +327,10 @@ void USB_DevTransProcess(void) } else { - errflag = 0xFF; /* ·Ç±ê×¼ÇëÇó */ + errflag = 0xFF; /* �DZ�׼���� */ } } - else /* ±ê×¼ÇëÇó */ + else /* ��׼���� */ { switch(USBFS_SetupReqCode) { @@ -383,7 +383,7 @@ void USB_DevTransProcess(void) break; default: - errflag = 0xFF; // ²»Ö§³ÖµÄ×Ö·û´®ÃèÊö·û + errflag = 0xFF; // ��֧�ֵ��ַ��������� break; } } @@ -394,7 +394,7 @@ void USB_DevTransProcess(void) break; } if(USBFS_SetupReqLen > len) - USBFS_SetupReqLen = len; //ʵ¼ÊÐèÉÏ´«×ܳ¤¶È + USBFS_SetupReqLen = len; //ʵ�����ϴ��ܳ��� len = (USBFS_SetupReqLen >= DEF_USBD_UEP0_SIZE) ? DEF_USBD_UEP0_SIZE : USBFS_SetupReqLen; pdf_memcpy(pEP0_DataBuf, pUSBFS_Descr, len); pUSBFS_Descr += len; @@ -418,7 +418,7 @@ void USB_DevTransProcess(void) case USB_CLEAR_FEATURE: { - if((USBFS_SetupReqType & USB_REQ_RECIP_MASK) == USB_REQ_RECIP_ENDP) // ¶Ëµã + if((USBFS_SetupReqType & USB_REQ_RECIP_MASK) == USB_REQ_RECIP_ENDP) // �˵� { switch(USBFS_SetupReqIndex & 0xff) { @@ -435,7 +435,7 @@ void USB_DevTransProcess(void) R8_UEP1_CTRL = (R8_UEP1_CTRL & ~(RB_UEP_R_TOG | MASK_UEP_R_RES)) | UEP_R_RES_ACK; break; default: - errflag = 0xFF; // ²»Ö§³ÖµÄ¶Ëµã + errflag = 0xFF; // ��֧�ֵĶ˵� break; } } @@ -463,24 +463,24 @@ void USB_DevTransProcess(void) } } - if(errflag == 0xff) // ´íÎó»ò²»Ö§³Ö + if(errflag == 0xff) // �����֧�� { // SetupReqCode = 0xFF; R8_UEP0_CTRL = RB_UEP_R_TOG | RB_UEP_T_TOG | UEP_R_RES_STALL | UEP_T_RES_STALL; // STALL } else { - if(USBFS_SetupReqType & 0x80) // ÉÏ´« + if(USBFS_SetupReqType & 0x80) // �ϴ� { len = (USBFS_SetupReqLen > DEF_USBD_UEP0_SIZE) ? DEF_USBD_UEP0_SIZE : USBFS_SetupReqLen; USBFS_SetupReqLen -= len; } else { - len = 0; // Ï´« + len = 0; // �´� } R8_UEP0_T_LEN = len; - R8_UEP0_CTRL = RB_UEP_R_TOG | RB_UEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK; // ĬÈÏÊý¾Ý°üÊÇDATA1 + R8_UEP0_CTRL = RB_UEP_R_TOG | RB_UEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK; // Ĭ�����ݰ���DATA1 } R8_USB_INT_FG = RB_UIF_TRANSFER; @@ -500,11 +500,11 @@ void USB_DevTransProcess(void) if(R8_USB_MIS_ST & RB_UMS_SUSPEND) { ; - } // ¹ÒÆð + } // ���� else { ; - } // »½ÐÑ + } // ���� R8_USB_INT_FG = RB_UIF_SUSPEND; } else @@ -517,13 +517,13 @@ void USB_DevTransProcess(void) /********************************************************************* * @fn USB_IRQHandler * - * @brief USBÖжϺ¯Êý + * @brief USB�жϺ��� * * @return none */ __INTERRUPT __HIGH_CODE -void USB_IRQHandler(void) /* USBÖжϷþÎñ³ÌÐò,ʹÓüĴæÆ÷×é1 */ +void USB_IRQHandler(void) /* USB�жϷ������,ʹ�üĴ�����1 */ { USB_DevTransProcess(); } diff --git a/examples/usb-pdf-logger-none-os-ch592/lib/USB_LIB/CH592UFI.c b/examples/usb-pdf-logger-none-os-ch592/lib/USB_LIB/CH592UFI.c index 1d782f0..20944a7 100644 --- a/examples/usb-pdf-logger-none-os-ch592/lib/USB_LIB/CH592UFI.c +++ b/examples/usb-pdf-logger-none-os-ch592/lib/USB_LIB/CH592UFI.c @@ -7,51 +7,51 @@ ** KEIL423, gcc 8.20 ** ***************************************** */ -/* CHRV3 UÅÌÖ÷»úÎļþϵͳ½Ó¿Ú, Ö§³Ö: FAT12/FAT16/FAT32 */ +/* CHRV3 U�������ļ�ϵͳ�ӿ�, ֧��: FAT12/FAT16/FAT32 */ -//#define DISK_BASE_BUF_LEN 512 /* ĬÈϵĴÅÅÌÊý¾Ý»º³åÇø´óСΪ512×Ö½Ú(¿ÉÒÔÑ¡ÔñΪ2048ÉõÖÁ4096ÒÔÖ§³ÖijЩ´óÉÈÇøµÄUÅÌ),Ϊ0Ôò½ûÖ¹ÔÚ±¾ÎļþÖж¨Ò建³åÇø²¢ÓÉÓ¦ÓóÌÐòÔÚpDISK_BASE_BUFÖÐÖ¸¶¨ */ -/* Èç¹ûÐèÒª¸´ÓôÅÅÌÊý¾Ý»º³åÇøÒÔ½ÚÔ¼RAM,ÄÇô¿É½«DISK_BASE_BUF_LEN¶¨ÒåΪ0ÒÔ½ûÖ¹ÔÚ±¾ÎļþÖж¨Ò建³åÇø,¶øÓÉÓ¦ÓóÌÐòÔÚµ÷ÓÃCHRV3LibInit֮ǰ½«ÓëÆäËü³ÌÐòºÏÓõĻº³åÇøÆðʼµØÖ·ÖÃÈëpDISK_BASE_BUF±äÁ¿ */ +//#define DISK_BASE_BUF_LEN 512 /* Ĭ�ϵĴ������ݻ�������СΪ512�ֽ�(����ѡ��Ϊ2048����4096��֧��ijЩ��������U��),Ϊ0���ֹ�ڱ��ļ��ж��建��������Ӧ�ó�����pDISK_BASE_BUF��ָ�� */ +/* �����Ҫ���ô������ݻ������Խ�ԼRAM,��ô�ɽ�DISK_BASE_BUF_LEN����Ϊ0�Խ�ֹ�ڱ��ļ��ж��建����,����Ӧ�ó����ڵ���CHRV3LibInit֮ǰ��������������õĻ�������ʼ��ַ����pDISK_BASE_BUF���� */ -#define NO_DEFAULT_ACCESS_SECTOR 1 /* ½ûֹĬÈϵĴÅÅÌÉÈÇø¶Áд×Ó³ÌÐò,ÏÂÃæÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ -//#define NO_DEFAULT_DISK_CONNECT 1 /* ½ûֹĬÈϵļì²é´ÅÅÌÁ¬½Ó×Ó³ÌÐò,ÏÂÃæÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ -//#define NO_DEFAULT_FILE_ENUMER 1 /* ½ûֹĬÈϵÄÎļþÃûö¾Ù»Øµ÷³ÌÐò,ÏÂÃæÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ +#define NO_DEFAULT_ACCESS_SECTOR 1 /* ��ֹĬ�ϵĴ���������д�ӳ���,���������б�д�ij�������� */ +//#define NO_DEFAULT_DISK_CONNECT 1 /* ��ֹĬ�ϵļ����������ӳ���,���������б�д�ij�������� */ +//#define NO_DEFAULT_FILE_ENUMER 1 /* ��ֹĬ�ϵ��ļ���ö�ٻص�����,���������б�д�ij�������� */ #include "CH59x_common.h" #include "CHRV3UFI.h" -#include "Internal_Flash.h" -#include "SW_UDISK.h" +#include "internal_flash.h" +#include "sw_udisk.h" #include "pdfFile.h" #include "spi_flash.h" #include "peripheral.h" -UINT8 CtrlGetConfigDescrTB(void) // »ñÈ¡ÅäÖÃÃèÊö·û,·µ»ØÔÚTxBufferÖÐ +UINT8 CtrlGetConfigDescrTB(void) // ��ȡ����������,������TxBuffer�� { return (CtrlGetConfigDescr()); } -CMD_PARAM_I mCmdParam; /* ÃüÁî²ÎÊý */ +CMD_PARAM_I mCmdParam; /* ������� */ #if DISK_BASE_BUF_LEN > 0 -//UINT8 DISK_BASE_BUF[ DISK_BASE_BUF_LEN ] __attribute__((at(BA_RAM+SZ_RAM/2))); /* ÍⲿRAMµÄ´ÅÅÌÊý¾Ý»º³åÇø,»º³åÇø³¤¶ÈΪһ¸öÉÈÇøµÄ³¤¶È */ -//UINT8 DISK_BASE_BUF[DISK_BASE_BUF_LEN] __attribute__((aligned(4))); /* ÍⲿRAMµÄ´ÅÅÌÊý¾Ý»º³åÇø,»º³åÇø³¤¶ÈΪһ¸öÉÈÇøµÄ³¤¶È */ -//UINT8 DISK_FAT_BUF[ DISK_BASE_BUF_LEN ] __attribute__((aligned (4))); /* ÍⲿRAMµÄ´ÅÅÌFATÊý¾Ý»º³åÇø,»º³åÇø³¤¶ÈΪһ¸öÉÈÇøµÄ³¤¶È */ +//UINT8 DISK_BASE_BUF[ DISK_BASE_BUF_LEN ] __attribute__((at(BA_RAM+SZ_RAM/2))); /* �ⲿRAM�Ĵ������ݻ�����,����������Ϊһ�������ij��� */ +//UINT8 DISK_BASE_BUF[DISK_BASE_BUF_LEN] __attribute__((aligned(4))); /* �ⲿRAM�Ĵ������ݻ�����,����������Ϊһ�������ij��� */ +//UINT8 DISK_FAT_BUF[ DISK_BASE_BUF_LEN ] __attribute__((aligned (4))); /* �ⲿRAM�Ĵ���FAT���ݻ�����,����������Ϊһ�������ij��� */ #endif -/* ÒÔϳÌÐò¿ÉÒÔ¸ù¾ÝÐèÒªÐÞ¸Ä */ +/* ���³�����Ը�����Ҫ�޸� */ -#ifndef NO_DEFAULT_ACCESS_SECTOR /* ÔÚÓ¦ÓóÌÐòÖж¨ÒåNO_DEFAULT_ACCESS_SECTOR¿ÉÒÔ½ûֹĬÈϵĴÅÅÌÉÈÇø¶Áд×Ó³ÌÐò,È»ºóÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ -//if ( use_external_interface ) { // Ìæ»»UÅÌÉÈÇøµ×²ã¶Áд×Ó³ÌÐò -// CHRV3vSectorSize=512; // ÉèÖÃʵ¼ÊµÄÉÈÇø´óС,±ØÐëÊÇ512µÄ±¶Êý,¸ÃÖµÊÇ´ÅÅ̵ÄÉÈÇø´óС -// CHRV3vSectorSizeB=9; // ÉèÖÃʵ¼ÊµÄÉÈÇø´óСµÄλÒÆÊý,512Ôò¶ÔÓ¦9,1024¶ÔÓ¦10,2048¶ÔÓ¦11 -// CHRV3DiskStatus=DISK_MOUNTED; // Ç¿ÖÆ¿éÉ豸Á¬½Ó³É¹¦(Ö»²î·ÖÎöÎļþϵͳ) +#ifndef NO_DEFAULT_ACCESS_SECTOR /* ��Ӧ�ó����ж���NO_DEFAULT_ACCESS_SECTOR���Խ�ֹĬ�ϵĴ���������д�ӳ���,Ȼ�������б�д�ij�������� */ +//if ( use_external_interface ) { // �滻U�������ײ��д�ӳ��� +// CHRV3vSectorSize=512; // ����ʵ�ʵ�������С,������512�ı���,��ֵ�Ǵ��̵�������С +// CHRV3vSectorSizeB=9; // ����ʵ�ʵ�������С��λ����,512���Ӧ9,1024��Ӧ10,2048��Ӧ11 +// CHRV3DiskStatus=DISK_MOUNTED; // ǿ�ƿ��豸���ӳɹ�(ֻ������ļ�ϵͳ) //} -UINT8 CHRV3ReadSector(UINT8 SectCount, PUINT8 DataBuf) /* ´Ó´ÅÅ̶ÁÈ¡¶à¸öÉÈÇøµÄÊý¾Ýµ½»º³åÇøÖÐ */ +UINT8 CHRV3ReadSector(UINT8 SectCount, PUINT8 DataBuf) /* �Ӵ��̶�ȡ������������ݵ��������� */ { UINT8 retry; - // if ( use_external_interface ) return( extReadSector( CHRV3vLbaCurrent, SectCount, DataBuf ) ); /* Íⲿ½Ó¿Ú */ + // if ( use_external_interface ) return( extReadSector( CHRV3vLbaCurrent, SectCount, DataBuf ) ); /* �ⲿ�ӿ� */ for(retry = 0; retry < 3; retry++) - { /* ´íÎóÖØÊÔ */ - pCBW->mCBW_DataLen = (UINT32)SectCount << CHRV3vSectorSizeB; /* Êý¾Ý´«Ê䳤¶È */ + { /* �������� */ + pCBW->mCBW_DataLen = (UINT32)SectCount << CHRV3vSectorSizeB; /* ���ݴ��䳤�� */ pCBW->mCBW_Flag = 0x80; pCBW->mCBW_LUN = CHRV3vCurrentLun; pCBW->mCBW_CB_Len = 10; @@ -65,7 +65,7 @@ pCBW->mCBW_CB_Buf[7] = 0x00; pCBW->mCBW_CB_Buf[8] = SectCount; pCBW->mCBW_CB_Buf[9] = 0x00; - CHRV3BulkOnlyCmd(DataBuf); /* Ö´ÐлùÓÚBulkOnlyЭÒéµÄÃüÁî */ + CHRV3BulkOnlyCmd(DataBuf); /* ִ�л���BulkOnly������� */ if(CHRV3IntStatus == ERR_SUCCESS) { return (ERR_SUCCESS); @@ -76,17 +76,17 @@ return (CHRV3IntStatus); } } - return (CHRV3IntStatus = ERR_USB_DISK_ERR); /* ´ÅÅ̲Ù×÷´íÎó */ + return (CHRV3IntStatus = ERR_USB_DISK_ERR); /* ���̲������� */ } #ifdef EN_DISK_WRITE -UINT8 CHRV3WriteSector(UINT8 SectCount, PUINT8 DataBuf) /* ½«»º³åÇøÖеĶà¸öÉÈÇøµÄÊý¾Ý¿éдÈë´ÅÅÌ */ +UINT8 CHRV3WriteSector(UINT8 SectCount, PUINT8 DataBuf) /* ���������еĶ�����������ݿ�д����� */ { UINT8 retry; - // if ( use_external_interface ) return( extWriteSector( CHRV3vLbaCurrent, SectCount, DataBuf ) ); /* Íⲿ½Ó¿Ú */ + // if ( use_external_interface ) return( extWriteSector( CHRV3vLbaCurrent, SectCount, DataBuf ) ); /* �ⲿ�ӿ� */ for(retry = 0; retry < 3; retry++) - { /* ´íÎóÖØÊÔ */ - pCBW->mCBW_DataLen = (UINT32)SectCount << CHRV3vSectorSizeB; /* Êý¾Ý´«Ê䳤¶È */ + { /* �������� */ + pCBW->mCBW_DataLen = (UINT32)SectCount << CHRV3vSectorSizeB; /* ���ݴ��䳤�� */ pCBW->mCBW_Flag = 0x00; pCBW->mCBW_LUN = CHRV3vCurrentLun; pCBW->mCBW_CB_Len = 10; @@ -100,10 +100,10 @@ pCBW->mCBW_CB_Buf[7] = 0x00; pCBW->mCBW_CB_Buf[8] = SectCount; pCBW->mCBW_CB_Buf[9] = 0x00; - CHRV3BulkOnlyCmd(DataBuf); /* Ö´ÐлùÓÚBulkOnlyЭÒéµÄÃüÁî */ + CHRV3BulkOnlyCmd(DataBuf); /* ִ�л���BulkOnly������� */ if(CHRV3IntStatus == ERR_SUCCESS) { - mDelayuS(200); /* д²Ù×÷ºóÑÓʱ */ + mDelayuS(200); /* д��������ʱ */ return (ERR_SUCCESS); } CHRV3IntStatus = CHRV3AnalyzeError(retry); @@ -112,7 +112,7 @@ return (CHRV3IntStatus); } } - return (CHRV3IntStatus = ERR_USB_DISK_ERR); /* ´ÅÅ̲Ù×÷´íÎó */ + return (CHRV3IntStatus = ERR_USB_DISK_ERR); /* ���̲������� */ } #endif #else @@ -150,15 +150,15 @@ UINT8 CHRV3WriteSector(UINT8 SectCount, PUINT8 DataBuf) /* Write data blocks of } #endif // NO_DEFAULT_ACCESS_SECTOR -#ifndef NO_DEFAULT_DISK_CONNECT /* ÔÚÓ¦ÓóÌÐòÖж¨ÒåNO_DEFAULT_DISK_CONNECT¿ÉÒÔ½ûֹĬÈϵļì²é´ÅÅÌÁ¬½Ó×Ó³ÌÐò,È»ºóÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ +#ifndef NO_DEFAULT_DISK_CONNECT /* ��Ӧ�ó����ж���NO_DEFAULT_DISK_CONNECT���Խ�ֹĬ�ϵļ����������ӳ���,Ȼ�������б�д�ij�������� */ /* -Ô¼¶¨: USBÉ豸µØÖ··ÖÅä¹æÔò(²Î¿¼USB_DEVICE_ADDR) -µØÖ·Öµ É豸λÖà -0x02 ÄÚÖÃRoot-HUB0ϵÄUSBÉ豸»òÍⲿHUB -0x03 ÄÚÖÃRoot-HUB1ϵÄUSBÉ豸»òÍⲿHUB -0x1x ÄÚÖÃRoot-HUB0ϵÄÍⲿHUBµÄ¶Ë¿ÚxϵÄUSBÉ豸,xΪ1~n -0x2x ÄÚÖÃRoot-HUB1ϵÄÍⲿHUBµÄ¶Ë¿ÚxϵÄUSBÉ豸,xΪ1~n +Լ��: USB�豸��ַ�������(�ο�USB_DEVICE_ADDR) +��ֵַ �豸λ�� +0x02 ����Root-HUB0�µ�USB�豸���ⲿHUB +0x03 ����Root-HUB1�µ�USB�豸���ⲿHUB +0x1x ����Root-HUB0�µ��ⲿHUB�Ķ˿�x�µ�USB�豸,xΪ1~n +0x2x ����Root-HUB1�µ��ⲿHUB�Ķ˿�x�µ�USB�豸,xΪ1~n */ //#define UHUB_DEV_ADDR ( CHRV3vRootPort ? R8_USB1_DEV_AD : R8_USB0_DEV_AD ) @@ -172,7 +172,7 @@ UINT8 CHRV3WriteSector(UINT8 SectCount, PUINT8 DataBuf) /* Write data blocks of #define bUMS_ATTACH RB_UMS_DEV_ATTACH #define bUMS_SUSPEND RB_UMS_SUSPEND -/* ¼ì²é´ÅÅÌÊÇ·ñÁ¬½Ó */ +/* �������Ƿ����� */ UINT8 CHRV3DiskConnect(void) { UINT8 ums, devaddr; @@ -180,24 +180,24 @@ UINT8 CHRV3DiskConnect(void) ums = UHUB_MIS_STAT; devaddr = UHUB_DEV_ADDR; if(devaddr == USB_DEVICE_ADDR) - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸 */ - // if ( UHUB_HOST_CTRL & RB_UH_PORT_EN ) { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚÇÒδ²å°Î */ + { /* ����Root-HUB�µ�USB�豸 */ + // if ( UHUB_HOST_CTRL & RB_UH_PORT_EN ) { /* ����Root-HUB�µ�USB�豸������δ��� */ if(ums & bUMS_ATTACH) - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚ */ - // if ( ( UHUB_INT_FLAG & UIF_DETECT ) == 0 ) { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚÇÒδ²å°Î */ + { /* ����Root-HUB�µ�USB�豸���� */ + // if ( ( UHUB_INT_FLAG & UIF_DETECT ) == 0 ) { /* ����Root-HUB�µ�USB�豸������δ��� */ if((ums & bUMS_SUSPEND) == 0) - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚÇÒδ²å°Î */ - return (ERR_SUCCESS); /* USBÉ豸ÒѾ­Á¬½ÓÇÒδ²å°Î */ + { /* ����Root-HUB�µ�USB�豸������δ��� */ + return (ERR_SUCCESS); /* USB�豸�Ѿ�������δ��� */ } else - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚ */ + { /* ����Root-HUB�µ�USB�豸���� */ mDiskConnect: - CHRV3DiskStatus = DISK_CONNECT; /* Ôø¾­¶Ï¿ª¹ý */ - return (ERR_SUCCESS); /* ÍⲿHUB»òUSBÉ豸ÒѾ­Á¬½Ó»òÕ߶ϿªºóÖØÐÂÁ¬½Ó */ + CHRV3DiskStatus = DISK_CONNECT; /* �����Ͽ��� */ + return (ERR_SUCCESS); /* �ⲿHUB��USB�豸�Ѿ����ӻ��߶Ͽ����������� */ } } else - { /* USBÉ豸¶Ï¿ª */ + { /* USB�豸�Ͽ� */ mDiskDisconn: CHRV3DiskStatus = DISK_DISCONNECT; return (ERR_USB_DISCON); @@ -205,43 +205,43 @@ UINT8 CHRV3DiskConnect(void) } #ifndef FOR_ROOT_UDISK_ONLY else if(devaddr > 0x10 && devaddr <= 0x14) - { /* ÍⲿHUBµÄ¶Ë¿ÚϵÄUSBÉ豸 */ - // if ( UHUB_HOST_CTRL & RB_UH_PORT_EN ) { /* ÄÚÖÃRoot-HUBϵÄÍⲿHUB´æÔÚÇÒδ²å°Î */ + { /* �ⲿHUB�Ķ˿��µ�USB�豸 */ + // if ( UHUB_HOST_CTRL & RB_UH_PORT_EN ) { /* ����Root-HUB�µ��ⲿHUB�������� */ if(ums & bUMS_ATTACH) - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚ */ - // if ( ( UHUB_INT_FLAG & UIF_DETECT ) == 0 ) { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚÇÒδ²å°Î */ + { /* ����Root-HUB�µ�USB�豸���� */ + // if ( ( UHUB_INT_FLAG & UIF_DETECT ) == 0 ) { /* ����Root-HUB�µ�USB�豸������δ��� */ if((ums & bUMS_SUSPEND) == 0) - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚÇÒδ²å°Î */ - TxBuffer[MAX_PACKET_SIZE - 1] = devaddr; /* ±¸·Ý */ - UHUB_DEV_ADDR = USB_DEVICE_ADDR - 1 + (UHUB_DEV_ADDR >> 4); /* ÉèÖÃUSBÖ÷»ú¶ËµÄUSBµØÖ·Ö¸ÏòHUB */ - CHRV3IntStatus = HubGetPortStatus(TxBuffer[MAX_PACKET_SIZE - 1] & 0x0F); /* ²éѯHUB¶Ë¿Ú״̬,·µ»ØÔÚTxBufferÖÐ */ + { /* ����Root-HUB�µ�USB�豸������δ��� */ + TxBuffer[MAX_PACKET_SIZE - 1] = devaddr; /* ���� */ + UHUB_DEV_ADDR = USB_DEVICE_ADDR - 1 + (UHUB_DEV_ADDR >> 4); /* ����USB�����˵�USB��ַָ��HUB */ + CHRV3IntStatus = HubGetPortStatus(TxBuffer[MAX_PACKET_SIZE - 1] & 0x0F); /* ��ѯHUB�˿�״̬,������TxBuffer�� */ if(CHRV3IntStatus == ERR_SUCCESS) { if(TxBuffer[2] & (1 << (HUB_C_PORT_CONNECTION - 0x10))) - { /* ¼ì²âµ½HUB¶Ë¿ÚÉϵIJå°Îʼþ */ - CHRV3DiskStatus = DISK_DISCONNECT; /* ¼Ù¶¨ÎªHUB¶Ë¿ÚÉϵÄUSBÉ豸¶Ï¿ª */ - HubClearPortFeature(TxBuffer[MAX_PACKET_SIZE - 1] & 0x0F, HUB_C_PORT_CONNECTION); /* Çå³ýHUB¶Ë¿ÚÁ¬½Óʼþ״̬ */ + { /* ��⵽HUB�˿��ϵIJ���¼� */ + CHRV3DiskStatus = DISK_DISCONNECT; /* �ٶ�ΪHUB�˿��ϵ�USB�豸�Ͽ� */ + HubClearPortFeature(TxBuffer[MAX_PACKET_SIZE - 1] & 0x0F, HUB_C_PORT_CONNECTION); /* ���HUB�˿������¼�״̬ */ } - UHUB_DEV_ADDR = TxBuffer[MAX_PACKET_SIZE - 1]; /* ÉèÖÃUSBÖ÷»ú¶ËµÄUSBµØÖ·Ö¸ÏòUSBÉ豸 */ + UHUB_DEV_ADDR = TxBuffer[MAX_PACKET_SIZE - 1]; /* ����USB�����˵�USB��ַָ��USB�豸 */ if(TxBuffer[0] & (1 << HUB_PORT_CONNECTION)) - { /* Á¬½Ó״̬ */ + { /* ����״̬ */ if(CHRV3DiskStatus < DISK_CONNECT) { - CHRV3DiskStatus = DISK_CONNECT; /* Ôø¾­¶Ï¿ª¹ý */ + CHRV3DiskStatus = DISK_CONNECT; /* �����Ͽ��� */ } - return (ERR_SUCCESS); /* USBÉ豸ÒѾ­Á¬½Ó»òÕ߶ϿªºóÖØÐÂÁ¬½Ó */ + return (ERR_SUCCESS); /* USB�豸�Ѿ����ӻ��߶Ͽ����������� */ } else { // CHRV3DiskStatus = DISK_DISCONNECT; // return( ERR_USB_DISCON ); CHRV3DiskStatus = DISK_CONNECT; - return (ERR_HUB_PORT_FREE); /* HUBÒѾ­Á¬½Óµ«ÊÇHUB¶Ë¿ÚÉÐδÁ¬½Ó´ÅÅÌ */ + return (ERR_HUB_PORT_FREE); /* HUB�Ѿ����ӵ���HUB�˿���δ���Ӵ��� */ } } else { - UHUB_DEV_ADDR = TxBuffer[MAX_PACKET_SIZE - 1]; /* ÉèÖÃUSBÖ÷»ú¶ËµÄUSBµØÖ·Ö¸ÏòUSBÉ豸 */ + UHUB_DEV_ADDR = TxBuffer[MAX_PACKET_SIZE - 1]; /* ����USB�����˵�USB��ַָ��USB�豸 */ if(CHRV3IntStatus == ERR_USB_DISCON) { // CHRV3DiskStatus = DISK_DISCONNECT; @@ -250,20 +250,20 @@ UINT8 CHRV3DiskConnect(void) } else { - CHRV3DiskStatus = DISK_CONNECT; /* HUB²Ù×÷ʧ°Ü */ + CHRV3DiskStatus = DISK_CONNECT; /* HUB����ʧ�� */ return (CHRV3IntStatus); } } } else - { /* ÄÚÖÃRoot-HUBϵÄUSBÉ豸´æÔÚ,ÍⲿHUB»òUSBÉ豸ÒѾ­Á¬½Ó»òÕ߶ϿªºóÖØÐÂÁ¬½Ó */ - // CHRV3DiskStatus = DISK_CONNECT; /* Ôø¾­¶Ï¿ª¹ý */ - // return( ERR_SUCCESS ); /* ÍⲿHUB»òUSBÉ豸ÒѾ­Á¬½Ó»òÕ߶ϿªºóÖØÐÂÁ¬½Ó */ + { /* ����Root-HUB�µ�USB�豸����,�ⲿHUB��USB�豸�Ѿ����ӻ��߶Ͽ����������� */ + // CHRV3DiskStatus = DISK_CONNECT; /* �����Ͽ��� */ + // return( ERR_SUCCESS ); /* �ⲿHUB��USB�豸�Ѿ����ӻ��߶Ͽ����������� */ goto mDiskConnect; } } else - { /* ÍⲿHUB¶Ï¿ª */ + { /* �ⲿHUB�Ͽ� */ CHRV3DiskStatus = DISK_DISCONNECT; } } @@ -277,54 +277,54 @@ UINT8 CHRV3DiskConnect(void) } #endif // NO_DEFAULT_DISK_CONNECT -#ifndef NO_DEFAULT_FILE_ENUMER /* ÔÚÓ¦ÓóÌÐòÖж¨ÒåNO_DEFAULT_FILE_ENUMER¿ÉÒÔ½ûֹĬÈϵÄÎļþÃûö¾Ù»Øµ÷³ÌÐò,È»ºóÓÃ×ÔÐбàдµÄ³ÌÐò´úÌæËü */ -void xFileNameEnumer(void) /* ÎļþÃûö¾Ù»Øµ÷×Ó³ÌÐò */ +#ifndef NO_DEFAULT_FILE_ENUMER /* ��Ӧ�ó����ж���NO_DEFAULT_FILE_ENUMER���Խ�ֹĬ�ϵ��ļ���ö�ٻص�����,Ȼ�������б�д�ij�������� */ +void xFileNameEnumer(void) /* �ļ���ö�ٻص��ӳ��� */ { - /* Èç¹ûÖ¸¶¨Ã¶¾ÙÐòºÅCHRV3vFileSizeΪ0xFFFFFFFFºóµ÷ÓÃFileOpen£¬ÄÇôÿËÑË÷µ½Ò»¸öÎļþFileOpen¶¼»áµ÷Óñ¾»Øµ÷³ÌÐò£¬ - »Øµ÷³ÌÐòxFileNameEnumer·µ»Øºó£¬FileOpenµÝ¼õCHRV3vFileSize²¢¼ÌÐøö¾ÙÖ±µ½ËÑË÷²»µ½Îļþ»òÕßĿ¼¡£½¨Òé×ö·¨ÊÇ£¬ - ÔÚµ÷ÓÃFileOpen֮ǰ¶¨ÒåÒ»¸öÈ«¾Ö±äÁ¿Îª0£¬µ±FileOpen»Øµ÷±¾³ÌÐòºó£¬±¾³ÌÐòÓÉCHRV3vFdtOffsetµÃµ½½á¹¹FAT_DIR_INFO£¬ - ·ÖÎö½á¹¹ÖеÄDIR_AttrÒÔ¼°DIR_NameÅжÏÊÇ·ñΪËùÐèÎļþÃû»òÕßĿ¼Ãû£¬¼Ç¼Ïà¹ØÐÅÏ¢£¬²¢½«È«¾Ö±äÁ¿¼ÆÊýÔöÁ¿£¬ - µ±FileOpen·µ»Øºó£¬ÅжϷµ»ØÖµÈç¹ûÊÇERR_MISS_FILE»òERR_FOUND_NAME¶¼ÊÓΪ²Ù×÷³É¹¦£¬È«¾Ö±äÁ¿ÎªËÑË÷µ½µÄÓÐЧÎļþÊý¡£ - Èç¹ûÔÚ±¾»Øµ÷³ÌÐòxFileNameEnumerÖн«CHRV3vFileSizeÖÃΪ1£¬ÄÇô¿ÉÒÔ֪ͨFileOpenÌáÇ°½áÊøËÑË÷¡£ÒÔÏÂÊǻص÷³ÌÐòÀý×Ó */ + /* ���ָ��ö�����CHRV3vFileSizeΪ0xFFFFFFFF�����FileOpen����ôÿ������һ���ļ�FileOpen������ñ��ص����� + �ص�����xFileNameEnumer���غ�FileOpen�ݼ�CHRV3vFileSize������ö��ֱ�����������ļ�����Ŀ¼�����������ǣ� + �ڵ���FileOpen֮ǰ����һ��ȫ�ֱ���Ϊ0����FileOpen�ص�������󣬱�������CHRV3vFdtOffset�õ��ṹFAT_DIR_INFO�� + �����ṹ�е�DIR_Attr�Լ�DIR_Name�ж��Ƿ�Ϊ�����ļ�������Ŀ¼������¼�����Ϣ������ȫ�ֱ������������� + ��FileOpen���غ��жϷ���ֵ�����ERR_MISS_FILE��ERR_FOUND_NAME����Ϊ�����ɹ���ȫ�ֱ���Ϊ����������Ч�ļ����� + ����ڱ��ص�����xFileNameEnumer�н�CHRV3vFileSize��Ϊ1����ô����֪ͨFileOpen��ǰ���������������ǻص��������� */ #if 0 UINT8 i; UINT16 FileCount; PX_FAT_DIR_INFO pFileDir; PUINT8 NameBuf; - pFileDir = (PX_FAT_DIR_INFO)(pDISK_BASE_BUF + CHRV3vFdtOffset); /* µ±Ç°FDTµÄÆðʼµØÖ· */ - FileCount = (UINT16)(0xFFFFFFFF - CHRV3vFileSize); /* µ±Ç°ÎļþÃûµÄö¾ÙÐòºÅ,CHRV3vFileSize³õÖµÊÇ0xFFFFFFFF,ÕÒµ½ÎļþÃûºóµÝ¼õ */ + pFileDir = (PX_FAT_DIR_INFO)(pDISK_BASE_BUF + CHRV3vFdtOffset); /* ��ǰFDT����ʼ��ַ */ + FileCount = (UINT16)(0xFFFFFFFF - CHRV3vFileSize); /* ��ǰ�ļ�����ö�����,CHRV3vFileSize��ֵ��0xFFFFFFFF,�ҵ��ļ�����ݼ� */ if(FileCount < sizeof(FILE_DATA_BUF) / 12) - { /* ¼ì²é»º³åÇøÊÇ·ñ×ã¹»´æ·Å,¼Ù¶¨Ã¿¸öÎļþÃûÐèÕ¼ÓÃ12¸ö×Ö½Ú´æ·Å */ - NameBuf = &FILE_DATA_BUF[FileCount * 12]; /* ¼ÆËã±£´æµ±Ç°ÎļþÃûµÄ»º³åÇøµØÖ· */ + { /* ��黺�����Ƿ��㹻���,�ٶ�ÿ���ļ�����ռ��12���ֽڴ�� */ + NameBuf = &FILE_DATA_BUF[FileCount * 12]; /* ���㱣�浱ǰ�ļ����Ļ�������ַ */ for(i = 0; i < 11; i++) - NameBuf[i] = pFileDir->DIR_Name[i]; /* ¸´ÖÆÎļþÃû,³¤¶ÈΪ11¸ö×Ö·û,δ´¦Àí¿Õ¸ñ */ - // if ( pFileDir -> DIR_Attr & ATTR_DIRECTORY ) NameBuf[ i ] = 1; /* ÅжÏÊÇĿ¼Ãû */ - NameBuf[i] = 0; /* ÎļþÃû½áÊø·û */ + NameBuf[i] = pFileDir->DIR_Name[i]; /* �����ļ���,����Ϊ11���ַ�,δ�����ո� */ + // if ( pFileDir -> DIR_Attr & ATTR_DIRECTORY ) NameBuf[ i ] = 1; /* �ж���Ŀ¼�� */ + NameBuf[i] = 0; /* �ļ��������� */ } #endif } #endif // NO_DEFAULT_FILE_ENUMER -UINT8 CHRV3LibInit(void) /* ³õʼ»¯CHRV3³ÌÐò¿â,²Ù×÷³É¹¦·µ»Ø0 */ +UINT8 CHRV3LibInit(void) /* ��ʼ��CHRV3�����,�����ɹ�����0 */ { if(CHRV3GetVer() < CHRV3_LIB_VER) - return (0xFF); /* »ñÈ¡µ±Ç°×Ó³ÌÐò¿âµÄ°æ±¾ºÅ,°æ±¾Ì«µÍÔò·µ»Ø´íÎó */ + return (0xFF); /* ��ȡ��ǰ�ӳ����İ汾��,�汾̫���ò·µ»Ø´ï¿½ï¿½ï¿½ */ #if DISK_BASE_BUF_LEN > 0 - pDISK_BASE_BUF = &RAM_BUFFER.PDF_BUFFER.DISK_BASE_BUF[0]; /* Ö¸ÏòÍⲿRAMµÄ´ÅÅÌÊý¾Ý»º³åÇø */ -// pDISK_FAT_BUF = &DISK_BASE_BUF[0]; /* Ö¸ÏòÍⲿRAMµÄ´ÅÅÌFATÊý¾Ý»º³åÇø,¿ÉÒÔÓëpDISK_BASE_BUFºÏÓÃÒÔ½ÚÔ¼RAM */ - pDISK_FAT_BUF = &RAM_BUFFER.PDF_BUFFER.DISK_FAT_BUF[0]; /* Ö¸ÏòÍⲿRAMµÄ´ÅÅÌFATÊý¾Ý»º³åÇø,¶ÀÁ¢ÓÚpDISK_BASE_BUFÒÔÌá¸ßËÙ¶È */ -/* Èç¹ûÏ£ÍûÌá¸ßÎļþ´æÈ¡ËÙ¶È,ÄÇô¿ÉÒÔÔÚÖ÷³ÌÐòÖе÷ÓÃCHRV3LibInitÖ®ºó,½«pDISK_FAT_BUFÖØÐÂÖ¸ÏòÁíÒ»¸ö¶ÀÁ¢·ÖÅäµÄÓëpDISK_BASE_BUFͬÑù´óСµÄ»º³åÇø */ + pDISK_BASE_BUF = &RAM_BUFFER.PDF_BUFFER.DISK_BASE_BUF[0]; /* ָ���ⲿRAM�Ĵ������ݻ����� */ +// pDISK_FAT_BUF = &DISK_BASE_BUF[0]; /* ָ���ⲿRAM�Ĵ���FAT���ݻ�����,������pDISK_BASE_BUF�����Խ�ԼRAM */ + pDISK_FAT_BUF = &RAM_BUFFER.PDF_BUFFER.DISK_FAT_BUF[0]; /* ָ���ⲿRAM�Ĵ���FAT���ݻ�����,������pDISK_BASE_BUF������ٶ� */ +/* ���ϣ������ļ���ȡ�ٶ�,��ô�������������е���CHRV3LibInit֮��,��pDISK_FAT_BUF����ָ����һ�������������pDISK_BASE_BUFͬ����С�Ļ����� */ #endif CHRV3DiskStatus = DISK_UNKNOWN; /* δ֪״̬ */ - CHRV3vSectorSizeB = 9; /* ĬÈϵÄÎïÀí´ÅÅ̵ÄÉÈÇøÊÇ512B */ - CHRV3vSectorSize = 512; // ĬÈϵÄÎïÀí´ÅÅ̵ÄÉÈÇøÊÇ512B,¸ÃÖµÊÇ´ÅÅ̵ÄÉÈÇø´óС - CHRV3vStartLba = 0; /* ĬÈÏΪ×Ô¶¯·ÖÎöFDDºÍHDD */ - CHRV3vPacketSize = 64; /* USB´æ´¢ÀàÉ豸µÄ×î´ó°ü³¤¶È:64@FS,512@HS/SS,ÓÉÓ¦ÓóÌÐò³õʼ»¯,ö¾ÙUÅ̺óÈç¹ûÊǸßËÙ»òÕß³¬ËÙÄÇô¼°Ê±¸üÐÂΪ512 */ - pTX_DMA_A_REG = (PUINT32)&R16_UH_TX_DMA; /* Ö¸Ïò·¢ËÍDMAµØÖ·¼Ä´æÆ÷,ÓÉÓ¦ÓóÌÐò³õʼ»¯ */ - pRX_DMA_A_REG = (PUINT32)&R16_UH_RX_DMA; /* Ö¸Ïò½ÓÊÕDMAµØÖ·¼Ä´æÆ÷,ÓÉÓ¦ÓóÌÐò³õʼ»¯ */ - pTX_LEN_REG = (PUINT16)&R8_UH_TX_LEN; /* Ö¸Ïò·¢Ëͳ¤¶È¼Ä´æÆ÷,ÓÉÓ¦ÓóÌÐò³õʼ»¯ */ - pRX_LEN_REG = (PUINT16)&R8_USB_RX_LEN; /* Ö¸Ïò½ÓÊÕ³¤¶È¼Ä´æÆ÷,ÓÉÓ¦ÓóÌÐò³õʼ»¯ */ + CHRV3vSectorSizeB = 9; /* Ĭ�ϵ��������̵�������512B */ + CHRV3vSectorSize = 512; // Ĭ�ϵ��������̵�������512B,��ֵ�Ǵ��̵�������С + CHRV3vStartLba = 0; /* Ĭ��Ϊ�Զ�����FDD��HDD */ + CHRV3vPacketSize = 64; /* USB�洢���豸����������:64@FS,512@HS/SS,��Ӧ�ó����ʼ��,ö��U�̺�����Ǹ��ٻ��߳�����ô��ʱ����Ϊ512 */ + pTX_DMA_A_REG = (PUINT32)&R16_UH_TX_DMA; /* ָ����DMA��ַ�Ĵ���,��Ӧ�ó����ʼ�� */ + pRX_DMA_A_REG = (PUINT32)&R16_UH_RX_DMA; /* ָ�����DMA��ַ�Ĵ���,��Ӧ�ó����ʼ�� */ + pTX_LEN_REG = (PUINT16)&R8_UH_TX_LEN; /* ָ���ͳ��ȼĴ���,��Ӧ�ó����ʼ�� */ + pRX_LEN_REG = (PUINT16)&R8_USB_RX_LEN; /* ָ����ճ��ȼĴ���,��Ӧ�ó����ʼ�� */ - //CHRV3vRootPort = 0; /* USBÖ÷»úÑ¡Ôñ(ÀàËÆRoot-hub¸ù¼¯ÏßÆ÷Ñ¡¶Ë¿Ú) */ + //CHRV3vRootPort = 0; /* USB����ѡ��(����Root-hub��������ѡ�˿�) */ return (ERR_SUCCESS); } diff --git a/examples/usb-pdf-logger-none-os-ch592/src/peripheral_main.c b/examples/usb-pdf-logger-none-os-ch592/src/peripheral_main.c index 14e09ae..b8804b2 100644 --- a/examples/usb-pdf-logger-none-os-ch592/src/peripheral_main.c +++ b/examples/usb-pdf-logger-none-os-ch592/src/peripheral_main.c @@ -3,7 +3,7 @@ * Author : WCH * Version : V1.1 * Date : 2020/08/06 - * Description : ÍâÉè´Ó»úÓ¦ÓÃÖ÷º¯Êý¼°ÈÎÎñϵͳ³õʼ»¯ + * Description : ����ӻ�Ӧ��������������ϵͳ��ʼ�� ********************************************************************************* * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Attention: This software (modified or not) and binary are used for @@ -11,7 +11,7 @@ *******************************************************************************/ /******************************************************************************/ -/* Í·Îļþ°üº¬ */ +/* ͷ�ļ����� */ #include "CH59x_common.h" #include "peripheral.h" #include "flash_info.h" @@ -57,7 +57,7 @@ uint8_t DeviceStatus; /********************************************************************* * @fn Main_Circulation * - * @brief Ö÷Ñ­»· + * @brief ��ѭ�� * * @return none */ @@ -68,7 +68,7 @@ float AHT20_HumidityValue; /********************************************************************* * @fn main * - * @brief Ö÷º¯Êý + * @brief ������ * * @return none */