diff options
Diffstat (limited to 'include/asm-nios')
-rwxr-xr-x | include/asm-nios/bitops.h | 37 | ||||
-rwxr-xr-x | include/asm-nios/byteorder.h | 30 | ||||
-rwxr-xr-x | include/asm-nios/cache.h | 1 | ||||
-rwxr-xr-x | include/asm-nios/global_data.h | 51 | ||||
-rwxr-xr-x | include/asm-nios/io.h | 100 | ||||
-rwxr-xr-x | include/asm-nios/posix_types.h | 63 | ||||
-rwxr-xr-x | include/asm-nios/processor.h | 1 | ||||
-rwxr-xr-x | include/asm-nios/psr.h | 28 | ||||
-rwxr-xr-x | include/asm-nios/ptrace.h | 36 | ||||
-rwxr-xr-x | include/asm-nios/status_led.h | 132 | ||||
-rwxr-xr-x | include/asm-nios/string.h | 25 | ||||
-rwxr-xr-x | include/asm-nios/system.h | 4 | ||||
-rwxr-xr-x | include/asm-nios/types.h | 57 | ||||
-rwxr-xr-x | include/asm-nios/u-boot.h | 49 |
14 files changed, 614 insertions, 0 deletions
diff --git a/include/asm-nios/bitops.h b/include/asm-nios/bitops.h new file mode 100755 index 0000000..7744212 --- /dev/null +++ b/include/asm-nios/bitops.h @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2003, Psyent Corporation <www.psyent.com> + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _ASM_NIOS_BITOPS_H_ +#define _ASM_NIOS_BITOPS_H_ + + +extern void set_bit(int nr, volatile void * a); +extern void clear_bit(int nr, volatile void * a); +extern int test_and_clear_bit(int nr, volatile void * a); +extern void change_bit(unsigned long nr, volatile void *addr); +extern int test_and_set_bit(int nr, volatile void * a); +extern int test_and_change_bit(int nr, volatile void * addr); +extern int test_bit(int nr, volatile void * a); +extern int ffs(int i); + +#endif /* _ASM_NIOS_BITOPS_H */ diff --git a/include/asm-nios/byteorder.h b/include/asm-nios/byteorder.h new file mode 100755 index 0000000..dc71021 --- /dev/null +++ b/include/asm-nios/byteorder.h @@ -0,0 +1,30 @@ +/* +* (C) Copyright 2003, Psyent Corporation <www.psyent.com> +* Scott McNutt <smcnutt@psyent.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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; either version 2 of +* the License, or (at your option) any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __ASM_NIOS_BYTEORDER_H +#define __ASM_NIOS_BYTEORDER_H + +#include <asm/types.h> +#include <linux/byteorder/little_endian.h> + +#endif diff --git a/include/asm-nios/cache.h b/include/asm-nios/cache.h new file mode 100755 index 0000000..3cdb703 --- /dev/null +++ b/include/asm-nios/cache.h @@ -0,0 +1 @@ +/*FIXME: Implement this! */ diff --git a/include/asm-nios/global_data.h b/include/asm-nios/global_data.h new file mode 100755 index 0000000..fd11389 --- /dev/null +++ b/include/asm-nios/global_data.h @@ -0,0 +1,51 @@ +/* + * (C) Copyright 2003, Psyent Corporation <www.psyent.com> + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __ASM_NIOS_GLOBALDATA_H +#define __ASM_NIOS_GLOBALDATA_H + +typedef struct global_data { + bd_t *bd; + unsigned long flags; + unsigned long baudrate; + unsigned long cpu_clk; /* CPU clock in Hz! */ + unsigned long have_console; /* serial_init() was called */ + unsigned long ram_size; /* RAM size */ + unsigned long reloc_off; /* Relocation Offset */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid */ +#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) + unsigned long post_log_word; /* Record POST activities */ + unsigned long post_init_f_time; /* When post_init_f started */ +#endif + void **jt; /* Standalone app jump table */ +} gd_t; + +/* flags */ +#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ +#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ + +#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7") + +#endif /* __ASM_NIOS_GLOBALDATA_H */ diff --git a/include/asm-nios/io.h b/include/asm-nios/io.h new file mode 100755 index 0000000..07499d9 --- /dev/null +++ b/include/asm-nios/io.h @@ -0,0 +1,100 @@ +/* + * (C) Copyright 2003, Psyent Corporation <www.psyent.com> + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifndef __ASM_NIOS_IO_H_ +#define __ASM_NIOS_IO_H_ + +#define readb(addr)\ + ({unsigned char val;\ + asm volatile( " pfxio 0 \n"\ + " ld %0, [%1] \n"\ + " ext8d %0, %1 \n"\ + :"=r"(val) : "r" (addr)); val;}) + +#define readw(addr)\ + ({unsigned short val;\ + asm volatile( " pfxio 0 \n"\ + " ld %0, [%1] \n"\ + " ext16d %0, %1 \n"\ + :"=r"(val) : "r" (addr)); val;}) + +#define readl(addr)\ + ({unsigned long val;\ + asm volatile( " pfxio 0 \n"\ + " ld %0, [%1] \n"\ + :"=r"(val) : "r" (addr)); val;}) + +#define writeb(addr,val)\ + asm volatile ( " fill8 %%r0, %1 \n"\ + " st8d [%0], %%r0 \n"\ + : : "r" (addr), "r" (val) : "r0") + +#define writew(addr,val)\ + asm volatile ( " fill16 %%r0, %1 \n"\ + " st16d [%0], %%r0 \n"\ + : : "r" (addr), "r" (val) : "r0") + +#define writel(addr,val)\ + asm volatile ( " st [%0], %1 \n"\ + : : "r" (addr), "r" (val)) + +#define inb(addr) readb(addr) +#define inw(addr) readw(addr) +#define inl(addr) readl(addr) +#define outb(val,addr) writeb(addr,val) +#define outw(val,addr) writew(addr,val) +#define outl(val,addr) writel(addr,val) + +static inline void insb (unsigned long port, void *dst, unsigned long count) +{ + unsigned char *p = dst; + while (count--) *p++ = inb (port); +} +static inline void insw (unsigned long port, void *dst, unsigned long count) +{ + unsigned short *p = dst; + while (count--) *p++ = inw (port); +} +static inline void insl (unsigned long port, void *dst, unsigned long count) +{ + unsigned long *p = dst; + while (count--) *p++ = inl (port); +} + +static inline void outsb (unsigned long port, const void *src, unsigned long count) +{ + const unsigned char *p = src; + while (count--) outb (*p++, port); +} + +static inline void outsw (unsigned long port, const void *src, unsigned long count) +{ + const unsigned short *p = src; + while (count--) outw (*p++, port); +} +static inline void outsl (unsigned long port, const void *src, unsigned long count) +{ + const unsigned long *p = src; + while (count--) outl (*p++, port); +} + +#endif /* __ASM_NIOS_IO_H_ */ diff --git a/include/asm-nios/posix_types.h b/include/asm-nios/posix_types.h new file mode 100755 index 0000000..eb74214 --- /dev/null +++ b/include/asm-nios/posix_types.h @@ -0,0 +1,63 @@ +#ifndef __ASM_NIOS_POSIX_TYPES_H +#define __ASM_NIOS_POSIX_TYPES_H + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned short __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned long __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif + +typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) + int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +} __kernel_fsid_t; + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#undef __FD_SET +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) + +#undef __FD_CLR +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) + +#undef __FD_ISSET +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) + +#undef __FD_ZERO +#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + +#endif diff --git a/include/asm-nios/processor.h b/include/asm-nios/processor.h new file mode 100755 index 0000000..78b8976 --- /dev/null +++ b/include/asm-nios/processor.h @@ -0,0 +1 @@ +/* FIXME: Implement this! */ diff --git a/include/asm-nios/psr.h b/include/asm-nios/psr.h new file mode 100755 index 0000000..6e8eba8 --- /dev/null +++ b/include/asm-nios/psr.h @@ -0,0 +1,28 @@ +/* + * (C) Copyright 2003, Psyent Corporation <www.psyent.com> + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _NIOS_PSR_H +#define _NIOS_PSR_H + + +#endif /* _NIOS_PSR_H */ diff --git a/include/asm-nios/ptrace.h b/include/asm-nios/ptrace.h new file mode 100755 index 0000000..73754c8 --- /dev/null +++ b/include/asm-nios/ptrace.h @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2003, Psyent Corporation <www.psyent.com> + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _NIOS_PTRACE_H +#define _NIOS_PTRACE_H + +struct pt_regs { + unsigned global[8]; + unsigned in[8]; + unsigned status; + unsigned istatus; + unsigned retaddr; +}; + + +#endif /* _NIOS_PTRACE_H */ diff --git a/include/asm-nios/status_led.h b/include/asm-nios/status_led.h new file mode 100755 index 0000000..241c917 --- /dev/null +++ b/include/asm-nios/status_led.h @@ -0,0 +1,132 @@ +/* + * (C) Copyright 2003, Li-Pro.Net <www.li-pro.net> + * Stephan Linz <linz@li-pro.net> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * asm-nios/status_led.h + * + * NIOS PIO based status led support functions + */ + +#ifndef __ASM_STATUS_LED_H__ +#define __ASM_STATUS_LED_H__ + +#include <nios-io.h> + +/* led_id_t is unsigned int mask */ +typedef unsigned int led_id_t; + +#ifdef STATUS_LED_WRONLY /* emulate read access */ +static led_id_t __led_portval = 0; +#endif + +static inline void __led_init (led_id_t mask, int state) +{ + nios_pio_t *piop = (nios_pio_t*)STATUS_LED_BASE; + +#ifdef STATUS_LED_WRONLY /* emulate read access */ + +#if (STATUS_LED_ACTIVE == 0) + if (state == STATUS_LED_ON) + __led_portval &= ~mask; + else + __led_portval |= mask; +#else + if (state == STATUS_LED_ON) + __led_portval |= mask; + else + __led_portval &= ~mask; +#endif + + piop->data = __led_portval; + +#else /* !STATUS_LED_WRONLY */ + +#if (STATUS_LED_ACTIVE == 0) + if (state == STATUS_LED_ON) + piop->data &= ~mask; + else + piop->data |= mask; +#else + if (state == STATUS_LED_ON) + piop->data |= mask; + else + piop->data &= ~mask; +#endif + + piop->direction |= mask; + +#endif /* STATUS_LED_WRONLY */ +} + +static inline void __led_toggle (led_id_t mask) +{ + nios_pio_t *piop = (nios_pio_t*)STATUS_LED_BASE; + +#ifdef STATUS_LED_WRONLY /* emulate read access */ + + __led_portval ^= mask; + piop->data = __led_portval; + +#else /* !STATUS_LED_WRONLY */ + + piop->data ^= mask; + +#endif /* STATUS_LED_WRONLY */ +} + +static inline void __led_set (led_id_t mask, int state) +{ + nios_pio_t *piop = (nios_pio_t*)STATUS_LED_BASE; + +#ifdef STATUS_LED_WRONLY /* emulate read access */ + +#if (STATUS_LED_ACTIVE == 0) + if (state == STATUS_LED_ON) + __led_portval &= ~mask; + else + __led_portval |= mask; +#else + if (state == STATUS_LED_ON) + __led_portval |= mask; + else + __led_portval &= ~mask; +#endif + + piop->data = __led_portval; + +#else /* !STATUS_LED_WRONLY */ + +#if (STATUS_LED_ACTIVE == 0) + if (state == STATUS_LED_ON) + piop->data &= ~mask; + else + piop->data |= mask; +#else + if (state == STATUS_LED_ON) + piop->data |= mask; + else + piop->data &= ~mask; +#endif + +#endif /* STATUS_LED_WRONLY */ +} + +#endif /* __ASM_STATUS_LED_H__ */ diff --git a/include/asm-nios/string.h b/include/asm-nios/string.h new file mode 100755 index 0000000..fa33275 --- /dev/null +++ b/include/asm-nios/string.h @@ -0,0 +1,25 @@ +#ifndef __ASM_NIOS_STRING_H +#define __ASM_NIOS_STRING_H + +#undef __HAVE_ARCH_STRRCHR +extern char * strrchr(const char * s, int c); + +#undef __HAVE_ARCH_STRCHR +extern char * strchr(const char * s, int c); + +#undef __HAVE_ARCH_MEMCPY +extern void * memcpy(void *, const void *, __kernel_size_t); + +#undef __HAVE_ARCH_MEMMOVE +extern void * memmove(void *, const void *, __kernel_size_t); + +#undef __HAVE_ARCH_MEMCHR +extern void * memchr(const void *, int, __kernel_size_t); + +#undef __HAVE_ARCH_MEMSET +extern void * memset(void *, int, __kernel_size_t); + +#undef __HAVE_ARCH_MEMZERO +extern void memzero(void *ptr, __kernel_size_t n); + +#endif diff --git a/include/asm-nios/system.h b/include/asm-nios/system.h new file mode 100755 index 0000000..9a9383d --- /dev/null +++ b/include/asm-nios/system.h @@ -0,0 +1,4 @@ +#ifndef _ASM_NIOS_SYSTEM_H_ +#define _ASM_NIOS_SYSTEM_H_ + +#endif /* _ASM_NIOS_SYSTEM_H */ diff --git a/include/asm-nios/types.h b/include/asm-nios/types.h new file mode 100755 index 0000000..43fd8f6 --- /dev/null +++ b/include/asm-nios/types.h @@ -0,0 +1,57 @@ +#ifndef _NIOS_TYPES_H +#define _NIOS_TYPES_H + +/* + * This file is never included by application software unless + * explicitly requested (e.g., via linux/types.h) in which case the + * application is Linux specific so (user-) name space pollution is + * not a major issue. However, for interoperability, libraries still + * need to be careful to avoid a name clashes. + */ + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#define BITS_PER_LONG 32 + +/* Dma addresses are 32-bits wide. */ + +typedef u32 dma_addr_t; +#endif /* __KERNEL__ */ + +#endif /* _NIOS_TYPES_H */ diff --git a/include/asm-nios/u-boot.h b/include/asm-nios/u-boot.h new file mode 100755 index 0000000..aae4be1 --- /dev/null +++ b/include/asm-nios/u-boot.h @@ -0,0 +1,49 @@ +/* + * (C) Copyright 2003 + * Psyent Corporation + * Scott McNutt <smcnutt@psyent.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ******************************************************************** + * NOTE: This header file defines an interface to U-Boot. Including + * this (unmodified) header file in another file is considered normal + * use of U-Boot, and does *not* fall under the heading of "derived + * work". + ******************************************************************** + */ + +#ifndef _U_BOOT_H_ +#define _U_BOOT_H_ + +typedef struct bd_info { + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */ + unsigned long bi_flashstart; /* start of FLASH memory */ + unsigned long bi_flashsize; /* size of FLASH memory */ + unsigned long bi_flashoffset; /* reserved area for startup monitor */ + unsigned long bi_sramstart; /* start of SRAM memory */ + unsigned long bi_sramsize; /* size of SRAM memory */ + unsigned long bi_ip_addr; /* IP Address */ + unsigned char bi_enetaddr[6]; /* Ethernet adress */ + unsigned long bi_baudrate; /* Console Baudrate */ +} bd_t; + + +#endif /* _U_BOOT_H_ */ |