sl811.h
来自「SPI FLASH,SL811HST驱动」· C头文件 代码 · 共 90 行
H
90 行
//========================================================================================
//
// USB MASS STORAGE DRIVER FOR PIC18F452
// Version: 2.01
//
//========================================================================================
// Author : Guillaume Fondeville
// Email : g.fondeville@free.fr
// Site : http://g.fondeville.free.fr
//========================================================================================
// Micro : PIC18F452 16MHz
// SIE : SL811HS (Cypress)
// WatchDog disable, Oscillator HS
// UART : 115200, 8 data bits, no parity, 1 start, 1 stop
//
//--------- GNU GPL LICENCE --------------------------------------------------
// This file is subject to the terms of the GNU General Public License as
// published by the Free Software Foundation. A copy of this license is
// included with this software distribution in the file COPYING. If you
// do not have a copy, you may obtain a copy by writing to the Free
// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details
//========================================================================================
//#include "18F4520.h"
//#include <pic18.h>
#include <pic18.h>
//========================================================================================
// Constant definitions
//========================================================================================
#define INTRQ RB0//PIN_B0
#define NWR RE1//PIN_E1
#define NRD RE0//PIN_E0
#define A0 RE2//PIN_E2
#define SL811_DATA PORTD
#define READY 0
#define COMPLETED 0
#define NO_DEVICE 1
#define NOT_FULL_SPEED 2
#define NOT_MASS_STORAGE 3
#define ERROR 4
#define BUSY 5
#define STALL 6
//========================================================================================
// Global Variables
//========================================================================================
extern unsigned char buffer[512];
extern unsigned char data_toggle, adr, endp_in, endp_out;
//========================================================================================
// Functions
//========================================================================================
//USB
void sl811_write(unsigned char adr, unsigned char value);
unsigned char sl811_read(unsigned char adr);
void sl811_write_buf(unsigned char adr, unsigned char * buffer, unsigned char size);
void sl811_read_buf(unsigned char adr, unsigned char * buffer, unsigned char size);
void sl811_write_next(unsigned char value); //先写一个,后接着写
unsigned char sl811_read_next(void); //先读一个,后接着读
unsigned char sl811_set_addr(void);
void sl811_get_device_desc(unsigned char * buf);
void sl811_get_device_conf(unsigned char * buf);
unsigned char sl811_set_conf(void);
void sl811_clear_feature(void);
unsigned char sl811_read_sector(unsigned long sector, void *buf); //用于FAT文件系统读写扇区
unsigned char sl811_write_sector(unsigned long sector, void *buf);
unsigned char sl811_usb_ready(void);
void sl811_init(void);
unsigned char sl811_start(void);
void pause_ms(unsigned char tps);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?