From 7cbf99e99cd9d6a585ac2fba54dd28f6d9f20543 Mon Sep 17 00:00:00 2001 From: Takashi Toyoshima Date: Mon, 2 Oct 2023 13:37:24 +0900 Subject: [PATCH] make it compile with SDCC 4.3 --- .gitignore | 4 ++++ jvsio_client.h | 14 +++++++------- jvsio_common_impl.h | 8 ++++---- jvsio_host.c | 6 +++--- jvsio_host.h | 6 +++--- jvsio_node.c | 14 +++++++------- jvsio_node.h | 2 +- makefile | 13 +++++++++++++ 8 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 makefile diff --git a/.gitignore b/.gitignore index af16660..2e49c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +*.asm +*.lst +*.rel +*.sym test/*.o test/out test/host_test diff --git a/jvsio_client.h b/jvsio_client.h index 8c6c207..f7e37c0 100644 --- a/jvsio_client.h +++ b/jvsio_client.h @@ -18,13 +18,13 @@ enum JVSIO_CommSupMode { // operaqtions, such as driving bus signals or controlling led hints. // Required for both client nodes and hosts. -int JVSIO_Client_isDataAvailable(); -void JVSIO_Client_willSend(); -void JVSIO_Client_willReceive(); +int JVSIO_Client_isDataAvailable(void); +void JVSIO_Client_willSend(void); +void JVSIO_Client_willReceive(void); void JVSIO_Client_send(uint8_t data); -uint8_t JVSIO_Client_receive(); +uint8_t JVSIO_Client_receive(void); void JVSIO_Client_dump(const char* str, uint8_t* data, uint8_t len); -bool JVSIO_Client_isSenseReady(); +bool JVSIO_Client_isSenseReady(void); // Required for client nodes. bool JVSIO_Client_receiveCommand(uint8_t node, @@ -37,8 +37,8 @@ void JVSIO_Client_setLed(bool ready); void JVSIO_Client_delayMicroseconds(unsigned int usec); // Required for hosts. -bool JVSIO_Client_isSenseConnected(); -uint32_t JVSIO_Client_getTick(); +bool JVSIO_Client_isSenseConnected(void); +uint32_t JVSIO_Client_getTick(void); void JVSIO_Client_ioIdReceived(uint8_t address, uint8_t* data, uint8_t len); void JVSIO_Client_commandRevReceived(uint8_t address, uint8_t rev); void JVSIO_Client_jvRevReceived(uint8_t address, uint8_t rev); diff --git a/jvsio_common_impl.h b/jvsio_common_impl.h index 11b5139..cc17d5d 100644 --- a/jvsio_common_impl.h +++ b/jvsio_common_impl.h @@ -24,7 +24,7 @@ static uint8_t nodes; static uint8_t address[2]; static bool downstream_ready; -static bool matchAddress() { +static bool matchAddress(void) { uint8_t target = rx_data[0]; for (uint8_t i = 0; i < nodes; ++i) { if (target == address[i]) { @@ -139,7 +139,7 @@ static void writeEscapedByte(uint8_t data) { } } -static void sendPacket() { +static void sendPacket(void) { JVSIO_Client_send(kSync); uint8_t sum = 0; @@ -152,13 +152,13 @@ static void sendPacket() { JVSIO_Client_willReceive(); } -static void pushOverflowStatus() { +static void pushOverflowStatus(void) { tx_data[0] = kHostAddress; tx_data[1] = 2; tx_data[2] = 0x04; } -static void pushUnknownCommandStatus() { +static void pushUnknownCommandStatus(void) { if (tx_report_size > 253) { return pushOverflowStatus(); } diff --git a/jvsio_host.c b/jvsio_host.c index 06c3d1b..5e672ed 100644 --- a/jvsio_host.c +++ b/jvsio_host.c @@ -85,7 +85,7 @@ static uint8_t* receiveStatus(uint8_t* len) { return &rx_data[2]; } -void JVSIO_Host_init() { +void JVSIO_Host_init(void) { state = kStateDisconnected; rx_size = 0; rx_read_ptr = 0; @@ -100,7 +100,7 @@ void JVSIO_Host_init() { JVSIO_Client_willReceive(); } -bool JVSIO_Host_run() { +bool JVSIO_Host_run(void) { uint8_t* status = 0; uint8_t status_len = 0; bool connected = JVSIO_Client_isSenseConnected(); @@ -381,7 +381,7 @@ bool JVSIO_Host_run() { return false; } -void JVSIO_Host_sync() { +void JVSIO_Host_sync(void) { if (state != kStateReady) return; state = kStateRequestSync; diff --git a/jvsio_host.h b/jvsio_host.h index 275f21d..b9eb169 100644 --- a/jvsio_host.h +++ b/jvsio_host.h @@ -7,8 +7,8 @@ #include -void JVSIO_Host_init(); -bool JVSIO_Host_run(); -void JVSIO_Host_sync(); +void JVSIO_Host_init(void); +bool JVSIO_Host_run(void); +void JVSIO_Host_sync(void); #endif // !defined(__JVSIO_HOST_H__) \ No newline at end of file diff --git a/jvsio_node.c b/jvsio_node.c index 741bc41..04d158a 100644 --- a/jvsio_node.c +++ b/jvsio_node.c @@ -12,17 +12,17 @@ static uint8_t new_address; static enum JVSIO_CommSupMode comm_mode; -static void senseNotReady() { +static void senseNotReady(void) { JVSIO_Client_setSense(false); JVSIO_Client_setLed(false); } -static void senseReady() { +static void senseReady(void) { JVSIO_Client_setSense(true); JVSIO_Client_setLed(true); } -static void sendStatus() { +static void sendStatus(void) { // Should not reply if the rx_receiving is reset, e.g. for broadcast commands. if (rx_receiving) { return; @@ -67,7 +67,7 @@ static void sendStatus() { sendPacket(); } -static void sendOkStatus() { +static void sendOkStatus(void) { if (tx_report_size > 253) { pushOverflowStatus(); } else { @@ -78,14 +78,14 @@ static void sendOkStatus() { sendStatus(); } -static void sendSumErrorStatus() { +static void sendSumErrorStatus(void) { tx_data[0] = kHostAddress; tx_data[1] = 2; tx_data[2] = 0x03; sendStatus(); } -static uint8_t getReceivingNode() { +static uint8_t getReceivingNode(void) { uint8_t node = kBroadcastAddress; for (uint8_t i = 0; i < nodes; ++i) { if (address[i] == rx_data[0]) { @@ -170,7 +170,7 @@ void JVSIO_Node_pushReport(uint8_t report) { } } -bool JVSIO_Node_isBusy() { +bool JVSIO_Node_isBusy(void) { return rx_receiving; } diff --git a/jvsio_node.h b/jvsio_node.h index 23212ee..cf79d12 100644 --- a/jvsio_node.h +++ b/jvsio_node.h @@ -11,6 +11,6 @@ void JVSIO_Node_init(uint8_t nodes); void JVSIO_Node_run(bool speculative); void JVSIO_Node_pushReport(uint8_t report); -bool JVSIO_Node_isBusy(); +bool JVSIO_Node_isBusy(void); #endif // !defined(__JVSIO_NODE_H__) \ No newline at end of file diff --git a/makefile b/makefile new file mode 100644 index 0000000..5a4fe3c --- /dev/null +++ b/makefile @@ -0,0 +1,13 @@ +CFLAGS = -V -mmcs51 --model-large --xram-size 0x1800 --xram-loc 0x0000 --code-size 0xec00 --stack-auto --Werror -Isrc --opt-code-speed +CC = sdcc +OBJS = jvsio_host.rel jvsio_node.rel + +.PHONY: all clean build + +all: $(OBJS) + +clean: + rm *.asm *.lst *.rel *.sym + +%.rel: %.c *.h + $(CC) -c $(CFLAGS) -o $@ $< \ No newline at end of file