Permalink
Browse files

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

  • Loading branch information...
2 parents f9a4ec3 + 832e989 commit b1c6d6697193cefa99449bb2a00d757d7baceff4 @kristianpaul committed Feb 19, 2012
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
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 \
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
@@ -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);
@@ -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);
@@ -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);
@@ -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 */
@@ -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));
@@ -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 */
@@ -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);
@@ -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 */
@@ -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
@@ -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 */
@@ -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);
@@ -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 */
@@ -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 */
@@ -20,6 +20,6 @@
extern const struct board_desc *brd_desc;
-void brd_init();
+void brd_init(void);
#endif /* __HAL_BRD_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);
@@ -20,6 +20,6 @@
#define BANK_SDRAM (0)
-void mem_init();
+void mem_init(void);
#endif /* __HAL_MEM_H */
Oops, something went wrong.

0 comments on commit b1c6d66

Please sign in to comment.