mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
changing {} style to match majority of previous style
This commit is contained in:
parent
da6cdf014b
commit
961d929f4d
320 changed files with 5502 additions and 10485 deletions
|
@ -73,8 +73,7 @@ struct timeval timeout = {
|
|||
.tv_usec = 30000 // 30 000 micro seconds
|
||||
};
|
||||
|
||||
serial_port uart_open(const char *pcPortName)
|
||||
{
|
||||
serial_port uart_open(const char *pcPortName) {
|
||||
serial_port_unix *sp = calloc(sizeof(serial_port_unix), sizeof(uint8_t));
|
||||
if (sp == 0) return INVALID_SERIAL_PORT;
|
||||
|
||||
|
@ -215,8 +214,7 @@ serial_port uart_open(const char *pcPortName)
|
|||
return sp;
|
||||
}
|
||||
|
||||
void uart_close(const serial_port sp)
|
||||
{
|
||||
void uart_close(const serial_port sp) {
|
||||
serial_port_unix *spu = (serial_port_unix *)sp;
|
||||
tcflush(spu->fd, TCIOFLUSH);
|
||||
tcsetattr(spu->fd, TCSANOW, &(spu->tiOld));
|
||||
|
@ -236,8 +234,7 @@ void uart_close(const serial_port sp)
|
|||
free(sp);
|
||||
}
|
||||
|
||||
bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size_t *pszRxLen)
|
||||
{
|
||||
bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size_t *pszRxLen) {
|
||||
int res;
|
||||
int byteCount;
|
||||
fd_set rfds;
|
||||
|
@ -296,8 +293,7 @@ bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size
|
|||
return true;
|
||||
}
|
||||
|
||||
bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len)
|
||||
{
|
||||
bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len) {
|
||||
int32_t res;
|
||||
size_t pos = 0;
|
||||
fd_set rfds;
|
||||
|
@ -333,8 +329,7 @@ bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
||||
{
|
||||
bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
||||
const serial_port_unix *spu = (serial_port_unix *)sp;
|
||||
speed_t stPortSpeed;
|
||||
switch (uiPortSpeed) {
|
||||
|
@ -422,8 +417,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
|||
return (tcsetattr(spu->fd, TCSANOW, &ti) != -1);
|
||||
}
|
||||
|
||||
uint32_t uart_get_speed(const serial_port sp)
|
||||
{
|
||||
uint32_t uart_get_speed(const serial_port sp) {
|
||||
struct termios ti;
|
||||
uint32_t uiPortSpeed;
|
||||
const serial_port_unix *spu = (serial_port_unix *)sp;
|
||||
|
|
|
@ -48,8 +48,7 @@ typedef struct {
|
|||
COMMTIMEOUTS ct; // Serial port time-out configuration
|
||||
} serial_port_windows;
|
||||
|
||||
serial_port uart_open(const char *pcPortName)
|
||||
{
|
||||
serial_port uart_open(const char *pcPortName) {
|
||||
char acPortName[255];
|
||||
serial_port_windows *sp = calloc(sizeof(serial_port_windows), sizeof(uint8_t));
|
||||
|
||||
|
@ -128,15 +127,13 @@ serial_port uart_open(const char *pcPortName)
|
|||
return sp;
|
||||
}
|
||||
|
||||
void uart_close(const serial_port sp)
|
||||
{
|
||||
void uart_close(const serial_port sp) {
|
||||
if (((serial_port_windows *)sp)->hPort != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(((serial_port_windows *)sp)->hPort);
|
||||
free(sp);
|
||||
}
|
||||
|
||||
bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
||||
{
|
||||
bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
||||
serial_port_windows *spw;
|
||||
|
||||
// Set port speed (Input and Output)
|
||||
|
@ -160,8 +157,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32_t uart_get_speed(const serial_port sp)
|
||||
{
|
||||
uint32_t uart_get_speed(const serial_port sp) {
|
||||
const serial_port_windows *spw = (serial_port_windows *)sp;
|
||||
if (!GetCommState(spw->hPort, (serial_port) & spw->dcb))
|
||||
return spw->dcb.BaudRate;
|
||||
|
@ -169,13 +165,11 @@ uint32_t uart_get_speed(const serial_port sp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool uart_receive(const serial_port sp, uint8_t *p_rx, size_t pszMaxRxLen, size_t *len)
|
||||
{
|
||||
bool uart_receive(const serial_port sp, uint8_t *p_rx, size_t pszMaxRxLen, size_t *len) {
|
||||
return ReadFile(((serial_port_windows *)sp)->hPort, p_rx, pszMaxRxLen, (LPDWORD)len, NULL);
|
||||
}
|
||||
|
||||
bool uart_send(const serial_port sp, const uint8_t *p_tx, const size_t len)
|
||||
{
|
||||
bool uart_send(const serial_port sp, const uint8_t *p_tx, const size_t len) {
|
||||
DWORD txlen = 0;
|
||||
return WriteFile(((serial_port_windows *)sp)->hPort, p_tx, len, &txlen, NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue