Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

milkymist: use -Wstrict-prototypes

And fix resulting warnings.
  • Loading branch information...
commit abec5421463abe3a95963dd386854c982bddd570 1 parent 555e97f
@wpwrak wpwrak authored sbourdeauducq committed
Showing with 96 additions and 93 deletions.
  1. +4 −1 software/include.mak
  2. +1 −1  software/include/base/blockdev.h
  3. +2 −2 software/include/base/board.h
  4. +4 −4 software/include/base/console.h
  5. +1 −1  software/include/base/fatfs.h
  6. +3 −3 software/include/base/irq.h
  7. +2 −2 software/include/base/stdlib.h
  8. +5 −5 software/include/base/system.h
  9. +4 −4 software/include/base/uart.h
  10. +1 −1  software/include/hal/brd.h
  11. +1 −1  software/include/hal/dmx.h
  12. +1 −1  software/include/hal/mem.h
  13. +2 −2 software/include/hal/pfpu.h
  14. +11 −11 software/include/hal/snd.h
  15. +3 −3 software/include/hal/time.h
  16. +2 −2 software/include/hal/tmu.h
  17. +1 −1  software/include/hal/ukb.h
  18. +2 −2 software/include/hal/usb.h
  19. +4 −4 software/include/hal/vga.h
  20. +1 −1  software/include/hal/vin.h
  21. +2 −2 software/include/net/microudp.h
  22. +5 −5 software/libbase/blockdev.c
  23. +1 −1  software/libhal/brd.c
  24. +2 −2 software/libhal/time.c
  25. +2 −2 software/libhal/ukb.c
  26. +3 −3 software/libhal/usb.c
  27. +11 −11 software/libhal/vga.c
  28. +6 −6 software/libhal/vin.c
  29. +3 −3 software/libnet/mdio.c
  30. +6 −6 software/libnet/microudp.c
View
5 software/include.mak
@@ -1,12 +1,14 @@
# Mico32 toolchain
#
CROSS_COMPILER=lm32-rtems4.11-
+
CC_normal := $(CROSS_COMPILER)gcc
AR_normal := $(CROSS_COMPILER)ar
AS_normal := $(CROSS_COMPILER)as
LD_normal := $(CROSS_COMPILER)ld
OBJCOPY_normal := $(CROSS_COMPILER)objcopy
RANLIB_normal := $(CROSS_COMPILER)ranlib
+
CC_quiet = @echo " CC " $@ && $(CROSS_COMPILER)gcc
AR_quiet = @echo " AR " $@ && $(CROSS_COMPILER)ar
AS_quiet = @echo " AS " $@ && $(CROSS_COMPILER)as
@@ -35,7 +37,8 @@ endif
INCLUDES_NOLIBC ?= -nostdinc -I$(MMDIR)/software/include/base
INCLUDES = $(INCLUDES_NOLIBC) -I$(MMDIR)/software/include -I$(MMDIR)/tools
ASFLAGS = $(INCLUDES) -nostdinc
-CFLAGS = -O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled \
+CFLAGS = -O9 -Wall -Wstrict-prototypes \
+ -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled \
-msign-extend-enabled -fno-builtin -fsigned-char \
-fsingle-precision-constant $(INCLUDES)
LDFLAGS = -nostdlib -nodefaultlibs
View
2  software/include/base/blockdev.h
@@ -24,7 +24,7 @@ enum {
int bd_init(int devnr);
int bd_readblock(unsigned int block, void *buffer);
-void bd_done();
+void bd_done(void);
int bd_has_part_table(int devnr);
View
4 software/include/base/board.h
@@ -27,8 +27,8 @@ struct board_desc {
};
const struct board_desc *get_board_desc_id(unsigned short int id);
-const struct board_desc *get_board_desc();
-int get_pcb_revision();
+const struct board_desc *get_board_desc(void);
+int get_pcb_revision(void);
void get_soc_version(unsigned int *major, unsigned int *minor, unsigned int *subminor, unsigned int *rc);
void get_soc_version_formatted(char *version);
View
8 software/include/base/console.h
@@ -19,14 +19,14 @@
#define __CONSOLE_H
typedef void (*console_write_hook)(char);
-typedef char (*console_read_hook)();
-typedef int (*console_read_nonblock_hook)();
+typedef char (*console_read_hook)(void);
+typedef int (*console_read_nonblock_hook)(void);
void console_set_write_hook(console_write_hook h);
void console_set_read_hook(console_read_hook r, console_read_nonblock_hook rn);
-char readchar();
-int readchar_nonblock();
+char readchar(void);
+int readchar_nonblock(void);
int puts(const char *s);
void putsnonl(const char *s);
View
2  software/include/base/fatfs.h
@@ -23,6 +23,6 @@ typedef int (*fatfs_dir_callback)(const char *, const char *, void *);
int fatfs_init(int devnr);
int fatfs_list_files(fatfs_dir_callback cb, void *param);
int fatfs_load(const char *filename, char *buffer, int size, int *realsize);
-void fatfs_done();
+void fatfs_done(void);
#endif /* __FATFS_H */
View
6 software/include/base/irq.h
@@ -23,7 +23,7 @@ static inline void irq_enable(unsigned int en)
__asm__ __volatile__("wcsr IE, %0" : : "r" (en));
}
-static inline unsigned int irq_getmask()
+static inline unsigned int irq_getmask(void)
{
unsigned int mask;
__asm__ __volatile__("rcsr %0, IM" : "=r" (mask));
@@ -35,7 +35,7 @@ static inline void irq_setmask(unsigned int mask)
__asm__ __volatile__("wcsr IM, %0" : : "r" (mask));
}
-static inline unsigned int irq_pending()
+static inline unsigned int irq_pending(void)
{
unsigned int pending;
__asm__ __volatile__("rcsr %0, IP" : "=r" (pending));
@@ -47,7 +47,7 @@ static inline void irq_ack(unsigned int mask)
__asm__ __volatile__("wcsr IP, %0" : : "r" (mask));
}
-static inline unsigned int irq_getie()
+static inline unsigned int irq_getie(void)
{
unsigned int ie;
__asm__ __volatile__("rcsr %0, IE" : "=r" (ie));
View
4 software/include/base/stdlib.h
@@ -49,8 +49,8 @@ char *number(char *buf, char *end, unsigned long num, int base, int size, int pr
long strtol(const char *nptr, char **endptr, int base);
float atof(const char *s);
-unsigned int rand();
-void abort();
+unsigned int rand(void);
+void abort(void);
void *malloc(size_t size);
void free(void *p);
View
10 software/include/base/system.h
@@ -18,10 +18,10 @@
#ifndef __SYSTEM_H
#define __SYSTEM_H
-void flush_cpu_icache();
-void flush_cpu_dcache();
-void flush_bridge_cache();
-__attribute__((noreturn)) void reboot();
-__attribute__((noreturn)) void reconf();
+void flush_cpu_icache(void);
+void flush_cpu_dcache(void);
+void flush_bridge_cache(void);
+__attribute__((noreturn)) void reboot(void);
+__attribute__((noreturn)) void reconf(void);
#endif /* __SYSTEM_H */
View
8 software/include/base/uart.h
@@ -18,12 +18,12 @@
#ifndef __UART_H
#define __UART_H
-void uart_init();
-void uart_isr();
+void uart_init(void);
+void uart_isr(void);
void uart_force_sync(int f);
void uart_write(char c);
-char uart_read();
-int uart_read_nonblock();
+char uart_read(void);
+int uart_read_nonblock(void);
#endif
View
2  software/include/hal/brd.h
@@ -20,6 +20,6 @@
extern const struct board_desc *brd_desc;
-void brd_init();
+void brd_init(void);
#endif /* __HAL_BRD_H */
View
2  software/include/hal/dmx.h
@@ -18,7 +18,7 @@
#ifndef __HAL_DMX_H
#define __HAL_DMX_H
-void dmx_init();
+void dmx_init(void);
void dmx_thru_mode(int thru);
void dmx_set(int channel, int value);
int dmx_get(int channel);
View
2  software/include/hal/mem.h
@@ -20,6 +20,6 @@
#define BANK_SDRAM (0)
-void mem_init();
+void mem_init(void);
#endif /* __HAL_MEM_H */
View
4 software/include/hal/pfpu.h
@@ -37,8 +37,8 @@ struct pfpu_td {
void *user; /* < for application use */
};
-void pfpu_init();
-void pfpu_isr();
+void pfpu_init(void);
+void pfpu_isr(void);
int pfpu_submit_task(struct pfpu_td *td);
#endif /* __HAL_PFPU_H */
View
22 software/include/hal/snd.h
@@ -20,28 +20,28 @@
#include <hw/ac97.h>
-void snd_init();
-void snd_isr_crrequest();
-void snd_isr_crreply();
-void snd_isr_dmar();
-void snd_isr_dmaw();
+void snd_init(void);
+void snd_isr_crrequest(void);
+void snd_isr_crreply(void);
+void snd_isr_dmar(void);
+void snd_isr_dmaw(void);
unsigned int snd_ac97_read(unsigned int addr);
void snd_ac97_write(unsigned int addr, unsigned int value);
typedef void (*snd_callback)(short *buffer, void *user);
-void snd_play_empty();
+void snd_play_empty(void);
int snd_play_refill(short *buffer);
void snd_play_start(snd_callback callback, unsigned int nsamples, void *user);
-void snd_play_stop();
-int snd_play_active();
+void snd_play_stop(void);
+int snd_play_active(void);
-void snd_record_empty();
+void snd_record_empty(void);
int snd_record_refill(short *buffer);
void snd_record_start(snd_callback callback, unsigned int nsamples, void *user);
-void snd_record_stop();
-int snd_record_active();
+void snd_record_stop(void);
+int snd_record_active(void);
/*
* Each sample has 2 channels and 16 bits per channel
View
6 software/include/hal/time.h
@@ -23,14 +23,14 @@ struct timestamp {
int usec;
};
-void time_init();
-void time_isr();
+void time_init(void);
+void time_isr(void);
void time_get(struct timestamp *ts);
void time_add(struct timestamp *dest, struct timestamp *delta);
void time_diff(struct timestamp *dest, struct timestamp *t1, struct timestamp *t0);
-void time_tick(); /* provided by app */
+void time_tick(void); /* provided by app */
#endif /* __HAL_TIME_H */
View
4 software/include/hal/tmu.h
@@ -51,8 +51,8 @@ struct tmu_td {
int tmu_ready;
-void tmu_init();
-void tmu_isr();
+void tmu_init(void);
+void tmu_isr(void);
int tmu_submit_task(struct tmu_td *td);
#endif /* __HAL_TMU_H */
View
2  software/include/hal/ukb.h
@@ -18,6 +18,6 @@
#ifndef __HAL_UKB_H
#define __HAL_UKB_H
-void ukb_init();
+void ukb_init(void);
#endif /* __HAL_UKB_H */
View
4 software/include/hal/usb.h
@@ -21,11 +21,11 @@
typedef void (*mouse_event_cb)(unsigned char buttons, char dx, char dy, unsigned char wheel);
typedef void (*keyboard_event_cb)(unsigned char modifiers, unsigned char key);
-void usb_init();
+void usb_init(void);
void usb_debug_enable(int en);
void usb_set_mouse_cb(mouse_event_cb cb);
void usb_set_keyboard_cb(keyboard_event_cb cb);
-void usb_isr();
+void usb_isr(void);
#endif /* __HAL_USB_H */
View
8 software/include/hal/vga.h
@@ -32,11 +32,11 @@ enum {
};
void vga_init(int blanked);
-void vga_blank();
-void vga_unblank();
-void vga_swap_buffers();
+void vga_blank(void);
+void vga_unblank(void);
+void vga_swap_buffers(void);
void vga_set_console(int console);
-int vga_get_console();
+int vga_get_console(void);
int vga_read_edid(char *buffer);
void vga_set_mode(int mode);
View
2  software/include/hal/vin.h
@@ -18,7 +18,7 @@
#ifndef __HAL_VIN_H
#define __HAL_VIN_H
-void vin_init();
+void vin_init(void);
unsigned char vin_read_reg(unsigned char addr);
void vin_write_reg(unsigned char addr, unsigned char val);
View
4 software/include/net/microudp.h
@@ -26,9 +26,9 @@ typedef void (*udp_callback)(unsigned int src_ip, unsigned short src_port, unsig
void microudp_start(unsigned char *macaddr, unsigned int ip);
int microudp_arp_resolve(unsigned int ip);
-void *microudp_get_tx_buffer();
+void *microudp_get_tx_buffer(void);
int microudp_send(unsigned short src_port, unsigned short dst_port, unsigned int length);
void microudp_set_callback(udp_callback callback);
-void microudp_service();
+void microudp_service(void);
#endif /* __NET_MICROUDP_H */
View
10 software/libbase/blockdev.c
@@ -23,19 +23,19 @@
//#define MEMCARD_DEBUG
-static void memcard_start_cmd_tx()
+static void memcard_start_cmd_tx(void)
{
CSR_MEMCARD_ENABLE = MEMCARD_ENABLE_CMD_TX;
}
-static void memcard_start_cmd_rx()
+static void memcard_start_cmd_rx(void)
{
CSR_MEMCARD_PENDING = MEMCARD_PENDING_CMD_RX;
CSR_MEMCARD_START = MEMCARD_START_CMD_RX;
CSR_MEMCARD_ENABLE = MEMCARD_ENABLE_CMD_RX;
}
-static void memcard_start_cmd_dat_rx()
+static void memcard_start_cmd_dat_rx(void)
{
CSR_MEMCARD_PENDING = MEMCARD_PENDING_CMD_RX|MEMCARD_PENDING_DAT_RX;
CSR_MEMCARD_START = MEMCARD_START_CMD_RX|MEMCARD_START_DAT_RX;
@@ -80,7 +80,7 @@ static void memcard_send_command(unsigned char cmd, unsigned int arg)
}
}
-static void memcard_send_dummy()
+static void memcard_send_dummy(void)
{
CSR_MEMCARD_CMD = 0xff;
while(CSR_MEMCARD_PENDING & MEMCARD_PENDING_CMD_TX);
@@ -170,7 +170,7 @@ static int memcard_receive_command_data(unsigned char *command, unsigned int *da
return 1;
}
-static int memcard_init()
+static int memcard_init(void)
{
unsigned char b[17];
unsigned int rca;
View
2  software/libhal/brd.c
@@ -29,7 +29,7 @@ const struct board_desc *brd_desc;
#define display_capability(cap, val) if(val) printf("BRD: "cap": Yes\n"); else printf("BRD: "cap": No\n")
-static void display_capabilities()
+static void display_capabilities(void)
{
unsigned int cap;
View
4 software/libhal/time.c
@@ -27,7 +27,7 @@
static int sec;
-void time_init()
+void time_init(void)
{
unsigned int mask;
@@ -43,7 +43,7 @@ void time_init()
printf("TIM: system timer started\n");
}
-void time_isr()
+void time_isr(void)
{
irq_ack(IRQ_TIMER0);
sec++;
View
4 software/libhal/ukb.c
@@ -27,7 +27,7 @@ static char rx_buf[UKB_RINGBUFFER_SIZE_RX];
static volatile unsigned int rx_produce;
static volatile unsigned int rx_consume;
-char ukb_readchar()
+char ukb_readchar(void)
{
char c;
@@ -37,7 +37,7 @@ char ukb_readchar()
return c;
}
-int ukb_readchar_nonblock()
+int ukb_readchar_nonblock(void)
{
return (rx_consume != rx_produce);
}
View
6 software/libhal/usb.c
@@ -42,7 +42,7 @@ unsigned char previous_keys[5];
static keyboard_event_cb keyboard_cb;
static int keyboard_consume;
-void usb_init()
+void usb_init(void)
{
int nwords;
int i;
@@ -86,7 +86,7 @@ void usb_debug_enable(int en)
debug_enable = en;
}
-static void flush_debug_buffer()
+static void flush_debug_buffer(void)
{
char debug_buffer_fmt[266];
int i;
@@ -112,7 +112,7 @@ void usb_set_keyboard_cb(keyboard_event_cb cb)
keyboard_cb = cb;
}
-void usb_isr()
+void usb_isr(void)
{
char c;
View
22 software/libhal/vga.c
@@ -46,7 +46,7 @@ unsigned short int *vga_frontbuffer; /* < buffer currently displayed (or request
unsigned short int *vga_backbuffer; /* < buffer currently drawn to, never read by HW */
unsigned short int *vga_lastbuffer; /* < buffer displayed just before (or HW finishing last scan) */
-static int i2c_init();
+static int i2c_init(void);
/* Text mode framebuffer */
static unsigned short int framebuffer_text[1024*768] __attribute__((aligned(32)));
@@ -78,7 +78,7 @@ void vga_init(int blanked)
console_set_write_hook(write_hook);
}
-void vga_blank()
+void vga_blank(void)
{
if(!vga_blanked) {
CSR_VGA_RESET = VGA_RESET;
@@ -86,7 +86,7 @@ void vga_blank()
}
}
-void vga_unblank()
+void vga_unblank(void)
{
if(vga_blanked) {
CSR_VGA_RESET = 0;
@@ -94,7 +94,7 @@ void vga_unblank()
}
}
-void vga_swap_buffers()
+void vga_swap_buffers(void)
{
unsigned short int *p;
@@ -123,7 +123,7 @@ void vga_set_console(int console)
CSR_VGA_BASEADDRESS = (unsigned int)vga_frontbuffer;
}
-int vga_get_console()
+int vga_get_console(void)
{
return console_mode;
}
@@ -131,7 +131,7 @@ int vga_get_console()
/* DDC */
int i2c_started;
-static int i2c_init()
+static int i2c_init(void)
{
unsigned int timeout;
@@ -144,7 +144,7 @@ static int i2c_init()
return timeout;
}
-static void i2c_delay()
+static void i2c_delay(void)
{
unsigned int i;
@@ -152,7 +152,7 @@ static void i2c_delay()
}
/* I2C bit-banging functions from http://en.wikipedia.org/wiki/I2c */
-static unsigned int i2c_read_bit()
+static unsigned int i2c_read_bit(void)
{
unsigned int bit;
@@ -181,7 +181,7 @@ static void i2c_write_bit(unsigned int bit)
CSR_VGA_DDC &= ~VGA_DDC_SDC;
}
-static void i2c_start_cond()
+static void i2c_start_cond(void)
{
if(i2c_started) {
/* set SDA to 1 */
@@ -197,7 +197,7 @@ static void i2c_start_cond()
i2c_started = 1;
}
-static void i2c_stop_cond()
+static void i2c_stop_cond(void)
{
/* set SDA to 0 */
CSR_VGA_DDC = VGA_DDC_SDAOE;
@@ -382,7 +382,7 @@ static void scroll_callback(struct tmu_td *td)
irq_setmask(oldmask);
}
-static void scroll()
+static void scroll(void)
{
if(tmu_ready) {
/* Hardware-accelerated scrolling */
View
12 software/libhal/vin.c
@@ -21,7 +21,7 @@
static int i2c_started;
-static int i2c_init()
+static int i2c_init(void)
{
unsigned int timeout;
@@ -34,7 +34,7 @@ static int i2c_init()
return timeout;
}
-static void i2c_delay()
+static void i2c_delay(void)
{
unsigned int i;
@@ -42,7 +42,7 @@ static void i2c_delay()
}
/* I2C bit-banging functions from http://en.wikipedia.org/wiki/I2c */
-static unsigned int i2c_read_bit()
+static unsigned int i2c_read_bit(void)
{
unsigned int bit;
@@ -71,7 +71,7 @@ static void i2c_write_bit(unsigned int bit)
CSR_BT656CAP_I2C &= ~BT656CAP_I2C_SDC;
}
-static void i2c_start_cond()
+static void i2c_start_cond(void)
{
if(i2c_started) {
/* set SDA to 1 */
@@ -86,7 +86,7 @@ static void i2c_start_cond()
i2c_started = 1;
}
-static void i2c_stop_cond()
+static void i2c_stop_cond(void)
{
/* set SDA to 0 */
CSR_BT656CAP_I2C = BT656CAP_I2C_SDAOE;
@@ -133,7 +133,7 @@ static const char vreg_dat[] = {
0x00, 0x41, 0x40, 0x40, 0x16, 0xC3, 0xE4, 0x04, 0x05, 0x80, 0x80, 0x20, 0x18, 0xED, 0xC5, 0x93, 0x00, 0xC9, 0x40, 0x3C, 0xCA, 0xD5, 0x50, 0x4E, 0xDD, 0x51, 0xA0, 0xEA, 0x3E, 0x0F, 0x3E, 0x00
};
-void vin_init()
+void vin_init(void)
{
int i;
View
6 software/libnet/mdio.c
@@ -18,7 +18,7 @@
#include <hw/minimac.h>
#include <net/mdio.h>
-static void delay()
+static void delay(void)
{
volatile int i;
for(i=0;i<1000;i++);
@@ -44,7 +44,7 @@ static void raw_write(unsigned int word, int bitcount)
}
}
-static unsigned int raw_read()
+static unsigned int raw_read(void)
{
unsigned int word;
unsigned int i;
@@ -62,7 +62,7 @@ static unsigned int raw_read()
return word;
}
-static void raw_turnaround()
+static void raw_turnaround(void)
{
CSR_MINIMAC_MDIO = MINIMAC_MDIO_CLK;
delay();
View
12 software/libnet/microudp.c
@@ -120,7 +120,7 @@ static ethernet_buffer *rxbuffer1;
static int txlen;
static ethernet_buffer *txbuffer;
-static void send_packet()
+static void send_packet(void)
{
unsigned int crc;
@@ -142,7 +142,7 @@ static unsigned int my_ip;
static unsigned char cached_mac[6];
static unsigned int cached_ip;
-static void process_arp()
+static void process_arp(void)
{
if(rxlen < 68) return;
if(rxbuffer->frame.contents.arp.hwtype != ARP_HWTYPE_ETHERNET) return;
@@ -253,7 +253,7 @@ static unsigned short ip_checksum(unsigned int r, void *buffer, unsigned int len
return r;
}
-void *microudp_get_tx_buffer()
+void *microudp_get_tx_buffer(void)
{
return txbuffer->frame.contents.udp.payload;
}
@@ -318,7 +318,7 @@ int microudp_send(unsigned short src_port, unsigned short dst_port, unsigned int
static udp_callback rx_callback;
-static void process_ip()
+static void process_ip(void)
{
if(rxlen < (sizeof(struct ethernet_header)+sizeof(struct udp_frame))) return;
/* We don't verify UDP and IP checksums and rely on the Ethernet checksum solely */
@@ -341,7 +341,7 @@ void microudp_set_callback(udp_callback callback)
rx_callback = callback;
}
-static void process_frame()
+static void process_frame(void)
{
int i;
unsigned int received_crc;
@@ -388,7 +388,7 @@ void microudp_start(unsigned char *macaddr, unsigned int ip)
CSR_MINIMAC_SETUP = 0;
}
-void microudp_service()
+void microudp_service(void)
{
if(irq_pending() & IRQ_ETHRX) {
if(CSR_MINIMAC_STATE0 == MINIMAC_STATE_PENDING) {
Please sign in to comment.
Something went wrong with that request. Please try again.