Skip to content

Commit

Permalink
Fix filenames for Linux/Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Sep 18, 2024
1 parent f5b2858 commit 18e295e
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 146 deletions.
4 changes: 2 additions & 2 deletions examples/usb-pdf-logger-none-os-ch592/include/peripheral.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions examples/usb-pdf-logger-none-os-ch592/lib/PDF/pdfFile.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/usb-pdf-logger-none-os-ch592/lib/USB/sw_udisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
58 changes: 29 additions & 29 deletions examples/usb-pdf-logger-none-os-ch592/lib/USB/usbfs_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*******************************************************************************/

#include "usbfs_device.h"
#include "SW_UDISK.h"
#include "sw_udisk.h"
#include "usb_desc.h"
#include "pdfFile.h"

Expand Down Expand Up @@ -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
*
Expand All @@ -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;
}

Expand Down Expand Up @@ -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
*/
Expand All @@ -228,23 +228,23 @@ 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:
{
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:
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -327,10 +327,10 @@ void USB_DevTransProcess(void)
}
else
{
errflag = 0xFF; /* 非标准请求 */
errflag = 0xFF; /* �DZ�׼���� */
}
}
else /* 标准请求 */
else /* ��׼���� */
{
switch(USBFS_SetupReqCode)
{
Expand Down Expand Up @@ -383,7 +383,7 @@ void USB_DevTransProcess(void)
break;

default:
errflag = 0xFF; // 不支持的字符串描述符
errflag = 0xFF; // ��֧�ֵ��ַ���������
break;
}
}
Expand All @@ -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;
Expand All @@ -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)
{
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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();
}
Loading

0 comments on commit 18e295e

Please sign in to comment.