Library configuration is stored as a set of configuration macros in FSconfig.h and HardwareProfiles.h in the demo application folders. These macros has to be modified as per the application requirement.
FSconfig.h
This file contains options to configure the library firmware. The configuration macros include:
Macro/Option |
Category |
Indication |
Definition |
Describes the maximum number of files that can/will be opened at once. | |
Definition |
When enabled, the file system supports Long File Name entries for files and directories. | |
Definition |
Describes the size of a sector on the device. This will almost always equal 512. | |
Feature toggle | ||
Feature toggle |
Comment this definition out to disable all write functionality. This will reduce code size. | |
Feature toggle |
Comment this definition out to disable the format function. This will reduce code size. | |
Feature toggle |
Comment this definition out to disable all directory functionality. This will reduce code size. | |
ALLOW_PGMFUNCTIONS |
Feature toggle |
Comment this definition out to disable -pgm functions. The library requires -pgm functions to be disabled when not using PIC18. This will reduce code size. |
ALLOW_FSFPRINTF |
Feature toggle |
Comment this definition out to disable the FSfprintf function. This will reduce code size. |
Feature toggle | ||
Create/last modified timestamp generator |
Uncomment this macro to generate timestamps automatically with the RTCC module. You must configure the RTCC for this method to work correctly. Only one timestamp generation method may be enabled at one time. | |
USERDEFINEDCLOCK |
Create/last modified timestamp generator |
Uncomment this macro to generate timestamps based on global variabled that are set manually by the user using the SetClockVars() function. Only one timestamp generation method may be enabled at one time. |
INCREMENTTIMESTAMP |
Create/last modified timestamp generator |
Uncomment this macro to generate static timestamps. These timestamps will be incremented by 1 whenever the file is accessed. This should only be used in applications when create.modified times are not required. Only one timestamp generation method may be enabled at one time. |
Static/dynamic FSFILE object allocation. |
Set the #if preprocessor definition to 1 to allocate FSFILE objects dynamically. You will be required to allocate a heap to do this. For PIC18, you will be required to include the salloc.c and salloc.h files in your project. If the #if statement is set to 0, FSFILE objects will be allocated in a static array, with the maximum number of FSFILE objects determined by the FS_MAX_FILES_OPEN macro. |
HardwareProfiles.h
The HardwareProfiles.h header file reflects the state of the hardware. It contains the following macros:
Macro |
Indication |
GetSystemClock() |
Returns the value of the system clock. |
GetPeripheralClock() |
Returns the value of the microcontroller's peripheral clock |
GetInstructionClock() |
Returns the value of the microcontroller's instruction clock |
Uncomment this definition to use the SD-SPI physical layer. Only one physical layer may be enabled at one time. | |
USE_CF_INTERFACE_WITH_PMP |
Uncomment this definition to use the CF-PMP physical layer. Only one physical layer may be enabled at one time. |
USE_MANUAL_CF_INTERFACE |
Uncomment this definition to use the CF-Manual physical layer. Only one physical layer may be enabled at one time. |
USE_USB_INTERFACE |
Uncomment this definition to use the USB host physical layer. This physical layer is described in greater detail at http://www.microchip.com/usb. Only one physical layer may be enabled at one time. |
SD_CS, SD_CD, SD_WE |
Used for the SD-SPI physical layer. Set these to the I/O port register locations for the chip select, card detect, and write protect signals (e.g. PORTBbits.RB3). |
SD_CS_TRIS, SD_CD_TRIS, SD_WE_TRIS |
Used for the SD-SPI physical layer. Set these to the I/O tris register locations that correspond to the pins used for each signal (e.g. TRISBbits.TRISB3). |
SPICON1, SPISTAT, SPIBUF, SPISTAT_RBF, SPICON1bits, SPISTATbits, SPI_INTERRUPT_FLAG, SPIENABLE |
Used for the SD-SPI physical layer. Set these to the SPI registers or bits that correspond to the module you're using (e.g. SSP1CON1, SSP1STAT, SSP1BUF, SSP1STATbits.BF, SSP1CON1bits, SSP1STATbits, PIR1bits.SSPIF). |
SPICLOCK, SPIIN, SPIOUT, SPICLOCKLAT, SPIINLAT, SPIOUTLAT, SPICLOCKPORT, SPIINPORT, SPIOUTPORT |
Used for the SD-SPI physical layer. Set these to the SPI tris/lat/port register bits for the module you're using. |
CF_PMP_RST, CF_PMP_RDY, CF_PMP_CD1 |
Used with the CF-PMP physical layer. Set these to the I/O port register locations for the reset, ready, and card detect signals for your card. |
CF_PMP_RESETDIR, CF_PMP_READYDIR, CF_PMP_CD1DIR |
Used with the CF-PMP physical layer. Set these to the I/O tris register that corresponds to the reset, ready, and card detect signals. |
MDD_CFPMP_DATADIR |
Used with the CF-PMP physical layer. Set this to the tris register that corresponds to the PMP data bus. |
ADDBL, ADDDIR |
Used with the CF-Manual physical layer. Set these to the lat and tris registers that correspond to the address bus (PIC18). |
ADDR0, ADDR1, ADDR2, ADDR3 |
Used with the CF-Manual physical layer. Set these to the 4 lat pins used for your address bus. |
ADRTRIS0, ADRTRIS1, ADRTRIS2, ADRTRIS3 |
Used with the CF-Manual physical layer. Set these to the corresponding tris bits for your data bus. |
MDD_CFBT_DATABIN, MDD_CFBT_DATABOUT, MDD_CFBT_DATADIR |
Used with the CF-Manual physical layer. Set these to the port, lat, and tris registers that correspond to your data bus. |
CF_CE, CF_OE, CF_WE, CF_BT_RST, CF_BT_RDY, CF_BT_CD1 |
Used with the CF-Manual physical layer. Set these to the I/O lat and port bits that correspond to the chip select, output enable strobe, write enable strobe, reset, ready, and card detect signals, respectively. |
CF_CEDIR, CF_OEDIR, CF_WEDIR, CF_BT_RESETDIR, CF_BT_READYDIR, CF_BT_CD1DIR |
Used with the CF-Manual physical layer. Set these to tris bits that correspond to the control signals for the card. |