- Timestamp:
- 07/10/11 22:28:50 (13 years ago)
- Location:
- branches/dynamic-threads/csctapi
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dynamic-threads/csctapi/icc_async.c
r5470 r5598 176 176 case R_INTERNAL: 177 177 #if defined(COOL) 178 return Cool_Init(reader ->device);178 return Cool_Init(reader); 179 179 #elif defined(AZBOX) 180 180 return Azbox_Init(reader); … … 280 280 call (Sci_GetStatus(reader, &in)); 281 281 #elif defined(COOL) 282 call (Cool_GetStatus( &in));282 call (Cool_GetStatus(reader, &in)); 283 283 #elif defined(WITH_STAPI) 284 284 call (STReader_GetStatus(reader->stsmart_handle, &in)); … … 344 344 call (Sci_Reset(reader, atr)); 345 345 #elif defined(COOL) 346 call (Cool_Reset( atr));346 call (Cool_Reset(reader, atr)); 347 347 #elif defined(WITH_STAPI) 348 348 call (STReader_Reset(reader->stsmart_handle, atr)); … … 506 506 case R_INTERNAL: 507 507 #if defined(COOL) 508 call (Cool_Transmit( sent, size));508 call (Cool_Transmit(reader, sent, size)); 509 509 #elif defined(AZBOX) 510 510 call (Azbox_Transmit(reader, sent, size)); … … 554 554 case R_INTERNAL: 555 555 #if defined(COOL) 556 call (Cool_Receive( data, size));556 call (Cool_Receive(reader, data, size)); 557 557 #elif defined(AZBOX) 558 558 call (Azbox_Receive(reader, data, size)); … … 608 608 call(STReader_Close(reader->stsmart_handle)); 609 609 #elif defined(COOL) 610 call (Cool_Close( ));610 call (Cool_Close(reader)); 611 611 #endif 612 612 break; … … 1079 1079 call (Sci_WriteSettings (reader, reader->protocol_type, reader->mhz / 100, ETU, WWT, reader->BWT, reader->CWT, EGT, 5, (unsigned char)I)); //P fixed at 5V since this is default class A card, and TB is deprecated 1080 1080 #elif defined(COOL) 1081 call (Cool_SetClockrate(reader ->mhz));1082 call (Cool_WriteSettings (reader ->BWT, reader->CWT, EGT, BGT));1081 call (Cool_SetClockrate(reader)); 1082 call (Cool_WriteSettings (reader, reader->BWT, reader->CWT, EGT, BGT)); 1083 1083 #elif defined(WITH_STAPI) 1084 1084 call (STReader_SetClockrate(reader->stsmart_handle)); -
branches/dynamic-threads/csctapi/ifd_cool.c
r5004 r5598 9 9 #include <string.h> 10 10 #include <stdint.h> 11 #include"../globals.h" 11 12 #include"ifd_cool.h" 12 #include"../globals.h"13 13 #include"icc_async.h" 14 14 … … 20 20 21 21 #define specdev() \ 22 ((struct s_coolstream_reader *) cur_client()->reader->spec_dev)22 ((struct s_coolstream_reader *)reader->spec_dev) 23 23 24 int32_t Cool_Init ( char *device)24 int32_t Cool_Init (struct s_reader *reader) 25 25 { 26 char *device = reader->device; 26 27 cnxt_smc_init (NULL); //not sure whether this should be in coolapi_open_all 27 28 int32_t reader_nb = 0; … … 34 35 return FALSE; 35 36 } 36 cur_client()->reader->spec_dev=malloc(sizeof(struct s_coolstream_reader));37 reader->spec_dev=malloc(sizeof(struct s_coolstream_reader)); 37 38 if (cnxt_smc_open (&specdev()->handle, &reader_nb)) 38 39 return FALSE; … … 42 43 43 44 44 int32_t Cool_GetStatus ( int32_t * in)45 int32_t Cool_GetStatus (struct s_reader *reader, int32_t * in) 45 46 { 46 47 int32_t state; … … 58 59 } 59 60 60 int32_t Cool_Reset ( ATR * atr)61 int32_t Cool_Reset (struct s_reader *reader, ATR * atr) 61 62 { 62 call (Cool_SetClockrate( 357));63 call (Cool_SetClockrate(reader)); 63 64 64 65 //reset card … … 77 78 } 78 79 79 int32_t Cool_Transmit ( BYTE * sent, uint32_t size)80 int32_t Cool_Transmit (struct s_reader *reader, BYTE * sent, uint32_t size) 80 81 { 81 82 specdev()->cardbuflen = 256;//it needs to know max buffer size to respond? … … 86 87 } 87 88 88 int32_t Cool_Receive ( BYTE * data, uint32_t size)89 int32_t Cool_Receive (struct s_reader *reader, BYTE * data, uint32_t size) 89 90 { 90 91 if (size > specdev()->cardbuflen) … … 97 98 } 98 99 99 int32_t Cool_SetClockrate ( int32_t mhz)100 int32_t Cool_SetClockrate (struct s_reader *reader) 100 101 { 101 102 uint32_t clk; 103 int32_t mhz = reader->mhz; 102 104 clk = mhz * 10000; 103 105 call (cnxt_smc_set_clock_freq (specdev()->handle, clk)); … … 106 108 } 107 109 108 int32_t Cool_WriteSettings ( uint32_t BWT, uint32_t CWT, uint32_t EGT, uint32_t BGT)110 int32_t Cool_WriteSettings (struct s_reader *reader, uint32_t BWT, uint32_t CWT, uint32_t EGT, uint32_t BGT) 109 111 { 110 112 //this code worked with old cnxt_lnx.ko, but prevented nagra cards from working with new cnxt_lnx.ko … … 129 131 } 130 132 131 int32_t Cool_FastReset ( )133 int32_t Cool_FastReset (struct s_reader *reader) 132 134 { 133 135 int32_t n = 40; … … 142 144 } 143 145 144 int32_t Cool_Close ( void)146 int32_t Cool_Close (struct s_reader *reader) 145 147 { 146 148 call(cnxt_smc_close (specdev()->handle)); 147 NULLFREE( cur_client()->reader->spec_dev);149 NULLFREE(reader->spec_dev); 148 150 call(cnxt_kal_terminate()); //should call this only once in a thread 149 151 cnxt_drv_term(); -
branches/dynamic-threads/csctapi/ifd_cool.h
r4998 r5598 6 6 7 7 #include "atr.h" 8 int32_t Cool_Init (char *device); 9 int32_t Cool_Reset (ATR * atr); 10 int32_t Cool_Transmit (BYTE * buffer, uint32_t size); 11 int32_t Cool_Receive (BYTE * buffer, uint32_t size); 12 int32_t Cool_SetClockrate (int32_t mhz); 13 int32_t Cool_FastReset (void); 8 int32_t Cool_Init (struct s_reader *reader); 9 int32_t Cool_Reset (struct s_reader *reader, ATR * atr); 10 int32_t Cool_Transmit (struct s_reader *reader, BYTE * buffer, uint32_t size); 11 int32_t Cool_Receive (struct s_reader *reader, BYTE * buffer, uint32_t size); 12 int32_t Cool_SetClockrate (struct s_reader *reader); 13 int32_t Cool_FastReset (struct s_reader *reader); 14 int32_t Cool_GetStatus (struct s_reader *reader, int32_t * in); 15 int32_t Cool_WriteSettings (struct s_reader *reader, uint32_t BWT, uint32_t CWT, uint32_t EGT, uint32_t BGT); 16 int32_t Cool_Close (struct s_reader *reader); 14 17 void * handle; 15 18 #endif
Note:
See TracChangeset
for help on using the changeset viewer.