Microchip® Advanced Software Framework

nmspi.h File Reference

This module contains WINC3400 SPI protocol bus APIs implementation.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

Functions

sint8 nm_spi_deinit (void)
 DeInitialize the SPI. More...
 
sint8 nm_spi_init (void)
 Initialize the SPI. More...
 
sint8 nm_spi_read_block (uint32 u32Addr, uint8 *puBuf, uint16 u16Sz)
 
uint32 nm_spi_read_reg (uint32 u32Addr)
 
sint8 nm_spi_read_reg_with_ret (uint32 u32Addr, uint32 *pu32RetVal)
 
sint8 nm_spi_reset (void)
 Reset the SPI. More...
 
sint8 nm_spi_write_block (uint32 u32Addr, uint8 *puBuf, uint16 u16Sz)
 
sint8 nm_spi_write_reg (uint32 u32Addr, uint32 u32Val)
 

sint8 nm_spi_deinit ( void  )

DeInitialize the SPI.

Returns
M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure

References gu8Crc_off, and M2M_SUCCESS.

Referenced by nm_drv_deinit(), and nm_drv_init_start().

sint8 nm_spi_init ( void  )

Initialize the SPI.

DeInitialize the SPI.

Returns
M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure

configure protocol

make sure can read back chip id correctly

References gu8Crc_off, M2M_DBG, M2M_ERR, M2M_ERR_BUS_FAIL, M2M_SUCCESS, nm_spi_read_reg_with_ret(), nm_spi_write_reg(), NMI_SPI_PROTOCOL_CONFIG, and spi_init_pkt_sz().

Referenced by nm_drv_init_download_mode(), and nm_drv_init_hold().

sint8 nm_spi_read_block ( uint32  u32Addr,
uint8 puBuf,
uint16  u16Sz 
)
uint32 nm_spi_read_reg ( uint32  u32Addr)
sint8 nm_spi_read_reg_with_ret ( uint32  u32Addr,
uint32 pu32RetVal 
)
sint8 nm_spi_reset ( void  )

Reset the SPI.

Returns
M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure

References CMD_RESET, M2M_ERR, M2M_INFO, N_FAIL, N_OK, nmi_spi_writeread(), spi_cmd(), and spi_cmd_rsp().

Referenced by nm_bus_reset().

sint8 nm_spi_write_block ( uint32  u32Addr,
uint8 puBuf,
uint16  u16Sz 
)
sint8 nm_spi_write_reg ( uint32  u32Addr,
uint32  u32Val 
)