Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

Spiadds


Data Structures

struct  _SPIDCB
struct  _SPIICB

Defines

#define BUFOR_SIZE   300

Typedefs

typedef _SPIICB SPIICB
typedef _SPIDCB SPIDCB

Functions

int SpiInit (NUTDEVICE *dev)
int SpiInput (NUTDEVICE *dev, u_char *buf, u_int size)
int SpiOutput (NUTDEVICE *dev, u_char *buf, u_int size)
void LockSpi (NUTDEVICE *dev, u_char deviceId)
void UnlockSpi (NUTDEVICE *dev, u_char deviceId)

Variables

NUTDEVICE devSpi0

Detailed Description

This module is designed to manage SPI device included in CPU. This driver can be used to acces RTC and Data flash hardware. Module contains function to lock driver for exclusive use this driver to one device.

Define Documentation

#define BUFOR_SIZE   300
 

Size of writing buffor


Typedef Documentation

typedef struct _SPIDCB SPIDCB
 

Device control block for flash required for NUT device driver.

typedef struct _SPIICB SPIICB
 

Interfece control block for device flash required for NUT device driver.


Function Documentation

void LockSpi NUTDEVICE   dev,
u_char    deviceId
 

Locks spi device. This method block spi device for only one device with specified id and ensures that only one thread has access to spi. Function sets special spi parameters, for device. Use UnlockSpi to release lock.

Parameters:
dev  - pointer to spi device.
deviceId  - identyfier of device for which spi will be blocked.

int SpiInit NUTDEVICE   dev
 

Init a driver. Call it first.

Parameters:
dev  - pointer to driver control structure.
Returns:
0 - on success -1 on failed.

int SpiInput NUTDEVICE   dev,
u_char   buf,
u_int    size
 

Reads data from SPI device.

Parameters:
dev  - pointer to spi device.
buf  - pointer to buffer where data will be stored,
size  - number of bytes to read.

int SpiOutput NUTDEVICE   dev,
u_char   buf,
u_int    size
 

Write data to SPI device.

Parameters:
dev  - pointer to spi device.
buf  - pointer to buffor with data to write.
size  - number of bytes to write.

void UnlockSpi NUTDEVICE   dev,
u_char    deviceId
 

Unlock spi device. This method unblock spi device when spi was locked. See LockSpi. When spi device isn't blocked this method do nothing.

Parameters:
dev  - pointer to spi device.
deviceId  - identyfier of device for which spi will be blocked.


Variable Documentation

NUTDEVICE devSpi0
 

Driver control structure.


Generated on Thu Jan 30 22:30:57 2003 for EduNet by doxygen1.2.18