v_demosaic
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xv_demosaic.h File Reference
#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xil_io.h"
#include "xv_demosaic_hw.h"

Data Structures

struct  XV_demosaic_Config
 Configuration structure for the Demosaic IP core. More...
 
struct  XV_demosaic
 Driver instance structure for the Demosaic IP. More...
 

Macros

#define XVDEMOSAIC_IRQ_DONE_MASK   (0x01)
 Interrupt mask for frame processing done event. More...
 
#define XVDEMOSAIC_IRQ_READY_MASK   (0x02)
 Interrupt mask for frame ready event. More...
 
#define XV_demosaic_WriteReg(BaseAddress, RegOffset, Data)   Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
 Writes a value to a Demosaic IP register (bare-metal/RTOS) More...
 
#define XV_demosaic_ReadReg(BaseAddress, RegOffset)   Xil_In32((BaseAddress) + (RegOffset))
 Reads a value from a Demosaic IP register (bare-metal/RTOS) More...
 

Typedefs

typedef void(* XVDemosaic_Callback )(void *InstancePtr)
 Callback function type for Demosaic interrupt events. More...
 

Enumerations

enum  XVDEMOSAIC_HandlerType { XVDEMOSAIC_HANDLER_DONE = 1, XVDEMOSAIC_HANDLER_READY }
 Interrupt handler types for Demosaic IP. More...
 

Functions

int XV_demosaic_Initialize (XV_demosaic *InstancePtr, UINTPTR BaseAddress)
 Initializes a Demosaic instance using the base address (SDT). More...
 
XV_demosaic_ConfigXV_demosaic_LookupConfig (UINTPTR BaseAddress)
 Looks up the device configuration based on the base address (SDT). More...
 
int XV_demosaic_CfgInitialize (XV_demosaic *InstancePtr, XV_demosaic_Config *ConfigPtr, UINTPTR EffectiveAddr)
 Initializes the Demosaic IP instance. More...
 
void XV_demosaic_Start (XV_demosaic *InstancePtr)
 Starts the Demosaic IP core. More...
 
u32 XV_demosaic_IsDone (XV_demosaic *InstancePtr)
 Checks if the Demosaic IP has completed processing. More...
 
u32 XV_demosaic_IsIdle (XV_demosaic *InstancePtr)
 Checks if the Demosaic IP is idle. More...
 
u32 XV_demosaic_IsReady (XV_demosaic *InstancePtr)
 Checks if the Demosaic IP is ready for new input. More...
 
void XV_demosaic_EnableAutoRestart (XV_demosaic *InstancePtr)
 Enables auto-restart mode for the Demosaic IP. More...
 
void XV_demosaic_DisableAutoRestart (XV_demosaic *InstancePtr)
 Disables auto-restart mode for the Demosaic IP. More...
 
void XV_demosaic_Set_HwReg_width (XV_demosaic *InstancePtr, u32 Data)
 Sets the frame width for the Demosaic IP. More...
 
u32 XV_demosaic_Get_HwReg_width (XV_demosaic *InstancePtr)
 Gets the configured frame width from the Demosaic IP. More...
 
void XV_demosaic_Set_HwReg_height (XV_demosaic *InstancePtr, u32 Data)
 Sets the frame height for the Demosaic IP. More...
 
u32 XV_demosaic_Get_HwReg_height (XV_demosaic *InstancePtr)
 Gets the configured frame height from the Demosaic IP. More...
 
void XV_demosaic_Set_HwReg_bayer_phase (XV_demosaic *InstancePtr, u32 Data)
 Sets the Bayer pattern phase for the Demosaic IP. More...
 
u32 XV_demosaic_Get_HwReg_bayer_phase (XV_demosaic *InstancePtr)
 Gets the configured Bayer pattern phase from the Demosaic IP. More...
 
void XV_demosaic_InterruptGlobalEnable (XV_demosaic *InstancePtr)
 Enables global interrupts for the Demosaic IP. More...
 
void XV_demosaic_InterruptGlobalDisable (XV_demosaic *InstancePtr)
 Disables global interrupts for the Demosaic IP. More...
 
void XV_demosaic_InterruptEnable (XV_demosaic *InstancePtr, u32 Mask)
 Enables specific interrupt sources for the Demosaic IP. More...
 
void XV_demosaic_InterruptDisable (XV_demosaic *InstancePtr, u32 Mask)
 Disables specific interrupt sources for the Demosaic IP. More...
 
void XV_demosaic_InterruptClear (XV_demosaic *InstancePtr, u32 Mask)
 Clears pending interrupt flags for the Demosaic IP. More...
 
u32 XV_demosaic_InterruptGetEnabled (XV_demosaic *InstancePtr)
 Gets the enabled interrupt sources for the Demosaic IP. More...
 
u32 XV_demosaic_InterruptGetStatus (XV_demosaic *InstancePtr)
 Gets the current interrupt status for the Demosaic IP. More...
 
void XVDemosaic_SetCallback (XV_demosaic *InstancePtr, u32 HandlerType, void *CallbackFunc, void *CallbackRef)
 Installs an asynchronous callback function for the given handler type. More...
 
void XVDemosaic_InterruptHandler (XV_demosaic *InstancePtr)
 Interrupt handler for the Demosaic IP core. More...
 

Macro Definition Documentation

#define XV_demosaic_ReadReg (   BaseAddress,
  RegOffset 
)    Xil_In32((BaseAddress) + (RegOffset))
#define XV_demosaic_WriteReg (   BaseAddress,
  RegOffset,
  Data 
)    Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
#define XVDEMOSAIC_IRQ_DONE_MASK   (0x01)

Interrupt mask for frame processing done event.

Referenced by XVDemosaic_InterruptHandler().

#define XVDEMOSAIC_IRQ_READY_MASK   (0x02)

Interrupt mask for frame ready event.

Referenced by XVDemosaic_InterruptHandler().

Typedef Documentation

typedef void(* XVDemosaic_Callback)(void *InstancePtr)

Callback function type for Demosaic interrupt events.

Enumeration Type Documentation

Interrupt handler types for Demosaic IP.

Enumerator
XVDEMOSAIC_HANDLER_DONE 

Handler for processing done event (ap_done)

XVDEMOSAIC_HANDLER_READY 

Handler for ready event (ap_ready)

Function Documentation

int XV_demosaic_CfgInitialize ( XV_demosaic InstancePtr,
XV_demosaic_Config ConfigPtr,
UINTPTR  EffectiveAddr 
)

Initializes the Demosaic IP instance.

This function initializes the Demosaic instance by copying the configuration data and setting the effective base address for register access. It marks the instance as ready after successful initialization.

Parameters
InstancePtrPointer to the XV_demosaic instance to initialize.
ConfigPtrPointer to the configuration structure containing IP parameters.
EffectiveAddrThe effective base address for the IP registers.
Returns
XST_SUCCESS on successful initialization.
Note
This function is used in bare-metal and RTOS environments (not Linux).

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, and XV_demosaic::IsReady.

Referenced by driverInit(), and XV_demosaic_Initialize().

void XV_demosaic_DisableAutoRestart ( XV_demosaic InstancePtr)

Disables auto-restart mode for the Demosaic IP.

This function disables the auto-restart feature. The IP will stop after completing each frame and require an explicit start command for the next frame.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
None
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, and XV_demosaic_WriteReg.

void XV_demosaic_EnableAutoRestart ( XV_demosaic InstancePtr)

Enables auto-restart mode for the Demosaic IP.

This function enables the auto-restart feature, which causes the IP to automatically restart processing after completing each frame without requiring explicit start commands.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
None
Note
Auto-restart is useful for continuous video stream processing.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, and XV_demosaic_WriteReg.

Referenced by videoIpConfig().

u32 XV_demosaic_Get_HwReg_bayer_phase ( XV_demosaic InstancePtr)

Gets the configured Bayer pattern phase from the Demosaic IP.

This function reads the current Bayer phase configuration from the Demosaic IP hardware register.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
The configured Bayer phase value (0-3).
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_BAYER_PHASE_DATA, and XV_demosaic_ReadReg.

u32 XV_demosaic_Get_HwReg_height ( XV_demosaic InstancePtr)

Gets the configured frame height from the Demosaic IP.

This function reads the current frame height configuration in lines from the Demosaic IP hardware register.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
The configured frame height in lines.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_HEIGHT_DATA, and XV_demosaic_ReadReg.

u32 XV_demosaic_Get_HwReg_width ( XV_demosaic InstancePtr)

Gets the configured frame width from the Demosaic IP.

This function reads the current frame width configuration in pixels from the Demosaic IP hardware register.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
The configured frame width in pixels.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_WIDTH_DATA, and XV_demosaic_ReadReg.

int XV_demosaic_Initialize ( XV_demosaic InstancePtr,
UINTPTR  BaseAddress 
)

Initializes a Demosaic instance using the base address (SDT).

This function looks up the configuration for the specified base address and calls the CfgInitialize function to initialize the Demosaic instance. The instance is initialized with the configuration data, including hardware parameters. This version is used in SDT-based builds.

Parameters
InstancePtrPointer to the XV_demosaic instance to initialize.
BaseAddressThe base address of the Demosaic instance.
Returns
XST_SUCCESS if initialization is successful, XST_DEVICE_NOT_FOUND if the device configuration cannot be found.
Note
This function is used in SDT builds. The instance must be properly allocated before calling this function.

References XV_demosaic_Config::BaseAddress, XV_demosaic::IsReady, XV_demosaic_CfgInitialize(), and XV_demosaic_LookupConfig().

void XV_demosaic_InterruptClear ( XV_demosaic InstancePtr,
u32  Mask 
)

Clears pending interrupt flags for the Demosaic IP.

This function clears the specified interrupt status bits by writing to the Interrupt Status Register (ISR). This acknowledges the interrupt and allows new interrupts of the same type to be generated.

Parameters
InstancePtrPointer to the XV_demosaic instance.
MaskBit mask of interrupt flags to clear.
Returns
None
Note
This should be called in the interrupt handler after servicing the interrupt.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_ISR, and XV_demosaic_WriteReg.

Referenced by XVDemosaic_InterruptHandler().

void XV_demosaic_InterruptDisable ( XV_demosaic InstancePtr,
u32  Mask 
)

Disables specific interrupt sources for the Demosaic IP.

This function clears bits in the Interrupt Enable Register (IER) to disable specific interrupt sources. Multiple interrupts can be disabled by using a bitwise OR of interrupt masks.

Parameters
InstancePtrPointer to the XV_demosaic instance.
MaskBit mask of interrupts to disable.
Returns
None
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_IER, XV_demosaic_ReadReg, and XV_demosaic_WriteReg.

void XV_demosaic_InterruptEnable ( XV_demosaic InstancePtr,
u32  Mask 
)

Enables specific interrupt sources for the Demosaic IP.

This function sets bits in the Interrupt Enable Register (IER) to enable specific interrupt sources. Multiple interrupts can be enabled by using a bitwise OR of interrupt masks.

Parameters
InstancePtrPointer to the XV_demosaic instance.
MaskBit mask of interrupts to enable.
Returns
None
Note
Global interrupts must also be enabled using XV_demosaic_InterruptGlobalEnable().

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_IER, XV_demosaic_ReadReg, and XV_demosaic_WriteReg.

u32 XV_demosaic_InterruptGetEnabled ( XV_demosaic InstancePtr)

Gets the enabled interrupt sources for the Demosaic IP.

This function reads the Interrupt Enable Register (IER) to determine which interrupt sources are currently enabled.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
Bit mask of currently enabled interrupts.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_IER, and XV_demosaic_ReadReg.

u32 XV_demosaic_InterruptGetStatus ( XV_demosaic InstancePtr)

Gets the current interrupt status for the Demosaic IP.

This function reads the Interrupt Status Register (ISR) to determine which interrupts are currently pending/active.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
Bit mask of currently pending/active interrupts.
Note
The returned status should be checked and interrupts cleared using XV_demosaic_InterruptClear() in the interrupt handler.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_ISR, and XV_demosaic_ReadReg.

Referenced by XVDemosaic_InterruptHandler().

void XV_demosaic_InterruptGlobalDisable ( XV_demosaic InstancePtr)

Disables global interrupts for the Demosaic IP.

This function clears the Global Interrupt Enable (GIE) bit, preventing the IP core from generating interrupt signals to the processor.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
None
Note
This disables all interrupt generation regardless of individual interrupt enable settings.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_GIE, and XV_demosaic_WriteReg.

void XV_demosaic_InterruptGlobalEnable ( XV_demosaic InstancePtr)

Enables global interrupts for the Demosaic IP.

This function sets the Global Interrupt Enable (GIE) bit, allowing the IP core to generate interrupt signals to the processor.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
None
Note
Individual interrupt sources must also be enabled using XV_demosaic_InterruptEnable().

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_GIE, and XV_demosaic_WriteReg.

u32 XV_demosaic_IsDone ( XV_demosaic InstancePtr)

Checks if the Demosaic IP has completed processing.

This function reads the control register and checks the AP_DONE bit to determine if the IP core has finished processing the current frame.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
1 if processing is done, 0 otherwise.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, and XV_demosaic_ReadReg.

u32 XV_demosaic_IsIdle ( XV_demosaic InstancePtr)

Checks if the Demosaic IP is idle.

This function reads the control register and checks the AP_IDLE bit to determine if the IP core is in idle state (not processing).

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
1 if the IP is idle, 0 otherwise.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, and XV_demosaic_ReadReg.

u32 XV_demosaic_IsReady ( XV_demosaic InstancePtr)

Checks if the Demosaic IP is ready for new input.

This function checks the AP_START bit to determine if the IP core is ready to accept a new frame for processing. The IP is ready when the AP_START bit is not set.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
1 if the IP is ready for next input, 0 otherwise.
Note
None

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, and XV_demosaic_ReadReg.

XV_demosaic_Config* XV_demosaic_LookupConfig ( UINTPTR  BaseAddress)

Looks up the device configuration based on the base address (SDT).

This function searches the configuration table for a Demosaic device matching the specified base address. If BaseAddress is 0, it returns the first available configuration. This function is used in SDT-based builds where device lookup is done by base address instead of device ID.

Parameters
BaseAddressThe base address of the Demosaic instance, or 0 to return the first available configuration.
Returns
Pointer to the configuration structure if found, NULL otherwise.
Note
This function is used in SDT builds. For non-SDT builds, use the device ID variant of this function.

References XV_demosaic_Config::Name.

Referenced by driverInit(), and XV_demosaic_Initialize().

void XV_demosaic_Set_HwReg_bayer_phase ( XV_demosaic InstancePtr,
u32  Data 
)

Sets the Bayer pattern phase for the Demosaic IP.

This function configures the starting phase of the Bayer color filter array pattern. The phase determines which color (R, G, or B) is at the top-left pixel position.

Parameters
InstancePtrPointer to the XV_demosaic instance.
DataThe Bayer phase value (0-3 representing different RGGB patterns).
Returns
None
Note
Valid Bayer phases are typically: 0=RGGB, 1=GRBG, 2=GBRG, 3=BGGR.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_BAYER_PHASE_DATA, and XV_demosaic_WriteReg.

Referenced by videoIpConfig().

void XV_demosaic_Set_HwReg_height ( XV_demosaic InstancePtr,
u32  Data 
)

Sets the frame height for the Demosaic IP.

This function configures the active image height in lines that the Demosaic IP will process.

Parameters
InstancePtrPointer to the XV_demosaic instance.
DataThe frame height in lines.
Returns
None
Note
The height must not exceed the MAX_ROWS configured in hardware.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_HEIGHT_DATA, and XV_demosaic_WriteReg.

Referenced by videoIpConfig().

void XV_demosaic_Set_HwReg_width ( XV_demosaic InstancePtr,
u32  Data 
)

Sets the frame width for the Demosaic IP.

This function configures the active image width in pixels that the Demosaic IP will process.

Parameters
InstancePtrPointer to the XV_demosaic instance.
DataThe frame width in pixels.
Returns
None
Note
The width must not exceed the MAX_COLS configured in hardware.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_HWREG_WIDTH_DATA, and XV_demosaic_WriteReg.

Referenced by videoIpConfig().

void XV_demosaic_Start ( XV_demosaic InstancePtr)

Starts the Demosaic IP core.

This function triggers the Demosaic IP to start processing by setting the AP_START bit in the control register while preserving the auto-restart bit.

Parameters
InstancePtrPointer to the XV_demosaic instance.
Returns
None
Note
The instance must be initialized and ready before calling this function.

References XV_demosaic_Config::BaseAddress, XV_demosaic::Config, XV_demosaic::IsReady, XV_DEMOSAIC_CTRL_ADDR_AP_CTRL, XV_demosaic_ReadReg, and XV_demosaic_WriteReg.

Referenced by videoIpConfig().