Changeset 1177


Ignore:
Timestamp:
01/10/10 22:44:22 (12 years ago)
Author:
alno
Message:

WebIf:

  • Merging with 1171 of trunk
Location:
branches/monitor-improvement
Files:
7 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/CMakeLists.txt

    r1140 r1177  
    9292    set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
    9393elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")
    94     add_definitions ("-DOS_LINUX -DTUXBOX")
     94    add_definitions ("-DOS_LINUX -DTUXBOX -DCOOL")
    9595    set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
    9696elseif (OSCamOperatingSystem MATCHES "SlugOS")
     
    180180set (exe_name "oscam")
    181181add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
    182 target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt pthread)
     182target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt pthread rt nxp)
    183183if (HAVE_AES)
    184184    target_link_libraries (${exe_name} crypto)
  • branches/monitor-improvement/csctapi/Makefile

    r573 r1177  
    1414          $(LIBFILE1)(icc_async.o) \
    1515          $(LIBFILE1)(ifd_towitoko.o) \
     16            $(LIBFILE1)(ifd_cool.o) \
    1617          $(LIBFILE1)(io_serial.o) \
    1718          $(LIBFILE1)(pps.o) \
  • branches/monitor-improvement/csctapi/icc_async.c

    r1170 r1177  
    2828#include <stdio.h>
    2929#include <string.h>
     30#include "ifd.h"
    3031
    3132/*
     
    137138            return ICC_ASYNC_IFD_ERROR;     
    138139    }
     140#ifdef COOL
     141    if (icc->ifd->io->com != RTYP_SCI)
     142#endif
    139143    IO_Serial_Flush(ifd->io);
    140144#endif
     
    198202{
    199203    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*/
    200218    if (IFD_Towitoko_SetBaudrate (icc->ifd, baudrate) !=  IFD_TOWITOKO_OK)
    201219      return ICC_ASYNC_IFD_ERROR;
     
    237255    return ICC_ASYNC_OK;
    238256}
     257
     258#ifdef COOL
     259extern unsigned char cardbuffer[255];
     260extern int cardbuflen;
     261#endif
    239262
    240263int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * data)
     
    258281    timings.char_delay = icc->timings.char_delay;
    259282   
     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
    260302    if (IFD_Towitoko_Transmit (icc->ifd, &timings, size, sent) != IFD_TOWITOKO_OK)
    261303        return ICC_ASYNC_IFD_ERROR;
     304#endif
    262305   
    263306    if (icc->convention == ATR_CONVENTION_INVERSE)
     
    274317    timings.char_timeout = icc->timings.char_timeout;
    275318   
     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
    276337    if (IFD_Towitoko_Receive (icc->ifd, &timings, size, data) != IFD_TOWITOKO_OK)
    277338        return ICC_ASYNC_IFD_ERROR;
     339#endif
    278340   
    279341    if (icc->convention == ATR_CONVENTION_INVERSE && icc->ifd->io->com!=RTYP_SCI)
  • branches/monitor-improvement/csctapi/ifd_towitoko.c

    r1170 r1177  
    4747#include "sci_global.h"
    4848#include "sci_ioctl.h"
     49#include "ifd.h"
    4950
    5051/*
     
    162163   
    163164#ifdef DEBUG_IFD
    164     printf ("IFD: Initialicing slot number %d, com=%d\n", slot, io->com);
     165    printf ("IFD: Initializing slot number %d, com=%d\n", slot, io->com);
    165166#endif
    166167   
     
    361362    }
    362363    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
    364380#if defined(TUXBOX) && defined(PPC)
    365381    if ((ifd->io->com==RTYP_DB2COM1) || (ifd->io->com==RTYP_DB2COM2))
     
    538554        int n = 0;
    539555        SCI_PARAMETERS params;
    540         static char irdeto[] = "IRDETO";
    541556#ifdef SH4
    542557        struct timeval tv, tv_spent;
     
    612627        if(n==0)
    613628            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;
    614638           
     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)
    615651        (*atr) = ATR_New ();
    616652        if(ATR_InitFromArray ((*atr), buf, n) == ATR_OK)
     
    620656            req_ts.tv_nsec = 50000000;
    621657            nanosleep (&req_ts, NULL);
     658#ifdef SCI_DEV
    622659            if (ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0)
    623660                return IFD_TOWITOKO_IO_ERROR;
     661#endif
    624662            return IFD_TOWITOKO_OK;
    625663        }
  • branches/monitor-improvement/csctapi/io_serial.c

    r1140 r1177  
    189189    io->com = com;
    190190
    191 #ifdef SCI_DEV
     191#if defined(SCI_DEV) || defined(COOL)
    192192    if (com==RTYP_SCI)
    193193#ifdef SH4
    194194        io->fd = open (filename, O_RDWR|O_NONBLOCK|O_NOCTTY);
     195#elif COOL
     196        return Cool_Init();
    195197#else
    196198        io->fd = open (filename, O_RDWR);
  • branches/monitor-improvement/csctapi/pps.c

    r1140 r1177  
    3030#include <stdio.h>
    3131#include <string.h>
     32#include "ifd.h"
    3233
    3334/*
     
    341342
    342343    cs_debug("PTS: Sending request: %s", cs_hexdump(1, params, len_request));
    343    
     344
    344345    /* 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
    345368    if (ICC_Async_Transmit (pps->icc, len_request, params) != ICC_ASYNC_OK)
    346369        return PPS_ICC_ERROR;
     
    368391    else
    369392        ret = PPS_OK;
     393#endif
    370394   
    371395    /* Copy PPS handsake */
     
    444468       
    445469    }
     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
    446484#endif
    447485    {
  • branches/monitor-improvement/oscam-config.h

    r108 r1177  
    1818#  define CS_HW_DBOX2   1
    1919#  define CS_HW_DREAM   2
    20 #  define SCI_DEV 1
     20#  ifndef COOL
     21#    define SCI_DEV 1
     22#  endif
    2123#  ifndef NO_PAR_SWITCH
    2224#    define NO_PAR_SWITCH
Note: See TracChangeset for help on using the changeset viewer.