blob: d8c59fd9c2e3c52aa871b1c91fd95c807e673f5e
1 | /* |
2 | * include/amlogic/aml_cec.h |
3 | * |
4 | * Copyright (C) 2012 AMLOGIC, INC. All Rights Reserved. |
5 | * Author: hongmin hua <hongmin hua@amlogic.com> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the smems of the GNU General Public License as published by |
9 | * the Free Software Foundation; version 2 of the License. |
10 | */ |
11 | |
12 | |
13 | #ifndef _AML_CEC_H |
14 | #define _AML_CEC_H |
15 | |
16 | |
17 | #ifndef CONFIG_CEC_OSD_NAME |
18 | #define CONFIG_CEC_OSD_NAME "AML_TV" |
19 | #endif |
20 | |
21 | /*CEC UI MASK*/ |
22 | #define CEC_FUNC_MASK 0 |
23 | #define ONE_TOUCH_PLAY_MASK 1 |
24 | #define ONE_TOUCH_STANDBY_MASK 2 |
25 | #define AUTO_POWER_ON_MASK 3 |
26 | |
27 | #define MAX_MSG 16 |
28 | #define CEC_PLAYBACK_DEVICE_TYPE 4 |
29 | #define CEC_BROADCAST_ADDR 0xf |
30 | #define CEC_VERSION_14A 5 |
31 | |
32 | //=========ao cec a================================== |
33 | //cec a: read only |
34 | #define CEC_RX_MSG_LENGTH 0x90 |
35 | #define CEC_RX_MSG_STATUS 0x91 |
36 | #define CEC_RX_NUM_MSG 0x92 |
37 | #define CEC_TX_MSG_STATUS 0x93 |
38 | #define CEC_TX_NUM_MSG 0x94 |
39 | |
40 | //cec a: tx_msg_cmd definition |
41 | #define TX_NO_OP 0 // No transaction |
42 | #define TX_REQ_CURRENT 1 // Transmit earliest message in buffer |
43 | #define TX_ABORT 2 // Abort transmitting earliest message |
44 | #define TX_REQ_NEXT 3 // Overwrite earliest message in buffer and transmit next message |
45 | |
46 | //cec a: tx_msg_status definition |
47 | #define TX_IDLE 0 // No transaction |
48 | #define TX_BUSY 1 // Transmitter is busy |
49 | #define TX_DONE 2 // Message has been successfully transmitted |
50 | #define TX_ERROR 3 // Message has been transmitted with error |
51 | |
52 | //cec a: rx_msg_cmd |
53 | #define RX_NO_OP 0 // No transaction |
54 | #define RX_ACK_CURRENT 1 // Read earliest message in buffer |
55 | #define RX_DISABLE 2 // Disable receiving latest message |
56 | #define RX_ACK_NEXT 3 // Clear earliest message from buffer and read next message |
57 | |
58 | //cec a: rx_msg_status |
59 | #define RX_IDLE 0 // No transaction |
60 | #define RX_BUSY 1 // Receiver is busy |
61 | #define RX_DONE 2 // Message has been received successfully |
62 | #define RX_ERROR 3 // Message has been received with error |
63 | |
64 | |
65 | /* |
66 | * CEC OPCODES |
67 | */ |
68 | #define CEC_OC_ABORT_MESSAGE 0xFF |
69 | #define CEC_OC_ACTIVE_SOURCE 0x82 |
70 | #define CEC_OC_CEC_VERSION 0x9E |
71 | #define CEC_OC_CLEAR_ANALOGUE_TIMER 0x33 |
72 | #define CEC_OC_CLEAR_DIGITAL_TIMER 0x99 |
73 | #define CEC_OC_CLEAR_EXTERNAL_TIMER 0xA1 |
74 | #define CEC_OC_DECK_CONTROL 0x42 |
75 | #define CEC_OC_DECK_STATUS 0x1B |
76 | #define CEC_OC_DEVICE_VENDOR_ID 0x87 |
77 | #define CEC_OC_FEATURE_ABORT 0x00 |
78 | #define CEC_OC_GET_CEC_VERSION 0x9F |
79 | #define CEC_OC_GET_MENU_LANGUAGE 0x91 |
80 | #define CEC_OC_GIVE_AUDIO_STATUS 0x71 |
81 | #define CEC_OC_GIVE_DECK_STATUS 0x1A |
82 | #define CEC_OC_GIVE_DEVICE_POWER_STATUS 0x8F |
83 | #define CEC_OC_GIVE_DEVICE_VENDOR_ID 0x8C |
84 | #define CEC_OC_GIVE_OSD_NAME 0x46 |
85 | #define CEC_OC_GIVE_PHYSICAL_ADDRESS 0x83 |
86 | #define CEC_OC_GIVE_SYSTEM_AUDIO_MODE_STATUS 0x7D |
87 | #define CEC_OC_GIVE_TUNER_DEVICE_STATUS 0x08 |
88 | #define CEC_OC_IMAGE_VIEW_ON 0x04 |
89 | #define CEC_OC_INACTIVE_SOURCE 0x9D |
90 | #define CEC_OC_MENU_REQUEST 0x8D |
91 | #define CEC_OC_MENU_STATUS 0x8E |
92 | #define CEC_OC_PLAY 0x41 |
93 | #define CEC_OC_POLLING_MESSAGE 0xFC /* Fake Code - <Poll Message> has no OP Code and requires only the header byte */ |
94 | #define CEC_OC_RECORD_OFF 0x0B |
95 | #define CEC_OC_RECORD_ON 0x09 |
96 | #define CEC_OC_RECORD_STATUS 0x0A |
97 | #define CEC_OC_RECORD_TV_SCREEN 0x0F |
98 | #define CEC_OC_REPORT_AUDIO_STATUS 0x7A |
99 | #define CEC_OC_REPORT_PHYSICAL_ADDRESS 0x84 |
100 | #define CEC_OC_REPORT_POWER_STATUS 0x90 |
101 | #define CEC_OC_REQUEST_ACTIVE_SOURCE 0x85 |
102 | #define CEC_OC_ROUTING_CHANGE 0x80 |
103 | #define CEC_OC_ROUTING_INFORMATION 0x81 |
104 | #define CEC_OC_SELECT_ANALOGUE_SERVICE 0x92 |
105 | #define CEC_OC_SELECT_DIGITAL_SERVICE 0x93 |
106 | #define CEC_OC_SET_ANALOGUE_TIMER 0x34 |
107 | #define CEC_OC_SET_AUDIO_RATE 0x9A |
108 | #define CEC_OC_SET_DIGITAL_TIMER 0x97 |
109 | #define CEC_OC_SET_EXTERNAL_TIMER 0xA2 |
110 | #define CEC_OC_SET_MENU_LANGUAGE 0x32 |
111 | #define CEC_OC_SET_OSD_NAME 0x47 |
112 | #define CEC_OC_SET_OSD_STRING 0x64 |
113 | #define CEC_OC_SET_STREAM_PATH 0x86 |
114 | #define CEC_OC_SET_SYSTEM_AUDIO_MODE 0x72 |
115 | #define CEC_OC_SET_TIMER_PROGRAM_TITLE 0x67 |
116 | #define CEC_OC_STANDBY 0x36 |
117 | #define CEC_OC_SYSTEM_AUDIO_MODE_REQUEST 0x70 |
118 | #define CEC_OC_SYSTEM_AUDIO_MODE_STATUS 0x7E |
119 | #define CEC_OC_TEXT_VIEW_ON 0x0D |
120 | #define CEC_OC_TIMER_CLEARED_STATUS 0x43 |
121 | #define CEC_OC_TIMER_STATUS 0x35 |
122 | #define CEC_OC_TUNER_DEVICE_STATUS 0x07 |
123 | #define CEC_OC_TUNER_STEP_DECREMENT 0x06 |
124 | #define CEC_OC_TUNER_STEP_INCREMENT 0x05 |
125 | #define CEC_OC_USER_CONTROL_PRESSED 0x44 |
126 | #define CEC_OC_USER_CONTROL_RELEASED 0x45 |
127 | #define CEC_OC_VENDOR_COMMAND 0x89 |
128 | #define CEC_OC_VENDOR_COMMAND_WITH_ID 0xA0 |
129 | #define CEC_OC_VENDOR_REMOTE_BUTTON_DOWN 0x8A |
130 | #define CEC_OC_VENDOR_REMOTE_BUTTON_UP 0x8B |
131 | |
132 | enum _cec_log_dev_addr_e { |
133 | CEC_TV_ADDR = 0x00, |
134 | CEC_RECORDING_DEVICE_1_ADDR, |
135 | CEC_RECORDING_DEVICE_2_ADDR, |
136 | CEC_TUNER_1_ADDR, |
137 | CEC_PLAYBACK_DEVICE_1_ADDR, |
138 | CEC_AUDIO_SYSTEM_ADDR, |
139 | CEC_TUNER_2_ADDR, |
140 | CEC_TUNER_3_ADDR, |
141 | CEC_PLAYBACK_DEVICE_2_ADDR, |
142 | CEC_RECORDING_DEVICE_3_ADDR, |
143 | CEC_TUNER_4_ADDR, |
144 | CEC_PLAYBACK_DEVICE_3_ADDR, |
145 | CEC_RESERVED_1_ADDR, |
146 | CEC_RESERVED_2_ADDR, |
147 | CEC_FREE_USE_ADDR, |
148 | CEC_UNREGISTERED_ADDR |
149 | }; |
150 | |
151 | typedef enum { |
152 | CEC_UNRECONIZED_OPCODE = 0x0, |
153 | CEC_NOT_CORRECT_MODE_TO_RESPOND, |
154 | CEC_CANNOT_PROVIDE_SOURCE, |
155 | CEC_INVALID_OPERAND, |
156 | CEC_REFUSED, |
157 | CEC_UNABLE_TO_DETERMINE, |
158 | } cec_feature_abort_e; |
159 | |
160 | typedef enum { |
161 | DEVICE_MENU_ACTIVE = 0, |
162 | DEVICE_MENU_INACTIVE, |
163 | } cec_device_menu_state_e; |
164 | |
165 | /* cec message structure */ |
166 | typedef struct { |
167 | unsigned char msg[16]; |
168 | unsigned char msg_len; |
169 | } cec_msg_buf_t; |
170 | |
171 | typedef struct { |
172 | cec_msg_buf_t buf[2]; /* message memory */ |
173 | unsigned char power_status; |
174 | unsigned char log_addr; |
175 | unsigned char cec_power; |
176 | unsigned char active_source; |
177 | unsigned char rx_write_pos; |
178 | unsigned char rx_read_pos; |
179 | unsigned char rx_buf_size; |
180 | } cec_msg_t; |
181 | |
182 | typedef struct { |
183 | unsigned int wk_logic_addr:8; |
184 | unsigned int wk_phy_addr:16; |
185 | unsigned int wk_port_id:8; |
186 | }cec_wakeup_t; |
187 | |
188 | extern cec_msg_t cec_msg; |
189 | |
190 | extern int cec_hw_init(int logic_addr, unsigned char fun_cfg); |
191 | |
192 | #endif/*_AML_CEC_H*/ |
193 | |
194 |