| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
fatutil.h File Reference
`#include "usb.h"`
`#include "DataRam.h"`

Go to the source code of this file.

## Data Structures
struct | BSStruct
struct | FAT
struct | FATTime
struct | FATDate
struct | DirEntry
struct | DISKIMAGE

## Macros
#define | FAT12 1
#define | FAT16 2
#define | FAT32 3
#define | UDIV_ROUNDUP(a, b) ((a + b - 1) / b)
#define | FATTYPE FAT12
#define | DISKSIZE (0x100000)
#define | BYTESPERSECTOR (512)
#define | RESERVEDSECTORCNT (1)
#define | ROOTENTRIES (UDIV_ROUNDUP(BYTESPERSECTOR, 32))
#define | DIRECTORYSECTORCNT (UDIV_ROUNDUP(ROOTENTRIES, 16))
#define | NUMFATS (2)
#define | SECTORSPERCLUSTER (1)
#define | DATASECTORS (1024)
#define | TOTALSECTORS (UDIV_ROUNDUP(DISKSIZE, BYTESPERSECTOR))
#define | FATENTRIESPERSECTOR (UDIV_ROUNDUP(BYTESPERSECTOR * 8, 12 /*FAT12*/))
#define | SECTORSPERFAT
#define | NONDATASECTORS (RESERVEDSECTORCNT + NUMFATS * SECTORSPERFAT + DIRECTORYSECTORCNT)
#define | STARTDATAREGION (NONDATASECTORS * BYTESPERSECTOR)
#define | BYTESPERCLUSTER (BYTESPERSECTOR * SECTORSPERCLUSTER)
#define | FAT_MEDIA (0xF0)
#define | TIME_HOUR 16
#define | TIME_MIN 00
#define | TIME_SEC 00
#define | DATE_YEAR 2011 - 1980
#define | DATE_MONTH 8
#define | DATE_DAY 11

## Functions
int16_t | GetFAT12Entry (DISKIMAGE *DiskImagePtr, int FATindex)
void | SetFAT12Entry (DISKIMAGE *DiskImagePtr, int FATindex, unsigned short FAT12ClusEntryVal)
uint32_t | CalculateCountOfClusters (DISKIMAGE *DiskImagePtr)
void | CreateDiskImage (DISKIMAGE *DiskImagePtr)
void | SetDiskMetricsFromDiskImage (DISKIMAGE *DiskImagePtr)
void | InitializeDiskDiskImage (DISKIMAGE *DiskImagePtr)
void | InitializeFAT12 (DISKIMAGE *DiskImagePtr)

## Variables
int32_t | RootEntries
int32_t | BytesPerSector
int32_t | NumFats
int32_t | SectorsPerFat
int32_t | NonDataSectors
int32_t | TotalSectors
int32_t | StartDataRegion

## Macro Definition Documentation

#define BYTESPERCLUSTER (BYTESPERSECTOR * SECTORSPERCLUSTER)

Definition at line 47 of file fatutil.h.

#define BYTESPERSECTOR (512)

Definition at line 31 of file fatutil.h.

#define DATASECTORS (1024)

Definition at line 38 of file fatutil.h.

#define DATE_DAY 11

Definition at line 56 of file fatutil.h.

#define DATE_MONTH 8

Definition at line 55 of file fatutil.h.

#define DATE_YEAR 2011 - 1980

Definition at line 54 of file fatutil.h.

#define DIRECTORYSECTORCNT (UDIV_ROUNDUP(ROOTENTRIES, 16))

Definition at line 35 of file fatutil.h.

#define DISKSIZE (0x100000)

Definition at line 30 of file fatutil.h.

#define FAT12 1

Definition at line 22 of file fatutil.h.

#define FAT16 2

Definition at line 23 of file fatutil.h.

#define FAT32 3

Definition at line 24 of file fatutil.h.

#define FAT_MEDIA (0xF0)

Definition at line 48 of file fatutil.h.

#define FATENTRIESPERSECTOR (UDIV_ROUNDUP(BYTESPERSECTOR * 8, 12 /*FAT12*/))

Definition at line 41 of file fatutil.h.

#define FATTYPE FAT12

Definition at line 27 of file fatutil.h.

#define NONDATASECTORS (RESERVEDSECTORCNT + NUMFATS * SECTORSPERFAT + DIRECTORYSECTORCNT)

Definition at line 45 of file fatutil.h.

#define NUMFATS (2)

Definition at line 36 of file fatutil.h.

#define RESERVEDSECTORCNT (1)

Definition at line 32 of file fatutil.h.

#define ROOTENTRIES (UDIV_ROUNDUP(BYTESPERSECTOR, 32))

Definition at line 33 of file fatutil.h.

#define SECTORSPERCLUSTER (1)

Definition at line 37 of file fatutil.h.

#define SECTORSPERFAT

Value:
(UDIV_ROUNDUP(UDIV_ROUNDUP((TOTALSECTORS - RESERVEDSECTORCNT), SECTORSPERCLUSTER), \
FATENTRIESPERSECTOR))

Definition at line 42 of file fatutil.h.

#define STARTDATAREGION (NONDATASECTORS * BYTESPERSECTOR)

Definition at line 46 of file fatutil.h.

#define TIME_HOUR 16

Definition at line 51 of file fatutil.h.

#define TIME_MIN 00

Definition at line 52 of file fatutil.h.

#define TIME_SEC 00

Definition at line 53 of file fatutil.h.

#define TOTALSECTORS (UDIV_ROUNDUP(DISKSIZE, BYTESPERSECTOR))

Definition at line 40 of file fatutil.h.

#define UDIV_ROUNDUP | ( |  | a,
|  |  | b
| ) |  | ((a + b - 1) / b)

Definition at line 26 of file fatutil.h.

## Function Documentation

uint32_t CalculateCountOfClusters | ( | DISKIMAGE * | DiskImagePtr | ) |

Definition at line 148 of file fatutil.c.

void CreateDiskImage | ( | DISKIMAGE * | DiskImagePtr | ) |

Definition at line 198 of file fatutil.c.

int16_t GetFAT12Entry | ( | DISKIMAGE * | DiskImagePtr,
|  | int | FATindex
| ) |  |

Definition at line 86 of file fatutil.c.

void InitializeDiskDiskImage | ( | DISKIMAGE * | DiskImagePtr | ) |

Definition at line 175 of file fatutil.c.

void InitializeFAT12 | ( | DISKIMAGE * | DiskImagePtr | ) |

Definition at line 120 of file fatutil.c.

void SetDiskMetricsFromDiskImage | ( | DISKIMAGE * | DiskImagePtr | ) |

Definition at line 187 of file fatutil.c.

void SetFAT12Entry | ( | DISKIMAGE * | DiskImagePtr,
|  | int | FATindex,
|  | unsigned short | FAT12ClusEntryVal
| ) |  |

Definition at line 103 of file fatutil.c.

## Variable Documentation

int32_t BytesPerSector

Definition at line 168 of file fatutil.c.

int32_t NonDataSectors

Definition at line 171 of file fatutil.c.

int32_t NumFats

Definition at line 169 of file fatutil.c.

int32_t RootEntries

Definition at line 167 of file fatutil.c.

int32_t SectorsPerFat

Definition at line 170 of file fatutil.c.

int32_t StartDataRegion

Definition at line 173 of file fatutil.c.

int32_t TotalSectors

Definition at line 172 of file fatutil.c.