Add [bootloader_zevero_sd_m1284p_make] bootloader prj
This commit is contained in:
46
bootloader_zevero_sd_m1284p_make/pff/src/00readme.txt
Normal file
46
bootloader_zevero_sd_m1284p_make/pff/src/00readme.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
Petit FatFs Module Source Files R0.03 (C)ChaN, 2014
|
||||
|
||||
|
||||
FILES
|
||||
|
||||
pff.h Common include file for Petit FatFs and application module.
|
||||
pff.c Petit FatFs module.
|
||||
diskio.h Common include file for Petit FatFs and disk I/O module.
|
||||
diskio.c Skeleton of low level disk I/O module.
|
||||
integer.h Alternative type definitions for integer variables.
|
||||
|
||||
Low level disk I/O module is not included in this archive because the Petit
|
||||
FatFs module is only a generic file system layer and not depend on any
|
||||
specific storage device. You have to provide a low level disk I/O module that
|
||||
written to control your storage device.
|
||||
|
||||
|
||||
|
||||
AGREEMENTS
|
||||
|
||||
Petit FatFs module is an open source software to implement FAT file system to
|
||||
small embedded systems. This is a free software and is opened for education,
|
||||
research and commercial developments under license policy of following trems.
|
||||
|
||||
Copyright (C) 2014, ChaN, all right reserved.
|
||||
|
||||
* The Petit FatFs module is a free software and there is NO WARRANTY.
|
||||
* No restriction on use. You can use, modify and redistribute it for
|
||||
personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
|
||||
* Redistributions of source code must retain the above copyright notice.
|
||||
|
||||
|
||||
|
||||
REVISION HISTORY
|
||||
|
||||
Jun 15, 2009 R0.01a First release (Branched from FatFs R0.07b)
|
||||
|
||||
Dec 14, 2009 R0.02 Added multiple code page support.
|
||||
Added write funciton.
|
||||
Changed stream read mode interface.
|
||||
Dec 07,'2010 R0.02a Added some configuration options.
|
||||
Fixed fails to open objects with DBCS character.
|
||||
|
||||
Jun 10, 2014 R0.03 Separated out configuration options to pffconf.h.
|
||||
Added _USE_LCC option.
|
||||
Added _FS_FAT16 option.
|
||||
73
bootloader_zevero_sd_m1284p_make/pff/src/diskio.c
Normal file
73
bootloader_zevero_sd_m1284p_make/pff/src/diskio.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Low level disk I/O module skeleton for Petit FatFs (C)ChaN, 2014 */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include "diskio.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Initialize Disk Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_initialize (void)
|
||||
{
|
||||
DSTATUS stat;
|
||||
|
||||
// Put your code here
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Read Partial Sector */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_readp (
|
||||
BYTE* buff, /* Pointer to the destination object */
|
||||
DWORD sector, /* Sector number (LBA) */
|
||||
UINT offset, /* Offset in the sector */
|
||||
UINT count /* Byte count (bit15:destination) */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
|
||||
// Put your code here
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Write Partial Sector */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_writep (
|
||||
BYTE* buff, /* Pointer to the data to be written, NULL:Initiate/Finalize write operation */
|
||||
DWORD sc /* Sector number (LBA) or Number of bytes to send */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
|
||||
|
||||
if (!buff) {
|
||||
if (sc) {
|
||||
|
||||
// Initiate write process
|
||||
|
||||
} else {
|
||||
|
||||
// Finalize write process
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
// Send data to the disk
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
42
bootloader_zevero_sd_m1284p_make/pff/src/diskio.h
Normal file
42
bootloader_zevero_sd_m1284p_make/pff/src/diskio.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
/ PFF - Low level disk interface modlue include file (C)ChaN, 2014
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "integer.h"
|
||||
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Function succeeded */
|
||||
RES_ERROR, /* 1: Disk error */
|
||||
RES_NOTRDY, /* 2: Not ready */
|
||||
RES_PARERR /* 3: Invalid parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
DSTATUS disk_initialize (void);
|
||||
DRESULT disk_readp (BYTE* buff, DWORD sector, UINT offser, UINT count);
|
||||
DRESULT disk_writep (const BYTE* buff, DWORD sc);
|
||||
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DISKIO_DEFINED */
|
||||
33
bootloader_zevero_sd_m1284p_make/pff/src/integer.h
Normal file
33
bootloader_zevero_sd_m1284p_make/pff/src/integer.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*-------------------------------------------*/
|
||||
/* Integer type definitions for FatFs module */
|
||||
/*-------------------------------------------*/
|
||||
|
||||
#ifndef _FF_INTEGER
|
||||
#define _FF_INTEGER
|
||||
|
||||
#ifdef _WIN32 /* FatFs development platform */
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#else /* Embedded platform */
|
||||
|
||||
/* This type MUST be 8 bit */
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
/* These types MUST be 16 bit */
|
||||
typedef short SHORT;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned short WCHAR;
|
||||
|
||||
/* These types MUST be 16 bit or 32 bit */
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
/* These types MUST be 32 bit */
|
||||
typedef long LONG;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1108
bootloader_zevero_sd_m1284p_make/pff/src/pff.c
Normal file
1108
bootloader_zevero_sd_m1284p_make/pff/src/pff.c
Normal file
File diff suppressed because it is too large
Load Diff
159
bootloader_zevero_sd_m1284p_make/pff/src/pff.h
Normal file
159
bootloader_zevero_sd_m1284p_make/pff/src/pff.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Petit FatFs - FAT file system module include file R0.03 (C)ChaN, 2014
|
||||
/----------------------------------------------------------------------------/
|
||||
/ Petit FatFs module is an open source software to implement FAT file system to
|
||||
/ small embedded systems. This is a free software and is opened for education,
|
||||
/ research and commercial developments under license policy of following trems.
|
||||
/
|
||||
/ Copyright (C) 2014, ChaN, all right reserved.
|
||||
/
|
||||
/ * The Petit FatFs module is a free software and there is NO WARRANTY.
|
||||
/ * No restriction on use. You can use, modify and redistribute it for
|
||||
/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
|
||||
/ * Redistributions of source code must retain the above copyright notice.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _PFATFS
|
||||
#define _PFATFS 4004 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "integer.h"
|
||||
#include "pffconf.h"
|
||||
|
||||
#if _PFATFS != _PFFCONF
|
||||
#error Wrong configuration file (pffconf.h).
|
||||
#endif
|
||||
|
||||
#if _FS_FAT32
|
||||
#define CLUST DWORD
|
||||
#else
|
||||
#define CLUST WORD
|
||||
#endif
|
||||
|
||||
|
||||
/* File system object structure */
|
||||
|
||||
typedef struct {
|
||||
BYTE fs_type; /* FAT sub type */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE csize; /* Number of sectors per cluster */
|
||||
BYTE pad1;
|
||||
WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
|
||||
CLUST n_fatent; /* Number of FAT entries (= number of clusters + 2) */
|
||||
DWORD fatbase; /* FAT start sector */
|
||||
DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
|
||||
DWORD database; /* Data start sector */
|
||||
DWORD fptr; /* File R/W pointer */
|
||||
DWORD fsize; /* File size */
|
||||
CLUST org_clust; /* File start cluster */
|
||||
CLUST curr_clust; /* File current cluster */
|
||||
DWORD dsect; /* File current data sector */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* Directory object structure */
|
||||
|
||||
typedef struct {
|
||||
WORD index; /* Current read/write index number */
|
||||
BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
|
||||
CLUST sclust; /* Table start cluster (0:Static table) */
|
||||
CLUST clust; /* Current cluster */
|
||||
DWORD sect; /* Current sector */
|
||||
} DIR;
|
||||
|
||||
|
||||
|
||||
/* File status structure */
|
||||
|
||||
typedef struct {
|
||||
DWORD fsize; /* File size */
|
||||
WORD fdate; /* Last modified date */
|
||||
WORD ftime; /* Last modified time */
|
||||
BYTE fattrib; /* Attribute */
|
||||
char fname[13]; /* File name */
|
||||
} FILINFO;
|
||||
|
||||
|
||||
|
||||
/* File function return code (FRESULT) */
|
||||
|
||||
typedef enum {
|
||||
FR_OK = 0, /* 0 */
|
||||
FR_DISK_ERR, /* 1 */
|
||||
FR_NOT_READY, /* 2 */
|
||||
FR_NO_FILE, /* 3 */
|
||||
FR_NOT_OPENED, /* 4 */
|
||||
FR_NOT_ENABLED, /* 5 */
|
||||
FR_NO_FILESYSTEM /* 6 */
|
||||
} FRESULT;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Petit FatFs module application interface */
|
||||
|
||||
FRESULT pf_mount (FATFS* fs); /* Mount/Unmount a logical drive */
|
||||
FRESULT pf_open (const char* path); /* Open a file */
|
||||
FRESULT pf_read (void* buff, UINT btr, UINT* br); /* Read data from the open file */
|
||||
FRESULT pf_write (const void* buff, UINT btw, UINT* bw); /* Write data to the open file */
|
||||
FRESULT pf_lseek (DWORD ofs); /* Move file pointer of the open file */
|
||||
FRESULT pf_opendir (DIR* dj, const char* path); /* Open a directory */
|
||||
FRESULT pf_readdir (DIR* dj, FILINFO* fno); /* Read a directory item from the open directory */
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Flags and offset address */
|
||||
|
||||
/* File status flag (FATFS.flag) */
|
||||
|
||||
#define FA_OPENED 0x01
|
||||
#define FA_WPRT 0x02
|
||||
#define FA__WIP 0x40
|
||||
|
||||
|
||||
/* FAT sub type (FATFS.fs_type) */
|
||||
|
||||
#define FS_FAT12 1
|
||||
#define FS_FAT16 2
|
||||
#define FS_FAT32 3
|
||||
|
||||
|
||||
/* File attribute bits for directory entry */
|
||||
|
||||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_VOL 0x08 /* Volume label */
|
||||
#define AM_LFN 0x0F /* LFN entry */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
#define AM_MASK 0x3F /* Mask of defined bits */
|
||||
|
||||
|
||||
/*--------------------------------*/
|
||||
/* Multi-byte word access macros */
|
||||
|
||||
#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
|
||||
#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
|
||||
#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
|
||||
#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
|
||||
#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
|
||||
#else /* Use byte-by-byte access to the FAT structure */
|
||||
#define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
|
||||
#define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
|
||||
#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
|
||||
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PFATFS */
|
||||
89
bootloader_zevero_sd_m1284p_make/pff/src/pffconf.h
Normal file
89
bootloader_zevero_sd_m1284p_make/pff/src/pffconf.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Petit FatFs - Configuration file R0.03 (C)ChaN, 2014
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _PFFCONF
|
||||
#define _PFFCONF 4004 /* Revision ID */
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Function Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _USE_READ 1 /* Enable pf_read() function */
|
||||
#define _USE_DIR 0 /* Enable pf_opendir() and pf_readdir() function */
|
||||
#define _USE_LSEEK 0 /* Enable pf_lseek() function */
|
||||
#define _USE_WRITE 0 /* Enable pf_write() function */
|
||||
|
||||
#define _FS_FAT12 0 /* Enable FAT12 */
|
||||
#define _FS_FAT16 1 /* Enable FAT16 */
|
||||
#define _FS_FAT32 1 /* Enable FAT32 */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _USE_LCC 0 /* Allow lower case characters for path name */
|
||||
|
||||
#define _CODE_PAGE 437
|
||||
/* The _CODE_PAGE specifies the code page to be used on the target system.
|
||||
/ SBCS code pages with _USE_LCC == 1 requiers a 128 byte of case conversion
|
||||
/ table. This might occupy RAM on some platforms, e.g. avr-gcc.
|
||||
/ When _USE_LCC == 0, _CODE_PAGE has no effect.
|
||||
/
|
||||
/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows)
|
||||
/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
|
||||
/ 949 - Korean (DBCS, OEM, Windows)
|
||||
/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
|
||||
/ 1250 - Central Europe (Windows)
|
||||
/ 1251 - Cyrillic (Windows)
|
||||
/ 1252 - Latin 1 (Windows)
|
||||
/ 1253 - Greek (Windows)
|
||||
/ 1254 - Turkish (Windows)
|
||||
/ 1255 - Hebrew (Windows)
|
||||
/ 1256 - Arabic (Windows)
|
||||
/ 1257 - Baltic (Windows)
|
||||
/ 1258 - Vietnam (OEM, Windows)
|
||||
/ 437 - U.S. (OEM)
|
||||
/ 720 - Arabic (OEM)
|
||||
/ 737 - Greek (OEM)
|
||||
/ 775 - Baltic (OEM)
|
||||
/ 850 - Multilingual Latin 1 (OEM)
|
||||
/ 858 - Multilingual Latin 1 + Euro (OEM)
|
||||
/ 852 - Latin 2 (OEM)
|
||||
/ 855 - Cyrillic (OEM)
|
||||
/ 866 - Russian (OEM)
|
||||
/ 857 - Turkish (OEM)
|
||||
/ 862 - Hebrew (OEM)
|
||||
/ 874 - Thai (OEM, Windows)
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _WORD_ACCESS 1
|
||||
/* The _WORD_ACCESS option is an only platform dependent option. It defines
|
||||
/ which access method is used to the word data on the FAT volume.
|
||||
/
|
||||
/ 0: Byte-by-byte access. Always compatible with all platforms.
|
||||
/ 1: Word access. Do not choose this unless under both the following conditions.
|
||||
/
|
||||
/ * Address misaligned memory access is always allowed for ALL instructions.
|
||||
/ * Byte order on the memory is little-endian.
|
||||
/
|
||||
/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance and
|
||||
/ reduce code size. Following table shows an example of some processor types.
|
||||
/
|
||||
/ ARM7TDMI 0 ColdFire 0 V850E 0
|
||||
/ Cortex-M3 0 Z80 0/1 V850ES 0/1
|
||||
/ Cortex-M0 0 RX600(LE) 0/1 TLCS-870 0/1
|
||||
/ AVR 0/1 RX600(BE) 0 TLCS-900 0/1
|
||||
/ AVR32 0 RL78 0 R32C 0
|
||||
/ PIC18 0/1 SH-2 0 M16C 0/1
|
||||
/ PIC24 0 H8S 0 MSP430 0
|
||||
/ PIC32 0 H8/300H 0 x86 0/1
|
||||
*/
|
||||
|
||||
#endif /* _PFFCONF */
|
||||
Reference in New Issue
Block a user