📄 f34x_msd_dir_commands.lst
字号:
44 =1 unsigned offset_direntry;
45 =1 BYTE attrib;
46 =1 DWORD pos;
47 =1 DWORD size;
48 =1 BYTE isopen;
49 =1 } FILE;
50 =1
51 =1 typedef WORD UNI; // Unicode character type
52 =1
53 =1 typedef union {
54 =1
55 =1 struct {
56 =1 BYTE seq_nr; // Bit 0..4 = seqnr, ascending, start with 1. Bit 6:
- final part of name
57 =1 UNI unicode1_5[5]; // Little endian
58 =1 BYTE attrib; // 0x0F
59 =1 BYTE type; // 0x00
60 =1 BYTE checksum; // int i;BYTE sum=0;for(i=0;i<11;i++) { sum=(sum>>
-1)+((sum&1)<<7);sum+=name[i]; }
61 =1 UNI unicode6_11[6];
62 =1 unsigned starting_cluster; // 0x0000
63 =1 UNI unicode12_13[2];
64 =1 } lfn;
65 =1
66 =1 struct {
67 =1 char name[11];
68 =1 BYTE attrib;
69 =1 BYTE reserved[10];
70 =1 WORD time; // 5/6/5 bits for h/m/2*sec
71 =1 WORD date; // 7/4/5 bits for y-1980/m/d
72 =1 unsigned starting_cluster; // 0 for empty file
73 =1 DWORD filesize;
74 =1 } sfn;
75 =1
76 =1 } dir_entry;
77 =1
78 =1 typedef struct {
79 =1 unsigned long block;
80 =1 unsigned offset;
81 =1 BYTE findempty;
82 =1 dir_entry* direntry;
83 =1 } find_info;
84 =1
85 =1
86 =1
87 =1 #define ATTRIB_READ_ONLY 0x01
88 =1 #define ATTRIB_HIDDEN 0x02
89 =1 #define ATTRIB_SYSTEM 0x04
C51 COMPILER V7.50 F34X_MSD_DIR_COMMANDS 11/28/2006 10:54:04 PAGE 19
90 =1 #define ATTRIB_LABEL 0x08
91 =1 #define ATTRIB_SUBDIR 0x10
92 =1 #define ATTRIB_ARCHIVE 0x20
93 =1
94 =1 #define SEEK_CUR 0
95 =1 #define SEEK_END 1
96 =1 #define SEEK_SET 2
97 =1
98 =1 //----------------------------------------------------------------
--------------
99 =1 // Function Prototypes
100 =1 //----------------------------------------------------------------
--------------
101 =1
102 =1 int fopen(FILE* f,char* filename,char* mode);
103 =1 int fseek(FILE* f,long offset,int origin);
104 =1 DWORD ftell(FILE* f);
105 =1 int feof(FILE* f);
106 =1 unsigned fread(FILE* f,BYTE* buffer,unsigned count);
107 =1 unsigned fwrite(FILE* f,BYTE* buffer,unsigned count);
108 =1 void fclose(FILE* f);
109 =1 int fexists(char* filename);
110 =1 int fdelete(char* filename);
111 =1 BYTE findfirst(find_info* findinfo,BYTE empty);
112 =1 BYTE findnext(find_info* findinfo);
113 =1
114 =1
115 =1 //----------------------------------------------------------------
----------------
116 =1 // Functions only for F340 device
117 =1 //----------------------------------------------------------------
----------------
118 =1
119 =1 #ifdef __F340_VER__
120 =1
121 =1 #define DIRECTORY_EXISTS 1
122 =1 #define NO_PLACE_FOR_DIRECTORY 2
123 =1 #define DIRNAME_LENGTH_ERROR 3
124 =1
125 =1 //----------------------------------------------------------------
--------------
126 =1 // Function Prototypes
127 =1 //----------------------------------------------------------------
--------------
128 =1
129 =1 void FileSys_Init();
130 =1 BYTE chngdir(char* dirname);
131 =1 BYTE mkdir(char* dir_name);
132 =1 BYTE rmdir(char* dir_name) ;
133 =1 void write_current_dir();
134 =1
135 =1 //----------------------------------------------------------------
--------------
136 =1 // Structure Prototypes
137 =1 //----------------------------------------------------------------
--------------
138 =1
139 =1 typedef struct
140 =1 {
141 =1 unsigned long block;
142 =1 unsigned offset;
143 =1 }
C51 COMPILER V7.50 F34X_MSD_DIR_COMMANDS 11/28/2006 10:54:04 PAGE 20
144 =1 PREV_SEARCH;
145 =1
146 =1
147 =1 #endif
148 =1 #endif
40 #include "F34x_MSD_Sect_Serv.h"
1 =1 //----------------------------------------------------------------
--------------
2 =1 // F34x_MSD_Sect_Serv.h
3 =1 //----------------------------------------------------------------
--------------
4 =1 // Copyright 2006 Silicon Laboratories, Inc.
5 =1 // http://www.silabs.com
6 =1 //
7 =1 // Program Description:
8 =1 //
9 =1 // Header file with function prototypes relevant to F34x_Sect_Serv
-.c
10 =1 //
11 =1 //
12 =1 // FID: 34X000054
13 =1 // Target: C8051F34x
14 =1 // Tool chain: Keil
15 =1 // Command Line: See Readme.txt
16 =1 // Project Name: F34x_USB_MSD
17 =1 //
18 =1 // Release 1.1
19 =1 // -All changes by PKC
20 =1 // -09 JUN 2006
21 =1 // -No changes; incremented revision number to match project re
-vision
22 =1 //
23 =1 // Release 1.0
24 =1 // -Initial Release
25 =1 //
26 =1
27 =1 //----------------------------------------------------------------
--------------
28 =1 // Header File Preprocessor Directive
29 =1 //----------------------------------------------------------------
--------------
30 =1
31 =1 #ifndef _SECT_SERV_H_
32 =1 #define _SECT_SERV_H_
33 =1
34 =1 #include "F34x_MSD_USB_Main.h"
1 =2 //----------------------------------------------------------------
--------------
2 =2 // F34x_MSD_USB_Main.h
3 =2 //----------------------------------------------------------------
--------------
4 =2 // Copyright 2006 Silicon Laboratories, Inc.
5 =2 // http://www.silabs.com
6 =2 //
7 =2 // Program Description:
8 =2 //
9 =2 // Main header file for USB firmware. Includes function prototypes
-,
10 =2 // standard constants, and configuration constants.//
11 =2 //
12 =2 // FID: 34X000063
13 =2 // Target: C8051F34x
C51 COMPILER V7.50 F34X_MSD_DIR_COMMANDS 11/28/2006 10:54:04 PAGE 21
14 =2 // Tool chain: Keil
15 =2 // Command Line: See Readme.txt
16 =2 // Project Name: F34x_USB_MSD
17 =2 //
18 =2 // Release 1.1
19 =2 // -All changes by PKC
20 =2 // -09 JUN 2006
21 =2 // -No changes; incremented revision number to match project re
-vision
22 =2 //
23 =2 // Release 1.0
24 =2 // -Initial Release
25 =2 //
26 =2 // 11/22/02 - DM: 1. Updated function prototypes and added constan
-ts
27 =2 // to F34x_USB_Main.h with sample interrupt firmwar
-e.
28 =2
29 =2 //----------------------------------------------------------------
--------------
30 =2 // Header File Preprocessor Directive
31 =2 //----------------------------------------------------------------
--------------
32 =2
33 =2 #ifndef _USB_MAIN_H_
=2 #define _USB_MAIN_H_
=2
=2 #include "F34x_MSD_Definitions.h"
=2 //#define _USB_LOW_SPEED_ // Change this comm
-ent to make Full/Low speed
=2
=2 #define SYSCLK 12000000 // SYSCLK frequency i
-n Hz
=2
=2 // USB clock selections (SFR CLKSEL)
=2 #define USB_4X_CLOCK 0x00 // Select 4x clock mu
-ltiplier, for USB Full Speed
=2 #define USB_INT_OSC_DIV_2 0x10 // See Data Sheet sec
-tion 13. Oscillators
=2 #define USB_EXT_OSC 0x20
=2 #define USB_EXT_OSC_DIV_2 0x30
=2 #define USB_EXT_OSC_DIV_3 0x40
=2 #define USB_EXT_OSC_DIV_4 0x50
=2
=2 // System clock selections (SFR CLKSEL)
=2 #define SYS_INT_OSC 0x00 // Select to use inte
-rnal oscillator
=2 #define SYS_4X_MUL 0x03 // Select to use inte
-rnal oscillator
=2 #define SYS_EXT_OSC 0x01 // Select to use an e
-xternal oscillator
=2 #define SYS_4X_DIV_2 0x02
=2
=2 // BYTE type definition
=2 #ifndef _BYTE_DEF_
=2 #define _BYTE_DEF_
=2 typedef unsigned char BYTE;
=2 #endif /* _BYTE_DEF_ */
=2
=2 // WORD type definition, for KEIL Compiler
=2 #ifndef _WORD_DEF_ // Compiler Specific,
- written for Little Endian
C51 COMPILER V7.50 F34X_MSD_DIR_COMMANDS 11/28/2006 10:54:04 PAGE 22
=2 #define _WORD_DEF_
=2 typedef union {unsigned int i; unsigned char c[2];} WORD;
=2 #define LSB 1 // All words sent to
-and received from the host are
=2 #define MSB 0 // little endian, thi
-s is switched by software when
=2 // neccessary. These
- sections of code have been marked
=2 // with "Compiler Specific" as above for easier modifi
-cation
=2 #endif /* _WORD_DEF_ */
=2
=2 // DWORD type definition
=2 #ifndef _DWORD_DEF_
=2 #define _DWORD_DEF_
=2 typedef unsigned long DWORD;
=2 #endif /* _DWORD_DEF_ */
=2
=2 extern volatile DWORD xdata tickcount;
=2
=2 // Define Endpoint Packet Sizes
=2 #ifdef _USB_LOW_SPEED_
=2 #define EP0_PACKET_SIZE 0x40 // This value can be
-8,16,32,64 depending on device speed, see USB spec
=2 #else
=2 #define EP0_PACKET_SIZE 0x40
=2 #endif /* _USB_LOW_SPEED_ */
=2
=2 #define EP1_PACKET_SIZE 0x0040 // Can range 0 - 1024
- depending on data and transfer type
=2 #define EP1_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -