This section provides high level APIs to upper layer.
More...
This section provides high level APIs to upper layer.
int mtk_os_hal_spim_dump_reg |
( |
spim_num |
bus_num | ) |
|
Dump SPIM register value.
- Parameters
-
[in] | bus_num | : SPIM ISU Port number, it can be OS_HAL_SPIM_ISU0~OS_HAL_SPIM_ISU4 |
- Returns
- negative value means fail.
-
0 means success.
int mtk_os_hal_spim_ctlr_init |
( |
spim_num |
bus_num | ) |
|
Init SPIM controller.
- Parameters
-
[in] | bus_num | : SPIM ISU Port number, it can be OS_HAL_SPIM_ISU0~OS_HAL_SPIM_ISU4 |
- Returns
- negative value means fail.
-
0 means success.
int mtk_os_hal_spim_ctlr_deinit |
( |
spim_num |
bus_num | ) |
|
Deinit SPIM controller.
- Parameters
-
[in] | bus_num | : SPIM ISU Port number, it can be OS_HAL_SPIM_ISU0~OS_HAL_SPIM_ISU4 |
- Returns
- negative value means fail.
-
0 means success.
use FIFO or DMA mode to do one blocking/synchronous SPI data transfer.
- Parameters
-
[in] | bus_num | : SPIM ISU Port number, it can be OS_HAL_SPIM_ISU0~OS_HAL_SPIM_ISU4 |
[in] | config | : the HW setting |
[in] | xfer | : the data should be read/writen. |
Note:
The transfer data format should be as belows:
- Half-duplex transaction: There is only one valid transaction at a time on a single direction: either Send or Receive.
- Send: Device driver should provide mtk_spi_transfer->opcode, mtk_spi_transfer->opcode_len, mtk_spi_transfer->tx_buf, mtk_spi_transfer->len and set mtk_spi_transfer->rx_buf = NULL. mtk_spi_transfer->opcode_len should be 1~4bytes, mtk_spi_transfer->len should be 0~32bytes.
- Receive: Device driver should provide mtk_spi_transfer->opcode, mtk_spi_transfer->opcode_len, mtk_spi_transfer->rx_buf, mtk_spi_transfer->len and set mtk_spi_transfer->tx_buf = NULL. mtk_spi_transfer->opcode_len should be 0~4bytes, mtk_spi_transfer->len should be 1~32bytes.
- Full-duplex transaction: There are two valid mutually inclusive transactions: Send and Receive.
- Device driver should provide mtk_spi_transfer->len, mtk_spi_transfer->opcode, mtk_spi_transfer->opcode_len, mtk_spi_transfer->tx_buf and set mtk_spi_transfer->rx_buf at the same time.
- mtk_spi_transfer->opcode_len should be 1~4bytes, mtk_spi_transfer->len should be 1~16bytes.
- Returns
- negative value means fail.
-
0 means success.
use FIFO or DMA mode to do one asynchronous SPI transfer.
- Parameters
-
[in] | bus_num | : SPIM ISU Port number, it can be OS_HAL_SPIM_ISU0~OS_HAL_SPIM_ISU4 |
[in] | config | : the HW setting |
[in] | xfer | : the data should be read/writen. |
[in] | complete | : called to report transaction completions |
[in] | context | : the argument to complete() when it's called |
- Returns
- negative value means fail.
-
0 means success.