SD card for ARM board (first part)

This commit is contained in:
bsongis
2012-05-14 17:36:18 +00:00
parent 7b16972636
commit ab2c65b9f2
25 changed files with 6462 additions and 2874 deletions
+1 -1
View File
@@ -395,7 +395,7 @@ DSTATUS disk_initialize (
/*-----------------------------------------------------------------------*/
DSTATUS disk_status (
BYTE drv /* Physical drive nmuber (0) */
BYTE drv /* Physical drive number (0) */
)
{
if (drv) return STA_NOINIT; /* Supports only single drive */
+25
View File
@@ -120,6 +120,7 @@
#include "ff.h" /* FatFs configurations and declarations */
#include "diskio.h" /* Declarations of low level disk I/O functions */
#include "gtime.h"
/*--------------------------------------------------------------------------
@@ -2027,6 +2028,30 @@ FRESULT f_mount (
}
/*---------------------------------------------------------*/
/* User Provided Date/Time Function for FatFs module */
/*---------------------------------------------------------*/
/* This is a real time clock service to be called from */
/* FatFs module. Any valid time must be returned even if */
/* the system does not support a real time clock. */
/* This is not required in read-only configuration. */
uint8_t g_ms100 = 0; // global to allow time set function to reset to zero
gtime_t g_unixTime; // global date/time register, incremented each second in per10ms()
uint32_t o9x_get_fattime(void)
{
struct gtm t;
filltm(&g_unixTime, &t); // create a struct tm date/time structure from global unix time stamp
/* Pack date and time into a DWORD variable */
return ((DWORD)(t.tm_year - 80) << 25)
| ((uint32_t)(t.tm_mon+1) << 21)
| ((uint32_t)t.tm_mday << 16)
| ((uint32_t)t.tm_hour << 11)
| ((uint32_t)t.tm_min << 5)
| ((uint32_t)t.tm_sec >> 1);
}
/*-----------------------------------------------------------------------*/
+3
View File
@@ -57,6 +57,7 @@ extern "C" {
#include "inttypes.h"
#include "integer.h" /* Basic integer types */
#include "ffconf.h" /* FatFs configuration options */
#include "gtime.h"
#if _FATFS != _FFCONF
#error Wrong configuration file (ffconf.h).
@@ -572,4 +573,6 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
}
#endif
extern gtime_t g_unixTime; // Global date/time register, incremented each second in per10ms()
#endif /* _FATFS */
+8 -1
View File
@@ -34,9 +34,12 @@
#ifndef sdcard_h
#define sdcard_h
#include "ff.h"
#include "rtc.h"
#include "gtime.h"
#define LOGS_PATH "/9XLOGS" // no trailing slash = important
#define MODELS_PATH "/9XMODELS"
#define MODELS_EXT ".bin"
extern char g_logFilename[21]; // "/9XLOGS/M00_000.CSV\0" max required length = 21
@@ -49,5 +52,9 @@ extern void writeLogs();
const pm_char *SDCARD_ERROR(FRESULT result);
// MM/SD card Disk IO Support
extern void disk_timerproc(void);
extern uint8_t g_ms100; // defined in drivers.cpp
#endif