problem about the spi low level driver

cancel
Showing results for 
Search instead for 
Did you mean: 

problem about the spi low level driver

Jump to solution
320 Views
botaoyang
Contributor II

I am learning to use the MQX , and I want to how the spi driver works. But I can't see definition of these functions,

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_INIT_FPTR)(const void _PTR_ init_data_ptr, pointer *io_info_ptr_ptr);

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_DEINIT_FPTR)(pointer io_info_ptr);

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_SETPARAM_FPTR)(pointer io_info_ptr, SPI_PARAM_STRUCT_PTR spi_param_ptr);

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_TX_RX_FPTR)(pointer io_info_ptr, uint_8_ptr txbuf, uint_8_ptr rxbuf, uint_32 len);

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_CS_DEASSERT_FPTR)(pointer io_info_ptr);

typedef _mqx_int (_CODE_PTR_ SPI_DEVIF_IOCTL_FPTR)(pointer io_info_ptr, SPI_PARAM_STRUCT_PTR spi_param_ptr, uint_32 cmd, uint_32_ptr cmd_param_ptr);

for example, in the spi.c,

   result = driver_data->DEVIF->TX_RX(driver_data->DEVIF_DATA, (uint_8_ptr)wrbuf, (uint_8_ptr)rdbuf, len);

I can't see the definition of the TX_RX function.

is there anybody can tell me what to do ?

thank you !

Labels (1)
0 Kudos
1 Solution
83 Views
RadekS
NXP Employee
NXP Employee

driver_data structure is created in _io_spi_install() function.

_io_spi_install() function is called in init_bsp.c file.

driver_data = e.g. SPI0 (spi.c)

DEVIF = _spi_dspi_dma_devif (spi_dspi_dma.c)

TX_RX = _dspi_dma_tx_rx() function in spi_dspi_dma.c

Of course, if you not enable DMA (BSPCFG_DSPI0_USE_DMA=0), TX_RX will points to _dspi_tx_rx() function in spi_dspi.c file.

I would like to recommend currently do not use DMA for current DSPI driver.

I hope it helps you.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
84 Views
RadekS
NXP Employee
NXP Employee

driver_data structure is created in _io_spi_install() function.

_io_spi_install() function is called in init_bsp.c file.

driver_data = e.g. SPI0 (spi.c)

DEVIF = _spi_dspi_dma_devif (spi_dspi_dma.c)

TX_RX = _dspi_dma_tx_rx() function in spi_dspi_dma.c

Of course, if you not enable DMA (BSPCFG_DSPI0_USE_DMA=0), TX_RX will points to _dspi_tx_rx() function in spi_dspi.c file.

I would like to recommend currently do not use DMA for current DSPI driver.

I hope it helps you.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos