Go to the source code of this file.
|
vsf_err_t | vk_mal_init (vk_mal_t *pthis) |
| prepare subcall to initialize a mal instance.
|
|
vsf_err_t | vk_mal_fini (vk_mal_t *pthis) |
| prepare subcall to finialize a mal instance.
|
|
uint_fast32_t | vk_mal_blksz (vk_mal_t *pthis, uint_fast64_t addr, uint_fast32_t size, vsf_mal_op_t op) |
| get the block size of a dedicated operation.
|
|
bool | vk_mal_prepare_buffer (vk_mal_t *pthis, uint_fast64_t addr, uint_fast32_t size, vsf_mal_op_t op, vsf_mem_t *mem) |
| get the local memory of a dedicated operation, if mal instance has VSF_MAL_LOCAL_BUFFER feature.
|
|
vsf_err_t | vk_mal_erase (vk_mal_t *pthis, uint_fast64_t addr, uint_fast32_t size) |
| prepare subcall to erase a mal instance.
|
|
vsf_err_t | vk_mal_read (vk_mal_t *pthis, uint_fast64_t addr, uint_fast32_t size, uint8_t *buff) |
| prepare subcall to read a mal instance.
|
|
vsf_err_t | vk_mal_write (vk_mal_t *pthis, uint_fast64_t addr, uint_fast32_t size, uint8_t *buff) |
| prepare subcall to write a mal instance.
|
|
vsf_err_t | vk_mal_read_stream (vk_mal_stream_t *pthis, uint_fast64_t addr, uint_fast32_t size, vsf_stream_t *stream) |
| prepare subcall to read mal instance into a stream.
|
|
vsf_err_t | vk_mal_write_stream (vk_mal_stream_t *pthis, uint_fast64_t addr, uint_fast32_t size, vsf_stream_t *stream) |
| prepare subcall to write a stream into mal instance.
|
|
◆ vsf_mal_op_t
This module provides MAL(Memory Abstraction Layser) device class. !
- Author
- SimonQian !
- Note
- Supports read/write/erase operation in block granularity. ! Enabled by VSF_USE_MAL. Drivers: ! mim_mal(mim: mal in mal) by VSF_MAL_USE_MIM_MAL: ! Used to derive a mal device from partial of another mal device. ! fakefat32_mal by VSF_MAL_USE_FAKEFAT32_MAL, depends on VSF_USE_FS/VSF_FS_USE_MEMFS/VSF_FS_USE_FATFS: ! Generate a vitual fat32 mal device. ! file_mal by VSF_MAL_USE_FILE_MAL, depends on VSF_USE_FS: ! Generate a mal device from a file. ! flash_mal by VSF_MAL_USE_FLASH_MAL, depends on VSF_HAL_USE_FLASH: ! Generate a mal device from partial of the FLASH in HAL. ! mem_mal by VSF_MAL_USE_MEM_MAL: ! Generate a mal device from io-accessable memory. ! sdmmc_mal by VSF_MAL_USE_SDMMC_MAL: ! Mal device from a SD/MMC card. ! scsi_mal by VSF_MAL_USE_SCSI_MAL, depnends on VSF_USE_SCSI: ! Mal device from a SCSI device.
◆ vsf_mal_feature_t
◆ vsf_mal_op_t
This module provides MAL(Memory Abstraction Layser) device class. !
- Author
- SimonQian !
- Note
- Supports read/write/erase operation in block granularity. ! Enabled by VSF_USE_MAL. Drivers: ! mim_mal(mim: mal in mal) by VSF_MAL_USE_MIM_MAL: ! Used to derive a mal device from partial of another mal device. ! fakefat32_mal by VSF_MAL_USE_FAKEFAT32_MAL, depends on VSF_USE_FS/VSF_FS_USE_MEMFS/VSF_FS_USE_FATFS: ! Generate a vitual fat32 mal device. ! file_mal by VSF_MAL_USE_FILE_MAL, depends on VSF_USE_FS: ! Generate a mal device from a file. ! flash_mal by VSF_MAL_USE_FLASH_MAL, depends on VSF_HAL_USE_FLASH: ! Generate a mal device from partial of the FLASH in HAL. ! mem_mal by VSF_MAL_USE_MEM_MAL: ! Generate a mal device from io-accessable memory. ! sdmmc_mal by VSF_MAL_USE_SDMMC_MAL: ! Mal device from a SD/MMC card. ! scsi_mal by VSF_MAL_USE_SCSI_MAL, depnends on VSF_USE_SCSI: ! Mal device from a SCSI device.
Enumerator |
---|
VSF_MAL_OP_ERASE | |
VSF_MAL_OP_READ | |
VSF_MAL_OP_WRITE | |
◆ vsf_mal_feature_t
Enumerator |
---|
VSF_MAL_READABLE | |
VSF_MAL_WRITABLE | |
VSF_MAL_ERASABLE | |
VSF_MAL_NON_UNIFIED_BLOCK | |
VSF_MAL_LOCAL_BUFFER | |
◆ vk_mal_init()
prepare subcall to initialize a mal instance.
- Note
- A mal instance MUST be successfully initialized before calling other mal APIs. The initialization is done by a subcall, so if vk_mal_init returns VSF_ERR_NONE, it does not mean that the initialization is done. It depends on the caller context.
- If caller is a stack-owner thread, vk_mal_init will return after subcall is done. The result of initialization can be got by vsf_eda_get_return_value, with type vsf_err_t.
- If caller is not a stack-owner thread, the initializaion subcall will start after exiting of current event handler. After the subcall is done, VSF_EVT_RETURN will be send to the caller task. And vsf_eda_get_return_value could be called to get the result with type vsf_err_t.
- Parameters
-
- Returns
- vsf_err_t: VSF_ERR_NONE if subcall is ready to start, or a negative error code
◆ vk_mal_fini()
prepare subcall to finialize a mal instance.
- Note
- similar to vk_mal_init.
- Parameters
-
- Returns
- vsf_err_t: VSF_ERR_NONE if subcall is ready to start, or a negative error code
◆ vk_mal_blksz()
get the block size of a dedicated operation.
- Parameters
-
[in] | pthis | mal instance |
[in] | addr | address(starting from 0) to operate |
[in] | size | size in bytes to operation |
[in] | op | the operation, one in vsf_mal_op_t |
- Returns
- block size in bytes: if 0 means the specified operation is not supported
◆ vk_mal_prepare_buffer()
get the local memory of a dedicated operation, if mal instance has VSF_MAL_LOCAL_BUFFER feature.
- Parameters
-
[in] | pthis | mal instance |
[in] | addr | address(starting from 0) to operate |
[in] | size | size in bytes to operation |
[in] | op | the operation, one in vsf_mal_op_t |
[out] | mem | the memory returned |
- Returns
- true: a valid local memory is returned; false: local memory is not supported
◆ vk_mal_erase()
prepare subcall to erase a mal instance.
- Note
- similar to vk_mal_init.
- Parameters
-
[in] | pthis | mal instance |
[in] | addr | address(starting from 0) to operate |
[in] | size | size in bytes to operation |
- Returns
- vsf_err_t: VSF_ERR_NONE if subcall is ready to start, or a negative error code
◆ vk_mal_read()
prepare subcall to read a mal instance.
- Note
- similar to vk_mal_init. The result of subcall from vsf_eda_get_return_value is int32_t type. result < 0 means error; result >= 0 means the actual byte size read.
- Parameters
-
[in] | pthis | mal instance |
[in] | addr | address(starting from 0) to read |
[in] | size | size in bytes to read |
[in] | buffer | data buffer for reading |
- Returns
- vsf_err_t: VSF_ERR_NONE if subcall is ready to start, or a negative error code
◆ vk_mal_write()
prepare subcall to write a mal instance.
- Note
- similar to vk_mal_init. The result of subcall from vsf_eda_get_return_value is int32_t type. result < 0 means error; result >= 0 means the actual byte size written.
- Parameters
-
[in] | pthis | mal instance |
[in] | addr | address(starting from 0) to write |
[in] | size | size in bytes to write |
[in] | buffer | data buffer for writing |
- Returns
- vsf_err_t: VSF_ERR_NONE if subcall is ready to start, or a negative error code
◆ vk_mal_read_stream()
prepare subcall to read mal instance into a stream.
- Note
- similar to vk_mal_init. stream will be connected/disconnected automatically. The result of subcall from vsf_eda_get_return_value is int32_t type. result < 0 means error; result >= 0 means the actual byte size read.
- Parameters
-
[in] | pthis | mal_stream instance |
[in] | addr | address(starting from 0) to read |
[in] | size | size in bytes to read |
[in] | stream | stream for reading |
- Returns
- vsf_err_t: VSF_ERR_NONE if stream is started, or a negative error code
◆ vk_mal_write_stream()
prepare subcall to write a stream into mal instance.
- Note
- similar to vk_mal_init. stream will be connected/disconnected automatically. The result of subcall from vsf_eda_get_return_value is int32_t type. result < 0 means error; result >= 0 means the actual byte size written.
- Parameters
-
[in] | pthis | mal_stream instance |
[in] | addr | address(starting from 0) to write |
[in] | size | size in bytes to write |
[in] | stream | stream for writing |
- Returns
- vsf_err_t: VSF_ERR_NONE if stream is started, or a negative error code
◆ vk_reentrant_mal_drv