Changeset 1177
- Timestamp:
- 01/10/10 22:44:22 (14 years ago)
- Location:
- branches/monitor-improvement
- Files:
-
- 7 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/monitor-improvement/CMakeLists.txt
r1140 r1177 92 92 set (DEFAULT_CS_CONFDIR "/var/tuxbox/config") 93 93 elseif (OSCamOperatingSystem MATCHES "NeutrinoHD") 94 add_definitions ("-DOS_LINUX -DTUXBOX ")94 add_definitions ("-DOS_LINUX -DTUXBOX -DCOOL") 95 95 set (DEFAULT_CS_CONFDIR "/var/tuxbox/config") 96 96 elseif (OSCamOperatingSystem MATCHES "SlugOS") … … 180 180 set (exe_name "oscam") 181 181 add_executable (${exe_name} ${exe_srcs} ${exe_hdrs}) 182 target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt pthread )182 target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt pthread rt nxp) 183 183 if (HAVE_AES) 184 184 target_link_libraries (${exe_name} crypto) -
branches/monitor-improvement/csctapi/Makefile
r573 r1177 14 14 $(LIBFILE1)(icc_async.o) \ 15 15 $(LIBFILE1)(ifd_towitoko.o) \ 16 $(LIBFILE1)(ifd_cool.o) \ 16 17 $(LIBFILE1)(io_serial.o) \ 17 18 $(LIBFILE1)(pps.o) \ -
branches/monitor-improvement/csctapi/icc_async.c
r1170 r1177 28 28 #include <stdio.h> 29 29 #include <string.h> 30 #include "ifd.h" 30 31 31 32 /* … … 137 138 return ICC_ASYNC_IFD_ERROR; 138 139 } 140 #ifdef COOL 141 if (icc->ifd->io->com != RTYP_SCI) 142 #endif 139 143 IO_Serial_Flush(ifd->io); 140 144 #endif … … 198 202 { 199 203 icc->baudrate = baudrate; 204 /*#ifdef COOL 205 if (icc->ifd->io->com==RTYP_SCI) { 206 typedef unsigned long u_int32; 207 u_int32 clk; 208 //clk = 357*10000; // MHZ 209 //clk = baudrate * 3570000L / 9600L; 210 clk = 500*10000; 211 if (cnxt_smc_set_clock_freq(icc->ifd->io->handle, clk)) 212 return ICC_ASYNC_IFD_ERROR; 213 printf("set clock to %lu Hz\n", clk); 214 return ICC_ASYNC_OK; 215 } 216 else 217 #endif*/ 200 218 if (IFD_Towitoko_SetBaudrate (icc->ifd, baudrate) != IFD_TOWITOKO_OK) 201 219 return ICC_ASYNC_IFD_ERROR; … … 237 255 return ICC_ASYNC_OK; 238 256 } 257 258 #ifdef COOL 259 extern unsigned char cardbuffer[255]; 260 extern int cardbuflen; 261 #endif 239 262 240 263 int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * data) … … 258 281 timings.char_delay = icc->timings.char_delay; 259 282 283 #ifdef COOL 284 //transmit buffer to SC and put answer in cardbuffer 285 if (icc->ifd->io->com == RTYP_SCI) { 286 #define TIMEOUT 4000 //max 4294 287 cardbuflen = 256;//it needs to know max buffer size to respond? 288 if (cnxt_smc_read_write(handle, FALSE, sent, size, cardbuffer, &cardbuflen, TIMEOUT, 0)) 289 return ICC_ASYNC_IFD_ERROR; 290 291 #ifdef DEBUG_IFD 292 //usually done in IFD_Towitoko, for COOL do it here 293 printf ("COOLIFD: Transmit: "); 294 int i; 295 for (i = 0; i < size; i++) 296 printf ("%X ", sent[i]); 297 printf ("\n"); 298 #endif 299 } 300 else 301 #else 260 302 if (IFD_Towitoko_Transmit (icc->ifd, &timings, size, sent) != IFD_TOWITOKO_OK) 261 303 return ICC_ASYNC_IFD_ERROR; 304 #endif 262 305 263 306 if (icc->convention == ATR_CONVENTION_INVERSE) … … 274 317 timings.char_timeout = icc->timings.char_timeout; 275 318 319 #ifdef COOL 320 //receive buffer to SC 321 if (size > cardbuflen) 322 size = cardbuflen; //never read past end of buffer 323 memcpy(data,cardbuffer,size); 324 cardbuflen -= size; 325 memmove(cardbuffer,cardbuffer+size,cardbuflen); 326 327 #ifdef DEBUG_IFD 328 int i; 329 printf ("COOLIFD: Receive: "); //I think 330 for (i = 0; i < size; i++) 331 printf ("%X ", data[i]); 332 printf ("\n"); 333 fflush(stdout); 334 #endif 335 return ICC_ASYNC_OK; 336 #else 276 337 if (IFD_Towitoko_Receive (icc->ifd, &timings, size, data) != IFD_TOWITOKO_OK) 277 338 return ICC_ASYNC_IFD_ERROR; 339 #endif 278 340 279 341 if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io->com!=RTYP_SCI) -
branches/monitor-improvement/csctapi/ifd_towitoko.c
r1170 r1177 47 47 #include "sci_global.h" 48 48 #include "sci_ioctl.h" 49 #include "ifd.h" 49 50 50 51 /* … … 162 163 163 164 #ifdef DEBUG_IFD 164 printf ("IFD: Initiali cing slot number %d, com=%d\n", slot, io->com);165 printf ("IFD: Initializing slot number %d, com=%d\n", slot, io->com); 165 166 #endif 166 167 … … 361 362 } 362 363 else 363 #endif 364 #elif COOL 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 376 } 377 else 378 #endif 379 364 380 #if defined(TUXBOX) && defined(PPC) 365 381 if ((ifd->io->com==RTYP_DB2COM1) || (ifd->io->com==RTYP_DB2COM2)) … … 538 554 int n = 0; 539 555 SCI_PARAMETERS params; 540 static char irdeto[] = "IRDETO";541 556 #ifdef SH4 542 557 struct timeval tv, tv_spent; … … 612 627 if(n==0) 613 628 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; 614 638 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) 615 651 (*atr) = ATR_New (); 616 652 if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK) … … 620 656 req_ts.tv_nsec = 50000000; 621 657 nanosleep (&req_ts, NULL); 658 #ifdef SCI_DEV 622 659 if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0) 623 660 return IFD_TOWITOKO_IO_ERROR; 661 #endif 624 662 return IFD_TOWITOKO_OK; 625 663 } -
branches/monitor-improvement/csctapi/io_serial.c
r1140 r1177 189 189 io->com = com; 190 190 191 #if def SCI_DEV191 #if defined(SCI_DEV) || defined(COOL) 192 192 if (com==RTYP_SCI) 193 193 #ifdef SH4 194 194 io->fd = open (filename, O_RDWR|O_NONBLOCK|O_NOCTTY); 195 #elif COOL 196 return Cool_Init(); 195 197 #else 196 198 io->fd = open (filename, O_RDWR); -
branches/monitor-improvement/csctapi/pps.c
r1140 r1177 30 30 #include <stdio.h> 31 31 #include <string.h> 32 #include "ifd.h" 32 33 33 34 /* … … 341 342 342 343 cs_debug("PTS: Sending request: %s", cs_hexdump(1, params, len_request)); 343 344 344 345 /* Send PPS request */ 346 #ifdef COOL 347 //unsigned char ptsAck[10]; 348 //u_int8 ptsLen = len_request; 349 unsigned short int ptsLen = len_request; 350 int Status = cnxt_smc_start_pps(handle, params, confirm, &ptsLen, TRUE); 351 printf ("cnxt_smc_start_pps Status=%i\n", Status); 352 len_confirm = ptsLen; 353 #ifdef DEBUG_PROTOCOL 354 printf("COOL: confirm: \n"); 355 for (i = 0; i < ptsLen; i++) 356 printf ("%02X", confirm[i]); 357 printf ("\n"); 358 fflush(stdout); 359 printf("COOL: req: \n"); 360 for (i = 0; i < len_request; i++) 361 printf ("%02X", params[i]); 362 printf ("\n"); 363 fflush(stdout); 364 #endif 365 if (Status) 366 return PPS_HANDSAKE_ERROR; 367 #else 345 368 if (ICC_Async_Transmit (pps->icc, len_request, params) != ICC_ASYNC_OK) 346 369 return PPS_ICC_ERROR; … … 368 391 else 369 392 ret = PPS_OK; 393 #endif 370 394 371 395 /* Copy PPS handsake */ … … 444 468 445 469 } 470 else 471 #elif COOL 472 if(pps->icc->ifd->io->com==RTYP_SCI) { 473 typedef unsigned long u_int32; 474 u_int32 clk; 475 clk = atr_fs_table[pps->parameters.FI]; 476 if (cnxt_smc_set_clock_freq(handle, clk)) 477 return ICC_ASYNC_IFD_ERROR; 478 #ifdef DEBUG_PROTOCOL 479 printf("Coolstream: set clock to %lu Hz\n", clk); 480 #endif 481 return ICC_ASYNC_OK; 482 } 483 else 446 484 #endif 447 485 { -
branches/monitor-improvement/oscam-config.h
r108 r1177 18 18 # define CS_HW_DBOX2 1 19 19 # define CS_HW_DREAM 2 20 # define SCI_DEV 1 20 # ifndef COOL 21 # define SCI_DEV 1 22 # endif 21 23 # ifndef NO_PAR_SWITCH 22 24 # define NO_PAR_SWITCH
Note:
See TracChangeset
for help on using the changeset viewer.