Typedefs | |
typedef struct sdio_uif * | sdio_uif_t |
typedef void(LIBSDIOAPI * | sdio_int_handler_t )(sdio_uif_t uif, void *arg) |
typedef void(LIBSDIOAPI * | sdio_io_callback_t )(sdio_uif_t uif, void *arg, int status) |
Enumerations | |
enum | sdio_status { SDIO_SUCCESS = 0, SDIO_EAGAIN = -1, SDIO_EINVAL = -2, SDIO_EIO = -3, SDIO_ENODEV = -4, SDIO_ENOMEM = -5, SDIO_ENOTSUPP = -6, SDIO_ENXIO = -7, SDIO_ETIMEDOUT = -8 } |
Functions | |
sdio_uif_t LIBSDIOAPI | sdio_open (const char *dev_filename, sdio_int_handler_t int_handler, void *arg) |
void LIBSDIOAPI | sdio_interrupt_mask (sdio_uif_t uif) |
void LIBSDIOAPI | sdio_interrupt_unmask (sdio_uif_t uif) |
void LIBSDIOAPI | sdio_close (sdio_uif_t uif) |
int LIBSDIOAPI | sdio_num_functions (sdio_uif_t uif) |
int LIBSDIOAPI | sdio_set_bus_width (sdio_uif_t uif, int bus_width) |
void LIBSDIOAPI | sdio_set_max_bus_freq (sdio_uif_t uif, int max_freq) |
uint16_t LIBSDIOAPI | sdio_manf_id (sdio_uif_t uif) |
uint16_t LIBSDIOAPI | sdio_card_id (sdio_uif_t uif) |
uint8_t LIBSDIOAPI | sdio_std_if (sdio_uif_t uif, int func) |
int LIBSDIOAPI | sdio_max_block_size (sdio_uif_t uif, int func) |
int LIBSDIOAPI | sdio_block_size (sdio_uif_t uif, int func) |
int LIBSDIOAPI | sdio_set_block_size (sdio_uif_t uif, int func, int blksz) |
int LIBSDIOAPI | sdio_read8 (sdio_uif_t uif, int func, uint32_t addr, uint8_t *data) |
int LIBSDIOAPI | sdio_write8 (sdio_uif_t uif, int func, uint32_t addr, uint8_t data) |
int LIBSDIOAPI | sdio_read (sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, size_t len, int block_size) |
int LIBSDIOAPI | sdio_write (sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, size_t len, int block_size) |
int LIBSDIOAPI | sdio_read8_async (sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, sdio_io_callback_t callback, void *arg) |
int LIBSDIOAPI | sdio_write8_async (sdio_uif_t uif, int func, uint32_t addr, uint8_t data, sdio_io_callback_t callback, void *arg) |
int LIBSDIOAPI | sdio_read_async (sdio_uif_t uif, int func, uint32_t addr, uint8_t *data, size_t len, int block_size, sdio_io_callback_t callback, void *arg) |
int LIBSDIOAPI | sdio_write_async (sdio_uif_t uif, int func, uint32_t addr, const uint8_t *data, size_t len, int block_size, sdio_io_callback_t callback, void *arg) |
int LIBSDIOAPI | sdio_reinsert_card (sdio_uif_t uif) |
Use of this library requires several sdioemb kernel modules to be loaded:
sdio
.An
SDIO slot driver (e.g., slot_shc
for a standard PCI SDIO Host Controller).sdio_uif
which provides the required character devices (/dev/sdio_uif0 for the card in SDIO slot 0 etc.). typedef void(LIBSDIOAPI * sdio_int_handler_t)(sdio_uif_t uif, void *arg) |
Card interrupt handler function.
uif | handle to the interrupting device. | |
arg | data supplied by the caller of sdio_open(). |
typedef void(LIBSDIOAPI * sdio_io_callback_t)(sdio_uif_t uif, void *arg, int status) |
Asynchronous IO completion callback function.
uif | handle to the device that completed the IO operation. | |
arg | data supplied by the caller of the asynchronous IO operation. | |
status | status of the IO operation. 0 is success; -EIO, -EINVAL, -ETIMEDOUT etc. on an error. |
typedef struct sdio_uif* sdio_uif_t |
Handle to an opened SDIO Userspace Interface device.
int LIBSDIOAPI sdio_block_size | ( | sdio_uif_t | uif, | |
int | func | |||
) |
Return a function's current block size.
uif | device handle. | |
func | card function to query. |
uint16_t LIBSDIOAPI sdio_card_id | ( | sdio_uif_t | uif | ) |
Return the card's card (device) ID.
uif | device handle. |
void LIBSDIOAPI sdio_close | ( | sdio_uif_t | uif | ) |
Close an opened SDIO Userspace Interface device, freeing all associated resources.
uif | handle to the device. |
void LIBSDIOAPI sdio_interrupt_mask | ( | sdio_uif_t | uif | ) |
Mask the SDIO interrupt.
Call this in an interrupt handler to allow the processing of interrupts to be deferred until after the interrupt handler has returned.
uif | device handle. |
void LIBSDIOAPI sdio_interrupt_unmask | ( | sdio_uif_t | uif | ) |
Unmask the SDIO interrupt.
Unmasks the SDIO interrupt if it had previously been masked with sdio_interrupt_mask().
uif | device handle. |
uint16_t LIBSDIOAPI sdio_manf_id | ( | sdio_uif_t | uif | ) |
Return the card's manufacturer (vendor) ID.
uif | device handle. |
int LIBSDIOAPI sdio_max_block_size | ( | sdio_uif_t | uif, | |
int | func | |||
) |
Return a function's maximum supported block size.
uif | device handle. | |
func | card function to query. |
int LIBSDIOAPI sdio_num_functions | ( | sdio_uif_t | uif | ) |
Return the number of functions the card has.
uif | device handle. |
sdio_uif_t LIBSDIOAPI sdio_open | ( | const char * | dev_filename, | |
sdio_int_handler_t | int_handler, | |||
void * | arg | |||
) |
Open a SDIO Userspace Interface device and (optionally) register a card interrupt handler and enable card interrupts.
Card interrupts are masked before calling int_handler and are unmasked when int_handler returns (unless sdio_interrupt_mask() is called).
dev_filename | filename of the device to open. | |
int_handler | card interrupt handler; or NULL if no interrupt handler is required. | |
arg | argument to be passed to the interrupt handler. |
int LIBSDIOAPI sdio_read | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t * | data, | |||
size_t | len, | |||
int | block_size | |||
) |
Read a buffer from a 8 bit wide register/FIFO.
The buffer read uses a fixed (not incrementing) address.
block_size must be set to the value writted into func's I/O block size FBR register.
If len % block_size == 0, a block mode transfer is used; a byte mode transfer is used if len < block_size.
uif | device handle. | |
func | card function. | |
addr | register/FIFO address. | |
data | buffer to store the data read. | |
len | length of data to read. | |
block_size | block size to use for this transfer. |
int LIBSDIOAPI sdio_read8 | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t * | data | |||
) |
Read an 8 bit register.
uif | device handle. | |
func | card function. | |
addr | register address. | |
data | the data read. |
int LIBSDIOAPI sdio_read8_async | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t * | data, | |||
sdio_io_callback_t | callback, | |||
void * | arg | |||
) |
Read an 8 bit register, without waiting for completion.
uif | device handle. | |
func | card function. | |
addr | register address. | |
data | the data read. | |
callback | function to be called when the read completes. | |
arg | argument to be passed to callback. |
int LIBSDIOAPI sdio_read_async | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t * | data, | |||
size_t | len, | |||
int | block_size, | |||
sdio_io_callback_t | callback, | |||
void * | arg | |||
) |
Read a buffer from a 8 bit wide register/FIFO, without waiting for completion.
The buffer read uses a fixed (not incrementing) address.
block_size must be set to the value writted into func's I/O block size FBR register.
If len % block_size == 0, a block mode transfer is used; a byte mode transfer is used if len < block_size.
uif | device handle. | |
func | card function. | |
addr | register/FIFO address. | |
data | buffer to store the data read. | |
len | length of data to read. | |
block_size | block size to use for this transfer. | |
callback | function to be called when the read completes. | |
arg | argument to be passed to callback. |
int LIBSDIOAPI sdio_reinsert_card | ( | sdio_uif_t | uif | ) |
Force a card removal and reinsertion.
This will power cycle the card if the slot hardware supports power control.
uif | device handle. |
int LIBSDIOAPI sdio_set_block_size | ( | sdio_uif_t | uif, | |
int | func, | |||
int | blksz | |||
) |
Set a function's block size.
The function's block size registers will be written if necessary.
uif | device handle. | |
func | function to modify. | |
blksz | the new block size; or 0 for the default size. |
int LIBSDIOAPI sdio_set_bus_width | ( | sdio_uif_t | uif, | |
int | bus_width | |||
) |
Set an SDIO bus to 1 bit or 4 bit wide mode.
The CCCR bus interface control register will be read and rewritten with the new bus width.
uif | device handle. | |
bus_width | bus width (1 or 4). |
void LIBSDIOAPI sdio_set_max_bus_freq | ( | sdio_uif_t | uif, | |
int | max_freq | |||
) |
Limit the frequency of (or stop) the SD bus clock.
The frequency cannot be set greater than that supported by the card or the controller.
uif | device handle. | |
max_freq | maximum frequency (Hz) or 0 to stop the bus clock until the start of the next command. |
uint8_t LIBSDIOAPI sdio_std_if | ( | sdio_uif_t | uif, | |
int | func | |||
) |
Return the standard interface code for a function.
uif | device handle. | |
func | card function to query. |
int LIBSDIOAPI sdio_write | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
const uint8_t * | data, | |||
size_t | len, | |||
int | block_size | |||
) |
Write a buffer to an 8 bit wide register/FIFO.
The buffer write uses a fixed (not incrementing) address.
block_size must be set to the value writted into func's I/O block size FBR register.
If len % block_size == 0, a block mode transfer is used; a byte mode transfer is used if len < block_size.
uif | device handle. | |
func | card function. | |
addr | register/FIFO address. | |
data | buffer of data to write. | |
len | length of the data to write. | |
block_size | block size to use for this transfer. |
int LIBSDIOAPI sdio_write8 | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t | data | |||
) |
Write an 8 bit register.
uif | device handle. | |
func | card function. | |
addr | register address. | |
data | the data to write. |
int LIBSDIOAPI sdio_write8_async | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
uint8_t | data, | |||
sdio_io_callback_t | callback, | |||
void * | arg | |||
) |
Write an 8 bit register, without waiting for completion.
uif | device handle. | |
func | card function. | |
addr | register address. | |
data | the data to write. | |
callback | function to be called when the write completes. | |
arg | argument to be passed to callback. |
int LIBSDIOAPI sdio_write_async | ( | sdio_uif_t | uif, | |
int | func, | |||
uint32_t | addr, | |||
const uint8_t * | data, | |||
size_t | len, | |||
int | block_size, | |||
sdio_io_callback_t | callback, | |||
void * | arg | |||
) |
Write a buffer to an 8 bit wide register/FIFO, without waiting for completion.
The buffer write uses a fixed (not incrementing) address.
block_size must be set to the value writted into func's I/O block size FBR register.
If len % block_size == 0, a block mode transfer is used; a byte mode transfer is used if len < block_size.
uif | device handle. | |
func | card function. | |
addr | register/FIFO address. | |
data | buffer of data to write. | |
len | length of the data to write. | |
block_size | block size to use for this transfer. | |
callback | function to be called when the write completes. | |
arg | argument to be passed to callback. |