2 * Copyright (C) 2006 Atmel Corporation
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 #ifndef __ASM_AVR32_POSIX_TYPES_H
23 #define __ASM_AVR32_POSIX_TYPES_H
26 * This file is generally used by user-level software, so you need to
27 * be a little careful about namespace pollution etc. Also, we cannot
28 * assume GCC is being used.
31 typedef unsigned long __kernel_dev_t;
32 typedef unsigned long __kernel_ino_t;
33 typedef unsigned short __kernel_mode_t;
34 typedef unsigned short __kernel_nlink_t;
35 typedef long __kernel_off_t;
36 typedef int __kernel_pid_t;
37 typedef unsigned short __kernel_ipc_pid_t;
38 typedef unsigned int __kernel_uid_t;
39 typedef unsigned int __kernel_gid_t;
40 typedef unsigned long __kernel_size_t;
41 typedef int __kernel_ssize_t;
42 typedef int __kernel_ptrdiff_t;
43 typedef long __kernel_time_t;
44 typedef long __kernel_suseconds_t;
45 typedef long __kernel_clock_t;
46 typedef int __kernel_timer_t;
47 typedef int __kernel_clockid_t;
48 typedef int __kernel_daddr_t;
49 typedef char * __kernel_caddr_t;
50 typedef unsigned short __kernel_uid16_t;
51 typedef unsigned short __kernel_gid16_t;
52 typedef unsigned int __kernel_uid32_t;
53 typedef unsigned int __kernel_gid32_t;
55 typedef unsigned short __kernel_old_uid_t;
56 typedef unsigned short __kernel_old_gid_t;
57 typedef unsigned short __kernel_old_dev_t;
60 typedef long long __kernel_loff_t;
64 #if defined(__KERNEL__) || defined(__USE_ALL)
66 #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
68 #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
71 #if defined(__KERNEL__)
74 static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
76 unsigned long __tmp = __fd / __NFDBITS;
77 unsigned long __rem = __fd % __NFDBITS;
78 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
82 static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
84 unsigned long __tmp = __fd / __NFDBITS;
85 unsigned long __rem = __fd % __NFDBITS;
86 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
91 static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
93 unsigned long __tmp = __fd / __NFDBITS;
94 unsigned long __rem = __fd % __NFDBITS;
95 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
99 * This will unroll the loop for the normal constant case (8 ints,
100 * for a 256-bit fd_set)
103 static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
105 unsigned long *__tmp = __p->fds_bits;
108 if (__builtin_constant_p(__FDSET_LONGS)) {
109 switch (__FDSET_LONGS) {
111 __tmp[ 0] = 0; __tmp[ 1] = 0;
112 __tmp[ 2] = 0; __tmp[ 3] = 0;
113 __tmp[ 4] = 0; __tmp[ 5] = 0;
114 __tmp[ 6] = 0; __tmp[ 7] = 0;
115 __tmp[ 8] = 0; __tmp[ 9] = 0;
116 __tmp[10] = 0; __tmp[11] = 0;
117 __tmp[12] = 0; __tmp[13] = 0;
118 __tmp[14] = 0; __tmp[15] = 0;
122 __tmp[ 0] = 0; __tmp[ 1] = 0;
123 __tmp[ 2] = 0; __tmp[ 3] = 0;
124 __tmp[ 4] = 0; __tmp[ 5] = 0;
125 __tmp[ 6] = 0; __tmp[ 7] = 0;
129 __tmp[ 0] = 0; __tmp[ 1] = 0;
130 __tmp[ 2] = 0; __tmp[ 3] = 0;
142 #endif /* defined(__KERNEL__) */
144 #endif /* __ASM_AVR32_POSIX_TYPES_H */