sd.h File Reference

Function library for secure digital memory. More...

#include "cfg/cfg_fat.h"
#include <kern/kfile.h>
#include <fs/fatfs/diskio.h>

Go to the source code of this file.

Defines

#define sd_disk_initialize   disk_initialize
 Same as sd_disk_status.
#define sd_disk_status   disk_status
 Return the status of the disk.
#define sd_disk_read   disk_read
 Read count sectors from SD card.
#define sd_disk_write   disk_write
 Write count sectors to SD card.
#define sd_disk_ioctl   disk_ioctl
 Interface to send device independant commands to the device.

Functions

bool sd_init (KFile *_fd)
 Initializes the SD driver.

Detailed Description

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>

Definition in file sd.h.


Define Documentation

#define sd_disk_initialize   disk_initialize

Same as sd_disk_status.

Card initialization must be done with sd_init.

Definition at line 71 of file sd.h.

#define sd_disk_ioctl   disk_ioctl

Interface to send device independant commands to the device.

See also:
diskio.h and related documentation for further explanations.

Definition at line 114 of file sd.h.

#define sd_disk_read   disk_read

Read count sectors from SD card.

Parameters:
drv The drive number to read from. Only 0 is supported.
buf A buffer to store read data. You can get sector size using sd_disk_ioctl.
sector Start sector number.
count The number of sectors to read.
Returns:
RES_OK if the function succeded, RES_ERROR if any error occurred, RES_NOTRDY if the disk is not initialized.
See also:
diskio.h

Definition at line 91 of file sd.h.

#define sd_disk_status   disk_status

Return the status of the disk.

Parameters:
drv The number of the drive to initialize. Currently only drive 0 is allowed.
Returns:
RES_OK if the sd card was correctly initialized by a previous call to sd_init(), STA_NOINIT otherwise.

Definition at line 79 of file sd.h.

#define sd_disk_write   disk_write

Write count sectors to SD card.

Parameters:
drv The drive number to read from. Only 0 is supported.
buf The data to be written.
sector Start sector number.
count The number of sectors to write.
Returns:
RES_OK if the function succeded, RES_ERROR if any error occurred, RES_NOTRDY if the disk is not initialized.
See also:
diskio.h

Definition at line 106 of file sd.h.


Function Documentation

bool sd_init ( KFile _fd  ) 

Initializes the SD driver.

Parameters:
_fd A pointer to a kfile where the SD will read/write to.
Returns:
true if initialization succeds, false otherwise.

Definition at line 343 of file sd.c.