Skip to content

Commit

Permalink
make it compile with SDCC 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
toyoshim committed Oct 2, 2023
1 parent 5809a55 commit 7cbf99e
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 25 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.asm
*.lst
*.rel
*.sym
test/*.o
test/out
test/host_test
Expand Down
14 changes: 7 additions & 7 deletions jvsio_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions jvsio_common_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down Expand Up @@ -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;

Expand All @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions jvsio_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions jvsio_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <stdbool.h>

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__)
14 changes: 7 additions & 7 deletions jvsio_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,7 +67,7 @@ static void sendStatus() {
sendPacket();
}

static void sendOkStatus() {
static void sendOkStatus(void) {
if (tx_report_size > 253) {
pushOverflowStatus();
} else {
Expand All @@ -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]) {
Expand Down Expand Up @@ -170,7 +170,7 @@ void JVSIO_Node_pushReport(uint8_t report) {
}
}

bool JVSIO_Node_isBusy() {
bool JVSIO_Node_isBusy(void) {
return rx_receiving;
}

Expand Down
2 changes: 1 addition & 1 deletion jvsio_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
13 changes: 13 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -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 $@ $<

0 comments on commit 7cbf99e

Please sign in to comment.