]> git.zerfleddert.de Git - proxmark3-svn/blame - client/comms.h
USB comms: part 2 towards @micolous PR#463 (#595)
[proxmark3-svn] / client / comms.h
CommitLineData
f5ecd97b 1//-----------------------------------------------------------------------------
2// Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4//
5// This code is licensed to you under the terms of the GNU GPL, version 2 or,
6// at your option, any later version. See the LICENSE.txt file for the text of
7// the license.
8//-----------------------------------------------------------------------------
9// Code for communicating with the proxmark3 hardware.
10//-----------------------------------------------------------------------------
11
12#ifndef COMMS_H_
13#define COMMS_H_
14
15#include <stdbool.h>
16#include <pthread.h>
17
18#include "usb_cmd.h"
19#include "uart.h"
20
21#ifndef CMD_BUFFER_SIZE
22#define CMD_BUFFER_SIZE 50
23#endif
24
25typedef struct {
26 // If TRUE, continue running the uart_receiver thread
27 bool run;
28
29 // Lock around serial port receives
30 pthread_mutex_t recv_lock;
31} receiver_arg;
32
61aaee35 33
34// Wrappers required as static variables can only be used in one file.
35void SetOffline(bool new_offline);
36bool IsOffline();
37
f5ecd97b 38void SendCommand(UsbCommand *c);
39
40void *uart_receiver(void *targ);
41void UsbCommandReceived(UsbCommand *UC);
42void clearCommandBuffer();
43bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeout, bool show_warning);
44bool WaitForResponseTimeout(uint32_t cmd, UsbCommand* response, size_t ms_timeout);
45bool WaitForResponse(uint32_t cmd, UsbCommand* response);
46
47extern serial_port sp;
f5ecd97b 48
49#endif // COMMS_H_
Impressum, Datenschutz