Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branches 'master' and 'gps-sdr-testing' into gps-sdr-testing

  • Loading branch information...
commit b1c6d6697193cefa99449bb2a00d757d7baceff4 2 parents f9a4ec3 + 832e989
Cristian Paul Peñaranda Rojas authored
Showing with 1,023 additions and 1,636 deletions.
  1. +1 −1  Makefile
  2. +5 −1 software/include.mak
  3. +1 −1  software/include/base/blockdev.h
  4. +2 −2 software/include/base/board.h
  5. +4 −4 software/include/base/console.h
  6. +1 −1  software/include/base/fatfs.h
  7. +3 −3 software/include/base/irq.h
  8. +0 −86 software/include/base/math.h
  9. +2 −2 software/include/base/stdlib.h
  10. +5 −5 software/include/base/system.h
  11. +4 −4 software/include/base/uart.h
  12. +10 −10 software/include/fpvm/ast.h
  13. +11 −10 software/include/fpvm/fpvm.h
  14. +1 −1  software/include/fpvm/pfpu.h
  15. +18 −0 software/include/fpvm/symbol.h
  16. +1 −1  software/include/hal/brd.h
  17. +1 −1  software/include/hal/dmx.h
  18. +1 −1  software/include/hal/mem.h
  19. +2 −2 software/include/hal/pfpu.h
  20. +11 −11 software/include/hal/snd.h
  21. +3 −3 software/include/hal/time.h
  22. +2 −2 software/include/hal/tmu.h
  23. +1 −1  software/include/hal/ukb.h
  24. +2 −2 software/include/hal/usb.h
  25. +4 −4 software/include/hal/vga.h
  26. +1 −1  software/include/hal/vin.h
  27. +2 −2 software/include/net/microudp.h
  28. +6 −6 software/libbase/blockdev.c
  29. +2 −2 software/libbase/board.c
  30. +2 −2 software/libbase/console.c
  31. +1 −1  software/libbase/fatfs.c
  32. +2 −2 software/libbase/libc.c
  33. +1 −2  software/libbase/softfloat.c
  34. +5 −5 software/libbase/system.c
  35. +5 −5 software/libbase/uart.c
  36. +0 −1  software/libbase/vsnprintf.c
  37. +3 −11 software/libfpvm/Makefile
  38. +59 −24 software/libfpvm/fpvm.c
  39. +1 −1  software/libfpvm/pfpu.c
  40. +18 −3 software/libfpvm/x86-linux/Makefile
  41. +2 −2 software/libhal/brd.c
  42. +1 −1  software/libhal/dmx.c
  43. +1 −1  software/libhal/mem.c
  44. +2 −2 software/libhal/pfpu.c
  45. +11 −11 software/libhal/snd.c
  46. +2 −2 software/libhal/time.c
  47. +2 −2 software/libhal/tmu.c
  48. +3 −3 software/libhal/ukb.c
  49. +3 −3 software/libhal/usb.c
  50. +11 −11 software/libhal/vga.c
  51. +6 −6 software/libhal/vin.c
  52. +0 −47 software/libmath/Makefile
  53. +0 −35 software/libmath/acosf.c
  54. +0 −85 software/libmath/asincosf.c
  55. +0 −36 software/libmath/asinf.c
  56. +0 −48 software/libmath/atan2f.c
  57. +0 −73 software/libmath/atanf.c
  58. +0 −35 software/libmath/ceilf.c
  59. +0 −33 software/libmath/cosf.c
  60. +0 −32 software/libmath/coshf.c
  61. +0 −44 software/libmath/cotf.c
  62. +0 −89 software/libmath/expf.c
  63. +0 −34 software/libmath/fabsf.c
  64. +0 −35 software/libmath/floorf.c
  65. +0 −40 software/libmath/frexpf.c
  66. +0 −39 software/libmath/ldexpf.c
  67. +0 −30 software/libmath/log10f.c
  68. +0 −69 software/libmath/logf.c
  69. +0 −31 software/libmath/modff.c
  70. +0 −34 software/libmath/powf.c
  71. +0 −89 software/libmath/sincosf.c
  72. +0 −92 software/libmath/sincoshf.c
  73. +0 −33 software/libmath/sinf.c
  74. +0 −32 software/libmath/sinhf.c
  75. +0 −54 software/libmath/sqrtf.c
  76. +0 −88 software/libmath/tancotf.c
  77. +0 −33 software/libmath/tanf.c
  78. +0 −63 software/libmath/tanhf.c
  79. +3 −3 software/libnet/mdio.c
  80. +6 −6 software/libnet/microudp.c
  81. +0 −1  software/update_depend.sh
  82. +2 −2 tools/Makefile
  83. +65 −0 tools/asm/Makefile
  84. +68 −0 tools/asm/asm.l
  85. +174 −0 tools/asm/asm.y
  86. +80 −0 tools/asm/fpvm
  87. +86 −0 tools/asm/mod.fpvm
  88. +37 −0 tools/asm/pfpu
  89. +180 −0 tools/asm/pfpuasm.c
  90. +74 −0 tools/asm/pfpuasm.h
2  Makefile
View
@@ -10,7 +10,7 @@ BASEDIR=${CURDIR}
SYNTOOL?=xst
BOARD?=milkymist-one
-SDK_DIRS=libbase libmath libhal libfpvm libnet
+SDK_DIRS=libbase libhal libfpvm libnet
SW_DIRS=${SDK_DIRS} libhpdmc libfpvm libfpvm/x86-linux libfpvm/lm32-linux bios
CORE_DIRS=ac97 bt656cap conbus dmx fmlbrg fmlmeter hpdmc_ddr32 \
6 software/include.mak
View
@@ -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,9 @@ 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 \
+# later: -Wmissing-prototypes
+CFLAGS = -O9 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
+ -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled \
-msign-extend-enabled -fno-builtin -fsigned-char \
-fsingle-precision-constant $(INCLUDES)
LDFLAGS = -nostdlib -nodefaultlibs
2  software/include/base/blockdev.h
View
@@ -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);
4 software/include/base/board.h
View
@@ -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);
8 software/include/base/console.h
View
@@ -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);
2  software/include/base/fatfs.h
View
@@ -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 */
6 software/include/base/irq.h
View
@@ -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));
86 software/include/base/math.h
View
@@ -1,86 +0,0 @@
-/*-------------------------------------------------------------------------
- math.h: Floating point math function declarations
-
- Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
- Adopted for the PIC14 port 2006 by Raphael Neider <rneider AT web.de>
-
- Copyright (C) 2001 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------*/
-
-/*
-** $Id: math.h 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#ifndef __MATH_H
-#define __MATH_H
-
-#define PI 3.1415926536
-#define TWO_PI 6.2831853071
-#define HALF_PI 1.5707963268
-#define QUART_PI 0.7853981634
-#define iPI 0.3183098862
-#define iTWO_PI 0.1591549431
-#define TWO_O_PI 0.6366197724
-
-// EPS=B**(-t/2), where B is the radix of the floating-point representation
-// and there are t base-B digits in the significand. Therefore, for floats
-// EPS=2**(-12). Also define EPS2=EPS*EPS.
-#define EPS 244.14062E-6
-#define EPS2 59.6046E-9
-#define XMAX 3.402823466E+38
-
-union float_long
-{
- float f;
- long l;
-};
-
-/**********************************************
- * Prototypes for float ANSI C math functions *
- **********************************************/
-
-/* Trigonometric functions */
-float sinf(const float x);
-float cosf(const float x);
-float tanf(const float x);
-float cotf(const float x);
-float asinf(const float x);
-float acosf(const float x);
-float atanf(const float x);
-float atan2f(const float x, const float y);
-
-/* Hyperbolic functions */
-float sinhf(const float x);
-float coshf(const float x);
-float tanhf(const float x);
-
-/* Exponential, logarithmic and power functions */
-float expf(const float x);
-float logf(const float x);
-float log10f(const float x);
-float powf(const float x, const float y);
-float sqrtf(const float a);
-
-/* Nearest integer, absolute value, and remainder functions */
-float fabsf(const float x);
-float frexpf(const float x, int *pw2);
-float ldexpf(const float x, const int pw2);
-float ceilf(float x);
-float floorf(float x);
-float modff(float x, float *y);
-
-#endif /* __MATH_H */
4 software/include/base/stdlib.h
View
@@ -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);
10 software/include/base/system.h
View
@@ -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 */
8 software/include/base/uart.h
View
@@ -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
20 software/include/fpvm/ast.h
View
@@ -40,13 +40,16 @@ enum ast_op {
op_if,
op_tsign,
op_quake,
- op_not,
+ op_negate,
op_sqr,
op_sqrt,
op_invsqrt,
op_min,
op_max,
op_int,
+ op_bnot,
+ op_band,
+ op_bor,
};
/* maximum supported arity is 3 */
@@ -58,19 +61,16 @@ struct ast_branches {
struct ast_node {
enum ast_op op;
- /*
- * label is an empty string:
- * node is a constant
- * label is not an empty string and branch A is null:
- * node is variable "label"
- * label is not an empty string and branch A is not null:
- * node is function/operator "label"
- */
- const char *label;
+ struct fpvm_sym *sym;
union {
struct ast_branches branches;
float constant;
} contents;
};
+static inline int node_is_op(const struct ast_node *n)
+{
+ return n->op >= op_plus;
+}
+
#endif /* __FPVM_AST_H */
21 software/include/fpvm/fpvm.h
View
@@ -26,6 +26,7 @@
#include <fpvm/is.h>
#include <fpvm/ast.h>
+#include <fpvm/symbol.h>
#define FPVM_MAXBINDINGS 128
#define FPVM_MAXTBINDINGS 128
@@ -37,19 +38,19 @@
#define FPVM_MAXERRLEN 64
-typedef void (*fpvm_bind_callback)(void *, const char *, int);
+typedef void (*fpvm_bind_callback)(void *, struct fpvm_sym *, int);
struct fpvm_binding {
int isvar;
union {
float c;
- const char *v;
+ struct fpvm_sym *v;
} b;
};
struct fpvm_tbinding {
int reg;
- const char *sym;
+ struct fpvm_sym *sym;
};
enum {
@@ -102,7 +103,7 @@ struct fpvm_fragment {
int vector_mode;
};
-extern const char *_Xi, *_Yi, *_Xo, *_Yo;
+extern struct fpvm_sym *_Xi, *_Yi, *_Xo, *_Yo;
const char *fpvm_version(void);
@@ -111,13 +112,13 @@ const char *fpvm_get_last_error(struct fpvm_fragment *fragment);
void fpvm_set_bind_mode(struct fpvm_fragment *fragment, int bind_mode);
void fpvm_set_bind_callback(struct fpvm_fragment *fragment, fpvm_bind_callback callback, void *user);
-int fpvm_bind(struct fpvm_fragment *fragment, const char *sym);
-void fpvm_set_xin(struct fpvm_fragment *fragment, const char *sym);
-void fpvm_set_yin(struct fpvm_fragment *fragment, const char *sym);
-void fpvm_set_xout(struct fpvm_fragment *fragment, const char *sym);
-void fpvm_set_yout(struct fpvm_fragment *fragment, const char *sym);
+int fpvm_bind(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_xin(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_yin(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_xout(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
+void fpvm_set_yout(struct fpvm_fragment *fragment, struct fpvm_sym *sym);
-int fpvm_do_assign(struct fpvm_fragment *fragment, const char *dest,
+int fpvm_do_assign(struct fpvm_fragment *fragment, struct fpvm_sym *dest,
struct ast_node *n);
void fpvm_get_references(struct fpvm_fragment *fragment, int *references);
2  software/include/fpvm/pfpu.h
View
@@ -22,6 +22,6 @@
#define pfpu_to_fpvm(x) (x)
int pfpu_get_latency(int opcode);
-void pfpu_dump(unsigned int *code, unsigned int n);
+void pfpu_dump(const unsigned int *code, unsigned int n);
#endif /* __FPVM_PFPU_H */
18 software/include/fpvm/symbol.h
View
@@ -0,0 +1,18 @@
+/*
+ * symbol.h - Symbol table entry
+ *
+ * Copyright 2012 by Werner Almesberger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ */
+
+#ifndef __FPVM_SYMBOL_H
+#define __FPVM_SYMBOL_H
+
+struct fpvm_sym {
+ const char *name;
+};
+
+#endif /* __FPVM_SYMBOL_H */
2  software/include/hal/brd.h
View
@@ -20,6 +20,6 @@
extern const struct board_desc *brd_desc;
-void brd_init();
+void brd_init(void);
#endif /* __HAL_BRD_H */
2  software/include/hal/dmx.h
View
@@ -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);
2  software/include/hal/mem.h
View
@@ -20,6 +20,6 @@
#define BANK_SDRAM (0)
-void mem_init();
+void mem_init(void);
#endif /* __HAL_MEM_H */
4 software/include/hal/pfpu.h
View
@@ -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 */
22 software/include/hal/snd.h
View
@@ -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
6 software/include/hal/time.h
View
@@ -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 */
4 software/include/hal/tmu.h
View
@@ -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 */
2  software/include/hal/ukb.h
View
@@ -18,6 +18,6 @@
#ifndef __HAL_UKB_H
#define __HAL_UKB_H
-void ukb_init();
+void ukb_init(void);
#endif /* __HAL_UKB_H */
4 software/include/hal/usb.h
View
@@ -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 */
8 software/include/hal/vga.h
View
@@ -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);
2  software/include/hal/vin.h
View
@@ -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);
4 software/include/net/microudp.h
View
@@ -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 */
12 software/libbase/blockdev.c
View
@@ -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;
@@ -263,7 +263,7 @@ int bd_readblock(unsigned int block, void *buffer)
return memcard_readblock(block, buffer);
}
-void bd_done()
+void bd_done(void)
{
}
4 software/libbase/board.c
View
@@ -39,12 +39,12 @@ const struct board_desc *get_board_desc_id(unsigned short int id)
return NULL;
}
-const struct board_desc *get_board_desc()
+const struct board_desc *get_board_desc(void)
{
return get_board_desc_id(CSR_SYSTEM_ID & 0xffff);
}
-int get_pcb_revision()
+int get_pcb_revision(void)
{
int r;
unsigned int io;
4 software/libbase/console.c
View
@@ -44,7 +44,7 @@ static void writechar(char c)
write_hook(c);
}
-char readchar()
+char readchar(void)
{
while(1) {
if(uart_read_nonblock())
@@ -54,7 +54,7 @@ char readchar()
}
}
-int readchar_nonblock()
+int readchar_nonblock(void)
{
return (uart_read_nonblock()
|| ((read_nonblock_hook != NULL) && read_nonblock_hook()));
2  software/libbase/fatfs.c
View
@@ -434,7 +434,7 @@ int fatfs_load(const char *filename, char *buffer, int size, int *realsize)
return n*cluster_size;
}
-void fatfs_done()
+void fatfs_done(void)
{
bd_done();
}
4 software/libbase/libc.c
View
@@ -564,13 +564,13 @@ int sprintf(char * buf, const char *fmt, ...)
*/
static unsigned int seed;
-unsigned int rand()
+unsigned int rand(void)
{
seed = 129 * seed + 907633385;
return seed;
}
-void abort()
+void abort(void)
{
printf("Aborted.");
while(1);
3  software/libbase/softfloat.c
View
@@ -750,7 +750,7 @@ float32 float32_rem( float32 a, float32 b )
flag aSign, bSign, zSign;
int16 aExp, bExp, expDiff;
bits32 aSig, bSig;
- bits32 q, allZero, alternateASig;
+ bits32 q, alternateASig;
sbits32 sigMean;
aSig = extractFloat32Frac( a );
@@ -985,7 +985,6 @@ IEC/IEEE Standard for Binary Floating-point Arithmetic.
flag float32_le_quiet( float32 a, float32 b )
{
flag aSign, bSign;
- int16 aExp, bExp;
if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
|| ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
10 software/libbase/system.c
View
@@ -22,7 +22,7 @@
#include <system.h>
-void flush_cpu_icache()
+void flush_cpu_icache(void)
{
asm volatile(
"wcsr ICC, r0\n"
@@ -33,7 +33,7 @@ void flush_cpu_icache()
);
}
-void flush_cpu_dcache()
+void flush_cpu_dcache(void)
{
asm volatile(
"wcsr DCC, r0\n"
@@ -41,7 +41,7 @@ void flush_cpu_dcache()
);
}
-void flush_bridge_cache()
+void flush_bridge_cache(void)
{
volatile char *flushbase = (char *)FMLBRG_FLUSH_BASE;
int i, offset;
@@ -53,7 +53,7 @@ void flush_bridge_cache()
}
}
-__attribute__((noreturn)) void reboot()
+__attribute__((noreturn)) void reboot(void)
{
uart_force_sync(1); /* flush UART buffers */
irq_setmask(0);
@@ -70,7 +70,7 @@ static void icap_write(int val, unsigned int w)
CSR_ICAP = w;
}
-__attribute__((noreturn)) void reconf()
+__attribute__((noreturn)) void reconf(void)
{
uart_force_sync(1); /* flush UART buffers */
irq_setmask(0);
10 software/libbase/uart.c
View
@@ -45,9 +45,10 @@ static volatile int tx_cts;
static int force_sync;
-void uart_isr()
+void uart_isr(void)
{
unsigned int stat = CSR_UART_STAT;
+ CSR_UART_STAT = stat;
if(stat & UART_STAT_RX_EVT) {
rx_buf[rx_produce] = CSR_UART_RXTX;
@@ -62,12 +63,11 @@ void uart_isr()
tx_cts = 1;
}
- CSR_UART_STAT = stat;
irq_ack(IRQ_UART);
}
/* Do not use in interrupt handlers! */
-char uart_read()
+char uart_read(void)
{
char c;
@@ -77,7 +77,7 @@ char uart_read()
return c;
}
-int uart_read_nonblock()
+int uart_read_nonblock(void)
{
return (rx_consume != rx_produce);
}
@@ -104,7 +104,7 @@ void uart_write(char c)
irq_setmask(oldmask);
}
-void uart_init()
+void uart_init(void)
{
unsigned int mask;
1  software/libbase/vsnprintf.c
View
@@ -198,7 +198,6 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
int m;
float f;
int integer;
- int i;
/* until I sort out how to disable this stupid promotion to double ... */
f = *(va_arg(args, float *));
14 software/libfpvm/Makefile
View
@@ -27,26 +27,18 @@ clean:
# DO NOT DELETE
-fpvm-export.o: ../../software/include/fpvm/fpvm.h
-fpvm-export.o: ../../software/include/fpvm/is.h
-fpvm-export.o: ../../software/include/fpvm/ast.h unique.h parser_helper.h
fpvm.o: ../../software/include/base/version.h
fpvm.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
fpvm.o: ../../software/include/fpvm/ast.h
gfpus.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
-gfpus.o: ../../software/include/fpvm/pfpu.h
+gfpus.o: ../../software/include/fpvm/ast.h ../../software/include/fpvm/pfpu.h
gfpus.o: ../../software/include/fpvm/schedulers.h
gfpus.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
lnfpus.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
+lnfpus.o: ../../software/include/fpvm/ast.h
lnfpus.o: ../../software/include/fpvm/pfpu.h
lnfpus.o: ../../software/include/fpvm/schedulers.h
lnfpus.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
-parser.o: ../../software/include/fpvm/ast.h parser_itf.h parser.h
-parser_helper.o: ../../software/include/fpvm/ast.h scanner.h parser.h
-parser_helper.o: parser_itf.h parser_helper.h
pfpu.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
pfpu.o: ../../software/include/fpvm/fpvm.h ../../software/include/fpvm/is.h
-pfpu.o: ../../software/include/fpvm/pfpu.h
-scanner.o: unique.h scanner.h parser.h
-test.o: fnp.h unique.h
-unique.o: unique.h fnp.inc
+pfpu.o: ../../software/include/fpvm/ast.h ../../software/include/fpvm/pfpu.h
83 software/libfpvm/fpvm.c
View
@@ -19,12 +19,15 @@
#include <base/version.h>
#include <fpvm/is.h>
+#include <fpvm/symbol.h>
#include <fpvm/fpvm.h>
#include <fpvm/ast.h>
-const char *_Xi, *_Yi, *_Xo, *_Yo; /* unique, provided by user of libfpvm */
+struct fpvm_sym *_Xi, *_Yi, *_Xo, *_Yo;
+ /* unique, provided by user of libfpvm */
+static struct fpvm_sym dummy_sym = { .name = "" };
const char *fpvm_version(void)
{
@@ -44,7 +47,7 @@ void fpvm_do_init(struct fpvm_fragment *fragment, int vector_mode)
fragment->bindings[1].b.v = _Yi;
/* Prevent binding of R2 (we need it for "if") */
fragment->bindings[2].isvar = 1;
- fragment->bindings[2].b.v = "";
+ fragment->bindings[2].b.v = &dummy_sym;
fragment->ntbindings = 2;
fragment->tbindings[0].reg = -1;
@@ -78,13 +81,13 @@ void fpvm_set_bind_mode(struct fpvm_fragment *fragment, int bind_mode)
fragment->bind_mode = bind_mode;
}
-int fpvm_bind(struct fpvm_fragment *fragment, const char *sym)
+int fpvm_bind(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
int r;
if(fragment->nbindings == FPVM_MAXBINDINGS) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
- "Failed to allocate register for variable: %s", sym);
+ "Failed to allocate register for variable: %s", sym->name);
return FPVM_INVALID_REG;
}
r = fragment->nbindings++;
@@ -95,27 +98,27 @@ int fpvm_bind(struct fpvm_fragment *fragment, const char *sym)
return r;
}
-void fpvm_set_xin(struct fpvm_fragment *fragment, const char *sym)
+void fpvm_set_xin(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->bindings[0].b.v = sym;
}
-void fpvm_set_yin(struct fpvm_fragment *fragment, const char *sym)
+void fpvm_set_yin(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->bindings[1].b.v = sym;
}
-void fpvm_set_xout(struct fpvm_fragment *fragment, const char *sym)
+void fpvm_set_xout(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->tbindings[0].sym = sym;
}
-void fpvm_set_yout(struct fpvm_fragment *fragment, const char *sym)
+void fpvm_set_yout(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
fragment->tbindings[1].sym = sym;
}
-static int lookup(struct fpvm_fragment *fragment, const char *sym)
+static int lookup(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
int i;
@@ -132,11 +135,11 @@ static int lookup(struct fpvm_fragment *fragment, const char *sym)
return FPVM_INVALID_REG;
}
-static int tbind(struct fpvm_fragment *fragment, const char *sym)
+static int tbind(struct fpvm_fragment *fragment, struct fpvm_sym *sym)
{
if(fragment->ntbindings == FPVM_MAXTBINDINGS) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
- "Failed to allocate register for variable: %s", sym);
+ "Failed to allocate register for variable: %s", sym->name);
return FPVM_INVALID_REG;
}
fragment->tbindings[fragment->ntbindings].reg = fragment->next_sur;
@@ -145,7 +148,8 @@ static int tbind(struct fpvm_fragment *fragment, const char *sym)
return fragment->next_sur--;
}
-static int rename_reg(struct fpvm_fragment *fragment, const char *sym, int reg)
+static int rename_reg(struct fpvm_fragment *fragment, struct fpvm_sym *sym,
+ int reg)
{
int i;
@@ -157,7 +161,7 @@ static int rename_reg(struct fpvm_fragment *fragment, const char *sym, int reg)
if(fragment->nrenamings == FPVM_MAXRENAMINGS) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
"Failed to allocate renamed register for variable: %s",
- sym);
+ sym->name);
return 0;
}
fragment->renamings[fragment->nrenamings].reg = reg;
@@ -166,7 +170,7 @@ static int rename_reg(struct fpvm_fragment *fragment, const char *sym, int reg)
return 1;
}
-static int sym_to_reg(struct fpvm_fragment *fragment, const char *sym,
+static int sym_to_reg(struct fpvm_fragment *fragment, struct fpvm_sym *sym,
int dest, int *created)
{
int r;
@@ -361,15 +365,15 @@ static int compile(struct fpvm_fragment *fragment, int reg, struct ast_node *nod
case op_ident:
/* AST node is a variable */
if(fragment->bind_mode) {
- opa = sym_to_reg(fragment, node->label, 0, NULL);
+ opa = sym_to_reg(fragment, node->sym, 0, NULL);
if(opa == FPVM_INVALID_REG) return FPVM_INVALID_REG;
} else {
- opa = lookup(fragment, node->label);
+ opa = lookup(fragment, node->sym);
if((opa == FPVM_INVALID_REG)||
(opa == fragment->final_dest)) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
"Reading unbound variable: %s",
- node->label);
+ node->sym->name);
return FPVM_INVALID_REG;
}
}
@@ -389,9 +393,14 @@ static int compile(struct fpvm_fragment *fragment, int reg, struct ast_node *nod
*/
opa = COMPILE(FPVM_INVALID_REG, node->contents.branches.b);
opb = COMPILE(FPVM_INVALID_REG, node->contents.branches.c);
- COMPILE(FPVM_REG_IFB, node->contents.branches.a);
+ (void) COMPILE(FPVM_REG_IFB, node->contents.branches.a);
break;
- case op_not:
+ case op_band:
+ case op_bor:
+ opa = opb = 0;
+ (void) COMPILE(FPVM_REG_IFB, node->contents.branches.a);
+ break;
+ case op_negate:
if(node->contents.branches.a->op == op_constant) {
/* Node is a negative constant */
struct ast_node *n;
@@ -512,18 +521,44 @@ static int compile(struct fpvm_fragment *fragment, int reg, struct ast_node *nod
case op_int:
ADD_INT(opa, reg);
break;
- case op_not:
+ case op_negate:
opb = find_negative_constant(fragment);
if(opb == FPVM_INVALID_REG)
return FPVM_INVALID_REG;
ADD_ISN(FPVM_OPCODE_TSIGN, opa, opb, reg);
break;
+ case op_bnot:
+ opb = REG_CONST(0);
+ if(opb == FPVM_INVALID_REG)
+ return FPVM_INVALID_REG;
+ ADD_ISN(FPVM_OPCODE_EQUAL, opa, opb, reg);
+ break;
+ case op_band: {
+ int reg_zero = REG_CONST(0);
+ int reg_one = REG_CONST(1);
+ int reg_tmp = REG_ALLOC();
+
+ ADD_ISN(FPVM_OPCODE_IF, reg_one, reg_zero, reg_tmp);
+ (void) COMPILE(FPVM_REG_IFB, node->contents.branches.b);
+ ADD_ISN(FPVM_OPCODE_IF, reg_tmp, reg_zero, reg);
+ break;
+ }
+ case op_bor: {
+ int reg_zero = REG_CONST(0);
+ int reg_one = REG_CONST(1);
+ int reg_tmp = REG_ALLOC();
+
+ ADD_ISN(FPVM_OPCODE_IF, reg_one, reg_zero, reg_tmp);
+ (void) COMPILE(FPVM_REG_IFB, node->contents.branches.b);
+ ADD_ISN(FPVM_OPCODE_IF, reg_one, reg_tmp, reg);
+ break;
+ }
default:
/* Normal case */
opcode = operator2opcode(node->op);
if(opcode < 0) {
snprintf(fragment->last_error, FPVM_MAXERRLEN,
- "Operation not supported: %s", node->label);
+ "Operation not supported: %d", node->op);
return FPVM_INVALID_REG;
}
ADD_ISN(opcode, opa, opb, reg);
@@ -555,7 +590,7 @@ static void fragment_restore(struct fpvm_fragment *fragment,
fragment->ninstructions = backup->ninstructions;
}
-int fpvm_do_assign(struct fpvm_fragment *fragment, const char *dest,
+int fpvm_do_assign(struct fpvm_fragment *fragment, struct fpvm_sym *dest,
struct ast_node *n)
{
int dest_reg;
@@ -683,7 +718,7 @@ void fpvm_dump(struct fpvm_fragment *fragment)
for(i=0;i<fragment->nbindings;i++) {
printf("R%04d ", i);
if(fragment->bindings[i].isvar)
- printf("%s\n", fragment->bindings[i].b.v);
+ printf("%s\n", fragment->bindings[i].b.v->name);
else
#ifdef PRINTF_FLOAT
printf("%f\n", fragment->bindings[i].b.c);
@@ -694,7 +729,7 @@ void fpvm_dump(struct fpvm_fragment *fragment)
printf("== Transient bindings:\n");
for(i=0;i<fragment->ntbindings;i++) {
printf("R%04d ", fragment->tbindings[i].reg);
- printf("%s\n", fragment->tbindings[i].sym);
+ printf("%s\n", fragment->tbindings[i].sym->name);
}
printf("== Code:\n");
for(i=0;i<fragment->ninstructions;i++) {
2  software/libfpvm/pfpu.c
View
@@ -43,7 +43,7 @@ int pfpu_get_latency(int opcode)
}
}
-void pfpu_dump(unsigned int *code, unsigned int n)
+void pfpu_dump(const unsigned int *code, unsigned int n)
{
int i;
int exits;
21 software/libfpvm/x86-linux/Makefile
View
@@ -1,9 +1,24 @@
MMDIR?=../../../
-CC=clang
+CC_normal = clang
+AR_normal = ar
+RANLIB_normal = ranlib
+
+CC_quiet = @echo " CC " $@ && $(CC_normal)
+AR_quiet = @echo " AR " $@ && $(AR_normal)
+RANLIB_quiet = @echo " RANLIB " $@ && $(RANLIB_normal)
+
+ifeq ($(V),1)
+ CC = $(CC_normal)
+ AR = $(AR_normal)
+ RANLIB = $(RANLIB_normal)
+else
+ CC = $(CC_quiet)
+ AR = $(AR_quiet)
+ RANLIB = $(RANLIB_quiet)
+endif
+
CFLAGS=-O2 -DPRINTF_FLOAT -I$(MMDIR)/software/include
-AR=ar
-RANLIB=ranlib
include ../subdir.mak
4 software/libhal/brd.c
View
@@ -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;
@@ -48,7 +48,7 @@ static void display_capabilities()
display_capability("Memtester ", cap & CAP_MEMTEST);
}
-void brd_init()
+void brd_init(void)
{
int rev;
char soc_version[13];
2  software/libhal/dmx.c
View
@@ -20,7 +20,7 @@
#include <hal/dmx.h>
-void dmx_init()
+void dmx_init(void)
{
int i;
2  software/libhal/mem.c
View
@@ -29,7 +29,7 @@ struct malloc_bank banks[1] = {
}
};
-void mem_init()
+void mem_init(void)
{
int i, n;
4 software/libhal/pfpu.c
View
@@ -32,7 +32,7 @@ static unsigned int consume;
static unsigned int level;
static int cts;
-void pfpu_init()
+void pfpu_init(void)
{
unsigned int mask;
@@ -98,7 +98,7 @@ static void pfpu_start(struct pfpu_td *td)
CSR_PFPU_CTL = PFPU_CTL_START;
}
-void pfpu_isr()
+void pfpu_isr(void)
{
if(queue[consume]->update)
update_registers(queue[consume]->registers);
22 software/libhal/snd.c
View
@@ -38,7 +38,7 @@
static volatile int snd_cr_request;
static volatile int snd_cr_reply;
-void snd_init()
+void snd_init(void)
{
unsigned int codec_id;
unsigned int mask;
@@ -86,13 +86,13 @@ void snd_init()
printf("SND: initialization complete\n");
}
-void snd_isr_crrequest()
+void snd_isr_crrequest(void)
{
snd_cr_request = 1;
irq_ack(IRQ_AC97CRREQUEST);
}
-void snd_isr_crreply()
+void snd_isr_crreply(void)
{
snd_cr_reply = 1;
irq_ack(IRQ_AC97CRREPLY);
@@ -140,7 +140,7 @@ static void play_start(short *buffer)
CSR_AC97_DCTL = AC97_SCTL_EN;
}
-void snd_isr_dmar()
+void snd_isr_dmar(void)
{
/* NB. the callback can give us buffers by calling snd_play_refill() */
play_callback(play_queue[play_consume], play_user);
@@ -158,7 +158,7 @@ void snd_isr_dmar()
}
}
-void snd_play_empty()
+void snd_play_empty(void)
{
play_produce = 0;
play_consume = 0;
@@ -212,7 +212,7 @@ void snd_play_start(snd_callback callback, unsigned int nsamples, void *user)
}
}
-void snd_play_stop()
+void snd_play_stop(void)
{
unsigned int oldmask;
@@ -224,7 +224,7 @@ void snd_play_stop()
irq_setmask(oldmask);
}
-int snd_play_active()
+int snd_play_active(void)
{
return(CSR_AC97_DCTL & AC97_SCTL_EN);
}
@@ -254,7 +254,7 @@ static void record_start(short *buffer)
CSR_AC97_UCTL = AC97_SCTL_EN;
}
-void snd_isr_dmaw()
+void snd_isr_dmaw(void)
{
flush_cpu_dcache();
@@ -277,7 +277,7 @@ void snd_isr_dmaw()
record_overrun = 1;
}
-void snd_record_empty()
+void snd_record_empty(void)
{
record_produce = 0;
record_consume = 0;
@@ -329,7 +329,7 @@ void snd_record_start(snd_callback callback, unsigned int nsamples, void *user)
record_overrun = 1;
}
-void snd_record_stop()
+void snd_record_stop(void)
{
unsigned int oldmask;
@@ -341,7 +341,7 @@ void snd_record_stop()
irq_setmask(oldmask);
}
-int snd_record_active()
+int snd_record_active(void)
{
return(CSR_AC97_UCTL & AC97_SCTL_EN);
}
4 software/libhal/time.c
View
@@ -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++;
4 software/libhal/tmu.c
View
@@ -37,7 +37,7 @@ static unsigned int consume;
static unsigned int level;
static int cts;
-void tmu_init()
+void tmu_init(void)
{
unsigned int mask;
@@ -90,7 +90,7 @@ static void tmu_start(struct tmu_td *td)
CSR_TMU_CTL = td->flags|TMU_CTL_START;
}
-void tmu_isr()
+void tmu_isr(void)
{
if(queue[consume]->callback)
queue[consume]->callback(queue[consume]);
6 software/libhal/ukb.c
View
@@ -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()
+static char ukb_readchar(void)
{
char c;
@@ -37,7 +37,7 @@ char ukb_readchar()
return c;
}
-int ukb_readchar_nonblock()
+static int ukb_readchar_nonblock(void)
{
return (rx_consume != rx_produce);
}
@@ -133,7 +133,7 @@ static void keyboard_cb(unsigned char modifiers, unsigned char key)
}
}
-void ukb_init()
+void ukb_init(void)
{
rx_produce = 0;
rx_consume = 0;
6 software/libhal/usb.c
View
@@ -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;
22 software/libhal/vga.c
View
@@ -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 */
12 software/libhal/vin.c
View
@@ -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;
47 software/libmath/Makefile
View
@@ -1,47 +0,0 @@
-MMDIR=../..
-include $(MMDIR)/software/include.mak
-
-OBJECTS=acosf.o asinf.o atanf.o cosf.o cotf.o expf.o floorf.o ldexpf.o logf.o modff.o sincosf.o sinf.o sqrtf.o tanf.o asincosf.o atan2f.o ceilf.o coshf.o fabsf.o frexpf.o log10f.o powf.o sincoshf.o sinhf.o tancotf.o tanhf.o
-
-all: libmath.a
-
-libmath.a: $(OBJECTS)
- $(AR) clr libmath.a $(OBJECTS)
- $(RANLIB) libmath.a
-
-.PHONY: clean depend
-
-depend:
- makedepend -Y -- $(CFLAGS) -- *.c
-
-clean:
- rm -f *.o libmath.a .*~ *~ Makefile.bak
-
-# DO NOT DELETE
-
-acosf.o: ../../software/include/base/math.h
-asincosf.o: ../../software/include/base/math.h
-asinf.o: ../../software/include/base/math.h
-atan2f.o: ../../software/include/base/math.h
-atanf.o: ../../software/include/base/math.h
-ceilf.o: ../../software/include/base/math.h
-cosf.o: ../../software/include/base/math.h
-coshf.o: ../../software/include/base/math.h
-cotf.o: ../../software/include/base/math.h
-expf.o: ../../software/include/base/math.h
-fabsf.o: ../../software/include/base/math.h
-floorf.o: ../../software/include/base/math.h
-frexpf.o: ../../software/include/base/math.h
-ldexpf.o: ../../software/include/base/math.h
-log10f.o: ../../software/include/base/math.h
-logf.o: ../../software/include/base/math.h
-modff.o: ../../software/include/base/math.h
-powf.o: ../../software/include/base/math.h
-sincosf.o: ../../software/include/base/math.h
-sincoshf.o: ../../software/include/base/math.h
-sinf.o: ../../software/include/base/math.h
-sinhf.o: ../../software/include/base/math.h
-sqrtf.o: ../../software/include/base/math.h
-tancotf.o: ../../software/include/base/math.h
-tanf.o: ../../software/include/base/math.h
-tanhf.o: ../../software/include/base/math.h
35 software/libmath/acosf.c
View
@@ -1,35 +0,0 @@
-/* acosf.c: Computes arc cosine of a 32-bit float
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: acosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float asincosf(const float x, const int isacos);
-
-float acosf(const float x)
-{
- if(x== 1.0) return 0.0;
- else if(x==-1.0) return PI;
- else if(x== 0.0) return HALF_PI;
- return asincosf(x,1);
-}
85 software/libmath/asincosf.c
View
@@ -1,85 +0,0 @@
-/* asincosf.c: Computes asin or acos of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: asincosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-
-#include <math.h>
-
-#define P1 0.933935835E+0
-#define P2 -0.504400557E+0
-#define Q0 0.560363004E+1
-#define Q1 -0.554846723E+1
-#define Q2 0.100000000E+1
-
-#define P(g) (P2*g+P1)
-#define Q(g) ((Q2*g+Q1)*g+Q0)
-
-float asincosf(const float x, const int isacos)
-{
- float y, g, r;
- int i;
-
- static const float a[2]={ 0.0, QUART_PI };
- static const float b[2]={ HALF_PI, QUART_PI };
-
- y=fabsf(x);
- i=isacos;
- if (y < EPS) r=y;
- else
- {
- if (y > 0.5)
- {
- i=1-i;
- if (y > 1.0)
- {
- //errno=EDOM;
- return 0.0;
- }
- g=(0.5-y)+0.5;
- g=ldexpf(g,-1);
- y=sqrtf(g);
- y=-(y+y);
- }
- else
- {
- g=y*y;
- }
- r=y+y*((P(g)*g)/Q(g));
- }
- if (isacos)
- {
- if (x < 0.0)
- r=(b[i]+r)+b[i];
- else
- r=(a[i]-r)+a[i];
- }
- else
- {
- r=(a[i]+r)+a[i];
- if (x<0.0) r=-r;
- }
- return r;
-}
36 software/libmath/asinf.c
View
@@ -1,36 +0,0 @@
-/* asinf.c: Computes asin(x)
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: asinf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float asincosf(const float x, const int isacos);
-
-float asinf(const float x)
-{
- if(x== 1.0) return HALF_PI;
- else if(x==-1.0) return -HALF_PI;
- else if(x== 0.0) return 0.0;
- else return asincosf(x,0);
-}
-
48 software/libmath/atan2f.c
View
@@ -1,48 +0,0 @@
-/* atan2f.c: Computes atan2(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: atan2f.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float atan2f(const float x, const float y)
-{
- float r;
-
- if ((x==0.0) && (y==0.0))
- {
- //errno=EDOM;
- return 0.0;
- }
-
- if(fabsf(y)>=fabsf(x))
- {
- r=atanf(x/y);
- if(y<0.0) r+=(x>=0?PI:-PI);
- }
- else
- {
- r=-atanf(y/x);
- r+=(x<0.0?-HALF_PI:HALF_PI);
- }
- return r;
-}
73 software/libmath/atanf.c
View
@@ -1,73 +0,0 @@
-/* atanf.c: Computes arctan of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: atanf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 -0.4708325141E+0
-#define P1 -0.5090958253E-1
-#define Q0 0.1412500740E+1
-#define Q1 0.1000000000E+1
-
-#define P(g,f) ((P1*g+P0)*g*f)
-#define Q(g) (Q1*g+Q0)
-
-#define K1 0.2679491924 /* 2-sqrt(3) */
-#define K2 0.7320508076 /* sqrt(3)-1 */
-#define K3 1.7320508076 /* sqrt(3) */
-
-float atanf(const float x)
-{
- float f, r, g;
- int n=0;
- static float a[]={ 0.0, 0.5235987756, 1.5707963268, 1.0471975512 };
-
- f=fabsf(x);
- if(f>1.0)
- {
- f=1.0/f;
- n=2;
- }
- if(f>K1)
- {
- f=((K2*f-1.0)+f)/(K3+f);
- // What it is actually wanted is this more accurate formula,
- // but SDCC optimizes it and then it does not work:
- // f=(((K2*f-0.5)-0.5)+f)/(K3+f);
- n++;
- }
- if(fabsf(f)<EPS) r=f;
- else
- {
- g=f*f;
- r=f+P(g,f)/Q(g);
- }
- if(n>1) r=-r;
- r+=a[n];
- if(x<0.0) r=-r;
- return r;
-}
-
35 software/libmath/ceilf.c
View
@@ -1,35 +0,0 @@
-/* ceilf.c: Returns the integer larger or equal than x
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: ceilf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float ceilf(float x)
-{
- long r;
- r=x;
- if (r<0)
- return r;
- else
- return (r+((r<x)?1:0));
-}
33 software/libmath/cosf.c
View
@@ -1,33 +0,0 @@
-/* cosf.c: Computes cos(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: cosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincosf(float x, int iscos);
-
-float cosf(float x)
-{
- if (x==0.0) return 1.0;
- return sincosf(x, 1);
-}
32 software/libmath/coshf.c
View
@@ -1,32 +0,0 @@
-/* coshf.c: Computes cosh(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: coshf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincoshf(const float x, const int iscosh);
-
-float coshf(const float x)
-{
- return sincoshf(x, 1);
-}
44 software/libmath/cotf.c
View
@@ -1,44 +0,0 @@
-/* cotf.c: Computes cot(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: cotf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float tancotf(const float x, const int iscot);
-
-float cotf(const float x)
-{
- float y;
-
- y=fabsf(x);
- if (y<1.0E-30) //This one requires more thinking...
- {
- //errno = ERANGE;
- if (x<0.0)
- return -XMAX;
- else
- return XMAX;
- }
- return tancotf(x, 1);
-}
-
89 software/libmath/expf.c
View
@@ -1,89 +0,0 @@
-/* expf.c: Computes e**x of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: expf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 0.2499999995E+0
-#define P1 0.4160288626E-2
-#define Q0 0.5000000000E+0
-#define Q1 0.4998717877E-1
-
-#define P(z) ((P1*z)+P0)
-#define Q(z) ((Q1*z)+Q0)
-
-#define C1 0.693359375
-#define C2 -2.1219444005469058277e-4
-
-#define BIGX 88.72283911 /* ln(XMAX) */
-#define EXPEPS 1.0E-7 /* exp(1.0E-7)=0.0000001 */
-#define K1 1.4426950409 /* 1/ln(2) */
-
-float expf(const float x)
-{
- int n;
- float xn, g, r, z, y;
- char sign;
-
- if(x>=0.0)
- { y=x; sign=0; }
- else
- { y=-x; sign=1; }
-
- if(y<EXPEPS) return 1.0;
-
- if(y>BIGX)
- {
- if(sign)
- {
- //errno=ERANGE;
- return XMAX;
- }
- else
- {
- return 0.0;
- }
- }
-
- z=y*K1;
- n=z;
-
- if(n<0) --n;
- if(z-n>=0.5) ++n;
- xn=n;
- g=((y-xn*C1))-xn*C2;
- z=g*g;
- r=P(z)*g;
- r=0.5+(r/(Q(z)-r));
-
- n++;
- z=ldexpf(r, n);
- if(sign)
- return 1.0/z;
- else
- return z;
-}
-
34 software/libmath/fabsf.c
View
@@ -1,34 +0,0