Changeset 1182
- Timestamp:
- 01/11/10 12:11:53 (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r1178 r1182 202 202 elseif (OSCamOperatingSystem MATCHES "Tuxbox") 203 203 target_link_libraries ( ${exe_name} dl) 204 elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")205 204 elseif (OSCamOperatingSystem MATCHES "SlugOS") 206 205 elseif (OSCamOperatingSystem MATCHES "Fonera2") -
trunk/csctapi/icc_async.c
r1179 r1182 78 78 return ICC_ASYNC_IFD_ERROR; 79 79 /* Reset ICC */ 80 #ifdef COOL 81 if (ifd->io->com == RTYP_SCI) { 82 if (!Cool_Reset(&(icc->atr))) 83 { 84 icc->atr = NULL; 85 return ICC_ASYNC_IFD_ERROR; 86 } 87 } 88 else 89 #endif 80 90 if (IFD_Towitoko_ResetAsyncICC (ifd, &(icc->atr)) != IFD_TOWITOKO_OK) 81 91 { … … 83 93 return ICC_ASYNC_IFD_ERROR; 84 94 } 85 86 95 /* Get ICC convention */ 87 96 if (ATR_GetConvention (icc->atr, &(icc->convention)) != ATR_OK) -
trunk/csctapi/ifd_cool.c
r1171 r1182 8 8 #include <time.h> 9 9 #include"ifd_cool.h" 10 /*11 #include "io_serial.h"12 #include "sci_global.h"13 #include "sci_ioctl.h"14 */15 10 16 // these should be called from icc, t0, cardterminal etc. like this:17 // switch (reader[ridx].type) {18 // case INTERN:19 // #ifdef COOL20 // Cool_Init();21 // break;22 // #endif23 // #ifdef SCI_DEV24 // //still in towitoko shit25 // #endif26 // case SMART:27 // case MOUSE:28 // IFD_Towitoko_Init(ifd, io, slot);29 // break;30 // default:31 // return ERROR;32 // }33 11 // all other IFD_Towitoko functions should be 34 12 // -eliminated (like SetLed or administrative jobs) … … 48 26 int Cool_Init () 49 27 { 50 //initialize properties(input_bitrate, output_bitrate, bits, stopbits, parity,dtr, rts) of device to default values51 //initialize ifd settings52 //and get reader info53 28 if (cnxt_kal_initialize ()) 54 29 return FALSE; … … 70 45 } 71 46 72 /*73 int Cool_GetStatus (BYTE * result)74 {75 // return status : 0 -start, 1 - card, 2- no card76 47 77 //extern int cnxt_smc_get_state(); 48 int Cool_GetStatus (int * in) 49 { 50 int state; 51 if (cnxt_smc_get_state(handle, &state)) 52 return ERROR; 53 //state = 0 no card, 1 = not ready, 2 = ready 54 if (state) 55 *in = 1; //CARD, even if not ready report card is in, or it will never get activated 56 else 57 *in = 0; //NOCARD 78 58 return OK; 79 59 } 80 */ 60 81 61 int Cool_Reset (ATR ** atr) 82 62 { 83 printf("Entering coolreset"); 84 fflush(stdout); 63 //Cool_Reset(atr); 85 64 //reset needs clock to be reset by hand 86 65 typedef unsigned long u_int32; … … 96 75 97 76 int n = 40; 98 //int atr_len = 40;99 77 unsigned char buf[40]; 100 78 if (cnxt_smc_get_atr (handle, buf, &n)) 101 79 return ERROR; 102 //atr_len = n; 103 // atr = buf; 104 ///////////// 105 (*atr) = ATR_New (); 106 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK) 107 { 108 struct timespec req_ts; 109 req_ts.tv_sec = 0; 110 req_ts.tv_nsec = 50000000; 111 nanosleep (&req_ts, NULL); 112 #ifdef SCI_DEV 113 if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0) 114 return ERROR; 115 #endif 116 return OK; 117 } 118 else 119 { 120 ATR_Delete (*atr); 121 (*atr) = NULL; 122 return ERROR; 123 } 124 /////////// 80 81 (*atr) = ATR_New (); 82 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK) 83 { 84 struct timespec req_ts; 85 req_ts.tv_sec = 0; 86 req_ts.tv_nsec = 50000000; 87 nanosleep (&req_ts, NULL); 88 return OK; 89 } 90 else 91 { 92 ATR_Delete (*atr); 93 (*atr) = NULL; 94 return ERROR; 95 } 125 96 } 126 97 /* … … 155 126 #define TIMEOUT 4000 //max 4294 156 127 cardbuflen = 256;//it needs to know max buffer size to respond? 157 128 int rc = cnxt_smc_read_write(handle, FALSE, sent, size, cardbuffer, &cardbuflen, TIMEOUT, 0); 158 129 159 130 #ifdef DEBUG_IFD 160 131 //usually done in IFD_Towitoko, for COOL do it here 161 132 printf ("COOLIFD: Transmit: "); 162 133 int i; 163 134 for (i = 0; i < size; i++) 164 135 printf ("%X ", sent[i]); 165 136 printf ("\n"); 166 137 #endif -
trunk/csctapi/ifd_towitoko.c
r1171 r1182 364 364 #elif COOL 365 365 if(ifd->io->com==RTYP_SCI) 366 { 367 // in=1;//FIXME 368 int state; 369 if (cnxt_smc_get_state(handle, &state)) 370 return IFD_TOWITOKO_IO_ERROR; 371 //guessing: state = 0 no card, 1 = not ready, 2 = ready 372 if (state) 373 in = 1; //CARD, even if not ready report card is in, or it will never get activated 374 else 375 in = 0; //Nocard 366 { 367 if (!Cool_GetStatus(&in)) 368 return IFD_TOWITOKO_IO_ERROR; 376 369 } 377 370 else … … 627 620 if(n==0) 628 621 return IFD_TOWITOKO_IO_ERROR; 629 #elif COOL 630 if(ifd->io->com==RTYP_SCI) { 631 //Cool_Reset(atr); 632 //reset needs clock to be reset by hand 633 typedef unsigned long u_int32; 634 u_int32 clk; 635 clk = 357*10000; // MHZ 636 if (cnxt_smc_set_clock_freq(handle, clk)) 637 return IFD_TOWITOKO_IO_ERROR; 622 #endif 638 623 639 //reset card 640 int timeout = 5000; // Timout in ms? 641 if (cnxt_smc_reset_card (handle, timeout, NULL, NULL)) 642 return IFD_TOWITOKO_IO_ERROR; 643 644 int n = 40; 645 unsigned char buf[40]; 646 if (cnxt_smc_get_atr (handle, buf, &n)) 647 return IFD_TOWITOKO_IO_ERROR; 648 #endif 649 650 #if defined(SCI_DEV) || defined(COOL) 624 #ifdef SCI_DEV 651 625 (*atr) = ATR_New (); 652 626 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK)
Note:
See TracChangeset
for help on using the changeset viewer.