Software Drivers

xbram.h File Reference

#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xbram_hw.h"

Classes

struct  XBram_Config
struct  XBram

Defines

#define XBRAM_H

Functions

XBram_ConfigXBram_LookupConfig (u16 DeviceId)
int XBram_CfgInitialize (XBram *InstancePtr, XBram_Config *Config, u32 EffectiveAddr)
int XBram_SelfTest (XBram *InstancePtr, u8 IntMask)
void XBram_InterruptEnable (XBram *InstancePtr, u32 Mask)
void XBram_InterruptDisable (XBram *InstancePtr, u32 Mask)
void XBram_InterruptClear (XBram *InstancePtr, u32 Mask)
u32 XBram_InterruptGetEnabled (XBram *InstancePtr)
u32 XBram_InterruptGetStatus (XBram *InstancePtr)

Detailed Description


Define Documentation

#define XBRAM_H

Function Documentation

int XBram_CfgInitialize ( XBram InstancePtr,
XBram_Config Config,
u32  EffectiveAddr 
)

Initialize the XBram instance provided by the caller based on the given configuration data.

Nothing is done except to initialize the InstancePtr.

Parameters:
InstancePtr is a pointer to an XBram instance. The memory the pointer references must be pre-allocated by the caller. Further calls to manipulate the driver through the XBram API must be made with this pointer.
Config is a reference to a structure containing information about a specific BRAM device. This function initializes an InstancePtr object for a specific device specified by the contents of Config. This function can initialize multiple instance objects with the use of multiple calls giving different Config information on each call.
EffectiveAddr is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use Config->BaseAddress for this parameters, passing the physical address instead.
Returns:
  • XST_SUCCESS Initialization was successful.
Note:
None.
void XBram_InterruptClear ( XBram InstancePtr,
u32  Mask 
)

Clear pending interrupts with the provided mask. This function should be called after the software has serviced the interrupts that are pending. This function will assert if the hardware device has not been built with interrupt capabilities.

Parameters:
InstancePtr is the BRAM instance to operate on.
Mask is the mask to clear pending interrupts for. Bit positions of 1 are cleared. This mask is formed by OR'ing bits from XBRAM_IR* bits which are contained in xbram_hw.h.
Returns:
None.
Note:
None.
void XBram_InterruptDisable ( XBram InstancePtr,
u32  Mask 
)

Disable interrupts. This function allows each specific interrupt to be disabled. This function will assert if the hardware device has not been built with interrupt capabilities.

Parameters:
InstancePtr is the BRAM instance to operate on.
Mask is the mask to disable. Bits set to 1 are disabled. This mask is formed by OR'ing bits from XBRAM_IR* bits which are contained in xbram_hw.h.
Returns:
None.
Note:
None.
void XBram_InterruptEnable ( XBram InstancePtr,
u32  Mask 
)

Enable interrupts. This function will assert if the hardware device has not been built with interrupt capabilities.

Parameters:
InstancePtr is the BRAM instance to operate on.
Mask is the mask to enable. Bit positions of 1 are enabled. This mask is formed by OR'ing bits from XBRAM_IR* bits which are contained in xbram_hw.h.
Returns:
None.
Note:
None.
u32 XBram_InterruptGetEnabled ( XBram InstancePtr  ) 

Returns the interrupt enable mask. This function will assert if the hardware device has not been built with interrupt capabilities.

Parameters:
InstancePtr is the BRAM instance to operate on.
Returns:
A mask of bits made from XBRAM_IR* bits which are contained in xbram_hw.h.
None.
Note:
None.
u32 XBram_InterruptGetStatus ( XBram InstancePtr  ) 

Returns the status of interrupt signals. Any bit in the mask set to 1 indicates that the channel associated with the bit has asserted an interrupt condition. This function will assert if the hardware device has not been built with interrupt capabilities.

Parameters:
InstancePtr is the BRAM instance to operate on.
Returns:
A pointer to a mask of bits made from XBRAM_IR* bits which are contained in xbram_hw.h.
Note:

The interrupt status indicates the status of the device irregardless if the interrupts from the devices have been enabled or not through XBram_InterruptEnable().

XBram_Config* XBram_LookupConfig ( u16  DeviceId  ) 

Lookup the device configuration based on the unique device ID. The table ConfigTable contains the configuration info for each device in the system.

Parameters:
DeviceId is the device identifier to lookup.
Returns:
  • A pointer of data type XBram_Config which points to the device configuration if DeviceID is found.
  • NULL if DeviceID is not found.
Note:
None.
int XBram_SelfTest ( XBram InstancePtr,
u8  IntMask 
)

Run a self-test on the driver/device. Unless fault injection is implemented in hardware, this function only does a minimal test in which available registers (if any) are written and read.

With fault injection, all possible single-bit and double-bit errors are injected, and checked to the extent possible, given the implemented hardware.

Parameters:
InstancePtr is a pointer to the XBram instance.
IntMask is the interrupt mask to use. When testing with interrupts, this should be set to allow interrupt generation, otherwise it should be 0.
Returns:
  • XST_SUCCESS if fault injection/detection is working properly OR if ECC is Not Enabled in the HW.
  • XST_FAILURE if the injected fault is not correctly detected or the Control Base Address is Zero when ECC is enabled.
If the BRAM device is not present in the hardware a bus error could be generated. Other indicators of a bus error, such as registers in bridges or buses, may be necessary to determine if this function caused a bus error.
Note:
None.