summaryrefslogtreecommitdiffstats
path: root/src/arch/e1/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/e1/include')
-rw-r--r--src/arch/e1/include/bits/byteswap.h39
-rw-r--r--src/arch/e1/include/bits/cpu.h6
-rw-r--r--src/arch/e1/include/bits/elf.h6
-rw-r--r--src/arch/e1/include/bits/endian.h6
-rw-r--r--src/arch/e1/include/bits/string.h35
-rw-r--r--src/arch/e1/include/e132_xs_board.h22
-rw-r--r--src/arch/e1/include/hooks.h9
-rw-r--r--src/arch/e1/include/io.h210
-rw-r--r--src/arch/e1/include/latch.h12
-rw-r--r--src/arch/e1/include/limits.h34
-rw-r--r--src/arch/e1/include/setjmp.h23
-rw-r--r--src/arch/e1/include/stdint.h16
12 files changed, 418 insertions, 0 deletions
diff --git a/src/arch/e1/include/bits/byteswap.h b/src/arch/e1/include/bits/byteswap.h
new file mode 100644
index 000000000..1d1a7d2f0
--- /dev/null
+++ b/src/arch/e1/include/bits/byteswap.h
@@ -0,0 +1,39 @@
+#ifndef ETHERBOOT_BITS_BYTESWAP_H
+#define ETHERBOOT_BITS_BYTESWAP_H
+
+/* We do not have byte swap functions ... We are
+ * RISC processor ...
+ */
+
+static inline unsigned short __swap16(volatile unsigned short v)
+{
+ return ((v << 8) | (v >> 8));
+}
+
+static inline unsigned int __swap32(volatile unsigned long v)
+{
+ return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
+}
+
+#define __bswap_constant_16(x) \
+ ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \
+ (((uint16_t)(x) & 0xff00) >> 8)))
+
+#define __bswap_constant_32(x) \
+ ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \
+ (((uint32_t)(x) & 0x0000ff00U) << 8) | \
+ (((uint32_t)(x) & 0x00ff0000U) >> 8) | \
+ (((uint32_t)(x) & 0xff000000U) >> 24)))
+
+#define __bswap_16(x) \
+ (__builtin_constant_p(x) ? \
+ __bswap_constant_16(x) : \
+ __swap16(x))
+
+
+#define __bswap_32(x) \
+ (__builtin_constant_p(x) ? \
+ __bswap_constant_32(x) : \
+ __swap32(x))
+
+#endif /* ETHERBOOT_BITS_BYTESWAP_H */
diff --git a/src/arch/e1/include/bits/cpu.h b/src/arch/e1/include/bits/cpu.h
new file mode 100644
index 000000000..f25c009a2
--- /dev/null
+++ b/src/arch/e1/include/bits/cpu.h
@@ -0,0 +1,6 @@
+#ifndef E1_BITS_CPU_H
+#define E1_BITS_CPU_H
+
+#define cpu_setup() do {} while(0)
+
+#endif /* E1_BITS_CPU_H */
diff --git a/src/arch/e1/include/bits/elf.h b/src/arch/e1/include/bits/elf.h
new file mode 100644
index 000000000..aa40e1107
--- /dev/null
+++ b/src/arch/e1/include/bits/elf.h
@@ -0,0 +1,6 @@
+#ifndef E1_BITS_ELF_H
+#define E1_BITS_ELF_H
+
+/* dummy file, needed for the compilation of core/nic.c */
+
+#endif /* E1_BITS_ELF_H */
diff --git a/src/arch/e1/include/bits/endian.h b/src/arch/e1/include/bits/endian.h
new file mode 100644
index 000000000..4145518bc
--- /dev/null
+++ b/src/arch/e1/include/bits/endian.h
@@ -0,0 +1,6 @@
+#ifndef ETHERBOOT_BITS_ENDIAN_H
+#define ETHERBOOT_BITS_ENDIAN_H
+
+#define __BYTE_ORDER __BIG_ENDIAN
+
+#endif /* ETHERBOOT_BITS_ENDIAN_H */
diff --git a/src/arch/e1/include/bits/string.h b/src/arch/e1/include/bits/string.h
new file mode 100644
index 000000000..b6df2fcbc
--- /dev/null
+++ b/src/arch/e1/include/bits/string.h
@@ -0,0 +1,35 @@
+#ifndef ETHERBOOT_BITS_STRING_H
+#define ETHERBOOT_BITS_STRING_H
+
+/* define inline optimized string functions here */
+
+#define __HAVE_ARCH_MEMCPY
+//extern void * memcpy(const void *d, const void *s, size_t count);
+
+#define __HAVE_ARCH_MEMCMP
+//extern int memcmp(const void * s ,const void * d ,size_t );
+
+#define __HAVE_ARCH_MEMSET
+//extern void * memset(const void * s, int c, size_t count);
+
+#define __HAVE_ARCH_MEMMOVE
+static inline void *memmove(void *s1, const void *s2, size_t n) {
+
+ unsigned int i;
+ char *tmp = s1;
+ char *cs2 = (char *) s2;
+
+ if (tmp < cs2) {
+ for(i=0; i<n; ++i, ++tmp, ++cs2)
+ *tmp = *cs2;
+ }
+ else {
+ tmp += n - 1;
+ cs2 += n - 1;
+ for(i=0; i<n; ++i, --tmp, --cs2)
+ *tmp = *cs2;
+ }
+ return(s1);
+}
+
+#endif /* ETHERBOOT_BITS_STRING_H */
diff --git a/src/arch/e1/include/e132_xs_board.h b/src/arch/e1/include/e132_xs_board.h
new file mode 100644
index 000000000..257cfc37d
--- /dev/null
+++ b/src/arch/e1/include/e132_xs_board.h
@@ -0,0 +1,22 @@
+#ifndef __E132_XS_BOARD_H
+#define __E132_XS_BOARD_H
+
+#define CONFIG_HYPERSTONE_OSC_FREQ_MHZ 15
+
+#define NR_MEMORY_REGNS 3
+#define BASEMEM 0x0
+
+/* SDRAM mapping */
+#define SDRAM_SIZE 0x01000000
+#define SDRAM_BASEMEM BASEMEM
+
+/* SRAM mapping */
+#define SRAM_BASEMEM 0x40000000
+#define SRAM_SIZE 0x0003FFFF
+
+/* IRAM mapping */
+#define IRAM_BASEMEM 0xC0000000
+#define IRAM_SIZE 0x00003FFF
+
+
+#endif /* __E132_XS_BOARD_H */
diff --git a/src/arch/e1/include/hooks.h b/src/arch/e1/include/hooks.h
new file mode 100644
index 000000000..a67aa193f
--- /dev/null
+++ b/src/arch/e1/include/hooks.h
@@ -0,0 +1,9 @@
+#ifndef ETHERBOOT_E1_HOOKS_H
+#define ETHERBOOT_E1_HOOKS_H
+
+#define arch_main(data,params) do {} while(0)
+#define arch_on_exit(status) do {} while(0)
+#define arch_relocate_to(addr) do {} while(0)
+#define arch_relocated_from(old_addr) do {} while(0)
+
+#endif /* ETHERBOOT_E1_HOOKS_H */
diff --git a/src/arch/e1/include/io.h b/src/arch/e1/include/io.h
new file mode 100644
index 000000000..acf940ce5
--- /dev/null
+++ b/src/arch/e1/include/io.h
@@ -0,0 +1,210 @@
+#ifndef ETHERBOOT_IO_H
+#define ETHERBOOT_IO_H
+
+/* Don't require identity mapped physical memory,
+ * osloader.c is the only valid user at the moment.
+ */
+#if 0
+static inline unsigned long virt_to_phys(volatile const void *virt_addr)
+{
+ return ((unsigned long)virt_addr);
+}
+#else
+#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
+#endif
+
+#if 0
+static inline void *phys_to_virt(unsigned long phys_addr)
+{
+ return (void *)(phys_addr);
+}
+#else
+#define phys_to_virt(vaddr) ((void *) (vaddr))
+#endif
+
+/* virt_to_bus converts an addresss inside of etherboot [_start, _end]
+ * into a memory address cards can use.
+ */
+#define virt_to_bus virt_to_phys
+
+/* bus_to_virt reverses virt_to_bus, the address must be output
+ * from virt_to_bus to be valid. This function does not work on
+ * all bus addresses.
+ */
+#define bus_to_virt phys_to_virt
+
+#define iounmap(addr) ((void)0)
+#define ioremap(physaddr, size) (physaddr)
+
+#define IORegAddress 13
+#define IOWait 11
+#define IOSetupTime 8
+#define IOAccessTime 5
+#define IOHoldTime 3
+
+#define SLOW_IO_ACCESS ( 0x3 << IOSetupTime | 0x0 << IOWait | 7 << IOAccessTime | 3 << IOHoldTime )
+
+/* The development board can generate up to 15 Chip selects */
+#define NR_CS 16
+
+extern unsigned int io_periph[NR_CS];
+#define ETHERNET_CS 4
+
+static inline unsigned short _swapw(volatile unsigned short v)
+{
+ return ((v << 8) | (v >> 8));
+}
+
+static inline unsigned int _swapl(volatile unsigned long v)
+{
+ return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
+}
+
+#define hy_inpw(addr) \
+ ({ register unsigned long dummy, dummy1; \
+ dummy = addr; \
+ asm volatile ("LDW.IOD %1, %0, 0" \
+ : "=l" (dummy1) \
+ : "l" (dummy)); dummy1; })
+
+
+#define hy_outpw(x, addr) \
+ ({ register unsigned long dummy0,dummy1; \
+ dummy0 = addr; \
+ dummy1 = x; \
+ asm volatile ("STW.IOD %1, %0, 0" \
+ : "=l" (dummy1) \
+ : "l"(dummy0), "l" (dummy1)); dummy1; })
+
+#define readb(addr) ({ unsigned char __v = inregb(addr); __v; })
+#define readw(addr) ({ unsigned short __v = inregw(addr); __v; })
+#define readl(addr) ({ unsigned long __v = inregl(addr); __v; })
+
+#define writeb(b,addr) (void)(outreg(b, addr))
+#define writew(b,addr) (void)(outreg(b, addr))
+#define writel(b,addr) (void)(outreg(b, addr))
+
+static inline unsigned long common_io_access(unsigned long addr)
+{
+ return io_periph[(addr & 0x03C00000) >> 22];
+}
+
+static inline volatile unsigned char inregb(volatile unsigned long reg)
+{
+ unsigned char val;
+
+ val = hy_inpw(common_io_access(reg) | ((0xf & reg) << IORegAddress));
+ return val;
+}
+
+static inline volatile unsigned short inregw(volatile unsigned long reg)
+{
+ unsigned short val;
+
+ val = hy_inpw(common_io_access(reg) | ((0xf & reg) << IORegAddress));
+ return val;
+}
+
+static inline volatile unsigned long inregl(volatile unsigned long reg)
+{
+ unsigned long val;
+
+ val = hy_inpw(common_io_access(reg) | ((0xf & reg) << IORegAddress));
+ return val;
+}
+
+static inline void outreg(volatile unsigned long val, volatile unsigned long reg)
+{
+
+ hy_outpw(val, (common_io_access(reg) | ((0xf & reg) << IORegAddress)));
+}
+
+static inline void io_outsb(unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned char *bp = (unsigned char *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--){
+ hy_outpw(_swapw(*bp++), tmp);
+ }
+}
+
+static inline void io_outsw(volatile unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned short *bp = (unsigned short *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--){
+ hy_outpw(_swapw(*bp++), tmp);
+ }
+}
+
+static inline void io_outsl(volatile unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned int *bp = (unsigned int *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--){
+ hy_outpw(_swapl(*bp++), tmp);
+ }
+}
+
+static inline void io_insb(volatile unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned char *bp = (unsigned char *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--)
+ *bp++ = hy_inpw((unsigned char) tmp);
+
+}
+
+static inline void io_insw(unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned short *bp = (unsigned short *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--)
+ *bp++ = _swapw((unsigned short)hy_inpw(tmp));
+
+}
+
+static inline void io_insl(unsigned int addr, void *buf, int len)
+{
+ unsigned long tmp;
+ unsigned int *bp = (unsigned int *) buf;
+
+ tmp = (common_io_access(addr)) | ((0xf & addr) << IORegAddress);
+
+ while (len--)
+ *bp++ = _swapl((unsigned int)hy_inpw(tmp));
+}
+
+#define inb(addr) readb(addr)
+#define inw(addr) readw(addr)
+#define inl(addr) readl(addr)
+#define outb(x,addr) ((void) writeb(x,addr))
+#define outw(x,addr) ((void) writew(x,addr))
+#define outl(x,addr) ((void) writel(x,addr))
+
+#define insb(a,b,l) io_insb(a,b,l)
+#define insw(a,b,l) io_insw(a,b,l)
+#define insl(a,b,l) io_insl(a,b,l)
+#define outsb(a,b,l) io_outsb(a,b,l)
+#define outsw(a,b,l) io_outsw(a,b,l)
+#define outsl(a,b,l) io_outsl(a,b,l)
+
+#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
+#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
+
+#endif /* ETHERBOOT_IO_H */
diff --git a/src/arch/e1/include/latch.h b/src/arch/e1/include/latch.h
new file mode 100644
index 000000000..0ee6fb2a7
--- /dev/null
+++ b/src/arch/e1/include/latch.h
@@ -0,0 +1,12 @@
+#ifndef LATCH_H
+#define LATCH_H
+
+//#define TICKS_PER_SEC (1000000UL)
+#define TICKS_PER_SEC (625000UL)
+
+/* Fixed timer interval used for calibrating a more precise timer */
+//#define LATCHES_PER_SEC 10
+
+void sleep_latch(void);
+
+#endif /* LATCH_H */
diff --git a/src/arch/e1/include/limits.h b/src/arch/e1/include/limits.h
new file mode 100644
index 000000000..e7056ce5c
--- /dev/null
+++ b/src/arch/e1/include/limits.h
@@ -0,0 +1,34 @@
+/*--------------------------------------------------------------------------*/
+/* Project: ANSI C Standard Header Files */
+/* File: LIMITS.H */
+/* Edited by: hyperstone electronics GmbH */
+/* Am Seerhein 8 */
+/* D-78467 Konstanz, Germany */
+/* Date: January 30, 1996 */
+/*--------------------------------------------------------------------------*/
+/* Purpose: */
+/* The header file <limits.h> defines limits of ordinal types */
+/* (char, short, int, long) */
+/*--------------------------------------------------------------------------*/
+
+#ifndef __LIMITS_H
+#define __LIMITS_H 1
+
+#define MB_LEN_MAX 1
+#define CHAR_BIT 8
+#define SCHAR_MIN -128L
+#define SCHAR_MAX 127L
+#define UCHAR_MAX 255
+#define CHAR_MIN 0
+#define CHAR_MAX UCHAR_MAX
+#define SHRT_MIN -32768
+#define SHRT_MAX 32767
+#define USHRT_MAX 65535
+#define INT_MIN 0x80000000
+#define INT_MAX 0x7FFFFFFF
+#define UINT_MAX 0xFFFFFFFFL
+#define LONG_MIN INT_MIN
+#define LONG_MAX INT_MAX
+#define ULONG_MAX UINT_MAX
+
+#endif
diff --git a/src/arch/e1/include/setjmp.h b/src/arch/e1/include/setjmp.h
new file mode 100644
index 000000000..ef401b625
--- /dev/null
+++ b/src/arch/e1/include/setjmp.h
@@ -0,0 +1,23 @@
+#ifndef _SETJMP_H
+#define _SETJMP_H
+
+
+typedef struct {
+ unsigned long G3;
+ unsigned long G4;
+ unsigned long SavedSP;
+ unsigned long SavedPC;
+ unsigned long SavedSR;
+ unsigned long ReturnValue;
+} __jmp_buf[1];
+
+typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
+ {
+ __jmp_buf __jmpbuf; /* Calling environment. */
+ int __mask_was_saved; /* Saved the signal mask? */
+ } jmp_buf[1];
+
+void longjmp(jmp_buf state, int value );
+int setjmp( jmp_buf state);
+
+#endif
diff --git a/src/arch/e1/include/stdint.h b/src/arch/e1/include/stdint.h
new file mode 100644
index 000000000..8a7ad978a
--- /dev/null
+++ b/src/arch/e1/include/stdint.h
@@ -0,0 +1,16 @@
+#ifndef STDINT_H
+#define STDINT_H
+
+typedef unsigned long size_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned long uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed long long int64_t;
+
+#endif /* STDINT_H */