ethspi.c File Reference

SPI Interface for Ethernet controller; Micrel KSZ8851SNL. More...

#include "ethspi.h"
#include <stdint.h>
#include "em_device.h"
#include "em_usart.h"
#include "em_gpio.h"
#include "em_cmu.h"
#include <stdio.h>
Include dependency graph for ethspi.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ETHSPI_Init (void)
 ETHSPI_Init Initialize SPI interface to Ethernet controller.
static uint8_t ETHSPI_XferSpi (uint8_t data)
 Performs the actual transfer of a byte.
static void ETHSPI_SetChipSelect (bool value)
 Sets/resets the ChipSelect of the SPI.
void ETHSPI_ReadRegister (uint8_t reg, int numBytes, void *data)
 Read ethernet controller register.
void ETHSPI_WriteRegister (uint8_t reg, int numBytes, void *data)
 Write ethernet controller register.
void ETHSPI_StartReadFIFO (void)
 Start reading from the ethernet controller FIFO.
void ETHSPI_StartWriteFIFO (void)
 Start writing to the ethernet controller FIFO.
void ETHSPI_StopFIFO (void)
 Stop read/write the ethernet controller FIFO.
void ETHSPI_ReadFifoContinue (int numBytes, uint8_t *data)
 Continue reading ethernet controller FIFO.
void ETHSPI_WriteFifoContinue (int numBytes, uint8_t *data)
 Continue writing ethernet controller FIFO.

Detailed Description

SPI Interface for Ethernet controller; Micrel KSZ8851SNL.

Author:
Energy Micro AS
Version:
3.20.0

License

(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. 4. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers and "EFR4" radios.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Energy Micro AS will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file ethspi.c.


Function Documentation

static void ETHSPI_SetChipSelect ( bool  value  )  [static]

Sets/resets the ChipSelect of the SPI.

Parameters:
[in] value if true CS will be set, and reseted otherwise

Definition at line 126 of file ethspi.c.

References SPI_CS_PIN, and SPI_CS_PORT.

Referenced by ETHSPI_ReadRegister(), ETHSPI_StartReadFIFO(), ETHSPI_StartWriteFIFO(), ETHSPI_StopFIFO(), and ETHSPI_WriteRegister().

Here is the caller graph for this function:

static uint8_t ETHSPI_XferSpi ( uint8_t  data  )  [static]

Performs the actual transfer of a byte.

Parameters:
[in] data actual data to be passed towards spi
Returns:
actual data to be received from spi

Definition at line 109 of file ethspi.c.

Referenced by ETHSPI_ReadFifoContinue(), ETHSPI_ReadRegister(), ETHSPI_StartReadFIFO(), ETHSPI_StartWriteFIFO(), ETHSPI_WriteFifoContinue(), and ETHSPI_WriteRegister().

Here is the caller graph for this function: