2 Copyright (c) 2012, Broadcom Europe Ltd
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holder nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * CEC service command enumeration and parameter types.
34 * This file contains definition shared by host side and
35 * Videocore side CEC service:
37 * In general, a zero return value indicates success of the function
38 * A non-zero value indicates VCHI error
39 * A positive value indicates alternative return value (for some functions).
44 #ifndef _VC_CECSERVICE_DEFS_H_
45 #define _VC_CECSERVICE_DEFS_H_
46 #include "vcinclude/common.h"
47 #include "interface/vcos/vcos.h"
48 #include "interface/vcos/vcos_logging.h"
49 #include "interface/vchi/message_drivers/message.h"
51 //CEC VCOS logging stuff
52 #define CECHOST_LOG_CATEGORY (&cechost_log_category)
53 #define vc_cec_log_trace(...) _VCOS_LOG_X(CECHOST_LOG_CATEGORY, VCOS_LOG_TRACE, __VA_ARGS__)
54 #define vc_cec_log_warn(...) _VCOS_LOG_X(CECHOST_LOG_CATEGORY, VCOS_LOG_WARN, __VA_ARGS__)
55 #define vc_cec_log_error(...) _VCOS_LOG_X(CECHOST_LOG_CATEGORY, VCOS_LOG_ERROR, __VA_ARGS__)
56 #define vc_cec_log_info(...) _VCOS_LOG_X(CECHOST_LOG_CATEGORY, VCOS_LOG_INFO, __VA_ARGS__)
57 extern VCOS_LOG_CAT_T cechost_log_category; //The actual object lives in CEC host side service code
59 #define VC_CECSERVICE_VER 1
60 #define CECSERVICE_MSGFIFO_SIZE 1024
61 #define CECSERVICE_CLIENT_NAME MAKE_FOURCC("CECS")
62 #define CECSERVICE_NOTIFY_NAME MAKE_FOURCC("CECN")
64 //CEC service commands
66 VC_CEC_REGISTER_CMD = 0,
68 VC_CEC_DEREGISTER_CMD,
69 VC_CEC_DEREGISTER_ALL,
71 VC_CEC_GET_LOGICAL_ADDR,
72 VC_CEC_ALLOC_LOGICAL_ADDR,
73 VC_CEC_RELEASE_LOGICAL_ADDR,
77 VC_CEC_GET_PHYSICAL_ADDR,
80 //The following 3 commands are used when CEC middleware is
81 //running in passive mode (i.e. it does not allocate
82 //logical address automatically)
84 VC_CEC_SET_LOGICAL_ADDR,
87 //Add more commands here
91 //See vc_cec.h for details
93 //Parameters: opcode to register (CEC_OPCODE_T sent as uint32)
101 //Parameters: opcode to deregister (CEC_OPCODE_T sent as uint32)
109 //Parameters: destination, length, 16 bytes buffer (message can only be at most 15 bytes however)
110 //Reply: none (callback)
114 uint8_t payload[16]; //max. 15 bytes padded to 16
115 uint32_t is_reply; //non-zero if this is a reply, zero otherwise
116 } CEC_SEND_MSG_PARAM_T;
120 //Reply: logical address (uint8 returned as uint32)
124 //Reply: none (callback)
128 //Reply: topology (see VC_TOPOLOGY_T)
131 //Parameters: vendor id (uint32)
135 //Parameters: 14 byte char
137 #define OSD_NAME_LENGTH 14
141 //Reply: packed physical address returned as uint16
144 //Parameter: logical address (CEC_AllDevices_T sent as uint32_t)
145 //Reply: (uint32_t vendor id)
147 //POLL_LOGICAL_ADDR (only for passive mode)
148 //Used by host to test a logical address to see if it is available for use
149 //Only available if CEC is compiled in passive mode and while the host
150 //is testing the availability of a logical address
151 //Parameter: logical address
154 //SET_LOGICAL_ADDR [(only for passive mode) This will be changed when we support multiple logical addresses]
155 //Set the logical address used
156 //Only available if CEC is compiled in passive mode
157 //Parameter: logical address, device type, vendor ID
158 //Reply: (int32_t - zero means success, non-zero otherwise)
159 //This function will result in a VC_CEC_LOGICAL_ADDR callback
161 uint32_t logical_address;
162 uint32_t device_type;
164 } CEC_SET_LOGICAL_ADDR_PARAM_T;
166 //ADD_DEVICE (only for passive mode)
167 //Only available if CEC is compiled in passive mode
168 //Parameter: logical address, physical address, device type, last device?
169 //Reply: (int32_t - zero means success, non-zero otherwise)
171 uint32_t logical_address; /**<logical address */
172 uint32_t physical_address; /**<16-bit packed physical address in big endian */
173 uint32_t device_type; /**<CEC_DEVICE_TYPE_T */
174 uint32_t last_device; /**<True (non-zero) or false (zero) */
175 } CEC_ADD_DEVICE_PARAM_T;
177 //SET PASSIVE (only for passive mode)
178 //Enable/disable passive mode
179 //Parameter: non-zero to enable passive mode, zero to disable
180 //Reply: (int32_t - zero means success, non-zero otherwise, non zero will be VCHI errors)
182 #endif //#ifndef _VC_CECSERVICE_DEFS_H_