Software Drivers

xcfa.h File Reference

#include "xcfa_hw.h"
#include "xil_assert.h"
#include "xstatus.h"

Classes

struct  XCfa_Config
struct  XCfa

Active size range macros

#define XCFA_VSIZE_FIRST   32
#define XCFA_VSIZE_LAST   7680
#define XCFA_HSIZE_FIRST   32
#define XCFA_HSIZE_LAST   7680

Handler Types

enum  { XCFA_HANDLER_PROCSTART = 1, XCFA_HANDLER_FRAMEDONE, XCFA_HANDLER_ERROR }

Bayer phase

enum  XCfa_BayerPhaseCombination { XCFA_RGRG_COMBINATION, XCFA_GRGR_COMBINATION, XCFA_GBGB_COMBINATION, XCFA_BGBG_COMBINATION }

Defines

#define XCFA_H_
#define XCfa_Enable(InstancePtr)
#define XCfa_Disable(InstancePtr)
#define XCfa_Start   XCfa_Enable
#define XCfa_Stop   XCfa_Disable
#define XCfa_RegUpdateEnable(InstancePtr)
#define XCfa_RegUpdateDisable(InstancePtr)
#define XCfa_SyncReset(InstancePtr)
#define XCfa_Reset(InstancePtr)
#define XCfa_StatusGetPending(InstancePtr)
#define XCfa_IntrClear(InstancePtr, IntrType)
#define XCfa_IntrEnable(InstancePtr, IntrType)
#define XCfa_IntrDisable(InstancePtr, IntrType)
#define XCfa_IntrGetPending(InstancePtr)

Typedefs

typedef void(*) XCfa_CallBack (void *CallBackRef)
typedef void(*) XCfa_ErrorCallBack (void *CallBackRef, u32 ErrorMask)

Functions

XCfa_ConfigXCfa_LookupConfig (u16 DeviceId)
int XCfa_CfgInitialize (XCfa *InstancePtr, XCfa_Config *CfgPtr, u32 EffectiveAddr)
void XCfa_Setup (XCfa *InstancePtr)
void XCfa_EnableDbgByPass (XCfa *InstancePtr)
int XCfa_IsDbgByPassEnabled (XCfa *InstancePtr)
void XCfa_DisableDbgBypass (XCfa *InstancePtr)
void XCfa_EnableDbgTestPattern (XCfa *InstancePtr)
int XCfa_IsDbgTestPatternEnabled (XCfa *InstancePtr)
void XCfa_DisableDbgTestPattern (XCfa *InstancePtr)
u32 XCfa_GetVersion (XCfa *InstancePtr)
u32 XCfa_GetDbgFrameCount (XCfa *InstancePtr)
u32 XCfa_GetDbgLineCount (XCfa *InstancePtr)
u32 XCfa_GetDbgPixelCount (XCfa *InstancePtr)
void XCfa_SetActiveSize (XCfa *InstancePtr, u16 HSize, u16 VSize)
void XCfa_GetActiveSize (XCfa *InstancePtr, u16 *HSize, u16 *VSize)
void XCfa_SetBayerPhase (XCfa *InstancePtr, enum XCfa_BayerPhaseCombination BayerPhase)
u32 XCfa_GetBayerPhase (XCfa *InstancePtr)
int XCfa_SelfTest (XCfa *InstancePtr)
void XCfa_IntrHandler (void *InstancePtr)
int XCfa_SetCallBack (XCfa *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef)


Define Documentation

#define XCfa_Disable ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                (XCFA_CONTROL_OFFSET), \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_CONTROL_OFFSET))) & (~(XCFA_CTL_SW_EN_MASK))))
This function macro disables the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_Disable(XCfa *InstancePtr)

#define XCfa_Enable ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                (XCFA_CONTROL_OFFSET), \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_CONTROL_OFFSET))) | (XCFA_CTL_SW_EN_MASK)))
This function macro enables the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_Enable(XCfa *InstancePtr)

#define XCFA_H_

Prevent circular inclusions by using protection macros

#define XCFA_HSIZE_FIRST   32

Horizontal Size starting value

#define XCFA_HSIZE_LAST   7680

Horizontal Size ending value

#define XCfa_IntrClear ( InstancePtr,
IntrType   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_STATUS_OFFSET), ((IntrType) & \
                                ((u32)(XCFA_IXR_ALLINTR_MASK))))
This function macro clears/acknowledges pending interrupts of the CFA core. in the Status register. Bit positions of 1 will be cleared.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
IntrType is the pending interrupts to clear/acknowledge. Use OR'ing of XCFA_IXR_*_MASK constants defined in xcfa_hw.h to create this parameter value.
Returns:
None.
Note:
C-style signature: void XCfa_IntrClear(XCfa *InstancePtr, u32 IntrType)

#define XCfa_IntrDisable ( InstancePtr,
IntrType   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                        (XCFA_IRQ_EN_OFFSET), \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_IRQ_EN_OFFSET))) & ((~(IntrType)) & \
                                (XCFA_IXR_ALLINTR_MASK))))
This function macro disables the given individual interrupt(s) on the CFA core by updating Irq_Enable register.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
IntrType is the bit-mask of the interrupts to be disabled. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XCFA_IXR_*_MASK bits defined in xcfa_hw.h.
Returns:
None.
Note:
Any other interrupt not covered by parameter IntrType, if enabled before this macro is called, will remain enabled. C-style signature: void XCfa_IntrDisable(XCfa *InstancePtr, u32 IntrType)

#define XCfa_IntrEnable ( InstancePtr,
IntrType   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                        (XCFA_IRQ_EN_OFFSET), \
                (((IntrType) & (XCFA_IXR_ALLINTR_MASK)) | \
                        (XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                                (XCFA_IRQ_EN_OFFSET)))))
This function macro enables the given individual interrupt(s) on the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
IntrType is the bit-mask of the interrupts to be enabled. Bit positions of 1 will be enabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XCFA_IXR_*_MASK bits defined in xcfa_hw.h.
Returns:
None.
Note:
The existing enabled interrupt(s) will remain enabled. C-style signature: void XCfa_IntrEnable(XCfa *InstancePtr, u32 IntrType)

#define XCfa_IntrGetPending ( InstancePtr   ) 

Value:

XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                                (XCFA_IRQ_EN_OFFSET)) & \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                (XCFA_STATUS_OFFSET))) & ((u32)(XCFA_IXR_ALLINTR_MASK)))
This function macro returns the pending interrupts of the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
The pending interrupts of the CFA. Use XCFA_IXR_*_MASK constants defined in xcfa_hw.h to interpret this value. The returned value is a logical AND of the contents of the STATUS Register and the IRQ_ENABLE Register.
Note:
C-style signature: u32 XCfa_IntrGetPending(XCfa *InstancePtr)

#define XCfa_RegUpdateDisable ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                        (XCFA_CONTROL_OFFSET), \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_CONTROL_OFFSET)))) & (~(XCFA_CTL_RUE_MASK)))
This function macro prevents the CFA core from committing recent changes made so far by the software. When disabled, changes to other configuration registers are stored, but do not effect the behavior of the core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_RegUpdateDisable(XCfa *InstancePtr)

#define XCfa_RegUpdateEnable ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                                        (XCFA_CONTROL_OFFSET), \
                ((XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                        (XCFA_CONTROL_OFFSET))) | (XCFA_CTL_RUE_MASK)))
This function macro commits all the register value changes made so far by the software to the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_RegUpdateEnable(XCfa *InstancePtr)

#define XCfa_Reset ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                (XCFA_CONTROL_OFFSET), (XCFA_CTL_RESET_MASK))
This macro resets CFA core instance. This reset effects the core immediately and may cause image tearing.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_Reset(XCfa *InstancePtr)

#define XCfa_Start   XCfa_Enable

This function macro enables/starts the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_Start(XCfa *InstancePtr)

#define XCfa_StatusGetPending ( InstancePtr   ) 

Value:

XCfa_ReadReg((InstancePtr)->Config.BaseAddress, \
                (XCFA_STATUS_OFFSET)) & (XCFA_IXR_ALLINTR_MASK)
This function macro returns the pending status of a CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
The pending interrupts of the CFA core. Use XCFA_IXR_*_MASK constants defined in xcfa_hw.h to interpret this value.
Note:
C-style signature: u32 XCfa_StatusGePending(XCfa *InstancePtr)

#define XCfa_Stop   XCfa_Disable

This function macro disables/stops the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_Stop(XCfa *InstancePtr)

#define XCfa_SyncReset ( InstancePtr   ) 

Value:

XCfa_WriteReg((InstancePtr)->Config.BaseAddress, \
                (XCFA_CONTROL_OFFSET), (XCFA_CTL_AUTORESET_MASK))
This function macro resets a CFA core at the end of the frame being processed. It enables core automatically synchronizes to the SOF of the core to prevent image tearing. This function macro is differ from XCfa_Reset().

On the next rising-edge of SOF following a call to XCfa_SyncReset(), all of the core's configuration registers and outputs will be reset, then the reset flag will be immediately released, allowing the core to immediately resume default operation.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
C-style signature: void XCfa_SyncReset(XCfa *InstancePtr)

#define XCFA_VSIZE_FIRST   32

Vertical Size starting value

#define XCFA_VSIZE_LAST   7680

Vertical Size ending value


Typedef Documentation

typedef void(*) XCfa_CallBack(void *CallBackRef)

Callback type for all interrupts except error interrupt.

Parameters:
CallBackRef is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.

typedef void(*) XCfa_ErrorCallBack(void *CallBackRef, u32 ErrorMask)

Callback type for error interrupt.

Parameters:
CallBackRef is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.
ErrorMask is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XCFA_IXR_*_MASK values defined in xcfa_hw.h.


Enumeration Type Documentation

anonymous enum

These constants specify different types of handlers and used to differentiate interrupt requests from core.

Enumerator:
XCFA_HANDLER_PROCSTART  A processing start event interrupt type
XCFA_HANDLER_FRAMEDONE  A frame done event interrupt type
XCFA_HANDLER_ERROR  An error condition interrupt type

enum XCfa_BayerPhaseCombination

These constants specify Bayer phase combinations of the core.

Enumerator:
XCFA_RGRG_COMBINATION  Red green combination
XCFA_GRGR_COMBINATION  Green red combination
XCFA_GBGB_COMBINATION  Green blue combination
XCFA_BGBG_COMBINATION  Blue green combination


Function Documentation

int XCfa_CfgInitialize ( XCfa InstancePtr,
XCfa_Config CfgPtr,
u32  EffectiveAddr 
)

This function initializes the CFA core. This function must be called prior to using the CFA core. Initialization of the CFA includes setting up the instance data and ensuring the hardware is in a quiescent state.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
CfgPtr is a reference to a configuration structure containing information about the CFA core.
EffectiveAddr is the base address of the core. If address translation is being used then this parameter must reflect the virtual base address. Otherwise, the physical address should be used.
Returns:
  • XST_SUCCESS if initialization was successful.
Note:
None.

void XCfa_DisableDbgBypass ( XCfa InstancePtr  ) 

This function disables bypass mode of the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
Debug functionality should be enabled.

void XCfa_DisableDbgTestPattern ( XCfa InstancePtr  ) 

This function disables the test pattern mode of the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
Debug functionality should be enabled.

void XCfa_EnableDbgByPass ( XCfa InstancePtr  ) 

This sets the bypass bit of the control register to switch the core to bypass mode if debug is enabled in the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
Debug functionality should be enabled.

void XCfa_EnableDbgTestPattern ( XCfa InstancePtr  ) 

This function sets the test-pattern mode of the CFA core if debug features is enabled.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
Debug functionality should be enabled.

void XCfa_GetActiveSize ( XCfa InstancePtr,
u16 *  HSize,
u16 *  VSize 
)

This function gets the number of Active Pixel per Scan line and number of Active Lines per Frame from the Active Frame Size register.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
HSize is a pointer to 16-bit variable in which the number of Active Pixels per Scan Line is returned. (Range is 32 to 7680).
VSize is a pointer to 16-bit variable in which the number of Active Lines per Frame is returned. (Range is 32 to 7680).
Returns:
None.
Note:
None.

u32 XCfa_GetBayerPhase ( XCfa InstancePtr  ) 

This function gets the Bayer phase value combination from Bayer phase register.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
BayerPhase the Bayer Phase value 0 to 3. The Phase value combinations are
  • Bayer Phase 0 is XCFA_RGRG_COMBINATION.
  • Bayer Phase 1 is XCFA_GRGR_COMBINATION.
  • Bayer Phase 2 is XCFA_GBGB_COMBINATION.
  • Bayer Phase 3 is XCFA_BGBG_COMBINATION.
Note:
- It is a double buffered register.

u32 XCfa_GetDbgFrameCount ( XCfa InstancePtr  ) 

This function gets number of frames processed since power-up or last time the core is reset.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
FrameCount is the number of frames processed since power up.
Note:
Debug functionality should be enabled.

u32 XCfa_GetDbgLineCount ( XCfa InstancePtr  ) 

This function gets the number of lines processed since power-up or last time the core is reset.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
LineCount is the number of lines processed since power up.
Note:
Debug functionality should be enabled.

u32 XCfa_GetDbgPixelCount ( XCfa InstancePtr  ) 

This function gets the number of pixels processed since power-up or last time the core is reset.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
PixelCount is the number of pixels processed since power up.
Note:
Debug functionality should be enabled.

u32 XCfa_GetVersion ( XCfa InstancePtr  ) 

This function gets the Version of the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
Returns the contents of the Version register.
Note:
None.

void XCfa_IntrHandler ( void *  InstancePtr  ) 

This function is the interrupt handler for the CFA core.

This handler reads the pending interrupt from the STATUS register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in IRQ_ENABLE register, and finally clears the interrupts.

The application is responsible for connecting this function to the interrupt system. Application beyond this core is also responsible for providing callbacks to handle interrupts and installing the callbacks using XCfa_SetCallBack() during initialization phase.

Parameters:
InstancePtr is a pointer to the XCfa instance that just interrupted.
Returns:
None.
Note:
Interrupt interface should be enabled.

int XCfa_IsDbgByPassEnabled ( XCfa InstancePtr  ) 

This function gets the current status of the bypass setting of the CFA core.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
Core debug bypass mode.
  • TRUE = Bypass mode is enabled.
  • FALSE = Bypass mode is not enabled.
Note:
Debug functionality should be enabled.

int XCfa_IsDbgTestPatternEnabled ( XCfa InstancePtr  ) 

This function gets the test-pattern mode if debug feature is enabled.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
Test-pattern generator mode.
  • TRUE = Test-pattern mode is enabled.
  • FALSE = Test-pattern mode is not enabled.
Note:
Debug functionality should be enabled.

XCfa_Config* XCfa_LookupConfig ( u16  DeviceId  ) 

This function returns a reference to an XCfa_Config structure based on the unique device id, DeviceId. The return value will refer to an entry in the device configuration table defined in the xcfa_g.c file.

Parameters:
DeviceId is the unique device ID of the core for the lookup operation.
Returns:
CfgPtr is a reference to a config record in the configuration table (in xcfa_g.c) corresponding to DeviceId, or NULL if no match is found.
Note:
None.

int XCfa_SelfTest ( XCfa InstancePtr  ) 

This function reads complete Version register of CFA core and compares with zero values as part of self test.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
  • XST_SUCCESS if the Version register read test was successful.
  • XST_FAILURE if the Version register read test failed.
Note:
None.

void XCfa_SetActiveSize ( XCfa InstancePtr,
u16  HSize,
u16  VSize 
)

This function sets the active H/V sizes in the Active Size register.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
HSize is number of Active Pixels per scan line to be set. Range of HSize is 32 to 7680.
VSize is number of Active Lines per frame to be set. Range of VSize is 32 to 7680.
Returns:
None.
Note:
None.

void XCfa_SetBayerPhase ( XCfa InstancePtr,
enum XCfa_BayerPhaseCombination  BayerPhase 
)

This function specify whether the starting position pixel(0,0) of the Bayer sampling grid is on a red-green or blue-green line and whether the first pixel is green or not.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
BayerPhase to be set to identify starting position. Range of Phase is 0 to 3. The Phase value combinations are
  • Bayer Phase 0 is XCFA_RGRG_COMBINATION.
  • Bayer Phase 1 is XCFA_GRGR_COMBINATION.
  • Bayer Phase 2 is XCFA_GBGB_COMBINATION.
  • Bayer Phase 3 is XCFA_BGBG_COMBINATION.
  • It is a double buffered register.
Returns:
None.
Note:
None.

int XCfa_SetCallBack ( XCfa InstancePtr,
u32  HandlerType,
void *  CallBackFunc,
void *  CallBackRef 
)

void XCfa_Setup ( XCfa InstancePtr  ) 

This function sets the input/output frame size in Active Size register and enables the register update.

Parameters:
InstancePtr is a pointer to the XCfa instance to be worked on.
Returns:
None.
Note:
None.

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.