| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2009, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bsettop_user_io.h $ |
|---|
| 11 | * $brcm_Revision: 3 $ |
|---|
| 12 | * $brcm_Date: 3/4/09 7:47p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_user_io.h $ |
|---|
| 19 | * |
|---|
| 20 | * 3 3/4/09 7:47p jgarrett |
|---|
| 21 | * PR 52269: Adding XMP support |
|---|
| 22 | * |
|---|
| 23 | * Trinity_Xmp_Support/1 2/24/09 11:21a prasadv |
|---|
| 24 | * Add XMP support into user io. code cleanup. |
|---|
| 25 | * |
|---|
| 26 | * 2 3/25/08 10:12a jgarrett |
|---|
| 27 | * PR 40857: Removing private function |
|---|
| 28 | * |
|---|
| 29 | * 1 2/7/05 7:07p dlwin |
|---|
| 30 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 31 | * |
|---|
| 32 | * Irvine_BSEAVSW_Devel/16 1/5/05 3:06p ywu |
|---|
| 33 | * PR 13748: Create an IR keystrokes automation utility |
|---|
| 34 | * bsettop_keystroke.c/h |
|---|
| 35 | * |
|---|
| 36 | * Irvine_BSEAVSW_Devel/15 7/6/04 3:53p erickson |
|---|
| 37 | * PR11771: settop api dataflow redesign |
|---|
| 38 | * |
|---|
| 39 | * Irvine_BSEAVSW_Devel/14 6/29/04 11:28a erickson |
|---|
| 40 | * PR11135: updated deprecation notices for settop api |
|---|
| 41 | * |
|---|
| 42 | * Irvine_BSEAVSW_Devel/13 1/15/04 4:40p vsilyaev |
|---|
| 43 | * PR 8850: Fixed type in the argument name. |
|---|
| 44 | * |
|---|
| 45 | * Irvine_BSEAVSW_Devel/Irvine_BSEAVSW_Devel_7038/2 12/17/03 4:21p erickson |
|---|
| 46 | * PR8850: clarify which Sejin IR keyboard is supported |
|---|
| 47 | * |
|---|
| 48 | ***************************************************************************/ |
|---|
| 49 | #ifndef BSETTOP_USER_IO_H__ |
|---|
| 50 | #define BSETTOP_USER_IO_H__ |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | #ifdef __cplusplus |
|---|
| 54 | extern "C" |
|---|
| 55 | { |
|---|
| 56 | #endif |
|---|
| 57 | |
|---|
| 58 | /*=********************* |
|---|
| 59 | Control user input and output, including: |
|---|
| 60 | |
|---|
| 61 | o LED's, including 7-segment LED's |
|---|
| 62 | o Remote controls |
|---|
| 63 | o Front panel |
|---|
| 64 | o IR keyboards |
|---|
| 65 | |
|---|
| 66 | The key codes are passed through unmodified in a 32-bit structure. |
|---|
| 67 | ***********************/ |
|---|
| 68 | |
|---|
| 69 | /* User Input API */ |
|---|
| 70 | |
|---|
| 71 | /* |
|---|
| 72 | Summary: |
|---|
| 73 | Open a user input object for receiving IR remote and keypad input. |
|---|
| 74 | Description: |
|---|
| 75 | For now, the following id's are used: |
|---|
| 76 | 0 - remote a |
|---|
| 77 | 1 - remote b |
|---|
| 78 | 2 - 56 MHz Sejin IR Keyboard |
|---|
| 79 | 3 - keypad |
|---|
| 80 | */ |
|---|
| 81 | buser_input_t buser_input_open( |
|---|
| 82 | bobject_t user_input_id /* user input object id */ |
|---|
| 83 | ); |
|---|
| 84 | |
|---|
| 85 | /* |
|---|
| 86 | Summary: |
|---|
| 87 | Close a user input handle. |
|---|
| 88 | Description: |
|---|
| 89 | Releases all resources associated with the user input object |
|---|
| 90 | */ |
|---|
| 91 | void buser_input_close( |
|---|
| 92 | buser_input_t ui /* user input object */ |
|---|
| 93 | ); |
|---|
| 94 | |
|---|
| 95 | /** |
|---|
| 96 | Summary: |
|---|
| 97 | Settings to control the user input interface. |
|---|
| 98 | **/ |
|---|
| 99 | typedef struct buser_input_settings { |
|---|
| 100 | bsettop_callback data_ready_callback; /* The callback is called whenever |
|---|
| 101 | data becomes available. It is allowed for the user to call buser_input_get_event |
|---|
| 102 | in the callback. You may receive more than one callback before |
|---|
| 103 | calling buser_input_get_event. */ |
|---|
| 104 | void *callback_context; /* User defined context which is passed into the |
|---|
| 105 | above callback. */ |
|---|
| 106 | } buser_input_settings; |
|---|
| 107 | |
|---|
| 108 | /** |
|---|
| 109 | Summary: |
|---|
| 110 | Get the current settings from a buser_input_t handle. |
|---|
| 111 | Description: |
|---|
| 112 | This can be called after buser_input_open to obtain the initial settings. |
|---|
| 113 | **/ |
|---|
| 114 | void buser_input_get_settings( |
|---|
| 115 | buser_input_t ui, |
|---|
| 116 | buser_input_settings *settings); |
|---|
| 117 | |
|---|
| 118 | /** |
|---|
| 119 | Summary: |
|---|
| 120 | Set new settings for a buser_input_t handle. |
|---|
| 121 | **/ |
|---|
| 122 | void buser_input_set_settings( |
|---|
| 123 | buser_input_t ui, |
|---|
| 124 | const buser_input_settings *settings); |
|---|
| 125 | |
|---|
| 126 | /* |
|---|
| 127 | Summary: |
|---|
| 128 | Representation of a user event. |
|---|
| 129 | Description: |
|---|
| 130 | The actual protocol for each input device is different. But they all |
|---|
| 131 | fit into the same storage space. |
|---|
| 132 | */ |
|---|
| 133 | typedef struct buser_input_event { |
|---|
| 134 | uint32_t code; /* One event is always contained in 32 bits of information */ |
|---|
| 135 | } buser_input_event; |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | /* |
|---|
| 139 | Summary: |
|---|
| 140 | Read events from a user input device. |
|---|
| 141 | |
|---|
| 142 | Description: |
|---|
| 143 | Because this function does not return a void* to raw data, but an array of structures, |
|---|
| 144 | it is not called buser_input_read. |
|---|
| 145 | */ |
|---|
| 146 | bresult buser_input_get_event( |
|---|
| 147 | buser_input_t ui, /* user input object */ |
|---|
| 148 | buser_input_event *event, /* [out,size_is(nevents)] event from the user */ |
|---|
| 149 | unsigned nevents, /* number of entries in the event array */ |
|---|
| 150 | unsigned *result_nevents /* [out] number of entries read */ |
|---|
| 151 | ); |
|---|
| 152 | |
|---|
| 153 | /* End of user input API */ |
|---|
| 154 | |
|---|
| 155 | /* User Output API */ |
|---|
| 156 | |
|---|
| 157 | /* |
|---|
| 158 | Summary: |
|---|
| 159 | Open a user output object for setting LEDS. |
|---|
| 160 | */ |
|---|
| 161 | buser_output_t buser_output_open( |
|---|
| 162 | bobject_t user_output_id /* user output object id */ |
|---|
| 163 | ); |
|---|
| 164 | |
|---|
| 165 | /* |
|---|
| 166 | Summary: |
|---|
| 167 | Close a user output object. |
|---|
| 168 | Description: |
|---|
| 169 | Releases all resources associated with the user output object |
|---|
| 170 | */ |
|---|
| 171 | void buser_output_close( |
|---|
| 172 | buser_output_t uo /* user output object */ |
|---|
| 173 | ); |
|---|
| 174 | |
|---|
| 175 | /* |
|---|
| 176 | Summary: |
|---|
| 177 | Set or clear an LED on the front panel. |
|---|
| 178 | */ |
|---|
| 179 | bresult buser_output_set_led( |
|---|
| 180 | buser_output_t ui, /* user output object */ |
|---|
| 181 | unsigned led, /* LED to control. The meaning of this number varies |
|---|
| 182 | for each platform and can change meaning depending on |
|---|
| 183 | how the outside box is labelled and the color of |
|---|
| 184 | the LED. */ |
|---|
| 185 | bool on /* If true, the light is on. Otherwise the light is off. */ |
|---|
| 186 | ); |
|---|
| 187 | |
|---|
| 188 | /* |
|---|
| 189 | Summary: |
|---|
| 190 | Write a message to the seven-segment LED digital display. |
|---|
| 191 | */ |
|---|
| 192 | bresult buser_output_display_message( |
|---|
| 193 | buser_output_t ui, /* user output object */ |
|---|
| 194 | const char *message /* Message to be written. The number of characters |
|---|
| 195 | that can be displayed depends on the platform. |
|---|
| 196 | The message is always left-aligned and truncated |
|---|
| 197 | if needed. */ |
|---|
| 198 | ); |
|---|
| 199 | |
|---|
| 200 | /* End of user output API */ |
|---|
| 201 | |
|---|
| 202 | /* The following Public functions and structures have been added for XMP Support */ |
|---|
| 203 | /** |
|---|
| 204 | Summary: |
|---|
| 205 | Settings to control the XMP2. |
|---|
| 206 | **/ |
|---|
| 207 | typedef struct buser_input_xmp_settings{ |
|---|
| 208 | bsettop_callback xmp_data_ready_callback; /* The callback is called whenever |
|---|
| 209 | data becomes available. */ |
|---|
| 210 | void *callback_context; /* User defined context which is passed into the above callback. */ |
|---|
| 211 | uint32_t xmp1_owner; /* owner code for the XMP1 protocol.*/ |
|---|
| 212 | uint32_t xmp1_registry; /* 32 bit registry code for the XMP1 protocol.*/ |
|---|
| 213 | uint32_t xmp2_owner; /* owner code for the XMP2 protocol */ |
|---|
| 214 | uint32_t xmp2_tag; /* tag for the XMP2 protocol */ |
|---|
| 215 | uint32_t xmp2_remote_registry; /* 32 bit remote registry code for the XMP2 protocol */ |
|---|
| 216 | uint32_t xmp2_transceiver_registry; /* 32 bit transciever registry code for the XMP2 protocol */ |
|---|
| 217 | bool xmp2remote; /* This indicates whether XMP2 operation is used or not. */ |
|---|
| 218 | }buser_input_xmp_settings; |
|---|
| 219 | |
|---|
| 220 | /** |
|---|
| 221 | Summary: |
|---|
| 222 | Status of an XMP2 device. |
|---|
| 223 | *status and previous_ack are always 8 bit* |
|---|
| 224 | **/ |
|---|
| 225 | typedef struct buser_input_xmp_status{ |
|---|
| 226 | uint8_t status; /* 8 bit ack/nak from the remote->STB and viceversa */ |
|---|
| 227 | uint32_t response;/* 32 bit data received from the Remote */ |
|---|
| 228 | uint8_t previous_ack; /* 8 bit to hold the previous ack */ |
|---|
| 229 | unsigned data_counter; /* counter to serve no: of bytes received */ |
|---|
| 230 | bool xmp_response_event_registered; /* bool for setting up various events */ |
|---|
| 231 | }buser_input_xmp_status; |
|---|
| 232 | |
|---|
| 233 | /** |
|---|
| 234 | Summary: |
|---|
| 235 | Set new XMP2 settings for a buser_input_xmp_t handle. |
|---|
| 236 | **/ |
|---|
| 237 | |
|---|
| 238 | void buser_input_set_xmp_settings( |
|---|
| 239 | buser_input_t ui, |
|---|
| 240 | const buser_input_xmp_settings *settings); |
|---|
| 241 | |
|---|
| 242 | /** |
|---|
| 243 | Summary: |
|---|
| 244 | Get the current XMP2 settings from a buser_input_xmp_t handle. |
|---|
| 245 | Description: |
|---|
| 246 | This can be called after buser_xmp_input_open to obtain the initial settings. |
|---|
| 247 | **/ |
|---|
| 248 | |
|---|
| 249 | void buser_input_get_xmp_settings( |
|---|
| 250 | buser_input_t ui, |
|---|
| 251 | buser_input_xmp_settings *settings); |
|---|
| 252 | |
|---|
| 253 | /** Summary |
|---|
| 254 | This function is called by the application for sending the bytes from the STB to the remote. |
|---|
| 255 | Input: Remote Handle, Pointer to input buffer, input size, |
|---|
| 256 | Output: Pointer to output buffer, Output size |
|---|
| 257 | Return: success or external error |
|---|
| 258 | input_buffer always holds 1 byte data. |
|---|
| 259 | **/ |
|---|
| 260 | bresult buser_input_send_xmp( |
|---|
| 261 | buser_input_t remote, |
|---|
| 262 | const uint8_t *input_buffer, /* [out,size_is(length)] */ |
|---|
| 263 | size_t length |
|---|
| 264 | ); |
|---|
| 265 | |
|---|
| 266 | /** Summary |
|---|
| 267 | * This function is called by the application for receiving the |
|---|
| 268 | * bytes from the remote. |
|---|
| 269 | * Input: Remote Handle, Output: Returns the output data 1 at a |
|---|
| 270 | * time |
|---|
| 271 | * length is Max output buffer size |
|---|
| 272 | * output_size is max number of output bytes received |
|---|
| 273 | * data_packet is the 32 bit data received from the remote |
|---|
| 274 | * output_data always holds 1 byte data |
|---|
| 275 | * |
|---|
| 276 | **/ |
|---|
| 277 | |
|---|
| 278 | bresult buser_input_receive_xmp( |
|---|
| 279 | buser_input_t remote, |
|---|
| 280 | uint8_t *output_data, /* [out,size_is(length)] */ |
|---|
| 281 | size_t length, |
|---|
| 282 | unsigned *output_size, |
|---|
| 283 | uint32_t *data_packet |
|---|
| 284 | ); |
|---|
| 285 | |
|---|
| 286 | /* End of XMP Support */ |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | #ifdef __cplusplus |
|---|
| 290 | } |
|---|
| 291 | #endif |
|---|
| 292 | |
|---|
| 293 | |
|---|
| 294 | #endif /* BSETTOP_USER_IO_H__ */ |
|---|
| 295 | |
|---|