USB comm: prepare for @micolous change (PR#463) (#587)

* move communication related code from proxmark3.c and cmdmain.c to new file comms.c
* replace byte_t by uint8_t in uart_posix.c and uart_win32.c
* move OpenProxmark() and CloseProxmark() from flasher.c to flash.c
* move print_lock mutex including initializer to ui.c
* minor changes in printing help texts
* no changes in comms functionality yet
This commit is contained in:
pwpiwi 2018-03-31 09:52:43 +02:00 committed by GitHub
commit f5ecd97b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 384 additions and 307 deletions

View file

@ -39,7 +39,15 @@
#include <stdint.h>
#include <stdbool.h>
typedef unsigned char byte_t;
/* Used to substitute for an example serial port path on each platform.
*/
#ifdef _WIN32
#define SERIAL_PORT_H "com3"
#elif __APPLE__
#define SERIAL_PORT_H "/dev/tty.usbmodem*"
#else
#define SERIAL_PORT_H "/dev/ttyACM0"
#endif
/* serial_port is declared as a void*, which you should cast to whatever type
* makes sense to your connection method. Both the posix and win32
@ -78,13 +86,13 @@ void uart_close(const serial_port sp);
* partial read may have completed into the buffer by the corresponding
* implementation, so pszRxLen should be checked to see if any data was written.
*/
bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t pszMaxRxLen, size_t* pszRxLen);
bool uart_receive(const serial_port sp, uint8_t* pbtRx, size_t pszMaxRxLen, size_t* pszRxLen);
/* Sends a buffer to a given serial port.
* pbtTx: A pointer to a buffer containing the data to send.
* szTxLen: The amount of data to be sent.
*/
bool uart_send(const serial_port sp, const byte_t* pbtTx, const size_t szTxLen);
bool uart_send(const serial_port sp, const uint8_t* pbtTx, const size_t szTxLen);
/* Sets the current speed of the serial port, in baud.
*/