General AVR32 SPI bus controller routines. More...
#include <cfg/spi.h>
#include <sys/timer.h>
#include <sys/nutdebug.h>
#include <stdlib.h>
#include <memdebug.h>
#include <dev/spibus_avr32.h>
#include <avr32/io.h>
Go to the source code of this file.
Functions | |
int | Avr32SpiSetup (NUTSPINODE *node) |
Update SPI shadow registers. | |
int | Avr32SpiBusNodeInit (NUTSPINODE *node) |
Initialize an SPI bus node. | |
int | Avr32SpiBusWait (NUTSPINODE *node, uint32_t tmo) |
Wait until all SPI bus transfers are done. |
General AVR32 SPI bus controller routines.
Copyright (C) 2001-2010 by egnite Software GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
* $Id: spibus.c,v 1.3 2009/02/13 14:52:05 haraldkipp Exp $ *
Definition in file spibus.c.
int Avr32SpiSetup | ( | NUTSPINODE * | node | ) |
Update SPI shadow registers.
node | Specifies the SPI bus node. |
Definition at line 75 of file spibus.c.
References _NUTSPIBUS::bus_base, _AVR32SPIREG::csr, _AVR32SPIREG::mr, _NUTSPINODE::node_bits, _NUTSPINODE::node_bus, _NUTSPINODE::node_mode, _NUTSPINODE::node_rate, _NUTSPINODE::node_stat, NUT_HWCLK_PERIPHERAL_A, NUTASSERT, NutClockGet, SPI_MODE_CPHA, SPI_MODE_CPOL, SPI_MODE_CSKEEP, SPI_MODE_FAULT, SPI_MODE_LOOPBACK, and SPI_MODE_UPDATE.
Referenced by Avr32SpiBus0Select(), Avr32SpiBus1Select(), and Avr32SpiBusNodeInit().
int Avr32SpiBusNodeInit | ( | NUTSPINODE * | node | ) |
Initialize an SPI bus node.
This routine is called for each SPI node, which is registered via NutRegisterSpiDevice().
node | Specifies the SPI bus node. |
Definition at line 145 of file spibus.c.
References Avr32Spi0ChipSelect(), Avr32Spi1ChipSelect(), Avr32SpiBus0Interrupt(), Avr32SpiBus1Interrupt(), Avr32SpiSetup(), _NUTSPIBUS::bus_base, _NUTSPIBUS::bus_ready, _NUTSPIBUS::bus_sig, _AVR32SPIREG::csr, malloc(), _AVR32SPIREG::mr, _NUTSPINODE::node_bus, _NUTSPINODE::node_cs, _NUTSPINODE::node_mode, _NUTSPINODE::node_stat, NUTASSERT, NutIrqEnable(), NutRegisterIrqHandler(), outr, and SPI_MODE_CSHIGH.
int Avr32SpiBusWait | ( | NUTSPINODE * | node, |
uint32_t | tmo | ||
) |
Wait until all SPI bus transfers are done.
node | Specifies the SPI bus node. |
tmo | Timeout in milliseconds. To disable timeout, set this parameter to NUT_WAIT_INFINITE. |
Definition at line 294 of file spibus.c.
References _NUTSPIBUS::bus_base, _NUTSPIBUS::bus_ready, inr, _NUTSPINODE::node_bus, and NutEventWait().
Referenced by Avr32SpiBus0Deselect(), and Avr32SpiBus1Deselect().