| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#ifndef CF_HDMI_H_ |
| 42 |
#define CF_HDMI_H_ |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
#include "xparameters.h" |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#ifdef XPAR_AXI_CLKGEN_0_BASEADDR |
| 53 |
#define CF_CLKGEN_BASEADDR XPAR_AXI_CLKGEN_0_BASEADDR |
| 54 |
#else |
| 55 |
#define CF_CLKGEN_BASEADDR XPAR_AXI_HDMI_CLKGEN_BASEADDR |
| 56 |
#endif |
| 57 |
#ifdef XPAR_AXI_HDMI_TX_0_BASEADDR |
| 58 |
#define CFV_BASEADDR XPAR_AXI_HDMI_TX_0_BASEADDR |
| 59 |
#else |
| 60 |
#define CFV_BASEADDR XPAR_AXI_HDMI_CORE_BASEADDR |
| 61 |
#endif |
| 62 |
#ifdef XPAR_AXI_SPDIF_TX_0_BASEADDR |
| 63 |
#define CFA_BASEADDR XPAR_AXI_SPDIF_TX_0_BASEADDR |
| 64 |
#else |
| 65 |
#define CFA_BASEADDR XPAR_AXI_SPDIF_TX_CORE_BASEADDR |
| 66 |
#endif |
| 67 |
#define DDR_BASEADDR XPAR_DDR_MEM_BASEADDR |
| 68 |
#define UART_BASEADDR XPS_UART1_BASEADDR |
| 69 |
#ifdef XPAR_AXI_VDMA_0_BASEADDR |
| 70 |
#define VDMA_BASEADDR XPAR_AXI_VDMA_0_BASEADDR |
| 71 |
#else |
| 72 |
#define VDMA_BASEADDR XPAR_AXI_HDMI_DMA_BASEADDR |
| 73 |
#endif |
| 74 |
#define ADMA_DEVICE_ID XPAR_XDMAPS_1_DEVICE_ID |
| 75 |
#define IIC_BASEADDR XPS_I2C0_BASEADDR |
| 76 |
#define VIDEO_BASEADDR DDR_BASEADDR + 0x2000000 |
| 77 |
#define AUDIO_BASEADDR DDR_BASEADDR + 0x1000000 |
| 78 |
#define A_SAMPLE_FREQ 48000 |
| 79 |
#define A_FREQ 1400 |
| 80 |
#define AUDIO_LENGTH (A_SAMPLE_FREQ/A_FREQ) |
| 81 |
|
| 82 |
#define AXI_HDMI_REG_RESET 0x040 |
| 83 |
#define AXI_HDMI_REG_CTRL 0x044 |
| 84 |
#define AXI_HDMI_REG_SOURCE_SEL 0x048 |
| 85 |
#define AXI_HDMI_REG_COLORPATTERN 0x04c |
| 86 |
#define AXI_HDMI_REG_STATUS 0x05c |
| 87 |
#define AXI_HDMI_REG_VDMA_STATUS 0x060 |
| 88 |
#define AXI_HDMI_REG_TPM_STATUS 0x064 |
| 89 |
#define AXI_HDMI_REG_HTIMING1 0x400 |
| 90 |
#define AXI_HDMI_REG_HTIMING2 0x404 |
| 91 |
#define AXI_HDMI_REG_HTIMING3 0x408 |
| 92 |
#define AXI_HDMI_REG_VTIMING1 0x440 |
| 93 |
#define AXI_HDMI_REG_VTIMING2 0x444 |
| 94 |
#define AXI_HDMI_REG_VTIMING3 0x448 |
| 95 |
|
| 96 |
#define AXI_VDMA_REG_DMA_CTRL 0x00 |
| 97 |
#define AXI_VDMA_REG_V_SIZE 0x50 |
| 98 |
#define AXI_VDMA_REG_H_SIZE 0x54 |
| 99 |
#define AXI_VDMA_REG_FRMDLY_STRIDE 0x58 |
| 100 |
#define AXI_VDMA_REG_START_1 0x5C |
| 101 |
#define AXI_VDMA_REG_START_2 0x60 |
| 102 |
#define AXI_VDMA_REG_START_3 0x64 |
| 103 |
|
| 104 |
#define AXI_CLKGEN_V2_REG_RESET 0x40 |
| 105 |
#define AXI_CLKGEN_V2_REG_DRP_CNTRL 0x70 |
| 106 |
#define AXI_CLKGEN_V2_REG_DRP_STATUS 0x74 |
| 107 |
|
| 108 |
#define AXI_CLKGEN_V2_RESET_MMCM_ENABLE (1 << 1) |
| 109 |
#define AXI_CLKGEN_V2_RESET_ENABLE (1 << 0) |
| 110 |
|
| 111 |
#define AXI_CLKGEN_V2_DRP_CNTRL_SEL (1 << 29) |
| 112 |
#define AXI_CLKGEN_V2_DRP_CNTRL_READ (1 << 28) |
| 113 |
#define AXI_CLKGEN_V2_DRP_STATUS_BUSY (1 << 16) |
| 114 |
|
| 115 |
#define MMCM_REG_CLKOUT0_1 0x08 |
| 116 |
#define MMCM_REG_CLKOUT0_2 0x09 |
| 117 |
#define MMCM_REG_CLK_FB1 0x14 |
| 118 |
#define MMCM_REG_CLK_FB2 0x15 |
| 119 |
#define MMCM_REG_CLK_DIV 0x16 |
| 120 |
#define MMCM_REG_LOCK1 0x18 |
| 121 |
#define MMCM_REG_LOCK2 0x19 |
| 122 |
#define MMCM_REG_LOCK3 0x1a |
| 123 |
#define MMCM_REG_FILTER1 0x4e |
| 124 |
#define MMCM_REG_FILTER2 0x4f |
| 125 |
|
| 126 |
enum videoResolution |
| 127 |
{ |
| 128 |
RESOLUTION_640x480, |
| 129 |
RESOLUTION_800x600, |
| 130 |
RESOLUTION_1024x768, |
| 131 |
RESOLUTION_1280x720, |
| 132 |
RESOLUTION_1360x768, |
| 133 |
RESOLUTION_1600x900, |
| 134 |
RESOLUTION_1920x1080 |
| 135 |
}; |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
void InitHdmiVideoPcore(unsigned short horizontalActiveTime, |
| 141 |
unsigned short horizontalBlankingTime, |
| 142 |
unsigned short horizontalSyncOffset, |
| 143 |
unsigned short horizontalSyncPulseWidth, |
| 144 |
unsigned short verticalActiveTime, |
| 145 |
unsigned short verticalBlankingTime, |
| 146 |
unsigned short verticalSyncOffset, |
| 147 |
unsigned short verticalSyncPulseWidth); |
| 148 |
void SetVideoResolution(unsigned char resolution); |
| 149 |
void InitHdmiAudioPcore(void); |
| 150 |
void AudioClick(void); |
| 151 |
int CLKGEN_SetRate(unsigned long rate, |
| 152 |
unsigned long parent_rate); |
| 153 |
unsigned long CLKGEN_GetRate(unsigned long parent_rate); |
| 154 |
|
| 155 |
#endif |