Physical Drive Reference.
More...
Physical Drive Data Structures and API Reference.
◆ physical_drive_init()
This API function will initialize hardware memory module, making it ready for subsequent read and write operations.
- Parameters
-
[in] | physical_drive | A 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_OK | If the hardware memory module is initialized successfully. |
FSS_GENERAL_ERROR | If 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_drive | A 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] | buffer | A pointer to the buffer from which data will be written to the hardware memory module. |
[in] | addr | The location inside hardware memory module, in unit of bytes, where data will be written. |
[in] | size | Number of bytes data that needs to be written into the hardware memory module. |
- Return values
-
PDS_OK | If data was written to the hardware memory module successfully. |
FSS_GENERAL_ERROR | If 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_drive | A 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] | buffer | A pointer to the buffer where data read form the hardware memory module will be stored. |
[in] | addr | The location inside hardware memory module, from which data will be read. |
[in] | size | Number of bytes data that needs to be read from the hardware memory module. |
- Return values
-
PDS_OK | If data was read from the hardware memory module successfully. |
FSS_GENERAL_ERROR | If reading data failed. |
- Precondition
- The hardware memory module must be initialized first. See physical_drive_init functions for detailed explanation.
◆ sdspi_physical_drive_init()
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,