Skip to content

Commit

Permalink
Properly declare functions with no arguments.
Browse files Browse the repository at this point in the history
This fixes sdcc compiler warning 283.
  • Loading branch information
vifino authored and whitequark committed Nov 28, 2023
1 parent 73fa811 commit 9167386
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion docs/build_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To start using it, create a source file...
#include <fx2regs.h>
int main() {
int main(void) {
IOA = OEA = 1;
while(1);
}
Expand Down
6 changes: 3 additions & 3 deletions docs/fx2ints_h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ To define a core interrupt handler, override the corresponding ``isr_`` function

.. code-block:: c
void isr_TF0() __interrupt(_INT_TF0) {
void isr_TF0(void) __interrupt(_INT_TF0) {
// TIMER0 has overflowed
}
Interrupts with flags in the ``EXIF`` register need to be reset manually:

.. code-block:: c
void isr_I2C() __interrupt(_INT_I2C) {
void isr_I2C(void) __interrupt(_INT_I2C) {
// I2C is done or errored
CLEAR_I2C_IRQ();
}
Expand All @@ -35,7 +35,7 @@ To define an autovectored interrupt handler, override the corresponding ``isr_``

.. code-block:: c
void isr_SOF() __interrupt {
void isr_SOF(void) __interrupt {
// Start of Frame packet has been received
CLEAR_USB_IRQ();
USBIRQ = _SOF;
Expand Down
4 changes: 2 additions & 2 deletions examples/blinky/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#include <fx2ints.h>

// Register an interrupt handler for TIMER0 overflow
void isr_TF0() __interrupt(_INT_TF0) {
void isr_TF0(void) __interrupt(_INT_TF0) {
static int i;
if(i++ % 64 == 0)
PA0 = !PA0;
}

int main() {
int main(void) {
// Configure pins
PA0 = 1; // set PA0 to high
OEA = 0b1; // set PA0 as output
Expand Down
6 changes: 3 additions & 3 deletions examples/boot-dfu-spiflash/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// The following routines should handle the multi-master nature of SPI flash usage in
// an application. E.g. if an FPGA is the primary user of the SPI flash, flash_bus_init() should
// also assert FPGA reset, and flash_bus_deinit() would deassert it.
void flash_bus_init() {
void flash_bus_init(void) {
OEA |= 0b0111;
}
void flash_bus_deinit() {
void flash_bus_deinit(void) {
OEA &= ~0b0111;
}

Expand Down Expand Up @@ -292,7 +292,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {
STALL_EP0();
}

int main() {
int main(void) {
CPUCS = _CLKSPD1;

flash_bus_deinit();
Expand Down
4 changes: 2 additions & 2 deletions examples/boot-uf2-dfu/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {

volatile bool pending_ep6_in;

void isr_IBN() __interrupt {
void isr_IBN(void) __interrupt {
pending_ep6_in = true;
CLEAR_USB_IRQ();
NAKIRQ = _IBN;
IBNIRQ = _IBNI_EP6;
}

int main() {
int main(void) {
CPUCS = _CLKSPD1;

REVCTL = _ENH_PKT|_DYN_OUT;
Expand Down
4 changes: 2 additions & 2 deletions examples/cdc-acm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {

volatile bool pending_ep6_in;

void isr_IBN() __interrupt {
void isr_IBN(void) __interrupt {
pending_ep6_in = true;
CLEAR_USB_IRQ();
NAKIRQ = _IBN;
IBNIRQ = _IBNI_EP6;
}

int main() {
int main(void) {
// Run core at 48 MHz fCLK.
CPUCS = _CLKSPD1;

Expand Down
2 changes: 1 addition & 1 deletion examples/printf/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

DEFINE_DEBUG_PUTCHAR_FN(PA0, 57600)

int main() {
int main(void) {
// Any of these will work at 57600 baud:
CPUCS = 0;
// CPUCS = _CLKSPD0;
Expand Down
4 changes: 2 additions & 2 deletions firmware/boot-cypress/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {
// requests A2/A9 work the same as in Cypress libraries by default.
uint8_t page_size = 0; // log2(page size in bytes)

void handle_pending_usb_setup() {
void handle_pending_usb_setup(void) {
__xdata struct usb_req_setup *req = (__xdata struct usb_req_setup *)SETUPDAT;

if(req->bmRequestType == (USB_RECIP_DEVICE|USB_TYPE_VENDOR|USB_DIR_OUT) &&
Expand Down Expand Up @@ -194,7 +194,7 @@ void handle_pending_usb_setup() {
STALL_EP0();
}

int main() {
int main(void) {
CPUCS = _CLKOE|_CLKSPD1;

// Don't re-enumerate. `fx2tool -B` will load this firmware to access EEPROM, and it
Expand Down
4 changes: 2 additions & 2 deletions firmware/boot-dfu/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ usb_dfu_status_t firmware_dnload(uint32_t address, __xdata uint8_t *data,
}
}

usb_dfu_status_t firmware_manifest() __reentrant {
usb_dfu_status_t firmware_manifest(void) __reentrant {
// Simulate committing the firmware. If this function is not necessary, it may simply be omitted,
// together with its entry in `usb_dfu_iface_state`.
delay_ms(1000);
Expand All @@ -193,7 +193,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {
STALL_EP0();
}

int main() {
int main(void) {
// Run core at 48 MHz fCLK.
CPUCS = _CLKSPD1;

Expand Down
4 changes: 2 additions & 2 deletions firmware/boot-uf2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {

volatile bool pending_ep6_in;

void isr_IBN() __interrupt {
void isr_IBN(void) __interrupt {
pending_ep6_in = true;
CLEAR_USB_IRQ();
NAKIRQ = _IBN;
IBNIRQ = _IBNI_EP6;
}

int main() {
int main(void) {
// Run core at 48 MHz fCLK.
CPUCS = _CLKSPD1;

Expand Down
2 changes: 1 addition & 1 deletion firmware/library/defautoisr.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <fx2ints.h>

void ISRNAME() __interrupt {}
void ISRNAME(void) __interrupt {}
2 changes: 1 addition & 1 deletion firmware/library/defisr.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <fx2ints.h>

void ISRNAME() __interrupt(INTNAME) {}
void ISRNAME(void) __interrupt(INTNAME) {}
2 changes: 1 addition & 1 deletion firmware/library/defusbgetconfig.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <fx2usb.h>

void handle_usb_get_configuration() {
void handle_usb_get_configuration(void) {
EP0BUF[0] = usb_config_value;
SETUP_EP0_BUF(1);
}
2 changes: 1 addition & 1 deletion firmware/library/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool i2c_start(uint8_t chip) {
return i2c_wait(/*need_ack=*/true);
}

bool i2c_stop() {
bool i2c_stop(void) {
if(I2CS & _BERR)
return false;

Expand Down
2 changes: 1 addition & 1 deletion firmware/library/include/fx2i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool i2c_start(uint8_t chip);
/**
* This function generates a stop condition.
*/
bool i2c_stop();
bool i2c_stop(void);

/**
* This function writes `len` bytes from `buf` to the I2C bus.
Expand Down
108 changes: 54 additions & 54 deletions firmware/library/include/fx2ints.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ enum fx2_core_interrupt {
#define CLEAR_INT5_IRQ() \
do { EXIF &= ~_IE5; } while(0)

void isr_IE0() __interrupt(_INT_IE0);
void isr_TF0() __interrupt(_INT_TF0);
void isr_IE1() __interrupt(_INT_IE1);
void isr_TF1() __interrupt(_INT_TF1);
void isr_RI_TI_0() __interrupt(_INT_RI_TI_0);
void isr_TF2() __interrupt(_INT_TF2);
void isr_RESUME() __interrupt(_INT_RESUME);
void isr_RI_TI_1() __interrupt(_INT_RI_TI_1);
void isr_USB() __interrupt(_INT_USB);
void isr_I2C() __interrupt(_INT_I2C);
void isr_GPIF_IE4() __interrupt(_INT_GPIF_IE4);
void isr_IE5() __interrupt(_INT_IE5);
void isr_IE6() __interrupt(_INT_IE6);
void isr_IE0(void) __interrupt(_INT_IE0);
void isr_TF0(void) __interrupt(_INT_TF0);
void isr_IE1(void) __interrupt(_INT_IE1);
void isr_TF1(void) __interrupt(_INT_TF1);
void isr_RI_TI_0(void) __interrupt(_INT_RI_TI_0);
void isr_TF2(void) __interrupt(_INT_TF2);
void isr_RESUME(void) __interrupt(_INT_RESUME);
void isr_RI_TI_1(void) __interrupt(_INT_RI_TI_1);
void isr_USB(void) __interrupt(_INT_USB);
void isr_I2C(void) __interrupt(_INT_I2C);
void isr_GPIF_IE4(void) __interrupt(_INT_GPIF_IE4);
void isr_IE5(void) __interrupt(_INT_IE5);
void isr_IE6(void) __interrupt(_INT_IE6);

/**@}*/

Expand All @@ -74,33 +74,33 @@ void isr_IE6() __interrupt(_INT_IE6);
#define CLEAR_USB_IRQ() \
do { EXIF &= ~_USBINT; } while(0)

void isr_SUDAV() __interrupt;
void isr_SOF() __interrupt;
void isr_SUTOK() __interrupt;
void isr_SUSPEND() __interrupt;
void isr_USBRESET() __interrupt;
void isr_HISPEED() __interrupt;
void isr_EP0ACK() __interrupt;
void isr_EP0IN() __interrupt;
void isr_EP0OUT() __interrupt;
void isr_EP1IN() __interrupt;
void isr_EP1OUT() __interrupt;
void isr_EP2() __interrupt;
void isr_EP4() __interrupt;
void isr_EP6() __interrupt;
void isr_EP8() __interrupt;
void isr_IBN() __interrupt;
void isr_EP0PING() __interrupt;
void isr_EP1PING() __interrupt;
void isr_EP2PING() __interrupt;
void isr_EP4PING() __interrupt;
void isr_EP6PING() __interrupt;
void isr_EP8PING() __interrupt;
void isr_ERRLIMIT() __interrupt;
void isr_EP2ISOERR() __interrupt;
void isr_EP4ISOERR() __interrupt;
void isr_EP6ISOERR() __interrupt;
void isr_EP8ISOERR() __interrupt;
void isr_SUDAV(void) __interrupt;
void isr_SOF(void) __interrupt;
void isr_SUTOK(void) __interrupt;
void isr_SUSPEND(void) __interrupt;
void isr_USBRESET(void) __interrupt;
void isr_HISPEED(void) __interrupt;
void isr_EP0ACK(void) __interrupt;
void isr_EP0IN(void) __interrupt;
void isr_EP0OUT(void) __interrupt;
void isr_EP1IN(void) __interrupt;
void isr_EP1OUT(void) __interrupt;
void isr_EP2(void) __interrupt;
void isr_EP4(void) __interrupt;
void isr_EP6(void) __interrupt;
void isr_EP8(void) __interrupt;
void isr_IBN(void) __interrupt;
void isr_EP0PING(void) __interrupt;
void isr_EP1PING(void) __interrupt;
void isr_EP2PING(void) __interrupt;
void isr_EP4PING(void) __interrupt;
void isr_EP6PING(void) __interrupt;
void isr_EP8PING(void) __interrupt;
void isr_ERRLIMIT(void) __interrupt;
void isr_EP2ISOERR(void) __interrupt;
void isr_EP4ISOERR(void) __interrupt;
void isr_EP6ISOERR(void) __interrupt;
void isr_EP8ISOERR(void) __interrupt;

/**@}*/

Expand All @@ -123,20 +123,20 @@ void isr_EP8ISOERR() __interrupt;
#define CLEAR_GPIF_IRQ() \
do { EXIF &= ~_IE4; } while(0)

void isr_EP2PF() __interrupt;
void isr_EP4PF() __interrupt;
void isr_EP6PF() __interrupt;
void isr_EP8PF() __interrupt;
void isr_EP2EF() __interrupt;
void isr_EP4EF() __interrupt;
void isr_EP6EF() __interrupt;
void isr_EP8EF() __interrupt;
void isr_EP2FF() __interrupt;
void isr_EP4FF() __interrupt;
void isr_EP6FF() __interrupt;
void isr_EP8FF() __interrupt;
void isr_GPIFDONE() __interrupt;
void isr_GPIFWF() __interrupt;
void isr_EP2PF(void) __interrupt;
void isr_EP4PF(void) __interrupt;
void isr_EP6PF(void) __interrupt;
void isr_EP8PF(void) __interrupt;
void isr_EP2EF(void) __interrupt;
void isr_EP4EF(void) __interrupt;
void isr_EP6EF(void) __interrupt;
void isr_EP8EF(void) __interrupt;
void isr_EP2FF(void) __interrupt;
void isr_EP4FF(void) __interrupt;
void isr_EP6FF(void) __interrupt;
void isr_EP8FF(void) __interrupt;
void isr_GPIFDONE(void) __interrupt;
void isr_GPIFWF(void) __interrupt;

/**@}*/

Expand Down
12 changes: 6 additions & 6 deletions firmware/library/include/fx2spiflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
__xdata uint8_t _##name##_spiflash_buf[4];

#define _DEFINE_SPIFLASH_INIT_FN(name, cs, sck, si, so) \
void name##_init() { \
void name##_init(void) { \
__asm setb _ASM_REG(cs) __endasm; \
__asm setb _ASM_REG(sck) __endasm; \
__asm setb _ASM_REG(si) __endasm; \
}

#define _DEFINE_SPIFLASH_RDP_FN(name, cs) \
void name##_rdp() { \
void name##_rdp(void) { \
_##name##_spiflash_buf[0] = 0xAB; \
__asm clr _ASM_REG(cs) __endasm; \
_##name##_spi_wr(_##name##_spiflash_buf, 1); \
__asm setb _ASM_REG(cs) __endasm; \
}

#define _DEFINE_SPIFLASH_DP_FN(name, cs) \
void name##_dp() { \
void name##_dp(void) { \
_##name##_spiflash_buf[0] = 0xB9; \
__asm clr _ASM_REG(cs) __endasm; \
_##name##_spi_wr(_##name##_spiflash_buf, 1); \
Expand All @@ -44,15 +44,15 @@
}

#define _DEFINE_SPIFLASH_WREN_FN(name, cs) \
void name##_wren() { \
void name##_wren(void) { \
_##name##_spiflash_buf[0] = 0x06; \
__asm clr _ASM_REG(cs) __endasm; \
_##name##_spi_wr(_##name##_spiflash_buf, 1); \
__asm setb _ASM_REG(cs) __endasm; \
}

#define _DEFINE_SPIFLASH_RDSR_FN(name, cs) \
uint8_t name##_rdsr() { \
uint8_t name##_rdsr(void) { \
_##name##_spiflash_buf[0] = 0x05; \
__asm clr _ASM_REG(cs) __endasm; \
_##name##_spi_wr(_##name##_spiflash_buf, 1); \
Expand All @@ -62,7 +62,7 @@
}

#define _DEFINE_SPIFLASH_CE_FN(name, cs) \
void name##_ce() { \
void name##_ce(void) { \
_##name##_spiflash_buf[0] = 0x60; \
__asm clr _ASM_REG(cs) __endasm; \
_##name##_spi_wr(_##name##_spiflash_buf, 1); \
Expand Down
2 changes: 1 addition & 1 deletion firmware/library/include/fx2usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool handle_usb_set_configuration(uint8_t config_value);
* This callback has a default implementation that sets up an EP0 IN transfer
* with value `usb_config_value`.
*/
void handle_usb_get_configuration();
void handle_usb_get_configuration(void);

/**
* Callback for the standard Set Interface request.
Expand Down
Loading

0 comments on commit 9167386

Please sign in to comment.