source: svn/newcon3bcm2_21bu/magnum/portinginterface/kir/7552/bkir.h @ 45

Last change on this file since 45 was 45, checked in by megakiss, 11 years ago
  • Property svn:executable set to *
File size: 37.0 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2012, 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: bkir.h $
11 * $brcm_Revision: Hydra_Software_Devel/57 $
12 * $brcm_Date: 2/21/12 6:34p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/kir/7405/bkir.h $
19 *
20 * Hydra_Software_Devel/57   2/21/12 6:34p jkim
21 * SW7425-2283: Add API to enable/disable filter1
22 *
23 * Hydra_Software_Devel/56   11/3/11 5:54p mward
24 * SW7435-7:  Add 7435.
25 *
26 * Hydra_Software_Devel/55   10/27/11 2:06p xhuang
27 * SW7552-9: Add 7552 power management support
28 *
29 * Hydra_Software_Devel/54   10/20/11 3:51p bselva
30 * SW7358-169: Added the changes required for power managment support
31 *
32 * Hydra_Software_Devel/53   9/20/11 2:11p jkim
33 * SW7429-10: Add 7429 support
34 *
35 * Hydra_Software_Devel/52   9/20/11 1:37p jkim
36 * SWBLURAY-27433: Add Toshiba IR support
37 *
38 * Hydra_Software_Devel/52   9/20/11 1:35p jkim
39 * SWBLURAY-27433: Add Toshiba IR support
40 *
41 * Hydra_Software_Devel/51   6/22/11 6:10p randyjew
42 * SW7344-14: Enable data filter for 7344/7346
43 *
44 * Hydra_Software_Devel/50   6/9/11 7:02p nickh
45 * SW7425-533: Enable data filter for 7425
46 *
47 * Hydra_Software_Devel/49   6/6/11 5:14p etrudeau
48 * SWBLURAY-24213: identify Quick chip 7630 B2 as having IR Filter support
49 *
50 * Hydra_Software_Devel/48   5/13/11 5:15p gmohile
51 * SW7231-128 : Enable data filter for 7231
52 *
53 * Hydra_Software_Devel/47   4/12/11 5:47p mward
54 * SW7125-905:  Add 7125 to BKIR_HAS_DATA_FILTER.
55 *
56 * Hydra_Software_Devel/46   2/11/11 9:54a mward
57 * SW7125-820:  Enable 2nd KIR on 7125 all revs.
58 *
59 * Hydra_Software_Devel/45   2/11/11 9:21a gmohile
60 * SW7408-210 : Enable data filter for 7420
61 *
62 * Hydra_Software_Devel/44   2/4/11 5:10p mward
63 * SW7125-820:  Enable 2nd KIR on 7125 c0.
64 *
65 * Hydra_Software_Devel/43   1/26/11 2:26p etrudeau
66 * SWBLURAY-23692: add 7640 support
67 *
68 * Hydra_Software_Devel/42   1/20/11 5:36p gmohile
69 * SW7408-1 : define BKIR_HAS_DATA_FILTER for 7408
70 *
71 * Hydra_Software_Devel/41   12/27/10 2:19p xhuang
72 * SW7358-29: Add 7358/7552 support
73 *
74 * Hydra_Software_Devel/40   12/7/10 2:46p jrubio
75 * SW7344-9: add 7346/7344 support
76 *
77 * Hydra_Software_Devel/39   12/2/10 10:31a katrep
78 * SW7231-4:add support for 7231
79 *
80 * Hydra_Software_Devel/38   10/13/10 2:49p jkim
81 * SW7630-98: add support for RCA remote
82 *
83 * Hydra_Software_Devel/37   10/7/10 4:20p nickh
84 * SW7422-74: Add 7422 support
85 *
86 * Hydra_Software_Devel/36   9/14/10 5:46p hongtaoz
87 * SW7425-9: adding 7425 support;
88 *
89 * Hydra_Software_Devel/35   7/23/10 10:49a jkim
90 * SW7550-471: define BKIR_HAS_DATA_FILTER for 7550
91 *
92 * Hydra_Software_Devel/34   6/25/10 11:27a jkim
93 * SW7550-471:Add support for pattern matching and 48 bit data
94 *
95 * Hydra_Software_Devel/33   3/24/10 2:18p jkim
96 * SW7405-4100: make BKIR_KirDevice_eNumKirDevice the highest value
97 *
98 * Hydra_Software_Devel/32   12/13/09 6:41p rpereira
99 * SW7550-41: Fixed compilation issues for 7550
100 *
101 * Hydra_Software_Devel/31   12/1/09 6:16p randyjew
102 * SW7468-6: Add 7468 support
103 *
104 * Hydra_Software_Devel/30   11/23/09 6:33p mward
105 * SW7125-97: Use BKIR_N_CHANNELS 1, no bchp_kbd2.h for 7125b0
106 *
107 * Hydra_Software_Devel/29   11/6/09 4:18p gmohile
108 * SW7408-1 : Add 7408 support
109 *
110 * Hydra_Software_Devel/28   9/24/09 10:43a mward
111 * SW7125-4: Changing BKIR_N_CHANNELS 2 for 7125 after RDB header update
112 * removed both bchp_kbd3.h and bchp_kbd4.h.
113 *
114 * Hydra_Software_Devel/27   9/15/09 10:33a rpereira
115 * SW7630-45: Adding support for 7630
116 *
117 * Hydra_Software_Devel/26   9/1/09 9:22p rpereira
118 * SW7550-30: Adding 7550 support
119 *
120 * Hydra_Software_Devel/25   8/24/09 1:50p jkim
121 * SW7405-340: Add RC6 Mode 0 support
122 *
123 * Hydra_Software_Devel/24   8/20/09 4:23p mward
124 * PR55545: Support 7125.
125 *
126 * Hydra_Software_Devel/23   8/19/09 4:03p mward
127 * PR55545: Support for 7125.
128 *
129 * Hydra_Software_Devel/22   8/10/09 4:09p jrubio
130 * PR55232: add 7342/7340 support
131 *
132 * Hydra_Software_Devel/21   7/27/09 7:05p jkim
133 * PR56525: add a function to set custom device type
134 *
135 * Hydra_Software_Devel/20   7/22/09 3:03p jkim
136 * PR37963: Add functions to check preamble status
137 *
138 * Hydra_Software_Devel/19   7/14/09 6:09p jkim
139 * PR56525: Add API to get default cir paramters so that it can be
140 * modified and copied to cutom cir
141 *
142 * Hydra_Software_Devel/18   4/17/09 11:15a agin
143 * PR54338: Moved BKIR_N_CHANNELS from bkir.c because other files need
144 * this.
145 *
146 * Hydra_Software_Devel/17   2/9/09 8:24p jkim
147 * PR37963: create device type for xmp-2 ack
148 *
149 * Hydra_Software_Devel/16   9/22/08 4:16p jkim
150 * PR37963: add xmp-2 cir param
151 *
152 * Hydra_Software_Devel/15   7/28/08 1:43p jkim
153 * PR45065: add R-step remote support
154 *
155 * Hydra_Software_Devel/14   4/1/08 4:19p brianlee
156 * PR23894: Added functions to register user callback with KIR PI.
157 *
158 * Hydra_Software_Devel/13   4/9/07 4:51p jkim
159 * PR28061: Add RCMM support
160 *
161 * Hydra_Software_Devel/12   11/28/06 6:03p bandrews
162 * PR25664: Changed all c++ comments to C comments
163 *
164 * Hydra_Software_Devel/11   11/28/06 11:40a jkim
165 * PR25664: Added RC6 remote support. Simultaneous support for two remote
166 * should be working but can not be tested using broadcom reference
167 * board.
168 *
169 * Hydra_Software_Devel/10   10/1/05 6:17p jkim
170 * PR14344: Add UHFR legacy support
171 *
172 * Hydra_Software_Devel/9   4/4/05 2:40p agin
173 * PR14558:  Add pointer to array for BKIR_Read function.
174 *
175 * Hydra_Software_Devel/8   2/28/05 2:27p brianlee
176 * PR14284: Add support for UEI RF remote.
177 *
178 * Hydra_Software_Devel/7   3/4/04 5:36p brianlee
179 * PR9958: Added BKIR_KirDevice_eCirCustom type and the function
180 * BKIR_SetCustomCir() to allow user to set custom KIR settings.
181 *
182 * Hydra_Software_Devel/6   10/17/03 10:40a brianlee
183 * Added a function to check for repeat key.
184 *
185 * Hydra_Software_Devel/5   10/2/03 10:40a brianlee
186 * BKIR_Read should output interrupt device type, not IR device type.
187 *
188 * Hydra_Software_Devel/4   9/25/03 11:59a brianlee
189 * Fixed tags for Midas service generator.
190 *
191 * Hydra_Software_Devel/3   9/15/03 10:28a brianlee
192 * Added enums for port and interrupt device.
193 *
194 * Hydra_Software_Devel/2   7/31/03 1:58p brianlee
195 * Removed blocking option from IsDataReady function.  Provide a GetEvent
196 * function so caller can block on the event himself.
197 *
198 * Hydra_Software_Devel/1   7/24/03 4:24p brianlee
199 * Initial version.
200 *
201 ***************************************************************************/
202
203
204/*= Module Overview *********************************************************
205<verbatim>
206
207Overview
208The KIR PI module controls the keyboard/IR receiver core within the BCM7038.
209There are two separate keyboard/IR receivers within the 7038.  Each KIR core
210can support 2 ports, i.e. 2 separate input pins.  There is built-in
211hardware support for several IR devices, such as Sejin, TWIRP, GI Remote A and B.
212In addition, there is a consumer IR decoder that is programmable by the user.
213
214Design
215The design for BKIR PI API is broken into two parts.
216  Part 1 (open/close/configuration):
217    These APIs are used for opening and closing BKIR device/device channel.
218  Part 2 (enable device):
219    These APIs are used to enable a KIR device type.
220  Part 3 (get receiver data):
221    These APIs are used to check for data received, read it, and return it
222    to the caller.
223
224Usage
225The usage of BKIR involves the following:
226   * Configure/Open of BKIR
227      * Configure BKIR device for the target system
228      * Open BKIR device
229      * Configure BKIR device channel for the target system
230      * Open BKIR device channel
231   * Enable device
232      * Enable the IR device type.
233   * Check to see if data is received.
234   * Get the data received.
235
236Sample Code
237void main( void )
238{
239    BKIR_Handle         hKir;
240    BKIR_ChannelHandle  hKirChan;
241    BKIR_ChannelSettings defChnSettings;
242    BREG_Handle         hReg;
243    BCHP_Handle         hChip;
244    BINT_Handle         hInt;
245    bool                readyFlag = 0;
246    uint32_t            data;
247    int                 chanNo;
248    BKIR_KirInterruptDevice interruptDevice;
249
250    // Do other initialization, i.e. for BREG, BCHP, etc
251
252    // Make any changes required from the default values
253    BKIR_Open (&hKir, hChip, hReg, hInt, (BKIR_Settings *)NULL);
254
255    chanNo = 0; //example for channel 0
256    BKIR_GetChannelDefaultSettings( hKir, chanNo, &defChnSettings );
257
258    defChnSettings.irPort = 2;      // using port 2
259
260    BKIR_OpenChannel( hKir, &hKirChan, chanNo, &defChnSettings );
261
262    // Enable TWIRP device
263    BKIR_EnableIrDevice (hKirChan, BKIR_KirDevice_eTwirpKbd);
264
265    interruptDevice = BKIR_KirInterruptDevice_eNone;
266    do
267    {
268        // Using polling
269        BKIR_IsDataReady (hKirChan, &readyFlag);
270        if (readyFlag)
271            BKIR_Read (hKirChan, &interruptDevice, &data);
272    } while (interruptDevice != BKIR_KirInterruptDevice_eTwirpKbd)
273}
274
275</verbatim>
276***************************************************************************/
277
278
279#ifndef BKIR_H__
280#define BKIR_H__
281
282#include "bchp.h"
283#include "breg_mem.h"
284#include "bint.h"
285#include "bkni.h"
286#include "berr_ids.h"
287
288#ifdef __cplusplus
289extern "C" {
290#endif
291
292#if (BCHP_CHIP==3548 || BCHP_CHIP==3556 || BCHP_CHIP==3560 || BCHP_CHIP==3563 || BCHP_CHIP==7440 || BCHP_CHIP==7601 \
293|| BCHP_CHIP==7635 || BCHP_CHIP==7630 || BCHP_CHIP==7468  || BCHP_CHIP==7550 || BCHP_CHIP==7640)
294#define BKIR_N_CHANNELS 1
295#elif (BCHP_CHIP==7118  || BCHP_CHIP==7408 || BCHP_CHIP==7125)
296#define BKIR_N_CHANNELS 2
297#elif (BCHP_CHIP==7038 || BCHP_CHIP==7325 || BCHP_CHIP==7335 || BCHP_CHIP==7401 || BCHP_CHIP==7403 || BCHP_CHIP==7405 || BCHP_CHIP==7420 || BCHP_CHIP==7438 \
298     ||  BCHP_CHIP==7340 || BCHP_CHIP==7342) || BCHP_CHIP==7425 || BCHP_CHIP==7435 || BCHP_CHIP==7429 || BCHP_CHIP==7422 || BCHP_CHIP==7231 || \
299   BCHP_CHIP==7346 || BCHP_CHIP==7344 || BCHP_CHIP==7358 || BCHP_CHIP==7552
300#define BKIR_N_CHANNELS 3
301#elif BCHP_CHIP==7400
302#define BKIR_N_CHANNELS 4
303#else
304#error "Not supported"
305#endif
306
307#if (BCHP_CHIP==7550) || (BCHP_CHIP==7408) || (BCHP_CHIP==7420) || (BCHP_CHIP==7125) || (BCHP_CHIP==7231)  || (BCHP_CHIP==7425)|| (BCHP_CHIP==7429)|| (BCHP_CHIP==7344)|| (BCHP_CHIP==7346) || ((BCHP_CHIP==7630) && (BCHP_VER>=BCHP_VER_B2)) || (BCHP_CHIP==7358) || (BCHP_CHIP==7552)
308#define BKIR_HAS_DATA_FILTER 1
309#endif
310
311/***************************************************************************
312Summary:
313    Error Codes specific to BKIR
314
315Description:
316
317See Also:
318
319****************************************************************************/
320#define BKIR_ERR_NOTAVAIL_CHN_NO            BERR_MAKE_CODE(BERR_KIR_ID, 0)
321
322/***************************************************************************
323Summary:
324    The handles for kir module.
325
326Description:
327    Since BKIR is a device channel, it has main device handle as well
328    as a device channel handle.
329
330See Also:
331    BKIR_Open(), BKIR_OpenChannel()
332
333****************************************************************************/
334typedef struct BKIR_P_Handle                *BKIR_Handle;
335typedef struct BKIR_P_ChannelHandle         *BKIR_ChannelHandle;
336
337/***************************************************************************
338Summary:
339    Enumeration for supported KIR devices
340
341Description:
342    This enumeration defines the devices that the KIR PI supports.
343
344See Also:
345    None.
346
347****************************************************************************/
348typedef enum
349{
350    BKIR_KirDevice_eTwirpKbd = 1,       /* TWIRP */
351    BKIR_KirDevice_eSejin38KhzKbd,      /* Sejin IR keyboard (38.4KHz) */
352    BKIR_KirDevice_eSejin56KhzKbd,      /* Sejin IR keyboard (56.0KHz) */
353    BKIR_KirDevice_eRemoteA,            /* remote A */
354    BKIR_KirDevice_eRemoteB,            /* remote B */
355    BKIR_KirDevice_eCirGI,              /* Consumer GI */
356    BKIR_KirDevice_eCirSaE2050,         /* Consumer SA E2050 */
357    BKIR_KirDevice_eCirTwirp,           /* Consumer Twirp */
358    BKIR_KirDevice_eCirSony,            /* Consumer Sony */
359    BKIR_KirDevice_eCirRecs80,          /* Consumer Rec580 */
360    BKIR_KirDevice_eCirRc5,             /* Consumer Rc5 */
361    BKIR_KirDevice_eCirUei,             /* Consumer UEI */
362    BKIR_KirDevice_eCirRfUei,           /* Consumer RF UEI */
363    BKIR_KirDevice_eCirEchoStar,        /* Consumer EchoRemote */
364    BKIR_KirDevice_eSonySejin,          /* Sony Sejin keyboard using UART D */
365    BKIR_KirDevice_eCirNec,             /* Consumer NEC */
366    BKIR_KirDevice_eCirRC6,             /* Consumer RC6 */
367    BKIR_KirDevice_eCirGISat,           /* Consumer GI Satellite */
368    BKIR_KirDevice_eCirCustom,          /* Customer specific type */
369    BKIR_KirDevice_eCirDirectvUhfr,     /* DIRECTV uhfr */
370    BKIR_KirDevice_eCirEchostarUhfr,    /* Echostar uhfr */
371    BKIR_KirDevice_eCirRcmmRcu,         /* RCMM Remote Control Unit */
372    BKIR_KirDevice_eCirRstep,           /* R-step Remote Control Unit */
373    BKIR_KirDevice_eCirXmp2,            /* XMP-2 4 byte data*/
374    BKIR_KirDevice_eCirXmp2Ack,         /* XMP-2 Ack/Nak*/
375    BKIR_KirDevice_eCirRC6Mode0,        /* Consumer RC6 Mode 0 */
376    BKIR_KirDevice_eCirRca,             /* Consumer RCA */
377    BKIR_KirDevice_eCirToshibaTC9012,   /* Consumer Toshiba */
378    BKIR_KirDevice_eNumKirDevice        /* number of keyboard devices */
379} BKIR_KirDevice;
380
381/***************************************************************************
382Summary:
383    Enumeration for IR device type that generated the interrupt
384
385Description:
386    This enumeration defines the device type that generated the interrupt
387
388See Also:
389    None.
390
391****************************************************************************/
392typedef enum
393{
394    BKIR_KirInterruptDevice_eNone = 0,
395    BKIR_KirInterruptDevice_eTwirpKbd,      /* TWIRP */
396    BKIR_KirInterruptDevice_eSejinKbd,      /* SEJIN */
397    BKIR_KirInterruptDevice_eRemoteA,
398    BKIR_KirInterruptDevice_eRemoteB,
399    BKIR_KirInterruptDevice_eCir
400
401} BKIR_KirInterruptDevice;
402
403/***************************************************************************
404Summary:
405    Enumeration for IR port selection
406
407Description:
408    This enumeration defines the port selection for each IR channel.
409
410See Also:
411    None.
412
413****************************************************************************/
414typedef enum
415{
416    BKIR_KirPort1,
417    BKIR_KirPort2,
418    BKIR_KirPortAuto
419} BKIR_KirPort;
420
421/***************************************************************************
422Summary:
423    Typedef for CIR parameters
424
425Description:
426    This structure typedef is designed for CIR parameters
427
428See Also:
429    None.
430
431****************************************************************************/
432typedef struct tspec {
433    unsigned val;   /* value */
434    unsigned char tol;  /* tolerance select code */
435} tspec;
436
437typedef struct CIR_Param { /* CIR decoder configuration */
438    unsigned countDivisor;  /* count clock divisor */
439    tspec pa[4],        /* preamble A pulse sequence */
440          pb[4];        /* preamble B pulse sequence */
441    unsigned char paCount;  /* number of entries in pa[] */
442    unsigned char pbCount;  /* number of entries in pb[] */
443    int measurePreamblePulse;/* false => even counts specifies pulse off period */
444                /* true => even counts specifies cycle period */
445    int pbRepeat;       /* if true, pb[] matches a repeat sequence */
446    unsigned pulseTol;      /* pulse tolerance */
447    unsigned t0;        /* T0 */
448    unsigned delT;      /* delta T */
449    int fixSymPulseLast;    /* false => fix-width symbol pulse between */
450                    /*   edges 0 & 1 */
451                /* true => fix-width symbol pulse between */
452                /*   edges 1 & 2 */
453    int measureSymPulse;    /* false => measure spacing for complete cycle */
454            /* true => measure spacing between 2 consecutive edges */
455    tspec symPulseWidth;    /* data symbol fix-width pulse period */
456    tspec spacingTol;       /* spacing tolerance value and select code */
457    unsigned nSymA,     /* no. of symbols for sequence with preamble A */
458             nSymB;     /* no. of symbols for sequence with preamble B */
459    unsigned bitsPerSym;    /* no. of data bits per symbol */
460    int mostSignifSymRecvFirst;/* true => most significant symbol received */
461                    /*   first */
462                /* false => least significant symbol received */
463                /*   first */
464    int leftAdjustRecvData; /* true => resulting received data is left */
465                    /* adjusted using '0' to pad LSBs */
466                    /* false => resulting received data is right */
467                    /* adjusted using '0' to pad MSBs */
468    int biphaseCoded;       /* true => the input signal is bi-phase coded */
469                /* false => the input signal is pulse spacing */
470                /*   coded */
471    int twoSymPerCy;        /* two symbols per cycle, 1 or 0 */
472    int chkStopSym;         /* check stop symbol, 1 or 0 */
473    int varLenData;         /* variable length data, 1 or 0. */
474    unsigned timeoutDivisor;    /* time-out clock divisor */
475    unsigned frameTimeout;  /* frame time-out */
476    unsigned edgeTimeout;   /* edge time-out */
477    unsigned faultDeadTime; /* mininmum dead-time after fault */
478    tspec    stop;          /* stop */
479    unsigned dataSymTimeout;    /* data symbol timeout */
480
481    unsigned repeatTimeout;     /* repeat timer timeout */
482    int stopParamUnit;      /* stop parameter unit selector: */
483                    /*  0: stop has count units */
484                    /*  1: stop has timout units */
485    int dataSymClkTickUnit;     /* data symbol timer clock tick and */
486                    /*  dataSymTimeout units selector: */
487                    /*  0: dataSymTimeout has count units */
488                    /*  1: dataSymTimeout has timout units */
489    int ignoreDataSymTimerEdge1;    /* ignore data symbol timer expiration */
490                    /* while waiting for Edge 1; 0 or 1. */
491    int dataSymTimerExpStatEn;  /* enable data symbol time-out */
492                    /*   expiration flag to lflag bit in */
493                    /*   status register */
494    int enHavePreambleAftStop;  /* enable havePreambleAftStop parameter */
495                    /* for non-biphase decoding, 0 or 1 */
496    int havePreambleAftStop;    /* have preamble after stop symbol */
497    int restrictiveDecode;      /* restrictive decoding enabled */
498    int rc6;            /* RC6 encoded. Requires biphaseCoded=1 */
499    int dontValidateMode;       /* don't validate RC6 mode bits */
500    unsigned modeBits;      /* RC6 mode bits (3 bits), typically 6 */
501    int dontValidateTrailer;    /* Reserved: don't validate RC6 trailer: */
502                    /*  0:false, 1:true */
503    unsigned trailer;       /* Reserved: RC6 trailer (1 bit): */
504                    /*  0 for Mode 6A */
505    int dontValidateCustCode;   /* don't validate customer code bits */
506    unsigned custCode;      /* RC6 customer code bits (16 bits) */
507    unsigned nCustCodeBits;     /* number of RC6 customer code bits: */
508    unsigned passModeCustCodePass;
509            /* RC6 mode bits and customer code pass-through control. */
510            /* 0: Exclude mode bits and customer code from */
511            /*    received data. The nccb field determines */
512            /*    the size of the customer code. */
513            /* 1: Exclude mode bits from the received data, but, */
514            /*    include customer code. */
515            /* 2: Not allowed. */
516            /* 3: Include both mode bits and customer code in */
517            /*    the received data. */
518} CIR_Param;
519
520
521/***************************************************************************
522Summary:
523    KIR user callback function
524
525Description:
526    The is the user callback function.  It allows a user to register a
527    callback function with the KIR PI.  When a KIR interrupt happens,
528    this callback function gets called if it's registered.
529
530See Also:
531    BKIR_RegisterCallback(), BKIR_UnregisterCallback()
532
533****************************************************************************/
534typedef BERR_Code (*BKIR_Callback)(BKIR_ChannelHandle hChn, void *pData);
535
536/***************************************************************************
537Summary:
538    Required default settings structure for KIR module.
539
540Description:
541    The default setting structure defines the default configure of
542    KIR when the device is opened.  Since BKIR is a device
543    channel, it also has default settings for a device channel.
544    Currently there are no parameters for device setting.
545
546See Also:
547    BKIR_Open(), BKIR_OpenChannel()
548
549****************************************************************************/
550typedef void *BKIR_Settings;
551
552typedef struct BKIR_ChannelSettings
553{
554    BKIR_KirPort        irPort;         /* IR port */
555    bool                intMode;        /* interrupt enable flag */
556    BKIR_KirDevice      customDevice;   /* device that this custom cir is used for */
557} BKIR_ChannelSettings;
558
559/***************************************************************************
560Summary:
561    This function opens KIR module.
562
563Description:
564    This function is responsible for opening BKIR module. When BKIR is
565    opened, it will create a module handle and configure the module based
566    on the default settings. Once the device is opened, it must be closed
567    before it can be opened again.
568
569Returns:
570    TODO:
571
572See Also:
573    BKIR_Close(), BKIR_OpenChannel(), BKIR_CloseChannel(),
574    BKIR_GetDefaultSettings()
575
576****************************************************************************/
577BERR_Code BKIR_Open(
578    BKIR_Handle *pKIR,                  /* [out] Returns handle */
579    BCHP_Handle hChip,                  /* [in] Chip handle */
580    BREG_Handle hRegister,              /* [in] Register handle */
581    BINT_Handle hInterrupt,             /* [in] Interrupt handle */
582    const BKIR_Settings *pDefSettings   /* [in] Default settings */
583    );
584
585/***************************************************************************
586Summary:
587    This function closes KIR module.
588
589Description:
590    This function is responsible for closing BKIR module. Closing BKIR
591    will free main BKIR handle. It is required that all opened
592    BKIR channels must be closed before calling this function. If this
593    is not done, the results will be unpredicable.
594
595Returns:
596    TODO:
597
598See Also:
599    BKIR_Open(), BKIR_CloseChannel()
600
601****************************************************************************/
602BERR_Code BKIR_Close(
603    BKIR_Handle hDev                    /* [in] Device handle */
604    );
605
606/***************************************************************************
607Summary:
608    This function returns the default settings for KIR module.
609
610Description:
611    This function is responsible for returns the default setting for
612    BKIR module. The returning default setting should be when
613    opening the device.
614
615Returns:
616    TODO:
617
618See Also:
619    BKIR_Open()
620
621****************************************************************************/
622BERR_Code BKIR_GetDefaultSettings(
623    BKIR_Settings *pDefSettings,        /* [out] Returns default setting */
624    BCHP_Handle hChip                   /* [in] Chip handle */
625    );
626
627/***************************************************************************
628Summary:
629    This function returns the total number of channels supported by
630    KIR module.
631
632Description:
633    This function is responsible for getting total number of channels
634    supported by BKIR module, since BKIR device is implemented as a
635    device channel.
636
637Returns:
638    TODO:
639
640See Also:
641    BKIR_OpenChannel(), BKIR_ChannelDefaultSettings()
642
643****************************************************************************/
644BERR_Code BKIR_GetTotalChannels(
645    BKIR_Handle hDev,                   /* [in] Device handle */
646    unsigned int *totalChannels         /* [out] Returns total number downstream channels supported */
647    );
648
649/***************************************************************************
650Summary:
651    This function gets default setting for a KIR module channel.
652
653Description:
654    This function is responsible for returning the default setting for
655    channel of BKIR. The return default setting is used when opening
656    a channel.
657
658Returns:
659    TODO:
660
661See Also:
662    BKIR_OpenChannel()
663
664****************************************************************************/
665BERR_Code BKIR_GetChannelDefaultSettings(
666    BKIR_Handle hDev,                   /* [in] Device handle */
667    unsigned int channelNo,             /* [in] Channel number to default setting for */
668    BKIR_ChannelSettings *pChnDefSettings /* [out] Returns channel default setting */
669    );
670
671/***************************************************************************
672Summary:
673    This function gets default CIR setting for a KIR module channel and specified device.
674
675Description:
676    This function is responsible for returning the default setting for
677    channel of BKIR and the specified device. The return default setting is
678    used when setting custom CIR.
679
680Returns:
681    TODO:
682
683See Also:
684    BKIR_SetCustomCir()
685
686****************************************************************************/
687BERR_Code BKIR_GetDefaultCirParam (
688    BKIR_ChannelHandle  hChn,            /* Device channel handle */
689    BKIR_KirDevice      device,          /* device type to enable */
690    CIR_Param           *pCustomCirParam /* [output] Returns default setting */
691);
692
693/***************************************************************************
694Summary:
695    This function opens KIR module channel.
696
697Description:
698    This function is responsible for opening BKIR module channel. When a
699    BKIR channel is opened, it will create a module channel handle and
700    configure the module based on the channel default settings. Once a
701    channel is opened, it must be closed before it can be opened again.
702
703Returns:
704    TODO:
705
706See Also:
707    BKIR_CloseChannel(), BKIR_GetChannelDefaultSettings()
708
709****************************************************************************/
710BERR_Code BKIR_OpenChannel(
711    BKIR_Handle hDev,                   /* [in] Device handle */
712    BKIR_ChannelHandle *phChn,          /* [out] Returns channel handle */
713    unsigned int channelNo,             /* [in] Channel number to open */
714    const BKIR_ChannelSettings *pChnDefSettings /* [in] Channel default setting */
715    );
716
717/***************************************************************************
718Summary:
719    This function closes KIR module channel.
720
721Description:
722    This function is responsible for closing BKIR module channel. Closing
723    BKIR channel it will free BKIR channel handle. It is required that all
724    opened BKIR channels must be closed before closing BKIR.
725
726Returns:
727    TODO:
728
729See Also:
730    BKIR_OpenChannel(), BKIR_CloseChannel()
731
732****************************************************************************/
733BERR_Code BKIR_CloseChannel(
734    BKIR_ChannelHandle hChn             /* [in] Device channel handle */
735    );
736
737/***************************************************************************
738Summary:
739    This function gets KIR module device handle based on
740    the device channel handle.
741
742Description:
743    This function is responsible returning BKIR module handle based on the
744    BKIR module channel.
745
746Returns:
747    TODO:
748
749See Also:
750
751****************************************************************************/
752BERR_Code BKIR_GetDevice(
753    BKIR_ChannelHandle hChn,            /* [in] Device channel handle */
754    BKIR_Handle *pKIR                   /* [out] Returns Device handle */
755    );
756
757/***************************************************************************
758Summary:
759    This function checks to see if data is received.
760
761Description:
762    This function is used to check to see if data is received by the KIR receiver.
763
764Returns:
765    TODO:
766
767See Also:
768
769
770****************************************************************************/
771BERR_Code BKIR_IsDataReady (
772    BKIR_ChannelHandle  hChn,           /* [in] Device channel handle */
773    bool                *dataReady      /* [out] flag to indicate if data is ready */
774    );
775
776/***************************************************************************
777Summary:
778    This function reads the received KIR data
779
780Description:
781    This function is used to read the data received by the KIR receiver.
782
783Returns:
784    TODO:
785
786See Also:
787
788
789****************************************************************************/
790BERR_Code BKIR_Read(
791    BKIR_ChannelHandle      hChn,           /* [in] Device channel handle */
792    BKIR_KirInterruptDevice *pDevice,       /* [out] pointer to IR device type that generated the key */
793    unsigned char           *data           /* [out] pointer to data received */
794    );
795
796/***************************************************************************
797Summary:
798    This function reads the received KIR data.
799    Intended to be called from ISR.
800
801Description:
802    This function is used to read the data received by the KIR receiver.
803
804Returns:
805    TODO:
806
807See Also:
808
809
810****************************************************************************/
811BERR_Code BKIR_Read_Isr(
812    BKIR_ChannelHandle      hChn,           /* [in] Device channel handle */
813    BKIR_KirInterruptDevice *pDevice,       /* [out] pointer to IR device type that generated the key */
814    unsigned char           *data           /* [out] pointer to data received */
815    );
816
817/***************************************************************************
818Summary:
819    This function checks to see if remote A repeat condition occurs.
820
821Description:
822    This function is used to check if the remote A repeat condition occurs.
823
824Returns:
825    TODO:
826
827See Also:
828
829
830****************************************************************************/
831BERR_Code BKIR_IsRepeated(
832    BKIR_ChannelHandle      hChn,           /* [in] Device channel handle */
833    bool                    *repeatFlag     /* [out] flag to remote A repeat condition */
834    );
835
836/***************************************************************************
837Summary:
838    This function checks to see if preamble A is detected.
839
840Description:
841    This function is used to check if the preamble A is detected.
842
843Returns:
844    TODO:
845
846See Also:
847
848
849****************************************************************************/
850BERR_Code BKIR_IsPreambleA(
851    BKIR_ChannelHandle      hChn,           /* [in] Device channel handle */
852    bool                    *preambleFlag   /* [out] flag for preamble A */
853    );
854
855/***************************************************************************
856Summary:
857    This function checks to see if preamble B is detected.
858
859Description:
860    This function is used to check if the preamble B is detected.
861
862Returns:
863    TODO:
864
865See Also:
866
867
868****************************************************************************/
869BERR_Code BKIR_IsPreambleB(
870    BKIR_ChannelHandle      hChn,           /* [in] Device channel handle */
871    bool                    *preambleFlag   /* [out] flag for preamble B */
872    );
873
874/***************************************************************************
875Summary:
876    This function enables a KIR device.
877
878Description:
879    This function enables a KIR device type.
880
881Returns:
882    TODO:
883
884See Also:
885
886****************************************************************************/
887BERR_Code BKIR_EnableIrDevice (
888    BKIR_ChannelHandle  hChn,           /* [in] Device channel handle */
889    BKIR_KirDevice      device          /* [in] device type to enable */
890    );
891
892/***************************************************************************
893Summary:
894    This function disables a KIR device.
895
896Description:
897    This function disables a KIR device type.
898
899Returns:
900    TODO:
901
902See Also:
903
904****************************************************************************/
905BERR_Code BKIR_DisableIrDevice (
906    BKIR_ChannelHandle  hChn,           /* [in] Device channel handle */
907    BKIR_KirDevice      device          /* [in] device type to disable */
908    );
909
910/***************************************************************************
911Summary:
912    This function enables a data filter.
913
914Description:
915    This function enables a data filter based on the pattern.
916
917Returns:
918    TODO:
919
920See Also:
921
922****************************************************************************/
923BERR_Code BKIR_EnableDataFilter (
924    BKIR_ChannelHandle  hChn,       /* [in] Device channel handle */
925    unsigned int        pat0,       /* [in] pattern to match(LSB) */
926    unsigned int        pat1,       /* [in] pattern to match(MSB)*/
927    unsigned int        mask0,      /* [in] don's care bits in the pattern(LSB) */
928    unsigned int        mask1       /* [in] don's care bits in the pattern(MSB) */
929    );
930
931/***************************************************************************
932Summary:
933    This function disables a data filter.
934
935Description:
936    This function disables a data filter based on the pattern.
937
938Returns:
939    TODO:
940
941See Also:
942
943****************************************************************************/
944BERR_Code BKIR_DisableDataFilter (
945    BKIR_ChannelHandle  hChn        /* [in] Device channel handle */
946    );
947
948/***************************************************************************
949Summary:
950    This function enables a filter1.
951
952Description:
953    This function enables a filter1 using the filter width.
954        Any pulse smaller than (28*filter_width+2)/27) microseconds     will be rejected
955Returns:
956    TODO:
957
958See Also:
959
960****************************************************************************/
961BERR_Code BKIR_EnableFilter1 (
962    BKIR_ChannelHandle  hChn,           /* [in] Device channel handle */
963    unsigned int        filter_width    /* filter width if smaller than this to be rejected */
964    );
965
966/***************************************************************************
967Summary:
968    This function disables a data filter.
969
970Description:
971    This function disables a data filter based on the pattern.
972
973Returns:
974    TODO:
975
976See Also:
977
978****************************************************************************/
979BERR_Code BKIR_DisableFilter1 (
980    BKIR_ChannelHandle  hChn        /* [in] Device channel handle */
981    );
982
983/***************************************************************************
984Summary:
985    This function disables all KIR devices.
986
987Description:
988    This function disables all KIR devices.
989
990Returns:
991    TODO:
992
993See Also:
994
995****************************************************************************/
996BERR_Code BKIR_DisableAllIrDevices (
997    BKIR_ChannelHandle  hChn            /* [in] Device channel handle */
998    );
999
1000/***************************************************************************
1001Summary:
1002    This function gets the event handle for BKIR module channel.
1003
1004Description:
1005    This function is responsible for getting the event handle. The
1006    application code should use this function get BKIR's event handle,
1007    which the application should use to pend on.  The KIR ISR will
1008    set the event.
1009
1010Returns:
1011    TODO:
1012
1013See Also:
1014
1015****************************************************************************/
1016BERR_Code BKIR_GetEventHandle(
1017    BKIR_ChannelHandle hChn,            /* [in] Device channel handle */
1018    BKNI_EventHandle *phEvent           /* [out] Returns event handle */
1019    );
1020
1021/***************************************************************************
1022Summary:
1023    This function sets the custom device type.
1024
1025Description:
1026    This function is called to set the custom device type.
1027    This function should be called before calling BKIR_EnableIrDevice function
1028    since custom device type is used in BKIR_EnableIrDevice function
1029
1030Returns:
1031    TODO:
1032
1033See Also:
1034
1035****************************************************************************/
1036void BKIR_SetCustomDeviceType (
1037    BKIR_ChannelHandle  hChn,           /* Device channel handle */
1038    BKIR_KirDevice      customDevice    /* device that this custom cir is used for */
1039);
1040
1041/***************************************************************************
1042Summary:
1043    This function sets the custom CIR's parameters.
1044
1045Description:
1046    This function is called to set the custom CIR parameters to the ones
1047    pointed to by pCirParam.  This allows the user to change the CIR
1048    parameters on the fly.
1049
1050Returns:
1051    TODO:
1052
1053See Also:
1054
1055****************************************************************************/
1056void BKIR_SetCustomCir (
1057    BKIR_ChannelHandle  hChn,           /* [in] Device channel handle */
1058    CIR_Param           *pCirParam      /* [in] Pointer to custom CIR parameters */
1059);
1060
1061/***************************************************************************
1062Summary:
1063    This function registers a callback function with KIR PI
1064
1065Description:
1066    This function is used to register a callback function with KIR PI.
1067    When a KIR interrupt happens, if a callback function has been registered
1068    for this channel, it will call that function.
1069
1070Returns:
1071    TODO:
1072
1073See Also:
1074
1075****************************************************************************/
1076void BKIR_RegisterCallback (
1077    BKIR_ChannelHandle  hChn,       /* Device channel handle */
1078    BKIR_Callback       callback,   /* Callback function to register */
1079    void                *pData      /* Data passed to callback function */
1080);
1081
1082/***************************************************************************
1083Summary:
1084    This function unregisters a callback function with KIR PI
1085
1086Description:
1087    This function is used to unregister a callback function for a
1088    particular KIR channel.
1089
1090Returns:
1091    TODO:
1092
1093See Also:
1094
1095****************************************************************************/
1096void BKIR_UnregisterCallback (
1097    BKIR_ChannelHandle  hChn        /* Device channel handle */
1098);
1099
1100#ifdef __cplusplus
1101}
1102#endif
1103
1104#endif
1105
1106
1107
Note: See TracBrowser for help on using the repository browser.