mikroSDK Reference Manual
Physical Drive

Physical Drive Reference. More...

Modules

 Physical Drive APIs Status
 Physical Drive API function return values.
 
 Physical Drive Data
 Physical Drive Data Structure Reference.
 

Functions list

pd_status_t physical_drive_init (physical_drive_t *physical_drive)
 Initialize a Hardware memory module. More...
 
pd_status_t physical_drive_read (physical_drive_t *physical_drive, void *buffer, unsigned long long addr, unsigned long long size)
 Write to a Hardware Memory Module. More...
 
pd_status_t physical_drive_write (physical_drive_t *physical_drive, const void *__generic_ptr buffer, unsigned long long addr, unsigned long long size)
 Read from a Hardware Memory Module. More...
 
pd_status_t sdspi_physical_drive_init (sdspi_physical_drive_t *sd, sdspi_config_t *config)
 Initializes Physical Drive for SD Card communication via SPI bus. More...
 

Detailed Description

Physical Drive Data Structures and API Reference.

Function Documentation

◆ physical_drive_init()

pd_status_t physical_drive_init ( physical_drive_t physical_drive)

This API function will initialize hardware memory module, making it ready for subsequent read and write operations.

Parameters
[in]physical_driveA pointer to the physical drive base structure. It manages communication with, and identifies hardware memory module. See physical_drive_t, and sdspi_physical_drive_t structures for detailed explanation.
Return values
PDS_OKIf the hardware memory module is initialized successfully.
FSS_GENERAL_ERRORIf the hardware memory module failed.
Precondition
physical_drive structure must be initialized before calling this function. See sdspi_physical_drive_init functions for detailed explanation.
Postcondition
Reading from and writing to hardware memory module is now possible. All other physical drive API function can be called.
Note
physical_drive should be used only as base of derived structures. Eg. sdspi_physical_drive_t.

◆ physical_drive_read()

pd_status_t physical_drive_read ( physical_drive_t physical_drive,
void *  buffer,
unsigned long long  addr,
unsigned long long  size 
)

This API function will write size number of bytes from the buffer into the hardware memory module at the location indicated by the parameter addr.

Parameters
[in]physical_driveA pointer to the physical drive base structure. It manages communication with, and identifies hardware memory module. See physical_drive_t, and sdspi_physical_drive_t structures for detailed explanation.
[in]bufferA pointer to the buffer from which data will be written to the hardware memory module.
[in]addrThe location inside hardware memory module, in unit of bytes, where data will be written.
[in]sizeNumber of bytes data that needs to be written into the hardware memory module.
Return values
PDS_OKIf data was written to the hardware memory module successfully.
FSS_GENERAL_ERRORIf writing data failed.
Precondition
The hardware memory module must be initialized first. See physical_drive_init functions for detailed explanation.
Note
physical_drive should be used only as base of derived structures. Eg. sdspi_physical_drive_t.

◆ physical_drive_write()

pd_status_t physical_drive_write ( physical_drive_t physical_drive,
const void *__generic_ptr  buffer,
unsigned long long  addr,
unsigned long long  size 
)

This API function will read size number of bytes from the location indicated by the parameter addr inside hardware memory module, and store it into the buffer.

Parameters
[in]physical_driveA pointer to the physical drive base structure. It manages communication with, and identifies hardware memory module. See physical_drive_t, and sdspi_physical_drive_t structures for detailed explanation.
[in]bufferA pointer to the buffer where data read form the hardware memory module will be stored.
[in]addrThe location inside hardware memory module, from which data will be read.
[in]sizeNumber of bytes data that needs to be read from the hardware memory module.
Return values
PDS_OKIf data was read from the hardware memory module successfully.
FSS_GENERAL_ERRORIf reading data failed.
Precondition
The hardware memory module must be initialized first. See physical_drive_init functions for detailed explanation.

◆ sdspi_physical_drive_init()

pd_status_t sdspi_physical_drive_init ( sdspi_physical_drive_t sd,
sdspi_config_t config 
)

This API function will initialize the sd structure with data provided by the config structure, by initializing spi and cs, thus enabling the communication with SD Card via SPI bus. vtptr vector tables inside the physical drive base structure, will be initialized to point to functions that implement communication with SD Card via SPI bus. All other struct members are set to zeros.

Postcondition
Physical drive sd is now ready to be used by the Physical Drive API functions. SD Card hardware memory module should be initialized now by calling physical_drive_init,