Nut/OS  4.10.3
API Reference
spibus.c File Reference

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>
Include dependency graph for spibus.c:

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.

Detailed Description

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.


Function Documentation

int Avr32SpiBusNodeInit ( NUTSPINODE node)

Initialize an SPI bus node.

This routine is called for each SPI node, which is registered via NutRegisterSpiDevice().

Parameters:
nodeSpecifies the SPI bus node.
Returns:
0 on success or -1 if there is no valid chip select.

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.

Here is the call graph for this function:

int Avr32SpiBusWait ( NUTSPINODE node,
uint32_t  tmo 
)

Wait until all SPI bus transfers are done.

Parameters:
nodeSpecifies the SPI bus node.
tmoTimeout in milliseconds. To disable timeout, set this parameter to NUT_WAIT_INFINITE.
Returns:
Always 0.

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().

Here is the call graph for this function: