| 1 | /***************************************************************************//** |
| 2 | * @file transmitter.h |
| 3 | ******************************************************************************** |
| 4 | * Copyright 2013(c) Analog Devices, Inc. |
| 5 | * |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions are met: |
| 10 | * - Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * - Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in |
| 14 | * the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived |
| 18 | * from this software without specific prior written permission. |
| 19 | * - The use of this software may or may not infringe the patent rights |
| 20 | * of one or more patent holders. This license does not release you |
| 21 | * from the requirement that you obtain separate licenses from these |
| 22 | * patent holders to use this software. |
| 23 | * - Use of the software either in source or binary form, must be run |
| 24 | * on or directly connected to an Analog Devices Inc. component. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
| 27 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 29 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 30 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 31 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 | * |
| 37 | ******************************************************************************** |
| 38 | * SVN Revision: $WCREV$ |
| 39 | *******************************************************************************/ |
| 40 | |
| 41 | #ifndef _TRANSMITTER_H_ |
| 42 | #define _TRANSMITTER_H_ |
| 43 | |
| 44 | /******************************************************************************/ |
| 45 | /***************************** Include Files **********************************/ |
| 46 | /******************************************************************************/ |
| 47 | #include "transmitter_defs.h" |
| 48 | |
| 49 | /******************************************************************************/ |
| 50 | /******************* Macros and Variables Definitions *************************/ |
| 51 | /******************************************************************************/ |
| 52 | #define ADI_TASK_EVENT_TIMER 0x1 |
| 53 | #define DBG_MSG xil_printf |
| 54 | #define TRANSMITTER_DBG_MSG if(TransmitterParm.DebugControl)DBG_MSG |
| 55 | |
| 56 | typedef struct |
| 57 | { |
| 58 | UCHAR Header[8]; |
| 59 | UCHAR ManID[2]; |
| 60 | UCHAR ProdCode[2]; |
| 61 | UCHAR Serial[4]; |
| 62 | UCHAR ManWeek; |
| 63 | UCHAR ManYear; |
| 64 | UCHAR EdidRev[2]; |
| 65 | UCHAR VidInpDef; |
| 66 | UCHAR MaxHSizeCm; |
| 67 | UCHAR MaxVSizeCm; |
| 68 | UCHAR DispGamma; |
| 69 | UCHAR FeatSupport; |
| 70 | UCHAR ColorSpecs[10]; |
| 71 | UCHAR EstTiming[3]; |
| 72 | UCHAR StndTiming[16]; |
| 73 | UCHAR DetailedTiming[72]; |
| 74 | UCHAR ExtBlkCount; |
| 75 | UCHAR Checksum; |
| 76 | }EDID_STRUCT; |
| 77 | |
| 78 | typedef struct |
| 79 | { |
| 80 | UCHAR PixelClk[2]; |
| 81 | UCHAR HActive; |
| 82 | UCHAR HBlanking; |
| 83 | UCHAR HActBlnk44; |
| 84 | UCHAR VActive; |
| 85 | UCHAR VBlanking; |
| 86 | UCHAR VActBlnk44; |
| 87 | UCHAR HSyncOffs; |
| 88 | UCHAR HSyncWidth; |
| 89 | UCHAR VOffsPulse; |
| 90 | UCHAR HVOffsPulse; |
| 91 | UCHAR HSizemm; |
| 92 | UCHAR VSizemm; |
| 93 | UCHAR HVSizemm44; |
| 94 | UCHAR HBorder; |
| 95 | UCHAR VBorder; |
| 96 | UCHAR Flags; |
| 97 | }STD_TIMING; |
| 98 | |
| 99 | typedef struct |
| 100 | { |
| 101 | UCHAR CurrMuteState; /* Current mute state of A/V */ |
| 102 | TX_STATUS_PKT TxStatus; /* State of TX hardware */ |
| 103 | } TRANSMITTER_TX_VARS; |
| 104 | |
| 105 | TRANSMITTER_TX_VARS TransmitterTxVars; |
| 106 | |
| 107 | #define CurrMuteState TransmitterTxVars.CurrMuteState |
| 108 | #define TxStatus TransmitterTxVars.TxStatus |
| 109 | |
| 110 | #define HDMI_IEEE_REG 0x000C03 |
| 111 | |
| 112 | /******************************************************************************/ |
| 113 | /************************ Functions Declarations ******************************/ |
| 114 | /******************************************************************************/ |
| 115 | |
| 116 | /*! Initializes the transmitter. */ |
| 117 | ATV_ERR ADIAPI_TransmitterInit(void); |
| 118 | |
| 119 | /*! Initializes the software parameters. */ |
| 120 | void TRANSMITTER_SoftwareInit(void); |
| 121 | |
| 122 | /*! Initializes the hardware of the transmitter. */ |
| 123 | void TRANSMITTER_HardwareInit(void); |
| 124 | |
| 125 | /*! Sets the transmitter power mode. */ |
| 126 | ATV_ERR ADIAPI_TransmitterSetPowerMode(TRANSMITTER_POWER_MODE pwrmode); |
| 127 | |
| 128 | /*! Gets the operating mode based on HDMI HPD and MSEN state. */ |
| 129 | ATV_ERR ADIAPI_TransmitterGetDetectedMode(TRANSMITTER_OPER_MODE *Mode); |
| 130 | |
| 131 | /*! Gets the current system operating mode. */ |
| 132 | ATV_ERR ADIAPI_TransmitterGetOperatingMode(TRANSMITTER_OPER_MODE *Mode); |
| 133 | |
| 134 | /*! Sets the system operating mode. */ |
| 135 | ATV_ERR ADIAPI_TransmitterSetOperatingMode(TRANSMITTER_OPER_MODE Mode); |
| 136 | |
| 137 | /*! @brief Sets the mute mode using the operating mode information. */ |
| 138 | void ADIAPI_TransmitterSetMuteMode(TRANSMITTER_OPER_MODE Mode); |
| 139 | |
| 140 | /*! Checks current AVR operating mode and notify application if mode changed. */ |
| 141 | void TRANSMITTER_MonitorAvrMode(void); |
| 142 | |
| 143 | /*! @brief Main function for polling mode operation. */ |
| 144 | ATV_ERR ADIAPI_TransmitterMain(void); |
| 145 | |
| 146 | /*! Performs TX housekeeping tasks. */ |
| 147 | void TRANSMITTER_Housekeeping(void); |
| 148 | |
| 149 | /*! @brief This is the TX audio/video mute handling function. */ |
| 150 | ATV_ERR ADIAPI_TransmitterSetMuteState(void); |
| 151 | |
| 152 | /*! Performs the notification operations. */ |
| 153 | UINT16 TRANSMITTER_Notification (TX_EVENT Ev, UINT16 Count, UCHAR *BufPtr); |
| 154 | |
| 155 | /*! @brief Parse the new EDID segment. */ |
| 156 | void TRANSMITTER_NewEdidSegment(UINT16 SegmentNum, UCHAR *SegPtr); |
| 157 | |
| 158 | #endif |