hdcp22_rng: Hdcp22_rng_v1_2

| hdcp22_rng Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List

Data Structures | Macros | Functions
Hdcp22_rng_v1_2

## Data Structures
struct | XHdcp22_Rng_Config
| This typedef contains configuration information for the HDCP22 Rng core. More...
struct | XHdcp22_Rng
| The XHdcp22 Rng driver instance data. More...

## Macros
#define | XHDCP22_RNG_H
| < Prevent circular inclusions by using protection macros More...
#define | XHdcp22Rng_Enable(InstancePtr)
| This macro enables the HDCP22 RNG peripheral. More...
#define | XHdcp22Rng_Disable(InstancePtr)
| This macro disables the HDCP22 RNG peripheral. More...
#define | XHdcp22Rng_IsEnabled(InstancePtr)
| This macro returns the enabled state of HDCP22 RNG. More...
#define | XHDCP22_RNG_HW_H
| < Prevent circular inclusions by using protection macros More...
#define | XHDCP22_RNG_VER_ID_OFFSET ((XHDCP22_RNG_VER_BASE)+(0*4))
| VER Identification register * register offset. More...
#define | XHDCP22_RNG_VER_VERSION_OFFSET ((XHDCP22_RNG_VER_BASE)+(1*4))
| VER Version register * offset. More...
#define | XHDCP22_RNG_REG_CTRL_OFFSET ((XHDCP22_RNG_REG_BASE)+(0*4))
| Control register * register offset. More...
#define | XHDCP22_RNG_REG_CTRL_SET_OFFSET ((XHDCP22_RNG_REG_BASE)+(1*4))
| Control set register * offset. More...
#define | XHDCP22_RNG_REG_CTRL_CLR_OFFSET ((XHDCP22_RNG_REG_BASE)+(2*4))
| Control clear register * offset. More...
#define | XHDCP22_RNG_REG_STA_OFFSET ((XHDCP22_RNG_REG_BASE)+(3*4))
| Status register * offset. More...
#define | XHDCP22_RNG_REG_RN_1_OFFSET ((XHDCP22_RNG_REG_BASE)+(4*4))
| Random number register 1 * offset. More...
#define | XHDCP22_RNG_REG_RN_2_OFFSET ((XHDCP22_RNG_REG_BASE)+(5*4))
| Random number 2 * offset. More...
#define | XHDCP22_RNG_REG_RN_3_OFFSET ((XHDCP22_RNG_REG_BASE)+(6*4))
| Random number 3 * offset. More...
#define | XHDCP22_RNG_REG_RN_4_OFFSET ((XHDCP22_RNG_REG_BASE)+(7*4))
| Random number 4 * offset. More...
#define | XHDCP22_RNG_REG_CTRL_RUN_MASK (1<<0)
| Control register Run mask. More...
#define | XHDCP22_RNG_REG_CTRL_IE_MASK (1<<1)
| Control register Interrupt Enable mask. More...
#define | XHDCP22_RN_REG_STA_IRQ_MASK (1<<0)
| Status register interrupt mask. More...
#define | XHDCP22_RN_REG_STA_EVT_MASK (1<<1)
| Status register event mask. More...
#define | XHDCP22_RNG_SHIFT_16 16
| 16 shift value More...
#define | XHDCP22_RNG_MASK_16 0xFFFF
| 16 bit mask value More...
#define | XHDCP22_RNG_VER_ID 0x2200
| Version ID. More...

## Functions
int | XHdcp22Rng_CfgInitialize (XHdcp22_Rng *InstancePtr, XHdcp22_Rng_Config *CfgPtr, UINTPTR EffectiveAddr)
| This function initializes the HDCP22 Rng core. More...
void | XHdcp22Rng_GetRandom (XHdcp22_Rng *InstancePtr, u8 *BufferPtr, u16 BufferLength, u16 RandomLength)
| This function returns a random number. More...
XHdcp22_Rng_Config * | XHdcp22Rng_LookupConfig (u16 DeviceId)
| This function returns a reference to an XHdcp22_Rng_Config structure based on the core id, DeviceId. More...
int | XHdcp22Rng_SelfTest (XHdcp22_Rng *InstancePtr)
| This function reads ID of the peripheral. More...

## Register access macro definition
#define | XHdcp22Rng_In32 Xil_In32
| Input Operations. More...
#define | XHdcp22Rng_Out32 Xil_Out32
| Output Operations. More...
#define | XHdcp22Rng_ReadReg(BaseAddress, RegOffset) XHdcp22Rng_In32((BaseAddress) + ((u32)RegOffset))
| This macro reads a value from a HDCP22 RNG register. More...
#define | XHdcp22Rng_WriteReg(BaseAddress, RegOffset, Data) XHdcp22Rng_Out32((BaseAddress) + ((u32)RegOffset), (u32)(Data))
| This macro writes a value to a HDCP22 RNG register. More...
#define | XHdcp22Rng_GetStatusReg(BaseAddress) XHdcp22Rng_ReadReg(BaseAddress, XHDCP22_RNG_REG_STA_OFFSET)
| This macro reads the status register from the HDCP22 RNG. More...
#define | XHdcp22Rng_GetControlReg(BaseAddress) XHdcp22Rng_ReadReg(BaseAddress, XHDCP22_RNG_REG_CTRL_OFFSET)
| This macro reads the control register from the HDCP22 RNG. More...

## Macro Definition Documentation

#define XHDCP22_RN_REG_STA_EVT_MASK (1<<1)

Status register event mask.

Reserved for future use.

#define XHDCP22_RN_REG_STA_IRQ_MASK (1<<0)

Status register interrupt mask.

Reserved for future use.

#define XHDCP22_RNG_H

< Prevent circular inclusions by using protection macros

#define XHDCP22_RNG_HW_H

< Prevent circular inclusions by using protection macros

#define XHDCP22_RNG_MASK_16 0xFFFF

16 bit mask value

Referenced by XHdcp22Rng_CfgInitialize(), and XHdcp22Rng_SelfTest().

#define XHDCP22_RNG_REG_CTRL_CLR_OFFSET ((XHDCP22_RNG_REG_BASE)+(2*4))

Control clear register * offset.

#define XHDCP22_RNG_REG_CTRL_IE_MASK (1<<1)

Control register Interrupt Enable mask.

Reserved for future use.

#define XHDCP22_RNG_REG_CTRL_OFFSET ((XHDCP22_RNG_REG_BASE)+(0*4))

Control register * register offset.

#define XHDCP22_RNG_REG_CTRL_RUN_MASK (1<<0)

Control register Run mask.

#define XHDCP22_RNG_REG_CTRL_SET_OFFSET ((XHDCP22_RNG_REG_BASE)+(1*4))

Control set register * offset.

#define XHDCP22_RNG_REG_RN_1_OFFSET ((XHDCP22_RNG_REG_BASE)+(4*4))

Random number register 1 * offset.

Referenced by XHdcp22Rng_GetRandom().

#define XHDCP22_RNG_REG_RN_2_OFFSET ((XHDCP22_RNG_REG_BASE)+(5*4))

Random number 2 * offset.

#define XHDCP22_RNG_REG_RN_3_OFFSET ((XHDCP22_RNG_REG_BASE)+(6*4))

Random number 3 * offset.

#define XHDCP22_RNG_REG_RN_4_OFFSET ((XHDCP22_RNG_REG_BASE)+(7*4))

Random number 4 * offset.

#define XHDCP22_RNG_REG_STA_OFFSET ((XHDCP22_RNG_REG_BASE)+(3*4))

Status register * offset.

#define XHDCP22_RNG_SHIFT_16 16

16 shift value

Referenced by XHdcp22Rng_CfgInitialize(), and XHdcp22Rng_SelfTest().

#define XHDCP22_RNG_VER_ID 0x2200

Version ID.

Referenced by XHdcp22Rng_CfgInitialize(), and XHdcp22Rng_SelfTest().

#define XHDCP22_RNG_VER_ID_OFFSET ((XHDCP22_RNG_VER_BASE)+(0*4))

VER Identification register * register offset.

Referenced by XHdcp22Rng_CfgInitialize(), and XHdcp22Rng_SelfTest().

#define XHDCP22_RNG_VER_VERSION_OFFSET ((XHDCP22_RNG_VER_BASE)+(1*4))

VER Version register * offset.

#define XHdcp22Rng_Disable | ( |  | InstancePtr | ) |

Value:
XHdcp22Rng_WriteReg((InstancePtr)->Config.BaseAddress, \
(XHDCP22_RNG_REG_CTRL_CLR_OFFSET), (XHDCP22_RNG_REG_CTRL_RUN_MASK))
XHDCP22_RNG_REG_CTRL_RUN_MASK
#define XHDCP22_RNG_REG_CTRL_RUN_MASK
Control register Run mask.
Definition: xhdcp22_rng_hw.h:87
XHdcp22Rng_WriteReg
#define XHdcp22Rng_WriteReg(BaseAddress, RegOffset, Data)
This macro writes a value to a HDCP22 RNG register.
Definition: xhdcp22_rng_hw.h:152
XHDCP22_RNG_REG_CTRL_CLR_OFFSET
#define XHDCP22_RNG_REG_CTRL_CLR_OFFSET
Control clear register * offset.
Definition: xhdcp22_rng_hw.h:73

This macro disables the HDCP22 RNG peripheral.

Parameters

  InstancePtr | is a pointer to the HDCP22 RNG core instance.

Returns
  None.

Note
  C-style signature: void XHdcp22Rng_Disable(u32 BaseAddress)

#define XHdcp22Rng_Enable | ( |  | InstancePtr | ) |

Value:
XHdcp22Rng_WriteReg((InstancePtr)->Config.BaseAddress, \
(XHDCP22_RNG_REG_CTRL_SET_OFFSET), (XHDCP22_RNG_REG_CTRL_RUN_MASK))
XHDCP22_RNG_REG_CTRL_RUN_MASK
#define XHDCP22_RNG_REG_CTRL_RUN_MASK
Control register Run mask.
Definition: xhdcp22_rng_hw.h:87
XHdcp22Rng_WriteReg
#define XHdcp22Rng_WriteReg(BaseAddress, RegOffset, Data)
This macro writes a value to a HDCP22 RNG register.
Definition: xhdcp22_rng_hw.h:152
XHDCP22_RNG_REG_CTRL_SET_OFFSET
#define XHDCP22_RNG_REG_CTRL_SET_OFFSET
Control set register * offset.
Definition: xhdcp22_rng_hw.h:71

This macro enables the HDCP22 RNG peripheral.

Parameters

  InstancePtr | is a pointer to the HDCP22 RNG core instance.

Returns
  None.

Note
  C-style signature: void XHdcp22Rng_Enable(u32 BaseAddress)

#define XHdcp22Rng_GetControlReg | ( |  | BaseAddress | ) | XHdcp22Rng_ReadReg(BaseAddress, XHDCP22_RNG_REG_CTRL_OFFSET)

This macro reads the control register from the HDCP22 RNG.

Parameters

  BaseAddress | is the base address of the HDCP22 RNG core instance.

Returns
  A 32-bit value representing the contents of the control register.

Note
  C-style signature: u32 XHdcp22Rng_GetStatusReg(u32 BaseAddress)

#define XHdcp22Rng_GetStatusReg | ( |  | BaseAddress | ) | XHdcp22Rng_ReadReg(BaseAddress, XHDCP22_RNG_REG_STA_OFFSET)

This macro reads the status register from the HDCP22 RNG.

Parameters

  BaseAddress | is the base address of the HDCP22 RNG core instance.

Returns
  A 32-bit value representing the contents of the status register.

Note
  C-style signature: u32 XHdcp22Rng_GetStatusReg(u32 BaseAddress)

#define XHdcp22Rng_In32 Xil_In32

Input Operations.

#define XHdcp22Rng_IsEnabled | ( |  | InstancePtr | ) |

Value:
((XHdcp22Rng_GetControlReg((InstancePtr)->Config.BaseAddress)\
& XHDCP22_RNG_REG_CTRL_RUN_MASK) == XHDCP22_RNG_REG_CTRL_RUN_MASK)
XHDCP22_RNG_REG_CTRL_RUN_MASK
#define XHDCP22_RNG_REG_CTRL_RUN_MASK
Control register Run mask.
Definition: xhdcp22_rng_hw.h:87
XHdcp22Rng_GetControlReg
#define XHdcp22Rng_GetControlReg(BaseAddress)
This macro reads the control register from the HDCP22 RNG.
Definition: xhdcp22_rng_hw.h:184

This macro returns the enabled state of HDCP22 RNG.

for the HDCP22 RNG peripheral.

Parameters

  InstancePtr | is a pointer to the HDCP22 RNG core instance.

Returns
  TRUE if HDCP22 RNG is enabled, FALSE otherwise.

Note
  C-style signature: u32 XHdcp22Rng_IsEnabled(u32 BaseAddress)

#define XHdcp22Rng_Out32 Xil_Out32

Output Operations.

#define XHdcp22Rng_ReadReg | ( |  | BaseAddress,
|  |  | RegOffset
| ) |  | XHdcp22Rng_In32((BaseAddress) + ((u32)RegOffset))

This macro reads a value from a HDCP22 RNG register.

A 32 bit read is performed. If the component is implemented in a smaller width, only the least significant data is read from the register. The most significant data will be read as 0.

Parameters

  BaseAddress | is the base address of the HDCP22 RNG core instance.
  RegOffset | is the register offset of the register (defined at the top of this file).

Returns
  The 32-bit value of the register.

Note
  C-style signature: u32 XHdcp22Rng_ReadReg(u32 BaseAddress, u32 RegOffset)

Referenced by XHdcp22Rng_CfgInitialize(), XHdcp22Rng_GetRandom(), and XHdcp22Rng_SelfTest().

#define XHdcp22Rng_WriteReg | ( |  | BaseAddress,
|  |  | RegOffset,
|  |  | Data
| ) |  | XHdcp22Rng_Out32((BaseAddress) + ((u32)RegOffset), (u32)(Data))

This macro writes a value to a HDCP22 RNG register.

A 32 bit write is performed. If the component is implemented in a smaller width, only the least significant data is written.

Parameters

  BaseAddress | is the base address of the HDCP22 RNG core instance.
  RegOffset | is the register offset of the register (defined at the top of this file) to be written.
  Data | is the 32-bit value to write into the register.

Returns
  None.

Note
  C-style signature: void XHdcp22Rng_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

## Function Documentation

int XHdcp22Rng_CfgInitialize | ( | XHdcp22_Rng * | InstancePtr,
|  | XHdcp22_Rng_Config * | CfgPtr,
|  | UINTPTR | EffectiveAddr
| ) |  |

This function initializes the HDCP22 Rng core.

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

Parameters

  InstancePtr | is a pointer to the XHdcp22_Rng core instance.
  CfgPtr | points to the configuration structure associated with the HDCP22 Rng core core.
  EffectiveAddr | is the base address of the device. 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 XHdcp22Rng_CfgInitialize was successful.
  - XST_FAILURE if HDCP22 Rng ID mismatched.

Note
  None.

References XHdcp22_Rng_Config::BaseAddress, XHdcp22_Rng::Config, XHdcp22_Rng::IsReady, XHDCP22_RNG_MASK_16, XHDCP22_RNG_SHIFT_16, XHDCP22_RNG_VER_ID, XHDCP22_RNG_VER_ID_OFFSET, and XHdcp22Rng_ReadReg.

void XHdcp22Rng_GetRandom | ( | XHdcp22_Rng * | InstancePtr,
|  | u8 * | BufferPtr,
|  | u16 | BufferLength,
|  | u16 | RandomLength
| ) |  |

This function returns a random number.

Parameters

  InstancePtr | is a pointer to the XHdcp22_Rng core instance.
  BufferPtr | points to the buffer that will contain a random number.
  BufferLength | is the length of the BufferPtr in bytes. The length must be greater than or equal to RandomLength.
  RandomLength | is the requested length of the random number in bytes. The length must be a multiple of 4

Returns
  None.

Note
  None.

References XHdcp22_Rng_Config::BaseAddress, XHdcp22_Rng::Config, XHDCP22_RNG_REG_RN_1_OFFSET, and XHdcp22Rng_ReadReg.

XHdcp22_Rng_Config * XHdcp22Rng_LookupConfig | ( | u16 | DeviceId | ) |

This function returns a reference to an XHdcp22_Rng_Config structure based on the core id, DeviceId.

The return value will refer to an entry in the device configuration table defined in the xhdcp22_rng_g.c file.

Parameters

  DeviceId | is the unique core ID of the XHDCP22 Rng core for the lookup operation.

Returns
  XHdcp22Rng_LookupConfig returns a reference to a config record in the configuration table (in xhdcp22_rng_g.c) corresponding to DeviceId, or NULL if no match is found.

Note
  None.

int XHdcp22Rng_SelfTest | ( | XHdcp22_Rng * | InstancePtr | ) |

This function reads ID of the peripheral.

Parameters

  InstancePtr | is a pointer to the HDCP22 Rng core instance.

Returns
  - XST_SUCCESS if ID was matched.
  - XST_FAILURE if ID was mismatched.

Note
  None.

References XHdcp22_Rng_Config::BaseAddress, XHdcp22_Rng::Config, XHDCP22_RNG_MASK_16, XHDCP22_RNG_SHIFT_16, XHDCP22_RNG_VER_ID, XHDCP22_RNG_VER_ID_OFFSET, and XHdcp22Rng_ReadReg.