1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. **********************
File Name : Disk.h
Version : S100 APP Ver 2.11
Description:
Author : Celery
Data: 2015/08/03
History:
2015/08/03 :
*******************************************************************************/
#ifndef __DISK_H
#define __DISK_H
#include "stm32f10x_flash.h"
#include "usb_scsi.h"
#include "usb_regs.h"
#include "usb_conf.h"
#include "usb_bot.h"
#include "usb_mem.h"
#include "usb_lib.h"
#include "usb_pwr.h"
#define SECTOR_SIZE 512
#define SECTOR_CNT 4096
#define FAT1_SECTOR &gDisk_buff[0x000]
#define FAT2_SECTOR &gDisk_buff[0x200]
#define ROOT_SECTOR &gDisk_buff[0x400]
#define VOLUME_BASE &gDisk_buff[0x416]
#define OTHER_FILES &gDisk_buff[0x420]
#define FILE_SECTOR &gDisk_buff[0x600]
#define Root (u8*)ROOT_SECTOR
//#define APP_BASE 0x0800C000
#define HEX 0
#define BIN 2
#define SET 1
#define RDY 0
#define NOT 2
#define END 3
#define ERR 4
#define DATA_SEG 0x00
#define DATA_END 0x01
#define EXT_ADDR 0x04
#define TXFR_IDLE 0
#define TXFR_ONGOING 1
//#define FAT_DATA 0x00FFFFF8
#define VOLUME 0x40DD8D18 //0x3E645C29
#define BUFF 0 // �������ݻ�����
#define V32_BASE SECTOR_SIZE // V32 �ܹ� 8*4=32 �ֽ�
#define W_ADDR 0
#define ADDR 1
#define H_ADDR 2
#define OFFSET 3
#define SEC_CNT 4
#define COUNT 5
#define RD_CNT 6
#define WR_CNT 7
#define VAR_BASE V32_BASE + 32 // VAR �ܹ� 9+17=26 �ֽ�
#define USB_ST 0
#define SEG_KIND 1
#define SEG_LEN 2
#define SEG_SUM 3
#define SEG_TMP 4
#define SEG_ST 5
#define DATA_CNT 6
#define F_TYPE 7
#define F_FLAG 8
#define SEG_DATA 9 // ͨ�Ű������� 9~26 ��17�ֽ�
u8 Cal_Val(u8 str[],u8 k,u8 flag);
void Disk_BuffInit(void);
u8 ReWrite_All(void);
u8 Config_Analysis(void);
void Disk_BuffInit(void);
void Disk_SecWrite(u8* pbuffer, u32 disk_addr);
void Close_File(void);
void Write_Memory(u32 w_offset, u32 w_length);
void Read_Memory (u32 r_offset, u32 r_length);
void Set_Ver(u8 str[],u8 i);
void Erase(void);
char * Get_Line(char *dst,char *src, int n,int m);
void Upper(u8* str, u16 len);
u8* SearchFile(u8* pfilename, u16* pfilelen,u16* root_addr);
u8 ReWriteFlsash(void);
#endif
/********************************* END OF FILE ******************************/
|