USB comms: part 4 towards @micolous PR #463

* make uart_communication(), storeCommand() and getCommand() static in comms.c
* move receiver thread creation and respective mutexes to comms.c
* add mutex and signal for tx buffer
* use comms.c for flasher as well
* remove comm functions from client/proxmark3.h
* this completes isolating all USB communication related functions in comms.c
* don't assume a port to be defined by a name. Change parameter in OpenProxmark() to void*
* comms.c: set sp and serial_port_name to NULL when offline
This commit is contained in:
pwpiwi 2018-06-03 14:25:20 +02:00 committed by GitHub
commit ad939de501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 274 additions and 248 deletions

View file

@ -22,24 +22,14 @@
#define CMD_BUFFER_SIZE 50
#endif
typedef struct {
// If TRUE, continue running the uart_receiver thread
bool run;
// Lock around serial port receives
pthread_mutex_t recv_lock;
} receiver_arg;
void SetOffline(bool new_offline);
bool IsOffline();
bool OpenProxmark(char *portname, bool waitCOMPort, int timeout);
bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode);
void CloseProxmark(void);
void SendCommand(UsbCommand *c);
void *uart_receiver(void *targ);
void clearCommandBuffer();
bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeout, bool show_warning);
bool WaitForResponseTimeout(uint32_t cmd, UsbCommand* response, size_t ms_timeout);