source: svn/newcon3bcm2_21bu/BSEAV/api/src/nexus/bsettop_user_io.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 20.9 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2010, 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.c $
11 * $brcm_Revision: 19 $
12 * $brcm_Date: 4/28/10 7:07p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/api/src/nexus/bsettop_user_io.c $
19 *
20 * 19   4/28/10 7:07p mward
21 * SW7125-33: Initially clear LEDs on  BCM97019, and disable
22 * buser_output_display_message() on that platform.
23 *
24 * 18   8/19/09 11:51a jrubio
25 * PR55232: disable LED's 7340/7342
26 *
27 * 17   3/25/09 2:39p katrep
28 * PR53577: New 97466 board uses IR1 on GPIP 23
29 *
30 * 16   3/9/09 7:20p mward
31 * PR52468: Setup ui->event before opening input device, otherwise, an
32 * event from device may occur before it is ready.
33 *
34 * 15   3/4/09 7:47p jgarrett
35 * PR 52269: Adding XMP support
36 *
37 * 14   2/4/09 10:23a jrubio
38 * PR51629: add 7336 support
39 *
40 * Trinity_Xmp_Support/4   2/24/09 10:55a prasadv
41 * complete XMP support now in bsettop_user_io.
42 *
43 * Trinity_Xmp_Support/3   2/18/09 3:52p prasadv
44 * Added dummy functions for XMP. cleaned up the code.
45 *
46 * Trinity_Xmp_Support/2   2/6/09 5:08p prasadv
47 * Separate Macros for XMP1 and XMP2. removed redundancy.
48 *
49 * Trinity_Xmp_Support/1   1/28/09 8:02p prasadv
50 * Adding XMP support. Maintaining under trinity support.
51 *
52 * 13   6/11/08 5:57p jgarrett
53 * PR 43489: Removing LED write errors for 3548/3556
54 *
55 * 12   5/23/08 11:41a jrubio
56 * PR42353: add 7335 support
57 *
58 * 11   4/11/08 11:17a erickson
59 * PR36068: fix non-uhf warnings
60 *
61 * 10   4/3/08 5:42p jgarrett
62 * PR 41312: Setting callback events
63 *
64 * 9   3/27/08 5:31p jrubio
65 * PR40919: add uhf support for both DirecTV and Echo
66 *
67 * 8   3/19/08 1:23p erickson
68 * PR36068: impl UhfInput mapping
69 *
70 * 7   3/19/08 1:15p erickson
71 * PR36068: implement Keypad
72 *
73 * 6   3/11/08 2:09p erickson
74 * PR36068: eliminate Led_WriteString error for 3563
75 *
76 * 5   2/26/08 1:54p erickson
77 * PR36068: fix additional IR inputs, impl user_output
78 *
79 * 4   12/12/07 9:06a erickson
80 * PR36068: wrap with UHF/KEYPAD_SUPPORT macros
81 *
82 * 3   12/5/07 4:09p erickson
83 * PR36068: add ir_input
84 *
85 * 2   10/16/07 12:35p erickson
86 * PR36068: brutus up over settop api/nexus
87 *
88 ***************************************************************************/
89#include "bsettop_impl.h"
90#include "nexus_ir_input.h"
91#include "nexus_led.h"
92#if NEXUS_HAS_UHF_INPUT
93#include "nexus_uhf_input.h"
94#endif
95#if NEXUS_HAS_KEYPAD
96#include "nexus_keypad.h"
97#endif
98
99#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
100static buser_input_xmp_t buser_xmp_input_open(void);
101static void buser_xmp_input_close(buser_input_xmp_t ui_xmp);
102
103static void buser_xmp_GetDefaultStatus(buser_input_xmp_status *pStatus);
104static void buser_xmp_GetDefaultSettings(buser_input_xmp_settings *pSettings);
105#endif /* Functions common to XMP1 and XMP2 Operation */
106
107#ifdef XMP2_SUPPORT
108static void bxmp_p_callback(void *context, int param);
109static void xmp_event_callback(void *pParam1);
110static bresult is_xmp2_operation(buser_input_xmp_t ui_xmp);
111#endif /* Functions only for XMP2 Operation */
112
113BDBG_MODULE(user_io);
114
115struct buser_input {
116    NEXUS_IrInputHandle nIrInput;
117#if NEXUS_HAS_UHF_INPUT
118    NEXUS_UhfInputHandle nUhfInput;
119    uint8_t index;
120    bool used;
121#endif
122#if NEXUS_HAS_KEYPAD
123    NEXUS_KeypadHandle nKeypad;
124#endif
125    buser_input_settings settings;
126    B_EventHandle event;
127    b_event_id_t eventId;
128#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
129    void *xmp_private;          /* For storing the XMP remote handle */
130    bool xmp_remote;            /* XMP remote used or not */
131#endif
132};
133
134#if NEXUS_HAS_UHF_INPUT
135buser_input_t g_uhfInputs[NEXUS_NUM_UHF_INPUTS];
136#endif
137
138struct buser_output {
139    NEXUS_LedHandle led;
140};
141
142static void buser_input_p_callback_handler(void *context);
143#if NEXUS_HAS_UHF_INPUT
144static void buser_uhf_close(buser_input_t ui);
145#endif
146
147static bresult buser_input_p_setup_event(buser_input_t ui)
148{
149    BDBG_ASSERT(NULL != ui);
150    ui->event = B_Event_Create(NULL);
151    if ( NULL == ui->event )
152    {
153        return BSETTOP_ERROR(berr_external_error);
154    }
155    ui->eventId = b_event_register(ui->event, buser_input_p_callback_handler, ui);
156    if ( NULL == ui->eventId )
157    {
158        B_Event_Destroy(ui->event);
159        ui->event = NULL;
160        return BSETTOP_ERROR(berr_external_error);
161    }
162    return b_ok;
163}
164
165static void buser_input_p_cleanup_event(buser_input_t ui)
166{
167    BDBG_ASSERT(NULL != ui);
168    if ( NULL != ui->eventId )
169    {
170        b_event_unregister(ui->eventId);
171        ui->eventId = NULL;
172    }
173    if ( NULL != ui->event )
174    {
175        B_Event_Destroy(ui->event);
176        ui->event = NULL;
177    }
178}
179
180static void buser_input_p_callback(void *context, int param)
181{
182    buser_input_t ui = (buser_input_t)context;
183#ifdef XMP2_SUPPORT
184    NEXUS_Error rc;
185    bresult xmp2_remote = berr_not_supported;
186    NEXUS_IrInputEvent irEvent;
187    bool overflow;
188    unsigned num;
189    buser_input_event *data;
190    if(ui->xmp_remote){
191        xmp2_remote = is_xmp2_operation(ui->xmp_private);/* If xmp2 remote needs to be used */
192        if(xmp2_remote == b_ok){
193            if (ui->nIrInput) {
194                    rc = NEXUS_IrInput_GetEvents(ui->nIrInput, &irEvent, 1, &num, &overflow);
195                    if (rc){
196                        BDBG_ERR(("Unable to Get Events from IR"));
197                    }
198                    data->code = irEvent.code;
199                    bsettop_p_userio_xmp(ui->xmp_private, &(data->code));
200            }
201        }
202    }
203#endif
204    BSTD_UNUSED(param);
205    B_Event_Set(ui->event);
206}
207
208static void buser_input_p_callback_handler(void *context)
209{
210    buser_input_t ui = (buser_input_t)context;
211    if (ui->settings.data_ready_callback) {
212        b_unlock();
213        (*ui->settings.data_ready_callback)(ui->settings.callback_context);
214        b_lock();
215    }
216}
217
218
219#if NEXUS_HAS_UHF_INPUT
220static buser_input_t buser_uhf_open(unsigned index)
221{
222     NEXUS_UhfInputSettings uhfSettings;
223     NEXUS_Error rc = 0;
224     int i =0;
225     bool error = true;
226     bresult result;
227
228     NEXUS_UhfInput_GetDefaultSettings(&uhfSettings);
229     uhfSettings.dataReady.callback = buser_input_p_callback;
230
231     /* Look for Free UHF input */
232     for(i=0;i<NEXUS_NUM_UHF_INPUTS;i++)
233     {
234         if( !g_uhfInputs[i]->used)
235         {
236             uhfSettings.dataReady.context = g_uhfInputs[i];
237             g_uhfInputs[i]->used= true;
238             error = false;
239             break;
240         }
241     }
242
243     if(error)
244     {
245         BDBG_ERR((" No more UHF channels to allocate"));
246         rc = BERR_TRACE(NEXUS_UNKNOWN);
247         return NULL;
248     }
249
250    /* Pick the Mode of Operation for this Channel */
251    if (index == 5)
252     uhfSettings.channel = NEXUS_UhfInputMode_eChannel9;
253    else
254        uhfSettings.channel = NEXUS_UhfInputMode_eChannel1;
255
256    result = buser_input_p_setup_event(g_uhfInputs[i]);
257    if ( result )
258    {
259        BSETTOP_ERROR(rc);
260        return NULL;
261    }
262
263    g_uhfInputs[i]->nUhfInput = NEXUS_UhfInput_Open(g_uhfInputs[i]->index, &uhfSettings);
264    if (!g_uhfInputs[i]->nUhfInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
265
266
267    return g_uhfInputs[i];
268
269}
270
271static void buser_uhf_close(buser_input_t ui)
272{
273    buser_input_p_cleanup_event(ui);
274
275    if(ui->used)
276        NEXUS_UhfInput_Close(ui->nUhfInput);
277
278   ui->used=false;
279   ui->nUhfInput = NULL;
280
281}
282#endif
283
284void buserio_p_init()
285{
286
287#if NEXUS_HAS_UHF_INPUT
288    int i;
289    for(i =0; i<NEXUS_NUM_UHF_INPUTS; i++)
290    {
291        g_uhfInputs[i] = BKNI_Malloc(sizeof(*g_uhfInputs[i]));
292        BKNI_Memset(g_uhfInputs[i], 0, sizeof(*g_uhfInputs[i]));
293        g_uhfInputs[i]->index = i;
294    }
295#endif
296
297}
298
299void buserio_p_uninit()
300{
301
302#if NEXUS_HAS_UHF_INPUT
303    int i;
304    for(i =0; i<NEXUS_NUM_UHF_INPUTS; i++)
305    {
306        if(g_uhfInputs[i]->used)
307            buser_uhf_close(g_uhfInputs[i]);
308
309        BKNI_Free(g_uhfInputs[i]);
310        g_uhfInputs[i] = NULL;
311    }
312#endif
313
314}
315
316
317buser_input_t buser_input_open(bobject_t user_input_id)
318{
319    unsigned index = B_ID_GET_INDEX(user_input_id);
320    buser_input_t ui = NULL;
321    NEXUS_Error rc = 0;
322    NEXUS_IrInputSettings irInputSettings;
323
324
325#if NEXUS_HAS_UHF_INPUT
326    if(index == 5 || index ==6)
327         return buser_uhf_open(index);
328#endif
329
330    ui = BKNI_Malloc(sizeof(*ui));
331    BKNI_Memset(ui, 0, sizeof(*ui));
332#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
333    ui->xmp_remote = false; 
334#endif
335    NEXUS_IrInput_GetDefaultSettings(&irInputSettings);
336    irInputSettings.dataReady.callback = buser_input_p_callback;
337    irInputSettings.dataReady.context = ui;
338#if BCM_BOARD == 97466
339    irInputSettings.channel_number=1;
340#endif
341    rc = buser_input_p_setup_event(ui);
342    if ( rc )
343    {
344        BSETTOP_ERROR(rc);
345        return NULL;
346    }
347
348    /* This index mapping is carried over from previous settop api impl's. */
349    switch (index) {
350    case 0:
351        irInputSettings.mode = NEXUS_IrInputMode_eRemoteA;
352        ui->nIrInput = NEXUS_IrInput_Open(0, &irInputSettings);
353        if (!ui->nIrInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
354        break;
355    case 1:
356        irInputSettings.mode = NEXUS_IrInputMode_eRemoteB;
357        ui->nIrInput = NEXUS_IrInput_Open(1, &irInputSettings);
358        if (!ui->nIrInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
359        break;
360    case 2:
361        irInputSettings.mode = NEXUS_IrInputMode_eSejin56KhzKbd;
362        ui->nIrInput = NEXUS_IrInput_Open(2, &irInputSettings);
363        if (!ui->nIrInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
364        break;
365#if NEXUS_HAS_KEYPAD
366    case 3:
367        {
368            NEXUS_KeypadSettings keypadSettings;
369            NEXUS_Keypad_GetDefaultSettings(&keypadSettings);
370            keypadSettings.dataReady.callback = buser_input_p_callback;
371            keypadSettings.dataReady.context = ui;
372            ui->nKeypad = NEXUS_Keypad_Open(0, &keypadSettings);
373            if (!ui->nKeypad) rc = BERR_TRACE(NEXUS_UNKNOWN);
374        }
375        break;
376#endif
377    case 4:
378        irInputSettings.mode = NEXUS_IrInputMode_eCirEchoStar;
379        ui->nIrInput = NEXUS_IrInput_Open(0, &irInputSettings);
380        if (!ui->nIrInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
381        break;
382    case 7:
383#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
384        ui->xmp_remote = true;
385        ui->xmp_private = buser_xmp_input_open(); 
386#endif
387        irInputSettings.mode = NEXUS_IrInputMode_eCirXmp;
388        ui->nIrInput = NEXUS_IrInput_Open(0, &irInputSettings);
389        if (!ui->nIrInput) rc = BERR_TRACE(NEXUS_UNKNOWN);
390        break;
391    default:
392        break;
393    }
394    if (rc) {
395        BKNI_Free(ui);
396        return NULL;
397    }
398
399    return ui;
400}
401
402void buser_input_close(buser_input_t ui)
403{
404    if (ui->nIrInput) {
405        NEXUS_IrInput_Close(ui->nIrInput);
406    }
407#if NEXUS_HAS_KEYPAD
408    if (ui->nKeypad) {
409        NEXUS_Keypad_Close(ui->nKeypad);
410    }
411#endif
412#if NEXUS_HAS_UHF_INPUT
413    if (ui->nUhfInput) {
414        buser_uhf_close(ui);
415        return;
416    }
417#endif
418#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
419    if(ui->xmp_remote) {
420        buser_xmp_input_close(ui->xmp_private);
421    }
422#endif
423    buser_input_p_cleanup_event(ui);
424
425     BKNI_Free(ui);
426}
427
428
429void buser_input_get_settings(buser_input_t ui, buser_input_settings *settings)
430{
431    *settings = ui->settings;
432}
433
434void buser_input_set_settings(buser_input_t ui, const buser_input_settings *settings)
435{
436    ui->settings = *settings;
437}
438
439bresult buser_input_get_event(buser_input_t ui, buser_input_event *event, unsigned nevents, unsigned *result_nevents)
440{
441    *result_nevents = 0;
442   
443    if (ui->nIrInput) {
444        while (nevents) {
445            NEXUS_Error rc;
446            NEXUS_IrInputEvent irEvent;
447            bool overflow;
448            unsigned num;
449
450            rc = NEXUS_IrInput_GetEvents(ui->nIrInput, &irEvent, 1, &num, &overflow);
451            if (rc) return BERR_TRACE(rc);
452
453            if (!num) break;
454            BDBG_ASSERT(num == 1);
455#ifdef XMP1_SUPPORT
456            if(ui->xmp_remote)
457                event[*result_nevents].code = irEvent.code | (irEvent.repeat?0x00FF0000:0);
458            else
459#endif
460            event[*result_nevents].code = irEvent.code | (irEvent.repeat?0x80000000:0);
461
462            (*result_nevents)++;
463            nevents--;
464        }
465    }
466#if NEXUS_HAS_KEYPAD
467    else if (ui->nKeypad) {
468        while (nevents) {
469            NEXUS_Error rc;
470            NEXUS_KeypadEvent keypadEvent;
471            bool overflow;
472            unsigned num;
473
474            rc = NEXUS_Keypad_GetEvents(ui->nKeypad, &keypadEvent, 1, &num, &overflow);
475            if (rc) return BERR_TRACE(rc);
476
477            if (!num) break;
478            BDBG_ASSERT(num == 1);
479
480            event[*result_nevents].code = keypadEvent.code | (keypadEvent.repeat?0x80000000:0);
481            (*result_nevents)++;
482            nevents--;
483        }
484    }
485#endif
486#if NEXUS_HAS_UHF_INPUT
487    else if (ui->nUhfInput) {
488        while (nevents) {
489            NEXUS_Error rc;
490            NEXUS_UhfInputEvent uhfInputEvent;
491            bool overflow;
492            unsigned num;
493
494            rc = NEXUS_UhfInput_GetEvents(ui->nUhfInput, &uhfInputEvent, 1, &num, &overflow);
495            if (rc) return BERR_TRACE(rc);
496
497            if (!num) break;
498            BDBG_ASSERT(num == 1);
499
500            event[*result_nevents].code = uhfInputEvent.code | (uhfInputEvent.repeat?0x80000000:0);
501            (*result_nevents)++;
502            nevents--;
503        }
504    }
505#endif
506
507    return 0;
508}
509
510buser_output_t buser_output_open(bobject_t user_output_id)
511{
512    buser_output_t uo = BKNI_Malloc(sizeof(*uo));
513    uo->led = NEXUS_Led_Open(B_ID_GET_INDEX(user_output_id), NULL);
514        #if NEXUS_PLATFORM==97019
515    (void)NEXUS_Led_WriteString(uo->led, "    ", 0);
516        #endif
517    return uo;
518}
519
520void buser_output_close(buser_output_t uo)
521{
522    NEXUS_Led_Close(uo->led);
523    BKNI_Free(uo);
524}
525
526bresult buser_output_set_led(buser_output_t uo, unsigned led, bool on)
527{
528    return NEXUS_Led_SetLedState(uo->led, led, on);
529}
530
531bresult buser_output_display_message(buser_output_t uo, const char *message)
532{
533#if BCHP_CHIP == 3563 || BCHP_CHIP == 7335  || BCHP_CHIP ==7336 || BCHP_CHIP == 7325 || BCHP_CHIP == 3548 || BCHP_CHIP == 3556 || \
534    BCHP_CHIP==7342 || BCHP_CHIP==7340  || NEXUS_PLATFORM==97019
535    /* allow it to fail silently */
536    BSTD_UNUSED(uo);
537    BSTD_UNUSED(message);
538    return 0;
539#else
540    return NEXUS_Led_WriteString(uo->led, message, 0);
541#endif
542}
543
544#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
545/**  Summary
546    This function gets default settings for the structure.
547 **/
548static void buser_xmp_GetDefaultSettings(buser_input_xmp_settings *pSettings)
549{
550    BKNI_Memset(pSettings, 0, sizeof(*pSettings));
551    pSettings->callback_context = NULL;
552    pSettings->xmp_data_ready_callback = NULL;
553    pSettings->xmp1_owner = 0;
554    pSettings->xmp1_registry = 0;
555    pSettings->xmp2_owner = 0;
556    pSettings->xmp2_remote_registry = 0;
557    pSettings->xmp2_tag = 0;
558    pSettings->xmp2_transceiver_registry = 0;
559    pSettings->xmp2remote = false;
560}
561
562/**  Summary
563    This function gets default status for the structure.
564 **/
565static void buser_xmp_GetDefaultStatus(buser_input_xmp_status *pStatus)
566{
567    BKNI_Memset(pStatus, 0, sizeof(*pStatus));
568    pStatus->data_counter = 0;
569    pStatus->previous_ack = 0;
570    pStatus->response = 0;
571    pStatus->status = 0;
572    pStatus->xmp_response_event_registered = false;
573}
574
575/*
576Summary:
577    Open a user input object for receiving IR remote.
578*/
579static buser_input_xmp_t buser_xmp_input_open(void)  {
580    buser_input_xmp_t ui_xmp=NULL;
581
582    ui_xmp = BKNI_Malloc(sizeof(*ui_xmp));
583    BKNI_Memset(ui_xmp, 0, sizeof(*ui_xmp));
584
585    buser_xmp_GetDefaultSettings(&ui_xmp->xmp_settings);
586    buser_xmp_GetDefaultStatus(&ui_xmp->xmp_status);
587
588#ifdef XMP2_SUPPORT
589        NEXUS_IrBlasterSettings pSettings;
590        NEXUS_IrBlaster_GetDefaultSettings(&pSettings);
591        pSettings.mode = NEXUS_IrBlasterMode_eXmp2;
592        pSettings.transmitComplete.callback = bxmp_p_callback;
593        pSettings.transmitComplete.context = ui_xmp;
594        ui_xmp->irBlaster = NEXUS_IrBlaster_Open(0, &pSettings); 
595
596        ui_xmp->xmp_response_event = B_Event_Create(NULL);
597        ui_xmp->xmp_status_event = B_Event_Create(NULL);
598        ui_xmp->irb_event = B_Event_Create(NULL);
599#endif
600    return ui_xmp;
601}
602
603
604/**
605Summary:
606Get the current XMP2 settings from a buser_input_xmp_t handle.
607Description:
608This can be called after buser_xmp_input_open to obtain the initial settings.
609**/
610
611void buser_input_get_xmp_settings(
612    buser_input_t ui, 
613    buser_input_xmp_settings *settings)
614{
615    buser_input_xmp_t ui_xmp;
616    ui_xmp = ui->xmp_private;
617    *settings = ui_xmp->xmp_settings;
618}
619
620/**
621Summary:
622Set new XMP2 settings for a buser_input_xmp_t handle.
623**/
624void buser_input_set_xmp_settings(
625    buser_input_t ui,
626    const buser_input_xmp_settings *settings)
627{
628    buser_input_xmp_t ui_xmp;
629    ui_xmp = ui->xmp_private;
630    ui_xmp->xmp_settings = *settings;
631#ifdef XMP2_SUPPORT
632    if (settings->xmp_data_ready_callback) {
633        if (ui_xmp->xmp_status.xmp_response_event_registered) {
634            b_event_unregister(ui_xmp->xmp_response_event_id);
635        }
636        ui_xmp->xmp_response_event_id = b_event_register(ui_xmp->xmp_response_event,
637            (b_event_callback_t)xmp_event_callback, ui_xmp);
638        ui_xmp->xmp_status.xmp_response_event_registered = true;
639    }
640#endif
641}
642
643/*
644Summary:
645    Close a user xmp input handle.
646Description:
647    Releases all resources associated with the user xmp input object
648*/
649static void buser_xmp_input_close(buser_input_xmp_t ui_xmp)  {
650#ifdef XMP2_SUPPORT
651    if (ui_xmp->xmp_status.xmp_response_event_registered) {
652        b_event_unregister(ui_xmp->xmp_response_event_id);
653        ui_xmp->xmp_status.xmp_response_event_registered = false;
654    }
655    B_Event_Destroy(ui_xmp->xmp_response_event);
656    ui_xmp->xmp_response_event = NULL;
657    B_Event_Destroy(ui_xmp->xmp_status_event);
658    ui_xmp->xmp_status_event = NULL;
659    B_Event_Destroy(ui_xmp->irb_event);
660    ui_xmp->irb_event = NULL;
661#endif
662    BKNI_Free(ui_xmp);
663}
664#else
665void buser_input_get_xmp_settings(
666    buser_input_t ui, 
667    buser_input_xmp_settings *settings)
668{
669    BSTD_UNUSED(ui);
670    BSTD_UNUSED(settings);
671}
672
673void buser_input_set_xmp_settings(
674    buser_input_t ui,
675    const buser_input_xmp_settings *settings)
676{
677    BSTD_UNUSED(ui);
678    BSTD_UNUSED(settings);
679}
680#endif /* XMP1 and XMP2 Operation common */
681
682
683#ifdef XMP2_SUPPORT
684/**  Summary
685    Callback registered when the response from the remote is got
686**/
687static void xmp_event_callback(void *pParam1)
688{
689    buser_input_xmp_t ui_xmp = (buser_input_xmp_t)pParam1;
690    b_unlock();
691    if (ui_xmp->xmp_settings.xmp_data_ready_callback) {
692        (*ui_xmp->xmp_settings.xmp_data_ready_callback)(ui_xmp->xmp_settings.callback_context);
693    }
694    b_lock();
695}
696
697/**  Summary
698*   For setting the irb event when data is sent by the ir
699*   blaster
700**/
701
702static void bxmp_p_callback(void *context, int param)
703{
704    BSTD_UNUSED(param);
705    buser_input_xmp_t ui_xmp = (buser_input_xmp_t)context;
706    B_Event_Set(ui_xmp->irb_event);
707}
708
709/*
710Summary:
711    Check if XMP2 Operation is used or not.
712*/
713
714static bresult is_xmp2_operation(buser_input_xmp_t ui_xmp)
715{
716    if(ui_xmp->xmp_settings.xmp2remote)
717        return b_ok;
718    else
719        return berr_not_supported;
720}
721
722/* Summary
723   wrapper for receiving XMP data from the remote.
724
725   This functions receives the XMP data from the remote.
726   The data can be register packet, data packet, response packet
727   This is a 4 byte data. The ISR sets an event and this function wakes up.
728   Input: remote handle, pointer to output buffer
729   Output: Returns the four bytes of Output data at a time.
730   *output_data is always 8 bit*
731
732 */
733bresult buser_input_receive_xmp(buser_input_t remote_ui,  uint8_t *output_data, 
734                                size_t length, unsigned *output_size, uint32_t *data_packet_output)
735{
736    buser_input_xmp_t remote;
737    remote = remote_ui->xmp_private;
738    return buser_input_p_receive_xmp(remote, output_data, length, output_size, data_packet_output);
739}
740
741
742/*  Summary
743    wrapper for sending XMP data to the remote.
744    This function is called by the application for sending the bytes from the STB to the remote.
745    Input: Remote Handle, Pointer to input buffer, input size,
746    Return: success or external error
747 */
748
749bresult buser_input_send_xmp(buser_input_t remote_ui, const uint8_t *input_buffer, size_t length) 
750{
751    buser_input_xmp_t remote;
752    remote = remote_ui->xmp_private;
753    return buser_input_p_send_xmp(remote, input_buffer, length);
754}
755#else
756
757bresult buser_input_receive_xmp(buser_input_t remote_ui,  uint8_t *output_data, 
758                                size_t length, unsigned *output_size, uint32_t *data_packet_output)
759{
760    BSTD_UNUSED(remote_ui);
761    BSTD_UNUSED(output_data);
762    BSTD_UNUSED(length);
763    BSTD_UNUSED(output_size);
764    BSTD_UNUSED(data_packet_output);
765    return berr_not_supported;
766}
767
768
769bresult buser_input_send_xmp(buser_input_t remote_ui, const uint8_t *input_buffer, size_t length) 
770{
771    BSTD_UNUSED(remote_ui);
772    BSTD_UNUSED(input_buffer);
773    BSTD_UNUSED(length);
774    return berr_not_supported;
775}
776
777#endif /* XMP2 operation specific */
Note: See TracBrowser for help on using the repository browser.