source: branches/smartreader/csctapi/ifd_smartreader.h@ 1297

Last change on this file since 1297 was 1297, checked in by rorothetroll, 11 years ago

fix typo

File size: 1.5 KB
Line 
1/*
2 ifd_smartreader.h
3 Header file for Argolis smartreader+.
4*/
5#ifdef HAVE_LIBUSB
6#ifdef USE_PTHREAD
7
8#include <stdlib.h>
9#include <stdio.h>
10#include <ctype.h>
11#include <unistd.h>
12
13#include <sys/time.h>
14#include <sys/types.h>
15
16#include <pthread.h>
17#include <memory.h>
18
19#include "ftdi.h"
20#include "atr.h"
21
22
23#define LOBYTE(w) ((BYTE)((w) & 0xff))
24#define HIBYTE(w) ((BYTE)((w) >> 8))
25
26typedef struct {
27 int F;
28 float D;
29 int fs;
30 int N;
31 int T;
32 int inv;
33} SR_CONFIG;
34
35unsigned char g_read_buffer[4096];
36unsigned short g_read_buffer_size = 0;
37pthread_mutex_t g_read_mutex = PTHREAD_MUTEX_INITIALIZER;
38pthread_mutex_t g_usb_mutex = PTHREAD_MUTEX_INITIALIZER;
39struct ftdi_context ftdic;
40pthread_t rt;
41
42SR_CONFIG sr_config;
43
44
45int SR_Init (int device_index);
46int SR_Reset (ATR ** atr);
47int SR_Transmit (BYTE * buffer, unsigned size);
48int SR_Receive (BYTE * buffer, unsigned size);
49int SR_SetBaudrate (int mhz);
50
51bool find_smartreader(int index, struct ftdi_context* ftdic);
52void smart_flush(struct ftdi_context* ftdic);
53int smart_read(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int timeout_sec);
54int smart_write(struct ftdi_context* ftdic, unsigned char* buff, size_t size, int udelay);
55void EnableSmartReader(struct ftdi_context* ftdic, int clock, unsigned short Fi, unsigned char Di, unsigned char Ni, unsigned char inv);
56void ResetSmartReader(struct ftdi_context* ftdic);
57void* ReaderThread(void *p);
58
59#endif // USE_PTHREAD
60#endif //HAVE_LIBUSB
Note: See TracBrowser for help on using the repository browser.