Microchip® Advanced Software Framework

fatfs_access_example.c File Reference

FatFS example.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "memories_initialization.h"

Macros

#define BOARD_NAME   "Undefined"
 
#define DATA_SIZE   2048
 Size of the file to write/read. More...
 
#define MENU_HEADER
 
#define STRING_EOL   "\r"
 Example header. More...
 
#define STRING_HEADER
 
#define TEST_SIZE   (4 * 1024)
 Test settings: Number of bytes to test. More...
 

Functions

int main (void)
 Application entry point for FatFS example. More...
 
static uint8_t run_fatfs_test (uint32_t disk_dev_num)
 Do file system tests. More...
 
static FRESULT scan_files (char *path)
 Scan files under a certain path. More...
 

Variables

static uint8_t data_buffer [DATA_SIZE]
 

#define BOARD_NAME   "Undefined"
#define DATA_SIZE   2048

Size of the file to write/read.

Referenced by run_fatfs_test().

#define MENU_HEADER
Value:
"\n\r" \
"---------------------------------------------------------\n\r"
#define STRING_EOL   "\r"

Example header.

#define STRING_HEADER
Value:
"-- FatFS Example --\r\n" \
"-- "BOARD_NAME " --\r\n" \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define STRING_EOL
Example header.
Definition: fatfs_access_example.c:110
#define BOARD_NAME
Definition: fatfs_access_example.c:112

Referenced by main().

#define TEST_SIZE   (4 * 1024)

Test settings: Number of bytes to test.

Referenced by run_fatfs_test().

static uint8_t run_fatfs_test ( uint32_t  disk_dev_num)
static

Do file system tests.

Parameters
disk_dev_numdisk number
Returns
Test result, 1: success.

References data_buffer, DATA_SIZE, f_close(), f_mkfs(), f_mount(), f_open(), f_opendir(), f_read(), f_write(), FA_CREATE_ALWAYS, FA_OPEN_EXISTING, FA_READ, FA_WRITE, file_object, FR_NO_FILESYSTEM, FR_OK, fs, FIL::fsize, i, scan_files(), and TEST_SIZE.

Referenced by main().

static FRESULT scan_files ( char *  path)
static

Scan files under a certain path.

Parameters
pathFolder path.
Returns
Scan result, 1: success.

References _MAX_LFN, AM_DIR, f_opendir(), f_readdir(), FILINFO::fattrib, FILINFO::fname, FR_OK, and i.

Referenced by run_fatfs_test().

uint8_t data_buffer[DATA_SIZE]
static

Referenced by run_fatfs_test().