Hanna
Sourcecode Batteriemanagementsystem
Dateien | Funktionen
Sd_raw

Dateien

Datei  sd_raw_config.h
 SD-Card Reader Bibliothek von Roland Riegel.
 

Funktionen

uint8_t sd_raw_available ()
 
uint8_t sd_raw_get_info (struct sd_raw_info *info)
 
uint8_t sd_raw_init ()
 
uint8_t sd_raw_locked ()
 
uint8_t sd_raw_read (offset_t offset, uint8_t *buffer, uintptr_t length)
 
uint8_t sd_raw_read_interval (offset_t offset, uint8_t *buffer, uintptr_t interval, uintptr_t length, sd_raw_read_interval_handler_t callback, void *p)
 
static uint8_t sd_raw_rec_byte ()
 
static void sd_raw_send_byte (uint8_t b)
 
static uint8_t sd_raw_send_command (uint8_t command, uint32_t arg)
 
uint8_t sd_raw_sync ()
 
uint8_t sd_raw_write (offset_t offset, const uint8_t *buffer, uintptr_t length)
 
uint8_t sd_raw_write_interval (offset_t offset, uint8_t *buffer, uintptr_t length, sd_raw_write_interval_handler_t callback, void *p)
 

Ausführliche Beschreibung

Dokumentation der Funktionen

uint8_t sd_raw_available ( )

Checks wether a memory card is located in the slot.

Rückgabe
1 if the card is available, 0 if it is not.

Definiert in Zeile 332 der Datei sd_raw.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_get_info ( struct sd_raw_info info)

Reads informational data from the card.

This function reads and returns the card's registers containing manufacturing and status information.

Zu beachten
: The information retrieved by this function is not required in any way to operate on the card, but it might be nice to display some of the data to the user.
Parameter
[in]infoA pointer to the structure into which to save the information.
Rückgabe
0 on failure, 1 on success.

Definiert in Zeile 848 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

uint8_t sd_raw_init ( )

Initialises memory card communication.

Rückgabe
0 on failure, 1 on success.
Noch zu erledigen:
notwendig ?

Definiert in Zeile 171 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

uint8_t sd_raw_locked ( )

Checks wether the memory card is locked for write access.

Rückgabe
1 if the card is locked, 0 if it is not.

Definiert in Zeile 343 der Datei sd_raw.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_read ( offset_t  offset,
uint8_t *  buffer,
uintptr_t  length 
)

Reads raw data from the card.

Parameter
[in]offsetThe offset from which to read.
[out]bufferThe buffer into which to write the data.
[in]lengthThe number of bytes to read.
Rückgabe
0 on failure, 1 on success.
Siehe auch
sd_raw_read_interval, sd_raw_write, sd_raw_write_interval

Definiert in Zeile 453 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_read_interval ( offset_t  offset,
uint8_t *  buffer,
uintptr_t  interval,
uintptr_t  length,
sd_raw_read_interval_handler_t  callback,
void *  p 
)

Continuously reads units of interval bytes and calls a callback function.

This function starts reading at the specified offset. Every interval bytes, it calls the callback function with the associated data buffer.

By returning zero, the callback may stop reading.

Zu beachten
Within the callback function, you can not start another read or write operation.
This function only works if the following conditions are met:
  • (offset - (offset % 512)) % interval == 0
  • length % interval == 0
Parameter
[in]offsetOffset from which to start reading.
[in]bufferPointer to a buffer which is at least interval bytes in size.
[in]intervalNumber of bytes to read before calling the callback function.
[in]lengthNumber of bytes to read altogether.
[in]callbackThe function to call every interval bytes.
[in]pAn opaque pointer directly passed to the callback function.
Rückgabe
0 on failure, 1 on success
Siehe auch
sd_raw_write_interval, sd_raw_read, sd_raw_write

Definiert in Zeile 563 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

uint8_t sd_raw_rec_byte ( )
static

Receives a raw byte from the memory card.

Rückgabe
The byte which should be read.
Siehe auch
sd_raw_send_byte

Definiert in Zeile 378 der Datei sd_raw.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void sd_raw_send_byte ( uint8_t  b)
static

Sends a raw byte to the memory card.

Parameter
[in]bThe byte to sent.
Siehe auch
sd_raw_rec_byte
Noch zu erledigen:
SPSR &= ~(1 << SPIF);

Definiert in Zeile 355 der Datei sd_raw.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_send_command ( uint8_t  command,
uint32_t  arg 
)
static

Send a command to the memory card which responses with a R1 response (and possibly others).

Parameter
[in]commandThe command to send.
[in]argThe argument for command.
Rückgabe
The command answer.

Definiert in Zeile 407 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_sync ( )

Writes the write buffer's content to the card.

Zu beachten
When write buffering is enabled, you should call this function before disconnecting the card to ensure all remaining data has been written.
Rückgabe
0 on failure, 1 on success.
Siehe auch
sd_raw_write

Definiert in Zeile 822 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_write ( offset_t  offset,
const uint8_t *  buffer,
uintptr_t  length 
)

Writes raw data to the card.

Zu beachten
If write buffering is enabled, you might have to call sd_raw_sync() before disconnecting the card to ensure all remaining data has been written.
Parameter
[in]offsetThe offset where to start writing.
[in]bufferThe buffer containing the data to be written.
[in]lengthThe number of bytes to write.
Rückgabe
0 on failure, 1 on success.
Siehe auch
sd_raw_write_interval, sd_raw_read, sd_raw_read_interval

Definiert in Zeile 673 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

uint8_t sd_raw_write_interval ( offset_t  offset,
uint8_t *  buffer,
uintptr_t  length,
sd_raw_write_interval_handler_t  callback,
void *  p 
)

Writes a continuous data stream obtained from a callback function.

This function starts writing at the specified offset. To obtain the next bytes to write, it calls the callback function. The callback fills the provided data buffer and returns the number of bytes it has put into the buffer.

By returning zero, the callback may stop writing.

Parameter
[in]offsetOffset where to start writing.
[in]bufferPointer to a buffer which is used for the callback function.
[in]lengthNumber of bytes to write in total. May be zero for endless writes.
[in]callbackThe function used to obtain the bytes to write.
[in]pAn opaque pointer directly passed to the callback function.
Rückgabe
0 on failure, 1 on success
Siehe auch
sd_raw_read_interval, sd_raw_write, sd_raw_read

Definiert in Zeile 781 der Datei sd_raw.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft: