source: svn/newcon3bcm2_21bu/magnum/portinginterface/scd/7552/bscd.h @ 44

Last change on this file since 44 was 44, checked in by megakiss, 11 years ago

광주방송 OTC 주파수 369Mhz로 변경

  • Property svn:executable set to *
File size: 55.3 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: bscd.h $
11 * $brcm_Revision: Hydra_Software_Devel/1 $
12 * $brcm_Date: 10/18/10 10:09a $
13 *
14 * Module Description: This file contains Broadcom smart card (OS/platform
15 *                     independent) porting interface public functions that
16 *                     can support multiple Broadcom smart card interfaces.
17 *                     Since smart card module supports multiple independent 
18 *                     and identical interfaces/channels, most of the functions
19 *                     required a channel handle (BSCD_ChannelHandle), 
20 *                     instead of module handle (BSCD_Handle).
21 *                     This module can support the board with or without
22 *                     TDA8004 chip.
23 *
24 * Revision History:
25 *
26 * $brcm_Log: /magnum/portinginterface/scd/7422/bscd.h $
27 *
28 * Hydra_Software_Devel/1   10/18/10 10:09a qxie
29 * SW7422-78: initial version
30 *
31 * Hydra_Software_Devel/18   7/13/09 3:20p qxie
32 * PR56770: Smartcard: move BSCD_Channel_P_DumpRegisters to public PI,
33 * changed name to BSCD_Channel_DumpRegisters
34 *
35 * Hydra_Software_Devel/17   3/22/06 10:13a qcheng
36 * PR19076: Support BCM7400.
37 *
38 * Hydra_Software_Devel/16   11/19/04 6:23p btan
39 * PR 13298: Refer to the functions BSCD_CLI_T0Test( ) or BSCD_CLI_T1Test(
40 * ) in bscd_cli_infra.c for sample codes.
41 *
42 * Hydra_Software_Devel/15   9/9/04 12:40p btan
43 * PR 12504, PR12607:support customized callback functions. Smartcard: T=0
44 * protocol takes too long to time out and time out happens after all
45 * bytes are received.
46 *
47 * Hydra_Software_Devel/14   7/20/04 2:11p btan
48 * PR 10898: Pass EMV 2000 tests with either event interrupt or WWT to
49 * detect CWT +4
50 *
51 * Hydra_Software_Devel/13   12/31/03 11:05a btan
52 * PR 8080: Fixed auto_clk set before sc_clk_en
53 *
54 * Hydra_Software_Devel/12   12/1/03 5:55p btan
55 * Added BSCD_Channel_ResetBlockWaitTimer.
56 *
57 * Hydra_Software_Devel/11   11/26/03 4:59p btan
58 * Fixes for EMV T=0
59 *
60 * Hydra_Software_Devel/9   11/18/03 5:04p btan
61 * Fixed a typo.
62 *
63 * Hydra_Software_Devel/8   10/13/03 12:05p btan
64 * updated to latest version.
65 *
66 * Hydra_Software_Devel/7   9/17/03 4:49p lseverin
67 * fixed a few documentation warnings
68 *
69 * Hydra_Software_Devel/6   7/23/03 5:40p btan
70 * Added some functions headers.
71 *
72 * Hydra_Software_Devel/5   7/21/03 6:28p btan
73 * Updated after 1st review.
74 *
75 * Hydra_Software_Devel/3   6/10/03 5:56p btan
76 * Fixed some comments.
77 *
78 * Hydra_Software_Devel/2   6/5/03 6:48p btan
79 * Correct some comments.
80 *
81 * Hydra_Software_Devel/1   6/5/03 4:58p btan
82 * Initial creation for 7038
83 *
84 ***************************************************************************/
85
86
87/*================== Module Overview =====================================
88<verbatim>
89
90Module Overview
91The Smart Card (SCD) API is a porting interface(PI) module which
92allows status/control of smart card communication.
93
94
95
96Usage
97Since most of the chips and reference designs can support multiple identical and
98completely indepedent smart card interfaces, SCD shall control multiple
99smartcard channels with different settings concurrently. However, the whole system
100should have only one module handle. 
101
102During system initialization, the system may first call BSCD_GetDefaultSettings
103to acquire the default settings for the smart card module.  The sytem shall then
104call BSCD_Open to create a module handle. It may call
105BSCD_GetChannelDefaultSettings to retrieve the default settings for the
106specific smart card channel and BSCD_Channel_Open to create a channel handle.
107The sytem shall reset and configure the channel and  detect the smart card.
108Upon receiving ATR (Answer To Reset) data after the sytem reset the smart card,
109the system can then communcate with smart card associated with this
110channel.  All the I/O data shall be automically processed according to the inverse
111or direct  convention.   During system shutdown, the system shall call
112BSCD_Channel_Close to close this channel and call BSCD_Close to close the
113smart card module.
114
115Each channel can support ISO 7816 asynchronous T=0 and T=1 modes with 
116264-byte UART receive and transmit buffers. Each channel can have different baud
117rate but all channels have to use either internal clock or external clock.  SCD
118could defines various smart card timing and error management registers to conform
119to different standards with minimal CPU overhead and interrupt latency. SCD should
120be able to support NDS, EMV 1996, ARIB and ISO smart card standards.
121
122SCD is expected to be able to support various smart card standards, therefore it
123is designed to be as much standard independent as possible.  Application is expected
124to be standard awareness and to handle all the standard comformance requirements.
125
126The caller usually first calls SCD to setup the related registers to receive ATR. 
127The caller then interprets ATR and setup the registers again for transmitting
128and receiving data.  Since all these scenarioes occur sequentially and
129synchronously, there is no reason for the caller to call more than one
130SCD functions to access one channel concurrently with multiple threads. 
131
132
133Sample Code:
134Please refer to the functions BSCD_CLI_T0Test( ) or BSCD_CLI_T1Test( ) in
135bscd_cli_infra.c.
136
137
138</verbatim>
139***************************************************************************/
140
141
142#ifndef BSCD_H__
143#define BSCD_H__
144
145#include "bchp.h"
146#include "breg_mem.h"
147#include "bint.h"
148#include "bscd_datatypes.h"
149
150#ifdef __cplusplus
151extern "C" {
152#endif
153
154/***************************************************************************
155Summary:
156Smart Card (SCD) module context handle.
157
158Description:
159Opaque handle that is created in BSCD_Open.
160BSCD_Handle holds the context of the smart card module.  The system
161should have only one BSCD_Handle. Caller of BSCD_Open is responsible  to store
162this BSCD_Handle and uses it for the future function call after BSCD_Open function
163returns successfully.
164
165See Also:
166BSCD_Open, BSCD_Channel_Open
167
168****************************************************************************/
169typedef struct BSCD_P_Handle            *BSCD_Handle;
170
171
172/***************************************************************************
173Summary:
174SCD channel context handle.
175
176Description:
177Opaque handle that is created in BSCD_Channel_Open.
178BSCD_ChannelHandle holds the context of the smart card channel.  The system
179could have more than one BSCD_ChannelHandle if the chip can support multiple
180smartcard interfaces/channels.  Caller of BSCD_Channel_Open is responsible
181to store this BSCD_ChannelHandle and uses it for the future function call after
182BSCD_Channel_Open function returns successfully.
183
184See Also:
185BSCD_Open, BSCD_Channel_Open
186
187****************************************************************************/
188typedef struct BSCD_P_ChannelHandle     *BSCD_ChannelHandle;
189
190
191/***************************************************************************
192Summary:
193Required default settings structure for smart card module.
194
195Description:
196The default setting structure that defines the default configure of
197smart card module when the module is initialized. 
198
199See Also:
200BSCD_GetDefaultSettings, BSCD_Open.
201
202****************************************************************************/
203typedef struct BSCD_Settings          BSCD_Settings;
204
205
206
207/**
208  Smart Card Interrupt Callback function.
209**/
210typedef void (*BSCD_IsrCallbackFunc)( BSCD_ChannelHandle in_channelHandle, void * inp_data );
211
212/***************************************************************************
213Summary:
214Required default settings structure for smart card channel.
215
216Description:
217The default setting structure defines the default configure of
218smart card interface/channel when the interface is open.  Since SCD
219could support multiple smart card interfaces/channels, system may have
220more than one default channel settings that each channel may have
221different default channel settings.
222
223See Also:
224BSCD_GetChannelDefaultSettings, BSCD_Channel_Open
225
226****************************************************************************/
227typedef struct BSCD_ChannelSettings   BSCD_ChannelSettings;
228
229
230/***************************************************************************
231Summary:
232Smart Card Interrupt Callback function.
233
234Description:
235Caller of BSCD shall call BSCD_Channel_EnableIntrCallback_isr
236to register and enable the callback.  BSCD shall call
237
238See Also:
239BSCD_Channel_EnableIntrCallback_isr
240****************************************************************************/
241typedef void (* BICM_CallbackFunc)( void * inp_parm1,  int in_parm2 );
242
243
244/* Basic Module Functions */
245
246/*****************************************************************************
247Summary:
248This function shall return a recommended default settings for SCD module.
249
250Description:
251This function shall return a recommended default settings for SCD module.
252This function shall be called before BSCD_Open
253and the caller can then over-ride any of the default settings
254required for the build and configuration by calling BSCD_Open.
255
256These default settings are always the same regardless of how
257many times this function is called or what other functions have
258been called in the porting interface.
259
260Calling Context:
261The function shall be called from application level (for example in
262VxWorks or no-os) or from driver level (for example in Linux,
263recommended ioctl: BSCD_IOCTL_GET_DEFAULT_SETTINGS or during insmod)
264
265Performance and Synchronization:
266This is a synchronous function that will return when it is done. 
267
268Input:
269in_chipHandle - BCHP_Handle,  chip handle.
270
271Output:
272outp_sSettings - BSCD_Settings, a ref/pointer to the default setting.
273
274Returns:
275BERR_SUCCESS - Always return success.
276
277See Also:
278BSCD_Open
279
280*****************************************************************************/
281BERR_Code BSCD_GetDefaultSettings(
282                BSCD_Settings   *outp_sSettings,
283                BCHP_Handle             in_chipHandle
284); 
285
286
287/*****************************************************************************
288Summary:
289This function creates the smart card module handle.
290
291Description:
292This function shall create the smart card module handle.
293It also initializes the smart card module
294and hardware using settings stored in the p_Settings pointer.
295All the associated channels are not ready to be access until
296BSCD_ChannelOpen is called and returns successfully.
297 
298The caller can pass a NULL pointer for inp_sSettings. If the
299p_Settings pointer is NULL, default settings should be used.
300
301It is the caller responsibility to store the outp_handle and uses
302it for the future function call after this function returns
303successfully. If this function returns successfully,  outp_handle shall
304not be NULL.
305
306Before calling this function, the only function that the caller
307can call is BSCD_GetDefaultSettings. System shall not call
308any other smart card functions prior to this function.
309
310System shall not call this function more than once without calling BSCD_Close
311previously.
312
313If illegal settings are passed in an error should be
314returned and the hardware state should not be modified.
315
316The BINT_Handle is only required if this module needs to
317associate ISR callback routines with L2 interrupts.
318
319Calling Context:
320The function shall be called from application level (for example in
321VxWorks or no-os) or from driver level (for example in Linux,
322during insmod )
323
324Performance and Synchronization:
325This is a synchronous function that will return when it is done.
326
327Input:
328in_regHandle  - BREG_Handle, use to access smart card register.
329in_chipHandle - BCHP_Handle,  Chip handle.
330in_interruptHandle - BINT_Handle, Interrupt handle to handle smart card
331                                                interrupt.         
332inp_sSettings - BSCD_Settings, the settings that apply to smart card module
333                                        If NULL, a default setting shall be used.
334                       
335Output:
336outp_handle - BSCD_Handle, a ref/pointer to the smart card module handle.
337                        It shall not be NULL if this function returns successfully.
338
339Returns:
340BERR_SUCCESS - success
341BERR_OUT_OF_SYSTEM_MEMORY - out of system memory
342
343See Also:
344BSCD_GetDefaultSettings
345BSCD_Close
346
347*****************************************************************************/
348BERR_Code BSCD_Open(
349                BSCD_Handle                     *outp_handle, 
350                BREG_Handle                     in_regHandle,     
351                BCHP_Handle                     in_chipHandle,
352                BINT_Handle                     in_interruptHandle,
353                const BSCD_Settings     *inp_sSettings
354);
355
356
357/*****************************************************************************
358Summary:
359This function frees the main handle and any resources contained
360in the main handle.
361
362Description:
363This function shall free the main handle and any resources contained
364in the main handle. This function shall try to free any resources associated
365with sub handles created from the main handle. However, this function does not
366free any resources associated with channel handle.
367
368Regardless of the return value, this function always attempts to free all
369the allocated resources and inout_handle shall be NULL.
370
371Other than BSCD_GetDefaultSettings, system shall not call any other smart
372card functions after this function returns, regardless of the return result.
373 
374Calling Context:
375The function shall be called from application level (for example in
376VxWorks or no-os) or from driver level (for example in Linux,
377during rmmod)
378
379Performance and Synchronization:
380This is a synchronous function that will return when it is done.
381
382Input/Output:
383inout_handle  - BSCD_Handle,  smart card module handle.
384
385Returns:
386BERR_SUCCESS - success
387BSCD_STATUS_FAILED - failed.
388
389See Also:
390BSCD_Open
391BSCD_GetDefaultSettings
392
393******************************************************************************/
394BERR_Code BSCD_Close(
395                BSCD_Handle inout_handle
396);
397
398
399/*****************************************************************************
400Summary:
401This function returns the number of smart card interfaces
402that we can support for the build and configuration.
403
404Description:
405This function returns the number of smart card interfaces
406that we can support for the build and configuration.
407
408The caller shall then call BSCD_Channel_Open or BSCD_GetChannelDefaultSettings
409with in_channelNo that smaller than outp_totalChannels.
410 
411Calling Context:
412The function shall be called from application level (for example in
413VxWorks or no-os) or from driver level (for example in Linux,
414recommended ioctl: BSCD_IOCTL_GET_TOTAL_CHANNELS or device open )
415
416Performance and Synchronization:
417This is a synchronous function that will return when it is done.
418
419Input:
420in_handle  - BSCD_Handle,  smart card module handle.
421                       
422Output:
423outp_totalChannels - unsigned char, a ref/pointer to the maximum number of
424                                                supported smart card channel handles.
425
426Returns:
427BERR_SUCCESS - success
428BSCD_STATUS_FAILED - failed.
429
430See Also:
431BSCD_GetChannelDefaultSettings
432BSCD_Channel_Open
433
434******************************************************************************/
435BERR_Code BSCD_GetTotalChannels(
436                BSCD_Handle             in_handle, 
437                unsigned char           *outp_ucTotalChannels
438);
439
440
441/*****************************************************************************
442Summary:
443This function shall return a recommended default settings for SCD channel.
444
445Description:
446This function shall return a recommended default settings for SCD channel.
447This function shall be called before BSCD_Channel_Open
448and the caller can then over-ride any of the default settings
449required for the build and configuration by calling BSCD_Channel_Open
450or BSCD_Channel_ResetIFD.
451
452The caller shall pass in_channelNo that is smaller outp_totalChannels in
453BSCD_GetTotalChannels. The in_channelNo for the first channel shall be zero.
454
455These default settings are always the same regardless of how
456many times this function is called or what other functions have
457been called in the porting interface.
458
459Calling Context:
460The function shall be called from application level (for example in
461VxWorks or no-os) or from driver level (for example in Linux,
462recommended ioctl: BSCD_IOCTL_GET_CHANNEL_DEFAULT_SETTINGS
463or device open )
464
465Performance and Synchronization:
466This is a synchronous function that will return when it is done.
467
468Input:
469in_handle - BSCD_Handle,  smart card module handle.
470in_channelNo  - unsigned int, an index that indicates which channel or smart
471                                        card interface that the caller want to access.
472Output:
473outp_sSettings - BSCD_ChannelSettings, a ref/pointer to the default channel
474                                        setting.
475
476Returns:
477BERR_SUCCESS - success
478BSCD_STATUS_FAILED - failed.
479BERR_INVALID_PARAMETER - in_channelNo is invalid.
480
481See Also:
482BSCD_Open
483BSCD_GetTotalChannels
484BSCD_Channel_Open
485
486*****************************************************************************/
487BERR_Code BSCD_GetChannelDefaultSettings(
488                BSCD_Handle                             in_handle, 
489                unsigned int                    in_channelNo, 
490                BSCD_ChannelSettings    *outp_sSettings
491); 
492
493
494/*****************************************************************************
495Summary:
496This function creates the smart card channel handle.
497
498Description:
499This function shall create the smart card channel handle.
500It also initializes the specified smart card interface, all the associated
501channels and hardware using settings stored in the inp_channelDefSettings
502pointer.
503
504The caller shall pass in_channelNo that is smaller outp_totalChannels in
505BSCD_GetTotalChannels. The in_channelNo for the first channel shall be zero.
506
507The caller can pass a NULL pointer for inp_channelDefSettings. If the
508inp_channelDefSettings pointer is NULL, default settings should be used.
509
510It is the caller responsibility to store the outp_channelHandle and uses
511it for the future function call after this function returns
512successfully. If this function returns successfully,  outp_handle shall
513not be NULL.
514
515Before calling this function, the only channel related functions that
516the system can call are BSCD_GetTotalChannels and
517BSCD_GetChannelDefaultSettings. System shall not call any other channel
518related functions prior to this function.
519
520System shall not call this function more than once without calling
521BSCD_Channel_Close previously.
522
523If illegal settings are passed in an error should be
524returned and the hardware state should not be modified.
525
526Calling Context:
527The function shall be called from application level (for example in
528VxWorks or no-os) or from driver level (for example in Linux,
529device open)
530
531Performance and Synchronization:
532This is a synchronous function that will return when it is done.
533
534Input:
535in_handle  - BSCD_Handle, smart card module handle.
536in_channelNo  - unsigned int, an index that indicates which channel or smart
537                                        card interface that the caller want to access.       
538inp_channelDefSettings - BSCD_ChannelSettings, the channel settings that
539                                        apply to this  specific channel.  If NULL, a default
540                                        channel setting shall be used.
541                       
542Output:
543outp_channelHandle - BSCD_ChannelHandle, a ref/pointer to the smart
544                                                        card channel handle.
545
546Returns:
547BERR_SUCCESS - success
548BSCD_STATUS_FAILED - failed.
549BERR_INVALID_PARAMETER - in_channelNo or part of inp_channelDefSettings
550                                                        is invalid.
551
552See Also:
553BSCD_Open
554BSCD_GetTotalChannels
555BSCD_Channel_Close
556
557*****************************************************************************/
558BERR_Code BSCD_Channel_Open(
559                BSCD_Handle                                     in_handle, 
560                BSCD_ChannelHandle                      *outp_channelHandle, 
561                unsigned int                            in_channelNo, 
562                const BSCD_ChannelSettings      *inp_channelDefSettings
563);
564
565/*****************************************************************************
566Summary:
567This function frees the channel handle and any resources contained
568in the channel handle.
569
570Description:
571This function shall free the channel handle and any resources contained
572in the channel handle.
573
574Regardless of the return value, this function always attempts to free all
575the allocated resources and inout_channelHandle shall be NULL.
576
577Other than BSCD_GetTotalChannels and BSCD_GetChannelDefaultSettings, system
578shall not call any other channel related functions after this function returns,
579regardless of the return result.
580 
581Calling Context:
582The function shall be called from application level (for example in
583VxWorks or no-os) or from driver level (for example in Linux,
584device close)
585
586Performance and Synchronization:
587This is a synchronous function that will return when it is done.
588
589Input/output:
590inout_channelHandle  - BSCD_ChannelHandle,  smart card channel handle.
591
592Returns:
593BERR_SUCCESS - success
594BSCD_STATUS_FAILED - failed.
595
596See Also:
597BSCD_Channel_Open
598
599******************************************************************************/
600BERR_Code BSCD_Channel_Close(
601                BSCD_ChannelHandle inout_channelHandle
602);
603
604
605/*****************************************************************************
606Summary:
607This function gets the module handle based on the channel handle.
608
609Description:
610This function shall get the module handle based on the channel handle.
611If this function returns successfully, outp_handle shall not be NULL.
612
613Calling Context:
614The function shall be called from application level (for example in
615VxWorks or no-os) or from driver level (for example in Linux,
616recommended ioctl: BSCD_IOCTL_GET_DEVICE)
617
618Performance and Synchronization:
619This is a synchronous function that will return when it is done.
620
621Input:
622in_channelHandle  - BSCD_ChannelHandle, smart card channel handle.
623                       
624Output:
625outp_handle - BSCD_Handle, a ref/pointer to the smart card module handle.
626
627Returns:
628BERR_SUCCESS - success
629BSCD_STATUS_FAILED - failed.
630
631See Also:
632BSCD_Open
633BSCD_Channel_Open
634
635*****************************************************************************/
636BERR_Code BSCD_Channel_GetDevice(
637                BSCD_ChannelHandle      in_channelHandle, 
638                BSCD_Handle                     *outp_handle
639);
640
641/* End of Basic Module Functions */
642
643
644/* Module Specific Functions */
645
646
647/*****************************************************************************
648Summary:
649This function returns a specific smart card channel handle.
650
651Description:
652This function returns a specific smart card channel handle.
653The caller shall pass in_channelNo that is smaller outp_totalChannels in
654BSCD_GetTotalChannels. The in_channelNo for the first channel shall be zero.
655If this function returns successfully, outp_channelHandle shall not be NULL.
656 
657Calling Context:
658The function shall be called from application level (for example in
659VxWorks or no-os) or from driver level (for example in Linux,
660recommended ioctl: BSCD_IOCTL_GET_CHANNEL )
661
662Performance and Synchronization:
663This is a synchronous function that will return when it is done.
664
665Input:
666in_handle  - BSCD_Handle, smart card module handle.
667in_channelNo -  unsigned int, an index that indicate which channel or smart card
668                        inerface that the caller want to access.
669                       
670Output:
671outp_channelHandle - BSCD_ChannelHandle, a ref/pointer to the smart card
672                                         channel handle.
673
674Returns:
675BERR_SUCCESS - success
676BSCD_STATUS_FAILED - failed.
677BERR_INVALID_PARAMETER - in_channelNo is invalid.
678
679See Also:
680BSCD_Open
681BSCD_GetTotalChannels
682BSCD_Channel_Open
683
684******************************************************************************/
685BERR_Code BSCD_GetChannel(
686                BSCD_Handle                     in_handle, 
687                unsigned int                    in_channelNo, 
688                BSCD_ChannelHandle      *outp_channelHandle
689);
690
691
692/*****************************************************************************
693Summary:
694This function shall wait until the card is inserted or removed.
695
696Description:
697This function shall wait until the card is inserted or removed.
698
699This function shall returns immediately either
7001) the card is removed and in_eCardPresent is BSCD_CardPresent_eRemoved, or
7012) the card is inserted and in_eCardPresent is BSCD_CardPresent_eInserted.
702
703This function shall be blocked until the card is inserted if the card is
704currently removed and in_eCardPresent is BSCD_CardPresent_eInserted.
705
706This function shall be blocked until the card is removed if the card is
707currently inserted and in_eCardPresent is BSCD_CardPresent_eRemoved.
708
709If the caller does not want to be blocked, it could use
710BSCD_Channel_GetStatus to check the card presence status.
711
712Note:
713The application may seem to be hang since this function may be blocked until
714user inserting or removing the card.
715 
716Calling Context:
717The function shall be called from application level (for example in
718VxWorks or no-os) or from driver level (for example in Linux,
719recommended ioctl: BSCD_IOCTL_DETECT_CARD )
720
721Performance and Synchronization:
722This is a synchronous function that will return when it is done.
723This function may be
724blocked until user inserts or removes the card. Since TDA8004 does not have
725debounce feature for the presence switches, this function may
726wait for extra 10ms for the presence switches to be stabilized.
727
728Input:
729in_channelHandle  - BSCD_ChannelHandle, a specific smart
730                                        card channel handle.
731in_eCardPresent -  BSCD_CardPresent, indicate if the caller wants to wait
732                                   until the card is inserted or removed.                       
733
734Returns:
735BERR_SUCCESS - success
736BSCD_STATUS_FAILED - failed.
737
738See Also:
739BSCD_Channel_GetStatus
740
741******************************************************************************/
742BERR_Code BSCD_Channel_DetectCard( 
743                BSCD_ChannelHandle      in_channelHandle, 
744                BSCD_CardPresent        in_eCardPresent
745);
746
747
748
749/*****************************************************************************
750Summary:
751This function shall modify the current smart card channel setting.
752
753Description:
754This function shall modify the current smart card channel setting. For
755better performance that this function can modify only a small set of changes,
756it is strongly recommended that the caller should call
757BSCD_Channel_GetParameters to retrieve the current channel setting.
758The caller should only update the modified members in BSCD_Settings and call
759BSCD_Channel_SetParameters to set the current setting.
760
761 
762Calling Context:
763The function shall be called from application level (for example in
764VxWorks or no-os) or from driver level (for example in Linux,
765recommended ioctl: BSCD_IOCTL_SET_PARAMETERS )
766
767Performance and Synchronization:
768This is a synchronous function that will return when it is done.
769
770Input:
771in_channelHandle  - BSCD_ChannelHandle, a specific smart
772                                        card channel handle.
773inp_sSettings - BSCD_Settings, the settings that apply to a specific
774                                channel.  If NULL, the function shall return an error.
775
776Returns:
777BERR_SUCCESS - success
778bxerr_InvalidArgument - inp_sSettings is NULL.
779BSCD_STATUS_FAILED - failed.
780
781See Also:
782BSCD_Channel_GetParameters
783
784******************************************************************************/
785BERR_Code BSCD_Channel_SetParameters(
786                BSCD_ChannelHandle                      in_channelHandle, 
787                const BSCD_ChannelSettings      *inp_sSettings
788);
789
790/*****************************************************************************
791Summary:
792This function retrieves the current smart card channel setting.
793
794Description:
795This function shall retrieve the current smart card channel setting. If
796necessary, the caller can call BSCD_Channel_SetParameters to modify the
797current channel setting.
798
799 
800Calling Context:
801The function shall be called from application level (for example in
802VxWorks or no-os) or from driver level (for example in Linux,
803recommended ioctl: BSCD_IOCTL_GET_PARAMETERS )
804
805Performance and Synchronization:
806This is a synchronous function that will return when it is done.
807
808Input:
809in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to a specific smart
810                                        card channel handle.
811       
812Output:
813outp_sSettings - BSCD_Settings, the settings that apply to a specific
814                                 channel.       
815
816Returns:
817BERR_SUCCESS - success
818BSCD_STATUS_FAILED - failed.
819
820See Also:
821BSCD_Channel_SetParameters
822
823******************************************************************************/
824BERR_Code BSCD_Channel_GetParameters(
825                BSCD_ChannelHandle      in_channelHandle, 
826                BSCD_ChannelSettings    *outp_sSettings
827);
828
829/*****************************************************************************
830Summary:
831This function retrieves the current smart card channel number.
832
833Description:
834This function shall retrieve the current smart card channel number.
835 
836Calling Context:
837The function shall be called from application level (for example in
838VxWorks or no-os) or from driver level (for example in Linux,
839recommended ioctl: BSCD_IOCTL_GET_CHANNEL_NUMBER )
840
841Performance and Synchronization:
842This is a synchronous function that will return when it is done.
843
844Input:
845in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to a specific smart
846                                        card channel handle.
847       
848Output:
849outp_ucChannelNumber - unsigned char, the settings that apply to a specific
850                                .       
851
852Returns:
853Channel number, where 0 is the first channel. If it fails, the return values is -1.
854
855See Also:
856
857******************************************************************************/
858char    BSCD_Channel_GetChannelNumber(
859                BSCD_ChannelHandle      in_channelHandle
860);
861
862/*****************************************************************************
863Summary:
864This function deativates the specific smart card interface.
865
866Description:
867This function shall deativate the specific smart card interface.  The
868deactivation sequence shall be:
869
870o Set SC_VCC high
871o Set SC_RST low
872o Disable SC_CLK
873o IO is unconditionally driver low.
874
875The caller shall call BSCD_Channel_ResetIFD to  reset a specific smart card
876channel.
877
878Calling Context:
879The function shall be called from application level (for example in
880VxWorks or no-os) or from driver level (for example in Linux,
881recommended ioctl: BSCD_IOCTL_DEACTIVATE )
882
883Performance and Synchronization:
884This is a synchronous function that will return when it is done.
885
886Input:
887in_channelHandle  - BSCD_ChannelHandle, a specific smart
888                                        card channel handle.
889
890Returns:
891BERR_SUCCESS - success
892To Do: Need more error code
893
894See Also:
895BSCD_Channel_PowerICC
896BSCD_Channel_ResetIFD
897
898******************************************************************************/
899BERR_Code BSCD_Channel_Deactivate(
900                BSCD_ChannelHandle          in_channelHandle
901);
902
903
904/*****************************************************************************
905Summary:
906This function reset a specific smart card interface (IFD).
907
908Description:
909This function shall reset a specific smart card interface (IFD).  It shall
910not reset the smart card (ICC). This function shall reset the channel and
911apply the settings stored in the p_Settings pointer to the channel and
912hardware.
913
914This function shall reset the smart card interface in the following sequence:
915        Set SC_VCC high  (Only Cold Reset)
916        Enable SC_CLK
917        Set SC_RST high
918        Reset UART transmit and receive buffer.
919
920No ATR data shall be received after this call since IO is yet to be
921enabled.  BSCD_Channel_PowerICC with ResetICC option shall activate
922the card so that the interface is ready to receive ATR.
923
924For TDA8004 emergency deactivation, we could use this function or
925BSCD_Channel_PowerICC with BSCD_ICCAction_ePowerUp
926to set SC_VCC high after we realize the smart card is no longer present.
927This will set the SC_VCC high and the next BSCD_Channel_GetStatus will show the
928correct presence of the card or next BSCD_Channel_DetectCard will response
929correctly.  The presence of card is unknown if this function is not called
930after TDA8004 emergency deactivation.
931
932The caller shall call BSCD_Channel_Deactivate to  deactivate a specific smart
933card channel. The caller shall call BSCD_Reset to reset all the channels.
934
935 
936Calling Context:
937The function shall be called from application level (for example in
938VxWorks or no-os) or from driver level (for example in Linux,
939recommended ioctl: BSCD_IOCTL_RESET_CHANNEL )
940
941Performance and Synchronization:
942This is a synchronous function that will return when it is done.
943
944Input:
945in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
946                                        channel handle.
947
948Returns:
949BERR_SUCCESS - success
950To Do: Need more error code
951
952
953See Also:
954BSCD_Channel_PowerICC
955BSCD_Channel_Deactivate
956
957******************************************************************************/
958BERR_Code BSCD_Channel_ResetIFD(
959                BSCD_ChannelHandle      in_channelHandle,
960                BSCD_ResetType          in_resetType
961               
962);
963
964
965/*****************************************************************************
966Summary:
967This function shall set SC_VCC high, low or reset the smart card.
968
969Description:
970There are 3 options to be selected in this function.
971
972If in_iccAction is BSCD_ICCAction_ePowerUp, this function shall set SC_VCC
973high.  System should call this function so that the next BSCD_Channel_GetStatus
974will show the correct presence of the card or next BSCD_Channel_DetectCard
975will response correctly after TDA8004 emergency deactivation.
976
977If in_iccAction is BSCD_ICCAction_ePowerDown, this function shall set SC_VCC
978low.  The next BSCD_Channel_GetStatus may not show the correct presence of the
979card or next BSCD_Channel_DetectCard may not response correctly after
980TDA8004 emergency deactivation.
981       
982Calling Context:
983The function shall be called from application level (for example in
984VxWorks or no-os) or from driver level (for example in Linux,
985recommended ioctl: BSCD_IOCTL_Power_ICC )
986
987Performance and Synchronization:
988This is a synchronous function that will return when it is done.
989
990Input:
991in_channelHandle  - BSCD_ChannelHandle,  smart card
992                                        channel handle.
993in_iccAction - BSCD_ICCAction, the settings that apply to a specific
994                                channel.  If NULL, the interface shall be reset with the
995                                current setting.
996
997Returns:
998BERR_SUCCESS - success
999To Do: Need more error code
1000
1001
1002See Also:
1003BSCD_Channel_PowerICC
1004BSCD_Channel_Deactivate
1005BSCD_Channel_Receive
1006
1007******************************************************************************/
1008BERR_Code BSCD_Channel_PowerICC(
1009                BSCD_ChannelHandle          in_channelHandle,
1010                BSCD_PowerICC               in_iccAction   
1011);
1012
1013/*****************************************************************************
1014Summary:
1015This function set voltage level for smart card interface.
1016
1017Description:
1018We have to modify the board to use VPP pin of smartcard and connect it to pin 3 (3V/5V) of TDA chip
1019and run this function.  Make sure to disconnect your QAM or QPSK connection before calling this function
1020or your smartcard will be damaged.
1021
1022We also have to use proper voltage card for test when we change smart card interface voltage.
1023( 3v card for 3v Smart Card  interface, 5v card for 5v Smart Card interface ).
1024By default the Smart Card iterface is set 5V.
1025       
1026Calling Context:
1027The function shall be called from application level (for example in
1028VxWorks or no-os) or from driver level
1029
1030Performance and Synchronization:
1031This is a synchronous function that will return when it is done.
1032
1033Input:
1034in_channelHandle  - BSCD_ChannelHandle,  smart card channel handle.
1035in_vccLevel - Smart Card interface voltage level ( 5V and 3V )
1036
1037Returns:
1038BERR_SUCCESS - success
1039To Do: Need more error code
1040
1041
1042See Also:
1043
1044******************************************************************************/
1045BERR_Code BSCD_Channel_SetVccLevel(
1046                BSCD_ChannelHandle          in_channelHandle,
1047                BSCD_VccLevel                   in_vccLevel
1048);
1049
1050
1051
1052
1053/*****************************************************************************
1054Summary:
1055This function enable or disable "Insert Card Hardware Reset" feature in smart card.
1056
1057Description:
1058When "Insert Card Hardware Reset" is enabled, the hardware will reset when smart card is inserted.
1059This is triggered by SC_STATUS_1 bit card_pres  = 0 -> 1 
1060Make sure the SC_IF_CMD_1 bit pres_pol = 1, otherwise this trigger can not happen.
1061After hardware reset, by default this feature is dabled.
1062       
1063Calling Context:
1064The function shall be called from application level (for example in
1065VxWorks or no-os) or from driver level
1066
1067Performance and Synchronization:
1068This is a synchronous function that will return when it is done.
1069
1070Input:
1071in_channelHandle  - BSCD_ChannelHandle,  smart card channel handle.
1072in_enableHwRst - true: Enable this feature
1073                                false: disable this feature
1074
1075Returns:
1076BERR_SUCCESS - success
1077To Do: Need more error code
1078
1079
1080See Also:
1081
1082******************************************************************************/
1083BERR_Code BSCD_Channel_InsCardHwReset(
1084                BSCD_ChannelHandle          in_channelHandle,
1085                bool                                  in_enableHwRst   
1086);
1087
1088/*****************************************************************************
1089Summary:
1090This function shall reset the smart card.  Depends on the option, this function could
1091further read and interpret the ATR data and program the registers accordingly.
1092
1093Description:
1094There are 2 options to be selected in this function.
1095
1096If in_iccAction is BSCD_ResetCardAction_eNoAction, this function shall only reset the card.  It
1097shall not read ATR data.  Caller has to call  BSCD_Channel_Receive to receive the ATR
1098data, decode it and then call BSCD_Channel_SetParameters to program the registers.
1099
1100If in_iccAction is BSCD_ResetCardAction_eReceiveAndDecode, this function shall reset the card.  It
1101then reads and decodes ATR data and programs the registers accordingly. This option is
1102required to support smart card standard, like EMV that has stringent timing requirements
1103on ATR error handling. Caller still has to call  BSCD_Channel_Receive to receive the ATR
1104data.  The caller has the option if it wants to decode it and then call
1105BSCD_Channel_SetParameters to program the registers.
1106     
1107This function shall reset the smart card (ICC) in the following sequence:
1108
1109o SC_VCC low 
1110o SC_RST high   
1111o Wait for 42000 clock cycles.
1112o IO is ready to receive ATR.
1113o SC_RST low 
1114o ICC must send ATR per standard requirements (For example between 400 and
1115   40,000 clock cycles).
1116
1117
1118Unless specify, the rest of this section describes the scenarioes if
1119in_iccAction is BSCD_ResetCardAction_eReceiveAndDecode:
1120This function shall be blocked until either
1121
11221) All ATR data is received.
11232) one of the timer expired.
1124
1125After ATR data are received correctly, the hardware shall determine if this
1126card support direct (TS, first character is 0x3B) or inverse convention (TS is
11270x3F). The caller shall call BSCD_Channel_Receive to receive the ATR data.
1128
1129
1130This function shall parse the ATR data and modify the following settings
1131according to the received ATR data:
1132
1133o ProtocolType (T=0 or T=1)
1134o Clock Rate Conversion Factor
1135o Baud Rate Adjustment Factor
1136o Extra Guard Time
1137o Work Waiting time (For T=0 only.  For EMV standard, it applies to T=1 too)
1138o Block Wait time (For T=1 only)
1139o Character Wait time (For T=1 only)
1140
1141This function shall enable certain interrupts for T=0 or T=1 and set the parity
1142retrial number.
1143
1144 
1145Calling Context:
1146The function shall be called from application level (for example in
1147VxWorks or no-os) or from driver level (for example in Linux,
1148recommended ioctl: BSCD_IOCTL_RESET_CARD )
1149
1150Performance and Synchronization:
1151This is a synchronous function that will return when it is done. The maximum
1152number of ATR data is 32 and the default work waiting time is 9600 ETUs,
1153therefore the application can wait for 5 seconds, if each ETU is 165us,
1154before all the ATR bytes are received.
1155
1156Input:
1157in_channelHandle  - BSCD_ChannelHandle,  smart card
1158                                        channel handle.
1159in_iccAction - BSCD_ResetCardAction, the settings that apply to a specific
1160                                channel.  If NULL, the interface shall be reset with the
1161                                current setting.
1162
1163Returns:
1164BERR_SUCCESS - success
1165To Do: Need more error code
1166
1167
1168See Also:
1169BSCD_Channel_PowerICC
1170BSCD_Channel_Deactivate
1171BSCD_Channel_Receive
1172
1173******************************************************************************/
1174BERR_Code BSCD_Channel_ResetCard(
1175                BSCD_ChannelHandle          in_channelHandle,
1176                BSCD_ResetCardAction               in_iccAction   
1177);
1178
1179
1180/*****************************************************************************
1181Summary:
1182This function retrieves the smart card channel status and current software
1183state.
1184
1185Description:
1186This function shall retrieve the smart card status and current software
1187state.
1188 
1189Calling Context:
1190The function shall be called from application level (for example in
1191VxWorks or no-os) or from driver level (for example in Linux,
1192recommended ioctl: BSCD_IOCTL_GET_STATUS )
1193
1194Performance and Synchronization:
1195This is a synchronous function that will return when it is done. Since
1196TDA8004 does not have debounce feature for the presence switches, this
1197function may wait for extra 10ms for the presence switches to be stabilized.
1198
1199Input:
1200in_channelHandle  - BSCD_ChannelHandle, smart card
1201                                        channel handle.
1202
1203Output:
1204outp_status - BSCD_Status, a ref/pointer that indicates the currect status
1205                          and software state of the smart card module.
1206
1207Returns:
1208BERR_SUCCESS - success
1209To Do: Need more error code
1210
1211
1212See Also:
1213BSCD_Channel_DetectCard
1214
1215******************************************************************************/
1216BERR_Code BSCD_Channel_GetStatus(
1217                BSCD_ChannelHandle          in_channelHandle,
1218                BSCD_Status                 *outp_status
1219);
1220
1221
1222/*****************************************************************************
1223Summary:
1224This function transmits data to the smart card.
1225
1226Description:
1227This function shall be blocked until it has transmitted in_unNumXmitBytes
1228number of  bytes in inp_ucXmitData to the card.
1229
1230This function shall be blocked until either all the bytes has been transmitted.
1231
1232For NDS standard, this function shall set the SC_FLOW_CMD[flow_en] to 1 and
1233the hardware transmitter shall waits until the NDS flow control is deasserted
1234before transmitting the next byte.
1235
1236This function shall not interpret the transmitting data.
1237
1238For any parity error, the hardware shall retry the transmission for the
1239number of times specify in the setting.  If ICC still reports transmission parity
1240error after that, SC_INTR_STAT_1[retry_intr] will set to 1 and caller can call
1241BSCD_Channel_GetStatus to check if this is a transmission parity error.
1242
1243Calling Context:
1244The function shall be called from application level (for example in
1245VxWorks or no-os) or from driver level (for example in Linux,
1246driver write)
1247
1248Performance and Synchronization:
1249This is a synchronous function that will return when it is done. This function
1250is blocked until it has transmitted in_unNumXmitBytes number of  bytes in
1251inp_ucXmitData.
1252
1253Input:
1254in_channelHandle  - BSCD_ChannelHandle, smart card
1255                                        channel handle.
1256inp_ucXmitData - uint8_t, a ref/pointer to the buffer for transmitting data
1257in_unNumXmitBytes - unsigned long, a ref/pointer to the number of transmitting
1258                                        bytes.
1259
1260Returns:
1261BERR_SUCCESS - success
1262To Do: Need more error code
1263
1264
1265See Also:
1266BSCD_Channel_Transmit
1267BSCD_Channel_Receive
1268BSCD_Channel_GetStatus
1269
1270******************************************************************************/
1271BERR_Code BSCD_Channel_Transmit(               
1272                BSCD_ChannelHandle          in_channelHandle,
1273                uint8_t                     *inp_ucXmitData,
1274                unsigned long                    in_ulNumXmitBytes
1275);
1276
1277
1278/*****************************************************************************
1279Summary:
1280This function receives data from the smart card after IFD transmits data to the smart card.
1281
1282Description:
1283This function shall receive data in the outp_ucRcvData from the smart card, after IFD
1284transmits data to the smart card.
1285
1286This function is NOT recommended to be used to read ATR data.  Use
1287BSCD_Channel_ReceiveATR to read ATR data since it handles the time out more
1288accurately. If the system does not care about the accurate timeout, this function can
1289be used to read the ATR data.
1290
1291For better performance, the caller is recommended to set in_unMaxReadBytes
1292equal to the number of expected receiving bytes. If the caller set
1293in_unMaxReadBytes to a number that is greater than the outp_unNumRcvBytes
1294(for example, MAX_ATR_SIZE), this function shall return outp_unNumRcvBytes
1295number of receiving bytes with an error. It is the responsibility of the
1296application to determine if this operation is succeed or not.
1297
1298This function shall be blocked until either
1299
13001) The number of receiving data is equal to in_unMaxReadBytes.
13012) An error occurs.
1302
1303This function shall return an error either
1304
13051) The number of receiving bytes is greater than in_unMaxReadBytes.
13062) One of the timer expired before in_unMaxReadBytes of bytes
1307   has received.
1308
1309This function shall not interpret receiving data.
1310
1311For any parity error, the hardware shall retry the receiving for the
1312number of times specify in the setting. If IFD still reports receiving parity
1313error after that, SC_INTR_STAT_1[retry_intr] will set to 1 and caller can call
1314BSCD_Channel_GetStatus to check if this is a receiving parity error.
1315
1316Calling Context:
1317The function shall be called from application level (for example in
1318VxWorks or no-os) or from driver level (for example in Linux,
1319driver read )
1320
1321Performance and Synchronization:
1322This is a synchronous function that will return when it is done.
1323
1324Input:
1325in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1326                                        channel handle.
1327in_unMaxReadBytes - unsigned long, a ref/pointer to the number of maximum receiving
1328                                        bytes
1329
1330Output:
1331outp_ucRcvData - uint8_t, a ref/pointer to the buffer for receive data
1332outp_unNumRcvBytes - unsigned long a ref/pointer to the number of receiving bytes
1333
1334Returns:
1335BERR_SUCCESS - success
1336To Do: Need more error code
1337
1338
1339See Also:
1340BSCD_Channel_Transmit
1341BSCD_Channel_ReceiveATR
1342BSCD_Channel_GetStatus
1343
1344******************************************************************************/
1345BERR_Code BSCD_Channel_Receive(
1346                BSCD_ChannelHandle       in_channelHandle,
1347                uint8_t                  *outp_ucRcvData,
1348                unsigned long                  *outp_ulNumRcvBytes,
1349                unsigned long                 in_ulMaxReadBytes
1350);
1351
1352/*****************************************************************************
1353Summary:
1354This function receives Answer To Reset (ATR) data from the smart card.
1355
1356Description:
1357This function shall receive ATR data in the outp_ucRcvData from the smart card. ATR data
1358shall actually be received after calling BSCD_Channel_PowerICC. This function only
1359retrieve ATR data from the hardware receiving buffer.
1360
1361This function is recommended to be used to return ATR data since the time out period
1362is more accurate. Use BSCD_Channel_Receive
1363to read the data from the smart card after IFD transmits data to the smart card.
1364
1365For better performance, the caller is recommended to set in_unMaxReadBytes
1366equal to the number of expected receiving bytes. If the caller set
1367in_unMaxReadBytes to a number that is greater than the outp_unNumRcvBytes
1368(for example, MAX_ATR_SIZE), this function shall return outp_unNumRcvBytes
1369number of receiving bytes with an error. It is the responsibility of the
1370application to determine if this operation is succeed or not.
1371
1372This function shall be blocked until either
1373
13741) The number of receiving data is equal to in_unMaxReadBytes.
13752) An error occurs.
1376
1377This function shall return an error either
1378
13791) The number of receiving bytes is greater than in_unMaxReadBytes.
13802) One of the timer expired before in_unMaxReadBytes of bytes
1381   has received.
1382
1383This function shall not interpret receiving data.
1384
1385For any parity error, the hardware shall retry the receiving for the
1386number of times specify in the setting. If IFD still reports receiving parity
1387error after that, SC_INTR_STAT_1[retry_intr] will set to 1 and caller can call
1388BSCD_Channel_GetStatus to check if this is a receiving parity error.
1389
1390Calling Context:
1391The function shall be called from application level (for example in
1392VxWorks or no-os) or from driver level (for example in Linux,
1393driver read )
1394
1395Performance and Synchronization:
1396This is a synchronous function that will return when it is done.
1397
1398Input:
1399in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1400                                        channel handle.
1401in_unMaxReadBytes - unsigned long, a ref/pointer to the number of maximum receiving
1402                                        bytes
1403
1404Output:
1405outp_ucRcvData - uint8_t, a ref/pointer to the buffer for receive data
1406outp_unNumRcvBytes - unsigned long a ref/pointer to the number of receiving bytes
1407
1408Returns:
1409BERR_SUCCESS - success
1410To Do: Need more error code
1411
1412
1413See Also:
1414BSCD_Channel_Transmit
1415BSCD_Channel_Receive
1416BSCD_Channel_GetStatus
1417
1418******************************************************************************/
1419BERR_Code BSCD_Channel_ReceiveATR(
1420                BSCD_ChannelHandle       in_channelHandle,
1421                uint8_t                                 *outp_ucRcvData,
1422                unsigned long                  *outp_ulNumRcvBytes,
1423                unsigned long                    in_ulMaxReadBytes
1424);
1425
1426/*****************************************************************************
1427Summary:
1428This function configures the Waiting Timer or General Purpose Timer.
1429
1430Description:
1431This function shall configure the Waiting Timer or General Purpose Timer.
1432
1433Calling Context:
1434The function shall be called from application level (for example in
1435VxWorks or no-os) or from driver level (for example in Linux,
1436recommended ioctl: BSCD_IOCTL_CONFIG_TIMER).
1437
1438Performance and Synchronization:
1439This is a synchronous function that will return when it is done.
1440
1441Input:
1442in_channelHandle  - BSCD_ChannelHandle, smart card
1443                                        channel handle.
1444inp_timer - BSCD_Timer, a ref/pointer to the smart card timer structure.
1445inp_unCount - BSCD_TimerValue, a ref/pointer to the smart card timer value
1446                          and unit.
1447
1448Returns:
1449BERR_SUCCESS - success
1450To Do: Need more error code
1451
1452******************************************************************************/
1453BERR_Code BSCD_Channel_ConfigTimer(
1454                BSCD_ChannelHandle          in_channelHandle,   
1455                BSCD_Timer                          *inp_timer,
1456                BSCD_TimerValue             *inp_unCount
1457               
1458);
1459
1460
1461
1462/*****************************************************************************
1463Summary:
1464This function enables or disables the Waiting Timer or General Purpose Timer.
1465
1466Description:
1467This function shall either
1468
14691) Disable Waiting Timer or General Purpose Timer.
14702) Enable Waiting Timer in Work Waiting Time Mode or Block Waiting Time Mode.
14713) Enable General Purppose Timer in Start Timer Immediate mode or Start Timer
1472   on Next Start Bit mode.
1473
1474Calling Context:
1475The function shall be called from application level (for example in
1476VxWorks or no-os) or from driver level (for example in Linux,
1477recommended ioctl: BSCD_IOCTL_ENABLE_DISABLE_TIMER).
1478
1479Performance and Synchronization:
1480This is a synchronous function that will return when it is done.
1481
1482Input:
1483in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1484                                        channel handle.
1485inp_timer - BSCD_Timer, a ref/pointer to the smart card timer structure.
1486
1487Returns:
1488BERR_SUCCESS - success
1489To Do: Need more error code
1490
1491******************************************************************************/
1492BERR_Code BSCD_Channel_EnableDisableTimer_isr(
1493                BSCD_ChannelHandle          in_channelHandle,
1494                BSCD_Timer                  *inp_timer
1495);
1496
1497
1498/*****************************************************************************
1499Summary:
1500This function enables a specific smart card interrupt.
1501
1502Description:
1503This function enables a specific smart card interrupt. 
1504
1505There are 2 callback functions that can be registered with a specific interrupt.
1506One of them must be reserved for default callback function provided by this module.
1507The other callback function is opt to use for customized callback function.
1508Therefore this function can only register 2 different callback functions
1509per specific interrupt.
1510
1511Calling Context:
1512The function shall be called from application level (for example in
1513VxWorks or no-os) or from driver level (for example in Linux,
1514recommended ioctl: BSCD_IOCTL_ENABLE_INTR_CALLBACK).
1515
1516Performance and Synchronization:
1517This is a synchronous function that will return when it is done.
1518
1519Input:
1520in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1521                                        channel handle.
1522in_eIntrType - BICM_IntrType, Interrupt type.
1523in_callbackhandle - BICM_CallbackFunc, callback function.
1524
1525Returns:
1526BERR_SUCCESS - success
1527To Do: Need more error code
1528
1529******************************************************************************/
1530BERR_Code BSCD_Channel_EnableIntrCallback_isr(
1531                BSCD_ChannelHandle in_channelHandle, 
1532                BSCD_IntrType      in_eIntrType,
1533                BSCD_IsrCallbackFunc  in_callbackhandle
1534);
1535
1536
1537/*****************************************************************************
1538Summary:
1539This function disables a specific smart card interrupt.
1540
1541Description:
1542This function disables a specific smart card interrupt.
1543
1544Calling Context:
1545The function shall be called from application level (for example in
1546VxWorks or no-os) or from driver level (for example in Linux,
1547recommended ioctl: BSCD_IOCTL_DISABLE_INTR_CALLBACK).
1548
1549Performance and Synchronization:
1550This is a synchronous function that will return when it is done.
1551
1552Input:
1553in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1554                                        channel handle.
1555in_eIntrType - BICM_IntrType, Interrupt type.
1556
1557Returns:
1558BERR_SUCCESS - success
1559To Do: Need more error code
1560
1561******************************************************************************/
1562BERR_Code  BSCD_Channel_DisableIntrCallback_isr(
1563                BSCD_ChannelHandle in_channelHandle, 
1564                BSCD_IntrType      in_eIntrType
1565);
1566
1567/*****************************************************************************
1568Summary:
1569This function enable set of related smart card interrupts for T=0, T=1 or T=14.
1570
1571Description:
1572This function enable set of related smart card interrupts for T=0, T=1 or T=14.
1573
1574Calling Context:
1575The function shall be called from application level (for example in
1576VxWorks or no-os) or from driver level (for example in Linux,
1577recommended ioctl: BSCD_IOCTL_ENABLE_INTERRUPTS).
1578
1579Performance and Synchronization:
1580This is a synchronous function that will return when it is done.
1581
1582Input:
1583in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1584                                        channel handle.
1585
1586Returns:
1587BERR_SUCCESS - success
1588To Do: Need more error code
1589
1590******************************************************************************/
1591BERR_Code BSCD_Channel_EnableInterrupts(
1592        BSCD_ChannelHandle      in_channelHandle
1593);
1594
1595
1596/*****************************************************************************
1597Summary:
1598This function will reset the Block wait time back to whatever current channel settings which was
1599either set through ATR or BSCD_Channel_SetParameters.
1600
1601Description:
1602This function will reset the Block wait time back to whatever current channel settings which was
1603either set through ATR or BSCD_Channel_SetParameters.
1604
1605Calling Context:
1606The function shall be called from application level (for example in
1607VxWorks or no-os) or from driver level (for example in Linux,
1608recommended ioctl: BSCD_IOCTL_RESET_BLOCK_WAIT_TIMER).
1609
1610Performance and Synchronization:
1611This is a synchronous function that will return when it is done.
1612
1613Input:
1614in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1615                                        channel handle.
1616
1617Returns:
1618BERR_SUCCESS - success
1619To Do: Need more error code
1620
1621******************************************************************************/
1622BERR_Code BSCD_Channel_ResetBlockWaitTimer(
1623                BSCD_ChannelHandle          in_channelHandle
1624);
1625
1626
1627/*****************************************************************************
1628Summary:
1629This function will set the Block wait time extension.
1630
1631Description:
1632This function will set the Block wait time extension.
1633
1634Calling Context:
1635The function shall be called from application level (for example in
1636VxWorks or no-os) or from driver level (for example in Linux,
1637recommended ioctl: BSCD_IOCTL_SET_BLOCK_WAIT_TIME_EXT).
1638
1639Performance and Synchronization:
1640This is a synchronous function that will return when it is done.
1641
1642Input:
1643in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1644                                        channel handle.
1645in_ulBlockWaitTimeExtInETU - uint32_t, block wait time extention in ETU.
1646
1647Returns:
1648BERR_SUCCESS - success
1649To Do: Need more error code
1650
1651******************************************************************************/
1652BERR_Code BSCD_Channel_SetBlockWaitTimeExt(
1653                BSCD_ChannelHandle          in_channelHandle,
1654                uint32_t                                    in_ulBlockWaitTimeExtInETU
1655);
1656
1657/*****************************************************************************
1658Summary:
1659This function will dump the smartcard control register values.
1660
1661Description:
1662This function will dump the smartcard control register values.
1663
1664
1665Input:
1666in_channelHandle  - BSCD_ChannelHandle, a ref/pointer to the smart card
1667                                        channel handle.
1668******************************************************************************/
1669
1670
1671void BSCD_Channel_DumpRegisters(
1672                BSCD_ChannelHandle       in_channelHandle
1673);
1674
1675                               
1676/* End of Module Specific Functions */
1677
1678#ifdef __cplusplus
1679}
1680#endif
1681
1682#endif /* BSCD_H__ */
1683
1684
1685
1686
1687
1688
1689
Note: See TracBrowser for help on using the repository browser.