kzdev_spi.c File Reference

KOBANZAME SDK SPI Device Driver. More...

#include "kobanzame.h"
#include "jsp_kernel.h"
Include dependency graph for kzdev_spi.c:

Data Structures

struct  SpiDeviceConfigurator_t

Defines

#define MAX_SPI_DEVICES   (8)
#define SPI_DEVICE_SEM   (mSemSpi)
#define SPI_COMPLETE_SIG   (mSpiCompleteSig)
#define SPI_TIMEOUT_PER_BYTE   (10)

Functions

void KzAttIniSpi (ID sem, ID sig)
 Initialize called from uITRON ATT_INI.
L1CODE void KzISRSpi (void)
 SPI Ingterrupt Survice Routine.
int kzdev_spi_regist (KZDEV_SPI_BITLEN_t nBitLen, UW dwBps, int nCS, BOOL bCPOL, BOOL bCPHA)
 SPI Registration.
UW kzdev_spi_chgbps (int nID, UW dwBps)
 Change bit ratio.
void kzdev_spi_open (void)
 Open SPI ( SPI Semaphore Lock ).
void kzdev_spi_close (void)
 Close SPI ( Release SPI Semaphore ).
int kzdev_spi_readwrite (int nID, const void *pTx, int nTx, void *pRx, int nRx)
 SPI Read and write.
int kzdev_spi_read (int nID, void *pRx, int nRx)
 SPI Read.
int kzdev_spi_write (int nID, const void *pTx, int nTx)
 SPI write.
int kzdev_spi_dma_read (int nID, void *pRx, int nRx)
 SPI DMA Read.
int kzdev_spi_dma_write (int nID, const void *pTx, int nTx)
 SPI DMA write.

Detailed Description

KOBANZAME SDK SPI Device Driver.

KOBANZAME SDK Software Developers Kit for Blackfin DSP Evaluation Board(KOBANZAME).

Copyright (C) 2010, KOBANZAME SDK Project, all right reserved

LICENSE: The software is a free and you can use and redistribute it for personal, non-profit or commercial products. Redistributions of source code must retain the above copyright notice. There is no warranty in this software, if you suffer any damages by using the software.


Function Documentation

KzAttIniSpi ( ID  sem,
ID  sig 
)

Initialize called from uITRON ATT_INI.

Parameters:
sem a semphore ID for re-entrant
sig a complete signal
Note:
KOBANZAME SDK kernel private function
UW kzdev_spi_chgbps ( int  nID,
UW  dwBps 
)

Change bit ratio.

Parameters:
nID a SPI ID
dwBps bit per second
Returns:
Old value
Note:
KOBANZAME SDK private function
void kzdev_spi_close ( void   ) 

Close SPI ( Release SPI Semaphore ).

Note:
KOBANZAME SDK private function
int kzdev_spi_dma_read ( int  nID,
void *  pRx,
int  nRx 
)

SPI DMA Read.

Parameters:
nID a SPI ID
pRx Rx Buffer pointer
nRx number of the receive units
Note:
KOBANZAME SDK private function
int kzdev_spi_dma_write ( int  nID,
const void *  pTx,
int  nTx 
)

SPI DMA write.

Parameters:
nID a SPI ID
pTx Tx Buffer pointer
nTx number of the send units
Note:
KOBANZAME SDK private function
void kzdev_spi_open ( void   ) 

Open SPI ( SPI Semaphore Lock ).

Note:
KOBANZAME SDK private function
int kzdev_spi_read ( int  nID,
void *  pRx,
int  nRx 
)

SPI Read.

Parameters:
nID a SPI ID
pRx Rx Buffer pointer
nRx number of the receive units
Note:
KOBANZAME SDK private function
int kzdev_spi_readwrite ( int  nID,
const void *  pTx,
int  nTx,
void *  pRx,
int  nRx 
)

SPI Read and write.

Parameters:
nID a SPI ID
pTx Tx Buffer pointer
nTx number of the send units
pRx Rx Buffer pointer
nRx number of the receive units
Note:
KOBANZAME SDK private function
int kzdev_spi_regist ( KZDEV_SPI_BITLEN_t  nBitLen,
UW  dwBps,
int  nCS,
BOOL  bCPOL,
BOOL  bCPHA 
)

SPI Registration.

Parameters:
nBitLen 16bit or 8bit
dwBps bit per second (BPS can be changed by calling kzdev_spi_chgbps even after this function is done )
nCS a chip select number , -1 is indicate no chip select work.
bCPOL SPI CPOL is set or not
bCPHA SPI CPHA is set or not
Returns:
SPI ID
Note:
KOBANZAME SDK private function
int kzdev_spi_write ( int  nID,
const void *  pTx,
int  nTx 
)

SPI write.

Parameters:
nID a SPI ID
pTx Tx Buffer pointer
nTx number of the send units
Note:
KOBANZAME SDK private function
void KzISRSpi ( void   ) 

SPI Ingterrupt Survice Routine.

Note:
KOBANZAME SDK kernel private function
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated by  doxygen 1.6.2