diff --git a/software/linux/Makefile b/software/linux/Makefile index 2785700..f24f417 100644 --- a/software/linux/Makefile +++ b/software/linux/Makefile @@ -5,7 +5,7 @@ OBJDIR = bin CC = clang -CFLAGS = -I ../sss7core/ -Os -Wall -Wstrict-prototypes -fPIC +CFLAGS = -DSSS7_THREADED -I ../sss7core/ -Os -Wall -Wstrict-prototypes -fPIC LDFLAGS = -pthread -Wl,--gc-sections all: start $(OBJDIR)/libsss7.so $(OBJDIR)/test diff --git a/software/sss7core/sss7.c b/software/sss7core/sss7.c index 4dc58ca..5120bf6 100644 --- a/software/sss7core/sss7.c +++ b/software/sss7core/sss7.c @@ -85,7 +85,7 @@ void sss7_process_rx(void) { uint8_t next_buffer_write = 0; sss7_timeout_counter = 0; - switch(sss7_state) { + switch((int) sss7_state) { case SSS7_IDLE: if(byte == SSS7_HEADER[0]) { sss7_state = SSS7_RX_HEADER; @@ -141,7 +141,7 @@ void sss7_process_rx(void) { void sss7_process_tx(void) { if(sss7_tx_last_ack) { uint8_t byte; - switch(sss7_state) { + switch((int) sss7_state) { case SSS7_TX_HEADER: sss7_send_byte(SSS7_HEADER[1]); sss7_state = SSS7_TX_PAYLOAD; @@ -178,7 +178,7 @@ void sss7_process_ticks(uint16_t ticks) { sss7_timeout_counter = sss7_timeout_counter + ticks; if(sss7_timeout_counter > sss7_timeout) { - switch(sss7_state) { + switch((int) sss7_state) { case SSS7_TX_HEADER: case SSS7_TX_PAYLOAD: case SSS7_TX_CRC: diff --git a/software/sss7core/sss7.h b/software/sss7core/sss7.h index db18204..3370bee 100644 --- a/software/sss7core/sss7.h +++ b/software/sss7core/sss7.h @@ -7,7 +7,9 @@ extern "C" { #include -#ifndef sss7_shared_modfier +#ifdef SSS7_THREADED +#define sss7_shared_modfier _Atomic +#else #define sss7_shared_modfier volatile #endif