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

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

added the base for the new code for the smartreader. The code isn't called yet

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