Microchip® Advanced Software Framework

nm_bus_wrapper_sam4s.c File Reference

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 NM_BUS_MAX_TRX_SZ   4096
 
#define SPI_ASSERT_CS()   do {p_pio->PIO_CODR = 1 << (CONF_WINC_SPI_CS_GPIO & 0x1F);}while(0)
 
#define SPI_DEASSERT_CS()   do {p_pio->PIO_SODR = 1 << (CONF_WINC_SPI_CS_GPIO & 0x1F);}while(0)
 
#define xSPI_ASSERT_CS()   {gpio_set_pin_low(CONF_WINC_SPI_CS_GPIO);}
 
#define xSPI_DEASSERT_CS()   {gpio_set_pin_high(CONF_WINC_SPI_CS_GPIO);}
 

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)
 
sint8 nm_spi_rw (uint8 *pu8Mosi, uint8 *pu8Miso, uint16 u16Sz)
 

Variables

tstrNmBusCapabilities egstrNmBusCapabilities
 
static Pdc * g_p_spim_pdc
 Pointer to Pdc data structure. More...
 
Pio * p_pio
 PIO instance used by CS. More...
 

#define NM_BUS_MAX_TRX_SZ   4096
#define SPI_ASSERT_CS ( )    do {p_pio->PIO_CODR = 1 << (CONF_WINC_SPI_CS_GPIO & 0x1F);}while(0)

Referenced by nm_spi_rw().

#define SPI_DEASSERT_CS ( )    do {p_pio->PIO_SODR = 1 << (CONF_WINC_SPI_CS_GPIO & 0x1F);}while(0)

Referenced by nm_bus_init(), and nm_spi_rw().

#define xSPI_ASSERT_CS ( )    {gpio_set_pin_low(CONF_WINC_SPI_CS_GPIO);}
#define xSPI_DEASSERT_CS ( )    {gpio_set_pin_high(CONF_WINC_SPI_CS_GPIO);}

nm_bus_deinit ( void  )

De-initialize the bus wrapper.

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

References M2M_SUCCESS.

Referenced by nm_bus_iface_deinit().

tstrNmBusCapabilities egstrNmBusCapabilities
Initial value:
=
{
}
#define NM_BUS_MAX_TRX_SZ
Definition: nm_bus_wrapper_sam4s.c:53

Referenced by nm_read_block(), and nm_write_block().

Pdc* g_p_spim_pdc
static

Pointer to Pdc data structure.

Referenced by nm_bus_init(), and nm_spi_rw().