This module contains NMC1000 bus wrapper APIs implementation.
Copyright (c) 2016-2021 Microchip Technology Inc. and its subsidiaries.
#include <stdio.h>
#include "bsp/include/nm_bsp.h"
#include "common/include/nm_common.h"
#include "bus_wrapper/include/nm_bus_wrapper.h"
#include "asf.h"
#include "conf_winc.h"
Macros | |
#define | I2C_TIMEOUT 100 |
Number of times to try to send packet if failed. More... | |
#define | NM_BUS_MAX_TRX_SZ 4096 |
#define | SLAVE_ADDRESS 0x60 |
Functions | |
sint8 | nm_bus_deinit (void) |
De-initialize the bus wrapper. More... | |
sint8 | nm_bus_init (void *pvinit) |
sint8 | nm_bus_ioctl (uint8 u8Cmd, void *pvParameter) |
static sint8 | nm_i2c_read (uint8 *rb, uint16 sz) |
static sint8 | nm_i2c_write (uint8 *b, uint16 sz) |
static sint8 | nm_i2c_write_special (uint8 *wb1, uint16 sz1, uint8 *wb2, uint16 sz2) |
Variables | |
tstrNmBusCapabilities | egstrNmBusCapabilities |
#define I2C_TIMEOUT 100 |
Number of times to try to send packet if failed.
Referenced by nm_i2c_read(), and nm_i2c_write().
#define NM_BUS_MAX_TRX_SZ 4096 |
Referenced by nm_i2c_write_special().
#define SLAVE_ADDRESS 0x60 |
Referenced by nm_i2c_read(), and nm_i2c_write().
nm_bus_deinit | ( | void | ) |
De-initialize the bus wrapper.
References CONF_WINC_SPI, CONF_WINC_SPI_CLK_GPIO, CONF_WINC_SPI_CS_GPIO, CONF_WINC_SPI_MISO_GPIO, CONF_WINC_SPI_MOSI_GPIO, IOPORT_DIR_INPUT, ioport_set_pin_dir(), M2M_SUCCESS, and spi_disable().
Referenced by nm_bus_iface_deinit().
sint8 nm_bus_init | ( | void * | pvinit | ) |
References CONF_WINC_I2C, CONF_WINC_I2C_ID, CONF_WINC_SPI, CONF_WINC_SPI_CLK_FLAGS, CONF_WINC_SPI_CLK_GPIO, CONF_WINC_SPI_CLOCK, CONF_WINC_SPI_CS_FLAGS, CONF_WINC_SPI_CS_GPIO, CONF_WINC_SPI_DLYBCT, CONF_WINC_SPI_DLYBS, CONF_WINC_SPI_MISO_FLAGS, CONF_WINC_SPI_MISO_GPIO, CONF_WINC_SPI_MOSI_FLAGS, CONF_WINC_SPI_MOSI_GPIO, CONF_WINC_SPI_NPCS, CONF_WINC_SPI_PHA, CONF_WINC_SPI_POL, CONF_WINC_TWIHS_CLOCK, IOPORT_DIR_OUTPUT, ioport_disable_pin(), ioport_enable_pin(), ioport_set_pin_dir(), ioport_set_pin_mode(), M2M_ERR, M2M_SUCCESS, twihs_options::master_clk, nm_bsp_reset(), nm_bsp_sleep(), PIO_DELTA, pmc_enable_periph_clk(), twihs_options::speed, spi_disable(), spi_disable_mode_fault_detect(), spi_enable(), spi_enable_clock(), spi_reset(), spi_set_baudrate_div(), spi_set_bits_per_transfer(), spi_set_clock_phase(), spi_set_clock_polarity(), spi_set_master_mode(), spi_set_peripheral_chip_select_value(), spi_set_transfer_delay(), sysclk_get_peripheral_hz(), twihs_master_init(), and TWIHS_SUCCESS.
Referenced by nm_bus_iface_init().
References M2M_ERR, NM_BUS_IOCTL_R, NM_BUS_IOCTL_RW, NM_BUS_IOCTL_W, NM_BUS_IOCTL_W_SPECIAL, nm_i2c_read(), nm_i2c_write(), nm_i2c_write_special(), tstrNmI2cDefault::pu8Buf, tstrNmI2cSpecial::pu8Buf1, tstrNmI2cSpecial::pu8Buf2, tstrNmSpiRw::pu8InBuf, tstrNmSpiRw::pu8OutBuf, tstrNmI2cDefault::u16Sz, tstrNmSpiRw::u16Sz, tstrNmI2cSpecial::u16Sz1, and tstrNmI2cSpecial::u16Sz2.
Referenced by nm_i2c_read_block(), nm_i2c_read_reg_with_ret(), nm_i2c_write_block(), and nm_i2c_write_reg().
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, CONF_WINC_I2C, I2C_TIMEOUT, twihs_packet::length, M2M_SUCCESS, SLAVE_ADDRESS, twihs_master_read(), and TWIHS_SUCCESS.
Referenced by nm_bus_ioctl().
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, CONF_WINC_I2C, I2C_TIMEOUT, twihs_packet::length, M2M_SUCCESS, SLAVE_ADDRESS, twihs_master_write(), and TWIHS_SUCCESS.
Referenced by nm_bus_ioctl(), and nm_i2c_write_special().
References m2m_memcpy(), NM_BUS_MAX_TRX_SZ, and nm_i2c_write().
Referenced by nm_bus_ioctl().
tstrNmBusCapabilities egstrNmBusCapabilities |
Referenced by nm_read_block(), and nm_write_block().