Changeset 1339
- Timestamp:
- 01/22/10 01:29:30 (14 years ago)
- Location:
- branches/smartreader
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/Makefile
r1290 r1339 77 77 DS_RL=ranlib \ 78 78 DS_ST=strip 79 ###################################################################### 80 # 81 # LINUX native with libusb (smartreader) 82 # 83 ###################################################################### 84 i386-pc-linux-libusb: 85 @-$(MAKE) --no-print-directory \ 86 -f Maketype TYP=$(subst i386,$(shell uname --machine),$(subst cross-,,$@)) \ 87 OS_LIBS="-lcrypto -lm" \ 88 OS_CULI="-lncurses" \ 89 OS_PTLI="-lpthread" \ 90 DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""'" \ 91 DS_CFLAGS="-c `libusb-config --cflags`" \ 92 DS_LDFLAGS="`libusb-config --libs`" \ 93 DS_ARFLAGS="-rvsl" \ 94 DS_CC=gcc \ 95 DS_AR=ar \ 96 DS_LD=ld \ 97 DS_RL=ranlib \ 98 DS_ST=strip 79 99 80 100 ###################################################################### … … 101 121 ###################################################################### 102 122 # 123 # LINUX native with PCSC & libusb (smartreader) 124 # 125 ###################################################################### 126 i386-pc-linux-pcsc-libusb: 127 @-$(MAKE) --no-print-directory \ 128 -f Maketype TYP=$(subst i386,$(shell uname --machine),$(subst cross-,,$@)) \ 129 OS_LIBS="-lcrypto -lm" \ 130 OS_CULI="-lncurses" \ 131 OS_PTLI="-lpthread -lpcsclite" \ 132 DS_OPTS="-O2 -DOS_LINUX -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -I/usr/include/PCSC -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""'" \ 133 DS_CFLAGS="-c `libusb-config --cflags`" \ 134 DS_LDFLAGS="`libusb-config --libs`" \ 135 DS_ARFLAGS="-rvsl" \ 136 DS_CC=gcc \ 137 DS_AR=ar \ 138 DS_LD=ld \ 139 DS_RL=ranlib \ 140 DS_ST=strip 141 142 ###################################################################### 143 # 103 144 # MacOSX native 104 145 # … … 113 154 DS_CFLAGS="-c" \ 114 155 DS_LDFLAGS="-framework PCSC" \ 156 DS_ARFLAGS="-rvsl" \ 157 DS_CC=gcc \ 158 DS_AR=ar \ 159 DS_LD=ld \ 160 DS_RL=ranlib \ 161 DS_ST=strip 162 163 ###################################################################### 164 # 165 # MacOSX native 166 # 167 ###################################################################### 168 macosx-libusb: 169 @-$(MAKE) --no-print-directory \ 170 -f Maketype TYP=$(subst cross-,,$@) \ 171 OS_LIBS="-lcrypto -lm " \ 172 OS_CULI="-lncurses" \ 173 OS_PTLI="-lpthread" \ 174 DS_OPTS="-O2 -DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD -DCS_CONFDIR=${CS_CONFDIR} -DHAVE_PCSC=1 -DHAVE_LIBUSB -m32 -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -D'CS_SVN_VERSION="\"$(SVN_REV)\""'" \ 175 DS_CFLAGS="-c `libusb-config --cflags`" \ 176 DS_LDFLAGS="-framework PCSC `libusb-config --libs`" \ 115 177 DS_ARFLAGS="-rvsl" \ 116 178 DS_CC=gcc \ -
branches/smartreader/csctapi/Makefile
r1271 r1339 20 20 $(LIBFILE1)(protocol_t0.o) \ 21 21 $(LIBFILE1)(protocol_t1.o) \ 22 $(LIBFILE1)(t1_block.o) 22 $(LIBFILE1)(t1_block.o) \ 23 $(LIBFILE1)(ftdi.o) \ 24 $(LIBFILE1)(ifd_smartreader.o) 23 25 24 26 all: $(LIBFILE1) -
branches/smartreader/csctapi/ifd_smartreader.c
r1335 r1339 97 97 98 98 //Read the ATR 99 ret = smart_read( &ftdic,data, 32,1);99 ret = smart_read(data, 32,1); 100 100 #ifdef DEBUG_IO 101 101 cs_log("IO:SR: get ATR ret = %d" , ret); … … 130 130 int SR_Transmit (BYTE * sent, unsigned size) 131 131 { 132 int ret;132 unsigned int ret; 133 133 ret = smart_write(&ftdic, sent, size, 0); 134 134 if (ret!=size) … … 140 140 int SR_Receive (BYTE * data, unsigned size) 141 141 { 142 int ret;143 ret = smart_read( &ftdic,data, size,1);142 unsigned int ret; 143 ret = smart_read(data, size,1); 144 144 if (ret!=size) 145 145 return ERROR; … … 165 165 struct usb_device * find_smartreader(int index, struct ftdi_context* ftdic) 166 166 { 167 int ret,i;167 int i; 168 168 bool dev_found; 169 169 struct usb_bus *bus; … … 230 230 } 231 231 232 int smart_read(struct ftdi_context* ftdic,unsigned char* buff, size_t size, int timeout_sec)232 unsigned int smart_read(unsigned char* buff, size_t size, int timeout_sec) 233 233 { 234 234 235 235 int ret = 0; 236 int total_read = 0;237 struct timeval start, now, dif = {0 };236 unsigned int total_read = 0; 237 struct timeval start, now, dif = {0,0}; 238 238 gettimeofday(&start,NULL); 239 239 … … 261 261 } 262 262 263 int smart_write(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int udelay)263 unsigned int smart_write(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int udelay) 264 264 { 265 265 266 266 int ret = 0; 267 int idx;267 unsigned int idx; 268 268 269 269 if (udelay == 0) { … … 290 290 291 291 int ret = 0; 292 unsigned char buff[4];293 292 int delay=50000; 294 293 … … 370 369 struct ftdi_context* ftdic = (struct ftdi_context*)p; 371 370 bool running = TRUE; 372 int ret;373 int copy_size;371 unsigned int ret; 372 unsigned int copy_size; 374 373 unsigned char local_buffer[64]; //64 is max transfer size of FTDI bulk pipe 375 374 -
branches/smartreader/csctapi/ifd_smartreader.h
r1332 r1339 18 18 #include <memory.h> 19 19 20 #include "../globals.h" 20 21 #include "ftdi.h" 21 22 #include "atr.h" … … 55 56 struct usb_device * find_smartreader(int index, struct ftdi_context* ftdic); 56 57 void smart_flush(struct ftdi_context* ftdic); 57 int smart_read(struct ftdi_context* ftdic,unsigned char* buff, size_t size, int timeout_sec);58 int smart_write(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int udelay);58 unsigned int smart_read(unsigned char* buff, size_t size, int timeout_sec); 59 unsigned int smart_write(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int udelay); 59 60 void EnableSmartReader(struct ftdi_context* ftdic, int clock, unsigned short Fi, unsigned char Di, unsigned char Ni, unsigned char T,unsigned char inv); 60 61 void ResetSmartReader(struct ftdi_context* ftdic);
Note:
See TracChangeset
for help on using the changeset viewer.