Main Page | Modules | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

Low Level Driver


Data Structures

struct  T_SCCB_SPEC

Camera Configuration

#define ERR_NO_CAMERA_FOUND   (ERR_GENERIC - 10)
 camera not found
#define ERR_SCCB_WRITE   (ERR_GENERIC - 20)
 sccb write access error
#define CAM_OV7645   0x7645
 device id for camera model ov7645
#define CAM_OV7648   0x7648
 device id for camera model ov7648
#define CAM_OV7660   0x7660
 device id for camera model ov7660
#define COLOR_RGB   1
#define COLOR_YUV   2
#define RESOLUTION_VGA   1
#define RESOLUTION_QVGA   2
#define FORMAT_CCIR656   1
typedef long T_CAMERA_HANDLE
T_ERROR_CODE cam_setup (T_CAMERA_HANDLE *pa_phCamera, T_GPIO_MASK pa_sio_cMask, T_GPIO_MASK pa_sio_dMask, T_GPIO_MASK pa_pwdnMask, unsigned char pa_cDevAddr, unsigned short *pa_pConfigParams, unsigned long pa_nCoreClk, void *pa_Generic)
T_ERROR_CODE cam_close (T_CAMERA_HANDLE pa_hCamera)

Flash Utility Functions for Intel Strata Compatible Devices

#define FLASH_PROGRAM_TIMEOUT   0x1ffffff
#define FLASH_ERASE_TIMEOUT   0x1ffffff
#define FLASH_DEBUG_LEVEL   0
unsigned short Flash_EraseSector (unsigned long startAddress, unsigned long sectorAddress)
unsigned short Flash_EraseChip (void)
unsigned short Flash_ProgramWord (unsigned long startAddress, unsigned long wordAddress, unsigned short data)
void Flash_ReadIdentifier (unsigned short *cDevCode, unsigned short *cManuCode)
unsigned short Flash_Lock (unsigned long pa_nSectorAddr)
unsigned short Flash_Reset (void)
unsigned short Flash_ReadWord (unsigned long pa_nOffset)
int Flash_GetSectorNumber (unsigned long ulOffset)
bool Flash_CheckIfEmpty (unsigned long pa_nStartAddress)

Parallel Peripheral Interface (PPI)

#define PPI_DEFAULT_DMA_CHANNEL   ADI_DMA_CHANNEL_COUNT
#define ERR_PLATFORM_INIT   ERR_GENERIC + 10
 platform specific initialization error
#define ERR_SET_DMA_MAP   ERR_GENERIC + 20
 cannot write dma peripheral map register
#define ERR_GET_DMA_MAP   ERR_GENERIC + 30
 cannot read dma peripheral map register
#define ERR_DMA_OPEN   ERR_GENERIC + 40
 could not access dma channel - only with DMA manager
#define ERR_NOT_OPENED   ERR_GENERIC + 50
 accessing a closed (not opened) dma channel - only with DMA manager
#define ERR_DMA_CLOSE   ERR_GENERIC + 60
 could not close dma channel - only with DMA manager
#define ERR_PPI_INDEX   ERR_GENERIC + 70
 invalid PPI index
#define ERR_HOOK_INTERRUPT   ERR_GENERIC + 80
 error hooking the interrupt
#define ERR_ALREADY_INITIALIZED   ERR_GENERIC + 90
 interface was already initialized
typedef void(* T_PPI_CALLBACK )(void)
 callback function for PPI interrupt
T_ERROR_CODE ppi_setup_itu656 (unsigned int pa_nPPIindex, unsigned short pa_nDMAmode, unsigned short pa_nDMAdirection, unsigned long pa_nStartAddress, unsigned short pa_nInterruptType, T_PPI_CALLBACK pa_fnCallback, unsigned short pa_nLinesPerBlock, unsigned short pa_nByteTransferWidth, unsigned short pa_nDMABusWidth, unsigned short pa_nDirection, unsigned short pa_nPackingMode, unsigned short pa_nFieldSelect, unsigned short pa_nSkipping, unsigned short pa_nXSize, unsigned short pa_nYSize, unsigned short pa_nNofBlankingLines)
void ppi_enable_itu656 (unsigned int pa_nPPIindex)
void ppi_disable_itu656 (unsigned int pa_nPPIindex)
T_ERROR_CODE ppi_close (unsigned int pa_nPPIindex)

Serial Peripheral Interface (SPI)

#define SPI_MAX_NR_OF_SLAVES   6
#define SPI_ERR_RECEIVE_OVERFLOW   1
#define SPI_ERR_TRANSMIT_OVERFLOW   2
#define SPI_ERR_HARDWARE   3
typedef long T_SPI_HANDLE
typedef void(* T_SPI_DATA_CALLBACK )(T_SPI_HANDLE, unsigned short)
enum  { SPI_BUFFERED_IO_MODE }
T_ERROR_CODE spi_setup (unsigned char pa_cMaSl, unsigned long pa_nBaudrate, unsigned short pa_nTransferSize, unsigned short pa_nClockPolarity, unsigned short pa_nMsbLsbFirst, unsigned short pa_nMasterErrorFlag, unsigned long pa_nSystemClk)
void spi_cleanup (void)
T_SPI_HANDLE spi_open (unsigned short pa_nSlaveNumber, unsigned short pa_nRxBufferSize, unsigned short pa_nTxBufferSize, T_SPI_DATA_CALLBACK pa_fnDataCallback)
void spi_writeData (T_SPI_HANDLE pa_hDevice, unsigned short pa_nData)
unsigned short spi_readData (T_SPI_HANDLE pa_hDevice, unsigned char *pa_cError)
unsigned short spi_rwData (T_SPI_HANDLE pa_hDevice, unsigned short pa_nData, unsigned char *pa_cError)
T_ERROR_CODE spi_selectSlave (T_SPI_HANDLE pa_hDevice)
void spi_deselectSlave (T_SPI_HANDLE pa_hDevice)
T_ERROR_CODE spi_close (T_SPI_HANDLE pa_hDevice)

Gernal Purpose Input Output (GPIO) Support

typedef unsigned long T_GPIO_MASK
 gpio mask (contains flag-bitmask and gpio bank)

Serial Camera Control Bus (SCCB)

typedef long T_SCCB_HANDLE
 handle for the sccb
void sccb_waitCycle (unsigned short pa_nWaitStates)
T_ERROR_CODE sccb_open (T_SCCB_HANDLE *pa_phSccb, T_GPIO_MASK pa_sio_cMask, T_GPIO_MASK pa_sio_dMask, T_GPIO_MASK pa_pwdnMask, unsigned char pa_cWriteAddr, unsigned long pa_nCoreClk)
T_ERROR_CODE sccb_writeByte (T_SCCB_HANDLE pa_hSccb, unsigned char pa_cDevAddr, unsigned char pa_cSubAddr, unsigned char pa_cData)
unsigned short sccb_readByte (T_SCCB_HANDLE pa_hSccb, unsigned char pa_cDevAddr, unsigned char pa_cSubAddr, T_ERROR_CODE *pa_errCode)
T_ERROR_CODE sccb_close (T_SCCB_HANDLE pa_hSccb)

Detailed Description

contains low level hardware support

Define Documentation

#define CAM_OV7645   0x7645
 

device id for camera model ov7645

#define CAM_OV7648   0x7648
 

device id for camera model ov7648

#define CAM_OV7660   0x7660
 

device id for camera model ov7660

#define COLOR_RGB   1
 

#define COLOR_YUV   2
 

#define ERR_ALREADY_INITIALIZED   ERR_GENERIC + 90
 

interface was already initialized

#define ERR_DMA_CLOSE   ERR_GENERIC + 60
 

could not close dma channel - only with DMA manager

#define ERR_DMA_OPEN   ERR_GENERIC + 40
 

could not access dma channel - only with DMA manager

#define ERR_GET_DMA_MAP   ERR_GENERIC + 30
 

cannot read dma peripheral map register

#define ERR_HOOK_INTERRUPT   ERR_GENERIC + 80
 

error hooking the interrupt

#define ERR_NO_CAMERA_FOUND   (ERR_GENERIC - 10)
 

camera not found

#define ERR_NOT_OPENED   ERR_GENERIC + 50
 

accessing a closed (not opened) dma channel - only with DMA manager

#define ERR_PLATFORM_INIT   ERR_GENERIC + 10
 

platform specific initialization error

#define ERR_PPI_INDEX   ERR_GENERIC + 70
 

invalid PPI index

#define ERR_SCCB_WRITE   (ERR_GENERIC - 20)
 

sccb write access error

#define ERR_SET_DMA_MAP   ERR_GENERIC + 20
 

cannot write dma peripheral map register

#define FLASH_DEBUG_LEVEL   0
 

#define FLASH_ERASE_TIMEOUT   0x1ffffff
 

#define FLASH_PROGRAM_TIMEOUT   0x1ffffff
 

#define FORMAT_CCIR656   1
 

#define PPI_DEFAULT_DMA_CHANNEL   ADI_DMA_CHANNEL_COUNT
 

#define RESOLUTION_QVGA   2
 

#define RESOLUTION_VGA   1
 

#define SPI_ERR_HARDWARE   3
 

#define SPI_ERR_RECEIVE_OVERFLOW   1
 

#define SPI_ERR_TRANSMIT_OVERFLOW   2
 

#define SPI_MAX_NR_OF_SLAVES   6
 


Typedef Documentation

typedef long T_CAMERA_HANDLE
 

typedef unsigned long T_GPIO_MASK
 

gpio mask (contains flag-bitmask and gpio bank)

typedef void(* T_PPI_CALLBACK)(void)
 

callback function for PPI interrupt

typedef long T_SCCB_HANDLE
 

handle for the sccb

typedef void(* T_SPI_DATA_CALLBACK)(T_SPI_HANDLE, unsigned short)
 

typedef long T_SPI_HANDLE
 


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
SPI_BUFFERED_IO_MODE 


Function Documentation

T_ERROR_CODE cam_close T_CAMERA_HANDLE  pa_hCamera  ) 
 

Parameters:
pa_hCamera camera handle
Returns:
ERR_NONE on success, appropriate error code otherwise
frees resources allocated by the camera, closes the sccb connection

T_ERROR_CODE cam_setup T_CAMERA_HANDLE pa_phCamera,
T_GPIO_MASK  pa_sio_cMask,
T_GPIO_MASK  pa_sio_dMask,
T_GPIO_MASK  pa_pwdnMask,
unsigned char  pa_cDevAddr,
unsigned short *  pa_pConfigParams,
unsigned long  pa_nCoreClk,
void *  pa_Generic
 

Parameters:
pa_phCamera pointer to created camera handle
pa_sio_cMask gpio flag where the sccb clock pin is connected
pa_sio_dMask gpio flag where the sccb data pin is connected
pa_pwdnMask gpio flag where the power down pin is connected (0 if not connected)
pa_cDevAddr sccb device address of the camera module
pa_pConfigParams pointer to configuration array (holding register address/value pairs)
pa_nCoreClk current core clock frequency
pa_Generic generic parameter for future use - set to 0
Returns:
ERR_NONE on success, appropriate error code otherwise
initialized the sccb, checks for a supported camera, initializes it with the parameters specified with pa_pConfigParams and creates a camera handle

bool Flash_CheckIfEmpty unsigned long  pa_nStartAddress  ) 
 

Parameters:
pa_nStartAddress start address of the check
Returns:
true if empty, otherwise false

unsigned short Flash_EraseChip void   ) 
 

Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
erases the entire flash

unsigned short Flash_EraseSector unsigned long  startAddress,
unsigned long  sectorAddress
 

Parameters:
startAddress start address of the flash device
sectorAddress address of the sector to be erased
Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
erases the specified sector

int Flash_GetSectorNumber unsigned long  ulOffset  ) 
 

Parameters:
ulOffset address offset
Returns:
sector number containing the address offset
calculates a sector number for a given address offset

unsigned short Flash_Lock unsigned long  pa_nSectorAddr  ) 
 

Parameters:
pa_nSectorAddr sector address to be locked
Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
locks a specified sector of the flash

unsigned short Flash_ProgramWord unsigned long  startAddress,
unsigned long  wordAddress,
unsigned short  data
 

Parameters:
startAddress start address of the flash device
wordAddress address of the word to be programmed
data value to be written
Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
programms a word at the specified address

void Flash_ReadIdentifier unsigned short *  cDevCode,
unsigned short *  cManuCode
 

Parameters:
cDevCode holds the device code after the function call
cManuCode holds the manufacturer code after the function call
reads flash device and manufacturer codes

unsigned short Flash_ReadWord unsigned long  pa_nOffset  ) 
 

Parameters:
pa_nOffset address offset to be read
Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
reads a word from the specified address

unsigned short Flash_Reset void   ) 
 

Returns:
content of the flash status register (on success 0x0080 for Intel Strata Compatible Devices)
resets the flash's state machine to default values

T_ERROR_CODE ppi_close unsigned int  pa_nPPIindex  ) 
 

Parameters:
pa_nPPIindex 
Returns:
on success ERR_NONE, appropriate errorcode otherwise
releases resources allocated by the setup function. closes the PPI transfer.

void ppi_disable_itu656 unsigned int  pa_nPPIindex  ) 
 

Parameters:
pa_nPPIindex stops the dma transfer for the specified PPI

void ppi_enable_itu656 unsigned int  pa_nPPIindex  ) 
 

Parameters:
pa_nPPIindex starts the dma transfer for the specified PPI

T_ERROR_CODE ppi_setup_itu656 unsigned int  pa_nPPIindex,
unsigned short  pa_nDMAmode,
unsigned short  pa_nDMAdirection,
unsigned long  pa_nStartAddress,
unsigned short  pa_nInterruptType,
T_PPI_CALLBACK  pa_fnCallback,
unsigned short  pa_nLinesPerBlock,
unsigned short  pa_nByteTransferWidth,
unsigned short  pa_nDMABusWidth,
unsigned short  pa_nDirection,
unsigned short  pa_nPackingMode,
unsigned short  pa_nFieldSelect,
unsigned short  pa_nSkipping,
unsigned short  pa_nXSize,
unsigned short  pa_nYSize,
unsigned short  pa_nNofBlankingLines
 

Parameters:
pa_nPPIindex index of the PPI
pa_nDMAmode single shot or auto buffer
pa_nDMAdirection read or write
pa_nStartAddress buffer start address
pa_nInterruptType no interrupt, framewise or blockwise interrupt
pa_fnCallback callback at PPI interrupt
pa_nLinesPerBlock lines per block with 2D transfer mode
pa_nByteTransferWidth number of bytes per dma transfer
pa_nDMABusWidth dma bus transfer width
pa_nDirection PPI input or output (has to match pa_nDMAdirection)
pa_nPackingMode byte packing mode of PPI
pa_nFieldSelect with interleaved mode: odd, even or both
pa_nSkipping skip odd, even or none bytes
pa_nXSize horizontal resolution
pa_nYSize vertical resolution
pa_nNofBlankingLines trailing blank lines
Returns:
on success ERR_NONE, appropriate errorcode otherwise
sets up the PPI in ITU656 mode, only active video is transmitted

T_ERROR_CODE sccb_close T_SCCB_HANDLE  pa_hSccb  ) 
 

Parameters:
pa_hSccb handle for the sccb
Returns:
on success ERR_NONE, otherwise an error code
closes the sccb and frees allocted resources

T_ERROR_CODE sccb_open T_SCCB_HANDLE pa_phSccb,
T_GPIO_MASK  pa_sio_cMask,
T_GPIO_MASK  pa_sio_dMask,
T_GPIO_MASK  pa_pwdnMask,
unsigned char  pa_cWriteAddr,
unsigned long  pa_nCoreClk
 

Parameters:
pa_phSccb pointer to the sccb handle
pa_sio_cMask gpio bitmask to specifiy the connected clock pin
pa_sio_dMask gpio bitmask to specifiy the connected data pin
pa_pwdnMask gpio bitmask to specifiy the connected power down pin
pa_cWriteAddr destination address for the sccb
pa_nCoreClk core clock frequency in hertz
Returns:
on success ERR_NONE, otherwise an error code
if the open operation succeds pa_hSccb holds a pointer to the initialized sccb handle, ready for use.

unsigned short sccb_readByte T_SCCB_HANDLE  pa_hSccb,
unsigned char  pa_cDevAddr,
unsigned char  pa_cSubAddr,
T_ERROR_CODE pa_errCode
 

Parameters:
pa_hSccb handle for the sccb
pa_cDevAddr camera device address
pa_cSubAddr camera register
pa_errCode pointer to error code
Returns:
the number of bytes read
reads a byte from a specifed register of a specified camera device, on success pa_errCode holds ERR_NONE, otherwise error code

void sccb_waitCycle unsigned short  pa_nWaitStates  ) 
 

wait SCCB_BASE_WAIT_CYCLE us * pa_nWaitStates ATTENTION: THE __PROCESSOR_SPEED__ MACRO ASSUMES MAX CORE FREQUENCY WITH CLKIN OF 27MHZ

T_ERROR_CODE sccb_writeByte T_SCCB_HANDLE  pa_hSccb,
unsigned char  pa_cDevAddr,
unsigned char  pa_cSubAddr,
unsigned char  pa_cData
 

Parameters:
pa_hSccb handle for the sccb
pa_cDevAddr camera device address
pa_cSubAddr camera register
pa_cData data to write
Returns:
on success ERR_NONE, otherwise an error code
writes a byte to the specified register for a specified camera device

void spi_cleanup void   ) 
 

frees resources allocated by spi_setup

See also:
spi_setup

T_ERROR_CODE spi_close T_SPI_HANDLE  pa_hDevice  ) 
 

Parameters:
pa_hDevice handle for slave device
Returns:
ERR_NONE on success otherwise appropriate error code
deselects the slave and frees the allocated resources.

void spi_deselectSlave T_SPI_HANDLE  pa_hDevice  ) 
 

Parameters:
pa_hDevice handle for slave device
resets the appropriate slave select signal (slave is deselected).

T_SPI_HANDLE spi_open unsigned short  pa_nSlaveNumber,
unsigned short  pa_nRxBufferSize,
unsigned short  pa_nTxBufferSize,
T_SPI_DATA_CALLBACK  pa_fnDataCallback
 

Parameters:
pa_nSlaveNumber slave select signal to be used
pa_nRxBufferSize receive buffer size - not used with simple io
pa_nTxBufferSize transmit buffer size - not used with simple io
pa_fnDataCallback not used with simple io
Returns:
handle for the opened slave
allocates some resources and enables the appropriate slave select signal.

unsigned short spi_readData T_SPI_HANDLE  pa_hDevice,
unsigned char *  pa_cError
 

Parameters:
pa_hDevice handle for slave device
pa_cError pointer to error character - always 0 with simple io
Returns:
on success 8/16 bit data value, otherwise undefined
write a dummy value to the SPI and reads the incoming data.

unsigned short spi_rwData T_SPI_HANDLE  pa_hDevice,
unsigned short  pa_nData,
unsigned char *  pa_cError
 

Parameters:
pa_hDevice handle for slave device
pa_nData 8/16 bit value to be transmitted
pa_cError pointer to error character - always 0 with simple io
Returns:
8/16 bit value received
writes the specified value to the SPI and return the received value.

T_ERROR_CODE spi_selectSlave T_SPI_HANDLE  pa_hDevice  ) 
 

Parameters:
pa_hDevice handle for slave device
Returns:
ERR_NONE on success otherwise appropriate error code
sets the appropriate slave select signal (slave is selected).

T_ERROR_CODE spi_setup unsigned char  pa_cMaSl,
unsigned long  pa_nBaudrate,
unsigned short  pa_nTransferSize,
unsigned short  pa_nClockPolarity,
unsigned short  pa_nMsbLsbFirst,
unsigned short  pa_nMasterErrorFlag,
unsigned long  pa_nSystemClk
 

Parameters:
pa_cMaSl master/slave selection, 0...slave, otherwise master
pa_nBaudrate baudrate in Hertz [Hz]
pa_nTransferSize 8/16 bit transfer size
pa_nClockPolarity sampling on rising or falling edge
pa_nMsbLsbFirst sending msb or lsb first
pa_nMasterErrorFlag SPISS usage as error flag in master mode
pa_nSystemClk system clock in Hertz [Hz]
Returns:
ERR_NONE on success, otherwise appropriate error code
sets up the SPI config registers according to the specified parameters

void spi_writeData T_SPI_HANDLE  pa_hDevice,
unsigned short  pa_nData
 

Parameters:
pa_hDevice handle for slave device
pa_nData 8/16 bit data to be transmitted
writes 8/16 bit value to the transmit buffer register and waits for the incoming data (will be discarded).


Generated on Thu Mar 2 16:11:31 2006 for VDK Blacksheep by  doxygen 1.4.1