diff options
| author | Michael Brown | 2005-03-08 19:53:11 +0100 |
|---|---|---|
| committer | Michael Brown | 2005-03-08 19:53:11 +0100 |
| commit | 3d6123e69ab879c72ff489afc5bf93ef0b7a94ce (patch) | |
| tree | 9f3277569153a550fa8d81ebd61bd88f266eb8da /src/arch/e1/include/bits | |
| download | ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.gz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.xz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.zip | |
Initial revision
Diffstat (limited to 'src/arch/e1/include/bits')
| -rw-r--r-- | src/arch/e1/include/bits/byteswap.h | 39 | ||||
| -rw-r--r-- | src/arch/e1/include/bits/cpu.h | 6 | ||||
| -rw-r--r-- | src/arch/e1/include/bits/elf.h | 6 | ||||
| -rw-r--r-- | src/arch/e1/include/bits/endian.h | 6 | ||||
| -rw-r--r-- | src/arch/e1/include/bits/string.h | 35 |
5 files changed, 92 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 */ |
