]> git.zerfleddert.de Git - proxmark3-svn/blame - client/comms.h
Comms refactor (prerequisite of libproxmark work) (#371)
[proxmark3-svn] / client / comms.h
CommitLineData
afdcb8c1
MF
1#ifndef COMMS_H_
2#define COMMS_H_
3
4#include <stdbool.h>
5#include <pthread.h>
6
7#include "usb_cmd.h"
8#include "uart.h"
9
10#ifndef CMD_BUFFER_SIZE
11#define CMD_BUFFER_SIZE 50
12#endif
13
14#ifndef MAX_DEMOD_BUF_LEN
15#define MAX_DEMOD_BUF_LEN (1024*128)
16#endif
17
18#ifndef BIGBUF_SIZE
19#define BIGBUF_SIZE 40000
20#endif
21
22typedef struct {
23 // If TRUE, continue running the uart_receiver thread.
24 bool run;
25
26 // Lock around serial port receives
27 pthread_mutex_t recv_lock;
28} receiver_arg;
29
30
31// Wrappers required as static variables can only be used in one file.
32void SetSerialPort(serial_port* new_port);
33serial_port* GetSerialPort();
34void SetOffline(bool new_offline);
35bool IsOffline();
36
37void SendCommand(UsbCommand *c);
38void *uart_receiver(void *targ);
39void UsbCommandReceived(UsbCommand *UC);
40void clearCommandBuffer();
41bool WaitForResponseTimeoutW(uint64_t cmd, UsbCommand* response, size_t ms_timeout, bool show_warning);
42bool WaitForResponseTimeout(uint64_t cmd, UsbCommand* response, size_t ms_timeout);
43bool WaitForResponse(uint64_t cmd, UsbCommand* response);
44
45#endif // COMMS_H_
Impressum, Datenschutz