IR Manager HAL 0.2.1
 
Loading...
Searching...
No Matches
plat_ir.h
Go to the documentation of this file.
1/*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2016 RDK Management
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18*/
19
20/**
21 * @addtogroup HPK HPK
22 * @{
23 * @par The Hardware Porting Kit
24 * HPK is the next evolution of the well-defined Hardware Abstraction Layer
25 * (HAL), but augmented with more comprehensive documentation and test suites
26 * that OEM or SOC vendors can use to self-certify their ports before taking
27 * them to RDKM for validation or to an operator for final integration and
28 * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC
29 * vendor to self-certify their own Video Accelerator devices, with minimal RDKM
30 * assistance
31 *
32 */
33
34/** @defgroup IR_MANAGER_HAL IR MANAGER HAL
35 * @{
36 * @par Application API Specification
37 * IR HAL provides an interface to register IR events with the low level interfaces,
38 * which will notify the caller based on received IR Key events.
39 */
40
41/** @defgroup PLAT_IR_API PLAT_IR_API
42 * @{
43 */
44
45
46#ifndef _MOD_IRHAL_PLATFORM_
47#define _MOD_IRHAL_PLATFORM_
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/**
53 * @file plat_ir.h
54 *
55 * @brief IR HAL header
56 *
57 * This file defines APIs, datatypes and error codes used by the IR HAL.
58 *
59 * @par Document
60 * Document reference.
61 *
62 * @par Open Issues (in no particular order)
63 * -# None
64 *
65 * @par Assumptions
66 * -# None
67 *
68 * @par Abbreviations
69 * - IR: Infra red
70 * - XMP: IR protocol. Platform specific
71 * - HAL: Hardware abstraction layer
72 * - XR Remote type
73 * @par Implementation Notes
74 * -# None
75 *
76 */
77
78/**
79 * @brief xmp tag type. This is used to specify the different remote types
80 */
81typedef enum PLAT_xmp_tag {
82 XMP_TAG_COMCAST = 0x00, ///< comcast remote
83 XMP_TAG_PLATCO = 0x01, ///< platco remote
84 XMP_TAG_XR11V2 = 0x02, ///< XR11V2 remote
85 XMP_TAG_XR15V1 = 0x03, ///< XR15V1 remote
86 XMP_TAG_XR15V2 = 0x04, ///< XR15V2 remote
87 XMP_TAG_XR16V1 = 0x05, ///< XR16V1 remote
88 XMP_TAG_XRAV1 = 0x06, ///< XRAV1 remote
89 XMP_TAG_XR20V1 = 0x07, ///< XR20V1 remote
90 XMP_TAG_PLATCOV2 = 0x08, ///< PLATCOV2 remote
91 XMP_TAG_UNDEFINED, ///< Undefined
93
94/**
95 * @brief xmp owner type describes whether key received in pairing or normal mode
96 *
97 */
98typedef enum PLAT_xmp_owner {
99 XMP_OWNER_NORMAL = 0x00, ///< normal mode
100 XMP_OWNER_PAIRING = 0x01, ///< paring mode
101 XMP_OWNER_UNDEFINED, ///< undefined mode
103
104/**
105 * @brief IR Key struct to store the IR key meta data
106 *
107 */
108typedef struct PLAT_irKey_metadata {
109 int type; ///< Event type of key press
110 ///< Platform specific. See macros KET_KEYDOWN, KET_KEYUP, KET_KEYREPEAT etc
111 int code; ///< Code of the pressed key
112 ///< See macros KED_POWER, KED_SELECT, KED_CHANNELUP etc
113 PLAT_xmp_tag_t tag; ///< Designates which device key belongs. See PLAT_xmp_tag_t
114 PLAT_xmp_owner_t owner; ///< Designates how key should be handled. See PLAT_xmp_owner_t
116
117/**
118* @brief HAL must call this function when an extended IR key is received
119*
120* The Event meta data contains Key Type, Code, Owner, and Tag of the IR key pressed
121*
122* @param[in] irKey contains data on IR key pressed. See PLAT_irKey_metadata_t
123*
124* @return None
125*
126* @note This function must not suspend and must not invoke any blocking system
127* calls. It shall send a message to a HAL IR event handler task.
128*/
130
131/**
132 * @brief This function is used to register for Extended IR key events
133 *
134 * The Caller must be notified with the extended IR Key events using the callback function
135 *
136 * @param[in] func callback function. See PLAT_IrKeyCallback_Extended_t
137 *
138 *
139 * @pre PLAT_API_INIT() should be called before calling this API
140 * @warning This API is NOT thread safe. Caller shall handle the concurrency.
141 * @see PLAT_API_INIT()
142 *
143 *
144 *
145 */
147
148/**
149 * @brief HAL must call this function when an IR key is received
150 *
151 * The Event Data contains Key Type and Key Code of the IR key pressed
152 *
153 * @param[in] keyType Key Type (e.g. Key Down, Key Up, Key Repeat) of the IR key pressed.
154 * Platform specific. See macros KET_KEYDOWN, KET_KEYUP, KET_KEYREPEAT etc
155 *
156 * @param[in] keyCode Key Code of the the IR key. Platform specific. See macros KED_POWER, KED_SELECT, KED_CHANNELUP etc
157 *
158 * @return None
159 *
160 * @note This function must not suspend and must not invoke any blocking system
161* calls. It shall send a message to a HAL IR event handler task.
162 */
163typedef void (*PLAT_IrKeyCallback_t)(int keyType, int keyCode);
164
165/**
166 * @brief This function is used to register for IR key events
167 *
168 * The Caller must be notified with the IR Key events using the callback function
169 *
170 * @param[in] func - callback function ; @see PLAT_IrKeyCallback_t
171 *
172 *
173 * @pre PLAT_API_INIT() should be called before calling this API
174 * @warning This API is NOT thread safe. Caller shall handle the concurrency
175 * @see PLAT_API_INIT()
176 *
177 */
179
180/**
181 * @brief This API initializes the underlying IR module
182 *
183 * This function must initialize all the IR specific user input device modules
184 *
185 *
186 * @return int - Status
187 * @retval 0 - Success
188 * @retval 1 - Failure
189 * @warning This API is NOT thread safe. Caller shall handle the concurrency
190 * @see PLAT_API_TERM()
191 *
192 */
194/**
195 * @brief This API is used to terminate the IR device module
196 *
197 * This function must terminate all the IR specific user input device modules. It must
198 * reset any data structures used within IR module and release any IR specific handles
199 * and resources
200 *
201 *
202 * @pre PLAT_API_INIT() should be called before calling this API
203 * @warning This API is NOT thread safe. Caller shall handle the concurrency
204 * @see PLAT_API_INIT()
205 */
206void PLAT_API_TERM(void);
207
208/**
209 * @brief This function executes the key event loop
210 *
211 * This function executes the platform-specific key event loop. This will generally
212 * translate between platform-specific key codes and Comcast standard keycode definitions
213 *
214 *
215 * @pre PLAT_API_INIT() should be called before calling this API
216 * @warning This API is NOT thread safe. Caller shall handle the concurrency
217 *
218 *
219 */
221
222
223#ifdef __cplusplus
224}
225#endif /* __cplusplus */
226#endif
227
228
229/** @} */ // End of PLAT_IR_API
230/** @} */ // End of IR_MANAGER_HAL
231/** @} */ // End of HPK
void(* PLAT_IrKeyCallback_Extended_t)(PLAT_irKey_metadata_t *irKey)
HAL must call this function when an extended IR key is received.
Definition plat_ir.h:129
void PLAT_API_LOOP()
This function executes the key event loop.
void PLAT_API_RegisterIRKeyCallbackExtended(PLAT_IrKeyCallback_Extended_t func)
This function is used to register for Extended IR key events.
PLAT_xmp_tag
xmp tag type. This is used to specify the different remote types
Definition plat_ir.h:81
struct PLAT_irKey_metadata PLAT_irKey_metadata_t
IR Key struct to store the IR key meta data.
void PLAT_API_TERM(void)
This API is used to terminate the IR device module.
int PLAT_API_INIT(void)
This API initializes the underlying IR module.
PLAT_xmp_owner
xmp owner type describes whether key received in pairing or normal mode
Definition plat_ir.h:98
void PLAT_API_RegisterIRKeyCallback(PLAT_IrKeyCallback_t func)
This function is used to register for IR key events.
enum PLAT_xmp_owner PLAT_xmp_owner_t
xmp owner type describes whether key received in pairing or normal mode
enum PLAT_xmp_tag PLAT_xmp_tag_t
xmp tag type. This is used to specify the different remote types
void(* PLAT_IrKeyCallback_t)(int keyType, int keyCode)
HAL must call this function when an IR key is received.
Definition plat_ir.h:163
@ XMP_TAG_COMCAST
comcast remote
Definition plat_ir.h:82
@ XMP_TAG_XR20V1
XR20V1 remote.
Definition plat_ir.h:89
@ XMP_TAG_XR15V2
XR15V2 remote.
Definition plat_ir.h:86
@ XMP_TAG_UNDEFINED
Undefined.
Definition plat_ir.h:91
@ XMP_TAG_PLATCOV2
PLATCOV2 remote.
Definition plat_ir.h:90
@ XMP_TAG_PLATCO
platco remote
Definition plat_ir.h:83
@ XMP_TAG_XRAV1
XRAV1 remote.
Definition plat_ir.h:88
@ XMP_TAG_XR11V2
XR11V2 remote.
Definition plat_ir.h:84
@ XMP_TAG_XR16V1
XR16V1 remote.
Definition plat_ir.h:87
@ XMP_TAG_XR15V1
XR15V1 remote.
Definition plat_ir.h:85
@ XMP_OWNER_NORMAL
normal mode
Definition plat_ir.h:99
@ XMP_OWNER_PAIRING
paring mode
Definition plat_ir.h:100
@ XMP_OWNER_UNDEFINED
undefined mode
Definition plat_ir.h:101
IR Key struct to store the IR key meta data.
Definition plat_ir.h:108
int code
See macros KED_POWER, KED_SELECT, KED_CHANNELUP etc.
Definition plat_ir.h:111
PLAT_xmp_owner_t owner
Designates how key should be handled. See PLAT_xmp_owner_t.
Definition plat_ir.h:114
PLAT_xmp_tag_t tag
Designates which device key belongs. See PLAT_xmp_tag_t.
Definition plat_ir.h:113
int type
Platform specific. See macros KET_KEYDOWN, KET_KEYUP, KET_KEYREPEAT etc.
Definition plat_ir.h:109