projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move TIMER_AFTER() and TIMER_BEFORE() macros in drv/timer.h
[bertos.git]
/
bertos
/
drv
/
sd.h
diff --git
a/bertos/drv/sd.h
b/bertos/drv/sd.h
index 368e0d4fff975d6d375257004ed01c1f2f3e4fca..df12bb6e7a0639a2cdd05bdff6cf7513f862307c 100644
(file)
--- a/
bertos/drv/sd.h
+++ b/
bertos/drv/sd.h
@@
-31,13
+31,11
@@
*
* \brief Function library for secure digital memory.
*
*
* \brief Function library for secure digital memory.
*
- * Right now, the interface for these function is the one defined in diskio.h from
- * the FatFS module.
*
* \author Francesco Sacchi <batt@develer.com>
*
* $WIZ$ module_name = "sd"
*
* \author Francesco Sacchi <batt@develer.com>
*
* $WIZ$ module_name = "sd"
- * $WIZ$ module_depends = "kfile", "timer"
+ * $WIZ$ module_depends = "kfile", "timer"
, "kblock"
* $WIZ$ module_hw = "bertos/hw/hw_sd.h"
* $WIZ$ module_configuration = "bertos/cfg/cfg_sd.h"
*/
* $WIZ$ module_hw = "bertos/hw/hw_sd.h"
* $WIZ$ module_configuration = "bertos/cfg/cfg_sd.h"
*/
@@
-46,19
+44,25
@@
#ifndef DRV_SD_H
#define DRV_SD_H
#ifndef DRV_SD_H
#define DRV_SD_H
+#include "cfg/cfg_sd.h"
+
#include <io/kfile.h>
#include <io/kblock.h>
#include <fs/fatfs/diskio.h>
#include <io/kfile.h>
#include <io/kblock.h>
#include <fs/fatfs/diskio.h>
-#include "cfg/cfg_sd.h"
+#define SD_UNBUFFERED BV(0) ///< Open SD memory disabling page caching, no modification and partial write are allowed.
+/**
+ * SD Card context structure.
+ */
typedef struct Sd
{
typedef struct Sd
{
- KBlock b;
+ KBlock b;
///< KBlock base class
KFile *ch; ///< SPI communication channel
KFile *ch; ///< SPI communication channel
- uint16_t r1;
+ uint16_t r1; ///< Last status data received from SD
+ uint16_t tranfer_len; ///< Lenght for the read/write commands, cached in order to increase speed.
} Sd;
bool sd_initUnbuf(Sd *sd, KFile *ch);
} Sd;
bool sd_initUnbuf(Sd *sd, KFile *ch);
@@
-79,6
+83,8
@@
bool sd_initBuf(Sd *sd, KFile *ch);
*
* \note This API is deprecated, disable CONFIG_SD_OLD_INIT and
* use the new one instead.
*
* \note This API is deprecated, disable CONFIG_SD_OLD_INIT and
* use the new one instead.
+ *
+ * \see CONFIG_SD_OLD_INIT.
*/
#define sd_init(ch) {static struct Sd sd; sd_initUnbuf(&sd, (ch));}
*/
#define sd_init(ch) {static struct Sd sd; sd_initUnbuf(&sd, (ch));}
@@
-96,7
+102,7
@@
bool sd_initBuf(Sd *sd, KFile *ch);
*
* \return true if initialization succeds, false otherwise.
*/
*
* \return true if initialization succeds, false otherwise.
*/
- #define sd_init(sd, ch, buffered) ((buffered
) ? sd_initBuf((sd), (ch)) : sd_initUnb
uf((sd), (ch)))
+ #define sd_init(sd, ch, buffered) ((buffered
& SD_UNBUFFERED) ? sd_initUnbuf((sd), (ch)) : sd_initB
uf((sd), (ch)))
#endif
#endif