diff options
Diffstat (limited to 'include')
162 files changed, 4089 insertions, 3581 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 578ed3f1a607..302201f1a097 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h @@ -321,6 +321,7 @@ static inline int fls(int word) #else #define fls generic_fls #endif +#define fls64 generic_fls64 /* Compute powers of two for the given integer. */ static inline long floor_log2(unsigned long word) diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h new file mode 100644 index 000000000000..7da89569061e --- /dev/null +++ b/include/asm-arm/arch-pxa/ohci.h @@ -0,0 +1,18 @@ +#ifndef ASMARM_ARCH_OHCI_H +#define ASMARM_ARCH_OHCI_H + +struct device; + +struct pxaohci_platform_data { + int (*init)(struct device *); + void (*exit)(struct device *); + + int port_mode; +#define PMM_NPS_MODE 1 +#define PMM_GLOBAL_MODE 2 +#define PMM_PERPORT_MODE 3 +}; + +extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); + +#endif diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index 7399d431edfe..d02de721ecc1 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h @@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) /* * ffs: find first bit set. This is defined the same way as @@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word) #define fls(x) \ ( __builtin_constant_p(x) ? generic_fls(x) : \ ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) +#define fls64(x) generic_fls64(x) #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) #define __ffs(x) (ffs(x) - 1) #define ffz(x) __ffs( ~(x) ) diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h index 7d062fb2e343..15cc6f2da792 100644 --- a/include/asm-arm26/bitops.h +++ b/include/asm-arm26/bitops.h @@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) /* * ffs: find first bit set. This is defined the same way as diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h index 1bddb3f3a289..d3eb0f1e4208 100644 --- a/include/asm-cris/bitops.h +++ b/include/asm-cris/bitops.h @@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) /* * hweightN - returns the hamming weight of a N-bit word diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index b664bd5b6663..02be7b3a8a83 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h @@ -228,6 +228,7 @@ found_middle: \ bit ? 33 - bit : bit; \ }) +#define fls64(x) generic_fls64(x) /* * Every architecture must define this function. It's the fastest diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index ce31b739fd80..0e6d9852008c 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #ifdef __KERNEL__ diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h index 5036f595f8c9..c0411ec9d651 100644 --- a/include/asm-h8300/bitops.h +++ b/include/asm-h8300/bitops.h @@ -406,5 +406,6 @@ found_middle: #endif /* __KERNEL__ */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #endif /* _H8300_BITOPS_H */ diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index ddf1739dc7fd..4807aa1d2e3d 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -372,6 +372,7 @@ static inline unsigned long ffz(unsigned long word) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #ifdef __KERNEL__ diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 7232528e2d0c..36d0fb95ea89 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h @@ -345,6 +345,7 @@ fls (int t) x |= x >> 16; return ia64_popcnt(x); } +#define fls64(x) generic_fls64(x) /* * ffs: find first bit set. This is defined the same way as the libc and compiler builtin diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h index e78443981349..abea2fdd8689 100644 --- a/include/asm-m32r/bitops.h +++ b/include/asm-m32r/bitops.h @@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word) * fls: find last bit set. */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #ifdef __KERNEL__ diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index b1bcf7c66516..13f4c0048463 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h @@ -310,6 +310,7 @@ static inline int fls(int x) return 32 - cnt; } +#define fls64(x) generic_fls64(x) /* * Every architecture must define this function. It's the fastest diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index c42f88a9b9f9..4058dd086a02 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h @@ -499,5 +499,6 @@ found_middle: * fls: find last bit set. */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #endif /* _M68KNOMMU_BITOPS_H */ diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore deleted file mode 100644 index 4ec57ad5bc3c..000000000000 --- a/include/asm-mips/.gitignore +++ /dev/null @@ -1 +0,0 @@ -asm_offsets.h diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 5496f9064a6a..3b0c8aaf6e8b 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word) return flz(~word) + 1; } - +#define fls64(x) generic_fls64(x) /* * find_next_zero_bit - find the first zero bit in a memory region diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 55b98c67fd82..15d8c2b51584 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h @@ -263,6 +263,7 @@ static __inline__ int fls(int x) return ret; } +#define fls64(x) generic_fls64(x) /* * hweightN: returns the hamming weight (i.e. the number diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h index 5727229b0444..1996eaa8aeae 100644 --- a/include/asm-powerpc/bitops.h +++ b/include/asm-powerpc/bitops.h @@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x) asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); return 32 - lz; } +#define fls64(x) generic_fls64(x) /* * hweightN: returns the hamming weight (i.e. the number diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index b07c578b22ea..61232760cc3b 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h @@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b) * fls: find last bit set. */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) /* * hweightN: returns the hamming weight (i.e. the number diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index 5163d1ff2f1b..1c5260860045 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h @@ -470,6 +470,7 @@ found_middle: */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #endif /* __KERNEL__ */ diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h index e1ff63e09227..ce9c3ad45fe0 100644 --- a/include/asm-sh64/bitops.h +++ b/include/asm-sh64/bitops.h @@ -510,6 +510,7 @@ found_middle: #define ffs(x) generic_ffs(x) #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #endif /* __KERNEL__ */ diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index bfbd795a0a80..41722b5e45ef 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h @@ -298,6 +298,7 @@ static inline int ffs(int x) * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) /* * hweightN: returns the hamming weight (i.e. the number diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 6388b8376c50..6efc0162fb09 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word) */ #define fls(x) generic_fls(x) +#define fls64(x) generic_fls64(x) #ifdef __KERNEL__ diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h index b91e799763fd..8955d2376ac8 100644 --- a/include/asm-v850/bitops.h +++ b/include/asm-v850/bitops.h @@ -276,6 +276,7 @@ found_middle: #define ffs(x) generic_ffs (x) #define fls(x) generic_fls (x) +#define fls64(x) generic_fls64(x) #define __ffs(x) ffs(x) diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index 05a0d374404b..a4d5d0909453 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h @@ -340,6 +340,20 @@ static __inline__ unsigned long __ffs(unsigned long word) return word; } +/* + * __fls: find last bit set. + * @word: The word to search + * + * Undefined if no zero exists, so code should check against ~0UL first. + */ +static __inline__ unsigned long __fls(unsigned long word) +{ + __asm__("bsrq %1,%0" + :"=r" (word) + :"rm" (word)); + return word; +} + #ifdef __KERNEL__ static inline int sched_find_first_bit(const unsigned long *b) @@ -370,6 +384,19 @@ static __inline__ int ffs(int x) } /** + * fls64 - find last bit set in 64 bit word + * @x: the word to search + * + * This is defined the same way as fls. + */ +static __inline__ int fls64(__u64 x) +{ + if (x == 0) + return 0; + return __fls(x) + 1; +} + +/** * hweightN - returns the hamming weight of a N-bit word * @x: the word to weigh * diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index e76ee889e21d..0a2065f1a372 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h @@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x) { return __cntlz(x); } +#define fls64(x) generic_fls64(x) static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset) diff --git a/include/linux/bio.h b/include/linux/bio.h index 685fd3720df5..b60ffe32cd21 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t); extern void bio_init(struct bio *); extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); +extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, + unsigned int, unsigned int); extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 38c2fb7ebe09..6a2a19f14bb2 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x) */ #include <asm/bitops.h> + +static inline int generic_fls64(__u64 x) +{ + __u32 h = x >> 32; + if (h) + return fls(x) + 32; + return fls(x); +} + static __inline__ int get_bitmask_order(unsigned int count) { int order; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a33a31e71bbc..a18500d196e1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -184,6 +184,7 @@ struct request { void *sense; unsigned int timeout; + int retries; /* * For Power Management requests @@ -558,6 +559,7 @@ extern void blk_unregister_queue(struct gendisk *disk); extern void register_disk(struct gendisk *dev); extern void generic_make_request(struct bio *bio); extern void blk_put_request(struct request *); +extern void __blk_put_request(request_queue_t *, struct request *); extern void blk_end_sync_rq(struct request *rq); extern void blk_attempt_remerge(request_queue_t *, struct request *); extern struct request *blk_get_request(request_queue_t *, int, gfp_t); @@ -579,6 +581,10 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *, int); +extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, + struct request *, int, + void (*done)(struct request *)); + static inline request_queue_t *bdev_get_queue(struct block_device *bdev) { return bdev->bd_disk->queue; @@ -696,7 +702,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *); #define MAX_PHYS_SEGMENTS 128 #define MAX_HW_SEGMENTS 128 -#define MAX_SECTORS 255 +#define SAFE_MAX_SECTORS 255 +#define BLK_DEF_MAX_SECTORS 1024 #define MAX_SEGMENT_SIZE 65536 diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index d068176b7ad7..c31650df9241 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu); /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ unsigned int cpufreq_get(unsigned int cpu); +/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ +#ifdef CONFIG_CPU_FREQ +unsigned int cpufreq_quick_get(unsigned int cpu); +#else +static inline unsigned int cpufreq_quick_get(unsigned int cpu) +{ + return 0; +} +#endif + /********************************************************************* * CPUFREQ DEFAULT GOVERNOR * diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 71fab4311e92..088529f54965 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h @@ -192,10 +192,9 @@ enum { #include <linux/workqueue.h> #include <net/inet_connection_sock.h> +#include <net/inet_sock.h> #include <net/inet_timewait_sock.h> -#include <net/sock.h> #include <net/tcp_states.h> -#include <net/tcp.h> enum dccp_state { DCCP_OPEN = TCP_ESTABLISHED, @@ -408,8 +407,6 @@ struct dccp_ackvec; * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss * @dccps_timestamp_time - time of latest TIMESTAMP option * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option - * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options) - * @dccps_pmtu_cookie - Last pmtu seen by socket * @dccps_packet_size - Set thru setsockopt * @dccps_role - Role of this sock, one of %dccp_role * @dccps_ndp_count - number of Non Data Packets since last data packet @@ -434,8 +431,6 @@ struct dccp_sock { __u32 dccps_timestamp_echo; __u32 dccps_packet_size; unsigned long dccps_ndp_count; - __u16 dccps_ext_header_len; - __u32 dccps_pmtu_cookie; __u32 dccps_mss_cache; struct dccp_options dccps_options; struct dccp_ackvec *dccps_hc_rx_ackvec; diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 5f49a30eb6f2..745c988359c0 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr) * @addr: Pointer to a six-byte array containing the Ethernet address * * Return true if the address is a multicast address. + * By definition the broadcast address is also a multicast address. */ static inline int is_multicast_ether_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return (0x01 & addr[0]); } /** diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index e677f73f13dd..4fab3d0a4bce 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -157,8 +157,7 @@ struct pppox_proto { extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); extern void unregister_pppox_proto(int proto_num); extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ -extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, - unsigned long arg); +extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); /* PPPoX socket states */ enum { diff --git a/include/linux/ip.h b/include/linux/ip.h index 33e8a19a1a0f..9e2eb9a602eb 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -16,6 +16,7 @@ */ #ifndef _LINUX_IP_H #define _LINUX_IP_H +#include <linux/types.h> #include <asm/byteorder.h> #define IPTOS_TOS_MASK 0x1E @@ -78,126 +79,6 @@ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 3 /* specified modules only */ -#ifdef __KERNEL__ -#include <linux/config.h> -#include <linux/types.h> -#include <net/request_sock.h> -#include <net/sock.h> -#include <linux/igmp.h> -#include <net/flow.h> - -struct ip_options { - __u32 faddr; /* Saved first hop address */ - unsigned char optlen; - unsigned char srr; - unsigned char rr; - unsigned char ts; - unsigned char is_setbyuser:1, /* Set by setsockopt? */ - is_data:1, /* Options in __data, rather than skb */ - is_strictroute:1, /* Strict source route */ - srr_is_hit:1, /* Packet destination addr was our one */ - is_changed:1, /* IP checksum more not valid */ - rr_needaddr:1, /* Need to record addr of outgoing dev */ - ts_needtime:1, /* Need to record timestamp */ - ts_needaddr:1; /* Need to record addr of outgoing dev */ - unsigned char router_alert; - unsigned char __pad1; - unsigned char __pad2; - unsigned char __data[0]; -}; - -#define optlength(opt) (sizeof(struct ip_options) + opt->optlen) - -struct inet_request_sock { - struct request_sock req; - u32 loc_addr; - u32 rmt_addr; - u16 rmt_port; - u16 snd_wscale : 4, - rcv_wscale : 4, - tstamp_ok : 1, - sack_ok : 1, - wscale_ok : 1, - ecn_ok : 1, - acked : 1; - struct ip_options *opt; -}; - -static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) -{ - return (struct inet_request_sock *)sk; -} - -struct ipv6_pinfo; - -struct inet_sock { - /* sk and pinet6 has to be the first two members of inet_sock */ - struct sock sk; -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) - struct ipv6_pinfo *pinet6; -#endif - /* Socket demultiplex comparisons on incoming packets. */ - __u32 daddr; /* Foreign IPv4 addr */ - __u32 rcv_saddr; /* Bound local IPv4 addr */ - __u16 dport; /* Destination port */ - __u16 num; /* Local port */ - __u32 saddr; /* Sending source */ - __s16 uc_ttl; /* Unicast TTL */ - __u16 cmsg_flags; - struct ip_options *opt; - __u16 sport; /* Source port */ - __u16 id; /* ID counter for DF pkts */ - __u8 tos; /* TOS */ - __u8 mc_ttl; /* Multicasting TTL */ - __u8 pmtudisc; - unsigned recverr : 1, - freebind : 1, - hdrincl : 1, - mc_loop : 1; - int mc_index; /* Multicast device index */ - __u32 mc_addr; - struct ip_mc_socklist *mc_list; /* Group array */ - /* - * Following members are used to retain the infomation to build - * an ip header on each ip fragmentation while the socket is corked. - */ - struct { - unsigned int flags; - unsigned int fragsize; - struct ip_options *opt; - struct rtable *rt; - int length; /* Total length of all frames */ - u32 addr; - struct flowi fl; - } cork; -}; - -#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ -#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ - -static inline struct inet_sock *inet_sk(const struct sock *sk) -{ - return (struct inet_sock *)sk; -} - -static inline void __inet_sk_copy_descendant(struct sock *sk_to, - const struct sock *sk_from, - const int ancestor_size) -{ - memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, - sk_from->sk_prot->obj_size - ancestor_size); -} -#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) -static inline void inet_sk_copy_descendant(struct sock *sk_to, - const struct sock *sk_from) -{ - __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); -} -#endif -#endif - -extern int inet_sk_rebuild_header(struct sock *sk); - struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 ihl:4, diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index e0b922785d98..93bbed5c6cf4 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -171,12 +171,13 @@ enum { }; #ifdef __KERNEL__ -#include <linux/in6.h> /* struct sockaddr_in6 */ #include <linux/icmpv6.h> -#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ #include <linux/tcp.h> #include <linux/udp.h> +#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ +#include <net/inet_sock.h> + /* This structure contains results of exthdrs parsing as offsets from skb->nh. @@ -199,18 +200,17 @@ static inline int inet6_iif(const struct sk_buff *skb) return IP6CB(skb)->iif; } -struct tcp6_request_sock { - struct tcp_request_sock req; +struct inet6_request_sock { struct in6_addr loc_addr; struct in6_addr rmt_addr; struct sk_buff *pktopts; int iif; }; -static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) -{ - return (struct tcp6_request_sock *)sk; -} +struct tcp6_request_sock { + struct tcp_request_sock tcp6rsk_tcp; + struct inet6_request_sock tcp6rsk_inet6; +}; /** * struct ipv6_pinfo - ipv6 private area @@ -298,12 +298,36 @@ struct tcp6_sock { struct ipv6_pinfo inet6; }; +extern int inet6_sk_rebuild_header(struct sock *sk); + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) { return inet_sk(__sk)->pinet6; } +static inline struct inet6_request_sock * + inet6_rsk(const struct request_sock *rsk) +{ + return (struct inet6_request_sock *)(((u8 *)rsk) + + inet_rsk(rsk)->inet6_rsk_offset); +} + +static inline u32 inet6_rsk_offset(struct request_sock *rsk) +{ + return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock); +} + +static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) +{ + struct request_sock *req = reqsk_alloc(ops); + + if (req != NULL) + inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); + + return req; +} + static inline struct raw6_sock *raw6_sk(const struct sock *sk) { return (struct raw6_sock *)sk; @@ -323,28 +347,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) -#include <linux/tcp.h> +struct inet6_timewait_sock { + struct in6_addr tw_v6_daddr; + struct in6_addr tw_v6_rcv_saddr; +}; struct tcp6_timewait_sock { - struct tcp_timewait_sock tw_v6_sk; - struct in6_addr tw_v6_daddr; - struct in6_addr tw_v6_rcv_saddr; + struct tcp_timewait_sock tcp6tw_tcp; + struct inet6_timewait_sock tcp6tw_inet6; }; -static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) +static inline u16 inet6_tw_offset(const struct proto *prot) { - return (struct tcp6_timewait_sock *)sk; + return prot->twsk_prot->twsk_obj_size - + sizeof(struct inet6_timewait_sock); } -static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) +static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk) +{ + return (struct inet6_timewait_sock *)(((u8 *)sk) + + inet_twsk(sk)->tw_ipv6_offset); +} + +static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk) { return likely(sk->sk_state != TCP_TIME_WAIT) ? - &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; + &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr; } -static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) +static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk) { - return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; + return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL; } static inline int inet_v6_ipv6only(const struct sock *sk) @@ -361,13 +394,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) return NULL; } +static inline struct inet6_request_sock * + inet6_rsk(const struct request_sock *rsk) +{ + return NULL; +} + static inline struct raw6_sock *raw6_sk(const struct sock *sk) { return NULL; } -#define __tcp_v6_rcv_saddr(__sk) NULL -#define tcp_v6_rcv_saddr(__sk) NULL +#define __inet6_rcv_saddr(__sk) NULL +#define inet6_rcv_saddr(__sk) NULL #define tcp_twsk_ipv6only(__sk) 0 #define inet_v6_ipv6only(__sk) 0 #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ diff --git a/include/linux/libata.h b/include/linux/libata.h index 41ea7dbc1755..e828e172ccbf 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -136,6 +136,8 @@ enum { ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ ATA_TMOUT_CDB = 30 * HZ, ATA_TMOUT_CDB_QUICK = 5 * HZ, + ATA_TMOUT_INTERNAL = 30 * HZ, + ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, /* ATA bus states */ BUS_UNKNOWN = 0, @@ -195,7 +197,7 @@ struct ata_port; struct ata_queued_cmd; /* typedefs */ -typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); +typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc); struct ata_ioports { unsigned long cmd_addr; @@ -280,9 +282,9 @@ struct ata_queued_cmd { /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ struct scatterlist *__sg; - ata_qc_cb_t complete_fn; + unsigned int err_mask; - struct completion *waiting; + ata_qc_cb_t complete_fn; void *private_data; }; @@ -331,8 +333,6 @@ struct ata_port { u8 ctl; /* cache of ATA control register */ u8 last_ctl; /* Cache last written value */ - unsigned int bus_state; - unsigned int port_state; unsigned int pio_mask; unsigned int mwdma_mask; unsigned int udma_mask; @@ -478,7 +478,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc); extern void ata_bmdma_stop(struct ata_queued_cmd *qc); extern u8 ata_bmdma_status(struct ata_port *ap); extern void ata_bmdma_irq_clear(struct ata_port *ap); -extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); +extern void ata_qc_complete(struct ata_queued_cmd *qc); extern void ata_eng_timeout(struct ata_port *ap); extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); @@ -670,6 +670,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc) qc->cursect = qc->cursg = qc->cursg_ofs = 0; qc->nsect = 0; qc->nbytes = qc->curbytes = 0; + qc->err_mask = 0; ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); } diff --git a/include/linux/net.h b/include/linux/net.h index d6a41e6577f6..28195a2d8ff0 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -107,7 +107,7 @@ enum sock_type { struct socket { socket_state state; unsigned long flags; - struct proto_ops *ops; + const struct proto_ops *ops; struct fasync_struct *fasync_list; struct file *file; struct sock *sk; @@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ (file, sock, vma)) \ \ -static struct proto_ops name##_ops = { \ +static const struct proto_ops name##_ops = { \ .family = fam, \ .owner = THIS_MODULE, \ .release = __lock_##name##_release, \ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 936f8b76114e..7fda03d338d1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -684,6 +684,7 @@ extern int netif_rx(struct sk_buff *skb); extern int netif_rx_ni(struct sk_buff *skb); #define HAVE_NETIF_RECEIVE_SKB 1 extern int netif_receive_skb(struct sk_buff *skb); +extern int dev_valid_name(const char *name); extern int dev_ioctl(unsigned int cmd, void __user *); extern int dev_ethtool(struct ifreq *); extern unsigned dev_get_flags(const struct net_device *); @@ -801,12 +802,16 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) return (1 << debug_value) - 1; } -/* Schedule rx intr now? */ +/* Test if receive needs to be scheduled */ +static inline int __netif_rx_schedule_prep(struct net_device *dev) +{ + return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state); +} +/* Test if receive needs to be scheduled but only if up */ static inline int netif_rx_schedule_prep(struct net_device *dev) { - return netif_running(dev) && - !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state); + return netif_running(dev) && __netif_rx_schedule_prep(dev); } /* Add interface to tail of rx poll list. This assumes that _prep has diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4db67b3b05cc..4f01710485cd 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -15,6 +15,7 @@ #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_SAS 0x0107 #define PCI_CLASS_STORAGE_OTHER 0x0180 #define PCI_BASE_CLASS_NETWORK 0x02 @@ -376,6 +377,10 @@ #define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_83815 0x0020 #define PCI_DEVICE_ID_NS_83820 0x0022 +#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d +#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e +#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f +#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030 #define PCI_DEVICE_ID_NS_SATURN 0x0035 #define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 #define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 724066778aff..6351c4055ace 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h @@ -216,6 +216,16 @@ struct sadb_x_nat_t_port { } __attribute__((packed)); /* sizeof(struct sadb_x_nat_t_port) == 8 */ +/* Generic LSM security context */ +struct sadb_x_sec_ctx { + uint16_t sadb_x_sec_len; + uint16_t sadb_x_sec_exttype; + uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ + uint8_t sadb_x_ctx_doi; + uint16_t sadb_x_ctx_len; +} __attribute__((packed)); +/* sizeof(struct sadb_sec_ctx) = 8 */ + /* Message types */ #define SADB_RESERVED 0 #define SADB_GETSPI 1 @@ -325,7 +335,8 @@ struct sadb_x_nat_t_port { #define SADB_X_EXT_NAT_T_SPORT 21 #define SADB_X_EXT_NAT_T_DPORT 22 #define SADB_X_EXT_NAT_T_OA 23 -#define SADB_EXT_MAX 23 +#define SADB_X_EXT_SEC_CTX 24 +#define SADB_EXT_MAX 24 /* Identity Extension values */ #define SADB_IDENTTYPE_RESERVED 0 diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index e87b233615b3..d10f35338507 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h @@ -429,6 +429,7 @@ enum TCA_NETEM_CORR, TCA_NETEM_DELAY_DIST, TCA_NETEM_REORDER, + TCA_NETEM_CORRUPT, __TCA_NETEM_MAX, }; @@ -457,6 +458,12 @@ struct tc_netem_reorder __u32 correlation; }; +struct tc_netem_corrupt +{ + __u32 probability; + __u32 correlation; +}; + #define NETEM_DIST_SCALE 8192 #endif diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 584d57cb393a..93b0959eb40f 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -162,6 +162,7 @@ struct pnp_card_link { struct pnp_card * card; struct pnp_card_driver * driver; void * driver_data; + pm_message_t pm_state; }; static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) @@ -294,6 +295,8 @@ struct pnp_driver { unsigned int flags; int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); void (*remove) (struct pnp_dev *dev); + int (*suspend) (struct pnp_dev *dev, pm_message_t state); + int (*resume) (struct pnp_dev *dev); struct device_driver driver; }; @@ -306,6 +309,8 @@ struct pnp_card_driver { unsigned int flags; int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); void (*remove) (struct pnp_card_link *card); + int (*suspend) (struct pnp_card_link *card, pm_message_t state); + int (*resume) (struct pnp_card_link *card); struct pnp_driver link; }; @@ -380,6 +385,8 @@ void pnp_init_resource_table(struct pnp_resource_table *table); int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); int pnp_auto_config_dev(struct pnp_dev *dev); int pnp_validate_config(struct pnp_dev *dev); +int pnp_start_dev(struct pnp_dev *dev); +int pnp_stop_dev(struct pnp_dev *dev); int pnp_activate_dev(struct pnp_dev *dev); int pnp_disable_dev(struct pnp_dev *dev); void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); @@ -423,6 +430,8 @@ static inline void pnp_init_resource_table(struct pnp_resource_table *table) { } static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } +static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } +static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } diff --git a/include/linux/random.h b/include/linux/random.h index 7b2adb3322d5..5d6456bcdeba 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes); void generate_random_uuid(unsigned char uuid_out[16]); extern __u32 secure_ip_id(__u32 daddr); -extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); -extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, - __u16 dport); +extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); +extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, + __u16 dport); extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, __u16 sport, __u16 dport); extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, diff --git a/include/linux/security.h b/include/linux/security.h index f7e0ae018712..ef753654daa5 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -59,6 +59,12 @@ struct sk_buff; struct sock; struct sockaddr; struct socket; +struct flowi; +struct dst_entry; +struct xfrm_selector; +struct xfrm_policy; +struct xfrm_state; +struct xfrm_user_sec_ctx; extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); extern int cap_netlink_recv(struct sk_buff *skb); @@ -788,6 +794,52 @@ struct swap_info_struct; * which is used to copy security attributes between local stream sockets. * @sk_free_security: * Deallocate security structure. + * @sk_getsid: + * Retrieve the LSM-specific sid for the sock to enable caching of network + * authorizations. + * + * Security hooks for XFRM operations. + * + * @xfrm_policy_alloc_security: + * @xp contains the xfrm_policy being added to Security Policy Database + * used by the XFRM system. + * @sec_ctx contains the security context information being provided by + * the user-level policy update program (e.g., setkey). + * Allocate a security structure to the xp->selector.security field. + * The security field is initialized to NULL when the xfrm_policy is + * allocated. + * Return 0 if operation was successful (memory to allocate, legal context) + * @xfrm_policy_clone_security: + * @old contains an existing xfrm_policy in the SPD. + * @new contains a new xfrm_policy being cloned from old. + * Allocate a security structure to the new->selector.security field + * that contains the information from the old->selector.security field. + * Return 0 if operation was successful (memory to allocate). + * @xfrm_policy_free_security: + * @xp contains the xfrm_policy + * Deallocate xp->selector.security. + * @xfrm_state_alloc_security: + * @x contains the xfrm_state being added to the Security Association + * Database by the XFRM system. + * @sec_ctx contains the security context information being provided by + * the user-level SA generation program (e.g., setkey or racoon). + * Allocate a security structure to the x->sel.security field. The + * security field is initialized to NULL when the xfrm_state is + * allocated. + * Return 0 if operation was successful (memory to allocate, legal context). + * @xfrm_state_free_security: + * @x contains the xfrm_state. + * Deallocate x>sel.security. + * @xfrm_policy_lookup: + * @xp contains the xfrm_policy for which the access control is being + * checked. + * @sk_sid contains the sock security label that is used to authorize + * access to the policy xp. + * @dir contains the direction of the flow (input or output). + * Check permission when a sock selects a xfrm_policy for processing + * XFRMs on a packet. The hook is called when selecting either a + * per-socket policy or a generic xfrm policy. + * Return 0 if permission is granted. * * Security hooks affecting all Key Management operations * @@ -1237,8 +1289,18 @@ struct security_operations { int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); void (*sk_free_security) (struct sock *sk); + unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); #endif /* CONFIG_SECURITY_NETWORK */ +#ifdef CONFIG_SECURITY_NETWORK_XFRM + int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); + int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); + void (*xfrm_policy_free_security) (struct xfrm_policy *xp); + int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); + void (*xfrm_state_free_security) (struct xfrm_state *x); + int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); +#endif /* CONFIG_SECURITY_NETWORK_XFRM */ + /* key management security hooks */ #ifdef CONFIG_KEYS int (*key_alloc)(struct key *key); @@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk) { return security_ops->sk_free_security(sk); } + +static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) +{ + return security_ops->sk_getsid(sk, fl, dir); +} #else /* CONFIG_SECURITY_NETWORK */ static inline int security_unix_stream_connect(struct socket * sock, struct socket * other, @@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) static inline void security_sk_free(struct sock *sk) { } + +static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) +{ + return 0; +} #endif /* CONFIG_SECURITY_NETWORK */ +#ifdef CONFIG_SECURITY_NETWORK_XFRM +static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) +{ + return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); +} + +static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) +{ + return security_ops->xfrm_policy_clone_security(old, new); +} + +static inline void security_xfrm_policy_free(struct xfrm_policy *xp) +{ + security_ops->xfrm_policy_free_security(xp); +} + +static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) +{ + return security_ops->xfrm_state_alloc_security(x, sec_ctx); +} + +static inline void security_xfrm_state_free(struct xfrm_state *x) +{ + security_ops->xfrm_state_free_security(x); +} + +static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) +{ + return security_ops->xfrm_policy_lookup(xp, sk_sid, dir); +} +#else /* CONFIG_SECURITY_NETWORK_XFRM */ +static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) +{ + return 0; +} + +static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) +{ + return 0; +} + +static inline void security_xfrm_policy_free(struct xfrm_policy *xp) +{ +} + +static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) +{ + return 0; +} + +static inline void security_xfrm_state_free(struct xfrm_state *x) +{ +} + +static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) +{ + return 0; +} +#endif /* CONFIG_SECURITY_NETWORK_XFRM */ + #ifdef CONFIG_KEYS #ifdef CONFIG_SECURITY static inline int security_key_alloc(struct key *key) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 8c5d6001a923..483cfc47ec34 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -32,7 +32,6 @@ #define HAVE_ALLOC_SKB /* For the drivers to know */ #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ -#define SLAB_SKB /* Slabified skbuffs */ #define CHECKSUM_NONE 0 #define CHECKSUM_HW 1 @@ -134,7 +133,7 @@ struct skb_frag_struct { */ struct skb_shared_info { atomic_t dataref; - unsigned int nr_frags; + unsigned short nr_frags; unsigned short tso_size; unsigned short tso_segs; unsigned short ufo_size; @@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen, struct iovec *iov); extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); +extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, + unsigned int flags); extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, int len, unsigned int csum); extern int skb_copy_bits(const struct sk_buff *skb, int offset, diff --git a/include/linux/socket.h b/include/linux/socket.h index 1739c2d5b95b..9f4019156fd8 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage { #include <linux/compiler.h> /* __user */ extern int sysctl_somaxconn; -extern void sock_init(void); #ifdef CONFIG_PROC_FS struct seq_file; extern void socket_seq_show(struct seq_file *seq); diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 0e9682c9def5..799be6747944 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -59,8 +59,7 @@ /* * Must define these before including other files, inline functions need them */ -#define LOCK_SECTION_NAME \ - ".text.lock." __stringify(KBUILD_BASENAME) +#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME #define LOCK_SECTION_START(extra) \ ".subsection 1\n\t" \ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 501564264518..a9b80fc7f0f3 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -390,6 +390,7 @@ enum NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, + NET_IPV4_IPFRAG_MAX_DIST=112, }; enum { diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 0e1da6602e05..f2bb2396853f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -55,22 +55,6 @@ struct tcphdr { __u16 urg_ptr; }; -#define TCP_ACTION_FIN (1 << 7) - -enum { - TCPF_ESTABLISHED = (1 << 1), - TCPF_SYN_SENT = (1 << 2), - TCPF_SYN_RECV = (1 << 3), - TCPF_FIN_WAIT1 = (1 << 4), - TCPF_FIN_WAIT2 = (1 << 5), - TCPF_TIME_WAIT = (1 << 6), - TCPF_CLOSE = (1 << 7), - TCPF_CLOSE_WAIT = (1 << 8), - TCPF_LAST_ACK = (1 << 9), - TCPF_LISTEN = (1 << 10), - TCPF_CLOSING = (1 << 11) -}; - /* * The union cast uses a gcc extension to avoid aliasing problems * (union is compatible to any of its members) @@ -254,10 +238,9 @@ struct tcp_sock { __u32 snd_wl1; /* Sequence for window update */ __u32 snd_wnd; /* The window we expect to receive */ __u32 max_window; /* Maximal window ever seen from peer */ - __u32 pmtu_cookie; /* Last pmtu seen by socket */ __u32 mss_cache; /* Cached effective mss, not including SACKS */ __u16 xmit_size_goal; /* Goal for segmenting output packets */ - __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ + /* XXX Two bytes hole, try to pack */ __u32 window_clamp; /* Maximal window to advertise */ __u32 rcv_ssthresh; /* Current window clamp */ @@ -295,8 +278,6 @@ struct tcp_sock { struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ - struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ - __u32 rcv_wnd; /* Current receiver window */ __u32 rcv_wup; /* rcv_nxt on last window update sent */ __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 46e2bb945353..36c684e1b110 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -13,11 +13,6 @@ * http://www.osta.org/ * http://www.ecma.ch/ * http://www.iso.org/ * - * CONTACTS - * E-mail regarding any portion of the Linux UDF file system should be - * directed to the development team mailing list (run by majordomo): - * linux_udf@hpesjro.fc.hp.com - * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h index 62b15a4214e6..1e7508420fcf 100644 --- a/include/linux/udf_fs_i.h +++ b/include/linux/udf_fs_i.h @@ -3,11 +3,6 @@ * * This file is intended for the Linux kernel/module. * - * CONTACTS - * E-mail regarding any portion of the Linux UDF file system should be - * directed to the development team mailing list (run by majordomo): - * linux_udf@hpesjro.fc.hp.com - * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h index 1966a6dbb4b6..b15ff2e99c91 100644 --- a/include/linux/udf_fs_sb.h +++ b/include/linux/udf_fs_sb.h @@ -3,11 +3,6 @@ * * This include file is for the Linux kernel/module. * - * CONTACTS - * E-mail regarding any portion of the Linux UDF file system should be - * directed to the development team mailing list (run by majordomo): - * linux_udf@hpesjro.fc.hp.com - * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: diff --git a/include/linux/udp.h b/include/linux/udp.h index b60e0b4a25c4..85a55658831c 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -35,10 +35,10 @@ struct udphdr { #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ #ifdef __KERNEL__ - #include <linux/config.h> -#include <net/sock.h> -#include <linux/ip.h> +#include <linux/types.h> + +#include <net/inet_sock.h> struct udp_sock { /* inet_sock has to be the first member */ diff --git a/include/linux/usb.h b/include/linux/usb.h index 7a20997e8071..827cc6de5f5c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -329,8 +329,6 @@ struct usb_device { struct usb_tt *tt; /* low/full speed dev, highspeed hub */ int ttport; /* device port on that tt hub */ - struct semaphore serialize; - unsigned int toggle[2]; /* one bit for each endpoint * ([0] = IN, [1] = OUT) */ @@ -349,6 +347,9 @@ struct usb_device { char **rawdescriptors; /* Raw descriptors for each config */ + unsigned short bus_mA; /* Current available from the bus */ + u8 portnum; /* Parent port number (origin 1) */ + int have_langid; /* whether string_langid is valid */ int string_langid; /* language ID for strings */ @@ -377,11 +378,12 @@ struct usb_device { extern struct usb_device *usb_get_dev(struct usb_device *dev); extern void usb_put_dev(struct usb_device *dev); -extern void usb_lock_device(struct usb_device *udev); -extern int usb_trylock_device(struct usb_device *udev); +/* USB device locking */ +#define usb_lock_device(udev) down(&(udev)->dev.sem) +#define usb_unlock_device(udev) up(&(udev)->dev.sem) +#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) extern int usb_lock_device_for_reset(struct usb_device *udev, struct usb_interface *iface); -extern void usb_unlock_device(struct usb_device *udev); /* USB port reset for device reinitialization */ extern int usb_reset_device(struct usb_device *dev); @@ -529,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, /* ----------------------------------------------------------------------- */ +struct usb_dynids { + spinlock_t lock; + struct list_head list; +}; + /** * struct usb_driver - identifies USB driver to usbcore - * @owner: Pointer to the module owner of this driver; initialize - * it using THIS_MODULE. * @name: The driver name should be unique among USB drivers, * and should normally be the same as the module name. * @probe: Called to see if the driver is willing to manage a particular @@ -553,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, * @id_table: USB drivers use ID table to support hotplugging. * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set * or your driver's probe function will never get called. + * @dynids: used internally to hold the list of dynamically added device + * ids for this driver. * @driver: the driver model core driver structure. + * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be + * added to this driver by preventing the sysfs file from being created. * * USB drivers must provide a name, probe() and disconnect() methods, * and an id_table. Other driver fields are optional. @@ -571,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, * them as necessary, and blocking until the unlinks complete). */ struct usb_driver { - struct module *owner; - const char *name; int (*probe) (struct usb_interface *intf, @@ -588,7 +595,9 @@ struct usb_driver { const struct usb_device_id *id_table; + struct usb_dynids dynids; struct device_driver driver; + unsigned int no_dynamic_id:1; }; #define to_usb_driver(d) container_of(d, struct usb_driver, driver) @@ -614,7 +623,11 @@ struct usb_class_driver { * use these in module_init()/module_exit() * and don't forget MODULE_DEVICE_TABLE(usb, ...) */ -extern int usb_register(struct usb_driver *); +int usb_register_driver(struct usb_driver *, struct module *); +static inline int usb_register(struct usb_driver *driver) +{ + return usb_register_driver(driver, THIS_MODULE); +} extern void usb_deregister(struct usb_driver *); extern int usb_register_dev(struct usb_interface *intf, diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h new file mode 100644 index 000000000000..b2d08984a9f7 --- /dev/null +++ b/include/linux/usb_usual.h @@ -0,0 +1,126 @@ +/* + * Interface to the libusual. + * + * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com> + * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com) + */ + +#ifndef __LINUX_USB_USUAL_H +#define __LINUX_USB_USUAL_H + +#include <linux/config.h> + +/* We should do this for cleanliness... But other usb_foo.h do not do this. */ +/* #include <linux/usb.h> */ + +/* + * The flags field, which we store in usb_device_id.driver_info. + * It is compatible with the old usb-storage flags in lower 24 bits. + */ + +/* + * Static flag definitions. We use this roundabout technique so that the + * proc_info() routine can automatically display a message for each flag. + */ +#define US_DO_ALL_FLAGS \ + US_FLAG(SINGLE_LUN, 0x00000001) \ + /* allow access to only LUN 0 */ \ + US_FLAG(NEED_OVERRIDE, 0x00000002) \ + /* unusual_devs entry is necessary */ \ + US_FLAG(SCM_MULT_TARG, 0x00000004) \ + /* supports multiple targets */ \ + US_FLAG(FIX_INQUIRY, 0x00000008) \ + /* INQUIRY response needs faking */ \ + US_FLAG(FIX_CAPACITY, 0x00000010) \ + /* READ CAPACITY response too big */ \ + US_FLAG(IGNORE_RESIDUE, 0x00000020) \ + /* reported residue is wrong */ \ + US_FLAG(BULK32, 0x00000040) \ + /* Uses 32-byte CBW length */ \ + US_FLAG(NOT_LOCKABLE, 0x00000080) \ + /* PREVENT/ALLOW not supported */ \ + US_FLAG(GO_SLOW, 0x00000100) \ + /* Need delay after Command phase */ \ + US_FLAG(NO_WP_DETECT, 0x00000200) \ + /* Don't check for write-protect */ \ + +#define US_FLAG(name, value) US_FL_##name = value , +enum { US_DO_ALL_FLAGS }; +#undef US_FLAG + +/* + * The bias field for libusual and friends. + */ +#define USB_US_TYPE_NONE 0 +#define USB_US_TYPE_STOR 1 /* usb-storage */ +#define USB_US_TYPE_UB 2 /* ub */ + +#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF) +#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF) + +/* + * This is probably not the best place to keep these constants, conceptually. + * But it's the only header included into all places which need them. + */ + +/* Sub Classes */ + +#define US_SC_RBC 0x01 /* Typically, flash devices */ +#define US_SC_8020 0x02 /* CD-ROM */ +#define US_SC_QIC 0x03 /* QIC-157 Tapes */ +#define US_SC_UFI 0x04 /* Floppy */ +#define US_SC_8070 0x05 /* Removable media */ +#define US_SC_SCSI 0x06 /* Transparent */ +#define US_SC_ISD200 0x07 /* ISD200 ATA */ +#define US_SC_MIN US_SC_RBC +#define US_SC_MAX US_SC_ISD200 + +#define US_SC_DEVICE 0xff /* Use device's value */ + +/* Protocols */ + +#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */ +#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */ +#define US_PR_BULK 0x50 /* bulk only */ +#ifdef CONFIG_USB_STORAGE_USBAT +#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */ +#endif +#ifdef CONFIG_USB_STORAGE_SDDR09 +#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ +#endif +#ifdef CONFIG_USB_STORAGE_SDDR55 +#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */ +#endif +#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ +#ifdef CONFIG_USB_STORAGE_FREECOM +#define US_PR_FREECOM 0xf1 /* Freecom */ +#endif +#ifdef CONFIG_USB_STORAGE_DATAFAB +#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */ +#endif +#ifdef CONFIG_USB_STORAGE_JUMPSHOT +#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ +#endif +#ifdef CONFIG_USB_STORAGE_ALAUDA +#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ +#endif + +#define US_PR_DEVICE 0xff /* Use device's value */ + +/* + */ +#ifdef CONFIG_USB_LIBUSUAL + +extern struct usb_device_id storage_usb_ids[]; +extern void usb_usual_set_present(int type); +extern void usb_usual_clear_present(int type); +extern int usb_usual_check_type(const struct usb_device_id *, int type); +#else + +#define usb_usual_set_present(t) do { } while(0) +#define usb_usual_clear_present(t) do { } while(0) +#define usb_usual_check_type(id, t) (0) +#endif /* CONFIG_USB_LIBUSUAL */ + +#endif /* __LINUX_USB_USUAL_H */ diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 0fb077d68441..82fbb758e28f 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h @@ -27,6 +27,22 @@ struct xfrm_id __u8 proto; }; +struct xfrm_sec_ctx { + __u8 ctx_doi; + __u8 ctx_alg; + __u16 ctx_len; + __u32 ctx_sid; + char ctx_str[0]; +}; + +/* Security Context Domains of Interpretation */ +#define XFRM_SC_DOI_RESERVED 0 +#define XFRM_SC_DOI_LSM 1 + +/* Security Context Algorithms */ +#define XFRM_SC_ALG_RESERVED 0 +#define XFRM_SC_ALG_SELINUX 1 + /* Selector, used as selector both on policy rules (SPD) and SAs. */ struct xfrm_selector @@ -146,6 +162,18 @@ enum { #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) +/* + * Generic LSM security context for comunicating to user space + * NOTE: Same format as sadb_x_sec_ctx + */ +struct xfrm_user_sec_ctx { + __u16 len; + __u16 exttype; + __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ + __u8 ctx_doi; + __u16 ctx_len; +}; + struct xfrm_user_tmpl { struct xfrm_id id; __u16 family; @@ -176,6 +204,7 @@ enum xfrm_attr_type_t { XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ XFRMA_SA, XFRMA_POLICY, + XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ __XFRMA_MAX #define XFRMA_MAX (__XFRMA_MAX - 1) diff --git a/include/net/af_unix.h b/include/net/af_unix.h index b5d785ab4a0e..bfc1779fc753 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -13,7 +13,7 @@ extern void unix_gc(void); #define UNIX_HASH_SIZE 256 extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; -extern rwlock_t unix_table_lock; +extern spinlock_t unix_table_lock; extern atomic_t unix_tot_inflight; @@ -58,10 +58,10 @@ struct unix_skb_parms { #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) -#define unix_state_rlock(s) read_lock(&unix_sk(s)->lock) -#define unix_state_runlock(s) read_unlock(&unix_sk(s)->lock) -#define unix_state_wlock(s) write_lock(&unix_sk(s)->lock) -#define unix_state_wunlock(s) write_unlock(&unix_sk(s)->lock) +#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) +#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) +#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) +#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) #ifdef __KERNEL__ /* The AF_UNIX socket */ @@ -76,7 +76,7 @@ struct unix_sock { struct sock *other; struct sock *gc_tree; atomic_t inflight; - rwlock_t lock; + spinlock_t lock; wait_queue_head_t peer_wait; }; #define unix_sk(__sk) ((struct unix_sock *)__sk) diff --git a/include/net/atmclip.h b/include/net/atmclip.h index 47048b1d179a..90fcc98e676f 100644 --- a/include/net/atmclip.h +++ b/include/net/atmclip.h @@ -7,7 +7,6 @@ #define _ATMCLIP_H #include <linux/netdevice.h> -#include <linux/skbuff.h> #include <linux/atm.h> #include <linux/atmdev.h> #include <linux/atmarp.h> @@ -18,6 +17,7 @@ #define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) #define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) +struct sk_buff; struct clip_vcc { struct atm_vcc *vcc; /* VCC descriptor */ diff --git a/include/net/dst.h b/include/net/dst.h index 6c196a5baf24..bee8b84d329d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -9,6 +9,7 @@ #define _NET_DST_H #include <linux/config.h> +#include <linux/netdevice.h> #include <linux/rtnetlink.h> #include <linux/rcupdate.h> #include <linux/jiffies.h> diff --git a/include/net/flow.h b/include/net/flow.h index 9a5c94b1a0ec..ec7eb86eb203 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -84,11 +84,12 @@ struct flowi { #define FLOW_DIR_OUT 1 #define FLOW_DIR_FWD 2 -typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, +struct sock; +typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir, void **objp, atomic_t **obj_refp); -extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, - flow_resolve_t resolver); +extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir, + flow_resolve_t resolver); extern void flow_cache_flush(void); extern atomic_t flow_cache_genid; diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 52d8b1a73d52..c5b96b2b8155 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -60,7 +60,7 @@ struct genl_info */ struct genl_ops { - unsigned int cmd; + u8 cmd; unsigned int flags; struct nla_policy *policy; int (*doit)(struct sk_buff *skb, diff --git a/include/net/icmp.h b/include/net/icmp.h index 6cdebeee5f96..e7c3f20fbafc 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -20,12 +20,9 @@ #include <linux/config.h> #include <linux/icmp.h> -#include <linux/skbuff.h> -#include <net/sock.h> -#include <net/protocol.h> +#include <net/inet_sock.h> #include <net/snmp.h> -#include <linux/ip.h> struct icmp_err { int errno; @@ -38,6 +35,10 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics); #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) +struct dst_entry; +struct net_proto_family; +struct sk_buff; + extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); extern int icmp_rcv(struct sk_buff *skb); extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 225fc751d464..03b766afdc39 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h @@ -23,12 +23,17 @@ #ifndef IEEE80211_CRYPT_H #define IEEE80211_CRYPT_H -#include <linux/skbuff.h> +#include <linux/types.h> +#include <linux/list.h> +#include <asm/atomic.h> enum { IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), }; +struct sk_buff; +struct module; + struct ieee80211_crypto_ops { const char *name; struct list_head list; @@ -87,6 +92,8 @@ struct ieee80211_crypt_data { atomic_t refcnt; }; +struct ieee80211_device; + int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h new file mode 100644 index 000000000000..b33b438bffcc --- /dev/null +++ b/include/net/inet6_connection_sock.h @@ -0,0 +1,42 @@ +/* + * NET Generic infrastructure for INET6 connection oriented protocols. + * + * Authors: Many people, see the TCPv6 sources + * + * From code originally in TCPv6 + * + * 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. + */ +#ifndef _INET6_CONNECTION_SOCK_H +#define _INET6_CONNECTION_SOCK_H + +#include <linux/types.h> + +struct in6_addr; +struct inet_bind_bucket; +struct request_sock; +struct sk_buff; +struct sock; +struct sockaddr; + +extern int inet6_csk_bind_conflict(const struct sock *sk, + const struct inet_bind_bucket *tb); + +extern struct request_sock *inet6_csk_search_req(const struct sock *sk, + struct request_sock ***prevp, + const __u16 rport, + const struct in6_addr *raddr, + const struct in6_addr *laddr, + const int iif); + +extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, + struct request_sock *req, + const unsigned long timeout); + +extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); + +extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); +#endif /* _INET6_CONNECTION_SOCK_H */ diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 5a2beed5a770..25f708ff020e 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -48,6 +48,32 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) return inet6_ehashfn(laddr, lport, faddr, fport); } +static inline void __inet6_hash(struct inet_hashinfo *hashinfo, + struct sock *sk) +{ + struct hlist_head *list; + rwlock_t *lock; + + BUG_TRAP(sk_unhashed(sk)); + + if (sk->sk_state == TCP_LISTEN) { + list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; + lock = &hashinfo->lhash_lock; + inet_listen_wlock(hashinfo); + } else { + unsigned int hash; + sk->sk_hash = hash = inet6_sk_ehashfn(sk); + hash &= (hashinfo->ehash_size - 1); + list = &hashinfo->ehash[hash].chain; + lock = &hashinfo->ehash[hash].lock; + write_lock(lock); + } + + __sk_add_node(sk, list); + sock_prot_inc_use(sk->sk_prot); + write_unlock(lock); +} + /* * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM @@ -84,10 +110,10 @@ static inline struct sock * if(*((__u32 *)&(tw->tw_dport)) == ports && sk->sk_family == PF_INET6) { - const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); + const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); - if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && - ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && + if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && + ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) goto hit; } diff --git a/include/net/inet_common.h b/include/net/inet_common.h index f943306ce5ff..227adcbdfec8 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -1,8 +1,8 @@ #ifndef _INET_COMMON_H #define _INET_COMMON_H -extern struct proto_ops inet_stream_ops; -extern struct proto_ops inet_dgram_ops; +extern const struct proto_ops inet_stream_ops; +extern const struct proto_ops inet_dgram_ops; /* * INET4 prototypes used by INET6 diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index b0c99060b78d..50234fa56a68 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -15,9 +15,11 @@ #ifndef _INET_CONNECTION_SOCK_H #define _INET_CONNECTION_SOCK_H -#include <linux/ip.h> +#include <linux/compiler.h> #include <linux/string.h> #include <linux/timer.h> + +#include <net/inet_sock.h> #include <net/request_sock.h> #define INET_CSK_DEBUG 1 @@ -29,6 +31,29 @@ struct inet_bind_bucket; struct inet_hashinfo; struct tcp_congestion_ops; +/* + * Pointers to address related TCP functions + * (i.e. things that depend on the address family) + */ +struct inet_connection_sock_af_ops { + int (*queue_xmit)(struct sk_buff *skb, int ipfragok); + void (*send_check)(struct sock *sk, int len, + struct sk_buff *skb); + int (*rebuild_header)(struct sock *sk); + int (*conn_request)(struct sock *sk, struct sk_buff *skb); + struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, + struct request_sock *req, + struct dst_entry *dst); + int (*remember_stamp)(struct sock *sk); + __u16 net_header_len; + int (*setsockopt)(struct sock *sk, int level, int optname, + char __user *optval, int optlen); + int (*getsockopt)(struct sock *sk, int level, int optname, + char __user *optval, int __user *optlen); + void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); + int sockaddr_len; +}; + /** inet_connection_sock - INET connection oriented sock * * @icsk_accept_queue: FIFO of established children @@ -36,13 +61,16 @@ struct tcp_congestion_ops; * @icsk_timeout: Timeout * @icsk_retransmit_timer: Resend (no ack) * @icsk_rto: Retransmit timeout + * @icsk_pmtu_cookie Last pmtu seen by socket * @icsk_ca_ops Pluggable congestion control hook + * @icsk_af_ops Operations which are AF_INET{4,6} specific * @icsk_ca_state: Congestion control state * @icsk_retransmits: Number of unrecovered [RTO] timeouts * @icsk_pending: Scheduled timer event * @icsk_backoff: Backoff * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries * @icsk_probes_out: unanswered 0 window probes + * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options) * @icsk_ack: Delayed ACK control data */ struct inet_connection_sock { @@ -54,14 +82,17 @@ struct inet_connection_sock { struct timer_list icsk_retransmit_timer; struct timer_list icsk_delack_timer; __u32 icsk_rto; + __u32 icsk_pmtu_cookie; struct tcp_congestion_ops *icsk_ca_ops; + struct inet_connection_sock_af_ops *icsk_af_ops; + unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); __u8 icsk_ca_state; __u8 icsk_retransmits; __u8 icsk_pending; __u8 icsk_backoff; __u8 icsk_syn_retries; __u8 icsk_probes_out; - /* 2 BYTES HOLE, TRY TO PACK! */ + __u16 icsk_ext_hdr_len; struct { __u8 pending; /* ACK is pending */ __u8 quick; /* Scheduled number of quick acks */ @@ -192,8 +223,12 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk, const __u16 rport, const __u32 raddr, const __u32 laddr); +extern int inet_csk_bind_conflict(const struct sock *sk, + const struct inet_bind_bucket *tb); extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, - struct sock *sk, unsigned short snum); + struct sock *sk, unsigned short snum, + int (*bind_conflict)(const struct sock *sk, + const struct inet_bind_bucket *tb)); extern struct dst_entry* inet_csk_route_req(struct sock *sk, const struct request_sock *req); @@ -207,7 +242,7 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk, extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, - const unsigned timeout); + unsigned long timeout); static inline void inet_csk_reqsk_queue_removed(struct sock *sk, struct request_sock *req) @@ -273,4 +308,6 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk) extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); extern void inet_csk_listen_stop(struct sock *sk); +extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); + #endif /* _INET_CONNECTION_SOCK_H */ diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index b0c47e2eccf1..d599c6bfbb86 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -3,6 +3,8 @@ #include <linux/ip.h> #include <linux/skbuff.h> + +#include <net/inet_sock.h> #include <net/dsfield.h> enum { diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 07840baa9341..135d80fd658e 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -26,6 +26,7 @@ #include <linux/wait.h> #include <net/inet_connection_sock.h> +#include <net/inet_sock.h> #include <net/route.h> #include <net/sock.h> #include <net/tcp_states.h> @@ -128,26 +129,6 @@ struct inet_hashinfo { kmem_cache_t *bind_bucket_cachep; }; -static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, - const __u32 faddr, const __u16 fport) -{ - unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); - h ^= h >> 16; - h ^= h >> 8; - return h; -} - -static inline int inet_sk_ehashfn(const struct sock *sk) -{ - const struct inet_sock *inet = inet_sk(sk); - const __u32 laddr = inet->rcv_saddr; - const __u16 lport = inet->num; - const __u32 faddr = inet->daddr; - const __u16 fport = inet->dport; - - return inet_ehashfn(laddr, lport, faddr, fport); -} - static inline struct inet_ehash_bucket *inet_ehash_bucket( struct inet_hashinfo *hashinfo, unsigned int hash) @@ -434,4 +415,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, return sk; } + +extern int inet_hash_connect(struct inet_timewait_death_row *death_row, + struct sock *sk); #endif /* _INET_HASHTABLES_H */ diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h new file mode 100644 index 000000000000..883eb529ef8e --- /dev/null +++ b/include/net/inet_sock.h @@ -0,0 +1,193 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for inet_sock + * + * Authors: Many, reorganised here by + * Arnaldo Carvalho de Melo <acme@mandriva.com> + * + * 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. + */ +#ifndef _INET_SOCK_H +#define _INET_SOCK_H + +#include <linux/config.h> + +#include <linux/string.h> +#include <linux/types.h> + +#include <net/flow.h> +#include <net/sock.h> +#include <net/request_sock.h> + +/** struct ip_options - IP Options + * + * @faddr - Saved first hop address + * @is_setbyuser - Set by setsockopt? + * @is_data - Options in __data, rather than skb + * @is_strictroute - Strict source route + * @srr_is_hit - Packet destination addr was our one + * @is_changed - IP checksum more not valid + * @rr_needaddr - Need to record addr of outgoing dev + * @ts_needtime - Need to record timestamp + * @ts_needaddr - Need to record addr of outgoing dev + */ +struct ip_options { + __u32 faddr; + unsigned char optlen; + unsigned char srr; + unsigned char rr; + unsigned char ts; + unsigned char is_setbyuser:1, + is_data:1, + is_strictroute:1, + srr_is_hit:1, + is_changed:1, + rr_needaddr:1, + ts_needtime:1, + ts_needaddr:1; + unsigned char router_alert; + unsigned char __pad1; + unsigned char __pad2; + unsigned char __data[0]; +}; + +#define optlength(opt) (sizeof(struct ip_options) + opt->optlen) + +struct inet_request_sock { + struct request_sock req; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + u16 inet6_rsk_offset; + /* 2 bytes hole, try to pack */ +#endif + u32 loc_addr; + u32 rmt_addr; + u16 rmt_port; + u16 snd_wscale : 4, + rcv_wscale : 4, + tstamp_ok : 1, + sack_ok : 1, + wscale_ok : 1, + ecn_ok : 1, + acked : 1; + struct ip_options *opt; +}; + +static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) +{ + return (struct inet_request_sock *)sk; +} + +struct ip_mc_socklist; +struct ipv6_pinfo; +struct rtable; + +/** struct inet_sock - representation of INET sockets + * + * @sk - ancestor class + * @pinet6 - pointer to IPv6 control block + * @daddr - Foreign IPv4 addr + * @rcv_saddr - Bound local IPv4 addr + * @dport - Destination port + * @num - Local port + * @saddr - Sending source + * @uc_ttl - Unicast TTL + * @sport - Source port + * @id - ID counter for DF pkts + * @tos - TOS + * @mc_ttl - Multicasting TTL + * @is_icsk - is this an inet_connection_sock? + * @mc_index - Multicast device index + * @mc_list - Group array + * @cork - info to build ip hdr on each ip frag while socket is corked + */ +struct inet_sock { + /* sk and pinet6 has to be the first two members of inet_sock */ + struct sock sk; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + struct ipv6_pinfo *pinet6; +#endif + /* Socket demultiplex comparisons on incoming packets. */ + __u32 daddr; + __u32 rcv_saddr; + __u16 dport; + __u16 num; + __u32 saddr; + __s16 uc_ttl; + __u16 cmsg_flags; + struct ip_options *opt; + __u16 sport; + __u16 id; + __u8 tos; + __u8 mc_ttl; + __u8 pmtudisc; + __u8 recverr:1, + is_icsk:1, + freebind:1, + hdrincl:1, + mc_loop:1; + int mc_index; + __u32 mc_addr; + struct ip_mc_socklist *mc_list; + struct { + unsigned int flags; + unsigned int fragsize; + struct ip_options *opt; + struct rtable *rt; + int length; /* Total length of all frames */ + u32 addr; + struct flowi fl; + } cork; +}; + +#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ +#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ + +static inline struct inet_sock *inet_sk(const struct sock *sk) +{ + return (struct inet_sock *)sk; +} + +static inline void __inet_sk_copy_descendant(struct sock *sk_to, + const struct sock *sk_from, + const int ancestor_size) +{ + memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, + sk_from->sk_prot->obj_size - ancestor_size); +} +#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) +static inline void inet_sk_copy_descendant(struct sock *sk_to, + const struct sock *sk_from) +{ + __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); +} +#endif + +extern int inet_sk_rebuild_header(struct sock *sk); + +static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, + const __u32 faddr, const __u16 fport) +{ + unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); + h ^= h >> 16; + h ^= h >> 8; + return h; +} + +static inline int inet_sk_ehashfn(const struct sock *sk) +{ + const struct inet_sock *inet = inet_sk(sk); + const __u32 laddr = inet->rcv_saddr; + const __u16 lport = inet->num; + const __u32 faddr = inet->daddr; + const __u16 fport = inet->dport; + + return inet_ehashfn(laddr, lport, faddr, fport); +} + +#endif /* _INET_SOCK_H */ diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 28f7b2103505..1da294c47522 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -17,15 +17,16 @@ #include <linux/config.h> -#include <linux/ip.h> #include <linux/list.h> #include <linux/module.h> #include <linux/timer.h> #include <linux/types.h> #include <linux/workqueue.h> +#include <net/inet_sock.h> #include <net/sock.h> #include <net/tcp_states.h> +#include <net/timewait_sock.h> #include <asm/atomic.h> @@ -127,7 +128,8 @@ struct inet_timewait_sock { __u16 tw_num; /* And these are ours. */ __u8 tw_ipv6only:1; - /* 31 bits hole, try to pack */ + /* 15 bits hole, try to pack */ + __u16 tw_ipv6_offset; int tw_timeout; unsigned long tw_ttd; struct inet_bind_bucket *tw_tb; @@ -199,7 +201,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw) printk(KERN_DEBUG "%s timewait_sock %p released\n", tw->tw_prot->name, tw); #endif - kmem_cache_free(tw->tw_prot->twsk_slab, tw); + kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); module_put(owner); } } diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 7fda471002b6..0965515f40cf 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -25,6 +25,7 @@ struct inet_peer __u32 v4daddr; /* peer's address */ __u16 avl_height; __u16 ip_id_count; /* IP ID for the next packet */ + atomic_t rid; /* Frag reception counter */ __u32 tcp_ts; unsigned long tcp_ts_stamp; }; diff --git a/include/net/ip.h b/include/net/ip.h index e4563bbee6ea..f7e7fd728b67 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -24,14 +24,10 @@ #include <linux/config.h> #include <linux/types.h> -#include <linux/socket.h> #include <linux/ip.h> #include <linux/in.h> -#include <linux/netdevice.h> -#include <linux/inetdevice.h> -#include <linux/in_route.h> -#include <net/route.h> -#include <net/arp.h> + +#include <net/inet_sock.h> #include <net/snmp.h> struct sock; @@ -45,6 +41,7 @@ struct inet_skb_parm #define IPSKB_TRANSLATED 2 #define IPSKB_FORWARDED 4 #define IPSKB_XFRM_TUNNEL_SIZE 8 +#define IPSKB_FRAG_COMPLETE 16 }; struct ipcm_cookie @@ -74,6 +71,13 @@ extern rwlock_t ip_ra_lock; #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ +struct msghdr; +struct net_device; +struct packet_type; +struct rtable; +struct sk_buff; +struct sockaddr; + extern void ip_mc_dropsocket(struct sock *); extern void ip_mc_dropdevice(struct net_device *dev); extern int igmp_mc_proc_init(void); @@ -168,6 +172,7 @@ extern int sysctl_ipfrag_high_thresh; extern int sysctl_ipfrag_low_thresh; extern int sysctl_ipfrag_time; extern int sysctl_ipfrag_secret_interval; +extern int sysctl_ipfrag_max_dist; /* From inetpeer.c */ extern int inet_peer_threshold; @@ -182,6 +187,8 @@ extern int sysctl_ip_dynaddr; extern void ipfrag_init(void); #ifdef CONFIG_INET +#include <net/dst.h> + /* The function in 2.2 was invalid, producing wrong result for * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ static inline diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 14de4ebd1211..e000fa2cd5f6 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -238,6 +238,8 @@ extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, struct net_device *dev, u32 *spec_dst, u32 *itag); extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); +struct rtentry; + /* Exported by fib_semantics.c */ extern int ip_fib_check_default(u32 gw, struct net_device *dev); extern int fib_sync_down(u32 local, struct net_device *dev, int force); diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3b5559a023a4..7d2674fde19a 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -251,16 +251,15 @@ struct ip_vs_daemon_user { #include <linux/config.h> #include <linux/list.h> /* for struct list_head */ #include <linux/spinlock.h> /* for struct rwlock_t */ -#include <linux/skbuff.h> /* for struct sk_buff */ -#include <linux/ip.h> /* for struct iphdr */ #include <asm/atomic.h> /* for struct atomic_t */ -#include <linux/netdevice.h> /* for struct neighbour */ -#include <net/dst.h> /* for struct dst_entry */ -#include <net/udp.h> #include <linux/compiler.h> +#include <linux/timer.h> +#include <net/checksum.h> #ifdef CONFIG_IP_VS_DEBUG +#include <linux/net.h> + extern int ip_vs_get_debug_level(void); #define IP_VS_DBG(level, msg...) \ do { \ @@ -429,8 +428,11 @@ struct ip_vs_stats spinlock_t lock; /* spin lock */ }; +struct dst_entry; +struct iphdr; struct ip_vs_conn; struct ip_vs_app; +struct sk_buff; struct ip_vs_protocol { struct ip_vs_protocol *next; diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 0a2ad51cff82..860bbac4c4ee 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -240,6 +240,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, struct ipv6_txoptions *opt); +extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); + extern int ip6_frag_nqueues; extern atomic_t ip6_frag_mem; @@ -525,6 +527,9 @@ extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr, extern int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +extern int inet6_hash_connect(struct inet_timewait_death_row *death_row, + struct sock *sk); + /* * reassembly.c */ @@ -533,8 +538,11 @@ extern int sysctl_ip6frag_low_thresh; extern int sysctl_ip6frag_time; extern int sysctl_ip6frag_secret_interval; -extern struct proto_ops inet6_stream_ops; -extern struct proto_ops inet6_dgram_ops; +extern const struct proto_ops inet6_stream_ops; +extern const struct proto_ops inet6_dgram_ops; + +struct group_source_req; +struct group_filter; extern int ip6_mc_source(int add, int omode, struct sock *sk, struct group_source_req *pgsr); diff --git a/include/net/ndisc.h b/include/net/ndisc.h index f85d6e4b7442..bbac87eeb422 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -35,11 +35,20 @@ enum { #ifdef __KERNEL__ -#include <linux/skbuff.h> -#include <linux/netdevice.h> +#include <linux/config.h> +#include <linux/compiler.h> #include <linux/icmpv6.h> +#include <linux/in6.h> +#include <linux/types.h> + #include <net/neighbour.h> -#include <asm/atomic.h> + +struct ctl_table; +struct file; +struct inet6_dev; +struct net_device; +struct net_proto_family; +struct sk_buff; extern struct neigh_table nd_tbl; @@ -108,7 +117,7 @@ extern int igmp6_event_report(struct sk_buff *skb); extern void igmp6_cleanup(void); #ifdef CONFIG_SYSCTL -extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl, +extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 34c07731933d..6fa9ae190741 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -49,8 +49,8 @@ #ifdef __KERNEL__ #include <asm/atomic.h> -#include <linux/skbuff.h> #include <linux/netdevice.h> +#include <linux/skbuff.h> #include <linux/rcupdate.h> #include <linux/seq_file.h> diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h index bd08964b72c0..b225d8472b7e 100644 --- a/include/net/pkt_act.h +++ b/include/net/pkt_act.h @@ -15,7 +15,6 @@ #include <linux/in.h> #include <linux/errno.h> #include <linux/interrupt.h> -#include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/rtnetlink.h> #include <linux/module.h> diff --git a/include/net/protocol.h b/include/net/protocol.h index 357691f6a45f..63f7db99c2a6 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h @@ -65,7 +65,7 @@ struct inet_protosw { int protocol; /* This is the L4 protocol number. */ struct proto *prot; - struct proto_ops *ops; + const struct proto_ops *ops; int capability; /* Which (if any) capability do * we need to use this socket @@ -76,6 +76,7 @@ struct inet_protosw { }; #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ #define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ +#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ extern struct net_protocol *inet_protocol_base; extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; diff --git a/include/net/raw.h b/include/net/raw.h index f47917469b12..e67b28a0248c 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -19,6 +19,8 @@ #include <linux/config.h> +#include <net/protocol.h> + extern struct proto raw_prot; extern void raw_err(struct sock *, struct sk_buff *, u32 info); diff --git a/include/net/request_sock.h b/include/net/request_sock.h index b52cc52ffe39..11641c9384f7 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -244,7 +244,7 @@ static inline int reqsk_queue_is_full(const struct request_sock_queue *queue) static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, u32 hash, struct request_sock *req, - unsigned timeout) + unsigned long timeout) { struct listen_sock *lopt = queue->listen_opt; diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 8e7794ee27ff..f5c22d77feab 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -277,6 +277,24 @@ struct sctp_sock { __u32 default_context; __u32 default_timetolive; + /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to + * the destination address every heartbeat interval. This value + * will be inherited by all new associations. + */ + __u32 hbinterval; + + /* This is the max_retrans value for new associations. */ + __u16 pathmaxrxt; + + /* The initial Path MTU to use for new associations. */ + __u32 pathmtu; + + /* The default SACK delay timeout for new associations. */ + __u32 sackdelay; + + /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ + __u32 param_flags; + struct sctp_initmsg initmsg; struct sctp_rtoinfo rtoinfo; struct sctp_paddrparams paddrparam; @@ -845,9 +863,6 @@ struct sctp_transport { /* Data that has been sent, but not acknowledged. */ __u32 flight_size; - /* PMTU : The current known path MTU. */ - __u32 pmtu; - /* Destination */ struct dst_entry *dst; /* Source address. */ @@ -862,7 +877,22 @@ struct sctp_transport { /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to * the destination address every heartbeat interval. */ - int hb_interval; + __u32 hbinterval; + + /* This is the max_retrans value for the transport and will + * be initialized from the assocs value. This can be changed + * using SCTP_SET_PEER_ADDR_PARAMS socket option. + */ + __u16 pathmaxrxt; + + /* PMTU : The current known path MTU. */ + __u32 pathmtu; + + /* SACK delay timeout */ + __u32 sackdelay; + + /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ + __u32 param_flags; /* When was the last time (in jiffies) that we heard from this * transport? We use this to pick new active and retran paths. @@ -882,22 +912,11 @@ struct sctp_transport { */ int state; - /* hb_allowed : The current heartbeat state of this destination, - * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. - */ - int hb_allowed; - /* These are the error stats for this destination. */ /* Error count : The current error count for this destination. */ unsigned short error_count; - /* This is the max_retrans value for the transport and will - * be initialized to proto.max_retrans.path. This can be changed - * using SCTP_SET_PEER_ADDR_PARAMS socket option. - */ - int max_retrans; - /* Per : A timer used by each destination. * Destination : * Timer : @@ -1502,6 +1521,28 @@ struct sctp_association { /* The largest timeout or RTO value to use in attempting an INIT */ __u16 max_init_timeo; + /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to + * the destination address every heartbeat interval. This value + * will be inherited by all new transports. + */ + __u32 hbinterval; + + /* This is the max_retrans value for new transports in the + * association. + */ + __u16 pathmaxrxt; + + /* Association : The smallest PMTU discovered for all of the + * PMTU : peer's transport addresses. + */ + __u32 pathmtu; + + /* SACK delay timeout */ + __u32 sackdelay; + + /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ + __u32 param_flags; + int timeouts[SCTP_NUM_TIMEOUT_TYPES]; struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; @@ -1571,11 +1612,6 @@ struct sctp_association { */ wait_queue_head_t wait; - /* Association : The smallest PMTU discovered for all of the - * PMTU : peer's transport addresses. - */ - __u32 pmtu; - /* The message size at which SCTP fragmentation will occur. */ __u32 frag_point; diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index f1c3bc54526a..8a6bef6f91eb 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h @@ -93,6 +93,8 @@ enum sctp_optname { #define SCTP_STATUS SCTP_STATUS SCTP_GET_PEER_ADDR_INFO, #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO + SCTP_DELAYED_ACK_TIME, +#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME /* Internal Socket Options. Some of the sctp library functions are * implemented using these socket options. @@ -503,13 +505,41 @@ struct sctp_setadaption { * unreachable. The following structure is used to access and modify an * address's parameters: */ +enum sctp_spp_flags { + SPP_HB_ENABLE = 1, /*Enable heartbeats*/ + SPP_HB_DISABLE = 2, /*Disable heartbeats*/ + SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, + SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ + SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ + SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ + SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, + SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ + SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ + SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, +}; + struct sctp_paddrparams { sctp_assoc_t spp_assoc_id; struct sockaddr_storage spp_address; __u32 spp_hbinterval; __u16 spp_pathmaxrxt; + __u32 spp_pathmtu; + __u32 spp_sackdelay; + __u32 spp_flags; } __attribute__((packed, aligned(4))); +/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) + * + * This options will get or set the delayed ack timer. The time is set + * in milliseconds. If the assoc_id is 0, then this sets or gets the + * endpoints default delayed ack timer value. If the assoc_id field is + * non-zero, then the set or get effects the specified association. + */ +struct sctp_assoc_value { + sctp_assoc_t assoc_id; + uint32_t assoc_value; +}; + /* * 7.2.2 Peer Address Information * diff --git a/include/net/sock.h b/include/net/sock.h index 982b4ecd187b..6961700ff3a0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -493,6 +493,7 @@ extern void sk_stream_kill_queues(struct sock *sk); extern int sk_wait_data(struct sock *sk, long *timeo); struct request_sock_ops; +struct timewait_sock_ops; /* Networking protocol blocks we attach to sockets. * socket layer -> transport layer interface @@ -557,11 +558,10 @@ struct proto { kmem_cache_t *slab; unsigned int obj_size; - kmem_cache_t *twsk_slab; - unsigned int twsk_obj_size; atomic_t *orphan_count; struct request_sock_ops *rsk_prot; + struct timewait_sock_ops *twsk_prot; struct module *owner; @@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk) sk_free(sk); } +static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb) +{ + int rc = NET_RX_SUCCESS; + + if (sk_filter(sk, skb, 0)) + goto discard_and_relse; + + skb->dev = NULL; + + bh_lock_sock(sk); + if (!sock_owned_by_user(sk)) + rc = sk->sk_backlog_rcv(sk, skb); + else + sk_add_backlog(sk, skb); + bh_unlock_sock(sk); +out: + sock_put(sk); + return rc; +discard_and_relse: + kfree_skb(skb); + goto out; +} + /* Detach socket from process context. * Announce socket dead, detach it from wait queue and inode. * Note that parent inode held reference count on this struct sock, @@ -1166,7 +1189,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) static inline int sock_error(struct sock *sk) { - int err = xchg(&sk->sk_err, 0); + int err; + if (likely(!sk->sk_err)) + return 0; + err = xchg(&sk->sk_err, 0); return -err; } diff --git a/include/net/tcp.h b/include/net/tcp.h index d78025f9fbea..77f21c65bbca 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated; extern int tcp_memory_pressure; /* - * Pointers to address related TCP functions - * (i.e. things that depend on the address family) - */ - -struct tcp_func { - int (*queue_xmit) (struct sk_buff *skb, - int ipfragok); - - void (*send_check) (struct sock *sk, - struct tcphdr *th, - int len, - struct sk_buff *skb); - - int (*rebuild_header) (struct sock *sk); - - int (*conn_request) (struct sock *sk, - struct sk_buff *skb); - - struct sock * (*syn_recv_sock) (struct sock *sk, - struct sk_buff *skb, - struct request_sock *req, - struct dst_entry *dst); - - int (*remember_stamp) (struct sock *sk); - - __u16 net_header_len; - - int (*setsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int optlen); - - int (*getsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int __user *optlen); - - - void (*addr2sockaddr) (struct sock *sk, - struct sockaddr *); - - int sockaddr_len; -}; - -/* * The next routines deal with comparing 32 bit unsigned ints * and worry about wraparound (automatic with unsigned arithmetic). */ @@ -334,6 +287,9 @@ extern int tcp_rcv_established(struct sock *sk, extern void tcp_rcv_space_adjust(struct sock *sk); +extern int tcp_twsk_unique(struct sock *sk, + struct sock *sktw, void *twp); + static inline void tcp_dec_quickack_mode(struct sock *sk, const unsigned int pkts) { @@ -405,8 +361,7 @@ extern void tcp_parse_options(struct sk_buff *skb, * TCP v4 functions exported for the inet6 API */ -extern void tcp_v4_send_check(struct sock *sk, - struct tcphdr *th, int len, +extern void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); extern int tcp_v4_conn_request(struct sock *sk, @@ -490,34 +445,16 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, sk_read_actor_t recv_actor); -/* Initialize RCV_MSS value. - * RCV_MSS is an our guess about MSS used by the peer. - * We haven't any direct information about the MSS. - * It's better to underestimate the RCV_MSS rather than overestimate. - * Overestimations make us ACKing less frequently than needed. - * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss(). - */ +extern void tcp_initialize_rcv_mss(struct sock *sk); -static inline void tcp_initialize_rcv_mss(struct sock *sk) -{ - struct tcp_sock *tp = tcp_sk(sk); - unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); - - hint = min(hint, tp->rcv_wnd/2); - hint = min(hint, TCP_MIN_RCVMSS); - hint = max(hint, TCP_MIN_MSS); - - inet_csk(sk)->icsk_ack.rcv_mss = hint; -} - -static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) +static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) { tp->pred_flags = htonl((tp->tcp_header_len << 26) | ntohl(TCP_FLAG_ACK) | snd_wnd); } -static __inline__ void tcp_fast_path_on(struct tcp_sock *tp) +static inline void tcp_fast_path_on(struct tcp_sock *tp) { __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); } @@ -535,7 +472,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) * Rcv_nxt can be after the window if our peer push more data * than the offered window. */ -static __inline__ u32 tcp_receive_window(const struct tcp_sock *tp) +static inline u32 tcp_receive_window(const struct tcp_sock *tp) { s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; @@ -707,6 +644,7 @@ extern void tcp_cleanup_congestion_control(struct sock *sk); extern int tcp_set_default_congestion_control(const char *name); extern void tcp_get_default_congestion_control(char *name); extern int tcp_set_congestion_control(struct sock *sk, const char *name); +extern void tcp_slow_start(struct tcp_sock *tp); extern struct tcp_congestion_ops tcp_init_congestion_ops; extern u32 tcp_reno_ssthresh(struct sock *sk); @@ -746,7 +684,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event) * "Packets left network, but not honestly ACKed yet" PLUS * "Packets fast retransmitted" */ -static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) +static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) { return (tp->packets_out - tp->left_out + tp->retrans_out); } @@ -766,33 +704,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) (tp->snd_cwnd >> 2))); } -/* - * Linear increase during slow start - */ -static inline void tcp_slow_start(struct tcp_sock *tp) -{ - if (sysctl_tcp_abc) { - /* RFC3465: Slow Start - * TCP sender SHOULD increase cwnd by the number of - * previously unacknowledged bytes ACKed by each incoming - * acknowledgment, provided the increase is not more than L - */ - if (tp->bytes_acked < tp->mss_cache) - return; - - /* We MAY increase by 2 if discovered delayed ack */ - if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) { - if (tp->snd_cwnd < tp->snd_cwnd_clamp) - tp->snd_cwnd++; - } - } - tp->bytes_acked = 0; - - if (tp->snd_cwnd < tp->snd_cwnd_clamp) - tp->snd_cwnd++; -} - - static inline void tcp_sync_left_out(struct tcp_sock *tp) { if (tp->rx_opt.sack_ok && @@ -801,34 +712,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) tp->left_out = tp->sacked_out + tp->lost_out; } -/* Set slow start threshold and cwnd not falling to slow start */ -static inline void __tcp_enter_cwr(struct sock *sk) -{ - const struct inet_connection_sock *icsk = inet_csk(sk); - struct tcp_sock *tp = tcp_sk(sk); - - tp->undo_marker = 0; - tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk); - tp->snd_cwnd = min(tp->snd_cwnd, - tcp_packets_in_flight(tp) + 1U); - tp->snd_cwnd_cnt = 0; - tp->high_seq = tp->snd_nxt; - tp->snd_cwnd_stamp = tcp_time_stamp; - TCP_ECN_queue_cwr(tp); -} - -static inline void tcp_enter_cwr(struct sock *sk) -{ - struct tcp_sock *tp = tcp_sk(sk); - - tp->prior_ssthresh = 0; - tp->bytes_acked = 0; - if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { - __tcp_enter_cwr(sk); - tcp_set_ca_state(sk, TCP_CA_CWR); - } -} - +extern void tcp_enter_cwr(struct sock *sk); extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); /* Slow start with delack produces 3 packets of burst, so that @@ -860,14 +744,14 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) return left <= tcp_max_burst(tp); } -static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, - const struct sk_buff *skb) +static inline void tcp_minshall_update(struct tcp_sock *tp, int mss, + const struct sk_buff *skb) { if (skb->len < mss) tp->snd_sml = TCP_SKB_CB(skb)->end_seq; } -static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) +static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) { const struct inet_connection_sock *icsk = inet_csk(sk); if (!tp->packets_out && !icsk->icsk_pending) @@ -875,18 +759,18 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *t icsk->icsk_rto, TCP_RTO_MAX); } -static __inline__ void tcp_push_pending_frames(struct sock *sk, - struct tcp_sock *tp) +static inline void tcp_push_pending_frames(struct sock *sk, + struct tcp_sock *tp) { __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); } -static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) +static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) { tp->snd_wl1 = seq; } -static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) +static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) { tp->snd_wl1 = seq; } @@ -894,19 +778,19 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) /* * Calculate(/check) TCP checksum */ -static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, - unsigned long saddr, unsigned long daddr, - unsigned long base) +static inline u16 tcp_v4_check(struct tcphdr *th, int len, + unsigned long saddr, unsigned long daddr, + unsigned long base) { return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); } -static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) +static inline int __tcp_checksum_complete(struct sk_buff *skb) { return __skb_checksum_complete(skb); } -static __inline__ int tcp_checksum_complete(struct sk_buff *skb) +static inline int tcp_checksum_complete(struct sk_buff *skb) { return skb->ip_summed != CHECKSUM_UNNECESSARY && __tcp_checksum_complete(skb); @@ -914,7 +798,7 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb) /* Prequeue for VJ style copy to user, combined with checksumming. */ -static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) +static inline void tcp_prequeue_init(struct tcp_sock *tp) { tp->ucopy.task = NULL; tp->ucopy.len = 0; @@ -930,7 +814,7 @@ static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) * * NOTE: is this not too big to inline? */ -static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) +static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); @@ -971,7 +855,7 @@ static const char *statename[]={ }; #endif -static __inline__ void tcp_set_state(struct sock *sk, int state) +static inline void tcp_set_state(struct sock *sk, int state) { int oldstate = sk->sk_state; @@ -1005,7 +889,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) #endif } -static __inline__ void tcp_done(struct sock *sk) +static inline void tcp_done(struct sock *sk) { tcp_set_state(sk, TCP_CLOSE); tcp_clear_xmit_timers(sk); @@ -1018,81 +902,13 @@ static __inline__ void tcp_done(struct sock *sk) inet_csk_destroy_sock(sk); } -static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) +static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) { rx_opt->dsack = 0; rx_opt->eff_sacks = 0; rx_opt->num_sacks = 0; } -static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, __u32 tstamp) -{ - if (tp->rx_opt.tstamp_ok) { - *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | - (TCPOPT_NOP << 16) | - (TCPOPT_TIMESTAMP << 8) | - TCPOLEN_TIMESTAMP); - *ptr++ = htonl(tstamp); - *ptr++ = htonl(tp->rx_opt.ts_recent); - } - if (tp->rx_opt.eff_sacks) { - struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks; - int this_sack; - - *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | - (TCPOPT_NOP << 16) | - (TCPOPT_SACK << 8) | - (TCPOLEN_SACK_BASE + - (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK))); - for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) { - *ptr++ = htonl(sp[this_sack].start_seq); - *ptr++ = htonl(sp[this_sack].end_seq); - } - if (tp->rx_opt.dsack) { - tp->rx_opt.dsack = 0; - tp->rx_opt.eff_sacks--; - } - } -} - -/* Construct a tcp options header for a SYN or SYN_ACK packet. - * If this is every changed make sure to change the definition of - * MAX_SYN_SIZE to match the new maximum number of options that you - * can generate. - */ -static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, - int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent) -{ - /* We always get an MSS option. - * The option bytes which will be seen in normal data - * packets should timestamps be used, must be in the MSS - * advertised. But we subtract them from tp->mss_cache so - * that calculations in tcp_sendmsg are simpler etc. - * So account for this fact here if necessary. If we - * don't do this correctly, as a receiver we won't - * recognize data packets as being full sized when we - * should, and thus we won't abide by the delayed ACK - * rules correctly. - * SACKs don't matter, we never delay an ACK when we - * have any of those going out. - */ - *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss); - if (ts) { - if(sack) - *ptr++ = __constant_htonl((TCPOPT_SACK_PERM << 24) | (TCPOLEN_SACK_PERM << 16) | - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); - else - *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); - *ptr++ = htonl(tstamp); /* TSVAL */ - *ptr++ = htonl(ts_recent); /* TSECR */ - } else if(sack) - *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | - (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM); - if (offer_wscale) - *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale)); -} - /* Determine a window scaling and initial window to offer. */ extern void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd, __u32 *window_clamp, @@ -1117,9 +933,9 @@ static inline int tcp_full_space(const struct sock *sk) return tcp_win_from_space(sk->sk_rcvbuf); } -static __inline__ void tcp_openreq_init(struct request_sock *req, - struct tcp_options_received *rx_opt, - struct sk_buff *skb) +static inline void tcp_openreq_init(struct request_sock *req, + struct tcp_options_received *rx_opt, + struct sk_buff *skb) { struct inet_request_sock *ireq = inet_rsk(req); diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h index b9d4176b2d15..b0b645988bd8 100644 --- a/include/net/tcp_states.h +++ b/include/net/tcp_states.h @@ -31,4 +31,20 @@ enum { #define TCP_STATE_MASK 0xF +#define TCP_ACTION_FIN (1 << 7) + +enum { + TCPF_ESTABLISHED = (1 << 1), + TCPF_SYN_SENT = (1 << 2), + TCPF_SYN_RECV = (1 << 3), + TCPF_FIN_WAIT1 = (1 << 4), + TCPF_FIN_WAIT2 = (1 << 5), + TCPF_TIME_WAIT = (1 << 6), + TCPF_CLOSE = (1 << 7), + TCPF_CLOSE_WAIT = (1 << 8), + TCPF_LAST_ACK = (1 << 9), + TCPF_LISTEN = (1 << 10), + TCPF_CLOSING = (1 << 11) +}; + #endif /* _LINUX_TCP_STATES_H */ diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h new file mode 100644 index 000000000000..2544281e1d5e --- /dev/null +++ b/include/net/timewait_sock.h @@ -0,0 +1,31 @@ +/* + * NET Generic infrastructure for Network protocols. + * + * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> + * + * 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. + */ +#ifndef _TIMEWAIT_SOCK_H +#define _TIMEWAIT_SOCK_H + +#include <linux/slab.h> +#include <net/sock.h> + +struct timewait_sock_ops { + kmem_cache_t *twsk_slab; + unsigned int twsk_obj_size; + int (*twsk_unique)(struct sock *sk, + struct sock *sktw, void *twp); +}; + +static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) +{ + if (sk->sk_prot->twsk_prot->twsk_unique != NULL) + return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp); + return 0; +} + +#endif /* _TIMEWAIT_SOCK_H */ diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 4e86f2de6638..61f724c1036f 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg, /* * address family specific functions */ -extern struct tcp_func ipv4_specific; +extern struct inet_connection_sock_af_ops ipv4_specific; extern int inet6_destroy_sock(struct sock *sk); diff --git a/include/net/udp.h b/include/net/udp.h index 107b9d791a1f..766fba1369ce 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -22,9 +22,8 @@ #ifndef _UDP_H #define _UDP_H -#include <linux/udp.h> -#include <linux/ip.h> #include <linux/list.h> +#include <net/inet_sock.h> #include <net/sock.h> #include <net/snmp.h> #include <linux/seq_file.h> @@ -62,6 +61,7 @@ static inline int udp_lport_inuse(u16 num) extern struct proto udp_prot; +struct sk_buff; extern void udp_err(struct sk_buff *, u32); diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 1cdb87912137..07d7b50cdd76 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -2,11 +2,12 @@ #define _NET_XFRM_H #include <linux/compiler.h> +#include <linux/in.h> #include <linux/xfrm.h> #include <linux/spinlock.h> #include <linux/list.h> #include <linux/skbuff.h> -#include <linux/netdevice.h> +#include <linux/socket.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> #include <linux/in6.h> @@ -144,6 +145,9 @@ struct xfrm_state * transformer. */ struct xfrm_type *type; + /* Security context */ + struct xfrm_sec_ctx *security; + /* Private data of this transformer, format is opaque, * interpreted by xfrm_type methods. */ void *data; @@ -298,6 +302,7 @@ struct xfrm_policy __u8 flags; __u8 dead; __u8 xfrm_nr; + struct xfrm_sec_ctx *security; struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; }; @@ -510,6 +515,25 @@ xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, return 0; } +#ifdef CONFIG_SECURITY_NETWORK_XFRM +/* If neither has a context --> match + * Otherwise, both must have a context and the sids, doi, alg must match + */ +static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) +{ + return ((!s1 && !s2) || + (s1 && s2 && + (s1->ctx_sid == s2->ctx_sid) && + (s1->ctx_doi == s2->ctx_doi) && + (s1->ctx_alg == s2->ctx_alg))); +} +#else +static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) +{ + return 1; +} +#endif + /* A struct encoding bundle of transformations to apply to some set of flow. * * dst->child points to the next element of bundle. @@ -878,8 +902,8 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); -struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, - int delete); +struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, + struct xfrm_sec_ctx *ctx, int delete); struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); void xfrm_policy_flush(void); u32 xfrm_get_acqseq(void); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 20da282d4abb..41cfc29be899 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -151,6 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); extern void scsi_put_command(struct scsi_cmnd *); extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); extern void scsi_finish_command(struct scsi_cmnd *cmd); -extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries); +extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd); #endif /* _SCSI_SCSI_CMND_H */ diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index b090a11d7e1c..4d69dee66d4d 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -16,7 +16,6 @@ extern void __scsi_print_sense(const char *name, extern void scsi_print_driverbyte(int); extern void scsi_print_hostbyte(int); extern void scsi_print_status(unsigned char); -extern int scsi_print_msg(const unsigned char *); extern const char *scsi_sense_key_string(unsigned char); extern const char *scsi_extd_sense_format(unsigned char, unsigned char); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 85cfd88461c8..e94ca4d36035 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -79,9 +79,9 @@ struct scsi_device { char inq_periph_qual; /* PQ from INQUIRY data */ unsigned char inquiry_len; /* valid bytes in 'inquiry' */ unsigned char * inquiry; /* INQUIRY response data */ - char * vendor; /* [back_compat] point into 'inquiry' ... */ - char * model; /* ... after scan; point to static string */ - char * rev; /* ... "nullnullnullnull" before scan */ + const char * vendor; /* [back_compat] point into 'inquiry' ... */ + const char * model; /* ... after scan; point to static string */ + const char * rev; /* ... "nullnullnullnull" before scan */ unsigned char current_tag; /* current tag */ struct scsi_target *sdev_target; /* used only for single_lun */ @@ -274,6 +274,12 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *, int timeout, int retries); +extern int scsi_execute_async(struct scsi_device *sdev, + const unsigned char *cmd, int data_direction, + void *buffer, unsigned bufflen, int use_sg, + int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), + gfp_t gfp); static inline unsigned int sdev_channel(struct scsi_device *sdev) { diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 6bdc4afb2483..54a89611e9c5 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h @@ -24,6 +24,9 @@ #include <linux/transport_class.h> struct scsi_transport_template; +struct scsi_target; +struct scsi_device; +struct Scsi_Host; struct spi_transport_attrs { int period; /* value in the PPR/SDTR command */ @@ -143,5 +146,6 @@ void spi_release_transport(struct scsi_transport_template *); void spi_schedule_dv_device(struct scsi_device *); void spi_dv_device(struct scsi_device *); void spi_display_xfer_agreement(struct scsi_target *); +int spi_print_msg(const unsigned char *); #endif /* SCSI_TRANSPORT_SPI_H */ diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 7f0ca79d6c98..b0b3ea7b365e 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -391,65 +391,35 @@ * */ -typedef struct _snd_ac97_bus ac97_bus_t; -typedef struct _snd_ac97_bus_ops ac97_bus_ops_t; -typedef struct _snd_ac97_template ac97_template_t; -typedef struct _snd_ac97 ac97_t; - -enum ac97_pcm_cfg { - AC97_PCM_CFG_FRONT = 2, - AC97_PCM_CFG_REAR = 10, /* alias surround */ - AC97_PCM_CFG_LFE = 11, /* center + lfe */ - AC97_PCM_CFG_40 = 4, /* front + rear */ - AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */ - AC97_PCM_CFG_SPDIF = 20 -}; - -/* PCM allocation */ -struct ac97_pcm { - ac97_bus_t *bus; - unsigned int stream: 1, /* stream type: 1 = capture */ - exclusive: 1, /* exclusive mode, don't override with other pcms */ - copy_flag: 1, /* lowlevel driver must fill all entries */ - spdif: 1; /* spdif pcm */ - unsigned short aslots; /* active slots */ - unsigned int rates; /* available rates */ - struct { - unsigned short slots; /* driver input: requested AC97 slot numbers */ - unsigned short rslots[4]; /* allocated slots per codecs */ - unsigned char rate_table[4]; - ac97_t *codec[4]; /* allocated codecs */ - } r[2]; /* 0 = standard rates, 1 = double rates */ - unsigned long private_value; /* used by the hardware driver */ -}; +struct snd_ac97; struct snd_ac97_build_ops { - int (*build_3d) (ac97_t *ac97); - int (*build_specific) (ac97_t *ac97); - int (*build_spdif) (ac97_t *ac97); - int (*build_post_spdif) (ac97_t *ac97); + int (*build_3d) (struct snd_ac97 *ac97); + int (*build_specific) (struct snd_ac97 *ac97); + int (*build_spdif) (struct snd_ac97 *ac97); + int (*build_post_spdif) (struct snd_ac97 *ac97); #ifdef CONFIG_PM - void (*suspend) (ac97_t *ac97); - void (*resume) (ac97_t *ac97); + void (*suspend) (struct snd_ac97 *ac97); + void (*resume) (struct snd_ac97 *ac97); #endif - void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ + void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */ }; -struct _snd_ac97_bus_ops { - void (*reset) (ac97_t *ac97); - void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); - unsigned short (*read) (ac97_t *ac97, unsigned short reg); - void (*wait) (ac97_t *ac97); - void (*init) (ac97_t *ac97); +struct snd_ac97_bus_ops { + void (*reset) (struct snd_ac97 *ac97); + void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val); + unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg); + void (*wait) (struct snd_ac97 *ac97); + void (*init) (struct snd_ac97 *ac97); }; -struct _snd_ac97_bus { +struct snd_ac97_bus { /* -- lowlevel (hardware) driver specific -- */ - ac97_bus_ops_t *ops; + struct snd_ac97_bus_ops *ops; void *private_data; - void (*private_free) (ac97_bus_t *bus); + void (*private_free) (struct snd_ac97_bus *bus); /* --- */ - snd_card_t *card; + struct snd_card *card; unsigned short num; /* bus number */ unsigned short no_vra: 1, /* bridge doesn't support VRA */ dra: 1, /* bridge supports double rate */ @@ -459,13 +429,13 @@ struct _snd_ac97_bus { unsigned short used_slots[2][4]; /* actually used PCM slots */ unsigned short pcms_count; /* count of PCMs */ struct ac97_pcm *pcms; - ac97_t *codec[4]; - snd_info_entry_t *proc; + struct snd_ac97 *codec[4]; + struct snd_info_entry *proc; }; -struct _snd_ac97_template { +struct snd_ac97_template { void *private_data; - void (*private_free) (ac97_t *ac97); + void (*private_free) (struct snd_ac97 *ac97); struct pci_dev *pci; /* assigned PCI device - used for quirks */ unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ unsigned short addr; /* physical address of codec [0-3] */ @@ -474,16 +444,16 @@ struct _snd_ac97_template { DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ }; -struct _snd_ac97 { +struct snd_ac97 { /* -- lowlevel (hardware) driver specific -- */ struct snd_ac97_build_ops * build_ops; void *private_data; - void (*private_free) (ac97_t *ac97); + void (*private_free) (struct snd_ac97 *ac97); /* --- */ - ac97_bus_t *bus; + struct snd_ac97_bus *bus; struct pci_dev *pci; /* assigned PCI device - used for quirks */ - snd_info_entry_t *proc; - snd_info_entry_t *proc_regs; + struct snd_info_entry *proc; + struct snd_info_entry *proc_regs; unsigned short subsystem_vendor; unsigned short subsystem_device; struct semaphore reg_mutex; @@ -517,43 +487,47 @@ struct _snd_ac97 { struct device dev; }; -#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) +#define to_ac97_t(d) container_of(d, struct snd_ac97, dev) /* conditions */ -static inline int ac97_is_audio(ac97_t * ac97) +static inline int ac97_is_audio(struct snd_ac97 * ac97) { return (ac97->scaps & AC97_SCAP_AUDIO); } -static inline int ac97_is_modem(ac97_t * ac97) +static inline int ac97_is_modem(struct snd_ac97 * ac97) { return (ac97->scaps & AC97_SCAP_MODEM); } -static inline int ac97_is_rev22(ac97_t * ac97) +static inline int ac97_is_rev22(struct snd_ac97 * ac97) { return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; } -static inline int ac97_can_amap(ac97_t * ac97) +static inline int ac97_can_amap(struct snd_ac97 * ac97) { return (ac97->ext_id & AC97_EI_AMAP) != 0; } -static inline int ac97_can_spdif(ac97_t * ac97) +static inline int ac97_can_spdif(struct snd_ac97 * ac97) { return (ac97->ext_id & AC97_EI_SPDIF) != 0; } /* functions */ -int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, void *private_data, ac97_bus_t **rbus); /* create new AC97 bus */ -int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ -const char *snd_ac97_get_short_name(ac97_t *ac97); - -void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); -unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); -void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); -int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); -int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); +/* create new AC97 bus */ +int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, + void *private_data, struct snd_ac97_bus **rbus); +/* create mixer controls */ +int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, + struct snd_ac97 **rac97); +const char *snd_ac97_get_short_name(struct snd_ac97 *ac97); + +void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); +unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg); +void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); +int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); +int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); #ifdef CONFIG_PM -void snd_ac97_suspend(ac97_t *ac97); -void snd_ac97_resume(ac97_t *ac97); +void snd_ac97_suspend(struct snd_ac97 *ac97); +void snd_ac97_resume(struct snd_ac97 *ac97); #endif /* quirk types */ @@ -567,6 +541,7 @@ enum { AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ + AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */ }; struct ac97_quirk { @@ -578,24 +553,46 @@ struct ac97_quirk { int type; /* quirk type above */ }; -int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); -int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); +int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); +int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); + +/* + * PCM allocation + */ + +enum ac97_pcm_cfg { + AC97_PCM_CFG_FRONT = 2, + AC97_PCM_CFG_REAR = 10, /* alias surround */ + AC97_PCM_CFG_LFE = 11, /* center + lfe */ + AC97_PCM_CFG_40 = 4, /* front + rear */ + AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */ + AC97_PCM_CFG_SPDIF = 20 +}; + +struct ac97_pcm { + struct snd_ac97_bus *bus; + unsigned int stream: 1, /* stream type: 1 = capture */ + exclusive: 1, /* exclusive mode, don't override with other pcms */ + copy_flag: 1, /* lowlevel driver must fill all entries */ + spdif: 1; /* spdif pcm */ + unsigned short aslots; /* active slots */ + unsigned int rates; /* available rates */ + struct { + unsigned short slots; /* driver input: requested AC97 slot numbers */ + unsigned short rslots[4]; /* allocated slots per codecs */ + unsigned char rate_table[4]; + struct snd_ac97 *codec[4]; /* allocated codecs */ + } r[2]; /* 0 = standard rates, 1 = double rates */ + unsigned long private_value; /* used by the hardware driver */ +}; -int snd_ac97_pcm_assign(ac97_bus_t *ac97, +int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97, unsigned short pcms_count, const struct ac97_pcm *pcms); int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, enum ac97_pcm_cfg cfg, unsigned short slots); int snd_ac97_pcm_close(struct ac97_pcm *pcm); -int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); - -struct ac97_enum { - unsigned char reg; - unsigned char shift_l; - unsigned char shift_r; - unsigned short mask; - const char **texts; -}; +int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); /* ad hoc AC97 device driver access */ extern struct bus_type ac97_bus_type; diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h index ca2e0e4fa937..b3aa62ee3c8d 100644 --- a/include/sound/ad1816a.h +++ b/include/sound/ad1816a.h @@ -123,9 +123,7 @@ #define AD1816A_CAPTURE_NOT_EQUAL 0x1000 #define AD1816A_WSS_ENABLE 0x8000 -typedef struct _snd_ad1816a ad1816a_t; - -struct _snd_ad1816a { +struct snd_ad1816a { unsigned long port; struct resource *res_port; int irq; @@ -140,15 +138,15 @@ struct _snd_ad1816a { unsigned short mode; unsigned int clock_freq; - snd_card_t *card; - snd_pcm_t *pcm; + struct snd_card *card; + struct snd_pcm *pcm; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; unsigned int p_dma_size; unsigned int c_dma_size; - snd_timer_t *timer; + struct snd_timer *timer; }; @@ -165,11 +163,11 @@ struct _snd_ad1816a { AD1816A_MODE_TIMER) -extern int snd_ad1816a_create(snd_card_t *card, unsigned long port, +extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, - ad1816a_t **chip); + struct snd_ad1816a **chip); -extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm); -extern int snd_ad1816a_mixer(ad1816a_t *chip); +extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); +extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); #endif /* __SOUND_AD1816A_H */ diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h index 7e33b11037f2..1a2759f3a292 100644 --- a/include/sound/ad1848.h +++ b/include/sound/ad1848.h @@ -127,7 +127,7 @@ #define AD1848_THINKPAD_CTL_PORT2 0x15e9 #define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 -struct _snd_ad1848 { +struct snd_ad1848 { unsigned long port; /* i/o port */ struct resource *res_port; int irq; /* IRQ line */ @@ -137,10 +137,10 @@ struct _snd_ad1848 { unsigned short hardware; /* see to AD1848_HW_XXXX */ unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ - snd_pcm_t *pcm; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; - snd_card_t *card; + struct snd_pcm *pcm; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; + struct snd_card *card; unsigned char image[32]; /* SGalaxy needs an access to extended registers */ int mce_bit; @@ -148,25 +148,28 @@ struct _snd_ad1848 { int dma_size; int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ +#ifdef CONFIG_PM + void (*suspend)(struct snd_ad1848 *chip); + void (*resume)(struct snd_ad1848 *chip); +#endif + spinlock_t reg_lock; struct semaphore open_mutex; }; -typedef struct _snd_ad1848 ad1848_t; - /* exported functions */ -void snd_ad1848_out(ad1848_t *chip, unsigned char reg, unsigned char value); +void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value); -int snd_ad1848_create(snd_card_t * card, +int snd_ad1848_create(struct snd_card *card, unsigned long port, int irq, int dma, unsigned short hardware, - ad1848_t ** chip); + struct snd_ad1848 ** chip); -int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm); -const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction); -int snd_ad1848_mixer(ad1848_t * chip); +int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm); +const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction); +int snd_ad1848_mixer(struct snd_ad1848 * chip); /* exported mixer stuffs */ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; @@ -176,7 +179,7 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; #define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) -int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, unsigned long value); +int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value); /* for ease of use */ struct ad1848_mix_elem { @@ -198,7 +201,7 @@ struct ad1848_mix_elem { .type = AD1848_MIX_DOUBLE, \ .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } -static inline int snd_ad1848_add_ctl_elem(ad1848_t *chip, const struct ad1848_mix_elem *c) +static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c) { return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); } diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h index 0ec02953815a..c4afb1f121fe 100644 --- a/include/sound/ainstr_fm.h +++ b/include/sound/ainstr_fm.h @@ -39,13 +39,13 @@ * FM operator */ -typedef struct fm_operator { +struct fm_operator { unsigned char am_vib; unsigned char ksl_level; unsigned char attack_decay; unsigned char sustain_release; unsigned char wave_select; -} fm_operator_t; +}; /* * Instrument @@ -54,11 +54,11 @@ typedef struct fm_operator { #define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ #define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ -typedef struct { +struct fm_instrument { unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned char type; /* instrument type */ - fm_operator_t op[4]; + struct fm_operator op[4]; unsigned char feedback_connection[2]; unsigned char echo_delay; @@ -68,7 +68,7 @@ typedef struct { unsigned char fix_dur; unsigned char modes; unsigned char fix_key; -} fm_instrument_t; +}; /* * @@ -88,25 +88,25 @@ typedef struct { * FM operator */ -typedef struct fm_xoperator { +struct fm_xoperator { __u8 am_vib; __u8 ksl_level; __u8 attack_decay; __u8 sustain_release; __u8 wave_select; -} fm_xoperator_t; +}; /* * Instrument */ -typedef struct fm_xinstrument { +struct fm_xinstrument { __u32 stype; /* structure type */ __u32 share_id[4]; /* share id - zero = no sharing */ __u8 type; /* instrument type */ - fm_xoperator_t op[4]; /* fm operators */ + struct fm_xoperator op[4]; /* fm operators */ __u8 feedback_connection[2]; __u8 echo_delay; @@ -116,15 +116,19 @@ typedef struct fm_xinstrument { __u8 fix_dur; __u8 modes; __u8 fix_key; -} fm_xinstrument_t; +}; #ifdef __KERNEL__ #include "seq_instr.h" -int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops, - snd_seq_kinstr_ops_t * next); +int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops, + struct snd_seq_kinstr_ops * next); #endif +/* typedefs for compatibility to user-space */ +typedef struct fm_xoperator fm_xoperator_t; +typedef struct fm_xinstrument fm_xinstrument_t; + #endif /* __SOUND_AINSTR_FM_H */ diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h index ae2ddda63971..47726fe0f46d 100644 --- a/include/sound/ainstr_gf1.h +++ b/include/sound/ainstr_gf1.h @@ -52,7 +52,7 @@ * Wavetable definitions */ -typedef struct gf1_wave { +struct gf1_wave { unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int format; /* wave format */ @@ -88,7 +88,7 @@ typedef struct gf1_wave { unsigned short scale_factor; /* 0-2048 or 0-2 */ struct gf1_wave *next; -} gf1_wave_t; +}; /* * Instrument @@ -103,7 +103,7 @@ typedef struct gf1_wave { #define IWFFFF_EFFECT_CHORUS 2 #define IWFFFF_EFFECT_ECHO 3 -typedef struct { +struct gf1_instrument { unsigned short exclusion; unsigned short exclusion_group; /* 0 - none, 1-65535 */ @@ -112,8 +112,8 @@ typedef struct { unsigned char effect2; /* effect 2 */ unsigned char effect2_depth; /* 0-127 */ - gf1_wave_t *wave; /* first waveform */ -} gf1_instrument_t; + struct gf1_wave *wave; /* first waveform */ +}; /* * @@ -135,7 +135,7 @@ typedef struct { * Wavetable definitions */ -typedef struct gf1_xwave { +struct gf1_xwave { __u32 stype; /* structure type */ __u32 share_id[4]; /* share id - zero = no sharing */ @@ -165,13 +165,13 @@ typedef struct gf1_xwave { __u8 vibrato_depth; __u16 scale_frequency; __u16 scale_factor; /* 0-2048 or 0-2 */ -} gf1_xwave_t; +}; /* * Instrument */ -typedef struct gf1_xinstrument { +struct gf1_xinstrument { __u32 stype; __u16 exclusion; @@ -181,7 +181,7 @@ typedef struct gf1_xinstrument { __u8 effect1_depth; /* 0-127 */ __u8 effect2; /* effect 2 */ __u8 effect2_depth; /* 0-127 */ -} gf1_xinstrument_t; +}; /* * Instrument info @@ -191,35 +191,39 @@ typedef struct gf1_xinstrument { #define GF1_INFO_TREMOLO (1<<1) #define GF1_INFO_VIBRATO (1<<2) -typedef struct gf1_info { +struct gf1_info { unsigned char flags; /* supported wave flags */ unsigned char pad[3]; unsigned int features; /* supported features */ unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */ -} gf1_info_t; +}; #ifdef __KERNEL__ #include "seq_instr.h" -typedef struct { +struct snd_gf1_ops { void *private_data; - int (*info)(void *private_data, gf1_info_t *info); - int (*put_sample)(void *private_data, gf1_wave_t *wave, + int (*info)(void *private_data, struct gf1_info *info); + int (*put_sample)(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, gf1_wave_t *wave, + int (*get_sample)(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, gf1_wave_t *wave, + int (*remove_sample)(void *private_data, struct gf1_wave *wave, int atomic); - void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); - snd_seq_kinstr_ops_t kops; -} snd_gf1_ops_t; + void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); + struct snd_seq_kinstr_ops kops; +}; -int snd_seq_gf1_init(snd_gf1_ops_t *ops, +int snd_seq_gf1_init(struct snd_gf1_ops *ops, void *private_data, - snd_seq_kinstr_ops_t *next); + struct snd_seq_kinstr_ops *next); #endif +/* typedefs for compatibility to user-space */ +typedef struct gf1_xwave gf1_xwave_t; +typedef struct gf1_xinstrument gf1_xinstrument_t; + #endif /* __SOUND_AINSTR_GF1_H */ diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h index 8adf744926ff..251feaf1b388 100644 --- a/include/sound/ainstr_iw.h +++ b/include/sound/ainstr_iw.h @@ -54,7 +54,7 @@ * Wavetable definitions */ -typedef struct iwffff_wave { +struct iwffff_wave { unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int format; /* wave format */ @@ -76,7 +76,7 @@ typedef struct iwffff_wave { unsigned char pad; struct iwffff_wave *next; -} iwffff_wave_t; +}; /* * Layer @@ -85,13 +85,13 @@ typedef struct iwffff_wave { #define IWFFFF_LFO_SHAPE_TRIANGLE 0 #define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 -typedef struct iwffff_lfo { +struct iwffff_lfo { unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ signed short depth; /* volume +- (0-255) 0.48675dB/step */ signed short sweep; /* 0 - 950 deciseconds */ unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ unsigned char delay; /* 0 - 255 deciseconds */ -} iwffff_lfo_t; +}; #define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ @@ -102,12 +102,12 @@ typedef struct iwffff_lfo { #define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ #define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ -typedef struct iwffff_env_point { +struct iwffff_env_point { unsigned short offset; unsigned short rate; -} iwffff_env_point_t; +}; -typedef struct iwffff_env_record { +struct iwffff_env_record { unsigned short nattack; unsigned short nrelease; unsigned short sustain_offset; @@ -118,15 +118,15 @@ typedef struct iwffff_env_record { struct iwffff_env_record *next; /* points are stored here */ /* count of points = nattack + nrelease */ -} iwffff_env_record_t; +}; -typedef struct iwffff_env { +struct iwffff_env { unsigned char flags; unsigned char mode; unsigned char index; unsigned char pad; struct iwffff_env_record *record; -} iwffff_env_t; +}; #define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ @@ -138,7 +138,7 @@ typedef struct iwffff_env { #define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ #define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ -typedef struct iwffff_layer { +struct iwffff_layer { unsigned char flags; unsigned char velocity_mode; unsigned char layer_event; @@ -147,17 +147,17 @@ typedef struct iwffff_layer { unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ unsigned char pan_freq_scale; /* position based on frequency (0-127) */ unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ - iwffff_lfo_t tremolo; /* tremolo effect */ - iwffff_lfo_t vibrato; /* vibrato effect */ + struct iwffff_lfo tremolo; /* tremolo effect */ + struct iwffff_lfo vibrato; /* vibrato effect */ unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ unsigned char freq_center; /* center for keyboard frequency scaling */ unsigned char pad; - iwffff_env_t penv; /* pitch envelope */ - iwffff_env_t venv; /* volume envelope */ + struct iwffff_env penv; /* pitch envelope */ + struct iwffff_env venv; /* volume envelope */ - iwffff_wave_t *wave; + struct iwffff_wave *wave; struct iwffff_layer *next; -} iwffff_layer_t; +}; /* * Instrument @@ -177,7 +177,7 @@ typedef struct iwffff_layer { #define IWFFFF_EFFECT_CHORUS 2 #define IWFFFF_EFFECT_ECHO 3 -typedef struct { +struct iwffff_instrument { unsigned short exclusion; unsigned short layer_type; unsigned short exclusion_group; /* 0 - none, 1-65535 */ @@ -187,8 +187,8 @@ typedef struct { unsigned char effect2; /* effect 2 */ unsigned char effect2_depth; /* 0-127 */ - iwffff_layer_t *layer; /* first layer */ -} iwffff_instrument_t; + struct iwffff_layer *layer; /* first layer */ +}; /* * @@ -216,7 +216,7 @@ typedef struct { * Wavetable definitions */ -typedef struct iwffff_xwave { +struct iwffff_xwave { __u32 stype; /* structure type */ __u32 share_id[4]; /* share id - zero = no sharing */ @@ -234,26 +234,26 @@ typedef struct iwffff_xwave { __u8 low_note; /* lower frequency range for this waveform */ __u8 high_note; /* higher frequency range for this waveform */ __u8 pad; -} iwffff_xwave_t; +}; /* * Layer */ -typedef struct iwffff_xlfo { +struct iwffff_xlfo { __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ __s16 depth; /* volume +- (0-255) 0.48675dB/step */ __s16 sweep; /* 0 - 950 deciseconds */ __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ __u8 delay; /* 0 - 255 deciseconds */ -} iwffff_xlfo_t; +}; -typedef struct iwffff_xenv_point { +struct iwffff_xenv_point { __u16 offset; __u16 rate; -} iwffff_xenv_point_t; +}; -typedef struct iwffff_xenv_record { +struct iwffff_xenv_record { __u32 stype; __u16 nattack; __u16 nrelease; @@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record { __u8 pad; /* points are stored here.. */ /* count of points = nattack + nrelease */ -} iwffff_xenv_record_t; +}; -typedef struct iwffff_xenv { +struct iwffff_xenv { __u8 flags; __u8 mode; __u8 index; __u8 pad; -} iwffff_xenv_t; +}; -typedef struct iwffff_xlayer { +struct iwffff_xlayer { __u32 stype; __u8 flags; __u8 velocity_mode; @@ -283,20 +283,20 @@ typedef struct iwffff_xlayer { __u8 pan; /* pan offset from CC1 (0 left - 127 right) */ __u8 pan_freq_scale; /* position based on frequency (0-127) */ __u8 attenuation; /* 0-127 (no corresponding midi controller) */ - iwffff_xlfo_t tremolo; /* tremolo effect */ - iwffff_xlfo_t vibrato; /* vibrato effect */ + struct iwffff_xlfo tremolo; /* tremolo effect */ + struct iwffff_xlfo vibrato; /* vibrato effect */ __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ __u8 freq_center; /* center for keyboard frequency scaling */ __u8 pad; - iwffff_xenv_t penv; /* pitch envelope */ - iwffff_xenv_t venv; /* volume envelope */ -} iwffff_xlayer_t; + struct iwffff_xenv penv; /* pitch envelope */ + struct iwffff_xenv venv; /* volume envelope */ +}; /* * Instrument */ -typedef struct iwffff_xinstrument { +struct iwffff_xinstrument { __u32 stype; __u16 exclusion; @@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument { __u8 effect1_depth; /* 0-127 */ __u8 effect2; /* effect 2 */ __u8 effect2_depth; /* 0-127 */ -} iwffff_xinstrument_t; +}; /* * ROM support @@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument { #define IWFFFF_ROM_HDR_SIZE 512 -typedef struct { +struct iwffff_rom_header { __u8 iwave[8]; __u8 revision; __u8 series_number; @@ -328,7 +328,7 @@ typedef struct { __u8 copyright[128]; __u8 vendor_name[64]; __u8 description[128]; -} iwffff_rom_header_t; +}; /* * Instrument info @@ -339,35 +339,46 @@ typedef struct { #define IWFFFF_INFO_LFO_TREMOLO (1<<2) #define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) -typedef struct iwffff_info { +struct iwffff_info { unsigned int format; /* supported format bits */ unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ unsigned int lfos; /* LFO effects */ unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */ -} iwffff_info_t; +}; #ifdef __KERNEL__ #include "seq_instr.h" -typedef struct { +struct snd_iwffff_ops { void *private_data; - int (*info)(void *private_data, iwffff_info_t *info); - int (*put_sample)(void *private_data, iwffff_wave_t *wave, + int (*info)(void *private_data, struct iwffff_info *info); + int (*put_sample)(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, iwffff_wave_t *wave, + int (*get_sample)(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, iwffff_wave_t *wave, + int (*remove_sample)(void *private_data, struct iwffff_wave *wave, int atomic); - void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); - snd_seq_kinstr_ops_t kops; -} snd_iwffff_ops_t; + void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); + struct snd_seq_kinstr_ops kops; +}; -int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, +int snd_seq_iwffff_init(struct snd_iwffff_ops *ops, void *private_data, - snd_seq_kinstr_ops_t *next); + struct snd_seq_kinstr_ops *next); #endif +/* typedefs for compatibility to user-space */ +typedef struct iwffff_xwave iwffff_xwave_t; +typedef struct iwffff_xlfo iwffff_xlfo_t; +typedef struct iwffff_xenv_point iwffff_xenv_point_t; +typedef struct iwffff_xenv_record iwffff_xenv_record_t; +typedef struct iwffff_xenv iwffff_xenv_t; +typedef struct iwffff_xlayer iwffff_xlayer_t; +typedef struct iwffff_xinstrument iwffff_xinstrument_t; +typedef struct iwffff_rom_header iwffff_rom_header_t; +typedef struct iwffff_info iwffff_info_t; + #endif /* __SOUND_AINSTR_IW_H */ diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h index 40824b4ab23d..5eead12e58ae 100644 --- a/include/sound/ainstr_simple.h +++ b/include/sound/ainstr_simple.h @@ -61,18 +61,18 @@ * instrument info */ -typedef struct simple_instrument_info { +struct simple_instrument_info { unsigned int format; /* supported format bits */ unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */ -} simple_instrument_info_t; +}; /* * Instrument */ -typedef struct { +struct simple_instrument { unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int format; /* wave format */ @@ -92,7 +92,7 @@ typedef struct { unsigned char effect1_depth; /* 0-127 */ unsigned char effect2; /* effect 2 */ unsigned char effect2_depth; /* 0-127 */ -} simple_instrument_t; +}; /* * @@ -112,7 +112,7 @@ typedef struct { * Instrument */ -typedef struct simple_xinstrument { +struct simple_xinstrument { __u32 stype; __u32 share_id[4]; /* share id - zero = no sharing */ @@ -128,29 +128,32 @@ typedef struct simple_xinstrument { __u8 effect1_depth; /* 0-127 */ __u8 effect2; /* effect 2 */ __u8 effect2_depth; /* 0-127 */ -} simple_xinstrument_t; +}; #ifdef __KERNEL__ #include "seq_instr.h" -typedef struct { +struct snd_simple_ops { void *private_data; - int (*info)(void *private_data, simple_instrument_info_t *info); - int (*put_sample)(void *private_data, simple_instrument_t *instr, + int (*info)(void *private_data, struct simple_instrument_info *info); + int (*put_sample)(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, simple_instrument_t *instr, + int (*get_sample)(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, simple_instrument_t *instr, + int (*remove_sample)(void *private_data, struct simple_instrument *instr, int atomic); - void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); - snd_seq_kinstr_ops_t kops; -} snd_simple_ops_t; + void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); + struct snd_seq_kinstr_ops kops; +}; -int snd_seq_simple_init(snd_simple_ops_t *ops, +int snd_seq_simple_init(struct snd_simple_ops *ops, void *private_data, - snd_seq_kinstr_ops_t *next); + struct snd_seq_kinstr_ops *next); #endif +/* typedefs for compatibility to user-space */ +typedef struct simple_xinstrument simple_xinstrument_t; + #endif /* __SOUND_AINSTR_SIMPLE_H */ diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h index f3f2c3e5ae51..11702aa0bea9 100644 --- a/include/sound/ak4114.h +++ b/include/sound/ak4114.h @@ -163,10 +163,8 @@ typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data); typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr); -typedef struct ak4114 ak4114_t; - struct ak4114 { - snd_card_t * card; + struct snd_card *card; ak4114_write_t * write; ak4114_read_t * read; void * private_data; @@ -174,9 +172,9 @@ struct ak4114 { spinlock_t lock; unsigned char regmap[7]; unsigned char txcsb[5]; - snd_kcontrol_t *kctls[AK4114_CONTROLS]; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; + struct snd_kcontrol *kctls[AK4114_CONTROLS]; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; unsigned long parity_errors; unsigned long v_bit_errors; unsigned long qcrc_errors; @@ -186,20 +184,20 @@ struct ak4114 { struct workqueue_struct *workqueue; struct work_struct work; void *change_callback_private; - void (*change_callback)(ak4114_t *ak4114, unsigned char c0, unsigned char c1); + void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1); }; -int snd_ak4114_create(snd_card_t *card, +int snd_ak4114_create(struct snd_card *card, ak4114_read_t *read, ak4114_write_t *write, unsigned char pgm[7], unsigned char txcsb[5], - void *private_data, ak4114_t **r_ak4114); -void snd_ak4114_reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char mask, unsigned char val); -void snd_ak4114_reinit(ak4114_t *ak4114); -int snd_ak4114_build(ak4114_t *ak4114, - snd_pcm_substream_t *playback_substream, - snd_pcm_substream_t *capture_substream); -int snd_ak4114_external_rate(ak4114_t *ak4114); -int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags); + void *private_data, struct ak4114 **r_ak4114); +void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val); +void snd_ak4114_reinit(struct ak4114 *ak4114); +int snd_ak4114_build(struct ak4114 *ak4114, + struct snd_pcm_substream *playback_substream, + struct snd_pcm_substream *capture_substream); +int snd_ak4114_external_rate(struct ak4114 *ak4114); +int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); #endif /* __SOUND_AK4114_H */ diff --git a/include/sound/ak4117.h b/include/sound/ak4117.h index 9e1dab17c33e..2b96c32f06fd 100644 --- a/include/sound/ak4117.h +++ b/include/sound/ak4117.h @@ -155,18 +155,16 @@ typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data); typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr); -typedef struct ak4117 ak4117_t; - struct ak4117 { - snd_card_t * card; + struct snd_card *card; ak4117_write_t * write; ak4117_read_t * read; void * private_data; unsigned int init: 1; spinlock_t lock; unsigned char regmap[5]; - snd_kcontrol_t *kctls[AK4117_CONTROLS]; - snd_pcm_substream_t *substream; + struct snd_kcontrol *kctls[AK4117_CONTROLS]; + struct snd_pcm_substream *substream; unsigned long parity_errors; unsigned long v_bit_errors; unsigned long qcrc_errors; @@ -176,16 +174,16 @@ struct ak4117 { unsigned char rcs2; struct timer_list timer; /* statistic timer */ void *change_callback_private; - void (*change_callback)(ak4117_t *ak4117, unsigned char c0, unsigned char c1); + void (*change_callback)(struct ak4117 *ak4117, unsigned char c0, unsigned char c1); }; -int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, - unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117); -void snd_ak4117_reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char mask, unsigned char val); -void snd_ak4117_reinit(ak4117_t *ak4117); -int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *capture_substream); -int snd_ak4117_external_rate(ak4117_t *ak4117); -int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags); +int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write, + unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117); +void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val); +void snd_ak4117_reinit(struct ak4117 *ak4117); +int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream); +int snd_ak4117_external_rate(struct ak4117 *ak4117); +int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags); #endif /* __SOUND_AK4117_H */ diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h index 8b18992376d5..edf04070ce7c 100644 --- a/include/sound/ak4531_codec.h +++ b/include/sound/ak4531_codec.h @@ -64,17 +64,22 @@ #define AK4531_AD_IN 0x18 /* AD input select */ #define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */ -typedef struct _snd_ak4531 ak4531_t; - -struct _snd_ak4531 { - void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val); +struct snd_ak4531 { + void (*write) (struct snd_ak4531 *ak4531, unsigned short reg, + unsigned short val); void *private_data; - void (*private_free) (ak4531_t *ak4531); + void (*private_free) (struct snd_ak4531 *ak4531); /* --- */ unsigned char regs[0x20]; struct semaphore reg_mutex; }; -int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531); +int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531, + struct snd_ak4531 **rak4531); + +#ifdef CONFIG_PM +void snd_ak4531_suspend(struct snd_ak4531 *ak4531); +void snd_ak4531_resume(struct snd_ak4531 *ak4531); +#endif #endif /* __SOUND_AK4531_CODEC_H */ diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h index e94ac0282318..3bf5911fe827 100644 --- a/include/sound/ak4xxx-adda.h +++ b/include/sound/ak4xxx-adda.h @@ -27,20 +27,20 @@ #define AK4XXX_MAX_CHIPS 4 #endif -typedef struct snd_akm4xxx akm4xxx_t; +struct snd_akm4xxx; struct snd_ak4xxx_ops { - void (*lock)(akm4xxx_t *ak, int chip); - void (*unlock)(akm4xxx_t *ak, int chip); - void (*write)(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); - // unsigned char (*read)(akm4xxx_t *ak, int chip, unsigned char reg); - void (*set_rate_val)(akm4xxx_t *ak, unsigned int rate); + void (*lock)(struct snd_akm4xxx *ak, int chip); + void (*unlock)(struct snd_akm4xxx *ak, int chip); + void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val); + // unsigned char (*read)(struct snd_akm4xxx *ak, int chip, unsigned char reg); + void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate); }; #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ struct snd_akm4xxx { - snd_card_t *card; + struct snd_card *card; unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ unsigned int num_dacs; /* AK4524 or AK4528 DACs */ unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ @@ -56,10 +56,10 @@ struct snd_akm4xxx { struct snd_ak4xxx_ops ops; }; -void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); -void snd_akm4xxx_reset(akm4xxx_t *ak, int state); -void snd_akm4xxx_init(akm4xxx_t *ak); -int snd_akm4xxx_build_controls(akm4xxx_t *ak); +void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val); +void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state); +void snd_akm4xxx_init(struct snd_akm4xxx *ak); +int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); #define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] #define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h index 728efd504262..6691e4aa4ea7 100644 --- a/include/sound/asequencer.h +++ b/include/sound/asequencer.h @@ -22,11 +22,10 @@ #ifndef __SOUND_ASEQUENCER_H #define __SOUND_ASEQUENCER_H -#ifndef __KERNEL__ +#ifdef __KERNEL__ #include <linux/ioctl.h> -#endif - #include <sound/asound.h> +#endif /** version of the sequencer */ #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) @@ -36,13 +35,13 @@ */ /** system messages - * event data type = #sndrv_seq_result_t + * event data type = #snd_seq_result */ #define SNDRV_SEQ_EVENT_SYSTEM 0 #define SNDRV_SEQ_EVENT_RESULT 1 /** note messages (channel specific) - * event data type = #sndrv_seq_ev_note + * event data type = #snd_seq_ev_note */ #define SNDRV_SEQ_EVENT_NOTE 5 #define SNDRV_SEQ_EVENT_NOTEON 6 @@ -50,7 +49,7 @@ #define SNDRV_SEQ_EVENT_KEYPRESS 8 /** control messages (channel specific) - * event data type = #sndrv_seq_ev_ctrl + * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_CONTROLLER 10 #define SNDRV_SEQ_EVENT_PGMCHANGE 11 @@ -61,7 +60,7 @@ #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ /** synchronisation messages - * event data type = #sndrv_seq_ev_ctrl + * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ @@ -70,7 +69,7 @@ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ /** timer messages - * event data type = sndrv_seq_ev_queue_control_t + * event data type = snd_seq_ev_queue_control */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ @@ -96,7 +95,7 @@ #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ /** system status messages (broadcast for subscribers) - * event data type = sndrv_seq_addr_t + * event data type = snd_seq_addr */ #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ @@ -106,13 +105,13 @@ #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ /** port connection changes - * event data type = sndrv_seq_connect_t + * event data type = snd_seq_connect */ #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ /** synthesizer events - * event data type = sndrv_seq_eve_sample_control_t + * event data type = snd_seq_eve_sample_control */ #define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ #define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ @@ -163,7 +162,7 @@ /* 119-129: reserved */ /* 130-139: variable length events - * event data type = sndrv_seq_ev_ext + * event data type = snd_seq_ev_ext * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) */ #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ @@ -187,18 +186,18 @@ #define SNDRV_SEQ_EVENT_NONE 255 -typedef unsigned char sndrv_seq_event_type_t; +typedef unsigned char snd_seq_event_type_t; /** event address */ -struct sndrv_seq_addr { +struct snd_seq_addr { unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ }; /** port connection */ -struct sndrv_seq_connect { - struct sndrv_seq_addr sender; - struct sndrv_seq_addr dest; +struct snd_seq_connect { + struct snd_seq_addr sender; + struct snd_seq_addr dest; }; @@ -227,7 +226,7 @@ struct sndrv_seq_connect { /* note event */ -struct sndrv_seq_ev_note { +struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; @@ -236,7 +235,7 @@ struct sndrv_seq_ev_note { }; /* controller event */ -struct sndrv_seq_ev_ctrl { +struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused1, unused2, unused3; /* pad */ unsigned int param; @@ -244,59 +243,59 @@ struct sndrv_seq_ev_ctrl { }; /* generic set of bytes (12x8 bit) */ -struct sndrv_seq_ev_raw8 { +struct snd_seq_ev_raw8 { unsigned char d[12]; /* 8 bit value */ }; /* generic set of integers (3x32 bit) */ -struct sndrv_seq_ev_raw32 { +struct snd_seq_ev_raw32 { unsigned int d[3]; /* 32 bit value */ }; /* external stored data */ -struct sndrv_seq_ev_ext { +struct snd_seq_ev_ext { unsigned int len; /* length of data */ void *ptr; /* pointer to data (note: maybe 64-bit) */ } __attribute__((packed)); /* Instrument cluster type */ -typedef unsigned int sndrv_seq_instr_cluster_t; +typedef unsigned int snd_seq_instr_cluster_t; /* Instrument type */ -struct sndrv_seq_instr { - sndrv_seq_instr_cluster_t cluster; +struct snd_seq_instr { + snd_seq_instr_cluster_t cluster; unsigned int std; /* the upper byte means a private instrument (owner - client #) */ unsigned short bank; unsigned short prg; }; /* sample number */ -struct sndrv_seq_ev_sample { +struct snd_seq_ev_sample { unsigned int std; unsigned short bank; unsigned short prg; }; /* sample cluster */ -struct sndrv_seq_ev_cluster { - sndrv_seq_instr_cluster_t cluster; +struct snd_seq_ev_cluster { + snd_seq_instr_cluster_t cluster; }; /* sample position */ -typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ +typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */ /* sample stop mode */ -enum sndrv_seq_stop_mode { +enum { SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ }; /* sample frequency */ -typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ +typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */ /* sample volume control; if any value is set to -1 == do not change */ -struct sndrv_seq_ev_volume { +struct snd_seq_ev_volume { signed short volume; /* range: 0-16383 */ signed short lr; /* left-right balance; range: 0-16383 */ signed short fr; /* front-rear balance; range: 0-16383 */ @@ -304,22 +303,22 @@ struct sndrv_seq_ev_volume { }; /* simple loop redefinition */ -struct sndrv_seq_ev_loop { +struct snd_seq_ev_loop { unsigned int start; /* loop start (in samples) * 16 */ unsigned int end; /* loop end (in samples) * 16 */ }; -struct sndrv_seq_ev_sample_control { +struct snd_seq_ev_sample_control { unsigned char channel; unsigned char unused1, unused2, unused3; /* pad */ union { - struct sndrv_seq_ev_sample sample; - struct sndrv_seq_ev_cluster cluster; - sndrv_seq_position_t position; - enum sndrv_seq_stop_mode stop_mode; - sndrv_seq_frequency_t frequency; - struct sndrv_seq_ev_volume volume; - struct sndrv_seq_ev_loop loop; + struct snd_seq_ev_sample sample; + struct snd_seq_ev_cluster cluster; + snd_seq_position_t position; + int stop_mode; + snd_seq_frequency_t frequency; + struct snd_seq_ev_volume volume; + struct snd_seq_ev_loop loop; unsigned char raw8[8]; } param; }; @@ -327,82 +326,82 @@ struct sndrv_seq_ev_sample_control { /* INSTR_BEGIN event */ -struct sndrv_seq_ev_instr_begin { +struct snd_seq_ev_instr_begin { int timeout; /* zero = forever, otherwise timeout in ms */ }; -struct sndrv_seq_result { +struct snd_seq_result { int event; /* processed event type */ int result; }; -struct sndrv_seq_real_time { +struct snd_seq_real_time { unsigned int tv_sec; /* seconds */ unsigned int tv_nsec; /* nanoseconds */ }; -typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ +typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ -union sndrv_seq_timestamp { - sndrv_seq_tick_time_t tick; - struct sndrv_seq_real_time time; +union snd_seq_timestamp { + snd_seq_tick_time_t tick; + struct snd_seq_real_time time; }; -struct sndrv_seq_queue_skew { +struct snd_seq_queue_skew { unsigned int value; unsigned int base; }; /* queue timer control */ -struct sndrv_seq_ev_queue_control { +struct snd_seq_ev_queue_control { unsigned char queue; /* affected queue */ unsigned char pad[3]; /* reserved */ union { signed int value; /* affected value (e.g. tempo) */ - union sndrv_seq_timestamp time; /* time */ + union snd_seq_timestamp time; /* time */ unsigned int position; /* sync position */ - struct sndrv_seq_queue_skew skew; + struct snd_seq_queue_skew skew; unsigned int d32[2]; unsigned char d8[8]; } param; }; /* quoted event - inside the kernel only */ -struct sndrv_seq_ev_quote { - struct sndrv_seq_addr origin; /* original sender */ +struct snd_seq_ev_quote { + struct snd_seq_addr origin; /* original sender */ unsigned short value; /* optional data */ - struct sndrv_seq_event *event; /* quoted event */ + struct snd_seq_event *event; /* quoted event */ } __attribute__((packed)); /* sequencer event */ -struct sndrv_seq_event { - sndrv_seq_event_type_t type; /* event type */ +struct snd_seq_event { + snd_seq_event_type_t type; /* event type */ unsigned char flags; /* event flags */ char tag; unsigned char queue; /* schedule queue */ - union sndrv_seq_timestamp time; /* schedule time */ + union snd_seq_timestamp time; /* schedule time */ - struct sndrv_seq_addr source; /* source address */ - struct sndrv_seq_addr dest; /* destination address */ + struct snd_seq_addr source; /* source address */ + struct snd_seq_addr dest; /* destination address */ union { /* event data... */ - struct sndrv_seq_ev_note note; - struct sndrv_seq_ev_ctrl control; - struct sndrv_seq_ev_raw8 raw8; - struct sndrv_seq_ev_raw32 raw32; - struct sndrv_seq_ev_ext ext; - struct sndrv_seq_ev_queue_control queue; - union sndrv_seq_timestamp time; - struct sndrv_seq_addr addr; - struct sndrv_seq_connect connect; - struct sndrv_seq_result result; - struct sndrv_seq_ev_instr_begin instr_begin; - struct sndrv_seq_ev_sample_control sample; - struct sndrv_seq_ev_quote quote; + struct snd_seq_ev_note note; + struct snd_seq_ev_ctrl control; + struct snd_seq_ev_raw8 raw8; + struct snd_seq_ev_raw32 raw32; + struct snd_seq_ev_ext ext; + struct snd_seq_ev_queue_control queue; + union snd_seq_timestamp time; + struct snd_seq_addr addr; + struct snd_seq_connect connect; + struct snd_seq_result result; + struct snd_seq_ev_instr_begin instr_begin; + struct snd_seq_ev_sample_control sample; + struct snd_seq_ev_quote quote; } data; }; @@ -410,72 +409,77 @@ struct sndrv_seq_event { /* * bounce event - stored as variable size data */ -struct sndrv_seq_event_bounce { +struct snd_seq_event_bounce { int err; - struct sndrv_seq_event event; + struct snd_seq_event event; /* external data follows here. */ }; -#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) +#ifdef __KERNEL__ + +/* helper macro */ +#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce))) /* * type check macros */ /* result events: 0-4 */ -#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) +#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5) /* channel specific events: 5-19 */ -#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) +#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) /* note events: 5-9 */ -#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) +#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) /* control events: 10-19 */ -#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) +#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) /* queue control events: 30-39 */ -#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) +#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) /* system status messages */ -#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) +#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) /* sample messages */ -#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) +#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) /* user-defined messages */ -#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) +#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) /* fixed length events: 0-99 */ -#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) +#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100) /* instrument layer events: 100-129 */ -#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) +#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) /* variable length events: 130-139 */ -#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) +#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) /* reserved for kernel */ -#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) +#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150) /* direct dispatched events */ -#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) +#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) /* * macros to check event flags */ /* prior events */ -#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) +#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) /* event length type */ -#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) -#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) -#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) -#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) +#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) +#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) +#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) +#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) /* time-stamp type */ -#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) -#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) -#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) +#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) +#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) +#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) /* time-mode type */ -#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) -#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) -#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) +#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) +#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) +#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) /* queue sync port */ -#define sndrv_seq_queue_sync_port(q) ((q) + 16) +#define snd_seq_queue_sync_port(q) ((q) + 16) + +#endif /* __KERNEL__ */ /* system information */ -struct sndrv_seq_system_info { +struct snd_seq_system_info { int queues; /* maximum queues count */ int clients; /* maximum clients count */ int ports; /* maximum ports per client */ @@ -487,7 +491,7 @@ struct sndrv_seq_system_info { /* system running information */ -struct sndrv_seq_running_info { +struct snd_seq_running_info { unsigned char client; /* client id */ unsigned char big_endian; /* 1 = big-endian */ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ @@ -498,16 +502,16 @@ struct sndrv_seq_running_info { /* known client numbers */ #define SNDRV_SEQ_CLIENT_SYSTEM 0 -#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */ -#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */ + /* internal client numbers */ +#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ +#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ /* client types */ -enum sndrv_seq_client_type { - NO_CLIENT = 0, - USER_CLIENT = 1, - KERNEL_CLIENT = 2 -}; +typedef int __bitwise snd_seq_client_type_t; +#define NO_CLIENT ((__force snd_seq_client_type_t) 0) +#define USER_CLIENT ((__force snd_seq_client_type_t) 1) +#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) /* event filter flags */ #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ @@ -515,9 +519,9 @@ enum sndrv_seq_client_type { #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ -struct sndrv_seq_client_info { +struct snd_seq_client_info { int client; /* client number to inquire */ - enum sndrv_seq_client_type type; /* client type */ + snd_seq_client_type_t type; /* client type */ char name[64]; /* client name */ unsigned int filter; /* filter flags */ unsigned char multicast_filter[8]; /* multicast filter bitmap */ @@ -529,7 +533,7 @@ struct sndrv_seq_client_info { /* client pool size */ -struct sndrv_seq_client_pool { +struct snd_seq_client_pool { int client; /* client number to inquire */ int output_pool; /* outgoing (write) pool size */ int input_pool; /* incoming (read) pool size */ @@ -553,13 +557,13 @@ struct sndrv_seq_client_pool { #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ -struct sndrv_seq_remove_events { +struct snd_seq_remove_events { unsigned int remove_mode; /* Flags that determine what gets removed */ - union sndrv_seq_timestamp time; + union snd_seq_timestamp time; unsigned char queue; /* Queue for REMOVE_DEST */ - struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ + struct snd_seq_addr dest; /* Address for REMOVE_DEST */ unsigned char channel; /* Channel for REMOVE_DEST */ int type; /* For REMOVE_EVENT_TYPE */ @@ -608,8 +612,8 @@ struct sndrv_seq_remove_events { #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) -struct sndrv_seq_port_info { - struct sndrv_seq_addr addr; /* client/port numbers */ +struct snd_seq_port_info { + struct snd_seq_addr addr; /* client/port numbers */ char name[64]; /* port name */ unsigned int capability; /* port capability bits */ @@ -632,7 +636,7 @@ struct sndrv_seq_port_info { #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ /* queue information */ -struct sndrv_seq_queue_info { +struct snd_seq_queue_info { int queue; /* queue id */ /* @@ -648,11 +652,11 @@ struct sndrv_seq_queue_info { }; /* queue info/status */ -struct sndrv_seq_queue_status { +struct snd_seq_queue_status { int queue; /* queue id */ int events; /* read-only - queue size */ - sndrv_seq_tick_time_t tick; /* current tick */ - struct sndrv_seq_real_time time; /* current time */ + snd_seq_tick_time_t tick; /* current tick */ + struct snd_seq_real_time time; /* current time */ int running; /* running state of queue */ int flags; /* various flags */ char reserved[64]; /* for the future */ @@ -660,7 +664,7 @@ struct sndrv_seq_queue_status { /* queue tempo */ -struct sndrv_seq_queue_tempo { +struct snd_seq_queue_tempo { int queue; /* sequencer queue */ unsigned int tempo; /* current tempo, us/tick */ int ppq; /* time resolution, ticks/quarter */ @@ -676,12 +680,12 @@ struct sndrv_seq_queue_tempo { #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ /* queue timer info */ -struct sndrv_seq_queue_timer { +struct snd_seq_queue_timer { int queue; /* sequencer queue */ int type; /* source timer type */ union { struct { - struct sndrv_timer_id id; /* ALSA's timer ID */ + struct snd_timer_id id; /* ALSA's timer ID */ unsigned int resolution; /* resolution in Hz */ } alsa; } u; @@ -689,7 +693,7 @@ struct sndrv_seq_queue_timer { }; -struct sndrv_seq_queue_client { +struct snd_seq_queue_client { int queue; /* sequencer queue */ int client; /* sequencer client */ int used; /* queue is used with this client @@ -703,9 +707,9 @@ struct sndrv_seq_queue_client { #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) -struct sndrv_seq_port_subscribe { - struct sndrv_seq_addr sender; /* sender address */ - struct sndrv_seq_addr dest; /* destination address */ +struct snd_seq_port_subscribe { + struct snd_seq_addr sender; /* sender address */ + struct snd_seq_addr dest; /* destination address */ unsigned int voices; /* number of voices to be allocated (0 = don't care) */ unsigned int flags; /* modes */ unsigned char queue; /* input time-stamp queue (optional) */ @@ -717,12 +721,12 @@ struct sndrv_seq_port_subscribe { #define SNDRV_SEQ_QUERY_SUBS_READ 0 #define SNDRV_SEQ_QUERY_SUBS_WRITE 1 -struct sndrv_seq_query_subs { - struct sndrv_seq_addr root; /* client/port id to be searched */ +struct snd_seq_query_subs { + struct snd_seq_addr root; /* client/port id to be searched */ int type; /* READ or WRITE */ int index; /* 0..N-1 */ int num_subs; /* R/O: number of subscriptions on this port */ - struct sndrv_seq_addr addr; /* R/O: result */ + struct snd_seq_addr addr; /* R/O: result */ unsigned char queue; /* R/O: result */ unsigned int flags; /* R/O: result */ char reserved[64]; /* for future use */ @@ -779,72 +783,72 @@ struct sndrv_seq_query_subs { #define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 /* size of ROM/RAM */ -typedef unsigned int sndrv_seq_instr_size_t; +typedef unsigned int snd_seq_instr_size_t; /* INSTR_INFO */ -struct sndrv_seq_instr_info { +struct snd_seq_instr_info { int result; /* operation result */ unsigned int formats[8]; /* bitmap of supported formats */ int ram_count; /* count of RAM banks */ - sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ + snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ int rom_count; /* count of ROM banks */ - sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ + snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ char reserved[128]; }; /* INSTR_STATUS */ -struct sndrv_seq_instr_status { +struct snd_seq_instr_status { int result; /* operation result */ - sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ + snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */ int instrument_count; /* count of downloaded instruments */ char reserved[128]; }; /* INSTR_FORMAT_INFO */ -struct sndrv_seq_instr_format_info { +struct snd_seq_instr_format_info { char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ unsigned int len; /* max data length (without this structure) */ }; -struct sndrv_seq_instr_format_info_result { +struct snd_seq_instr_format_info_result { int result; /* operation result */ char format[16]; /* format identifier */ unsigned int len; /* filled data length (without this structure) */ }; /* instrument data */ -struct sndrv_seq_instr_data { +struct snd_seq_instr_data { char name[32]; /* instrument name */ char reserved[16]; /* for the future use */ int type; /* instrument type */ union { char format[16]; /* format identifier */ - struct sndrv_seq_instr alias; + struct snd_seq_instr alias; } data; }; /* INSTR_PUT/GET, data are stored in one block (extended), header + data */ -struct sndrv_seq_instr_header { +struct snd_seq_instr_header { union { - struct sndrv_seq_instr instr; - sndrv_seq_instr_cluster_t cluster; + struct snd_seq_instr instr; + snd_seq_instr_cluster_t cluster; } id; /* instrument identifier */ unsigned int cmd; /* get/put/free command */ unsigned int flags; /* query flags (only for get) */ unsigned int len; /* real instrument data length (without header) */ int result; /* operation result */ char reserved[16]; /* for the future */ - struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ + struct snd_seq_instr_data data; /* instrument data (for put/get result) */ }; /* INSTR_CLUSTER_SET */ -struct sndrv_seq_instr_cluster_set { - sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ +struct snd_seq_instr_cluster_set { + snd_seq_instr_cluster_t cluster; /* cluster identifier */ char name[32]; /* cluster name */ int priority; /* cluster priority */ char reserved[64]; /* for the future use */ @@ -852,8 +856,8 @@ struct sndrv_seq_instr_cluster_set { /* INSTR_CLUSTER_GET */ -struct sndrv_seq_instr_cluster_get { - sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ +struct snd_seq_instr_cluster_get { + snd_seq_instr_cluster_t cluster; /* cluster identifier */ char name[32]; /* cluster name */ int priority; /* cluster priority */ char reserved[64]; /* for the future use */ @@ -865,44 +869,44 @@ struct sndrv_seq_instr_cluster_get { #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) -#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) -#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) - -#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) -#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) - -#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) -#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) -#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) -#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) - -#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) -#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) - -#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) -#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) -#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) -#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) -#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) -#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) -#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) -#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) +#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) +#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) + +#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) +#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) + +#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) + +#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) +#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) + +#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) /* XXX -#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync) */ -#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) -#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) -#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) -#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) -#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) -#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) -#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) -#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) -#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) +#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) +#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) +#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) +#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) +#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) +#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) +#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) #endif /* __SOUND_ASEQUENCER_H */ diff --git a/include/sound/asound.h b/include/sound/asound.h index 8e552d627fa5..9cc021c7ee11 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -23,12 +23,8 @@ #ifndef __SOUND_ASOUND_H #define __SOUND_ASOUND_H -#if defined(LINUX) || defined(__LINUX__) || defined(__linux__) - -#include <linux/ioctl.h> - #ifdef __KERNEL__ - +#include <linux/ioctl.h> #include <linux/types.h> #include <linux/time.h> #include <asm/byteorder.h> @@ -43,25 +39,7 @@ #endif #endif -#else /* !__KERNEL__ */ - -#include <endian.h> -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define SNDRV_LITTLE_ENDIAN -#elif __BYTE_ORDER == __BIG_ENDIAN -#define SNDRV_BIG_ENDIAN -#else -#error "Unsupported endian..." -#endif - -#endif /* __KERNEL **/ - -#endif /* LINUX */ - -#ifndef __KERNEL__ -#include <sys/time.h> -#include <sys/types.h> -#endif +#endif /* __KERNEL__ **/ /* * protocol version @@ -82,7 +60,7 @@ * * ****************************************************************************/ -struct sndrv_aes_iec958 { +struct snd_aes_iec958 { unsigned char status[24]; /* AES/IEC958 channel status bits */ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ unsigned char pad; /* nothing */ @@ -97,7 +75,7 @@ struct sndrv_aes_iec958 { #define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) -enum sndrv_hwdep_iface { +enum { SNDRV_HWDEP_IFACE_OPL2 = 0, SNDRV_HWDEP_IFACE_OPL3, SNDRV_HWDEP_IFACE_OPL4, @@ -119,17 +97,17 @@ enum sndrv_hwdep_iface { SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC }; -struct sndrv_hwdep_info { +struct snd_hwdep_info { unsigned int device; /* WR: device number */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* hwdep name */ - enum sndrv_hwdep_iface iface; /* hwdep interface */ + int iface; /* hwdep interface */ unsigned char reserved[64]; /* reserved for future */ }; /* generic DSP loader */ -struct sndrv_hwdep_dsp_status { +struct snd_hwdep_dsp_status { unsigned int version; /* R: driver-specific version */ unsigned char id[32]; /* R: driver-specific ID string */ unsigned int num_dsps; /* R: number of DSP images to transfer */ @@ -138,7 +116,7 @@ struct sndrv_hwdep_dsp_status { unsigned char reserved[16]; /* reserved for future use */ }; -struct sndrv_hwdep_dsp_image { +struct snd_hwdep_dsp_image { unsigned int index; /* W: DSP index */ unsigned char name[64]; /* W: ID (e.g. file name) */ unsigned char __user *image; /* W: binary image */ @@ -148,9 +126,9 @@ struct sndrv_hwdep_dsp_image { enum { SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), - SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), - SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), - SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) + SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info), + SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status), + SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image) }; /***************************************************************************** @@ -161,10 +139,10 @@ enum { #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) -typedef unsigned long sndrv_pcm_uframes_t; -typedef long sndrv_pcm_sframes_t; +typedef unsigned long snd_pcm_uframes_t; +typedef signed long snd_pcm_sframes_t; -enum sndrv_pcm_class { +enum { SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ SNDRV_PCM_CLASS_MULTI, /* multichannel device */ SNDRV_PCM_CLASS_MODEM, /* software modem class */ @@ -173,97 +151,94 @@ enum sndrv_pcm_class { SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, }; -enum sndrv_pcm_subclass { +enum { SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ /* Don't forget to change the following: */ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, }; -enum sndrv_pcm_stream { +enum { SNDRV_PCM_STREAM_PLAYBACK = 0, SNDRV_PCM_STREAM_CAPTURE, SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, }; -enum sndrv_pcm_access { - SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */ - SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */ - SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */ - SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */ - SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */ - SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, -}; - -enum sndrv_pcm_format { - SNDRV_PCM_FORMAT_S8 = 0, - SNDRV_PCM_FORMAT_U8, - SNDRV_PCM_FORMAT_S16_LE, - SNDRV_PCM_FORMAT_S16_BE, - SNDRV_PCM_FORMAT_U16_LE, - SNDRV_PCM_FORMAT_U16_BE, - SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */ - SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */ - SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */ - SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */ - SNDRV_PCM_FORMAT_S32_LE, - SNDRV_PCM_FORMAT_S32_BE, - SNDRV_PCM_FORMAT_U32_LE, - SNDRV_PCM_FORMAT_U32_BE, - SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ - SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ - SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ - SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ - SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */ - SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */ - SNDRV_PCM_FORMAT_MU_LAW, - SNDRV_PCM_FORMAT_A_LAW, - SNDRV_PCM_FORMAT_IMA_ADPCM, - SNDRV_PCM_FORMAT_MPEG, - SNDRV_PCM_FORMAT_GSM, - SNDRV_PCM_FORMAT_SPECIAL = 31, - SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ - SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ - SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ - SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ - SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ - SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ - SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ - SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE, +typedef int __bitwise snd_pcm_access_t; +#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ +#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ +#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ +#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ +#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ +#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED + +typedef int __bitwise snd_pcm_format_t; +#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) +#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) +#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) +#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) +#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) +#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) +#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ +#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ +#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ +#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ +#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) +#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) +#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) +#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) +#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ +#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) +#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) +#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) +#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) +#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) +#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) +#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ +#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE #ifdef SNDRV_LITTLE_ENDIAN - SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, - SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE, - SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE, - SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE, - SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE, - SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE, - SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE, - SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE, - SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, +#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE +#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE +#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE +#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE +#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE +#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE +#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE +#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE #endif #ifdef SNDRV_BIG_ENDIAN - SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE, - SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE, - SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE, - SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE, - SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE, - SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE, - SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE, - SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE, - SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, +#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE +#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE +#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE +#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE +#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE +#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE +#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE +#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE #endif -}; -enum sndrv_pcm_subformat { - SNDRV_PCM_SUBFORMAT_STD = 0, - SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD, -}; +typedef int __bitwise snd_pcm_subformat_t; +#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) +#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD #define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ #define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ @@ -280,18 +255,17 @@ enum sndrv_pcm_subformat { #define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ #define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ -enum sndrv_pcm_state { - SNDRV_PCM_STATE_OPEN = 0, /* stream is open */ - SNDRV_PCM_STATE_SETUP, /* stream has a setup */ - SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */ - SNDRV_PCM_STATE_RUNNING, /* stream is running */ - SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */ - SNDRV_PCM_STATE_DRAINING, /* stream is draining */ - SNDRV_PCM_STATE_PAUSED, /* stream is paused */ - SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */ - SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */ - SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED, -}; +typedef int __bitwise snd_pcm_state_t; +#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ +#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ +#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ +#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ +#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ +#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ +#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ +#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ +#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ +#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED enum { SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, @@ -299,55 +273,53 @@ enum { SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, }; -union sndrv_pcm_sync_id { +union snd_pcm_sync_id { unsigned char id[16]; unsigned short id16[8]; unsigned int id32[4]; }; -struct sndrv_pcm_info { +struct snd_pcm_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ - enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */ + int stream; /* RO/WR (control): stream direction */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* name of this device */ unsigned char subname[32]; /* subdevice name */ - enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */ - enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ + int dev_class; /* SNDRV_PCM_CLASS_* */ + int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ unsigned int subdevices_count; unsigned int subdevices_avail; - union sndrv_pcm_sync_id sync; /* hardware synchronization ID */ + union snd_pcm_sync_id sync; /* hardware synchronization ID */ unsigned char reserved[64]; /* reserved for future... */ }; -enum sndrv_pcm_hw_param { - SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */ - SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS, - SNDRV_PCM_HW_PARAM_FORMAT, /* Format */ - SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ - SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, - - SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, - SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ - SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ - SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */ - SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts - in us */ - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */ - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */ - SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */ - SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */ - SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ - SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ - SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ - SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME -}; +typedef int __bitwise snd_pcm_hw_param_t; +#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */ +#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */ +#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */ +#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS +#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT + +#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */ +#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */ +#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */ +#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */ +#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */ +#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */ +#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */ +#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */ +#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */ +#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */ +#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */ +#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */ +#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS +#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ -struct sndrv_interval { +struct snd_interval { unsigned int min, max; unsigned int openmin:1, openmax:1, @@ -357,137 +329,137 @@ struct sndrv_interval { #define SNDRV_MASK_MAX 256 -struct sndrv_mask { +struct snd_mask { u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; }; -struct sndrv_pcm_hw_params { +struct snd_pcm_hw_params { unsigned int flags; - struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; - struct sndrv_mask mres[5]; /* reserved masks */ - struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - + struct snd_mask mres[5]; /* reserved masks */ + struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; - struct sndrv_interval ires[9]; /* reserved intervals */ + struct snd_interval ires[9]; /* reserved intervals */ unsigned int rmask; /* W: requested masks */ unsigned int cmask; /* R: changed masks */ unsigned int info; /* R: Info flags for returned setup */ unsigned int msbits; /* R: used most significant bits */ unsigned int rate_num; /* R: rate numerator */ unsigned int rate_den; /* R: rate denominator */ - sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ + snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ unsigned char reserved[64]; /* reserved for future */ }; -enum sndrv_pcm_tstamp { +enum { SNDRV_PCM_TSTAMP_NONE = 0, SNDRV_PCM_TSTAMP_MMAP, SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, }; -struct sndrv_pcm_sw_params { - enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */ +struct snd_pcm_sw_params { + int tstamp_mode; /* timestamp mode */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ - sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */ - sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ - sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ - sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ - sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ - sndrv_pcm_uframes_t silence_size; /* silence block size */ - sndrv_pcm_uframes_t boundary; /* pointers wrap point */ + snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ + snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ + snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ + snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ + snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ + snd_pcm_uframes_t silence_size; /* silence block size */ + snd_pcm_uframes_t boundary; /* pointers wrap point */ unsigned char reserved[64]; /* reserved for future */ }; -struct sndrv_pcm_channel_info { +struct snd_pcm_channel_info { unsigned int channel; off_t offset; /* mmap offset */ unsigned int first; /* offset to first sample in bits */ unsigned int step; /* samples distance in bits */ }; -struct sndrv_pcm_status { - enum sndrv_pcm_state state; /* stream state */ +struct snd_pcm_status { + snd_pcm_state_t state; /* stream state */ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ struct timespec tstamp; /* reference timestamp */ - sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ - sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ - sndrv_pcm_sframes_t delay; /* current delay in frames */ - sndrv_pcm_uframes_t avail; /* number of frames available */ - sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */ - sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ - enum sndrv_pcm_state suspended_state; /* suspended stream state */ + snd_pcm_uframes_t appl_ptr; /* appl ptr */ + snd_pcm_uframes_t hw_ptr; /* hw ptr */ + snd_pcm_sframes_t delay; /* current delay in frames */ + snd_pcm_uframes_t avail; /* number of frames available */ + snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ + snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ + snd_pcm_state_t suspended_state; /* suspended stream state */ unsigned char reserved[60]; /* must be filled with zero */ }; -struct sndrv_pcm_mmap_status { - enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */ +struct snd_pcm_mmap_status { + snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ int pad1; /* Needed for 64 bit alignment */ - sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ + snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ struct timespec tstamp; /* Timestamp */ - enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */ + snd_pcm_state_t suspended_state; /* RO: suspended stream state */ }; -struct sndrv_pcm_mmap_control { - sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ - sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ +struct snd_pcm_mmap_control { + snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ + snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ }; #define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ -struct sndrv_pcm_sync_ptr { +struct snd_pcm_sync_ptr { unsigned int flags; union { - struct sndrv_pcm_mmap_status status; + struct snd_pcm_mmap_status status; unsigned char reserved[64]; } s; union { - struct sndrv_pcm_mmap_control control; + struct snd_pcm_mmap_control control; unsigned char reserved[64]; } c; }; -struct sndrv_xferi { - sndrv_pcm_sframes_t result; +struct snd_xferi { + snd_pcm_sframes_t result; void __user *buf; - sndrv_pcm_uframes_t frames; + snd_pcm_uframes_t frames; }; -struct sndrv_xfern { - sndrv_pcm_sframes_t result; +struct snd_xfern { + snd_pcm_sframes_t result; void __user * __user *bufs; - sndrv_pcm_uframes_t frames; + snd_pcm_uframes_t frames; }; enum { SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), - SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), + SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), - SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), - SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), + SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), + SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), - SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), - SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), - SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), + SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params), + SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status), + SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t), SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), - SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr), - SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), + SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr), + SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info), SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), SNDRV_PCM_IOCTL_START = _IO('A', 0x42), SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), - SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), + SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t), SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), - SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), - SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), - SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), - SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), - SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern), + SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t), + SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi), + SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi), + SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern), + SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern), SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61), }; @@ -507,7 +479,7 @@ enum { #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) -enum sndrv_rawmidi_stream { +enum { SNDRV_RAWMIDI_STREAM_OUTPUT = 0, SNDRV_RAWMIDI_STREAM_INPUT, SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, @@ -517,10 +489,10 @@ enum sndrv_rawmidi_stream { #define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 #define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 -struct sndrv_rawmidi_info { +struct snd_rawmidi_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ - enum sndrv_rawmidi_stream stream; /* WR: stream */ + int stream; /* WR: stream */ int card; /* R: card number */ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ unsigned char id[64]; /* ID (user selectable) */ @@ -531,16 +503,16 @@ struct sndrv_rawmidi_info { unsigned char reserved[64]; /* reserved for future use */ }; -struct sndrv_rawmidi_params { - enum sndrv_rawmidi_stream stream; +struct snd_rawmidi_params { + int stream; size_t buffer_size; /* queue size in bytes */ size_t avail_min; /* minimum avail bytes for wakeup */ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ unsigned char reserved[16]; /* reserved for future use */ }; -struct sndrv_rawmidi_status { - enum sndrv_rawmidi_stream stream; +struct snd_rawmidi_status { + int stream; struct timespec tstamp; /* Timestamp */ size_t avail; /* available bytes */ size_t xruns; /* count of overruns since last status (in bytes) */ @@ -549,9 +521,9 @@ struct sndrv_rawmidi_status { enum { SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), - SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info), - SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params), - SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status), + SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info), + SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params), + SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status), SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int), }; @@ -562,7 +534,7 @@ enum { #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) -enum sndrv_timer_class { +enum { SNDRV_TIMER_CLASS_NONE = -1, SNDRV_TIMER_CLASS_SLAVE = 0, SNDRV_TIMER_CLASS_GLOBAL, @@ -572,7 +544,7 @@ enum sndrv_timer_class { }; /* slave timer classes */ -enum sndrv_timer_slave_class { +enum { SNDRV_TIMER_SCLASS_NONE = 0, SNDRV_TIMER_SCLASS_APPLICATION, SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ @@ -588,16 +560,16 @@ enum sndrv_timer_slave_class { /* info flags */ #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ -struct sndrv_timer_id { - enum sndrv_timer_class dev_class; - enum sndrv_timer_slave_class dev_sclass; +struct snd_timer_id { + int dev_class; + int dev_sclass; int card; int device; int subdevice; }; -struct sndrv_timer_ginfo { - struct sndrv_timer_id tid; /* requested timer ID */ +struct snd_timer_ginfo { + struct snd_timer_id tid; /* requested timer ID */ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identification */ @@ -610,27 +582,27 @@ struct sndrv_timer_ginfo { unsigned char reserved[32]; }; -struct sndrv_timer_gparams { - struct sndrv_timer_id tid; /* requested timer ID */ +struct snd_timer_gparams { + struct snd_timer_id tid; /* requested timer ID */ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ unsigned char reserved[32]; }; -struct sndrv_timer_gstatus { - struct sndrv_timer_id tid; /* requested timer ID */ +struct snd_timer_gstatus { + struct snd_timer_id tid; /* requested timer ID */ unsigned long resolution; /* current period resolution in ns */ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ unsigned char reserved[32]; }; -struct sndrv_timer_select { - struct sndrv_timer_id id; /* bind to timer ID */ +struct snd_timer_select { + struct snd_timer_id id; /* bind to timer ID */ unsigned char reserved[32]; /* reserved */ }; -struct sndrv_timer_info { +struct snd_timer_info { unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identificator */ @@ -644,7 +616,7 @@ struct sndrv_timer_info { #define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ -struct sndrv_timer_params { +struct snd_timer_params { unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ unsigned int ticks; /* requested resolution in ticks */ unsigned int queue_size; /* total size of queue (32-1024) */ @@ -653,7 +625,7 @@ struct sndrv_timer_params { unsigned char reserved[60]; /* reserved */ }; -struct sndrv_timer_status { +struct snd_timer_status { struct timespec tstamp; /* Timestamp - last update */ unsigned int resolution; /* current period resolution in ns */ unsigned int lost; /* counter of master tick lost */ @@ -664,15 +636,15 @@ struct sndrv_timer_status { enum { SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), - SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), + SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id), SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), - SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), - SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), - SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), - SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), - SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), - SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), - SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), + SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo), + SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams), + SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus), + SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select), + SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info), + SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params), + SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status), /* The following four ioctls are changed since 1.0.9 due to confliction */ SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), @@ -680,12 +652,12 @@ enum { SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), }; -struct sndrv_timer_read { +struct snd_timer_read { unsigned int resolution; unsigned int ticks; }; -enum sndrv_timer_event { +enum { SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ SNDRV_TIMER_EVENT_TICK, /* val = ticks */ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ @@ -704,8 +676,8 @@ enum sndrv_timer_event { SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, }; -struct sndrv_timer_tread { - enum sndrv_timer_event event; +struct snd_timer_tread { + int event; struct timespec tstamp; unsigned int val; }; @@ -718,7 +690,7 @@ struct sndrv_timer_tread { #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) -struct sndrv_ctl_card_info { +struct snd_ctl_card_info { int card; /* card number */ int pad; /* reserved for future (was type) */ unsigned char id[16]; /* ID of card (user selectable) */ @@ -731,27 +703,25 @@ struct sndrv_ctl_card_info { unsigned char reserved[48]; /* reserved for future */ }; -enum sndrv_ctl_elem_type { - SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */ - SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */ - SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */ - SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */ - SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */ - SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */ - SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */ - SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64, -}; - -enum sndrv_ctl_elem_iface { - SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */ - SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */ - SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */ - SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */ - SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */ - SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */ - SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */ - SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER, -}; +typedef int __bitwise snd_ctl_elem_type_t; +#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ +#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ +#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ +#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ +#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ +#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ +#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ +#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 + +typedef int __bitwise snd_ctl_elem_iface_t; +#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ +#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ +#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ +#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ +#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ +#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ +#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ +#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER #define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) @@ -773,27 +743,27 @@ enum sndrv_ctl_elem_iface { #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ -struct sndrv_ctl_elem_id { +struct snd_ctl_elem_id { unsigned int numid; /* numeric identifier, zero = invalid */ - enum sndrv_ctl_elem_iface iface; /* interface identifier */ + snd_ctl_elem_iface_t iface; /* interface identifier */ unsigned int device; /* device/client number */ unsigned int subdevice; /* subdevice (substream) number */ unsigned char name[44]; /* ASCII name of item */ unsigned int index; /* index of item */ }; -struct sndrv_ctl_elem_list { +struct snd_ctl_elem_list { unsigned int offset; /* W: first element ID to get */ unsigned int space; /* W: count of element IDs to get */ unsigned int used; /* R: count of element IDs set */ unsigned int count; /* R: count of all elements */ - struct sndrv_ctl_elem_id __user *pids; /* R: IDs */ + struct snd_ctl_elem_id __user *pids; /* R: IDs */ unsigned char reserved[50]; }; -struct sndrv_ctl_elem_info { - struct sndrv_ctl_elem_id id; /* W: element ID */ - enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ +struct snd_ctl_elem_info { + struct snd_ctl_elem_id id; /* W: element ID */ + snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ unsigned int count; /* count of values */ pid_t owner; /* owner's PID of this control */ @@ -822,8 +792,8 @@ struct sndrv_ctl_elem_info { unsigned char reserved[64-4*sizeof(unsigned short)]; }; -struct sndrv_ctl_elem_value { - struct sndrv_ctl_elem_id id; /* W: element ID */ +struct snd_ctl_elem_value { + struct snd_ctl_elem_id id; /* W: element ID */ unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ union { union { @@ -842,7 +812,7 @@ struct sndrv_ctl_elem_value { unsigned char data[512]; unsigned char *data_ptr; } bytes; - struct sndrv_aes_iec958 iec958; + struct snd_aes_iec958 iec958; } value; /* RO */ struct timespec tstamp; unsigned char reserved[128-sizeof(struct timespec)]; @@ -850,24 +820,24 @@ struct sndrv_ctl_elem_value { enum { SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), - SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info), - SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list), - SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info), - SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value), - SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value), - SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id), - SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id), + SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), + SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list), + SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info), + SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value), + SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value), + SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id), + SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id), SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), - SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info), - SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info), - SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id), + SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), + SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), + SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), - SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info), + SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), - SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info), + SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info), SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), - SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info), + SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info), SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int), @@ -887,12 +857,12 @@ enum sndrv_ctl_event_type { #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ -struct sndrv_ctl_event { - enum sndrv_ctl_event_type type; /* event type - SNDRV_CTL_EVENT_* */ +struct snd_ctl_event { + int type; /* event type - SNDRV_CTL_EVENT_* */ union { struct { unsigned int mask; - struct sndrv_ctl_elem_id id; + struct snd_ctl_elem_id id; } elem; unsigned char data8[60]; } data; @@ -920,14 +890,14 @@ struct sndrv_ctl_event { * */ -struct sndrv_xferv { +struct snd_xferv { const struct iovec *vector; unsigned long count; }; enum { - SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv), - SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv), + SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv), + SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv), }; #endif /* __SOUND_ASOUND_H */ diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h index b0da677f8f75..956fdc23c595 100644 --- a/include/sound/asound_fm.h +++ b/include/sound/asound_fm.h @@ -29,16 +29,16 @@ #define SNDRV_DM_FM_MODE_OPL2 0x00 #define SNDRV_DM_FM_MODE_OPL3 0x01 -typedef struct snd_dm_fm_info { +struct snd_dm_fm_info { unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ unsigned char rhythm; /* percussion mode flag */ -} snd_dm_fm_info_t; +}; /* * Data structure composing an FM "note" or sound event. */ -typedef struct snd_dm_fm_voice { +struct snd_dm_fm_voice { unsigned char op; /* operator cell (0 or 1) */ unsigned char voice; /* FM voice (0 to 17) */ @@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice { unsigned char left; /* stereo left */ unsigned char right; /* stereo right */ unsigned char waveform; /* 3 bits: waveform shape */ -} snd_dm_fm_voice_t; +}; /* * This describes an FM note by its voice, octave, frequency number (10bit) * and key on/off. */ -typedef struct snd_dm_fm_note { +struct snd_dm_fm_note { unsigned char voice; /* 0-17 voice channel */ unsigned char octave; /* 3 bits: what octave to play */ unsigned int fnum; /* 10 bits: frequency number */ unsigned char key_on; /* set for active, clear for silent */ -} snd_dm_fm_note_t; +}; /* * FM parameters that apply globally to all voices, and thus are not "notes" */ -typedef struct snd_dm_fm_params { +struct snd_dm_fm_params { unsigned char am_depth; /* amplitude modulation depth (1=hi) */ unsigned char vib_depth; /* vibrato depth (1=hi) */ unsigned char kbd_split; /* keyboard split */ @@ -90,17 +90,17 @@ typedef struct snd_dm_fm_params { unsigned char tomtom; unsigned char cymbal; unsigned char hihat; -} snd_dm_fm_params_t; +}; /* * FM mode ioctl settings */ -#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t) +#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) -#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t) -#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t) -#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t) +#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) +#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) +#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) /* for OPL3 only */ #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) diff --git a/include/sound/control.h b/include/sound/control.h index ef7903c7a327..2489b1eb0110 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -24,24 +24,14 @@ #include <sound/asound.h> -typedef struct sndrv_aes_iec958 snd_aes_iec958_t; -typedef struct sndrv_ctl_card_info snd_ctl_card_info_t; -typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t; -typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t; -typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t; -typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t; -typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t; -typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t; -typedef enum sndrv_ctl_event_type snd_ctl_event_type_t; -typedef struct sndrv_ctl_event snd_ctl_event_t; - #define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) -typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo); -typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); -typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); +struct snd_kcontrol; +typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); +typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); +typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); -typedef struct _snd_kcontrol_new { +struct snd_kcontrol_new { snd_ctl_elem_iface_t iface; /* interface identifier */ unsigned int device; /* device/client number */ unsigned int subdevice; /* subdevice (substream) number */ @@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new { snd_kcontrol_get_t *get; snd_kcontrol_put_t *put; unsigned long private_value; -} snd_kcontrol_new_t; +}; -typedef struct _snd_kcontrol_volatile { - snd_ctl_file_t *owner; /* locked */ +struct snd_kcontrol_volatile { + struct snd_ctl_file *owner; /* locked */ pid_t owner_pid; unsigned int access; /* access rights */ -} snd_kcontrol_volatile_t; +}; -struct _snd_kcontrol { +struct snd_kcontrol { struct list_head list; /* list of controls */ - snd_ctl_elem_id_t id; + struct snd_ctl_elem_id id; unsigned int count; /* count of same elements */ snd_kcontrol_info_t *info; snd_kcontrol_get_t *get; snd_kcontrol_put_t *put; unsigned long private_value; void *private_data; - void (*private_free)(snd_kcontrol_t *kcontrol); - snd_kcontrol_volatile_t vd[0]; /* volatile data */ + void (*private_free)(struct snd_kcontrol *kcontrol); + struct snd_kcontrol_volatile vd[0]; /* volatile data */ }; -#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list) +#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list) -typedef struct _snd_kctl_event { +struct snd_kctl_event { struct list_head list; /* list of events */ - snd_ctl_elem_id_t id; + struct snd_ctl_elem_id id; unsigned int mask; -} snd_kctl_event_t; +}; -#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list) +#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list) -struct _snd_ctl_file { +struct snd_ctl_file { struct list_head list; /* list of all control files */ - snd_card_t *card; + struct snd_card *card; pid_t pid; int prefer_pcm_subdevice; int prefer_rawmidi_subdevice; @@ -97,25 +87,25 @@ struct _snd_ctl_file { struct list_head events; /* waiting events for read */ }; -#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list) +#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list) -typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, - snd_ctl_file_t * control, - unsigned int cmd, unsigned long arg); +typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card, + struct snd_ctl_file * control, + unsigned int cmd, unsigned long arg); -void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); +void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id); -snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); -snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); -void snd_ctl_free_one(snd_kcontrol_t * kcontrol); -int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); -int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); -int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id); -int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id); -snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid); -snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id); +struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access); +struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data); +void snd_ctl_free_one(struct snd_kcontrol * kcontrol); +int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); +int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); +int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id); +int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id); +struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid); +struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id); -int snd_ctl_create(snd_card_t *card); +int snd_ctl_create(struct snd_card *card); int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn); @@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn); #define snd_ctl_unregister_ioctl_compat(fcn) #endif -int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control); -int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control); +int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control); +int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control); -static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) +static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) { return id->numid - kctl->id.numid; } -static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) +static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) { return id->index - kctl->id.index; } -static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) +static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) { if (id->numid) { return snd_ctl_get_ioffnum(kctl, id); @@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i } } -static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id, - snd_kcontrol_t *src_kctl, +static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id, + struct snd_kcontrol *src_kctl, unsigned int offset) { *dst_id = src_kctl->id; diff --git a/include/sound/core.h b/include/sound/core.h index 2be65ad2fd83..90ac6132ea3b 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -28,13 +28,6 @@ #include <linux/workqueue.h> /* struct workqueue_struct */ #include <linux/pm.h> /* pm_message_t */ -/* Typedef's */ -typedef struct sndrv_interval snd_interval_t; -typedef enum sndrv_card_type snd_card_type; -typedef struct sndrv_xferi snd_xferi_t; -typedef struct sndrv_xfern snd_xfern_t; -typedef struct sndrv_xferv snd_xferv_t; - /* forward declarations */ #ifdef CONFIG_PCI struct pci_dev; @@ -47,76 +40,50 @@ struct sbus_dev; #define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 -typedef enum { - SNDRV_DEV_TOPLEVEL = (0*SNDRV_DEV_TYPE_RANGE_SIZE), - SNDRV_DEV_CONTROL, - SNDRV_DEV_LOWLEVEL_PRE, - SNDRV_DEV_LOWLEVEL_NORMAL = (1*SNDRV_DEV_TYPE_RANGE_SIZE), - SNDRV_DEV_PCM, - SNDRV_DEV_RAWMIDI, - SNDRV_DEV_TIMER, - SNDRV_DEV_SEQUENCER, - SNDRV_DEV_HWDEP, - SNDRV_DEV_INFO, - SNDRV_DEV_BUS, - SNDRV_DEV_CODEC, - SNDRV_DEV_LOWLEVEL = (2*SNDRV_DEV_TYPE_RANGE_SIZE) -} snd_device_type_t; - -typedef enum { - SNDRV_DEV_BUILD, - SNDRV_DEV_REGISTERED, - SNDRV_DEV_DISCONNECTED -} snd_device_state_t; - -typedef enum { - SNDRV_DEV_CMD_PRE = 0, - SNDRV_DEV_CMD_NORMAL = 1, - SNDRV_DEV_CMD_POST = 2 -} snd_device_cmd_t; - -typedef struct _snd_card snd_card_t; -typedef struct _snd_device snd_device_t; - -typedef int (snd_dev_free_t)(snd_device_t *device); -typedef int (snd_dev_register_t)(snd_device_t *device); -typedef int (snd_dev_disconnect_t)(snd_device_t *device); -typedef int (snd_dev_unregister_t)(snd_device_t *device); - -typedef struct { - snd_dev_free_t *dev_free; - snd_dev_register_t *dev_register; - snd_dev_disconnect_t *dev_disconnect; - snd_dev_unregister_t *dev_unregister; -} snd_device_ops_t; - -struct _snd_device { +typedef int __bitwise snd_device_type_t; +#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0) +#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) +#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2) +#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000) +#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001) +#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002) +#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003) +#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004) +#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005) +#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) +#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) +#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) +#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) + +typedef int __bitwise snd_device_state_t; +#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0) +#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1) +#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2) + +typedef int __bitwise snd_device_cmd_t; +#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0) +#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1) +#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2) + +struct snd_device; + +struct snd_device_ops { + int (*dev_free)(struct snd_device *dev); + int (*dev_register)(struct snd_device *dev); + int (*dev_disconnect)(struct snd_device *dev); + int (*dev_unregister)(struct snd_device *dev); +}; + +struct snd_device { struct list_head list; /* list of registered devices */ - snd_card_t *card; /* card which holds this device */ + struct snd_card *card; /* card which holds this device */ snd_device_state_t state; /* state of the device */ snd_device_type_t type; /* device type */ void *device_data; /* device structure */ - snd_device_ops_t *ops; /* operations */ + struct snd_device_ops *ops; /* operations */ }; -#define snd_device(n) list_entry(n, snd_device_t, list) - -/* various typedefs */ - -typedef struct snd_info_entry snd_info_entry_t; -typedef struct _snd_pcm snd_pcm_t; -typedef struct _snd_pcm_str snd_pcm_str_t; -typedef struct _snd_pcm_substream snd_pcm_substream_t; -typedef struct _snd_mixer snd_kmixer_t; -typedef struct _snd_rawmidi snd_rawmidi_t; -typedef struct _snd_ctl_file snd_ctl_file_t; -typedef struct _snd_kcontrol snd_kcontrol_t; -typedef struct _snd_timer snd_timer_t; -typedef struct _snd_timer_instance snd_timer_instance_t; -typedef struct _snd_hwdep snd_hwdep_t; -#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) -typedef struct _snd_oss_mixer snd_mixer_oss_t; -#endif +#define snd_device(n) list_entry(n, struct snd_device, list) /* monitor files for graceful shutdown (hotplug) */ @@ -129,7 +96,7 @@ struct snd_shutdown_f_ops; /* define it later in init.c */ /* main structure for soundcard */ -struct _snd_card { +struct snd_card { int number; /* number of soundcard (index to snd_cards) */ @@ -143,7 +110,7 @@ struct _snd_card { struct module *module; /* top-level module */ void *private_data; /* private data for soundcard */ - void (*private_free) (snd_card_t *card); /* callback for freeing of + void (*private_free) (struct snd_card *card); /* callback for freeing of private data */ struct list_head devices; /* devices */ @@ -155,8 +122,8 @@ struct _snd_card { struct list_head controls; /* all controls for this card */ struct list_head ctl_files; /* active control files */ - snd_info_entry_t *proc_root; /* root for soundcard specific files */ - snd_info_entry_t *proc_id; /* the card id */ + struct snd_info_entry *proc_root; /* root for soundcard specific files */ + struct snd_info_entry *proc_id; /* the card id */ struct proc_dir_entry *proc_root_link; /* number link to real id */ struct snd_monitor_file *files; /* all files associated to this card */ @@ -167,92 +134,64 @@ struct _snd_card { wait_queue_head_t shutdown_sleep; struct work_struct free_workq; /* for free in workqueue */ struct device *dev; -#ifdef CONFIG_SND_GENERIC_DRIVER - struct snd_generic_device *generic_dev; -#endif #ifdef CONFIG_PM - int (*pm_suspend)(snd_card_t *card, pm_message_t state); - int (*pm_resume)(snd_card_t *card); - void *pm_private_data; unsigned int power_state; /* power state */ struct semaphore power_lock; /* power lock */ wait_queue_head_t power_sleep; #endif #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) - snd_mixer_oss_t *mixer_oss; + struct snd_mixer_oss *mixer_oss; int mixer_oss_change_count; #endif }; #ifdef CONFIG_PM -static inline void snd_power_lock(snd_card_t *card) +static inline void snd_power_lock(struct snd_card *card) { down(&card->power_lock); } -static inline void snd_power_unlock(snd_card_t *card) +static inline void snd_power_unlock(struct snd_card *card) { up(&card->power_lock); } -static inline unsigned int snd_power_get_state(snd_card_t *card) +static inline unsigned int snd_power_get_state(struct snd_card *card) { return card->power_state; } -static inline void snd_power_change_state(snd_card_t *card, unsigned int state) +static inline void snd_power_change_state(struct snd_card *card, unsigned int state) { card->power_state = state; wake_up(&card->power_sleep); } /* init.c */ -int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); - -int snd_card_set_pm_callback(snd_card_t *card, - int (*suspend)(snd_card_t *, pm_message_t), - int (*resume)(snd_card_t *), - void *private_data); -int snd_card_set_generic_pm_callback(snd_card_t *card, - int (*suspend)(snd_card_t *, pm_message_t), - int (*resume)(snd_card_t *), - void *private_data); -#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \ - snd_card_set_generic_pm_callback(card, suspend, resume, data) -struct pci_dev; -int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state); -int snd_card_pci_resume(struct pci_dev *dev); -#define SND_PCI_PM_CALLBACKS \ - .suspend = snd_card_pci_suspend, .resume = snd_card_pci_resume +int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file); #else /* ! CONFIG_PM */ #define snd_power_lock(card) do { (void)(card); } while (0) #define snd_power_unlock(card) do { (void)(card); } while (0) -static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; } +static inline int snd_power_wait(struct snd_card *card, unsigned int state, struct file *file) { return 0; } #define snd_power_get_state(card) SNDRV_CTL_POWER_D0 #define snd_power_change_state(card, state) do { (void)(card); } while (0) -#define snd_card_set_pm_callback(card,suspend,resume,data) -#define snd_card_set_generic_pm_callback(card,suspend,resume,data) -#define snd_card_set_isa_pm_callback(card,suspend,resume,data) -#define SND_PCI_PM_CALLBACKS #endif /* CONFIG_PM */ -struct _snd_minor { - struct list_head list; /* list of all minors per card */ - int number; /* minor number */ +struct snd_minor { + int type; /* SNDRV_DEVICE_TYPE_XXX */ + int card; /* card number */ int device; /* device number */ - const char *comment; /* for /proc/asound/devices */ struct file_operations *f_ops; /* file operations */ + void *private_data; /* private data for f_ops->open */ char name[0]; /* device name (keep at the end of structure) */ }; -typedef struct _snd_minor snd_minor_t; - /* sound.c */ extern int snd_major; @@ -260,12 +199,18 @@ extern int snd_ecards_limit; void snd_request_card(int card); -int snd_register_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); -int snd_unregister_device(int type, snd_card_t *card, int dev); +int snd_register_device(int type, struct snd_card *card, int dev, + struct file_operations *f_ops, void *private_data, + const char *name); +int snd_unregister_device(int type, struct snd_card *card, int dev); +void *snd_lookup_minor_data(unsigned int minor, int type); #ifdef CONFIG_SND_OSSEMUL -int snd_register_oss_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); -int snd_unregister_oss_device(int type, snd_card_t *card, int dev); +int snd_register_oss_device(int type, struct snd_card *card, int dev, + struct file_operations *f_ops, void *private_data, + const char *name); +int snd_unregister_oss_device(int type, struct snd_card *card, int dev); +void *snd_lookup_oss_minor_data(unsigned int minor, int type); #endif int snd_minor_info_init(void); @@ -276,11 +221,9 @@ int snd_minor_info_done(void); #ifdef CONFIG_SND_OSSEMUL int snd_minor_info_oss_init(void); int snd_minor_info_oss_done(void); -int snd_oss_init_module(void); #else #define snd_minor_info_oss_init() /*NOP*/ #define snd_minor_info_oss_done() /*NOP*/ -#define snd_oss_init_module() 0 #endif /* memory.c */ @@ -291,43 +234,41 @@ int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size /* init.c */ extern unsigned int snd_cards_lock; -extern snd_card_t *snd_cards[SNDRV_CARDS]; +extern struct snd_card *snd_cards[SNDRV_CARDS]; extern rwlock_t snd_card_rwlock; #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) #define SND_MIXER_OSS_NOTIFY_REGISTER 0 #define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 #define SND_MIXER_OSS_NOTIFY_FREE 2 -extern int (*snd_mixer_oss_notify_callback)(snd_card_t *card, int cmd); +extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); #endif -snd_card_t *snd_card_new(int idx, const char *id, +struct snd_card *snd_card_new(int idx, const char *id, struct module *module, int extra_size); -int snd_card_disconnect(snd_card_t *card); -int snd_card_free(snd_card_t *card); -int snd_card_free_in_thread(snd_card_t *card); -int snd_card_register(snd_card_t *card); +int snd_card_disconnect(struct snd_card *card); +int snd_card_free(struct snd_card *card); +int snd_card_free_in_thread(struct snd_card *card); +int snd_card_register(struct snd_card *card); int snd_card_info_init(void); int snd_card_info_done(void); -int snd_component_add(snd_card_t *card, const char *component); -int snd_card_file_add(snd_card_t *card, struct file *file); -int snd_card_file_remove(snd_card_t *card, struct file *file); +int snd_component_add(struct snd_card *card, const char *component); +int snd_card_file_add(struct snd_card *card, struct file *file); +int snd_card_file_remove(struct snd_card *card, struct file *file); #ifndef snd_card_set_dev #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) #endif -/* register a generic device (for ISA, etc) */ -int snd_card_set_generic_dev(snd_card_t *card); /* device.c */ -int snd_device_new(snd_card_t *card, snd_device_type_t type, - void *device_data, snd_device_ops_t *ops); -int snd_device_register(snd_card_t *card, void *device_data); -int snd_device_register_all(snd_card_t *card); -int snd_device_disconnect(snd_card_t *card, void *device_data); -int snd_device_disconnect_all(snd_card_t *card); -int snd_device_free(snd_card_t *card, void *device_data); -int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd); +int snd_device_new(struct snd_card *card, snd_device_type_t type, + void *device_data, struct snd_device_ops *ops); +int snd_device_register(struct snd_card *card, void *device_data); +int snd_device_register_all(struct snd_card *card); +int snd_device_disconnect(struct snd_card *card, void *device_data); +int snd_device_disconnect_all(struct snd_card *card); +int snd_device_free(struct snd_card *card, void *device_data); +int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd); /* isadma.c */ @@ -443,4 +384,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #endif #endif +#include "typedefs.h" + #endif /* __SOUND_CORE_H */ diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h index d7f90823778a..ac6a5d882088 100644 --- a/include/sound/cs4231.h +++ b/include/sound/cs4231.h @@ -26,21 +26,6 @@ #include "pcm.h" #include "timer.h" -#ifdef CONFIG_SBUS -#define SBUS_SUPPORT -#include <asm/sbus.h> -#endif - -#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) -#define EBUS_SUPPORT -#include <linux/pci.h> -#include <asm/ebus.h> -#endif - -#if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT) -#define LEGACY_SUPPORT -#endif - /* IO ports */ #define CS4231P(x) (c_d_c_CS4231##x) @@ -232,18 +217,14 @@ #define CS4231_HWSHARE_DMA1 (1<<1) #define CS4231_HWSHARE_DMA2 (1<<2) -typedef struct _snd_cs4231 cs4231_t; - -struct _snd_cs4231 { +struct snd_cs4231 { unsigned long port; /* base i/o port */ -#ifdef LEGACY_SUPPORT struct resource *res_port; unsigned long cport; /* control base i/o port (CS4236) */ struct resource *res_cport; int irq; /* IRQ line */ int dma1; /* playback DMA */ int dma2; /* record DMA */ -#endif unsigned short version; /* version of CODEC chip */ unsigned short mode; /* see to CS4231_MODE_XXXX */ unsigned short hardware; /* see to CS4231_HW_XXXX */ @@ -251,29 +232,11 @@ struct _snd_cs4231 { unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ ebus_flag:1; /* SPARC: EBUS present */ -#ifdef EBUS_SUPPORT - struct ebus_dma_info eb2c; - struct ebus_dma_info eb2p; -#endif - -#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT) - union { -#ifdef SBUS_SUPPORT - struct sbus_dev *sdev; -#endif -#ifdef EBUS_SUPPORT - struct pci_dev *pdev; -#endif - } dev_u; - unsigned int p_periods_sent; - unsigned int c_periods_sent; -#endif - - snd_card_t *card; - snd_pcm_t *pcm; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; - snd_timer_t *timer; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; + struct snd_timer *timer; unsigned char image[32]; /* registers image */ unsigned char eimage[32]; /* extended registers image */ @@ -281,63 +244,59 @@ struct _snd_cs4231 { int mce_bit; int calibrate_mute; int sw_3d_bit; -#ifdef LEGACY_SUPPORT unsigned int p_dma_size; unsigned int c_dma_size; -#endif spinlock_t reg_lock; struct semaphore mce_mutex; struct semaphore open_mutex; - int (*rate_constraint) (snd_pcm_runtime_t *runtime); - void (*set_playback_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char pdfr); - void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr); - void (*trigger) (cs4231_t *chip, unsigned int what, int start); + int (*rate_constraint) (struct snd_pcm_runtime *runtime); + void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr); + void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr); + void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start); #ifdef CONFIG_PM - void (*suspend) (cs4231_t *chip); - void (*resume) (cs4231_t *chip); + void (*suspend) (struct snd_cs4231 *chip); + void (*resume) (struct snd_cs4231 *chip); #endif void *dma_private_data; -#ifdef LEGACY_SUPPORT - int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); - int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma); -#endif + int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); + int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); }; /* exported functions */ -void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char val); -unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg); -void snd_cs4236_ext_out(cs4231_t *chip, unsigned char reg, unsigned char val); -unsigned char snd_cs4236_ext_in(cs4231_t *chip, unsigned char reg); -void snd_cs4231_mce_up(cs4231_t *chip); -void snd_cs4231_mce_down(cs4231_t *chip); +void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); +unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg); +void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); +unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg); +void snd_cs4231_mce_up(struct snd_cs4231 *chip); +void snd_cs4231_mce_down(struct snd_cs4231 *chip); irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); -const char *snd_cs4231_chip_id(cs4231_t *chip); +const char *snd_cs4231_chip_id(struct snd_cs4231 *chip); -int snd_cs4231_create(snd_card_t * card, +int snd_cs4231_create(struct snd_card *card, unsigned long port, unsigned long cport, int irq, int dma1, int dma2, unsigned short hardware, unsigned short hwshare, - cs4231_t ** rchip); -int snd_cs4231_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); -int snd_cs4231_timer(cs4231_t * chip, int device, snd_timer_t **rtimer); -int snd_cs4231_mixer(cs4231_t * chip); + struct snd_cs4231 ** rchip); +int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); +int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer); +int snd_cs4231_mixer(struct snd_cs4231 * chip); -int snd_cs4236_create(snd_card_t * card, +int snd_cs4236_create(struct snd_card *card, unsigned long port, unsigned long cport, int irq, int dma1, int dma2, unsigned short hardware, unsigned short hwshare, - cs4231_t ** rchip); -int snd_cs4236_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); -int snd_cs4236_mixer(cs4231_t * chip); + struct snd_cs4231 ** rchip); +int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); +int snd_cs4236_mixer(struct snd_cs4231 * chip); /* * mixer library @@ -349,9 +308,9 @@ int snd_cs4236_mixer(cs4231_t * chip); .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } -int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); -int snd_cs4231_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); -int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); +int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); +int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ @@ -359,8 +318,8 @@ int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucon .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } -int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); -int snd_cs4231_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); -int snd_cs4231_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); +int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); +int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); #endif /* __SOUND_CS4231_H */ diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h index b0c0e192eb56..199b5098ff7e 100644 --- a/include/sound/cs46xx.h +++ b/include/sound/cs46xx.h @@ -1631,42 +1631,41 @@ #define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1 #define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2 -typedef struct _snd_cs46xx cs46xx_t; -typedef struct _snd_cs46xx_pcm_t { +struct snd_cs46xx_pcm { struct snd_dma_buffer hw_buf; unsigned int ctl; unsigned int shift; /* Shift count to trasform frames in bytes */ - snd_pcm_indirect_t pcm_rec; - snd_pcm_substream_t *substream; + struct snd_pcm_indirect pcm_rec; + struct snd_pcm_substream *substream; - pcm_channel_descriptor_t * pcm_channel; + struct dsp_pcm_channel_descriptor * pcm_channel; int pcm_channel_id; /* Fron Rear, Center Lfe ... */ -} cs46xx_pcm_t; +}; -typedef struct { +struct snd_cs46xx_region { char name[24]; unsigned long base; void __iomem *remap_addr; unsigned long size; struct resource *resource; -} snd_cs46xx_region_t; +}; -struct _snd_cs46xx { +struct snd_cs46xx { int irq; unsigned long ba0_addr; unsigned long ba1_addr; union { struct { - snd_cs46xx_region_t ba0; - snd_cs46xx_region_t data0; - snd_cs46xx_region_t data1; - snd_cs46xx_region_t pmem; - snd_cs46xx_region_t reg; + struct snd_cs46xx_region ba0; + struct snd_cs46xx_region data0; + struct snd_cs46xx_region data1; + struct snd_cs46xx_region pmem; + struct snd_cs46xx_region reg; } name; - snd_cs46xx_region_t idx[5]; + struct snd_cs46xx_region idx[5]; } region; unsigned int mode; @@ -1676,34 +1675,34 @@ struct _snd_cs46xx { unsigned int ctl; unsigned int shift; /* Shift count to trasform frames in bytes */ - snd_pcm_indirect_t pcm_rec; - snd_pcm_substream_t *substream; + struct snd_pcm_indirect pcm_rec; + struct snd_pcm_substream *substream; } capt; int nr_ac97_codecs; - ac97_bus_t *ac97_bus; - ac97_t *ac97[MAX_NR_AC97]; + struct snd_ac97_bus *ac97_bus; + struct snd_ac97 *ac97[MAX_NR_AC97]; struct pci_dev *pci; - snd_card_t *card; - snd_pcm_t *pcm; + struct snd_card *card; + struct snd_pcm *pcm; - snd_rawmidi_t *rmidi; - snd_rawmidi_substream_t *midi_input; - snd_rawmidi_substream_t *midi_output; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *midi_input; + struct snd_rawmidi_substream *midi_output; spinlock_t reg_lock; unsigned int midcr; unsigned int uartm; int amplifier; - void (*amplifier_ctrl)(cs46xx_t *, int); - void (*active_ctrl)(cs46xx_t *, int); - void (*mixer_init)(cs46xx_t *); + void (*amplifier_ctrl)(struct snd_cs46xx *, int); + void (*active_ctrl)(struct snd_cs46xx *, int); + void (*mixer_init)(struct snd_cs46xx *); int acpi_port; - snd_kcontrol_t *eapd_switch; /* for amplifier hack */ + struct snd_kcontrol *eapd_switch; /* for amplifier hack */ int accept_valid; /* accept mmap valid (for OSS) */ struct gameport *gameport; @@ -1714,29 +1713,31 @@ struct _snd_cs46xx { #ifdef CONFIG_SND_CS46XX_NEW_DSP struct semaphore spos_mutex; - dsp_spos_instance_t * dsp_spos_instance; + struct dsp_spos_instance * dsp_spos_instance; - snd_pcm_t *pcm_rear; - snd_pcm_t *pcm_center_lfe; - snd_pcm_t *pcm_iec958; + struct snd_pcm *pcm_rear; + struct snd_pcm *pcm_center_lfe; + struct snd_pcm *pcm_iec958; #else /* for compatibility */ - cs46xx_pcm_t *playback_pcm; + struct snd_cs46xx_pcm *playback_pcm; unsigned int play_ctl; #endif }; -int snd_cs46xx_create(snd_card_t *card, +int snd_cs46xx_create(struct snd_card *card, struct pci_dev *pci, int external_amp, int thinkpad, - cs46xx_t **rcodec); - -int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm); -int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm); -int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm); -int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm); -int snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device); -int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); -int snd_cs46xx_start_dsp(cs46xx_t *chip); -int snd_cs46xx_gameport(cs46xx_t *chip); + struct snd_cs46xx **rcodec); +int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state); +int snd_cs46xx_resume(struct pci_dev *pci); + +int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); +int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); +int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); +int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); +int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); +int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi); +int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); +int snd_cs46xx_gameport(struct snd_cs46xx *chip); #endif /* __SOUND_CS46XX_H */ diff --git a/include/sound/cs46xx_dsp_scb_types.h b/include/sound/cs46xx_dsp_scb_types.h index 3f990a3a6903..9cb6c7d09567 100644 --- a/include/sound/cs46xx_dsp_scb_types.h +++ b/include/sound/cs46xx_dsp_scb_types.h @@ -41,7 +41,7 @@ /* This structs are used internally by the SP */ -typedef struct _basic_dma_req_t { +struct dsp_basic_dma_req { /* DMA Requestor Word 0 (DCW) fields: 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0] @@ -53,9 +53,9 @@ typedef struct _basic_dma_req_t { u32 dmw; /* DMA Mode Word */ u32 saw; /* Source Address Word */ u32 daw; /* Destination Address Word */ -} basic_dma_req_t; +}; -typedef struct _scatter_gather_ext_t { +struct dsp_scatter_gather_ext { u32 npaw; /* Next-Page Address Word */ /* DMA Requestor Word 5 (NPCW) fields: @@ -69,9 +69,9 @@ typedef struct _scatter_gather_ext_t { u32 lbaw; /* Loop-Begin Address Word */ u32 nplbaw; /* Next-Page after Loop-Begin Address Word */ u32 sgaw; /* Scatter/Gather Address Word */ -} scatter_gather_ext_t; +}; -typedef struct _volume_control_t { +struct dsp_volume_control { ___DSP_DUAL_16BIT_ALLOC( rightTarg, /* Target volume for left & right channels */ leftTarg @@ -80,10 +80,10 @@ typedef struct _volume_control_t { rightVol, /* Current left & right channel volumes */ leftVol ) -} volume_control_t; +}; /* Generic stream control block (SCB) structure definition */ -typedef struct _generic_scb_t { +struct dsp_generic_scb { /* For streaming I/O, the DSP should never alter any words in the DMA requestor or the scatter/gather extension. Only ad hoc DMA request streams are free to alter the requestor (currently only occur in the @@ -99,13 +99,13 @@ typedef struct _generic_scb_t { /* Initialized by the host, only modified by DMA R/O for the DSP task */ - basic_dma_req_t basic_req; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ /* Scatter/gather DMA requestor extension (5 ints) Initialized by the host, only modified by DMA DSP task never needs to even read these. */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ /* Sublist pointer & next stream control block (SCB) link. Initialized & modified by the host R/O for the DSP task @@ -179,11 +179,11 @@ typedef struct _generic_scb_t { These two 32-bit words are redefined for wavetable & 3-D voices. */ - volume_control_t vol_ctrl_t; /* Optional */ -} generic_scb_t; + struct dsp_volume_control vol_ctrl_t; /* Optional */ +}; -typedef struct _spos_control_block_t { +struct dsp_spos_control_block { /* WARNING: Certain items in this structure are modified by the host Any dword that can be modified by the host, must not be modified by the SP as the host can only do atomic dword @@ -273,10 +273,10 @@ typedef struct _spos_control_block_t { u32 r32_save_for_spurious_int; u32 r32_save_for_trap; u32 r32_save_for_HFG; -} spos_control_block_t; +}; /* SPB for MIX_TO_OSTREAM algorithm family */ -typedef struct _mix2_ostream_spb_t +struct dsp_mix2_ostream_spb { /* 16b.16b integer.frac approximation to the number of 3 sample triplets to output each @@ -290,13 +290,13 @@ typedef struct _mix2_ostream_spb_t output triplets since the start of group */ u32 accumOutTriplets; -} mix2_ostream_spb_t; +}; /* SCB for Timing master algorithm */ -typedef struct _timing_master_scb_t { +struct dsp_timing_master_scb { /* First 12 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -358,13 +358,13 @@ typedef struct _timing_master_scb_t { number of samples to output each frame. (approximation must be floor, to insure */ u32 nsamp_per_frm_q15; -} timing_master_scb_t; +}; /* SCB for CODEC output algorithm */ -typedef struct _codec_output_scb_t { +struct dsp_codec_output_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -422,13 +422,13 @@ typedef struct _codec_output_scb_t { reserved, last_sub_ptr ) -} codec_output_scb_t; +}; /* SCB for CODEC input algorithm */ -typedef struct _codec_input_scb_t { +struct dsp_codec_input_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -479,13 +479,13 @@ typedef struct _codec_input_scb_t { ) u32 reserved2; -} codec_input_scb_t; +}; -typedef struct _pcm_serial_input_scb_t { +struct dsp_pcm_serial_input_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -512,11 +512,11 @@ typedef struct _pcm_serial_input_scb_t { ) /* Initialized by the host (host updates target volumes) */ - volume_control_t psi_vol_ctrl; + struct dsp_volume_control psi_vol_ctrl; -} pcm_serial_input_scb_t; +}; -typedef struct _src_task_scb_t { +struct dsp_src_task_scb { ___DSP_DUAL_16BIT_ALLOC( frames_left_in_gof, gofs_left_in_sec @@ -571,10 +571,10 @@ typedef struct _src_task_scb_t { u32 phiIncr6int_26frac; - volume_control_t src_vol_ctrl; -} src_task_scb_t; + struct dsp_volume_control src_vol_ctrl; +}; -typedef struct _decimate_by_pow2_scb_t { +struct dsp_decimate_by_pow2_scb { /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory when compared to cascading decimators) */ @@ -648,10 +648,10 @@ typedef struct _decimate_by_pow2_scb_t { u32 dec2_reserved4; - volume_control_t dec2_vol_ctrl; /* Not used! */ -} decimate_by_pow2_scb_t; + struct dsp_volume_control dec2_vol_ctrl; /* Not used! */ +}; -typedef struct _vari_decimate_scb_t { +struct dsp_vari_decimate_scb { ___DSP_DUAL_16BIT_ALLOC( vdec_frames_left_in_gof, vdec_gofs_left_in_sec @@ -711,15 +711,15 @@ typedef struct _vari_decimate_scb_t { u32 vdec_phi_incr_6int_26frac; - volume_control_t vdec_vol_ctrl; -} vari_decimate_scb_t; + struct dsp_volume_control vdec_vol_ctrl; +}; /* SCB for MIX_TO_OSTREAM algorithm family */ -typedef struct _mix2_ostream_scb_t { +struct dsp_mix2_ostream_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -758,14 +758,14 @@ typedef struct _mix2_ostream_scb_t { const_FFFF, const_zero ) -} mix2_ostream_scb_t; +}; /* SCB for S16_MIX algorithm */ -typedef struct _mix_only_scb_t { +struct dsp_mix_only_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -780,11 +780,11 @@ typedef struct _mix_only_scb_t { u32 strm_buf_ptr; /* REQUIRED */ u32 reserved; - volume_control_t vol_ctrl; -} mix_only_scb_t; + struct dsp_volume_control vol_ctrl; +}; /* SCB for the async. CODEC input algorithm */ -typedef struct _async_codec_input_scb_t { +struct dsp_async_codec_input_scb { u32 io_free2; u32 io_current_total; @@ -837,11 +837,11 @@ typedef struct _async_codec_input_scb_t { ) u32 i_free; -} async_codec_input_scb_t; +}; /* SCB for the SP/DIF CODEC input and output */ -typedef struct _spdifiscb_t { +struct dsp_spdifiscb { ___DSP_DUAL_16BIT_ALLOC( status_ptr, status_start_ptr @@ -895,12 +895,11 @@ typedef struct _spdifiscb_t { ) u32 free1; -} spdifiscb_t; +}; /* SCB for the SP/DIF CODEC input and output */ -typedef struct _spdifoscb_t { - +struct dsp_spdifoscb { u32 free2; @@ -941,11 +940,10 @@ typedef struct _spdifoscb_t { ) u32 free1; -} spdifoscb_t; - +}; -typedef struct _asynch_fg_rx_scb_t { +struct dsp_asynch_fg_rx_scb { ___DSP_DUAL_16BIT_ALLOC( bot_buf_mask, buf_Mask @@ -993,11 +991,10 @@ typedef struct _asynch_fg_rx_scb_t { right_vol, left_vol ) -} asynch_fg_rx_scb_t; - +}; -typedef struct _asynch_fg_tx_scb_t { +struct dsp_asynch_fg_tx_scb { ___DSP_DUAL_16BIT_ALLOC( not_buf_mask, buf_mask @@ -1052,13 +1049,13 @@ typedef struct _asynch_fg_tx_scb_t { unused_right_vol, unused_left_vol ) -} asynch_fg_tx_scb_t; +}; -typedef struct _output_snoop_scb_t { +struct dsp_output_snoop_scb { /* First 13 dwords from generic_scb_t */ - basic_dma_req_t basic_req; /* Optional */ - scatter_gather_ext_t sg_ext; /* Optional */ + struct dsp_basic_dma_req basic_req; /* Optional */ + struct dsp_scatter_gather_ext sg_ext; /* Optional */ ___DSP_DUAL_16BIT_ALLOC( next_scb, /* REQUIRED */ sub_list_ptr /* REQUIRED */ @@ -1083,9 +1080,9 @@ typedef struct _output_snoop_scb_t { reserved, input_scb ) -} output_snoop_scb_t; +}; -typedef struct _spio_write_scb_t { +struct dsp_spio_write_scb { ___DSP_DUAL_16BIT_ALLOC( address1, address2 @@ -1122,9 +1119,9 @@ typedef struct _spio_write_scb_t { ) u32 unused3[5]; -} spio_write_scb_t; +}; -typedef struct _magic_snoop_task_t { +struct dsp_magic_snoop_task { u32 i0; u32 i1; @@ -1155,11 +1152,11 @@ typedef struct _magic_snoop_task_t { u32 i8; - volume_control_t vdec_vol_ctrl; -} magic_snoop_task_t; + struct dsp_volume_control vdec_vol_ctrl; +}; -typedef struct _filter_scb_t { +struct dsp_filter_scb { ___DSP_DUAL_16BIT_ALLOC( a0_right, /* 0x00 */ a0_left @@ -1212,5 +1209,5 @@ typedef struct _filter_scb_t { b2_right, /* 0x0F */ b2_left ) -} filter_scb_t; +}; #endif /* __DSP_SCB_TYPES_H__ */ diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h index 10014cb62423..da934def31e9 100644 --- a/include/sound/cs46xx_dsp_spos.h +++ b/include/sound/cs46xx_dsp_spos.h @@ -65,133 +65,130 @@ #define DSP_SPDIF_STATUS_HW_ENABLED 4 #define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8 -struct _dsp_module_desc_t; - -typedef struct _symbol_entry_t { +struct dsp_symbol_entry { u32 address; char symbol_name[DSP_MAX_SYMBOL_NAME]; int symbol_type; /* initialized by driver */ - struct _dsp_module_desc_t * module; + struct dsp_module_desc * module; int deleted; -} symbol_entry_t; +}; -typedef struct _symbol_desc_t { +struct dsp_symbol_desc { int nsymbols; - symbol_entry_t * symbols; + struct dsp_symbol_entry *symbols; /* initialized by driver */ int highest_frag_index; -} symbol_desc_t; - +}; -typedef struct _segment_desc_t { +struct dsp_segment_desc { int segment_type; u32 offset; u32 size; u32 * data; -} segment_desc_t; +}; -typedef struct _dsp_module_desc_t { +struct dsp_module_desc { char * module_name; - symbol_desc_t symbol_table; + struct dsp_symbol_desc symbol_table; int nsegments; - segment_desc_t * segments; + struct dsp_segment_desc * segments; /* initialized by driver */ u32 overlay_begin_address; u32 load_address; int nfixups; -} dsp_module_desc_t; +}; -typedef struct _dsp_scb_descriptor_t { +struct dsp_scb_descriptor { char scb_name[DSP_MAX_SCB_NAME]; u32 address; int index; - struct _dsp_scb_descriptor_t * sub_list_ptr; - struct _dsp_scb_descriptor_t * next_scb_ptr; - struct _dsp_scb_descriptor_t * parent_scb_ptr; + struct dsp_scb_descriptor * sub_list_ptr; + struct dsp_scb_descriptor * next_scb_ptr; + struct dsp_scb_descriptor * parent_scb_ptr; - symbol_entry_t * task_entry; - symbol_entry_t * scb_symbol; + struct dsp_symbol_entry * task_entry; + struct dsp_symbol_entry * scb_symbol; - snd_info_entry_t *proc_info; + struct snd_info_entry *proc_info; int ref_count; spinlock_t lock; int deleted; -} dsp_scb_descriptor_t; +}; -typedef struct _dsp_task_descriptor_t { +struct dsp_task_descriptor { char task_name[DSP_MAX_TASK_NAME]; int size; u32 address; int index; -} dsp_task_descriptor_t; +}; -typedef struct _pcm_channel_descriptor_t { +struct dsp_pcm_channel_descriptor { int active; int src_slot; int pcm_slot; u32 sample_rate; u32 unlinked; - dsp_scb_descriptor_t * pcm_reader_scb; - dsp_scb_descriptor_t * src_scb; - dsp_scb_descriptor_t * mixer_scb; + struct dsp_scb_descriptor * pcm_reader_scb; + struct dsp_scb_descriptor * src_scb; + struct dsp_scb_descriptor * mixer_scb; void * private_data; -} pcm_channel_descriptor_t; +}; -typedef struct _dsp_spos_instance_t { - symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */ +struct dsp_spos_instance { + struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */ int nmodules; - dsp_module_desc_t * modules; /* modules loaded into SP */ + struct dsp_module_desc * modules; /* modules loaded into SP */ - segment_desc_t code; + struct dsp_segment_desc code; /* Main PCM playback mixer */ - dsp_scb_descriptor_t * master_mix_scb; + struct dsp_scb_descriptor * master_mix_scb; u16 dac_volume_right; u16 dac_volume_left; /* Rear/surround PCM playback mixer */ - dsp_scb_descriptor_t * rear_mix_scb; + struct dsp_scb_descriptor * rear_mix_scb; /* Center/LFE mixer */ - dsp_scb_descriptor_t * center_lfe_mix_scb; + struct dsp_scb_descriptor * center_lfe_mix_scb; int npcm_channels; int nsrc_scb; - pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS]; + struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS]; int src_scb_slots[DSP_MAX_SRC_NR]; /* cache this symbols */ - symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */ - symbol_entry_t * s16_up; /* used by SRCtaskSCB's */ + struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */ + struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */ /* proc fs */ - snd_card_t * snd_card; - snd_info_entry_t * proc_dsp_dir; - snd_info_entry_t * proc_sym_info_entry; - snd_info_entry_t * proc_modules_info_entry; - snd_info_entry_t * proc_parameter_dump_info_entry; - snd_info_entry_t * proc_sample_dump_info_entry; + struct snd_card *snd_card; + struct snd_info_entry * proc_dsp_dir; + struct snd_info_entry * proc_sym_info_entry; + struct snd_info_entry * proc_modules_info_entry; + struct snd_info_entry * proc_parameter_dump_info_entry; + struct snd_info_entry * proc_sample_dump_info_entry; /* SCB's descriptors */ int nscb; int scb_highest_frag_index; - dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC]; - snd_info_entry_t * proc_scb_info_entry; - dsp_scb_descriptor_t * the_null_scb; + struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; + struct snd_info_entry * proc_scb_info_entry; + struct dsp_scb_descriptor * the_null_scb; /* Task's descriptors */ int ntask; - dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC]; - snd_info_entry_t * proc_task_info_entry; + struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; + struct snd_info_entry * proc_task_info_entry; /* SPDIF status */ int spdif_status_out; @@ -204,30 +201,30 @@ typedef struct _dsp_spos_instance_t { unsigned int spdif_csuv_stream; /* SPDIF input sample rate converter */ - dsp_scb_descriptor_t * spdif_in_src; + struct dsp_scb_descriptor * spdif_in_src; /* SPDIF input asynch. receiver */ - dsp_scb_descriptor_t * asynch_rx_scb; + struct dsp_scb_descriptor * asynch_rx_scb; /* Capture record mixer SCB */ - dsp_scb_descriptor_t * record_mixer_scb; + struct dsp_scb_descriptor * record_mixer_scb; /* CODEC input SCB */ - dsp_scb_descriptor_t * codec_in_scb; + struct dsp_scb_descriptor * codec_in_scb; /* reference snooper */ - dsp_scb_descriptor_t * ref_snoop_scb; + struct dsp_scb_descriptor * ref_snoop_scb; /* SPDIF output PCM reference */ - dsp_scb_descriptor_t * spdif_pcm_input_scb; + struct dsp_scb_descriptor * spdif_pcm_input_scb; /* asynch TX task */ - dsp_scb_descriptor_t * asynch_tx_scb; + struct dsp_scb_descriptor * asynch_tx_scb; /* record sources */ - dsp_scb_descriptor_t * pcm_input; - dsp_scb_descriptor_t * adc_input; + struct dsp_scb_descriptor * pcm_input; + struct dsp_scb_descriptor * adc_input; int spdif_in_sample_rate; -} dsp_spos_instance_t; +}; #endif /* __DSP_SPOS_H__ */ diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h index 5dd3bf69cb03..b3076c487de6 100644 --- a/include/sound/cs46xx_dsp_task_types.h +++ b/include/sound/cs46xx_dsp_task_types.h @@ -71,7 +71,7 @@ Ptr____Call (c) at the end of BG */ /* Minimal context save area for Hyper Forground */ -typedef struct _hf_save_area_t { +struct dsp_hf_save_area { u32 r10_save; u32 r54_save; u32 r98_save; @@ -96,11 +96,11 @@ typedef struct _hf_save_area_t { rsa2Save ) /* saved as part of HFG context */ -} hf_save_area_t; +}; /* Task link data structure */ -typedef struct _tree_link_t { +struct dsp_tree_link { ___DSP_DUAL_16BIT_ALLOC( /* Pointer to sibling task control block */ next_scb, @@ -114,10 +114,10 @@ typedef struct _tree_link_t { /* Pointer to local data */ this_spb ) -} tree_link_t; +}; -typedef struct _task_tree_data_t { +struct dsp_task_tree_data { ___DSP_DUAL_16BIT_ALLOC( /* Initial tock count; controls task tree execution rate */ tock_count_limit, @@ -155,11 +155,10 @@ typedef struct _task_tree_data_t { data_stack_base_ptr ) -} task_tree_data_t; +}; - -typedef struct _interval_timer_data_t +struct dsp_interval_timer_data { /* These data items have the same relative locations to those */ ___DSP_DUAL_16BIT_ALLOC( @@ -172,12 +171,12 @@ typedef struct _interval_timer_data_t num_FG_ticks_this_interval, num_intervals ) -} interval_timer_data_t; +}; /* This structure contains extra storage for the task tree Currently, this additional data is related only to a full context save */ -typedef struct _task_tree_context_block_t { +struct dsp_task_tree_context_block { /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for The access to the context switch (call or interrupt), and 1 spare that users should never use. This last may be required by the system */ @@ -238,16 +237,16 @@ typedef struct _task_tree_context_block_t { u32 saveaux2xaux3x; u32 savershouthl; u32 savershoutxmacmode; -} task_tree_context_block_t; +}; -typedef struct _task_tree_control_block_t { - hf_save_area_t context; - tree_link_t links; - task_tree_data_t data; - task_tree_context_block_t context_blk; - interval_timer_data_t int_timer; -} task_tree_control_block_t; +struct dsp_task_tree_control_block { + struct dsp_hf_save_area context; + struct dsp_tree_link links; + struct dsp_task_tree_data data; + struct dsp_task_tree_context_block context_blk; + struct dsp_interval_timer_data int_timer; +}; #endif /* __DSP_TASK_TYPES_H__ */ diff --git a/include/sound/cs8403.h b/include/sound/cs8403.h index 0b7d216e24f1..c6c3f9f0da78 100644 --- a/include/sound/cs8403.h +++ b/include/sound/cs8403.h @@ -36,7 +36,7 @@ #endif -SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits) +SND_CS8403_DECL void SND_CS8403_DECODE(struct snd_aes_iec958 *diga, unsigned char bits) { if (bits & 0x01) { /* consumer */ if (!(bits & 0x02)) @@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit } } -SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) +SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(struct snd_aes_iec958 *diga) { unsigned char bits; @@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) #endif -SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits) +SND_CS8404_DECL void SND_CS8404_DECODE(struct snd_aes_iec958 *diga, unsigned char bits) { if (bits & 0x10) { /* consumer */ if (!(bits & 0x20)) @@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit } } -SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga) +SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(struct snd_aes_iec958 *diga) { unsigned char bits; diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h index e725b7049a53..97fd9acf8028 100644 --- a/include/sound/cs8427.h +++ b/include/sound/cs8427.h @@ -186,11 +186,16 @@ #define CS8427_VERSHIFT 0 #define CS8427_VER8427A 0x71 -int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, - unsigned int reset_timeout, snd_i2c_device_t **r_cs8427); -int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val); -int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); -int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); -int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); +struct snd_pcm_substream; + +int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr, + unsigned int reset_timeout, struct snd_i2c_device **r_cs8427); +int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, + unsigned char val); +int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, + struct snd_pcm_substream *playback_substream, + struct snd_pcm_substream *capture_substream); +int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active); +int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate); #endif /* __SOUND_CS8427_H */ diff --git a/include/sound/driver.h b/include/sound/driver.h index 3f0416ac24d9..89c6a73f3920 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h @@ -28,7 +28,12 @@ #include <linux/config.h> -#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */ +/* number of supported soundcards */ +#ifdef CONFIG_SND_DYNAMIC_MINORS +#define SNDRV_CARDS 32 +#else +#define SNDRV_CARDS 8 /* don't change - minor numbers */ +#endif #ifndef CONFIG_SND_MAJOR /* standard configuration */ #define CONFIG_SND_MAJOR 116 diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 8411c7ef6f11..951e40d720d9 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -887,47 +887,45 @@ /* ------------------- STRUCTURES -------------------- */ -typedef struct _snd_emu10k1 emu10k1_t; -typedef struct _snd_emu10k1_voice emu10k1_voice_t; -typedef struct _snd_emu10k1_pcm emu10k1_pcm_t; - -typedef enum { +enum { EMU10K1_EFX, EMU10K1_PCM, EMU10K1_SYNTH, EMU10K1_MIDI -} emu10k1_voice_type_t; +}; + +struct snd_emu10k1; -struct _snd_emu10k1_voice { - emu10k1_t *emu; +struct snd_emu10k1_voice { + struct snd_emu10k1 *emu; int number; unsigned int use: 1, pcm: 1, efx: 1, synth: 1, midi: 1; - void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice); + void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice); - emu10k1_pcm_t *epcm; + struct snd_emu10k1_pcm *epcm; }; -typedef enum { +enum { PLAYBACK_EMUVOICE, PLAYBACK_EFX, CAPTURE_AC97ADC, CAPTURE_AC97MIC, CAPTURE_EFX -} snd_emu10k1_pcm_type_t; - -struct _snd_emu10k1_pcm { - emu10k1_t *emu; - snd_emu10k1_pcm_type_t type; - snd_pcm_substream_t *substream; - emu10k1_voice_t *voices[NUM_EFX_PLAYBACK]; - emu10k1_voice_t *extra; +}; + +struct snd_emu10k1_pcm { + struct snd_emu10k1 *emu; + int type; + struct snd_pcm_substream *substream; + struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK]; + struct snd_emu10k1_voice *extra; unsigned short running; unsigned short first_ptr; - snd_util_memblk_t *memblk; + struct snd_util_memblk *memblk; unsigned int start_addr; unsigned int ccca_start_addr; unsigned int capture_ipr; /* interrupt acknowledge mask */ @@ -941,13 +939,13 @@ struct _snd_emu10k1_pcm { unsigned int capture_bufsize; /* buffer size in bytes */ }; -typedef struct { +struct snd_emu10k1_pcm_mixer { /* mono, left, right x 8 sends (4 on emu10k1) */ unsigned char send_routing[3][8]; unsigned char send_volume[3][8]; unsigned short attn[3]; - emu10k1_pcm_t *epcm; -} emu10k1_pcm_mixer_t; + struct snd_emu10k1_pcm *epcm; +}; #define snd_emu10k1_compose_send_routing(route) \ ((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) @@ -958,20 +956,20 @@ typedef struct { #define snd_emu10k1_compose_audigy_fxrt2(route) \ ((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) -typedef struct snd_emu10k1_memblk { - snd_util_memblk_t mem; +struct snd_emu10k1_memblk { + struct snd_util_memblk mem; /* private part */ int first_page, last_page, pages, mapped_page; unsigned int map_locked; struct list_head mapped_link; struct list_head mapped_order_link; -} emu10k1_memblk_t; +}; #define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1))) #define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16 -typedef struct { +struct snd_emu10k1_fx8010_ctl { struct list_head list; /* list link container */ unsigned int vcount; unsigned int count; /* count of GPR (1..16) */ @@ -980,19 +978,19 @@ typedef struct { unsigned int min; /* minimum range */ unsigned int max; /* maximum range */ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ - snd_kcontrol_t *kcontrol; -} snd_emu10k1_fx8010_ctl_t; + struct snd_kcontrol *kcontrol; +}; -typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data); +typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data); -typedef struct _snd_emu10k1_fx8010_irq { - struct _snd_emu10k1_fx8010_irq *next; +struct snd_emu10k1_fx8010_irq { + struct snd_emu10k1_fx8010_irq *next; snd_fx8010_irq_handler_t *handler; unsigned short gpr_running; void *private_data; -} snd_emu10k1_fx8010_irq_t; +}; -typedef struct { +struct snd_emu10k1_fx8010_pcm { unsigned int valid: 1, opened: 1, active: 1; @@ -1006,13 +1004,13 @@ typedef struct { unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ unsigned char etram[32]; /* external TRAM address & data */ - snd_pcm_indirect_t pcm_rec; + struct snd_pcm_indirect pcm_rec; unsigned int tram_pos; unsigned int tram_shift; - snd_emu10k1_fx8010_irq_t *irq; -} snd_emu10k1_fx8010_pcm_t; + struct snd_emu10k1_fx8010_irq *irq; +}; -typedef struct { +struct snd_emu10k1_fx8010 { unsigned short fxbus_mask; /* used FX buses (bitmask) */ unsigned short extin_mask; /* used external inputs (bitmask) */ unsigned short extout_mask; /* used external outputs (bitmask) */ @@ -1025,18 +1023,18 @@ typedef struct { int gpr_count; /* count of used kcontrols */ struct list_head gpr_ctl; /* GPR controls */ struct semaphore lock; - snd_emu10k1_fx8010_pcm_t pcm[8]; + struct snd_emu10k1_fx8010_pcm pcm[8]; spinlock_t irq_lock; - snd_emu10k1_fx8010_irq_t *irq_handlers; -} snd_emu10k1_fx8010_t; + struct snd_emu10k1_fx8010_irq *irq_handlers; +}; -#define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list) +#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list) -typedef struct { - struct _snd_emu10k1 *emu; - snd_rawmidi_t *rmidi; - snd_rawmidi_substream_t *substream_input; - snd_rawmidi_substream_t *substream_output; +struct snd_emu10k1_midi { + struct snd_emu10k1 *emu; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *substream_input; + struct snd_rawmidi_substream *substream_output; unsigned int midi_mode; spinlock_t input_lock; spinlock_t output_lock; @@ -1044,10 +1042,10 @@ typedef struct { int tx_enable, rx_enable; int port; int ipr_tx, ipr_rx; - void (*interrupt)(emu10k1_t *emu, unsigned int status); -} emu10k1_midi_t; + void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status); +}; -typedef struct { +struct snd_emu_chip_details { u32 vendor; u32 device; u32 subsystem; @@ -1063,18 +1061,23 @@ typedef struct { unsigned char spdif_bug; /* Has Spdif phasing bug */ unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ unsigned char ecard; /* APS EEPROM */ + unsigned char emu1212m; /* EMU 1212m card */ + unsigned char spi_dac; /* SPI interface for DAC */ + unsigned char i2c_adc; /* I2C interface for ADC */ const char *driver; const char *name; const char *id; /* for backward compatibility - can be NULL if not needed */ -} emu_chip_details_t; +}; -struct _snd_emu10k1 { +struct snd_emu10k1 { int irq; unsigned long port; /* I/O port number */ unsigned int tos_link: 1, /* tos link detected */ - rear_ac97: 1; /* rear channels are on AC'97 */ - const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ + rear_ac97: 1, /* rear channels are on AC'97 */ + enable_ir: 1; + /* Contains profile of card capabilities */ + const struct snd_emu_chip_details *card_capabilities; unsigned int audigy; /* is Audigy? */ unsigned int revision; /* chip revision */ unsigned int serial; /* serial number */ @@ -1088,8 +1091,8 @@ struct _snd_emu10k1 { struct snd_dma_device p16v_dma_dev; struct snd_dma_buffer p16v_buffer; - snd_util_memhdr_t *memhdr; /* page allocation list */ - emu10k1_memblk_t *reserved_page; /* reserved page */ + struct snd_util_memhdr *memhdr; /* page allocation list */ + struct snd_emu10k1_memblk *reserved_page; /* reserved page */ struct list_head mapped_link_head; struct list_head mapped_order_link_head; @@ -1099,142 +1102,169 @@ struct _snd_emu10k1 { unsigned int spdif_bits[3]; /* s/pdif out setup */ - snd_emu10k1_fx8010_t fx8010; /* FX8010 info */ + struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */ int gpr_base; - ac97_t *ac97; + struct snd_ac97 *ac97; struct pci_dev *pci; - snd_card_t *card; - snd_pcm_t *pcm; - snd_pcm_t *pcm_mic; - snd_pcm_t *pcm_efx; - snd_pcm_t *pcm_p16v; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_pcm *pcm_mic; + struct snd_pcm *pcm_efx; + struct snd_pcm *pcm_multi; + struct snd_pcm *pcm_p16v; spinlock_t synth_lock; void *synth; - int (*get_synth_voice)(emu10k1_t *emu); + int (*get_synth_voice)(struct snd_emu10k1 *emu); spinlock_t reg_lock; spinlock_t emu_lock; spinlock_t voice_lock; struct semaphore ptb_lock; - emu10k1_voice_t voices[NUM_G]; - emu10k1_voice_t p16v_voices[4]; - emu10k1_voice_t p16v_capture_voice; + struct snd_emu10k1_voice voices[NUM_G]; + struct snd_emu10k1_voice p16v_voices[4]; + struct snd_emu10k1_voice p16v_capture_voice; int p16v_device_offset; u32 p16v_capture_source; u32 p16v_capture_channel; - emu10k1_pcm_mixer_t pcm_mixer[32]; - emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; - snd_kcontrol_t *ctl_send_routing; - snd_kcontrol_t *ctl_send_volume; - snd_kcontrol_t *ctl_attn; - snd_kcontrol_t *ctl_efx_send_routing; - snd_kcontrol_t *ctl_efx_send_volume; - snd_kcontrol_t *ctl_efx_attn; - - void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status); - void (*capture_interrupt)(emu10k1_t *emu, unsigned int status); - void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status); - void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status); - void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status); - void (*dsp_interrupt)(emu10k1_t *emu); - - snd_pcm_substream_t *pcm_capture_substream; - snd_pcm_substream_t *pcm_capture_mic_substream; - snd_pcm_substream_t *pcm_capture_efx_substream; - snd_pcm_substream_t *pcm_playback_efx_substream; - - snd_timer_t *timer; - - emu10k1_midi_t midi; - emu10k1_midi_t midi2; /* for audigy */ + struct snd_emu10k1_pcm_mixer pcm_mixer[32]; + struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK]; + struct snd_kcontrol *ctl_send_routing; + struct snd_kcontrol *ctl_send_volume; + struct snd_kcontrol *ctl_attn; + struct snd_kcontrol *ctl_efx_send_routing; + struct snd_kcontrol *ctl_efx_send_volume; + struct snd_kcontrol *ctl_efx_attn; + + void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status); + void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status); + void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status); + void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status); + void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status); + void (*dsp_interrupt)(struct snd_emu10k1 *emu); + + struct snd_pcm_substream *pcm_capture_substream; + struct snd_pcm_substream *pcm_capture_mic_substream; + struct snd_pcm_substream *pcm_capture_efx_substream; + struct snd_pcm_substream *pcm_playback_efx_substream; + + struct snd_timer *timer; + + struct snd_emu10k1_midi midi; + struct snd_emu10k1_midi midi2; /* for audigy */ unsigned int efx_voices_mask[2]; unsigned int next_free_voice; + +#ifdef CONFIG_PM + unsigned int *saved_ptr; + unsigned int *saved_gpr; + unsigned int *tram_val_saved; + unsigned int *tram_addr_saved; + unsigned int *saved_icode; + unsigned int *p16v_saved; + unsigned int saved_a_iocfg, saved_hcfg; +#endif + }; -int snd_emu10k1_create(snd_card_t * card, +int snd_emu10k1_create(struct snd_card *card, struct pci_dev *pci, unsigned short extin_mask, unsigned short extout_mask, long max_cache_bytes, int enable_ir, uint subsystem, - emu10k1_t ** remu); - -int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_p16v_free(emu10k1_t * emu); -int snd_p16v_mixer(emu10k1_t * emu); -int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); -int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device); -int snd_emu10k1_timer(emu10k1_t * emu, int device); -int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); + struct snd_emu10k1 ** remu); + +int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_p16v_free(struct snd_emu10k1 * emu); +int snd_p16v_mixer(struct snd_emu10k1 * emu); +int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm); +int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device); +int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device); +int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep); irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs); -/* initialization */ -void snd_emu10k1_voice_init(emu10k1_t * emu, int voice); -int snd_emu10k1_init_efx(emu10k1_t *emu); -void snd_emu10k1_free_efx(emu10k1_t *emu); -int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size); +void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice); +int snd_emu10k1_init_efx(struct snd_emu10k1 *emu); +void snd_emu10k1_free_efx(struct snd_emu10k1 *emu); +int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size); +int snd_emu10k1_done(struct snd_emu10k1 * emu); /* I/O functions */ -unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); -void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); -unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); -void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); -unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc); -void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb); -void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb); -void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum); -void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait); -static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } -unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg); -void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data); +unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn); +void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); +unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn); +void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); +int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data); +unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc); +void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb); +void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb); +void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum); +void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait); +static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } +unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg); +void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data); unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); +#ifdef CONFIG_PM +void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu); +void snd_emu10k1_resume_init(struct snd_emu10k1 *emu); +void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu); +int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu); +void snd_emu10k1_efx_free_pm_buffer(struct snd_emu10k1 *emu); +void snd_emu10k1_efx_suspend(struct snd_emu10k1 *emu); +void snd_emu10k1_efx_resume(struct snd_emu10k1 *emu); +int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu); +void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu); +void snd_p16v_suspend(struct snd_emu10k1 *emu); +void snd_p16v_resume(struct snd_emu10k1 *emu); +#endif + /* memory allocation */ -snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); -int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); -snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); -int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); -int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size); -int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char __user *data, int size); -int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk); +struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream); +int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk); +struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size); +int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk); +int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size); +int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size); +int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk); /* voice allocation */ -int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice); -int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice); +int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice); +int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice); /* MIDI uart */ -int snd_emu10k1_midi(emu10k1_t * emu); -int snd_emu10k1_audigy_midi(emu10k1_t * emu); +int snd_emu10k1_midi(struct snd_emu10k1 * emu); +int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu); /* proc interface */ -int snd_emu10k1_proc_init(emu10k1_t * emu); +int snd_emu10k1_proc_init(struct snd_emu10k1 * emu); /* fx8010 irq handler */ -int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, +int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu, snd_fx8010_irq_handler_t *handler, unsigned char gpr_running, void *private_data, - snd_emu10k1_fx8010_irq_t **r_irq); -int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, - snd_emu10k1_fx8010_irq_t *irq); + struct snd_emu10k1_fx8010_irq **r_irq); +int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu, + struct snd_emu10k1_fx8010_irq *irq); #endif /* __KERNEL__ */ @@ -1469,14 +1499,14 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, #define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ #endif -typedef struct { +struct snd_emu10k1_fx8010_info { unsigned int internal_tram_size; /* in samples */ unsigned int external_tram_size; /* in samples */ char fxbus_names[16][32]; /* names of FXBUSes */ char extin_names[16][32]; /* names of external inputs */ char extout_names[32][32]; /* names of external outputs */ unsigned int gpr_controls; /* count of GPR controls */ -} emu10k1_fx8010_info_t; +}; #define EMU10K1_GPR_TRANSLATION_NONE 0 #define EMU10K1_GPR_TRANSLATION_TABLE100 1 @@ -1484,8 +1514,8 @@ typedef struct { #define EMU10K1_GPR_TRANSLATION_TREBLE 3 #define EMU10K1_GPR_TRANSLATION_ONOFF 4 -typedef struct { - snd_ctl_elem_id_t id; /* full control ID definition */ +struct snd_emu10k1_fx8010_control_gpr { + struct snd_ctl_elem_id id; /* full control ID definition */ unsigned int vcount; /* visible count */ unsigned int count; /* count of GPR (1..16) */ unsigned short gpr[32]; /* GPR number(s) */ @@ -1493,23 +1523,23 @@ typedef struct { unsigned int min; /* minimum range */ unsigned int max; /* maximum range */ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ -} emu10k1_fx8010_control_gpr_t; +}; -typedef struct { +struct snd_emu10k1_fx8010_code { char name[128]; DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ u_int32_t __user *gpr_map; /* initializers */ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ - emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ + struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ - snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ + struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */ unsigned int gpr_list_control_count; /* count of GPR controls to list */ unsigned int gpr_list_control_total; /* total count of GPR controls */ - emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ + struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */ DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ u_int32_t __user *tram_data_map; /* data initializers */ @@ -1517,16 +1547,16 @@ typedef struct { DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ u_int32_t __user *code; /* one instruction - 64 bits */ -} emu10k1_fx8010_code_t; +}; -typedef struct { +struct snd_emu10k1_fx8010_tram { unsigned int address; /* 31.bit == 1 -> external TRAM */ unsigned int size; /* size in samples (4 bytes) */ unsigned int *samples; /* pointer to samples (20-bit) */ /* NULL->clear memory */ -} emu10k1_fx8010_tram_t; +}; -typedef struct { +struct snd_emu10k1_fx8010_pcm_rec { unsigned int substream; /* substream number */ unsigned int res1; /* reserved */ unsigned int channels; /* 16-bit channels count, zero = remove this substream */ @@ -1541,20 +1571,27 @@ typedef struct { unsigned char pad; /* reserved */ unsigned char etram[32]; /* external TRAM address & data (one per channel) */ unsigned int res2; /* reserved */ -} emu10k1_fx8010_pcm_t; +}; -#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t) -#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t) -#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t) +#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) +#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) +#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) #define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) -#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t) -#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t) -#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t) -#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t) +#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) +#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) +#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) +#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) #define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) #define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) +/* typedefs for compatibility to user-space */ +typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; +typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; +typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; +typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; +typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; + #endif /* __SOUND_EMU10K1_H */ diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h index df0df1d09552..6ef61c420935 100644 --- a/include/sound/emu10k1_synth.h +++ b/include/sound/emu10k1_synth.h @@ -27,12 +27,12 @@ #define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth" /* argument for snd_seq_device_new */ -typedef struct snd_emu10k1_synth_arg { - emu10k1_t *hwptr; /* chip */ +struct snd_emu10k1_synth_arg { + struct snd_emu10k1 *hwptr; /* chip */ int index; /* sequencer client index */ int seq_ports; /* number of sequencer ports to be created */ int max_voices; /* maximum number of voices for wavetable */ -} snd_emu10k1_synth_arg_t; +}; #define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */ diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h index 4362c54e09d0..c8f66bde6d95 100644 --- a/include/sound/emu8000.h +++ b/include/sound/emu8000.h @@ -56,9 +56,9 @@ enum { * some of the channels may be used for other things so max_channels is * the number in use for wave voices. */ -typedef struct snd_emu8000 { +struct snd_emu8000 { - snd_emux_t *emu; + struct snd_emux *emu; int index; /* sequencer client index */ int seq_ports; /* number of sequencer ports */ @@ -77,44 +77,45 @@ typedef struct snd_emu8000 { int dram_checked; - snd_card_t *card; /* The card that this belongs to */ + struct snd_card *card; /* The card that this belongs to */ int chorus_mode; int reverb_mode; int bass_level; int treble_level; - snd_util_memhdr_t *memhdr; + struct snd_util_memhdr *memhdr; spinlock_t control_lock; - snd_kcontrol_t *controls[EMU8000_NUM_CONTROLS]; + struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS]; - snd_pcm_t *pcm; /* pcm on emu8000 wavetable */ + struct snd_pcm *pcm; /* pcm on emu8000 wavetable */ -} emu8000_t; +}; /* sequencer device id */ #define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth" /* exported functions */ -int snd_emu8000_new(snd_card_t *card, int device, long port, int seq_ports, snd_seq_device_t **ret); -void snd_emu8000_poke(emu8000_t *emu, unsigned int port, unsigned int reg, +int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports, + struct snd_seq_device **ret); +void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg, unsigned int val); -unsigned short snd_emu8000_peek(emu8000_t *emu, unsigned int port, +unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port, unsigned int reg); -void snd_emu8000_poke_dw(emu8000_t *emu, unsigned int port, unsigned int reg, +void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg, unsigned int val); -unsigned int snd_emu8000_peek_dw(emu8000_t *emu, unsigned int port, +unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg); -void snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode); +void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode); -void snd_emu8000_init_fm(emu8000_t *emu); +void snd_emu8000_init_fm(struct snd_emu8000 *emu); -void snd_emu8000_update_chorus_mode(emu8000_t *emu); -void snd_emu8000_update_reverb_mode(emu8000_t *emu); -void snd_emu8000_update_equalizer(emu8000_t *emu); -int snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void __user *buf, long len); -int snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void __user *buf, long len); +void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu); +void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu); +void snd_emu8000_update_equalizer(struct snd_emu8000 *emu); +int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len); +int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len); #endif /* __SOUND_EMU8000_H */ diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h index c6970aac9bdc..b2d6b2acc7c7 100644 --- a/include/sound/emux_synth.h +++ b/include/sound/emux_synth.h @@ -36,39 +36,40 @@ */ #define SNDRV_EMUX_USE_RAW_EFFECT - -/* - * typedefs - */ -typedef struct snd_emux_effect_table snd_emux_effect_table_t; -typedef struct snd_emux_port snd_emux_port_t; -typedef struct snd_emux_voice snd_emux_voice_t; -typedef struct snd_emux snd_emux_t; - +struct snd_emux; +struct snd_emux_port; +struct snd_emux_voice; +struct snd_emux_effect_table; /* * operators */ -typedef struct snd_emux_operators { +struct snd_emux_operators { struct module *owner; - snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); - int (*prepare)(snd_emux_voice_t *vp); - void (*trigger)(snd_emux_voice_t *vp); - void (*release)(snd_emux_voice_t *vp); - void (*update)(snd_emux_voice_t *vp, int update); - void (*terminate)(snd_emux_voice_t *vp); - void (*free_voice)(snd_emux_voice_t *vp); - void (*reset)(snd_emux_t *emu, int ch); - /* the first parameters are snd_emux_t */ - int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); - int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); - void (*sample_reset)(snd_emux_t *emu); - int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); - void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); + struct snd_emux_voice *(*get_voice)(struct snd_emux *emu, + struct snd_emux_port *port); + int (*prepare)(struct snd_emux_voice *vp); + void (*trigger)(struct snd_emux_voice *vp); + void (*release)(struct snd_emux_voice *vp); + void (*update)(struct snd_emux_voice *vp, int update); + void (*terminate)(struct snd_emux_voice *vp); + void (*free_voice)(struct snd_emux_voice *vp); + void (*reset)(struct snd_emux *emu, int ch); + /* the first parameters are struct snd_emux */ + int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp, + struct snd_util_memhdr *hdr, + const void __user *data, long count); + int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp, + struct snd_util_memhdr *hdr); + void (*sample_reset)(struct snd_emux *emu); + int (*load_fx)(struct snd_emux *emu, int type, int arg, + const void __user *data, long count); + void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, + struct snd_midi_channel_set *chset); #ifdef CONFIG_SND_SEQUENCER_OSS - int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); + int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); #endif -} snd_emux_operators_t; +}; /* @@ -90,46 +91,46 @@ typedef struct snd_emux_operators { */ struct snd_emux { - snd_card_t *card; /* assigned card */ + struct snd_card *card; /* assigned card */ /* following should be initialized before registration */ int max_voices; /* Number of voices */ int mem_size; /* memory size (in byte) */ int num_ports; /* number of ports to be created */ int pitch_shift; /* pitch shift value (for Emu10k1) */ - snd_emux_operators_t ops; /* operators */ + struct snd_emux_operators ops; /* operators */ void *hw; /* hardware */ unsigned long flags; /* other conditions */ int midi_ports; /* number of virtual midi devices */ int midi_devidx; /* device offset of virtual midi */ unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ int hwdep_idx; /* hwdep device index */ - snd_hwdep_t *hwdep; /* hwdep device */ + struct snd_hwdep *hwdep; /* hwdep device */ /* private */ int num_voices; /* current number of voices */ - snd_sf_list_t *sflist; /* root of SoundFont list */ - snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ + struct snd_sf_list *sflist; /* root of SoundFont list */ + struct snd_emux_voice *voices; /* Voices (EMU 'channel') */ int use_time; /* allocation counter */ spinlock_t voice_lock; /* Lock for voice access */ struct semaphore register_mutex; int client; /* For the sequencer client */ int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ - snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; + struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS]; int used; /* use counter */ char *name; /* name of the device (internal) */ - snd_rawmidi_t **vmidi; + struct snd_rawmidi **vmidi; struct timer_list tlist; /* for pending note-offs */ int timer_active; - snd_util_memhdr_t *memhdr; /* memory chunk information */ + struct snd_util_memhdr *memhdr; /* memory chunk information */ #ifdef CONFIG_PROC_FS - snd_info_entry_t *proc; + struct snd_info_entry *proc; #endif #ifdef CONFIG_SND_SEQUENCER_OSS - snd_seq_device_t *oss_synth; + struct snd_seq_device *oss_synth; #endif }; @@ -139,18 +140,18 @@ struct snd_emux { */ struct snd_emux_port { - snd_midi_channel_set_t chset; - snd_emux_t *emu; + struct snd_midi_channel_set chset; + struct snd_emux *emu; char port_mode; /* operation mode */ int volume_atten; /* emuX raw attenuation */ unsigned long drum_flags; /* drum bitmaps */ int ctrls[EMUX_MD_END]; /* control parameters */ #ifdef SNDRV_EMUX_USE_RAW_EFFECT - snd_emux_effect_table_t *effect; + struct snd_emux_effect_table *effect; #endif #ifdef CONFIG_SND_SEQUENCER_OSS - snd_seq_oss_arg_t *oss_arg; + struct snd_seq_oss_arg *oss_arg; #endif }; @@ -179,16 +180,16 @@ struct snd_emux_voice { unsigned char key; unsigned char velocity; /* Velocity of current note */ - snd_sf_zone_t *zone; /* Zone assigned to this note */ + struct snd_sf_zone *zone; /* Zone assigned to this note */ void *block; /* sample block pointer (optional) */ - snd_midi_channel_t *chan; /* Midi channel for this note */ - snd_emux_port_t *port; /* associated port */ - snd_emux_t *emu; /* assigned root info */ - void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ + struct snd_midi_channel *chan; /* Midi channel for this note */ + struct snd_emux_port *port; /* associated port */ + struct snd_emux *emu; /* assigned root info */ + void *hw; /* hardware pointer (emu8000 or emu10k1) */ unsigned long ontime; /* jiffies at note triggered */ /* Emu8k/Emu10k1 registers */ - soundfont_voice_info_t reg; + struct soundfont_voice_info reg; /* additional registers */ int avol; /* volume attenuation */ @@ -229,15 +230,15 @@ struct snd_emux_effect_table { /* * prototypes - interface to Emu10k1 and Emu8k routines */ -int snd_emux_new(snd_emux_t **remu); -int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); -int snd_emux_free(snd_emux_t *emu); +int snd_emux_new(struct snd_emux **remu); +int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name); +int snd_emux_free(struct snd_emux *emu); /* * exported functions */ -void snd_emux_terminate_all(snd_emux_t *emu); -void snd_emux_lock_voice(snd_emux_t *emu, int voice); -void snd_emux_unlock_voice(snd_emux_t *emu, int voice); +void snd_emux_terminate_all(struct snd_emux *emu); +void snd_emux_lock_voice(struct snd_emux *emu, int voice); +void snd_emux_unlock_voice(struct snd_emux *emu, int voice); #endif /* __SOUND_EMUX_SYNTH_H */ diff --git a/include/sound/es1688.h b/include/sound/es1688.h index 604f495bc8b1..fc1c47dae3da 100644 --- a/include/sound/es1688.h +++ b/include/sound/es1688.h @@ -30,7 +30,7 @@ #define ES1688_HW_688 0x0001 #define ES1688_HW_1688 0x0002 -struct _snd_es1688 { +struct snd_es1688 { unsigned long port; /* port of ESS chip */ struct resource *res_port; unsigned long mpu_port; /* MPU-401 port of ESS chip */ @@ -44,17 +44,15 @@ struct _snd_es1688 { unsigned char pad; unsigned int dma_size; - snd_card_t *card; - snd_pcm_t *pcm; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; spinlock_t reg_lock; spinlock_t mixer_lock; }; -typedef struct _snd_es1688 es1688_t; - /* I/O ports */ #define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x) @@ -107,17 +105,17 @@ typedef struct _snd_es1688 es1688_t; */ -void snd_es1688_mixer_write(es1688_t *chip, unsigned char reg, unsigned char data); +void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data); -int snd_es1688_create(snd_card_t * card, +int snd_es1688_create(struct snd_card *card, unsigned long port, unsigned long mpu_port, int irq, int mpu_irq, int dma8, unsigned short hardware, - es1688_t ** rchip); -int snd_es1688_pcm(es1688_t *chip, int device, snd_pcm_t ** rpcm); -int snd_es1688_mixer(es1688_t *chip); + struct snd_es1688 ** rchip); +int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm); +int snd_es1688_mixer(struct snd_es1688 *chip); #endif /* __SOUND_ES1688_H */ diff --git a/include/sound/gus.h b/include/sound/gus.h index 7000d9d9199d..63da50fae773 100644 --- a/include/sound/gus.h +++ b/include/sound/gus.h @@ -49,32 +49,32 @@ #define SNDRV_g_u_s_IRQSTAT (0x226-0x220) #define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220) #define SNDRV_g_u_s_TIMERDATA (0x229-0x220) -#define SNDRV_g_u_s_DRAM (0x327-0x220) +#define SNDRV_g_u_s_DRAM (0x327-0x220) #define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220) #define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220) #define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220) -#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220) -#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220) -#define SNDRV_g_u_s_IVER (0x325-0x220) +#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220) +#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220) +#define SNDRV_g_u_s_IVER (0x325-0x220) #define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220) -#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220) +#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220) /* GF1 registers */ /* global registers */ #define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e #define SNDRV_GF1_GB_VOICES_IRQ 0x0f -#define SNDRV_GF1_GB_GLOBAL_MODE 0x19 +#define SNDRV_GF1_GB_GLOBAL_MODE 0x19 #define SNDRV_GF1_GW_LFO_BASE 0x1a #define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f #define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41 -#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42 -#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43 -#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44 +#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42 +#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43 +#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44 #define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45 #define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46 #define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47 -#define SNDRV_GF1_GB_RECORD_RATE 0x48 +#define SNDRV_GF1_GB_RECORD_RATE 0x48 #define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49 #define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b #define SNDRV_GF1_GB_RESET 0x4c @@ -83,7 +83,7 @@ #define SNDRV_GF1_GW_MEMORY_CONFIG 0x52 #define SNDRV_GF1_GB_MEMORY_CONTROL 0x53 #define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54 -#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55 +#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55 #define SNDRV_GF1_GW_FIFO_SIZE 0x56 #define SNDRV_GF1_GW_INTERLEAVE 0x57 #define SNDRV_GF1_GB_COMPATIBILITY 0x59 @@ -100,39 +100,39 @@ #define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH #define SNDRV_GF1_VW_END_HIGH 0x04 #define SNDRV_GF1_VW_END_LOW 0x05 -#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH -#define SNDRV_GF1_VB_VOLUME_RATE 0x06 -#define SNDRV_GF1_VB_VOLUME_START 0x07 +#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH +#define SNDRV_GF1_VB_VOLUME_RATE 0x06 +#define SNDRV_GF1_VB_VOLUME_START 0x07 #define SNDRV_GF1_VB_VOLUME_END 0x08 #define SNDRV_GF1_VW_VOLUME 0x09 -#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a -#define SNDRV_GF1_VW_CURRENT_LOW 0x0b +#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a +#define SNDRV_GF1_VW_CURRENT_LOW 0x0b #define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH -#define SNDRV_GF1_VB_PAN 0x0c -#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c +#define SNDRV_GF1_VB_PAN 0x0c +#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c #define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d #define SNDRV_GF1_VB_UPPER_ADDRESS 0x10 -#define SNDRV_GF1_VW_EFFECT_HIGH 0x11 +#define SNDRV_GF1_VW_EFFECT_HIGH 0x11 #define SNDRV_GF1_VW_EFFECT_LOW 0x12 #define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH -#define SNDRV_GF1_VW_OFFSET_LEFT 0x13 -#define SNDRV_GF1_VB_ACCUMULATOR 0x14 -#define SNDRV_GF1_VB_MODE 0x15 +#define SNDRV_GF1_VW_OFFSET_LEFT 0x13 +#define SNDRV_GF1_VB_ACCUMULATOR 0x14 +#define SNDRV_GF1_VB_MODE 0x15 #define SNDRV_GF1_VW_EFFECT_VOLUME 0x16 #define SNDRV_GF1_VB_FREQUENCY_LFO 0x17 #define SNDRV_GF1_VB_VOLUME_LFO 0x18 #define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b #define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c -#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d +#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d /* ICS registers */ #define SNDRV_ICS_MIC_DEV 0 -#define SNDRV_ICS_LINE_DEV 1 +#define SNDRV_ICS_LINE_DEV 1 #define SNDRV_ICS_CD_DEV 2 #define SNDRV_ICS_GF1_DEV 3 -#define SNDRV_ICS_NONE_DEV 4 -#define SNDRV_ICS_MASTER_DEV 5 +#define SNDRV_ICS_NONE_DEV 4 +#define SNDRV_ICS_MASTER_DEV 5 /* LFO */ @@ -143,7 +143,7 @@ #define SNDRV_GF1_DMA_UNSIGNED 0x80 #define SNDRV_GF1_DMA_16BIT 0x40 -#define SNDRV_GF1_DMA_IRQ 0x20 +#define SNDRV_GF1_DMA_IRQ 0x20 #define SNDRV_GF1_DMA_WIDTH16 0x04 #define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */ #define SNDRV_GF1_DMA_ENABLE 0x01 @@ -159,7 +159,7 @@ /* defines for memory manager */ -#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001 +#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001 #define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001 #define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002 @@ -169,9 +169,9 @@ /* constants for interrupt handlers */ #define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000 -#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000 -#define SNDRV_GF1_HANDLER_TIMER1 0x00040000 -#define SNDRV_GF1_HANDLER_TIMER2 0x00080000 +#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000 +#define SNDRV_GF1_HANDLER_TIMER1 0x00040000 +#define SNDRV_GF1_HANDLER_TIMER2 0x00080000 #define SNDRV_GF1_HANDLER_VOICE 0x00100000 #define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000 #define SNDRV_GF1_HANDLER_DMA_READ 0x00400000 @@ -183,17 +183,16 @@ /* --- */ -struct _snd_gus_card; -typedef struct _snd_gus_card snd_gus_card_t; +struct snd_gus_card; /* GF1 specific structure */ -typedef struct _snd_gf1_bank_info { +struct snd_gf1_bank_info { unsigned int address; unsigned int size; -} snd_gf1_bank_info_t; +}; -typedef struct _snd_gf1_mem_block { +struct snd_gf1_mem_block { unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */ unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */ unsigned int share; /* share count */ @@ -201,68 +200,68 @@ typedef struct _snd_gf1_mem_block { unsigned int ptr; unsigned int size; char *name; - struct _snd_gf1_mem_block *next; - struct _snd_gf1_mem_block *prev; -} snd_gf1_mem_block_t; - -typedef struct _snd_gf1_mem { - snd_gf1_bank_info_t banks_8[4]; - snd_gf1_bank_info_t banks_16[4]; - snd_gf1_mem_block_t *first; - snd_gf1_mem_block_t *last; + struct snd_gf1_mem_block *next; + struct snd_gf1_mem_block *prev; +}; + +struct snd_gf1_mem { + struct snd_gf1_bank_info banks_8[4]; + struct snd_gf1_bank_info banks_16[4]; + struct snd_gf1_mem_block *first; + struct snd_gf1_mem_block *last; struct semaphore memory_mutex; -} snd_gf1_mem_t; +}; -typedef struct snd_gf1_dma_block { +struct snd_gf1_dma_block { void *buffer; /* buffer in computer's RAM */ unsigned long buf_addr; /* buffer address */ unsigned int addr; /* address in onboard memory */ unsigned int count; /* count in bytes */ unsigned int cmd; /* DMA command (format) */ - void (*ack)(snd_gus_card_t * gus, void *private_data); + void (*ack)(struct snd_gus_card * gus, void *private_data); void *private_data; struct snd_gf1_dma_block *next; -} snd_gf1_dma_block_t; +}; -typedef struct { - snd_midi_channel_set_t * chset; - snd_gus_card_t * gus; +struct snd_gus_port { + struct snd_midi_channel_set * chset; + struct snd_gus_card * gus; int mode; /* operation mode */ int client; /* sequencer client number */ int port; /* sequencer port number */ unsigned int midi_has_voices: 1; -} snd_gus_port_t; +}; -typedef struct _snd_gus_voice snd_gus_voice_t; +struct snd_gus_voice; -typedef struct { - void (*sample_start)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position); - void (*sample_stop)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode); - void (*sample_freq)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq); - void (*sample_volume)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume); - void (*sample_loop)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop); - void (*sample_pos)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position); - void (*sample_private1)(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data); -} snd_gus_sample_ops_t; +struct snd_gus_sample_ops { + void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position); + void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode); + void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq); + void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume); + void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop); + void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position); + void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data); +}; -#define SNDRV_GF1_VOICE_TYPE_PCM 0 +#define SNDRV_GF1_VOICE_TYPE_PCM 0 #define SNDRV_GF1_VOICE_TYPE_SYNTH 1 -#define SNDRV_GF1_VOICE_TYPE_MIDI 2 +#define SNDRV_GF1_VOICE_TYPE_MIDI 2 #define SNDRV_GF1_VFLG_RUNNING (1<<0) #define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1) #define SNDRV_GF1_VFLG_PAN (1<<2) -typedef enum { +enum snd_gus_volume_state { VENV_BEFORE, VENV_ATTACK, VENV_SUSTAIN, VENV_RELEASE, VENV_DONE, VENV_VOLUME -} snd_gus_volume_state_t; +}; -struct _snd_gus_voice { +struct snd_gus_voice { int number; unsigned int use: 1, pcm: 1, @@ -278,18 +277,18 @@ struct _snd_gus_voice { unsigned int interrupt_stat_wave; unsigned int interrupt_stat_volume; #endif - void (*handler_wave) (snd_gus_card_t * gus, snd_gus_voice_t * voice); - void (*handler_volume) (snd_gus_card_t * gus, snd_gus_voice_t * voice); - void (*handler_effect) (snd_gus_card_t * gus, snd_gus_voice_t * voice); - void (*volume_change) (snd_gus_card_t * gus); + void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice); + void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice); + void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice); + void (*volume_change) (struct snd_gus_card * gus); - snd_gus_sample_ops_t *sample_ops; + struct snd_gus_sample_ops *sample_ops; - snd_seq_instr_t instr; + struct snd_seq_instr instr; /* running status / registers */ - snd_seq_ev_volume_t sample_volume; + struct snd_seq_ev_volume sample_volume; unsigned short fc_register; unsigned short fc_lfo; @@ -300,8 +299,8 @@ struct _snd_gus_voice { unsigned char effect_accumulator; unsigned char volume_control; unsigned char venv_value_next; - snd_gus_volume_state_t venv_state; - snd_gus_volume_state_t venv_state_prev; + enum snd_gus_volume_state venv_state; + enum snd_gus_volume_state venv_state_prev; unsigned short vlo; unsigned short vro; unsigned short gf1_effect_volume; @@ -309,10 +308,10 @@ struct _snd_gus_voice { /* --- */ void *private_data; - void (*private_free)(snd_gus_voice_t *voice); + void (*private_free)(struct snd_gus_voice *voice); }; -struct _snd_gf1 { +struct snd_gf1 { unsigned int enh_mode:1, /* enhanced mode (GFA1) */ hw_lfo:1, /* use hardware LFO */ @@ -330,7 +329,7 @@ struct _snd_gf1 { unsigned int rom_present; /* bitmask */ unsigned int rom_banks; /* GUS's ROM banks */ - snd_gf1_mem_t mem_alloc; + struct snd_gf1_mem mem_alloc; /* registers */ unsigned short reg_page; @@ -347,7 +346,7 @@ struct _snd_gf1 { unsigned char active_voices; /* active voices */ unsigned char active_voice; /* selected voice (GF1PAGE register) */ - snd_gus_voice_t voices[32]; /* GF1 voices */ + struct snd_gus_voice voices[32]; /* GF1 voices */ unsigned int default_voice_address; @@ -362,12 +361,12 @@ struct _snd_gf1 { /* interrupt handlers */ - void (*interrupt_handler_midi_out) (snd_gus_card_t * gus); - void (*interrupt_handler_midi_in) (snd_gus_card_t * gus); - void (*interrupt_handler_timer1) (snd_gus_card_t * gus); - void (*interrupt_handler_timer2) (snd_gus_card_t * gus); - void (*interrupt_handler_dma_write) (snd_gus_card_t * gus); - void (*interrupt_handler_dma_read) (snd_gus_card_t * gus); + void (*interrupt_handler_midi_out) (struct snd_gus_card * gus); + void (*interrupt_handler_midi_in) (struct snd_gus_card * gus); + void (*interrupt_handler_timer1) (struct snd_gus_card * gus); + void (*interrupt_handler_timer2) (struct snd_gus_card * gus); + void (*interrupt_handler_dma_write) (struct snd_gus_card * gus); + void (*interrupt_handler_dma_read) (struct snd_gus_card * gus); #ifdef CONFIG_SND_DEBUG unsigned int interrupt_stat_midi_out; @@ -382,17 +381,17 @@ struct _snd_gf1 { /* synthesizer */ int seq_client; - snd_gus_port_t seq_ports[4]; - snd_seq_kinstr_list_t *ilist; - snd_iwffff_ops_t iwffff_ops; - snd_gf1_ops_t gf1_ops; - snd_simple_ops_t simple_ops; + struct snd_gus_port seq_ports[4]; + struct snd_seq_kinstr_list *ilist; + struct snd_iwffff_ops iwffff_ops; + struct snd_gf1_ops gf1_ops; + struct snd_simple_ops simple_ops; /* timer */ unsigned short timer_enabled; - snd_timer_t *timer1; - snd_timer_t *timer2; + struct snd_timer *timer1; + struct snd_timer *timer2; /* midi */ @@ -404,11 +403,11 @@ struct _snd_gf1 { unsigned int dma_flags; unsigned int dma_shared; - snd_gf1_dma_block_t *dma_data_pcm; - snd_gf1_dma_block_t *dma_data_pcm_last; - snd_gf1_dma_block_t *dma_data_synth; - snd_gf1_dma_block_t *dma_data_synth_last; - void (*dma_ack)(snd_gus_card_t * gus, void *private_data); + struct snd_gf1_dma_block *dma_data_pcm; + struct snd_gf1_dma_block *dma_data_pcm_last; + struct snd_gf1_dma_block *dma_data_synth; + struct snd_gf1_dma_block *dma_data_synth_last; + void (*dma_ack)(struct snd_gus_card * gus, void *private_data); void *dma_private_data; /* pcm */ @@ -425,8 +424,8 @@ struct _snd_gf1 { /* main structure for GUS card */ -struct _snd_gus_card { - snd_card_t *card; +struct snd_gus_card { + struct snd_card *card; unsigned int initialized: 1, /* resources were initialized */ @@ -448,18 +447,18 @@ struct _snd_gus_card { unsigned short joystick_dac; /* joystick DAC level */ int timer_dev; /* timer device */ - struct _snd_gf1 gf1; /* gf1 specific variables */ - snd_pcm_t *pcm; - snd_pcm_substream_t *pcm_cap_substream; + struct snd_gf1 gf1; /* gf1 specific variables */ + struct snd_pcm *pcm; + struct snd_pcm_substream *pcm_cap_substream; unsigned int c_dma_size; unsigned int c_period_size; unsigned int c_pos; - snd_rawmidi_t *midi_uart; - snd_rawmidi_substream_t *midi_substream_output; - snd_rawmidi_substream_t *midi_substream_input; + struct snd_rawmidi *midi_uart; + struct snd_rawmidi_substream *midi_substream_output; + struct snd_rawmidi_substream *midi_substream_input; - snd_seq_device_t *seq_dev; + struct snd_seq_device *seq_dev; spinlock_t reg_lock; spinlock_t voice_alloc; @@ -474,7 +473,7 @@ struct _snd_gus_card { /* I/O functions for GF1/InterWave chip - gus_io.c */ -static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice) +static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice) { unsigned long flags; @@ -486,63 +485,63 @@ static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice) spin_unlock_irqrestore(&gus->active_voice_lock, flags); } -static inline void snd_gf1_uart_cmd(snd_gus_card_t * gus, unsigned char b) +static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b) { outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL)); } -static inline unsigned char snd_gf1_uart_stat(snd_gus_card_t * gus) +static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus) { return inb(GUSP(gus, MIDISTAT)); } -static inline void snd_gf1_uart_put(snd_gus_card_t * gus, unsigned char b) +static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b) { outb(b, GUSP(gus, MIDIDATA)); } -static inline unsigned char snd_gf1_uart_get(snd_gus_card_t * gus) +static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus) { return inb(GUSP(gus, MIDIDATA)); } -extern void snd_gf1_delay(snd_gus_card_t * gus); +extern void snd_gf1_delay(struct snd_gus_card * gus); -extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); +extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg); -extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); -extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg); -static inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg) +extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data); +extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg); +static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg) { return snd_gf1_look8(gus, reg | 0x80); } -extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); -extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg); -static inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg) +extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data); +extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg); +static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg) { return snd_gf1_look16(gus, reg | 0x80); } -extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data); -extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); -extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); -extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); -extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); -extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); -extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); -extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); -extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg); -extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); -static inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg) +extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data); +extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr); +extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data); +extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr); +extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit); +extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit); +extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg); +extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data); +extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg); +extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data); +static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg) { return snd_gf1_i_look8(gus, reg | 0x80); } -extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg); -static inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg) +extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg); +static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg) { return snd_gf1_i_look16(gus, reg | 0x80); } -extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); +extern void snd_gf1_select_active_voices(struct snd_gus_card * gus); /* gus_lfo.c */ @@ -555,98 +554,98 @@ struct _SND_IW_LFO_PROGRAM { }; #if 0 -extern irqreturn_t snd_gf1_lfo_effect_interrupt(snd_gus_card_t * gus, snd_gf1_voice_t * voice); +extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice); #endif -extern void snd_gf1_lfo_init(snd_gus_card_t * gus); -extern void snd_gf1_lfo_done(snd_gus_card_t * gus); -extern void snd_gf1_lfo_program(snd_gus_card_t * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program); -extern void snd_gf1_lfo_enable(snd_gus_card_t * gus, int voice, int lfo_type); -extern void snd_gf1_lfo_disable(snd_gus_card_t * gus, int voice, int lfo_type); -extern void snd_gf1_lfo_change_freq(snd_gus_card_t * gus, int voice, int lfo_type, int freq); -extern void snd_gf1_lfo_change_depth(snd_gus_card_t * gus, int voice, int lfo_type, int depth); -extern void snd_gf1_lfo_setup(snd_gus_card_t * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape); -extern void snd_gf1_lfo_shutdown(snd_gus_card_t * gus, int voice, int lfo_type); +extern void snd_gf1_lfo_init(struct snd_gus_card * gus); +extern void snd_gf1_lfo_done(struct snd_gus_card * gus); +extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program); +extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type); +extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type); +extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq); +extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth); +extern void snd_gf1_lfo_setup(struct snd_gus_card * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape); +extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type); #if 0 -extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char *command); +extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command); #endif /* gus_mem.c */ -void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); -int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); -snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, +void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup); +int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block); +struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner, char *name, int size, int w_16, int align, unsigned int *share_id); -int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address); -int snd_gf1_mem_free_owner(snd_gf1_mem_t * alloc, int owner); -int snd_gf1_mem_init(snd_gus_card_t * gus); -int snd_gf1_mem_done(snd_gus_card_t * gus); +int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address); +int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner); +int snd_gf1_mem_init(struct snd_gus_card * gus); +int snd_gf1_mem_done(struct snd_gus_card * gus); /* gus_mem_proc.c */ -int snd_gf1_mem_proc_init(snd_gus_card_t * gus); +int snd_gf1_mem_proc_init(struct snd_gus_card * gus); /* gus_dma.c */ -int snd_gf1_dma_init(snd_gus_card_t * gus); -int snd_gf1_dma_done(snd_gus_card_t * gus); -int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, - snd_gf1_dma_block_t * block, +int snd_gf1_dma_init(struct snd_gus_card * gus); +int snd_gf1_dma_done(struct snd_gus_card * gus); +int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, + struct snd_gf1_dma_block * block, int atomic, int synth); /* gus_volume.c */ unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); -unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); +unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2); /* gus_reset.c */ -void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); -void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); -void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); -void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); -snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); -void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); -int snd_gf1_start(snd_gus_card_t * gus); -int snd_gf1_stop(snd_gus_card_t * gus); +void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what); +void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice); +void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice); +void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max); +struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port); +void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice); +int snd_gf1_start(struct snd_gus_card * gus); +int snd_gf1_stop(struct snd_gus_card * gus); /* gus_mixer.c */ -int snd_gf1_new_mixer(snd_gus_card_t * gus); +int snd_gf1_new_mixer(struct snd_gus_card * gus); /* gus_pcm.c */ -int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm); +int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm); #ifdef CONFIG_SND_DEBUG -extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); +extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus); #endif /* gus.c */ -int snd_gus_use_inc(snd_gus_card_t * gus); -void snd_gus_use_dec(snd_gus_card_t * gus); -int snd_gus_create(snd_card_t * card, +int snd_gus_use_inc(struct snd_gus_card * gus); +void snd_gus_use_dec(struct snd_gus_card * gus); +int snd_gus_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, int timer_dev, int voices, int pcm_channels, int effect, - snd_gus_card_t ** rgus); -int snd_gus_initialize(snd_gus_card_t * gus); + struct snd_gus_card ** rgus); +int snd_gus_initialize(struct snd_gus_card * gus); /* gus_irq.c */ irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs); #ifdef CONFIG_SND_DEBUG -void snd_gus_irq_profile_init(snd_gus_card_t *gus); +void snd_gus_irq_profile_init(struct snd_gus_card *gus); #endif /* gus_uart.c */ -int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t **rrawmidi); +int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi); #if 0 extern void snd_engine_instrument_register(unsigned short mode, @@ -657,37 +656,37 @@ extern int snd_engine_instrument_register_ask(unsigned short mode); #endif /* gus_dram.c */ -int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr, +int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size); -int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr, +int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size, int rom); #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) /* gus_sample.c */ -void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p); +void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p); /* gus_simple.c */ -void snd_gf1_simple_init(snd_gus_voice_t *voice); +void snd_gf1_simple_init(struct snd_gus_voice *voice); /* gus_instr.c */ -int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic); -int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic); -int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave, int atomic); -int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic); -int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic); -int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave, int atomic); -int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic); -int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic); -int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr, int atomic); #endif /* CONFIG_SND_SEQUENCER */ diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h index 7ce3aa67e5d6..25e1951a9955 100644 --- a/include/sound/hdsp.h +++ b/include/sound/hdsp.h @@ -21,17 +21,15 @@ #define HDSP_MATRIX_MIXER_SIZE 2048 -typedef enum { +enum HDSP_IO_Type { Digiface, Multiface, H9652, H9632, Undefined, -} HDSP_IO_Type; - -typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t; +}; -struct _snd_hdsp_peak_rms { +struct hdsp_peak_rms { u32 input_peaks[26]; u32 playback_peaks[26]; u32 output_peaks[28]; @@ -41,11 +39,9 @@ struct _snd_hdsp_peak_rms { u64 output_rms[26]; }; -#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t) +#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) -typedef struct _snd_hdsp_config_info hdsp_config_info_t; - -struct _snd_hdsp_config_info { +struct hdsp_config_info { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char spdif_sync_check; @@ -71,40 +67,41 @@ struct _snd_hdsp_config_info { unsigned char analog_extension_board; }; -#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t) - -typedef struct _snd_hdsp_firmware hdsp_firmware_t; +#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) -struct _snd_hdsp_firmware { +struct hdsp_firmware { void __user *firmware_data; /* 24413 x 4 bytes */ }; -#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t) +#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) -typedef struct _snd_hdsp_version hdsp_version_t; - -struct _snd_hdsp_version { - HDSP_IO_Type io_type; +struct hdsp_version { + enum HDSP_IO_Type io_type; unsigned short firmware_rev; }; -#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t) - -typedef struct _snd_hdsp_mixer hdsp_mixer_t; +#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) -struct _snd_hdsp_mixer { +struct hdsp_mixer { unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; }; -#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t) +#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) -typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t; - -struct _snd_hdsp_9632_aeb { +struct hdsp_9632_aeb { int aebi; int aebo; }; -#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t) +#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) + +/* typedefs for compatibility to user-space */ +typedef enum HDSP_IO_Type HDSP_IO_Type; +typedef struct hdsp_peak_rms hdsp_peak_rms_t; +typedef struct hdsp_config_info hdsp_config_info_t; +typedef struct hdsp_firmware hdsp_firmware_t; +typedef struct hdsp_version hdsp_version_t; +typedef struct hdsp_mixer hdsp_mixer_t; +typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; #endif /* __SOUND_HDSP_H */ diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h index c34427ccd0b3..c3c854d99c28 100644 --- a/include/sound/hdspm.h +++ b/include/sound/hdspm.h @@ -25,8 +25,6 @@ /* -------------------- IOCTL Peak/RMS Meters -------------------- */ -typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t; - /* peam rms level structure like we get from hardware maybe in future we can memory map it so I just copy it @@ -36,7 +34,7 @@ typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t; (i asume so from the code) */ -struct _snd_hdspm_peak_rms { +struct hdspm_peak_rms { unsigned int level_offset[1024]; @@ -58,18 +56,16 @@ struct _snd_hdspm_peak_rms { unsigned int xxx_rms_h[64]; /* not used */ }; -struct sndrv_hdspm_peak_rms_ioctl { - hdspm_peak_rms_t *peak; +struct hdspm_peak_rms_ioctl { + struct hdspm_peak_rms *peak; }; /* use indirect access due to the limit of ioctl bit size */ -#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct sndrv_hdspm_peak_rms_ioctl) +#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdspm_peak_rms_ioctl) /* ------------ CONFIG block IOCTL ---------------------- */ -typedef struct _snd_hdspm_config_info hdspm_config_info_t; - -struct _snd_hdspm_config_info { +struct hdspm_config_info { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char madi_sync_check; @@ -83,18 +79,16 @@ struct _snd_hdspm_config_info { unsigned int analog_out; }; -#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdspm_config_info_t) +#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdspm_config_info) /* get Soundcard Version */ -typedef struct _snd_hdspm_version hdspm_version_t; - -struct _snd_hdspm_version { +struct hdspm_version { unsigned short firmware_rev; }; -#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, hdspm_version_t) +#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version) /* ------------- get Matrix Mixer IOCTL --------------- */ @@ -108,24 +102,27 @@ struct _snd_hdspm_version { #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS -typedef struct _snd_hdspm_channelfader snd_hdspm_channelfader_t; - -struct _snd_hdspm_channelfader { +struct hdspm_channelfader { unsigned int in[HDSPM_MIXER_CHANNELS]; unsigned int pb[HDSPM_MIXER_CHANNELS]; }; -typedef struct _snd_hdspm_mixer hdspm_mixer_t; - -struct _snd_hdspm_mixer { - snd_hdspm_channelfader_t ch[HDSPM_MIXER_CHANNELS]; +struct hdspm_mixer { + struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; }; -struct sndrv_hdspm_mixer_ioctl { - hdspm_mixer_t *mixer; +struct hdspm_mixer_ioctl { + struct hdspm_mixer *mixer; }; /* use indirect access due to the limit of ioctl bit size */ -#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct sndrv_hdspm_mixer_ioctl) +#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) + +/* typedefs for compatibility to user-space */ +typedef struct hdspm_peak_rms hdspm_peak_rms_t; +typedef struct hdspm_config_info hdspm_config_info_t; +typedef struct hdspm_version hdspm_version_t; +typedef struct hdspm_channelfader snd_hdspm_channelfader_t; +typedef struct hdspm_mixer hdspm_mixer_t; #endif /* __SOUND_HDSPM_H */ diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h index 043876348fa1..c679e5b31111 100644 --- a/include/sound/hwdep.h +++ b/include/sound/hwdep.h @@ -25,27 +25,25 @@ #include <sound/asound.h> #include <linux/poll.h> -typedef enum sndrv_hwdep_iface snd_hwdep_iface_t; -typedef struct sndrv_hwdep_info snd_hwdep_info_t; -typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t; -typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t; +struct snd_hwdep; -typedef struct _snd_hwdep_ops { - long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); - long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset); - long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset); - int (*open) (snd_hwdep_t * hw, struct file * file); - int (*release) (snd_hwdep_t * hw, struct file * file); - unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); - int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); - int (*ioctl_compat) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); - int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma); - int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status); - int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image); -} snd_hwdep_ops_t; +struct snd_hwdep_ops { + long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig); + long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset); + long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset); + int (*open) (struct snd_hwdep * hw, struct file * file); + int (*release) (struct snd_hwdep *hw, struct file * file); + unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait); + int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); + int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); + int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma); + int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status); + int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image); +}; -struct _snd_hwdep { - snd_card_t *card; +struct snd_hwdep { + struct snd_card *card; + struct list_head list; int device; char id[32]; char name[80]; @@ -57,10 +55,10 @@ struct _snd_hwdep { int ossreg; #endif - snd_hwdep_ops_t ops; + struct snd_hwdep_ops ops; wait_queue_head_t open_wait; void *private_data; - void (*private_free) (snd_hwdep_t *hwdep); + void (*private_free) (struct snd_hwdep *hwdep); struct semaphore open_mutex; int used; @@ -68,6 +66,7 @@ struct _snd_hwdep { unsigned int exclusive: 1; }; -extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep); +extern int snd_hwdep_new(struct snd_card *card, char *id, int device, + struct snd_hwdep **rhwdep); #endif /* __SOUND_HWDEP_H */ diff --git a/include/sound/i2c.h b/include/sound/i2c.h index a665ddf9c146..81eb23ed761f 100644 --- a/include/sound/i2c.h +++ b/include/sound/i2c.h @@ -21,82 +21,84 @@ * */ -typedef struct _snd_i2c_device snd_i2c_device_t; -typedef struct _snd_i2c_bus snd_i2c_bus_t; - #define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ -struct _snd_i2c_device { +struct snd_i2c_device { struct list_head list; - snd_i2c_bus_t *bus; /* I2C bus */ + struct snd_i2c_bus *bus; /* I2C bus */ char name[32]; /* some useful device name */ unsigned short flags; /* device flags */ unsigned short addr; /* device address (might be 10-bit) */ unsigned long private_value; void *private_data; - void (*private_free)(snd_i2c_device_t *device); + void (*private_free)(struct snd_i2c_device *device); +}; + +#define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list) + +struct snd_i2c_bit_ops { + void (*start)(struct snd_i2c_bus *bus); /* transfer start */ + void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */ + void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ + void (*setlines)(struct snd_i2c_bus *bus, int clock, int data); + int (*getclock)(struct snd_i2c_bus *bus); + int (*getdata)(struct snd_i2c_bus *bus, int ack); }; -#define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) - -typedef struct _snd_i2c_bit_ops { - void (*start)(snd_i2c_bus_t *bus); /* transfer start */ - void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ - void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ - void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); - int (*getclock)(snd_i2c_bus_t *bus); - int (*getdata)(snd_i2c_bus_t *bus, int ack); -} snd_i2c_bit_ops_t; - -typedef struct _snd_i2c_ops { - int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count); - int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count); - int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr); -} snd_i2c_ops_t; - -struct _snd_i2c_bus { - snd_card_t *card; /* card which I2C belongs to */ +struct snd_i2c_ops { + int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); + int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); + int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr); +}; + +struct snd_i2c_bus { + struct snd_card *card; /* card which I2C belongs to */ char name[32]; /* some useful label */ struct semaphore lock_mutex; - snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ + struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */ struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ struct list_head devices; /* attached devices to this bus */ union { - snd_i2c_bit_ops_t *bit; + struct snd_i2c_bit_ops *bit; void *ops; } hw_ops; /* lowlevel operations */ - snd_i2c_ops_t *ops; /* midlevel operations */ + struct snd_i2c_ops *ops; /* midlevel operations */ unsigned long private_value; void *private_data; - void (*private_free)(snd_i2c_bus_t *bus); + void (*private_free)(struct snd_i2c_bus *bus); }; -#define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) +#define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses) -int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); -int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); -int snd_i2c_device_free(snd_i2c_device_t *device); +int snd_i2c_bus_create(struct snd_card *card, const char *name, + struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c); +int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, + unsigned char addr, struct snd_i2c_device **rdevice); +int snd_i2c_device_free(struct snd_i2c_device *device); -static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { +static inline void snd_i2c_lock(struct snd_i2c_bus *bus) +{ if (bus->master) down(&bus->master->lock_mutex); else down(&bus->lock_mutex); } -static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) { + +static inline void snd_i2c_unlock(struct snd_i2c_bus *bus) +{ if (bus->master) up(&bus->master->lock_mutex); else up(&bus->lock_mutex); } -int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); +int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); +int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); +int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr); #endif /* __SOUND_I2C_H */ diff --git a/include/sound/info.h b/include/sound/info.h index 1d76bf3cb05e..8ea5c7497c03 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -34,8 +34,6 @@ struct snd_info_buffer { int error; /* error code */ }; -typedef struct snd_info_buffer snd_info_buffer_t; - #define SNDRV_INFO_CONTENT_TEXT 0 #define SNDRV_INFO_CONTENT_DATA 1 @@ -44,28 +42,28 @@ struct snd_info_entry; struct snd_info_entry_text { unsigned long read_size; unsigned long write_size; - void (*read) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); - void (*write) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); + void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); + void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); }; struct snd_info_entry_ops { - int (*open) (snd_info_entry_t *entry, + int (*open) (struct snd_info_entry *entry, unsigned short mode, void **file_private_data); - int (*release) (snd_info_entry_t * entry, + int (*release) (struct snd_info_entry * entry, unsigned short mode, void *file_private_data); - long (*read) (snd_info_entry_t *entry, void *file_private_data, + long (*read) (struct snd_info_entry *entry, void *file_private_data, struct file * file, char __user *buf, unsigned long count, unsigned long pos); - long (*write) (snd_info_entry_t *entry, void *file_private_data, + long (*write) (struct snd_info_entry *entry, void *file_private_data, struct file * file, const char __user *buf, unsigned long count, unsigned long pos); - long long (*llseek) (snd_info_entry_t *entry, void *file_private_data, + long long (*llseek) (struct snd_info_entry *entry, void *file_private_data, struct file * file, long long offset, int orig); - unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data, + unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data, struct file * file, poll_table * wait); - int (*ioctl) (snd_info_entry_t *entry, void *file_private_data, + int (*ioctl) (struct snd_info_entry *entry, void *file_private_data, struct file * file, unsigned int cmd, unsigned long arg); - int (*mmap) (snd_info_entry_t *entry, void *file_private_data, + int (*mmap) (struct snd_info_entry *entry, void *file_private_data, struct inode * inode, struct file * file, struct vm_area_struct * vma); }; @@ -80,20 +78,18 @@ struct snd_info_entry { struct snd_info_entry_text text; struct snd_info_entry_ops *ops; } c; - snd_info_entry_t *parent; - snd_card_t *card; + struct snd_info_entry *parent; + struct snd_card *card; struct module *module; void *private_data; - void (*private_free)(snd_info_entry_t *entry); + void (*private_free)(struct snd_info_entry *entry); struct proc_dir_entry *p; struct semaphore access; }; -extern int snd_info_check_reserved_words(const char *str); - #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) -extern int snd_info_minor_register(void); -extern int snd_info_minor_unregister(void); +int snd_info_minor_register(void); +int snd_info_minor_unregister(void); #else #define snd_info_minor_register() /* NOP */ #define snd_info_minor_unregister() /* NOP */ @@ -102,72 +98,79 @@ extern int snd_info_minor_unregister(void); #ifdef CONFIG_PROC_FS -extern snd_info_entry_t *snd_seq_root; +extern struct snd_info_entry *snd_seq_root; #ifdef CONFIG_SND_OSSEMUL -extern snd_info_entry_t *snd_oss_root; +extern struct snd_info_entry *snd_oss_root; #else #define snd_oss_root NULL #endif -int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); +int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); int snd_info_init(void); int snd_info_done(void); -int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len); +int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len); char *snd_info_get_str(char *dest, char *src, int len); -snd_info_entry_t *snd_info_create_module_entry(struct module * module, +struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, - snd_info_entry_t * parent); -snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, + struct snd_info_entry * parent); +struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, - snd_info_entry_t * parent); -void snd_info_free_entry(snd_info_entry_t * entry); -int snd_info_store_text(snd_info_entry_t * entry); -int snd_info_restore_text(snd_info_entry_t * entry); + struct snd_info_entry * parent); +void snd_info_free_entry(struct snd_info_entry * entry); +int snd_info_store_text(struct snd_info_entry * entry); +int snd_info_restore_text(struct snd_info_entry * entry); -int snd_info_card_create(snd_card_t * card); -int snd_info_card_register(snd_card_t * card); -int snd_info_card_free(snd_card_t * card); -int snd_info_register(snd_info_entry_t * entry); -int snd_info_unregister(snd_info_entry_t * entry); +int snd_info_card_create(struct snd_card * card); +int snd_info_card_register(struct snd_card * card); +int snd_info_card_free(struct snd_card * card); +int snd_info_register(struct snd_info_entry * entry); +int snd_info_unregister(struct snd_info_entry * entry); /* for card drivers */ -int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp); +int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); -static inline void snd_info_set_text_ops(snd_info_entry_t *entry, +static inline void snd_info_set_text_ops(struct snd_info_entry *entry, void *private_data, long read_size, - void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) + void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) { entry->private_data = private_data; entry->c.text.read_size = read_size; entry->c.text.read = read; } +int snd_info_check_reserved_words(const char *str); #else #define snd_seq_root NULL #define snd_oss_root NULL -static inline int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) { return 0; } +static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; } static inline int snd_info_init(void) { return 0; } static inline int snd_info_done(void) { return 0; } -static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; } +static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; } static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } -static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; } -static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; } -static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; } - -static inline int snd_info_card_create(snd_card_t * card) { return 0; } -static inline int snd_info_card_register(snd_card_t * card) { return 0; } -static inline int snd_info_card_free(snd_card_t * card) { return 0; } -static inline int snd_info_register(snd_info_entry_t * entry) { return 0; } -static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } +static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; } +static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; } +static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; } + +static inline int snd_info_card_create(struct snd_card * card) { return 0; } +static inline int snd_info_card_register(struct snd_card * card) { return 0; } +static inline int snd_info_card_free(struct snd_card * card) { return 0; } +static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } +static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; } + +static inline int snd_card_proc_new(struct snd_card *card, const char *name, + struct snd_info_entry **entryp) { return -EINVAL; } +static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)), + void *private_data, + long read_size, + void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {} -#define snd_card_proc_new(card,name,entryp) 0 /* always success */ -#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/ +static inline int snd_info_check_reserved_words(const char *str) { return 1; } #endif @@ -185,7 +188,7 @@ static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } #define SNDRV_OSS_INFO_DEV_COUNT 6 -extern int snd_oss_info_register(int dev, int num, char *string); +int snd_oss_info_register(int dev, int num, char *string); #define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) #endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */ diff --git a/include/sound/initval.h b/include/sound/initval.h index 2bf1508825a4..d29e3d31d149 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -50,20 +50,6 @@ #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR -#ifdef SNDRV_LEGACY_AUTO_PROBE -static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port)) -{ - int result = 0; /* number of detected cards */ - - while ((signed long)*ports != -1) { - if (probe(*ports) >= 0) - result++; - ports++; - } - return result; -} -#endif - #ifdef SNDRV_LEGACY_FIND_FREE_IRQ #include <linux/interrupt.h> diff --git a/include/sound/minors.h b/include/sound/minors.h index a17b5c9961bb..46bcd2023ed8 100644 --- a/include/sound/minors.h +++ b/include/sound/minors.h @@ -26,18 +26,20 @@ #define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) #define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) -#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ +/* these minors can still be used for autoloading devices (/dev/aload*) */ +#define SNDRV_MINOR_CONTROL 0 /* 0 */ #define SNDRV_MINOR_GLOBAL 1 /* 1 */ #define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32) #define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32) + +#ifndef CONFIG_SND_DYNAMIC_MINORS + /* 2 - 3 (reserved) */ #define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ -#define SNDRV_MINOR_HWDEPS 4 #define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ -#define SNDRV_MINOR_RAWMIDIS 8 #define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ #define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */ -#define SNDRV_MINOR_PCMS 8 +/* same as first respective minor number to make minor allocation easier */ #define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL #define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP #define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI @@ -46,6 +48,25 @@ #define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER #define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER +#else /* CONFIG_SND_DYNAMIC_MINORS */ + +enum { + SNDRV_DEVICE_TYPE_CONTROL, + SNDRV_DEVICE_TYPE_SEQUENCER, + SNDRV_DEVICE_TYPE_TIMER, + SNDRV_DEVICE_TYPE_HWDEP, + SNDRV_DEVICE_TYPE_RAWMIDI, + SNDRV_DEVICE_TYPE_PCM_PLAYBACK, + SNDRV_DEVICE_TYPE_PCM_CAPTURE, +}; + +#endif /* CONFIG_SND_DYNAMIC_MINORS */ + +#define SNDRV_MINOR_HWDEPS 4 +#define SNDRV_MINOR_RAWMIDIS 8 +#define SNDRV_MINOR_PCMS 8 + + #ifdef CONFIG_SND_OSSEMUL #define SNDRV_MINOR_OSS_DEVICES 16 diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h index ed75b2fb00ab..ca5b4822b62c 100644 --- a/include/sound/mixer_oss.h +++ b/include/sound/mixer_oss.h @@ -24,51 +24,53 @@ #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) -typedef struct _snd_oss_mixer_slot snd_mixer_oss_slot_t; -typedef struct _snd_oss_file snd_mixer_oss_file_t; - -typedef int (*snd_mixer_oss_get_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *left, int *right); -typedef int (*snd_mixer_oss_put_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int left, int right); -typedef int (*snd_mixer_oss_get_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *active); -typedef int (*snd_mixer_oss_put_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int active); -typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int *active_index); -typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int active_index); - #define SNDRV_OSS_MAX_MIXERS 32 -struct _snd_oss_mixer_slot { +struct snd_mixer_oss_file; + +struct snd_mixer_oss_slot { int number; unsigned int stereo: 1; - snd_mixer_oss_get_volume_t get_volume; - snd_mixer_oss_put_volume_t put_volume; - snd_mixer_oss_get_recsrc_t get_recsrc; - snd_mixer_oss_put_recsrc_t put_recsrc; + int (*get_volume)(struct snd_mixer_oss_file *fmixer, + struct snd_mixer_oss_slot *chn, + int *left, int *right); + int (*put_volume)(struct snd_mixer_oss_file *fmixer, + struct snd_mixer_oss_slot *chn, + int left, int right); + int (*get_recsrc)(struct snd_mixer_oss_file *fmixer, + struct snd_mixer_oss_slot *chn, + int *active); + int (*put_recsrc)(struct snd_mixer_oss_file *fmixer, + struct snd_mixer_oss_slot *chn, + int active); unsigned long private_value; void *private_data; - void (*private_free)(snd_mixer_oss_slot_t *slot); + void (*private_free)(struct snd_mixer_oss_slot *slot); int volume[2]; }; -struct _snd_oss_mixer { - snd_card_t *card; +struct snd_mixer_oss { + struct snd_card *card; char id[16]; char name[32]; - snd_mixer_oss_slot_t slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */ + struct snd_mixer_oss_slot slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */ unsigned int mask_recsrc; /* exclusive recsrc mask */ - snd_mixer_oss_get_recsrce_t get_recsrc; - snd_mixer_oss_put_recsrce_t put_recsrc; + int (*get_recsrc)(struct snd_mixer_oss_file *fmixer, + unsigned int *active_index); + int (*put_recsrc)(struct snd_mixer_oss_file *fmixer, + unsigned int active_index); void *private_data_recsrc; - void (*private_free_recsrc)(snd_mixer_oss_t *mixer); + void (*private_free_recsrc)(struct snd_mixer_oss *mixer); struct semaphore reg_mutex; - snd_info_entry_t *proc_entry; + struct snd_info_entry *proc_entry; int oss_dev_alloc; /* --- */ int oss_recsrc; }; -struct _snd_oss_file { - snd_card_t *card; - snd_mixer_oss_t *mixer; +struct snd_mixer_oss_file { + struct snd_card *card; + struct snd_mixer_oss *mixer; }; #endif /* CONFIG_SND_MIXER_OSS */ diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h index ae39e38bf996..8e97ace78f16 100644 --- a/include/sound/mpu401.h +++ b/include/sound/mpu401.h @@ -58,10 +58,8 @@ #define MPU401_MODE_INPUT_TIMER (1<<0) #define MPU401_MODE_OUTPUT_TIMER (1<<1) -typedef struct _snd_mpu401 mpu401_t; - -struct _snd_mpu401 { - snd_rawmidi_t *rmidi; +struct snd_mpu401 { + struct snd_rawmidi *rmidi; unsigned short hardware; /* MPU401_HW_XXXX */ unsigned long port; /* base port of MPU-401 chip */ @@ -73,14 +71,14 @@ struct _snd_mpu401 { unsigned long mode; /* MPU401_MODE_XXXX */ int timer_invoked; - int (*open_input) (mpu401_t * mpu); - void (*close_input) (mpu401_t * mpu); - int (*open_output) (mpu401_t * mpu); - void (*close_output) (mpu401_t * mpu); + int (*open_input) (struct snd_mpu401 * mpu); + void (*close_input) (struct snd_mpu401 * mpu); + int (*open_output) (struct snd_mpu401 * mpu); + void (*close_output) (struct snd_mpu401 * mpu); void *private_data; - snd_rawmidi_substream_t *substream_input; - snd_rawmidi_substream_t *substream_output; + struct snd_rawmidi_substream *substream_input; + struct snd_rawmidi_substream *substream_output; spinlock_t input_lock; spinlock_t output_lock; @@ -88,8 +86,8 @@ struct _snd_mpu401 { struct timer_list timer; - void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); - unsigned char (*read) (mpu401_t * mpu, unsigned long addr); + void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr); + unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr); }; /* I/O ports */ @@ -103,13 +101,13 @@ struct _snd_mpu401 { irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); -int snd_mpu401_uart_new(snd_card_t * card, +int snd_mpu401_uart_new(struct snd_card *card, int device, unsigned short hardware, unsigned long port, int integrated, int irq, int irq_flags, - snd_rawmidi_t ** rrawmidi); + struct snd_rawmidi ** rrawmidi); #endif /* __SOUND_MPU401_H */ diff --git a/include/sound/opl3.h b/include/sound/opl3.h index 19f657d4fc06..83392641cb47 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h @@ -237,12 +237,12 @@ #define MAX_OPL2_VOICES 9 #define MAX_OPL3_VOICES 18 -typedef struct snd_opl3 opl3_t; +struct snd_opl3; /* * A structure to keep track of each hardware voice */ -typedef struct snd_opl3_voice { +struct snd_opl3_voice { int state; /* status */ #define SNDRV_OPL3_ST_OFF 0 /* Not playing */ #define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */ @@ -257,8 +257,8 @@ typedef struct snd_opl3_voice { unsigned char keyon_reg; /* KON register shadow */ - snd_midi_channel_t *chan; /* Midi channel for this note */ -} snd_opl3_voice_t; + struct snd_midi_channel *chan; /* Midi channel for this note */ +}; struct snd_opl3 { unsigned long l_port; @@ -267,18 +267,18 @@ struct snd_opl3 { struct resource *res_r_port; unsigned short hardware; /* hardware access */ - void (*command) (opl3_t * opl3, unsigned short cmd, unsigned char val); + void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val); unsigned short timer_enable; int seq_dev_num; /* sequencer device number */ - snd_timer_t *timer1; - snd_timer_t *timer2; + struct snd_timer *timer1; + struct snd_timer *timer2; spinlock_t timer_lock; void *private_data; - void (*private_free)(opl3_t *); + void (*private_free)(struct snd_opl3 *); spinlock_t reg_lock; - snd_card_t *card; /* The card that this belongs to */ + struct snd_card *card; /* The card that this belongs to */ int used; /* usage flag - exclusive */ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ unsigned char rhythm; /* percussion mode flag */ @@ -289,18 +289,18 @@ struct snd_opl3 { int synth_mode; /* synth mode */ int seq_client; - snd_seq_device_t *seq_dev; /* sequencer device */ - snd_midi_channel_set_t * chset; + struct snd_seq_device *seq_dev; /* sequencer device */ + struct snd_midi_channel_set * chset; #ifdef CONFIG_SND_SEQUENCER_OSS - snd_seq_device_t *oss_seq_dev; /* OSS sequencer device */ - snd_midi_channel_set_t * oss_chset; + struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */ + struct snd_midi_channel_set * oss_chset; #endif - snd_seq_kinstr_ops_t fm_ops; - snd_seq_kinstr_list_t *ilist; + struct snd_seq_kinstr_ops fm_ops; + struct snd_seq_kinstr_list *ilist; - snd_opl3_voice_t voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ + struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ int use_time; /* allocation counter */ unsigned short connection_reg; /* connection reg shadow */ @@ -316,24 +316,25 @@ struct snd_opl3 { }; /* opl3.c */ -void snd_opl3_interrupt(snd_hwdep_t * hw); -int snd_opl3_new(snd_card_t *card, unsigned short hardware, opl3_t **ropl3); -int snd_opl3_init(opl3_t *opl3); -int snd_opl3_create(snd_card_t * card, +void snd_opl3_interrupt(struct snd_hwdep * hw); +int snd_opl3_new(struct snd_card *card, unsigned short hardware, + struct snd_opl3 **ropl3); +int snd_opl3_init(struct snd_opl3 *opl3); +int snd_opl3_create(struct snd_card *card, unsigned long l_port, unsigned long r_port, unsigned short hardware, int integrated, - opl3_t ** opl3); -int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev); -int snd_opl3_hwdep_new(opl3_t * opl3, int device, int seq_device, - snd_hwdep_t ** rhwdep); + struct snd_opl3 ** opl3); +int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev); +int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device, + struct snd_hwdep ** rhwdep); /* opl3_synth */ -int snd_opl3_open(snd_hwdep_t * hw, struct file *file); -int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, +int snd_opl3_open(struct snd_hwdep * hw, struct file *file); +int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg); -int snd_opl3_release(snd_hwdep_t * hw, struct file *file); +int snd_opl3_release(struct snd_hwdep * hw, struct file *file); -void snd_opl3_reset(opl3_t * opl3); +void snd_opl3_reset(struct snd_opl3 * opl3); #endif /* __SOUND_OPL3_H */ diff --git a/include/sound/opl4.h b/include/sound/opl4.h index 20c04428b139..60ae8454b3ce 100644 --- a/include/sound/opl4.h +++ b/include/sound/opl4.h @@ -22,11 +22,11 @@ #include <sound/opl3.h> -typedef struct opl4 opl4_t; +struct snd_opl4; -extern int snd_opl4_create(snd_card_t *card, +extern int snd_opl4_create(struct snd_card *card, unsigned long fm_port, unsigned long pcm_port, int seq_device, - opl3_t **opl3, opl4_t **opl4); + struct snd_opl3 **opl3, struct snd_opl4 **opl4); #endif /* __SOUND_OPL4_H */ diff --git a/include/sound/pcm-indirect.h b/include/sound/pcm-indirect.h index 31fa7a54508a..7003d7702e26 100644 --- a/include/sound/pcm-indirect.h +++ b/include/sound/pcm-indirect.h @@ -24,7 +24,7 @@ #include <sound/pcm.h> -typedef struct sndrv_pcm_indirect { +struct snd_pcm_indirect { unsigned int hw_buffer_size; /* Byte size of hardware buffer */ unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */ unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ @@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect { unsigned int sw_io; /* Current software pointer in bytes */ int sw_ready; /* Bytes ready to be transferred to/from hw */ snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */ -} snd_pcm_indirect_t; +}; -typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream, - snd_pcm_indirect_t *rec, size_t bytes); +typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream, + struct snd_pcm_indirect *rec, size_t bytes); /* * helper function for playback ack callback */ static inline void -snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, - snd_pcm_indirect_t *rec, +snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream, + struct snd_pcm_indirect *rec, snd_pcm_indirect_copy_t copy) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; int qsize; @@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, * ptr = current byte pointer */ static inline snd_pcm_uframes_t -snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, - snd_pcm_indirect_t *rec, unsigned int ptr) +snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream, + struct snd_pcm_indirect *rec, unsigned int ptr) { int bytes = ptr - rec->hw_io; if (bytes < 0) @@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, * helper function for capture ack callback */ static inline void -snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, - snd_pcm_indirect_t *rec, +snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream, + struct snd_pcm_indirect *rec, snd_pcm_indirect_copy_t copy) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; @@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, * ptr = current byte pointer */ static inline snd_pcm_uframes_t -snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream, - snd_pcm_indirect_t *rec, unsigned int ptr) +snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream, + struct snd_pcm_indirect *rec, unsigned int ptr) { int qsize; int bytes = ptr - rec->hw_io; diff --git a/include/sound/pcm.h b/include/sound/pcm.h index acc4fa9d5abe..314268a11048 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -28,36 +28,9 @@ #include <linux/poll.h> #include <linux/bitops.h> -typedef sndrv_pcm_uframes_t snd_pcm_uframes_t; -typedef sndrv_pcm_sframes_t snd_pcm_sframes_t; -typedef enum sndrv_pcm_class snd_pcm_class_t; -typedef enum sndrv_pcm_subclass snd_pcm_subclass_t; -typedef enum sndrv_pcm_stream snd_pcm_stream_t; -typedef enum sndrv_pcm_access snd_pcm_access_t; -typedef enum sndrv_pcm_format snd_pcm_format_t; -typedef enum sndrv_pcm_subformat snd_pcm_subformat_t; -typedef enum sndrv_pcm_state snd_pcm_state_t; -typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t; -typedef struct sndrv_pcm_info snd_pcm_info_t; -typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t; -typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t; -typedef enum sndrv_pcm_start snd_pcm_start_t; -typedef enum sndrv_pcm_xrun snd_pcm_xrun_t; -typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t; -typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t; -typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t; -typedef struct sndrv_pcm_status snd_pcm_status_t; -typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t; -typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t; -typedef struct sndrv_mask snd_mask_t; -typedef struct snd_sg_buf snd_pcm_sgbuf_t; - #define snd_pcm_substream_chip(substream) ((substream)->private_data) #define snd_pcm_chip(pcm) ((pcm)->private_data) -typedef struct _snd_pcm_file snd_pcm_file_t; -typedef struct _snd_pcm_runtime snd_pcm_runtime_t; - #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #include "pcm_oss.h" #endif @@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t; * Hardware (lowlevel) section */ -typedef struct _snd_pcm_hardware { +struct snd_pcm_hardware { unsigned int info; /* SNDRV_PCM_INFO_* */ u64 formats; /* SNDRV_PCM_FMTBIT_* */ unsigned int rates; /* SNDRV_PCM_RATE_* */ @@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware { unsigned int periods_min; /* min # of periods */ unsigned int periods_max; /* max # of periods */ size_t fifo_size; /* fifo size in bytes */ -} snd_pcm_hardware_t; +}; -typedef struct _snd_pcm_ops { - int (*open)(snd_pcm_substream_t *substream); - int (*close)(snd_pcm_substream_t *substream); - int (*ioctl)(snd_pcm_substream_t * substream, +struct snd_pcm_ops { + int (*open)(struct snd_pcm_substream *substream); + int (*close)(struct snd_pcm_substream *substream); + int (*ioctl)(struct snd_pcm_substream * substream, unsigned int cmd, void *arg); - int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params); - int (*hw_free)(snd_pcm_substream_t *substream); - int (*prepare)(snd_pcm_substream_t * substream); - int (*trigger)(snd_pcm_substream_t * substream, int cmd); - snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); - int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, + int (*hw_params)(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params); + int (*hw_free)(struct snd_pcm_substream *substream); + int (*prepare)(struct snd_pcm_substream *substream); + int (*trigger)(struct snd_pcm_substream *substream, int cmd); + snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); + int (*copy)(struct snd_pcm_substream *substream, int channel, + snd_pcm_uframes_t pos, void __user *buf, snd_pcm_uframes_t count); - int (*silence)(snd_pcm_substream_t *substream, int channel, + int (*silence)(struct snd_pcm_substream *substream, int channel, snd_pcm_uframes_t pos, snd_pcm_uframes_t count); - struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); - int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma); - int (*ack)(snd_pcm_substream_t *substream); -} snd_pcm_ops_t; + struct page *(*page)(struct snd_pcm_substream *substream, + unsigned long offset); + int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma); + int (*ack)(struct snd_pcm_substream *substream); +}; /* * @@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops { #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE #endif -struct _snd_pcm_file { - snd_pcm_substream_t * substream; - struct _snd_pcm_file * next; +struct snd_pcm_file { + struct snd_pcm_substream *substream; + struct snd_pcm_file *next; }; -typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t; +struct snd_pcm_hw_rule; +typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule); -typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule); - -struct _snd_pcm_hw_rule { +struct snd_pcm_hw_rule { unsigned int cond; snd_pcm_hw_rule_func_t func; int var; @@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule { void *private; }; -typedef struct _snd_pcm_hw_constraints { - snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - +struct snd_pcm_hw_constraints { + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; - snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - + struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; unsigned int rules_num; unsigned int rules_all; - snd_pcm_hw_rule_t *rules; -} snd_pcm_hw_constraints_t; + struct snd_pcm_hw_rule *rules; +}; -static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, - snd_pcm_hw_param_t var) +static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs, + snd_pcm_hw_param_t var) { return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } -static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs, - snd_pcm_hw_param_t var) +static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs, + snd_pcm_hw_param_t var) { return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } -typedef struct { +struct snd_ratnum { unsigned int num; unsigned int den_min, den_max, den_step; -} ratnum_t; +}; -typedef struct { +struct snd_ratden { unsigned int num_min, num_max, num_step; unsigned int den; -} ratden_t; +}; -typedef struct { +struct snd_pcm_hw_constraint_ratnums { int nrats; - ratnum_t *rats; -} snd_pcm_hw_constraint_ratnums_t; + struct snd_ratnum *rats; +}; -typedef struct { +struct snd_pcm_hw_constraint_ratdens { int nrats; - ratden_t *rats; -} snd_pcm_hw_constraint_ratdens_t; + struct snd_ratden *rats; +}; -typedef struct { +struct snd_pcm_hw_constraint_list { unsigned int count; unsigned int *list; unsigned int mask; -} snd_pcm_hw_constraint_list_t; +}; -struct _snd_pcm_runtime { +struct snd_pcm_runtime { /* -- Status -- */ - snd_pcm_substream_t *trigger_master; + struct snd_pcm_substream *trigger_master; struct timespec trigger_tstamp; /* trigger timestamp */ int overrange; snd_pcm_uframes_t avail_max; @@ -306,7 +281,7 @@ struct _snd_pcm_runtime { unsigned int rate_den; /* -- SW params -- */ - snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ + int tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ @@ -320,11 +295,11 @@ struct _snd_pcm_runtime { snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ snd_pcm_uframes_t silence_filled; /* size filled with silence */ - snd_pcm_sync_id_t sync; /* hardware synchronization ID */ + union snd_pcm_sync_id sync; /* hardware synchronization ID */ /* -- mmap -- */ - volatile snd_pcm_mmap_status_t *status; - volatile snd_pcm_mmap_control_t *control; + volatile struct snd_pcm_mmap_status *status; + volatile struct snd_pcm_mmap_control *control; atomic_t mmap_count; /* -- locking / scheduling -- */ @@ -334,15 +309,15 @@ struct _snd_pcm_runtime { /* -- private section -- */ void *private_data; - void (*private_free)(snd_pcm_runtime_t *runtime); + void (*private_free)(struct snd_pcm_runtime *runtime); /* -- hardware description -- */ - snd_pcm_hardware_t hw; - snd_pcm_hw_constraints_t hw_constraints; + struct snd_pcm_hardware hw; + struct snd_pcm_hw_constraints hw_constraints; /* -- interrupt callbacks -- */ - void (*transfer_ack_begin)(snd_pcm_substream_t *substream); - void (*transfer_ack_end)(snd_pcm_substream_t *substream); + void (*transfer_ack_begin)(struct snd_pcm_substream *substream); + void (*transfer_ack_end)(struct snd_pcm_substream *substream); /* -- timer -- */ unsigned int timer_resolution; /* timer resolution */ @@ -356,19 +331,19 @@ struct _snd_pcm_runtime { #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) /* -- OSS things -- */ - snd_pcm_oss_runtime_t oss; + struct snd_pcm_oss_runtime oss; #endif }; -typedef struct _snd_pcm_group { /* keep linked substreams */ +struct snd_pcm_group { /* keep linked substreams */ spinlock_t lock; struct list_head substreams; int count; -} snd_pcm_group_t; +}; -struct _snd_pcm_substream { - snd_pcm_t *pcm; - snd_pcm_str_t *pstr; +struct snd_pcm_substream { + struct snd_pcm *pcm; + struct snd_pcm_str *pstr; void *private_data; /* copied from pcm->private_data */ int number; char name[32]; /* substream name */ @@ -378,32 +353,32 @@ struct _snd_pcm_substream { unsigned int dma_buf_id; size_t dma_max; /* -- hardware operations -- */ - snd_pcm_ops_t *ops; + struct snd_pcm_ops *ops; /* -- runtime information -- */ - snd_pcm_runtime_t *runtime; + struct snd_pcm_runtime *runtime; /* -- timer section -- */ - snd_timer_t *timer; /* timer */ + struct snd_timer *timer; /* timer */ unsigned timer_running: 1; /* time is running */ spinlock_t timer_lock; /* -- next substream -- */ - snd_pcm_substream_t *next; + struct snd_pcm_substream *next; /* -- linked substreams -- */ struct list_head link_list; /* linked list member */ - snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */ - snd_pcm_group_t *group; /* pointer to current group */ + struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ + struct snd_pcm_group *group; /* pointer to current group */ /* -- assigned files -- */ - snd_pcm_file_t *file; + struct snd_pcm_file *file; struct file *ffile; #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) /* -- OSS things -- */ - snd_pcm_oss_substream_t oss; + struct snd_pcm_oss_substream oss; #endif - snd_info_entry_t *proc_root; - snd_info_entry_t *proc_info_entry; - snd_info_entry_t *proc_hw_params_entry; - snd_info_entry_t *proc_sw_params_entry; - snd_info_entry_t *proc_status_entry; - snd_info_entry_t *proc_prealloc_entry; + struct snd_info_entry *proc_root; + struct snd_info_entry *proc_info_entry; + struct snd_info_entry *proc_hw_params_entry; + struct snd_info_entry *proc_sw_params_entry; + struct snd_info_entry *proc_status_entry; + struct snd_info_entry *proc_prealloc_entry; /* misc flags */ unsigned int no_mmap_ctrl: 1; }; @@ -415,65 +390,64 @@ struct _snd_pcm_substream { #endif -struct _snd_pcm_str { +struct snd_pcm_str { int stream; /* stream (direction) */ - snd_pcm_t *pcm; + struct snd_pcm *pcm; /* -- substreams -- */ unsigned int substream_count; unsigned int substream_opened; - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) /* -- OSS things -- */ - snd_pcm_oss_stream_t oss; + struct snd_pcm_oss_stream oss; #endif - snd_pcm_file_t *files; - snd_minor_t *reg; - snd_info_entry_t *proc_root; - snd_info_entry_t *proc_info_entry; + struct snd_pcm_file *files; + struct snd_info_entry *proc_root; + struct snd_info_entry *proc_info_entry; #ifdef CONFIG_SND_DEBUG unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ - snd_info_entry_t *proc_xrun_debug_entry; + struct snd_info_entry *proc_xrun_debug_entry; #endif }; -struct _snd_pcm { - snd_card_t *card; +struct snd_pcm { + struct snd_card *card; + struct list_head list; unsigned int device; /* device number */ unsigned int info_flags; unsigned short dev_class; unsigned short dev_subclass; char id[64]; char name[80]; - snd_pcm_str_t streams[2]; + struct snd_pcm_str streams[2]; struct semaphore open_mutex; wait_queue_head_t open_wait; void *private_data; - void (*private_free) (snd_pcm_t *pcm); + void (*private_free) (struct snd_pcm *pcm); #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) - snd_pcm_oss_t oss; + struct snd_pcm_oss oss; #endif }; -typedef struct _snd_pcm_notify { - int (*n_register) (snd_pcm_t * pcm); - int (*n_disconnect) (snd_pcm_t * pcm); - int (*n_unregister) (snd_pcm_t * pcm); +struct snd_pcm_notify { + int (*n_register) (struct snd_pcm * pcm); + int (*n_disconnect) (struct snd_pcm * pcm); + int (*n_unregister) (struct snd_pcm * pcm); struct list_head list; -} snd_pcm_notify_t; +}; /* * Registering */ -extern snd_pcm_t *snd_pcm_devices[]; -extern snd_minor_t snd_pcm_reg[2]; +extern struct file_operations snd_pcm_f_ops[2]; -int snd_pcm_new(snd_card_t * card, char *id, int device, +int snd_pcm_new(struct snd_card *card, char *id, int device, int playback_count, int capture_count, - snd_pcm_t **rpcm); -int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count); + struct snd_pcm **rpcm); +int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); -int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); +int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); /* * Native I/O @@ -481,24 +455,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); extern rwlock_t snd_pcm_link_rwlock; -int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); -int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); -int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); -int snd_pcm_prepare(snd_pcm_substream_t *substream); -int snd_pcm_start(snd_pcm_substream_t *substream); -int snd_pcm_stop(snd_pcm_substream_t *substream, int status); -int snd_pcm_drain_done(snd_pcm_substream_t *substream); +int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); +int snd_pcm_info_user(struct snd_pcm_substream *substream, + struct snd_pcm_info __user *info); +int snd_pcm_status(struct snd_pcm_substream *substream, + struct snd_pcm_status *status); +int snd_pcm_prepare(struct snd_pcm_substream *substream); +int snd_pcm_start(struct snd_pcm_substream *substream); +int snd_pcm_stop(struct snd_pcm_substream *substream, int status); +int snd_pcm_drain_done(struct snd_pcm_substream *substream); #ifdef CONFIG_PM -int snd_pcm_suspend(snd_pcm_substream_t *substream); -int snd_pcm_suspend_all(snd_pcm_t *pcm); +int snd_pcm_suspend(struct snd_pcm_substream *substream); +int snd_pcm_suspend_all(struct snd_pcm *pcm); #endif -int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); -int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); -int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); -int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream); -void snd_pcm_release_substream(snd_pcm_substream_t *substream); +int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); +int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); +int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); +int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream); +void snd_pcm_release_substream(struct snd_pcm_substream *substream); void snd_pcm_vma_notify_data(void *client, void *data); -int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area); +int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); #if BITS_PER_LONG >= 64 @@ -578,30 +554,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) * PCM library */ -static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream) +static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) { return substream->group != &substream->self_group; } -static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream) +static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) { read_lock(&snd_pcm_link_rwlock); spin_lock(&substream->self_group.lock); } -static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream) +static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) { spin_unlock(&substream->self_group.lock); read_unlock(&snd_pcm_link_rwlock); } -static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream) +static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) { read_lock_irq(&snd_pcm_link_rwlock); spin_lock(&substream->self_group.lock); } -static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream) +static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) { spin_unlock(&substream->self_group.lock); read_unlock_irq(&snd_pcm_link_rwlock); @@ -623,56 +599,56 @@ do { \ list_for_each(pos, &substream->group->substreams) #define snd_pcm_group_substream_entry(pos) \ - list_entry(pos, snd_pcm_substream_t, link_list) + list_entry(pos, struct snd_pcm_substream, link_list) -static inline int snd_pcm_running(snd_pcm_substream_t *substream) +static inline int snd_pcm_running(struct snd_pcm_substream *substream) { return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); } -static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size) +static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) { return size * 8 / runtime->sample_bits; } -static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size) +static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) { return size * 8 / runtime->frame_bits; } -static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size) +static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) { return size * runtime->sample_bits / 8; } -static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size) +static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) { return size * runtime->frame_bits / 8; } -static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes) +static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) { return bytes % runtime->byte_align == 0; } -static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream) +static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return frames_to_bytes(runtime, runtime->buffer_size); } -static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream) +static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return frames_to_bytes(runtime, runtime->period_size); } /* * result is: 0 ... (boundary - 1) */ -static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime) +static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) { snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; if (avail < 0) @@ -685,7 +661,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim /* * result is: 0 ... (boundary - 1) */ -static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime) +static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) { snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; if (avail < 0) @@ -693,12 +669,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime return avail; } -static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime) +static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) { return runtime->buffer_size - snd_pcm_playback_avail(runtime); } -static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime) +static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) { return runtime->buffer_size - snd_pcm_capture_avail(runtime); } @@ -711,9 +687,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt * * Returns non-zero if available, or zero if not. */ -static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) +static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; } @@ -725,9 +701,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) * * Returns non-zero if available, or zero if not. */ -static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) +static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; } @@ -740,9 +716,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) * * Returns non-zero if exists, or zero if not. */ -static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) +static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; if (runtime->stop_threshold >= runtime->boundary) return 1; @@ -757,9 +733,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) * * Returns non-zero if empty, or zero if not. */ -static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) +static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; } @@ -771,14 +747,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) * * Returns non-zero if empty, or zero if not. */ -static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream) +static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; return snd_pcm_capture_avail(runtime) == 0; } -static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream, - snd_pcm_substream_t *master) +static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, + struct snd_pcm_substream *master) { substream->runtime->trigger_master = master; } @@ -795,28 +771,28 @@ static inline int hw_is_interval(int var) var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; } -static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, +static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } -static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, +static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } -static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params, +static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var); + return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var); } -static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params, +static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); + return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var); } #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) @@ -832,66 +808,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_ #define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min -int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); -void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); -void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); -void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, - unsigned int k, snd_interval_t *c); -void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, - const snd_interval_t *b, snd_interval_t *c); -int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask); -int snd_interval_ratnum(snd_interval_t *i, - unsigned int rats_count, ratnum_t *rats, +int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); +void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); +void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); +void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, + unsigned int k, struct snd_interval *c); +void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, + const struct snd_interval *b, struct snd_interval *c); +int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); +int snd_interval_ratnum(struct snd_interval *i, + unsigned int rats_count, struct snd_ratnum *rats, unsigned int *nump, unsigned int *denp); -void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); -void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); -int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, - snd_pcm_hw_params_t *params, +void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); +void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); +int snd_pcm_hw_param_near(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, unsigned int val, int *dir); -int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, - snd_pcm_hw_params_t *params, +int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, unsigned int val, int dir); -int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); +int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); -int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); +int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); -int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); -int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); +int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream); +int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream); -int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, +int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, u_int32_t mask); -int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, +int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, u_int64_t mask); -int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, +int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsigned int min, unsigned int max); -int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); -int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, +int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var); +int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, - snd_pcm_hw_constraint_list_t *l); -int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, + struct snd_pcm_hw_constraint_list *l); +int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, - snd_pcm_hw_constraint_ratnums_t *r); -int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, + struct snd_pcm_hw_constraint_ratnums *r); +int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, - snd_pcm_hw_constraint_ratdens_t *r); -int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, + struct snd_pcm_hw_constraint_ratdens *r); +int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsigned int cond, unsigned int width, unsigned int msbits); -int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, +int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, unsigned long step); -int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, +int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var); -int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, +int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, int var, snd_pcm_hw_rule_func_t func, void *private, @@ -925,37 +901,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); const char *snd_pcm_format_name(snd_pcm_format_t format); -void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops); -void snd_pcm_set_sync(snd_pcm_substream_t * substream); -int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream); -int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, +void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); +void snd_pcm_set_sync(struct snd_pcm_substream *substream); +int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); +int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); -int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream); -int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream); -int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream); -int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream); -int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream); -void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr); -void snd_pcm_tick_prepare(snd_pcm_substream_t *substream); -void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks); -void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); -void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); -snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, +int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); +int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream); +int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); +int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); +int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); +void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); +void snd_pcm_tick_prepare(struct snd_pcm_substream *substream); +void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks); +void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream); +void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); +snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, snd_pcm_uframes_t frames); -snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, +snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __user *buf, snd_pcm_uframes_t frames); -snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, +snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames); -snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, +snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames); -int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); +int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); -static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, +static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, struct snd_dma_buffer *bufp) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; if (bufp) { runtime->dma_buffer_p = bufp; runtime->dma_area = bufp->area; @@ -973,47 +949,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, * Timer interface */ -void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream); -void snd_pcm_timer_init(snd_pcm_substream_t * substream); -void snd_pcm_timer_done(snd_pcm_substream_t * substream); +void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); +void snd_pcm_timer_init(struct snd_pcm_substream *substream); +void snd_pcm_timer_done(struct snd_pcm_substream *substream); /* * Memory */ -int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream); -int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm); -int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, +int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); +int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); +int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, int type, struct device *data, size_t size, size_t max); -int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, +int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, int type, void *data, size_t size, size_t max); -int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size); -int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream); +int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); +int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); #define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) #define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) #define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) -struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); +struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset); /* handle mmap counter - PCM mmap callback should handle this counter properly */ static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) { - snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; + struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; atomic_inc(&substream->runtime->mmap_count); } static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) { - snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; + struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; atomic_dec(&substream->runtime->mmap_count); } /* mmap for io-memory area */ #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) #define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP -int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area); +int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area); #else #define SNDRV_PCM_INFO_MMAP_IOMEM 0 #define snd_pcm_lib_mmap_iomem NULL diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h index 0b67c9d105af..fddaddde47b4 100644 --- a/include/sound/pcm_oss.h +++ b/include/sound/pcm_oss.h @@ -22,10 +22,7 @@ * */ -typedef struct _snd_pcm_plugin snd_pcm_plugin_t; -typedef struct _snd_pcm_oss_setup snd_pcm_oss_setup_t; - -struct _snd_pcm_oss_setup { +struct snd_pcm_oss_setup { char *task_name; unsigned int disable:1, direct:1, @@ -36,10 +33,10 @@ struct _snd_pcm_oss_setup { buggyptr:1; unsigned int periods; unsigned int period_size; - snd_pcm_oss_setup_t *next; + struct snd_pcm_oss_setup *next; }; -typedef struct _snd_pcm_oss_runtime { +struct snd_pcm_oss_runtime { unsigned params: 1, /* format/parameter change */ prepare: 1, /* need to prepare the operation */ trigger: 1, /* trigger flag */ @@ -59,30 +56,30 @@ typedef struct _snd_pcm_oss_runtime { size_t mmap_bytes; char *buffer; /* vmallocated period */ size_t buffer_used; /* used length from period buffer */ - snd_pcm_plugin_t *plugin_first; - snd_pcm_plugin_t *plugin_last; + struct snd_pcm_plugin *plugin_first; + struct snd_pcm_plugin *plugin_last; unsigned int prev_hw_ptr_interrupt; -} snd_pcm_oss_runtime_t; +}; -typedef struct _snd_pcm_oss_file { - snd_pcm_substream_t *streams[2]; -} snd_pcm_oss_file_t; +struct snd_pcm_oss_file { + struct snd_pcm_substream *streams[2]; +}; -typedef struct _snd_pcm_oss_substream { +struct snd_pcm_oss_substream { unsigned oss: 1; /* oss mode */ - snd_pcm_oss_setup_t *setup; /* active setup */ - snd_pcm_oss_file_t *file; -} snd_pcm_oss_substream_t; + struct snd_pcm_oss_setup *setup; /* active setup */ + struct snd_pcm_oss_file *file; +}; -typedef struct _snd_pcm_oss_stream { - snd_pcm_oss_setup_t *setup_list; /* setup list */ +struct snd_pcm_oss_stream { + struct snd_pcm_oss_setup *setup_list; /* setup list */ struct semaphore setup_mutex; - snd_info_entry_t *proc_entry; -} snd_pcm_oss_stream_t; + struct snd_info_entry *proc_entry; +}; -typedef struct _snd_pcm_oss { +struct snd_pcm_oss { int reg; unsigned int reg_mask; -} snd_pcm_oss_t; +}; #endif /* __SOUND_PCM_OSS_H */ diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 60b0e92e26f3..fb18aef77341 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -22,17 +22,17 @@ * */ -extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, const snd_mask_t *val); -extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, +extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var, const struct snd_mask *val); +extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir); -extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, +extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir); -extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, +extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, unsigned int val, int dir); -extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, +extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); -extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, +extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, unsigned int val, int dir); /* To share the same code we have alsa-lib */ @@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v) INLINE size_t snd_mask_sizeof(void) { - return sizeof(snd_mask_t); + return sizeof(struct snd_mask); } -INLINE void snd_mask_none(snd_mask_t *mask) +INLINE void snd_mask_none(struct snd_mask *mask) { memset(mask, 0, sizeof(*mask)); } -INLINE void snd_mask_any(snd_mask_t *mask) +INLINE void snd_mask_any(struct snd_mask *mask) { memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); } -INLINE int snd_mask_empty(const snd_mask_t *mask) +INLINE int snd_mask_empty(const struct snd_mask *mask) { int i; for (i = 0; i < SNDRV_MASK_SIZE; i++) @@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask) return 1; } -INLINE unsigned int snd_mask_min(const snd_mask_t *mask) +INLINE unsigned int snd_mask_min(const struct snd_mask *mask) { int i; assert(!snd_mask_empty(mask)); @@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask) return 0; } -INLINE unsigned int snd_mask_max(const snd_mask_t *mask) +INLINE unsigned int snd_mask_max(const struct snd_mask *mask) { int i; assert(!snd_mask_empty(mask)); @@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask) return 0; } -INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) +INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val) { assert(val <= SNDRV_MASK_BITS); mask->bits[MASK_OFS(val)] |= MASK_BIT(val); } -INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) +INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val) { assert(val <= SNDRV_MASK_BITS); mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); } -INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) +INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to) { unsigned int i; assert(to <= SNDRV_MASK_BITS && from <= to); @@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int mask->bits[MASK_OFS(i)] |= MASK_BIT(i); } -INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) +INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to) { unsigned int i; assert(to <= SNDRV_MASK_BITS && from <= to); @@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); } -INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) +INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val) { unsigned int v; assert(val <= SNDRV_MASK_BITS); @@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) mask->bits[MASK_OFS(val)] = v; } -INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) +INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v) { int i; for (i = 0; i < SNDRV_MASK_SIZE; i++) mask->bits[i] &= v->bits[i]; } -INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) +INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v) { return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); } -INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) +INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v) { *mask = *v; } -INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) +INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val) { assert(val <= SNDRV_MASK_BITS); return mask->bits[MASK_OFS(val)] & MASK_BIT(val); } -INLINE int snd_mask_single(const snd_mask_t *mask) +INLINE int snd_mask_single(const struct snd_mask *mask) { int i, c = 0; assert(!snd_mask_empty(mask)); @@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask) return 1; } -INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) +INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v) { - snd_mask_t old; + struct snd_mask old; assert(!snd_mask_empty(mask)); snd_mask_copy(&old, mask); snd_mask_intersect(mask, v); @@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) return !snd_mask_eq(mask, &old); } -INLINE int snd_mask_refine_first(snd_mask_t *mask) +INLINE int snd_mask_refine_first(struct snd_mask *mask) { assert(!snd_mask_empty(mask)); if (snd_mask_single(mask)) @@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask) return 1; } -INLINE int snd_mask_refine_last(snd_mask_t *mask) +INLINE int snd_mask_refine_last(struct snd_mask *mask) { assert(!snd_mask_empty(mask)); if (snd_mask_single(mask)) @@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask) return 1; } -INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) +INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val) { assert(!snd_mask_empty(mask)); if (snd_mask_min(mask) >= val) @@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) return 1; } -INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) +INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val) { assert(!snd_mask_empty(mask)); if (snd_mask_max(mask) <= val) @@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) return 1; } -INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) +INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val) { int changed; assert(!snd_mask_empty(mask)); @@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) return changed; } -INLINE int snd_mask_value(const snd_mask_t *mask) +INLINE int snd_mask_value(const struct snd_mask *mask) { assert(!snd_mask_empty(mask)); return snd_mask_min(mask); } -INLINE void snd_interval_any(snd_interval_t *i) +INLINE void snd_interval_any(struct snd_interval *i) { i->min = 0; i->openmin = 0; @@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i) i->empty = 0; } -INLINE void snd_interval_none(snd_interval_t *i) +INLINE void snd_interval_none(struct snd_interval *i) { i->empty = 1; } -INLINE int snd_interval_checkempty(const snd_interval_t *i) +INLINE int snd_interval_checkempty(const struct snd_interval *i) { return (i->min > i->max || (i->min == i->max && (i->openmin || i->openmax))); } -INLINE int snd_interval_empty(const snd_interval_t *i) +INLINE int snd_interval_empty(const struct snd_interval *i) { return i->empty; } -INLINE int snd_interval_single(const snd_interval_t *i) +INLINE int snd_interval_single(const struct snd_interval *i) { assert(!snd_interval_empty(i)); return (i->min == i->max || (i->min + 1 == i->max && i->openmax)); } -INLINE int snd_interval_value(const snd_interval_t *i) +INLINE int snd_interval_value(const struct snd_interval *i) { assert(snd_interval_single(i)); return i->min; } -INLINE int snd_interval_min(const snd_interval_t *i) +INLINE int snd_interval_min(const struct snd_interval *i) { assert(!snd_interval_empty(i)); return i->min; } -INLINE int snd_interval_max(const snd_interval_t *i) +INLINE int snd_interval_max(const struct snd_interval *i) { unsigned int v; assert(!snd_interval_empty(i)); @@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i) return v; } -INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val) +INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val) { return !((i->min > val || (i->min == val && i->openmin) || i->max < val || (i->max == val && i->openmax))); } -INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s) +INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s) { *d = *s; } -INLINE int snd_interval_setinteger(snd_interval_t *i) +INLINE int snd_interval_setinteger(struct snd_interval *i) { if (i->integer) return 0; @@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i) return 1; } -INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2) +INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2) { if (i1->empty) return i2->empty; diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index 3f9db510dee3..d19bddfbf995 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h @@ -36,11 +36,6 @@ * Raw MIDI interface */ -typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t; -typedef struct sndrv_rawmidi_info snd_rawmidi_info_t; -typedef struct sndrv_rawmidi_params snd_rawmidi_params_t; -typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; - #define SNDRV_RAWMIDI_DEVICES 8 #define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) @@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) #define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) -typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; -typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; -typedef struct _snd_rawmidi_str snd_rawmidi_str_t; +struct snd_rawmidi; +struct snd_rawmidi_substream; -typedef struct _snd_rawmidi_ops { - int (*open) (snd_rawmidi_substream_t * substream); - int (*close) (snd_rawmidi_substream_t * substream); - void (*trigger) (snd_rawmidi_substream_t * substream, int up); - void (*drain) (snd_rawmidi_substream_t * substream); -} snd_rawmidi_ops_t; +struct snd_rawmidi_ops { + int (*open) (struct snd_rawmidi_substream * substream); + int (*close) (struct snd_rawmidi_substream * substream); + void (*trigger) (struct snd_rawmidi_substream * substream, int up); + void (*drain) (struct snd_rawmidi_substream * substream); +}; -typedef struct _snd_rawmidi_global_ops { - int (*dev_register) (snd_rawmidi_t * rmidi); - int (*dev_unregister) (snd_rawmidi_t * rmidi); -} snd_rawmidi_global_ops_t; +struct snd_rawmidi_global_ops { + int (*dev_register) (struct snd_rawmidi * rmidi); + int (*dev_unregister) (struct snd_rawmidi * rmidi); +}; -struct _snd_rawmidi_runtime { +struct snd_rawmidi_runtime { unsigned int drain: 1, /* drain stage */ oss: 1; /* OSS compatible mode */ /* midi stream buffer */ @@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime { spinlock_t lock; wait_queue_head_t sleep; /* event handler (new bytes, input only) */ - void (*event)(snd_rawmidi_substream_t *substream); + void (*event)(struct snd_rawmidi_substream *substream); /* defers calls to event [input] or ops->trigger [output] */ struct tasklet_struct tasklet; /* private data */ void *private_data; - void (*private_free)(snd_rawmidi_substream_t *substream); + void (*private_free)(struct snd_rawmidi_substream *substream); }; -struct _snd_rawmidi_substream { +struct snd_rawmidi_substream { struct list_head list; /* list of all substream for given stream */ int stream; /* direction */ int number; /* substream number */ @@ -97,29 +91,29 @@ struct _snd_rawmidi_substream { active_sensing: 1; /* send active sensing when close */ int use_count; /* use counter (for output) */ size_t bytes; - snd_rawmidi_t *rmidi; - snd_rawmidi_str_t *pstr; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_str *pstr; char name[32]; - snd_rawmidi_runtime_t *runtime; + struct snd_rawmidi_runtime *runtime; /* hardware layer */ - snd_rawmidi_ops_t *ops; + struct snd_rawmidi_ops *ops; }; -typedef struct _snd_rawmidi_file { - snd_rawmidi_t *rmidi; - snd_rawmidi_substream_t *input; - snd_rawmidi_substream_t *output; -} snd_rawmidi_file_t; +struct snd_rawmidi_file { + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *input; + struct snd_rawmidi_substream *output; +}; -struct _snd_rawmidi_str { +struct snd_rawmidi_str { unsigned int substream_count; unsigned int substream_opened; struct list_head substreams; }; -struct _snd_rawmidi { - snd_card_t *card; - +struct snd_rawmidi { + struct snd_card *card; + struct list_head list; unsigned int device; /* device number */ unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ char id[64]; @@ -129,52 +123,61 @@ struct _snd_rawmidi { int ossreg; #endif - snd_rawmidi_global_ops_t *ops; + struct snd_rawmidi_global_ops *ops; - snd_rawmidi_str_t streams[2]; + struct snd_rawmidi_str streams[2]; void *private_data; - void (*private_free) (snd_rawmidi_t *rmidi); + void (*private_free) (struct snd_rawmidi *rmidi); struct semaphore open_mutex; wait_queue_head_t open_wait; - snd_info_entry_t *dev; - snd_info_entry_t *proc_entry; + struct snd_info_entry *dev; + struct snd_info_entry *proc_entry; #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) - snd_seq_device_t *seq_dev; + struct snd_seq_device *seq_dev; #endif }; /* main rawmidi functions */ -int snd_rawmidi_new(snd_card_t * card, char *id, int device, +int snd_rawmidi_new(struct snd_card *card, char *id, int device, int output_count, int input_count, - snd_rawmidi_t ** rmidi); -void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); + struct snd_rawmidi **rmidi); +void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, + struct snd_rawmidi_ops *ops); /* callbacks */ -void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); -int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); -void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); -int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); -int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); -int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); -int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); +void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream); +int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, + const unsigned char *buffer, int count); +void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream); +int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream); +int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, + unsigned char *buffer, int count); +int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count); +int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, + unsigned char *buffer, int count); /* main midi functions */ -int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); -int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); -int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); -int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); -int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); -int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); -int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); -int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); -long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); -long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); +int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info); +int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, + int mode, struct snd_rawmidi_file *rfile); +int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile); +int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, + struct snd_rawmidi_params *params); +int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, + struct snd_rawmidi_params *params); +int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream); +int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream); +int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream); +long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream, + unsigned char *buf, long count); +long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream, + const unsigned char *buf, long count); #endif /* __SOUND_RAWMIDI_H */ diff --git a/include/sound/sb.h b/include/sound/sb.h index 7960452445e6..431d06675e36 100644 --- a/include/sound/sb.h +++ b/include/sound/sb.h @@ -60,7 +60,7 @@ enum sb_hw_type { #define SB_MPU_INPUT 1 -struct _snd_sb { +struct snd_sb { unsigned long port; /* base port of DSP chip */ struct resource *res_port; unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */ @@ -92,24 +92,26 @@ struct _snd_sb { void *csp; /* used only when CONFIG_SND_SB16_CSP is set */ - snd_card_t *card; - snd_pcm_t *pcm; - snd_pcm_substream_t *playback_substream; - snd_pcm_substream_t *capture_substream; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; - snd_rawmidi_t *rmidi; - snd_rawmidi_substream_t *midi_substream_input; - snd_rawmidi_substream_t *midi_substream_output; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *midi_substream_input; + struct snd_rawmidi_substream *midi_substream_output; irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs); spinlock_t reg_lock; spinlock_t open_lock; spinlock_t midi_input_lock; - snd_info_entry_t *proc_entry; -}; + struct snd_info_entry *proc_entry; -typedef struct _snd_sb sb_t; +#ifdef CONFIG_PM + unsigned char saved_regs[0x20]; +#endif +}; /* I/O ports */ @@ -267,48 +269,52 @@ typedef struct _snd_sb sb_t; * */ -static inline void snd_sb_ack_8bit(sb_t *chip) +static inline void snd_sb_ack_8bit(struct snd_sb *chip) { inb(SBP(chip, DATA_AVAIL)); } -static inline void snd_sb_ack_16bit(sb_t *chip) +static inline void snd_sb_ack_16bit(struct snd_sb *chip) { inb(SBP(chip, DATA_AVAIL_16)); } /* sb_common.c */ -int snd_sbdsp_command(sb_t *chip, unsigned char val); -int snd_sbdsp_get_byte(sb_t *chip); -int snd_sbdsp_reset(sb_t *chip); -int snd_sbdsp_create(snd_card_t *card, +int snd_sbdsp_command(struct snd_sb *chip, unsigned char val); +int snd_sbdsp_get_byte(struct snd_sb *chip); +int snd_sbdsp_reset(struct snd_sb *chip); +int snd_sbdsp_create(struct snd_card *card, unsigned long port, int irq, irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), int dma8, int dma16, unsigned short hardware, - sb_t **r_chip); + struct snd_sb **r_chip); /* sb_mixer.c */ -void snd_sbmixer_write(sb_t *chip, unsigned char reg, unsigned char data); -unsigned char snd_sbmixer_read(sb_t *chip, unsigned char reg); -int snd_sbmixer_new(sb_t *chip); +void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data); +unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg); +int snd_sbmixer_new(struct snd_sb *chip); +#ifdef CONFIG_PM +void snd_sbmixer_suspend(struct snd_sb *chip); +void snd_sbmixer_resume(struct snd_sb *chip); +#endif /* sb8_init.c */ -int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); +int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm); /* sb8.c */ -irqreturn_t snd_sb8dsp_interrupt(sb_t *chip); -int snd_sb8_playback_open(snd_pcm_substream_t *substream); -int snd_sb8_capture_open(snd_pcm_substream_t *substream); -int snd_sb8_playback_close(snd_pcm_substream_t *substream); -int snd_sb8_capture_close(snd_pcm_substream_t *substream); +irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip); +int snd_sb8_playback_open(struct snd_pcm_substream *substream); +int snd_sb8_capture_open(struct snd_pcm_substream *substream); +int snd_sb8_playback_close(struct snd_pcm_substream *substream); +int snd_sb8_capture_close(struct snd_pcm_substream *substream); /* midi8.c */ -irqreturn_t snd_sb8dsp_midi_interrupt(sb_t *chip); -int snd_sb8dsp_midi(sb_t *chip, int device, snd_rawmidi_t ** rrawmidi); +irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip); +int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi); /* sb16_init.c */ -int snd_sb16dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); -const snd_pcm_ops_t *snd_sb16dsp_get_pcm_ops(int direction); -int snd_sb16dsp_configure(sb_t *chip); +int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm); +const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction); +int snd_sb16dsp_configure(struct snd_sb *chip); /* sb16.c */ irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs); @@ -328,7 +334,7 @@ enum { #define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \ ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24)) -int snd_sbmixer_add_ctl(sb_t *chip, const char *name, int index, int type, unsigned long value); +int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value); /* for ease of use */ struct sbmix_elem { @@ -352,7 +358,7 @@ struct sbmix_elem { .type = SB_MIX_INPUT_SW, \ .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) } -static inline int snd_sbmixer_add_ctl_elem(sb_t *chip, const struct sbmix_elem *c) +static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c) { return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value); } diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h index eb8368b56b16..3b44d4b370f5 100644 --- a/include/sound/sb16_csp.h +++ b/include/sound/sb16_csp.h @@ -63,25 +63,25 @@ #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 /* microcode header */ -typedef struct snd_sb_csp_mc_header { +struct snd_sb_csp_mc_header { char codec_name[16]; /* id name of codec */ unsigned short func_req; /* requested function */ -} snd_sb_csp_mc_header_t; +}; /* microcode to be loaded */ -typedef struct snd_sb_csp_microcode { - snd_sb_csp_mc_header_t info; +struct snd_sb_csp_microcode { + struct snd_sb_csp_mc_header info; unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; -} snd_sb_csp_microcode_t; +}; /* start CSP with sample_width in mono/stereo */ -typedef struct snd_sb_csp_start { +struct snd_sb_csp_start { int sample_width; /* sample width, look above */ int channels; /* channels, look above */ -} snd_sb_csp_start_t; +}; /* CSP information */ -typedef struct snd_sb_csp_info { +struct snd_sb_csp_info { char codec_name[16]; /* id name of codec */ unsigned short func_nr; /* function number */ unsigned int acc_format; /* accepted PCM formats */ @@ -93,17 +93,17 @@ typedef struct snd_sb_csp_info { unsigned short run_width; /* current sample width */ unsigned short version; /* version id: 0x10 - 0x1f */ unsigned short state; /* state bits */ -} snd_sb_csp_info_t; +}; /* HWDEP controls */ /* get CSP information */ -#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t) +#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) /* load microcode to CSP */ -#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t) +#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode) /* unload microcode from CSP */ #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) /* start CSP */ -#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t) +#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) /* stop CSP */ #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) /* pause CSP and DMA transfer */ @@ -115,25 +115,25 @@ typedef struct snd_sb_csp_info { #include "sb.h" #include "hwdep.h" -typedef struct snd_sb_csp snd_sb_csp_t; +struct snd_sb_csp; /* * CSP operators */ -typedef struct { - int (*csp_use) (snd_sb_csp_t * p); - int (*csp_unuse) (snd_sb_csp_t * p); - int (*csp_autoload) (snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); - int (*csp_start) (snd_sb_csp_t * p, int sample_width, int channels); - int (*csp_stop) (snd_sb_csp_t * p); - int (*csp_qsound_transfer) (snd_sb_csp_t * p); -} snd_sb_csp_ops_t; +struct snd_sb_csp_ops { + int (*csp_use) (struct snd_sb_csp * p); + int (*csp_unuse) (struct snd_sb_csp * p); + int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode); + int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels); + int (*csp_stop) (struct snd_sb_csp * p); + int (*csp_qsound_transfer) (struct snd_sb_csp * p); +}; /* * CSP private data */ struct snd_sb_csp { - sb_t *chip; /* SB16 DSP */ + struct snd_sb *chip; /* SB16 DSP */ int used; /* usage flag - exclusive */ char codec_name[16]; /* name of codec */ unsigned short func_nr; /* function number */ @@ -147,7 +147,7 @@ struct snd_sb_csp { int version; /* CSP version (0x10 - 0x1f) */ int running; /* running state */ - snd_sb_csp_ops_t ops; /* operators */ + struct snd_sb_csp_ops ops; /* operators */ spinlock_t q_lock; /* locking */ int q_enabled; /* enabled flag */ @@ -155,13 +155,13 @@ struct snd_sb_csp { int qpos_right; /* right position */ int qpos_changed; /* position changed flag */ - snd_kcontrol_t *qsound_switch; - snd_kcontrol_t *qsound_space; + struct snd_kcontrol *qsound_switch; + struct snd_kcontrol *qsound_space; struct semaphore access_mutex; /* locking */ }; -int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep); +int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); #endif #endif /* __SOUND_SB16_CSP */ diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h index 204ca540c28e..2b5f24cc7548 100644 --- a/include/sound/seq_device.h +++ b/include/sound/seq_device.h @@ -21,9 +21,6 @@ * */ -typedef struct snd_seq_device snd_seq_device_t; -typedef struct snd_seq_dev_ops snd_seq_dev_ops_t; - /* * registered device information */ @@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t; struct snd_seq_device { /* device info */ - snd_card_t *card; /* sound card */ + struct snd_card *card; /* sound card */ int device; /* device number */ char id[ID_LEN]; /* driver id */ char name[80]; /* device name */ @@ -44,7 +41,7 @@ struct snd_seq_device { void *driver_data; /* private data for driver */ int status; /* flag - read only */ void *private_data; /* private data for the caller */ - void (*private_free)(snd_seq_device_t *device); + void (*private_free)(struct snd_seq_device *device); struct list_head list; /* link to next device */ }; @@ -63,19 +60,19 @@ struct snd_seq_device { * Typically, call snd_device_free(dev->card, dev->driver_data) */ struct snd_seq_dev_ops { - int (*init_device)(snd_seq_device_t *dev); - int (*free_device)(snd_seq_device_t *dev); + int (*init_device)(struct snd_seq_device *dev); + int (*free_device)(struct snd_seq_device *dev); }; /* * prototypes */ void snd_seq_device_load_drivers(void); -int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); -int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); +int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); +int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); int snd_seq_device_unregister_driver(char *id); -#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) +#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) /* @@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id); #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" - #endif /* __SOUND_SEQ_DEVICE_H */ diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h index 1a654df4aa97..db764f09efb7 100644 --- a/include/sound/seq_instr.h +++ b/include/sound/seq_instr.h @@ -24,29 +24,27 @@ #include "seq_kernel.h" /* Instrument cluster */ -typedef struct _snd_seq_kcluster { +struct snd_seq_kcluster { snd_seq_instr_cluster_t cluster; char name[32]; int priority; - struct _snd_seq_kcluster *next; -} snd_seq_kcluster_t; + struct snd_seq_kcluster *next; +}; /* return pointer to private data */ -#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) - -typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t; +#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr)) /* Instrument structure */ -typedef struct _snd_seq_kinstr { - snd_seq_instr_t instr; +struct snd_seq_kinstr { + struct snd_seq_instr instr; char name[32]; int type; /* instrument type */ int use; /* use count */ int busy; /* not useable */ int add_len; /* additional length */ - snd_seq_kinstr_ops_t *ops; /* operations */ - struct _snd_seq_kinstr *next; -} snd_seq_kinstr_t; + struct snd_seq_kinstr_ops *ops; /* operations */ + struct snd_seq_kinstr *next; +}; #define SNDRV_SEQ_INSTR_HASH_SIZE 32 @@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr { #define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ /* List of all instruments */ -typedef struct { - snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; +struct snd_seq_kinstr_list { + struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; int count; /* count of all instruments */ - snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; + struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; int ccount; /* count of all clusters */ int owner; /* current owner of the instrument list */ @@ -68,7 +66,7 @@ typedef struct { spinlock_t ops_lock; struct semaphore ops_mutex; unsigned long ops_flags; -} snd_seq_kinstr_list_t; +}; #define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 #define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 @@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops { long add_len; /* additional length */ char *instr_type; int (*info)(void *private_data, char *info_data, long len); - int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, + int (*put)(void *private_data, struct snd_seq_kinstr *kinstr, char __user *instr_data, long len, int atomic, int cmd); - int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, + int (*get)(void *private_data, struct snd_seq_kinstr *kinstr, char __user *instr_data, long len, int atomic, int cmd); - int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); - int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); - void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); + int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size); + int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic); + void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what); struct snd_seq_kinstr_ops *next; }; /* instrument operations */ -snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); -void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); -int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, - snd_seq_instr_header_t *ifree, +struct snd_seq_kinstr_list *snd_seq_instr_list_new(void); +void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list); +int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list, + struct snd_seq_instr_header *ifree, int client, int atomic); -snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, - snd_seq_instr_t *instr, - int exact, - int follow_alias); -void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, - snd_seq_kinstr_t *instr); -int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, - snd_seq_kinstr_list_t *list, - snd_seq_event_t *ev, +struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list, + struct snd_seq_instr *instr, + int exact, + int follow_alias); +void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list, + struct snd_seq_kinstr *instr); +int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops, + struct snd_seq_kinstr_list *list, + struct snd_seq_event *ev, int client, int atomic, int hop); diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h index 4beca1952c76..f023c1b97f8c 100644 --- a/include/sound/seq_kernel.h +++ b/include/sound/seq_kernel.h @@ -24,62 +24,8 @@ #include <linux/time.h> #include "asequencer.h" -typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; -typedef sndrv_seq_position_t snd_seq_position_t; -typedef sndrv_seq_frequency_t snd_seq_frequency_t; -typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t; -typedef enum sndrv_seq_client_type snd_seq_client_type_t; -typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t; -typedef struct sndrv_seq_port_info snd_seq_port_info_t; -typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t; -typedef struct sndrv_seq_event snd_seq_event_t; -typedef struct sndrv_seq_addr snd_seq_addr_t; -typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t; -typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t; -typedef struct sndrv_seq_remove_events snd_seq_remove_events_t; -typedef struct sndrv_seq_query_subs snd_seq_query_subs_t; -typedef struct sndrv_seq_real_time snd_seq_real_time_t; -typedef struct sndrv_seq_system_info snd_seq_system_info_t; -typedef struct sndrv_seq_client_info snd_seq_client_info_t; -typedef struct sndrv_seq_queue_info snd_seq_queue_info_t; -typedef struct sndrv_seq_queue_status snd_seq_queue_status_t; -typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t; -typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t; -typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t; -typedef struct sndrv_seq_queue_client snd_seq_queue_client_t; -typedef struct sndrv_seq_client_pool snd_seq_client_pool_t; -typedef struct sndrv_seq_instr snd_seq_instr_t; -typedef struct sndrv_seq_instr_data snd_seq_instr_data_t; -typedef struct sndrv_seq_instr_header snd_seq_instr_header_t; -typedef union sndrv_seq_timestamp snd_seq_timestamp_t; - -#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data -#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type -#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type -#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type -#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type -#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type -#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type -#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type -#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type -#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type -#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type -#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type -#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved -#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct -#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior -#define snd_seq_ev_length_type sndrv_seq_ev_length_type -#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed -#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable -#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr -#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type -#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick -#define snd_seq_ev_is_real sndrv_seq_ev_is_real -#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type -#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime -#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime -#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port -#define snd_seq_queue_owner sndrv_seq_queue_owner +typedef struct snd_seq_real_time snd_seq_real_time_t; +typedef union snd_seq_timestamp snd_seq_timestamp_t; /* maximum number of events dequeued per schedule interval */ #define SNDRV_SEQ_MAX_DEQUEUE 50 @@ -114,69 +60,48 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t; /* max size of event size */ #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff -/* typedefs */ -struct _snd_seq_user_client; -struct _snd_seq_kernel_client; -struct _snd_seq_client; -struct _snd_seq_queue; - -typedef struct _snd_seq_user_client user_client_t; -typedef struct _snd_seq_kernel_client kernel_client_t; -typedef struct _snd_seq_client client_t; -typedef struct _snd_seq_queue queue_t; - -/* call-backs for kernel client */ - -typedef struct { - void *private_data; - unsigned allow_input: 1, - allow_output: 1; - /*...*/ -} snd_seq_client_callback_t; - /* call-backs for kernel port */ -typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); -typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info); -typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop); -typedef void (snd_seq_kernel_port_private_free_t)(void *private_data); - -typedef struct { +struct snd_seq_port_callback { struct module *owner; void *private_data; - snd_seq_kernel_port_open_t *subscribe; - snd_seq_kernel_port_close_t *unsubscribe; - snd_seq_kernel_port_open_t *use; - snd_seq_kernel_port_close_t *unuse; - snd_seq_kernel_port_input_t *event_input; - snd_seq_kernel_port_private_free_t *private_free; + int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info); + int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info); + int (*use)(void *private_data, struct snd_seq_port_subscribe *info); + int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info); + int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop); + void (*private_free)(void *private_data); unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ /*...*/ -} snd_seq_port_callback_t; +}; /* interface for kernel client */ -extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); -extern int snd_seq_delete_kernel_client(int client); -extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); -extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); -extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); +int snd_seq_create_kernel_client(struct snd_card *card, int client_index, + const char *name_fmt, ...) + __attribute__ ((format (printf, 3, 4))); +int snd_seq_delete_kernel_client(int client); +int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); +int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); +int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); #define SNDRV_SEQ_EXT_MASK 0xc0000000 #define SNDRV_SEQ_EXT_USRPTR 0x80000000 #define SNDRV_SEQ_EXT_CHAINED 0x40000000 typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); -int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); -int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); +int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf, + int in_kernel, int size_aligned); +int snd_seq_dump_var_event(const struct snd_seq_event *event, + snd_seq_dump_func_t func, void *private_data); /* interface for OSS emulation */ -int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); +int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo); /* port callback routines */ -void snd_port_init_callback(snd_seq_port_callback_t *p); -snd_seq_port_callback_t *snd_port_alloc_callback(void); +void snd_port_init_callback(struct snd_seq_port_callback *p); +struct snd_seq_port_callback *snd_port_alloc_callback(void); /* port attach/detach */ -int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, +int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp, int cap, int type, int midi_channels, int midi_voices, char *portname); int snd_seq_event_port_detach(int client, int port); diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h index e58ca45bc73b..d6c4615901b9 100644 --- a/include/sound/seq_midi_emul.h +++ b/include/sound/seq_midi_emul.h @@ -29,7 +29,7 @@ * channel. All drivers for hardware that does not understand midi * directly will probably need to use this structure. */ -typedef struct snd_midi_channel { +struct snd_midi_channel { void *private; /* A back pointer to driver data */ int number; /* The channel number */ int client; /* The client associated with this channel */ @@ -53,41 +53,43 @@ typedef struct snd_midi_channel { short gm_rpn_fine_tuning; /* Master fine tuning */ short gm_rpn_coarse_tuning; /* Master coarse tuning */ -} snd_midi_channel_t; +}; /* * A structure that represets a set of channels bound to a port. There * would usually be 16 channels per port. But fewer could be used for * particular cases. * The channel set consists of information describing the client and - * port for this midi synth and an array of snd_midi_channel_t structures. - * A driver that had no need for snd_midi_channel_t could still use the + * port for this midi synth and an array of snd_midi_channel structures. + * A driver that had no need for snd_midi_channel could still use the * channel set type if it wished with the channel array null. */ -typedef struct snd_midi_channel_set { +struct snd_midi_channel_set { void *private_data; /* Driver data */ int client; /* Client for this port */ int port; /* The port number */ int max_channels; /* Size of the channels array */ - snd_midi_channel_t *channels; + struct snd_midi_channel *channels; unsigned char midi_mode; /* MIDI operating mode */ unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ unsigned char gs_chorus_mode; unsigned char gs_reverb_mode; -} snd_midi_channel_set_t; +}; -typedef struct snd_seq_midi_op { - void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); - void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ - void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); - void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ - void (*control)(void *private_data, int type, snd_midi_channel_t *chan); - void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); - void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); -} snd_midi_op_t; +struct snd_midi_op { + void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan); + void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */ + void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan); + void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */ + void (*control)(void *private_data, int type, struct snd_midi_channel *chan); + void (*nrpn)(void *private_data, struct snd_midi_channel *chan, + struct snd_midi_channel_set *chset); + void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, + struct snd_midi_channel_set *chset); +}; /* * These defines are used so that pitchbend, aftertouch etc, can be @@ -186,10 +188,10 @@ enum { }; /* Prototypes for midi_process.c */ -void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, - snd_midi_channel_set_t *chanset); -void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); -snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); -void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); +void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev, + struct snd_midi_channel_set *chanset); +void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset); +struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n); +void snd_midi_channel_free_set(struct snd_midi_channel_set *chset); #endif /* __SOUND_SEQ_MIDI_EMUL_H */ diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h index 8857e2bd31a5..dd789e7cdb20 100644 --- a/include/sound/seq_midi_event.h +++ b/include/sound/seq_midi_event.h @@ -26,10 +26,8 @@ #define MAX_MIDI_EVENT_BUF 256 -typedef struct snd_midi_event_t snd_midi_event_t; - /* midi status */ -struct snd_midi_event_t { +struct snd_midi_event { int qlen; /* queue length */ int read; /* chars read */ int type; /* current event type */ @@ -40,15 +38,17 @@ struct snd_midi_event_t { spinlock_t lock; }; -int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); -void snd_midi_event_free(snd_midi_event_t *dev); -void snd_midi_event_reset_encode(snd_midi_event_t *dev); -void snd_midi_event_reset_decode(snd_midi_event_t *dev); -void snd_midi_event_no_status(snd_midi_event_t *dev, int on); +int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev); +void snd_midi_event_free(struct snd_midi_event *dev); +void snd_midi_event_reset_encode(struct snd_midi_event *dev); +void snd_midi_event_reset_decode(struct snd_midi_event *dev); +void snd_midi_event_no_status(struct snd_midi_event *dev, int on); /* encode from byte stream - return number of written bytes if success */ -long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); -int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); +long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count, + struct snd_seq_event *ev); +int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev); /* decode from event to bytes - return number of written bytes if success */ -long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); +long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count, + struct snd_seq_event *ev); #endif /* __SOUND_SEQ_MIDI_EVENT_H */ diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h index bd7e57322ab6..9b060bbd6e02 100644 --- a/include/sound/seq_oss.h +++ b/include/sound/seq_oss.h @@ -25,22 +25,16 @@ #include "seq_kernel.h" /* - * type definitions - */ -typedef struct snd_seq_oss_arg_t snd_seq_oss_arg_t; -typedef struct snd_seq_oss_callback_t snd_seq_oss_callback_t; - -/* * argument structure for synthesizer operations */ -struct snd_seq_oss_arg_t { +struct snd_seq_oss_arg { /* given by OSS sequencer */ int app_index; /* application unique index */ int file_mode; /* file mode - see below */ int seq_mode; /* sequencer mode - see below */ /* following must be initialized in open callback */ - snd_seq_addr_t addr; /* opened port address */ + struct snd_seq_addr addr; /* opened port address */ void *private_data; /* private data for lowlevel drivers */ /* note-on event passing mode: initially given by OSS seq, @@ -53,14 +47,14 @@ struct snd_seq_oss_arg_t { /* * synthesizer operation callbacks */ -struct snd_seq_oss_callback_t { +struct snd_seq_oss_callback { struct module *owner; - int (*open)(snd_seq_oss_arg_t *p, void *closure); - int (*close)(snd_seq_oss_arg_t *p); - int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg); - int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count); - int (*reset)(snd_seq_oss_arg_t *p); - int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data); + int (*open)(struct snd_seq_oss_arg *p, void *closure); + int (*close)(struct snd_seq_oss_arg *p); + int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg); + int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count); + int (*reset)(struct snd_seq_oss_arg *p); + int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data); }; /* flag: file_mode */ @@ -88,13 +82,13 @@ struct snd_seq_oss_callback_t { /* * data pointer to snd_seq_register_device */ -typedef struct snd_seq_oss_reg { +struct snd_seq_oss_reg { int type; int subtype; int nvoices; - snd_seq_oss_callback_t oper; + struct snd_seq_oss_callback oper; void *private_data; -} snd_seq_oss_reg_t; +}; /* device id */ #define SNDRV_SEQ_DEV_ID_OSS "seq-oss" diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h index 1ad27e859af3..8d5aea76d7c3 100644 --- a/include/sound/seq_virmidi.h +++ b/include/sound/seq_virmidi.h @@ -25,25 +25,23 @@ #include "rawmidi.h" #include "seq_midi_event.h" -typedef struct _snd_virmidi_dev snd_virmidi_dev_t; - /* * device file instance: * This instance is created at each time the midi device file is * opened. Each instance has its own input buffer and MIDI parser * (buffer), and is associated with the device instance. */ -typedef struct _snd_virmidi { +struct snd_virmidi { struct list_head list; int seq_mode; int client; int port; unsigned int trigger: 1; - snd_midi_event_t *parser; - snd_seq_event_t event; - snd_virmidi_dev_t *rdev; - snd_rawmidi_substream_t *substream; -} snd_virmidi_t; + struct snd_midi_event *parser; + struct snd_seq_event event; + struct snd_virmidi_dev *rdev; + struct snd_rawmidi_substream *substream; +}; #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) #define SNDRV_VIRMIDI_USE (1<<1) @@ -53,9 +51,9 @@ typedef struct _snd_virmidi { * Each virtual midi device has one device instance. It contains * common information and the linked-list of opened files, */ -struct _snd_virmidi_dev { - snd_card_t *card; /* associated card */ - snd_rawmidi_t *rmidi; /* rawmidi device */ +struct snd_virmidi_dev { + struct snd_card *card; /* associated card */ + struct snd_rawmidi *rmidi; /* rawmidi device */ int seq_mode; /* SNDRV_VIRMIDI_XXX */ int device; /* sequencer device */ int client; /* created/attached client */ @@ -78,6 +76,6 @@ struct _snd_virmidi_dev { #define SNDRV_VIRMIDI_SEQ_ATTACH 1 #define SNDRV_VIRMIDI_SEQ_DISPATCH 2 -int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); +int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi); #endif /* __SOUND_SEQ_VIRMIDI */ diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h index 674585f88a31..5d1ab9c4950f 100644 --- a/include/sound/sfnt_info.h +++ b/include/sound/sfnt_info.h @@ -35,7 +35,7 @@ #endif /* patch interface header: 16 bytes */ -typedef struct soundfont_patch_info_t { +struct soundfont_patch_info { unsigned short key; /* use the key below */ #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) @@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t { short reserved; /* word alignment data */ /* the actual patch data begins after this */ -} soundfont_patch_info_t; +}; /* @@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t { #define SNDRV_SFNT_PATCH_NAME_LEN 32 -typedef struct soundfont_open_parm_t { +struct soundfont_open_parm { unsigned short type; /* sample type */ #define SNDRV_SFNT_PAT_TYPE_MISC 0 #define SNDRV_SFNT_PAT_TYPE_GUS 6 @@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t { short reserved; char name[SNDRV_SFNT_PATCH_NAME_LEN]; -} soundfont_open_parm_t; +}; /* @@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t { */ /* wave table envelope & effect parameters to control EMU8000 */ -typedef struct soundfont_voice_parm_t { +struct soundfont_voice_parm { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ @@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t { unsigned char chorus; /* chorus send (0x00) */ unsigned char reverb; /* reverb send (0x00) */ unsigned short reserved[4]; /* not used */ -} soundfont_voice_parm_t; +}; /* wave table parameters: 92 bytes */ -typedef struct soundfont_voice_info_t { +struct soundfont_voice_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* sample offset correction */ @@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t { unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ short scaleTuning; /* pitch scale tuning(%), normally 100 */ - soundfont_voice_parm_t parm; /* voice envelope parameters */ + struct soundfont_voice_parm parm; /* voice envelope parameters */ unsigned short sample_mode; /* sample mode_flag (set by driver) */ -} soundfont_voice_info_t; +}; /* instrument info header: 4 bytes */ -typedef struct soundfont_voice_rec_hdr_t { +struct soundfont_voice_rec_hdr { unsigned char bank; /* midi bank number */ unsigned char instr; /* midi preset number */ char nvoices; /* number of voices */ @@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t { #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ -} soundfont_voice_rec_hdr_t; +}; /* @@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t { */ /* wave table sample header: 32 bytes */ -typedef struct soundfont_sample_info_t { +struct soundfont_sample_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* start & end offset */ @@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t { #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ unsigned int truesize; /* used memory size (set by driver) */ -} soundfont_sample_info_t; +}; /* * voice preset mapping (aliasing) */ -typedef struct soundfont_voice_map_t { +struct soundfont_voice_map { int map_bank, map_instr, map_key; /* key = -1 means all keys */ int src_bank, src_instr, src_key; -} soundfont_voice_map_t; +}; /* @@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t { #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ -struct sndrv_emux_misc_mode { +struct snd_emux_misc_mode { int port; /* -1 = all */ int mode; int value; @@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode { enum { SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), - SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), + SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info), SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), - SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), + SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode), }; #endif /* __SOUND_SFNT_INFO_H */ diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h index 4b0b2b9370b9..0b9e5de94ff1 100644 --- a/include/sound/snd_wavefront.h +++ b/include/sound/snd_wavefront.h @@ -26,8 +26,8 @@ struct _snd_wavefront_midi { snd_wavefront_mpu_id output_mpu; /* most-recently-used */ snd_wavefront_mpu_id input_mpu; /* most-recently-used */ unsigned int mode[2]; /* MPU401_MODE_XXX */ - snd_rawmidi_substream_t *substream_output[2]; - snd_rawmidi_substream_t *substream_input[2]; + struct snd_rawmidi_substream *substream_output[2]; + struct snd_rawmidi_substream *substream_input[2]; struct timer_list timer; spinlock_t open; spinlock_t virtual; /* protects isvirtual */ @@ -38,8 +38,8 @@ struct _snd_wavefront_midi { #define MPU_ACK 0xFE #define UART_MODE_ON 0x3F -extern snd_rawmidi_ops_t snd_wavefront_midi_output; -extern snd_rawmidi_ops_t snd_wavefront_midi_input; +extern struct snd_rawmidi_ops snd_wavefront_midi_output; +extern struct snd_rawmidi_ops snd_wavefront_midi_input; extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); @@ -116,23 +116,23 @@ extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ; extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *, unsigned char *); -extern int snd_wavefront_synth_ioctl (snd_hwdep_t *, +extern int snd_wavefront_synth_ioctl (struct snd_hwdep *, struct file *, unsigned int cmd, unsigned long arg); -extern int snd_wavefront_synth_open (snd_hwdep_t *, struct file *); -extern int snd_wavefront_synth_release (snd_hwdep_t *, struct file *); +extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *); +extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *); /* FX processor - see also yss225.[ch] */ extern int snd_wavefront_fx_start (snd_wavefront_t *); extern int snd_wavefront_fx_detect (snd_wavefront_t *); -extern int snd_wavefront_fx_ioctl (snd_hwdep_t *, +extern int snd_wavefront_fx_ioctl (struct snd_hwdep *, struct file *, unsigned int cmd, unsigned long arg); -extern int snd_wavefront_fx_open (snd_hwdep_t *, struct file *); -extern int snd_wavefront_fx_release (snd_hwdep_t *, struct file *); +extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *); +extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *); /* prefix in all snd_printk() delivered messages */ diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h index c992958f5e3c..61a010c65d02 100644 --- a/include/sound/soundfont.h +++ b/include/sound/soundfont.h @@ -29,94 +29,93 @@ #define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ #define SF_IS_DRUM_BANK(z) ((z) == 128) -typedef struct snd_sf_zone { +struct snd_sf_zone { struct snd_sf_zone *next; /* Link to next */ unsigned char bank; /* Midi bank for this zone */ unsigned char instr; /* Midi program for this zone */ unsigned char mapped; /* True if mapped to something else */ - soundfont_voice_info_t v; /* All the soundfont parameters */ + struct soundfont_voice_info v; /* All the soundfont parameters */ int counter; struct snd_sf_sample *sample; /* Link to sample */ /* The following deals with preset numbers (programs) */ struct snd_sf_zone *next_instr; /* Next zone of this instrument */ struct snd_sf_zone *next_zone; /* Next zone in play list */ -} snd_sf_zone_t; +}; -typedef struct snd_sf_sample { - soundfont_sample_info_t v; +struct snd_sf_sample { + struct soundfont_sample_info v; int counter; - snd_util_memblk_t *block; /* allocated data block */ + struct snd_util_memblk *block; /* allocated data block */ struct snd_sf_sample *next; -} snd_sf_sample_t; +}; /* * This represents all the information relating to a soundfont. */ -typedef struct snd_soundfont { +struct snd_soundfont { struct snd_soundfont *next; /* Link to next */ /*struct snd_soundfont *prev;*/ /* Link to previous */ short id; /* file id */ short type; /* font type */ unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ - snd_sf_zone_t *zones; /* Font information */ - snd_sf_sample_t *samples; /* The sample headers */ -} snd_soundfont_t; + struct snd_sf_zone *zones; /* Font information */ + struct snd_sf_sample *samples; /* The sample headers */ +}; /* * Type of the sample access callback */ -typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, - snd_util_memhdr_t *hdr, const void __user *buf, long count); -typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp, - snd_util_memhdr_t *hdr); -typedef void (*snd_sf_sample_reset_t)(void *private); - -typedef struct snd_sf_callback { +struct snd_sf_callback { void *private_data; - snd_sf_sample_new_t sample_new; - snd_sf_sample_free_t sample_free; - snd_sf_sample_reset_t sample_reset; -} snd_sf_callback_t; + int (*sample_new)(void *private_data, struct snd_sf_sample *sp, + struct snd_util_memhdr *hdr, + const void __user *buf, long count); + int (*sample_free)(void *private_data, struct snd_sf_sample *sp, + struct snd_util_memhdr *hdr); + void (*sample_reset)(void *private); +}; /* * List of soundfonts. */ -typedef struct snd_sf_list { - snd_soundfont_t *currsf; /* The currently open soundfont */ +struct snd_sf_list { + struct snd_soundfont *currsf; /* The currently open soundfont */ int open_client; /* client pointer for lock */ int mem_used; /* used memory size */ - snd_sf_zone_t *presets[SF_MAX_PRESETS]; - snd_soundfont_t *fonts; /* The list of soundfonts */ + struct snd_sf_zone *presets[SF_MAX_PRESETS]; + struct snd_soundfont *fonts; /* The list of soundfonts */ int fonts_size; /* number of fonts allocated */ int zone_counter; /* last allocated time for zone */ int sample_counter; /* last allocated time for sample */ int zone_locked; /* locked time for zone */ int sample_locked; /* locked time for sample */ - snd_sf_callback_t callback; /* callback functions */ + struct snd_sf_callback callback; /* callback functions */ int presets_locked; struct semaphore presets_mutex; spinlock_t lock; - snd_util_memhdr_t *memhdr; -} snd_sf_list_t; + struct snd_util_memhdr *memhdr; +}; /* Prototypes for soundfont.c */ -int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); -int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, +int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, + long count, int client); +int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count, int client); -int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); +int snd_soundfont_close_check(struct snd_sf_list *sflist, int client); -snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); -void snd_sf_free(snd_sf_list_t *sflist); +struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback, + struct snd_util_memhdr *hdr); +void snd_sf_free(struct snd_sf_list *sflist); -int snd_soundfont_remove_samples(snd_sf_list_t *sflist); -int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); +int snd_soundfont_remove_samples(struct snd_sf_list *sflist); +int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist); -int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, +int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, - snd_sf_zone_t **table, int max_layers); + struct snd_sf_zone **table, int max_layers); /* Parameter conversions */ int snd_sf_calc_parm_hold(int msec); diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index b82e408e758f..a4f554520197 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -24,15 +24,15 @@ #include <linux/videodev.h> -typedef struct snd_tea575x tea575x_t; +struct snd_tea575x; struct snd_tea575x_ops { - void (*write)(tea575x_t *tea, unsigned int val); - unsigned int (*read)(tea575x_t *tea); + void (*write)(struct snd_tea575x *tea, unsigned int val); + unsigned int (*read)(struct snd_tea575x *tea); }; struct snd_tea575x { - snd_card_t *card; + struct snd_card *card; struct video_device vd; /* video device */ struct file_operations fops; int dev_nr; /* requested device number + 1 */ @@ -45,7 +45,7 @@ struct snd_tea575x { void *private_data; }; -void snd_tea575x_init(tea575x_t *tea); -void snd_tea575x_exit(tea575x_t *tea); +void snd_tea575x_init(struct snd_tea575x *tea); +void snd_tea575x_exit(struct snd_tea575x *tea); #endif /* __SOUND_TEA575X_TUNER_H */ diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h index 3896c0a50907..51b282b76896 100644 --- a/include/sound/tea6330t.h +++ b/include/sound/tea6330t.h @@ -22,21 +22,10 @@ * */ -#include "control.h" #include "i2c.h" /* generic i2c support */ -typedef struct { - snd_i2c_device_t *device; - snd_i2c_bus_t *bus; - int equalizer; - int fader; - unsigned char regs[8]; - unsigned char mleft, mright; - unsigned char bass, treble; - unsigned char max_bass, max_treble; -} tea6330t_t; - -extern int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer); -extern int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader); +int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer); +int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus, + int equalizer, int fader); #endif /* __SOUND_TEA6330T_H */ diff --git a/include/sound/timer.h b/include/sound/timer.h index b55f38ae56e1..5ece2bf541dc 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h @@ -26,20 +26,6 @@ #include <sound/asound.h> #include <linux/interrupt.h> -typedef enum sndrv_timer_class snd_timer_class_t; -typedef enum sndrv_timer_slave_class snd_timer_slave_class_t; -typedef enum sndrv_timer_global snd_timer_global_t; -typedef struct sndrv_timer_id snd_timer_id_t; -typedef struct sndrv_timer_ginfo snd_timer_ginfo_t; -typedef struct sndrv_timer_gparams snd_timer_gparams_t; -typedef struct sndrv_timer_gstatus snd_timer_gstatus_t; -typedef struct sndrv_timer_select snd_timer_select_t; -typedef struct sndrv_timer_info snd_timer_info_t; -typedef struct sndrv_timer_params snd_timer_params_t; -typedef struct sndrv_timer_status snd_timer_status_t; -typedef struct sndrv_timer_read snd_timer_read_t; -typedef struct sndrv_timer_tread snd_timer_tread_t; - #define snd_timer_chip(timer) ((timer)->private_data) #define SNDRV_TIMER_DEVICES 16 @@ -64,11 +50,9 @@ typedef struct sndrv_timer_tread snd_timer_tread_t; #define SNDRV_TIMER_FLG_CHANGE 0x00000001 #define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ -typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); -typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event, - struct timespec * tstamp, unsigned long resolution); +struct snd_timer; -struct _snd_timer_hardware { +struct snd_timer_hardware { /* -- must be filled with low-level driver */ unsigned int flags; /* various flags */ unsigned long resolution; /* average timer resolution for one tick in nsec */ @@ -76,18 +60,18 @@ struct _snd_timer_hardware { unsigned long resolution_max; /* maximal resolution */ unsigned long ticks; /* max timer ticks per interrupt */ /* -- low-level functions -- */ - int (*open) (snd_timer_t * timer); - int (*close) (snd_timer_t * timer); - unsigned long (*c_resolution) (snd_timer_t * timer); - int (*start) (snd_timer_t * timer); - int (*stop) (snd_timer_t * timer); - int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); - int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); + int (*open) (struct snd_timer * timer); + int (*close) (struct snd_timer * timer); + unsigned long (*c_resolution) (struct snd_timer * timer); + int (*start) (struct snd_timer * timer); + int (*stop) (struct snd_timer * timer); + int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den); + int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den); }; -struct _snd_timer { - snd_timer_class_t tmr_class; - snd_card_t *card; +struct snd_timer { + int tmr_class; + struct snd_card *card; struct module *module; int tmr_device; int tmr_subdevice; @@ -97,8 +81,8 @@ struct _snd_timer { int running; /* running instances */ unsigned long sticks; /* schedule ticks */ void *private_data; - void (*private_free) (snd_timer_t *timer); - struct _snd_timer_hardware hw; + void (*private_free) (struct snd_timer *timer); + struct snd_timer_hardware hw; spinlock_t lock; struct list_head device_list; struct list_head open_list_head; @@ -108,49 +92,53 @@ struct _snd_timer { struct tasklet_struct task_queue; }; -struct _snd_timer_instance { - snd_timer_t * timer; +struct snd_timer_instance { + struct snd_timer *timer; char *owner; unsigned int flags; void *private_data; - void (*private_free) (snd_timer_instance_t *ti); - snd_timer_callback_t callback; - snd_timer_ccallback_t ccallback; + void (*private_free) (struct snd_timer_instance *ti); + void (*callback) (struct snd_timer_instance *timeri, + unsigned long ticks, unsigned long resolution); + void (*ccallback) (struct snd_timer_instance * timeri, + int event, + struct timespec * tstamp, + unsigned long resolution); void *callback_data; unsigned long ticks; /* auto-load ticks when expired */ unsigned long cticks; /* current ticks */ unsigned long pticks; /* accumulated ticks for callback */ unsigned long resolution; /* current resolution for tasklet */ unsigned long lost; /* lost ticks */ - snd_timer_slave_class_t slave_class; + int slave_class; unsigned int slave_id; struct list_head open_list; struct list_head active_list; struct list_head ack_list; struct list_head slave_list_head; struct list_head slave_active_head; - snd_timer_instance_t *master; + struct snd_timer_instance *master; }; /* * Registering */ -extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); -extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); -extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); -extern int snd_timer_global_free(snd_timer_t *timer); -extern int snd_timer_global_register(snd_timer_t *timer); -extern int snd_timer_global_unregister(snd_timer_t *timer); - -extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); -extern int snd_timer_close(snd_timer_instance_t * timeri); -extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); -extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); -extern int snd_timer_stop(snd_timer_instance_t * timeri); -extern int snd_timer_continue(snd_timer_instance_t * timeri); -extern int snd_timer_pause(snd_timer_instance_t * timeri); - -extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); +int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer); +void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp); +int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); +int snd_timer_global_free(struct snd_timer *timer); +int snd_timer_global_register(struct snd_timer *timer); +int snd_timer_global_unregister(struct snd_timer *timer); + +int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); +int snd_timer_close(struct snd_timer_instance *timeri); +unsigned long snd_timer_resolution(struct snd_timer_instance *timeri); +int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks); +int snd_timer_stop(struct snd_timer_instance *timeri); +int snd_timer_continue(struct snd_timer_instance *timeri); +int snd_timer_pause(struct snd_timer_instance *timeri); + +void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left); #endif /* __SOUND_TIMER_H */ diff --git a/include/sound/trident.h b/include/sound/trident.h index a408d3925050..9752243241e5 100644 --- a/include/sound/trident.h +++ b/include/sound/trident.h @@ -253,43 +253,43 @@ enum serial_intf_ctrl_bits { #define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */ #define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */ -typedef struct _snd_trident trident_t; -typedef struct _snd_trident_voice snd_trident_voice_t; -typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t; - -typedef struct { - void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position); - void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode); - void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq); - void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume); - void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop); - void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position); - void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data); -} snd_trident_sample_ops_t; - -typedef struct { - snd_midi_channel_set_t * chset; - trident_t * trident; +struct snd_trident; +struct snd_trident_voice; +struct snd_trident_pcm_mixer; + +struct snd_trident_sample_ops { + void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position); + void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode); + void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq); + void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume); + void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop); + void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position); + void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data); +}; + +struct snd_trident_port { + struct snd_midi_channel_set * chset; + struct snd_trident * trident; int mode; /* operation mode */ int client; /* sequencer client number */ int port; /* sequencer port number */ unsigned int midi_has_voices: 1; -} snd_trident_port_t; +}; -typedef struct snd_trident_memblk_arg { +struct snd_trident_memblk_arg { short first_page, last_page; -} snd_trident_memblk_arg_t; +}; -typedef struct { +struct snd_trident_tlb { unsigned int * entries; /* 16k-aligned TLB table */ dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ unsigned long * shadow_entries; /* shadow entries with virtual addresses */ struct snd_dma_buffer buffer; - snd_util_memhdr_t * memhdr; /* page allocation list */ + struct snd_util_memhdr * memhdr; /* page allocation list */ struct snd_dma_buffer silent_page; -} snd_trident_tlb_t; +}; -struct _snd_trident_voice { +struct snd_trident_voice { unsigned int number; unsigned int use: 1, pcm: 1, @@ -300,8 +300,8 @@ struct _snd_trident_voice { unsigned char port; unsigned char index; - snd_seq_instr_t instr; - snd_trident_sample_ops_t *sample_ops; + struct snd_seq_instr instr; + struct snd_trident_sample_ops *sample_ops; /* channel parameters */ unsigned int CSO; /* 24 bits (16 on DX) */ @@ -323,13 +323,13 @@ struct _snd_trident_voice { unsigned int negCSO; /* nonzero - use negative CSO */ - snd_util_memblk_t *memblk; /* memory block if TLB enabled */ + struct snd_util_memblk *memblk; /* memory block if TLB enabled */ /* PCM data */ - trident_t *trident; - snd_pcm_substream_t *substream; - snd_trident_voice_t *extra; /* extra PCM voice (acts as interrupt generator) */ + struct snd_trident *trident; + struct snd_pcm_substream *substream; + struct snd_trident_voice *extra; /* extra PCM voice (acts as interrupt generator) */ unsigned int running: 1, capture: 1, spdif: 1, @@ -347,25 +347,25 @@ struct _snd_trident_voice { /* --- */ void *private_data; - void (*private_free)(snd_trident_voice_t *voice); + void (*private_free)(struct snd_trident_voice *voice); }; -struct _snd_4dwave { +struct snd_4dwave { int seq_client; - snd_trident_port_t seq_ports[4]; - snd_simple_ops_t simple_ops; - snd_seq_kinstr_list_t *ilist; + struct snd_trident_port seq_ports[4]; + struct snd_simple_ops simple_ops; + struct snd_seq_kinstr_list *ilist; - snd_trident_voice_t voices[64]; + struct snd_trident_voice voices[64]; int ChanSynthCount; /* number of allocated synth channels */ int max_size; /* maximum synth memory size in bytes */ int current_size; /* current allocated synth mem in bytes */ }; -struct _snd_trident_pcm_mixer { - snd_trident_voice_t *voice; /* active voice */ +struct snd_trident_pcm_mixer { + struct snd_trident_voice *voice; /* active voice */ unsigned short vol; /* front volume */ unsigned char pan; /* pan control */ unsigned char rvol; /* rear volume */ @@ -373,7 +373,7 @@ struct _snd_trident_pcm_mixer { unsigned char pad; }; -struct _snd_trident { +struct snd_trident { int irq; unsigned int device; /* device ID */ @@ -386,13 +386,13 @@ struct _snd_trident { unsigned int spurious_irq_count; unsigned int spurious_irq_max_delta; - snd_trident_tlb_t tlb; /* TLB entries for NX cards */ + struct snd_trident_tlb tlb; /* TLB entries for NX cards */ unsigned char spdif_ctrl; unsigned char spdif_pcm_ctrl; unsigned int spdif_bits; unsigned int spdif_pcm_bits; - snd_kcontrol_t *spdif_pcm_ctl; /* S/PDIF settings */ + struct snd_kcontrol *spdif_pcm_ctl; /* S/PDIF settings */ unsigned int ac97_ctrl; unsigned int ChanMap[2]; /* allocation map for hardware channels */ @@ -403,7 +403,7 @@ struct _snd_trident { unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ unsigned int in_suspend: 1; /* 1 during suspend/resume */ - struct _snd_4dwave synth; /* synth specific variables */ + struct snd_4dwave synth; /* synth specific variables */ spinlock_t event_lock; spinlock_t voice_alloc; @@ -411,52 +411,57 @@ struct _snd_trident { struct snd_dma_device dma_dev; struct pci_dev *pci; - snd_card_t *card; - snd_pcm_t *pcm; /* ADC/DAC PCM */ - snd_pcm_t *foldback; /* Foldback PCM */ - snd_pcm_t *spdif; /* SPDIF PCM */ - snd_rawmidi_t *rmidi; - snd_seq_device_t *seq_dev; + struct snd_card *card; + struct snd_pcm *pcm; /* ADC/DAC PCM */ + struct snd_pcm *foldback; /* Foldback PCM */ + struct snd_pcm *spdif; /* SPDIF PCM */ + struct snd_rawmidi *rmidi; + struct snd_seq_device *seq_dev; - ac97_bus_t *ac97_bus; - ac97_t *ac97; - ac97_t *ac97_sec; + struct snd_ac97_bus *ac97_bus; + struct snd_ac97 *ac97; + struct snd_ac97 *ac97_sec; unsigned int musicvol_wavevol; - snd_trident_pcm_mixer_t pcm_mixer[32]; - snd_kcontrol_t *ctl_vol; /* front volume */ - snd_kcontrol_t *ctl_pan; /* pan */ - snd_kcontrol_t *ctl_rvol; /* rear volume */ - snd_kcontrol_t *ctl_cvol; /* center volume */ + struct snd_trident_pcm_mixer pcm_mixer[32]; + struct snd_kcontrol *ctl_vol; /* front volume */ + struct snd_kcontrol *ctl_pan; /* pan */ + struct snd_kcontrol *ctl_rvol; /* rear volume */ + struct snd_kcontrol *ctl_cvol; /* center volume */ spinlock_t reg_lock; struct gameport *gameport; }; -int snd_trident_create(snd_card_t * card, +int snd_trident_create(struct snd_card *card, struct pci_dev *pci, int pcm_streams, int pcm_spdif_device, int max_wavetable_size, - trident_t ** rtrident); -int snd_trident_create_gameport(trident_t *trident); - -int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); -int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); -int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); -int snd_trident_attach_synthesizer(trident_t * trident); -snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port); -void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice); -void snd_trident_start_voice(trident_t * trident, unsigned int voice); -void snd_trident_stop_voice(trident_t * trident, unsigned int voice); -void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice); + struct snd_trident ** rtrident); +int snd_trident_create_gameport(struct snd_trident *trident); + +int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); +int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); +int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); +int snd_trident_attach_synthesizer(struct snd_trident * trident); +struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, + int client, int port); +void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice); +void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice); +void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice); +void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice); +int snd_trident_suspend(struct pci_dev *pci, pm_message_t state); +int snd_trident_resume(struct pci_dev *pci); /* TLB memory allocation */ -snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream); -int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk); -snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); -int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); -int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size); +struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident, + struct snd_pcm_substream *substream); +int snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk); +struct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size); +int snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk); +int snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk, + int offset, const char __user *data, int size); #endif /* __SOUND_TRIDENT_H */ diff --git a/include/sound/typedefs.h b/include/sound/typedefs.h new file mode 100644 index 000000000000..f454b0206b93 --- /dev/null +++ b/include/sound/typedefs.h @@ -0,0 +1,173 @@ +/* + * Typedef's for backward compatibility (for out-of-kernel drivers) + * + * This file will be removed soon in future + */ + +/* core stuff */ +typedef struct snd_card snd_card_t; +typedef struct snd_device snd_device_t; +typedef struct snd_device_ops snd_device_ops_t; +typedef enum snd_card_type snd_card_type_t; +typedef struct snd_minor snd_minor_t; + +/* info */ +typedef struct snd_info_entry snd_info_entry_t; +typedef struct snd_info_buffer snd_info_buffer_t; + +/* control */ +typedef struct snd_ctl_file snd_ctl_file_t; +typedef struct snd_kcontrol snd_kcontrol_t; +typedef struct snd_kcontrol_new snd_kcontrol_new_t; +typedef struct snd_kcontrol_volatile snd_kcontrol_volatile_t; +typedef struct snd_kctl_event snd_kctl_event_t; +typedef struct snd_aes_iec958 snd_aes_iec958_t; +typedef struct snd_ctl_card_info snd_ctl_card_info_t; +typedef struct snd_ctl_elem_id snd_ctl_elem_id_t; +typedef struct snd_ctl_elem_list snd_ctl_elem_list_t; +typedef struct snd_ctl_elem_info snd_ctl_elem_info_t; +typedef struct snd_ctl_elem_value snd_ctl_elem_value_t; +typedef struct snd_ctl_event snd_ctl_event_t; +#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) +typedef struct snd_mixer_oss snd_mixer_oss_t; +#endif + +/* timer */ +typedef struct snd_timer snd_timer_t; +typedef struct snd_timer_instance snd_timer_instance_t; +typedef struct snd_timer_id snd_timer_id_t; +typedef struct snd_timer_ginfo snd_timer_ginfo_t; +typedef struct snd_timer_gparams snd_timer_gparams_t; +typedef struct snd_timer_gstatus snd_timer_gstatus_t; +typedef struct snd_timer_select snd_timer_select_t; +typedef struct snd_timer_info snd_timer_info_t; +typedef struct snd_timer_params snd_timer_params_t; +typedef struct snd_timer_status snd_timer_status_t; +typedef struct snd_timer_read snd_timer_read_t; +typedef struct snd_timer_tread snd_timer_tread_t; + +/* PCM */ +typedef struct snd_pcm snd_pcm_t; +typedef struct snd_pcm_str snd_pcm_str_t; +typedef struct snd_pcm_substream snd_pcm_substream_t; +typedef struct snd_pcm_info snd_pcm_info_t; +typedef struct snd_pcm_hw_params snd_pcm_hw_params_t; +typedef struct snd_pcm_sw_params snd_pcm_sw_params_t; +typedef struct snd_pcm_channel_info snd_pcm_channel_info_t; +typedef struct snd_pcm_status snd_pcm_status_t; +typedef struct snd_pcm_mmap_status snd_pcm_mmap_status_t; +typedef struct snd_pcm_mmap_control snd_pcm_mmap_control_t; +typedef struct snd_mask snd_mask_t; +typedef struct snd_sg_buf snd_pcm_sgbuf_t; + +typedef struct snd_interval snd_interval_t; +typedef struct snd_xferi snd_xferi_t; +typedef struct snd_xfern snd_xfern_t; +typedef struct snd_xferv snd_xferv_t; + +typedef struct snd_pcm_file snd_pcm_file_t; +typedef struct snd_pcm_runtime snd_pcm_runtime_t; +typedef struct snd_pcm_hardware snd_pcm_hardware_t; +typedef struct snd_pcm_ops snd_pcm_ops_t; +typedef struct snd_pcm_hw_rule snd_pcm_hw_rule_t; +typedef struct snd_pcm_hw_constraints snd_pcm_hw_constraints_t; +typedef struct snd_ratnum ratnum_t; +typedef struct snd_ratden ratden_t; +typedef struct snd_pcm_hw_constraint_ratnums snd_pcm_hw_constraint_ratnums_t; +typedef struct snd_pcm_hw_constraint_ratdens snd_pcm_hw_constraint_ratdens_t; +typedef struct snd_pcm_hw_constraint_list snd_pcm_hw_constraint_list_t; +typedef struct snd_pcm_group snd_pcm_group_t; +typedef struct snd_pcm_notify snd_pcm_notify_t; + +/* rawmidi */ +typedef struct snd_rawmidi snd_rawmidi_t; +typedef struct snd_rawmidi_info snd_rawmidi_info_t; +typedef struct snd_rawmidi_params snd_rawmidi_params_t; +typedef struct snd_rawmidi_status snd_rawmidi_status_t; +typedef struct snd_rawmidi_runtime snd_rawmidi_runtime_t; +typedef struct snd_rawmidi_substream snd_rawmidi_substream_t; +typedef struct snd_rawmidi_str snd_rawmidi_str_t; +typedef struct snd_rawmidi_ops snd_rawmidi_ops_t; +typedef struct snd_rawmidi_global_ops snd_rawmidi_global_ops_t; +typedef struct snd_rawmidi_file snd_rawmidi_file_t; + +/* hwdep */ +typedef struct snd_hwdep snd_hwdep_t; +typedef struct snd_hwdep_info snd_hwdep_info_t; +typedef struct snd_hwdep_dsp_status snd_hwdep_dsp_status_t; +typedef struct snd_hwdep_dsp_image snd_hwdep_dsp_image_t; +typedef struct snd_hwdep_ops snd_hwdep_ops_t; + +/* sequencer */ +typedef struct snd_seq_port_info snd_seq_port_info_t; +typedef struct snd_seq_port_subscribe snd_seq_port_subscribe_t; +typedef struct snd_seq_event snd_seq_event_t; +typedef struct snd_seq_addr snd_seq_addr_t; +typedef struct snd_seq_ev_volume snd_seq_ev_volume_t; +typedef struct snd_seq_ev_loop snd_seq_ev_loop_t; +typedef struct snd_seq_remove_events snd_seq_remove_events_t; +typedef struct snd_seq_query_subs snd_seq_query_subs_t; +typedef struct snd_seq_system_info snd_seq_system_info_t; +typedef struct snd_seq_client_info snd_seq_client_info_t; +typedef struct snd_seq_queue_info snd_seq_queue_info_t; +typedef struct snd_seq_queue_status snd_seq_queue_status_t; +typedef struct snd_seq_queue_tempo snd_seq_queue_tempo_t; +typedef struct snd_seq_queue_owner snd_seq_queue_owner_t; +typedef struct snd_seq_queue_timer snd_seq_queue_timer_t; +typedef struct snd_seq_queue_client snd_seq_queue_client_t; +typedef struct snd_seq_client_pool snd_seq_client_pool_t; +typedef struct snd_seq_instr snd_seq_instr_t; +typedef struct snd_seq_instr_data snd_seq_instr_data_t; +typedef struct snd_seq_instr_header snd_seq_instr_header_t; + +typedef struct snd_seq_user_client user_client_t; +typedef struct snd_seq_kernel_client kernel_client_t; +typedef struct snd_seq_client client_t; +typedef struct snd_seq_queue queue_t; + +/* seq_device */ +typedef struct snd_seq_device snd_seq_device_t; +typedef struct snd_seq_dev_ops snd_seq_dev_ops_t; + +/* seq_midi */ +typedef struct snd_midi_event snd_midi_event_t; + +/* seq_midi_emul */ +typedef struct snd_midi_channel snd_midi_channel_t; +typedef struct snd_midi_channel_set snd_midi_channel_set_t; +typedef struct snd_midi_op snd_midi_op_t; + +/* seq_oss */ +typedef struct snd_seq_oss_arg snd_seq_oss_arg_t; +typedef struct snd_seq_oss_callback snd_seq_oss_callback_t; +typedef struct snd_seq_oss_reg snd_seq_oss_reg_t; + +/* virmidi */ +typedef struct snd_virmidi_dev snd_virmidi_dev_t; +typedef struct snd_virmidi snd_virmidi_t; + +/* seq_instr */ +typedef struct snd_seq_kcluster snd_seq_kcluster_t; +typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t; +typedef struct snd_seq_kinstr snd_seq_kinstr_t; +typedef struct snd_seq_kinstr_list snd_seq_kinstr_list_t; + +/* ac97 */ +typedef struct snd_ac97_bus ac97_bus_t; +typedef struct snd_ac97_bus_ops ac97_bus_ops_t; +typedef struct snd_ac97_template ac97_template_t; +typedef struct snd_ac97 ac97_t; + +/* opl3/4 */ +typedef struct snd_opl3 opl3_t; +typedef struct snd_opl4 opl4_t; + +/* mpu401 */ +typedef struct snd_mpu401 mpu401_t; + +/* i2c */ +typedef struct snd_i2c_device snd_i2c_device_t; +typedef struct snd_i2c_bus snd_i2c_bus_t; + +typedef struct snd_ak4531 ak4531_t; + diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h index 61ff65a628bc..2e564bfb37fe 100644 --- a/include/sound/uda1341.h +++ b/include/sound/uda1341.h @@ -15,7 +15,7 @@ * features support */ -/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */ +/* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */ #define UDA1341_ALSA_NAME "snd-uda1341" @@ -37,11 +37,6 @@ enum uda1341_onoff { ON, }; -const char *onoff_names[] = { - "Off", - "On", -}; - enum uda1341_format { I2S=0, LSB16, @@ -53,17 +48,6 @@ enum uda1341_format { LSB20MSB, }; -const char *format_names[] = { - "I2S-bus", - "LSB 16bits", - "LSB 18bits", - "LSB 20bits", - "MSB", - "in LSB 16bits/out MSB", - "in LSB 18bits/out MSB", - "in LSB 20bits/out MSB", -}; - enum uda1341_fs { F512=0, F384, @@ -71,23 +55,11 @@ enum uda1341_fs { Funused, }; -const char *fs_names[] = { - "512*fs", - "384*fs", - "256*fs", - "Unused - bad value!", -}; - enum uda1341_peak { BEFORE=0, AFTER, }; -const char *peak_names[] = { - "before", - "after", -}; - enum uda1341_filter { FLAT=0, MIN, @@ -95,24 +67,6 @@ enum uda1341_filter { MAX, }; -const char *filter_names[] = { - "flat", - "min", - "min", - "max", -}; - -const char*bass_values[][16] = { - {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", - "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", - "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", - "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB", - "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max -}; - enum uda1341_mixer { DOUBLE, LINE, @@ -120,13 +74,6 @@ enum uda1341_mixer { MIXER, }; -const char *mixer_names[] = { - "double differential", - "input channel 1 (line in)", - "input channel 2 (microphone)", - "digital mixer", -}; - enum uda1341_deemp { NONE, D32, @@ -134,58 +81,6 @@ enum uda1341_deemp { D48, }; -const char *deemp_names[] = { - "none", - "32 kHz", - "44.1 kHz", - "48 kHz", -}; - -const char *mic_sens_value[] = { - "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used", -}; - -const unsigned short AGC_atime[] = { - 11, 16, 11, 16, 21, 11, 16, 21, -}; - -const unsigned short AGC_dtime[] = { - 100, 100, 200, 200, 200, 400, 400, 400, -}; - -const char *AGC_level[] = { - "-9.0", "-11.5", "-15.0", "-17.5", -}; - -const char *ig_small_value[] = { - "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5", -}; - -/* - * this was computed as peak_value[i] = pow((63-i)*1.42,1.013) - * - * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2 - * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29 - * [61]=-2.78, [62] = -1.48, [63] = 0.0 - * I tried to compute it, but using but even using logarithm with base either 10 or 2 - * i was'n able to get values in the table from the formula. So I constructed another - * formula (see above) to interpolate the values as good as possible. If there is some - * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks. - * UDA1341TS datasheet is available at: - * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf - */ -const char *peak_value[] = { - "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB", - "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB", - "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB", - "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB", - "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB", - "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB", - "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB", - "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB", - "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB", -}; - enum uda1341_config { CMD_READ_REG = 0, CMD_RESET, @@ -224,7 +119,7 @@ enum write_through { FLUSH, }; -int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt); +int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt); /* * Local variables: diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h index 9d2cdfa0c42a..69944bbb5445 100644 --- a/include/sound/util_mem.h +++ b/include/sound/util_mem.h @@ -20,29 +20,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -typedef struct snd_util_memblk snd_util_memblk_t; -typedef struct snd_util_memhdr snd_util_memhdr_t; -typedef unsigned int snd_util_unit_t; - /* * memory block */ struct snd_util_memblk { - snd_util_unit_t size; /* size of this block */ - snd_util_unit_t offset; /* zero-offset of this block */ + unsigned int size; /* size of this block */ + unsigned int offset; /* zero-offset of this block */ struct list_head list; /* link */ }; -#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) +#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk)) /* * memory management information */ struct snd_util_memhdr { - snd_util_unit_t size; /* size of whole data */ + unsigned int size; /* size of whole data */ struct list_head block; /* block linked-list header */ int nblocks; /* # of allocated blocks */ - snd_util_unit_t used; /* used memory size */ + unsigned int used; /* used memory size */ int block_extra_size; /* extra data size of chunk */ struct semaphore block_mutex; /* lock */ }; @@ -50,15 +46,17 @@ struct snd_util_memhdr { /* * prototypes */ -snd_util_memhdr_t *snd_util_memhdr_new(int memsize); -void snd_util_memhdr_free(snd_util_memhdr_t *hdr); -snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); -int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); -int snd_util_mem_avail(snd_util_memhdr_t *hdr); +struct snd_util_memhdr *snd_util_memhdr_new(int memsize); +void snd_util_memhdr_free(struct snd_util_memhdr *hdr); +struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); +int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); +int snd_util_mem_avail(struct snd_util_memhdr *hdr); /* functions without mutex */ -snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); -void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); -snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); +struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); +void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); +struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr, + unsigned int units, + struct list_head *prev); #endif /* __SOUND_UTIL_MEM_H */ diff --git a/include/sound/version.h b/include/sound/version.h index d1bd3b723967..919da0dd001c 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated by configure. */ -#define CONFIG_SND_VERSION "1.0.10rc3" -#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)" +#define CONFIG_SND_VERSION "1.0.11rc2" +#define CONFIG_SND_DATE " (Wed Jan 04 08:57:20 2006 UTC)" diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h index 7a60a3888667..5fd6f3305e0d 100644 --- a/include/sound/vx_core.h +++ b/include/sound/vx_core.h @@ -36,9 +36,6 @@ struct firmware; struct device; -typedef struct snd_vx_core vx_core_t; -typedef struct vx_pipe vx_pipe_t; - #define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ /* @@ -76,7 +73,7 @@ struct vx_pipe { int channels; unsigned int differed_type; pcx_time_t pcx_time; - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; int hbuf_size; /* H-buffer size in bytes */ int buffer_bytes; /* the ALSA pcm buffer size in bytes */ @@ -88,36 +85,38 @@ struct vx_pipe { u64 cur_count; /* current sample position (for playback) */ unsigned int references; /* an output pipe may be used for monitoring and/or playback */ - vx_pipe_t *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ + struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ struct tasklet_struct start_tq; }; +struct vx_core; + struct snd_vx_ops { /* low-level i/o */ - unsigned char (*in8)(vx_core_t *chip, int reg); - unsigned int (*in32)(vx_core_t *chip, int reg); - void (*out8)(vx_core_t *chip, int reg, unsigned char val); - void (*out32)(vx_core_t *chip, int reg, unsigned int val); + unsigned char (*in8)(struct vx_core *chip, int reg); + unsigned int (*in32)(struct vx_core *chip, int reg); + void (*out8)(struct vx_core *chip, int reg, unsigned char val); + void (*out32)(struct vx_core *chip, int reg, unsigned int val); /* irq */ - int (*test_and_ack)(vx_core_t *chip); - void (*validate_irq)(vx_core_t *chip, int enable); + int (*test_and_ack)(struct vx_core *chip); + void (*validate_irq)(struct vx_core *chip, int enable); /* codec */ - void (*write_codec)(vx_core_t *chip, int codec, unsigned int data); - void (*akm_write)(vx_core_t *chip, int reg, unsigned int data); - void (*reset_codec)(vx_core_t *chip); - void (*change_audio_source)(vx_core_t *chip, int src); - void (*set_clock_source)(vx_core_t *chp, int src); + void (*write_codec)(struct vx_core *chip, int codec, unsigned int data); + void (*akm_write)(struct vx_core *chip, int reg, unsigned int data); + void (*reset_codec)(struct vx_core *chip); + void (*change_audio_source)(struct vx_core *chip, int src); + void (*set_clock_source)(struct vx_core *chp, int src); /* chip init */ - int (*load_dsp)(vx_core_t *chip, int idx, const struct firmware *fw); - void (*reset_dsp)(vx_core_t *chip); - void (*reset_board)(vx_core_t *chip, int cold_reset); - int (*add_controls)(vx_core_t *chip); + int (*load_dsp)(struct vx_core *chip, int idx, const struct firmware *fw); + void (*reset_dsp)(struct vx_core *chip); + void (*reset_board)(struct vx_core *chip, int cold_reset); + int (*add_controls)(struct vx_core *chip); /* pcm */ - void (*dma_write)(vx_core_t *chip, snd_pcm_runtime_t *runtime, - vx_pipe_t *pipe, int count); - void (*dma_read)(vx_core_t *chip, snd_pcm_runtime_t *runtime, - vx_pipe_t *pipe, int count); + void (*dma_write)(struct vx_core *chip, struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe, int count); + void (*dma_read)(struct vx_core *chip, struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe, int count); }; struct snd_vx_hardware { @@ -158,10 +157,10 @@ enum { /* min/max values for analog output for old codecs */ #define VX_ANALOG_OUT_LEVEL_MAX 0xe3 -struct snd_vx_core { +struct vx_core { /* ALSA stuff */ - snd_card_t *card; - snd_pcm_t *pcm[VX_MAX_CODECS]; + struct snd_card *card; + struct snd_pcm *pcm[VX_MAX_CODECS]; int type; /* VX_TYPE_XXX */ int irq; @@ -179,7 +178,7 @@ struct snd_vx_core { unsigned int pcm_running; struct device *dev; - snd_hwdep_t *hwdep; + struct snd_hwdep *hwdep; struct vx_rmh irq_rmh; /* RMH used in interrupts */ @@ -216,14 +215,14 @@ struct snd_vx_core { /* * constructor */ -vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, - struct snd_vx_ops *ops, int extra_size); -int snd_vx_setup_firmware(vx_core_t *chip); -int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *dsp); -int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *dsp); -int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp); +struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, + struct snd_vx_ops *ops, int extra_size); +int snd_vx_setup_firmware(struct vx_core *chip); +int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp); +int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp); +int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp); -void snd_vx_free_firmware(vx_core_t *chip); +void snd_vx_free_firmware(struct vx_core *chip); /* * interrupt handler; exported for pcmcia @@ -233,37 +232,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs); /* * lowlevel functions */ -static inline int vx_test_and_ack(vx_core_t *chip) +static inline int vx_test_and_ack(struct vx_core *chip) { snd_assert(chip->ops->test_and_ack, return -ENXIO); return chip->ops->test_and_ack(chip); } -static inline void vx_validate_irq(vx_core_t *chip, int enable) +static inline void vx_validate_irq(struct vx_core *chip, int enable) { snd_assert(chip->ops->validate_irq, return); chip->ops->validate_irq(chip, enable); } -static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg) +static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg) { snd_assert(chip->ops->in8, return 0); return chip->ops->in8(chip, reg); } -static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg) +static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg) { snd_assert(chip->ops->in32, return 0); return chip->ops->in32(chip, reg); } -static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) +static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val) { snd_assert(chip->ops->out8, return); chip->ops->out8(chip, reg, val); } -static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) +static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val) { snd_assert(chip->ops->out32, return); chip->ops->out32(chip, reg, val); @@ -274,27 +273,25 @@ static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) #define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) #define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) -void snd_vx_delay(vx_core_t *chip, int msec); - -static inline void vx_reset_dsp(vx_core_t *chip) +static inline void vx_reset_dsp(struct vx_core *chip) { snd_assert(chip->ops->reset_dsp, return); chip->ops->reset_dsp(chip); } -int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh); -int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh); -int vx_send_rih(vx_core_t *chip, int cmd); -int vx_send_rih_nolock(vx_core_t *chip, int cmd); +int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh); +int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh); +int vx_send_rih(struct vx_core *chip, int cmd); +int vx_send_rih_nolock(struct vx_core *chip, int cmd); -void vx_reset_codec(vx_core_t *chip, int cold_reset); +void vx_reset_codec(struct vx_core *chip, int cold_reset); /* * check the bit on the specified register * returns zero if a bit matches, or a negative error code. * exported for vxpocket driver */ -int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); +int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time); #define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) #define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) #define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) @@ -303,15 +300,15 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); /* * pseudo-DMA transfer */ -static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, - vx_pipe_t *pipe, int count) +static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe, int count) { snd_assert(chip->ops->dma_write, return); chip->ops->dma_write(chip, runtime, pipe, count); } -static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, - vx_pipe_t *pipe, int count) +static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe, int count) { snd_assert(chip->ops->dma_read, return); chip->ops->dma_read(chip, runtime, pipe, count); @@ -329,27 +326,33 @@ static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtim /* * pcm stuff */ -int snd_vx_pcm_new(vx_core_t *chip); -void vx_pcm_update_intr(vx_core_t *chip, unsigned int events); +int snd_vx_pcm_new(struct vx_core *chip); +void vx_pcm_update_intr(struct vx_core *chip, unsigned int events); /* * mixer stuff */ -int snd_vx_mixer_new(vx_core_t *chip); -void vx_toggle_dac_mute(vx_core_t *chip, int mute); -int vx_sync_audio_source(vx_core_t *chip); -int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active); +int snd_vx_mixer_new(struct vx_core *chip); +void vx_toggle_dac_mute(struct vx_core *chip, int mute); +int vx_sync_audio_source(struct vx_core *chip); +int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active); /* * IEC958 & clock stuff */ -void vx_set_iec958_status(vx_core_t *chip, unsigned int bits); -int vx_set_clock(vx_core_t *chip, unsigned int freq); -void vx_set_internal_clock(vx_core_t *chip, unsigned int freq); -int vx_change_frequency(vx_core_t *chip); +void vx_set_iec958_status(struct vx_core *chip, unsigned int bits); +int vx_set_clock(struct vx_core *chip, unsigned int freq); +void vx_set_internal_clock(struct vx_core *chip, unsigned int freq); +int vx_change_frequency(struct vx_core *chip); /* + * PM + */ +int snd_vx_suspend(struct vx_core *card, pm_message_t state); +int snd_vx_resume(struct vx_core *card); + +/* * hardware constants */ diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h index c3bccbfd8d4c..d567bfdbf513 100644 --- a/include/sound/ymfpci.h +++ b/include/sound/ymfpci.h @@ -184,7 +184,7 @@ * */ -typedef struct _snd_ymfpci_playback_bank { +struct snd_ymfpci_playback_bank { u32 format; u32 loop_default; u32 base; /* 32-bit address */ @@ -215,46 +215,45 @@ typedef struct _snd_ymfpci_playback_bank { u32 eff3_gain; u32 lpfD1; u32 lpfD2; -} snd_ymfpci_playback_bank_t; + }; -typedef struct _snd_ymfpci_capture_bank { +struct snd_ymfpci_capture_bank { u32 base; /* 32-bit address */ u32 loop_end; /* 32-bit offset */ u32 start; /* 32-bit offset */ u32 num_of_loops; /* counter */ -} snd_ymfpci_capture_bank_t; +}; -typedef struct _snd_ymfpci_effect_bank { +struct snd_ymfpci_effect_bank { u32 base; /* 32-bit address */ u32 loop_end; /* 32-bit offset */ u32 start; /* 32-bit offset */ u32 temp; -} snd_ymfpci_effect_bank_t; +}; -typedef struct _snd_ymfpci_voice ymfpci_voice_t; -typedef struct _snd_ymfpci_pcm ymfpci_pcm_t; -typedef struct _snd_ymfpci ymfpci_t; +struct snd_ymfpci_pcm; +struct snd_ymfpci; -typedef enum { +enum snd_ymfpci_voice_type { YMFPCI_PCM, YMFPCI_SYNTH, YMFPCI_MIDI -} ymfpci_voice_type_t; +}; -struct _snd_ymfpci_voice { - ymfpci_t *chip; +struct snd_ymfpci_voice { + struct snd_ymfpci *chip; int number; unsigned int use: 1, pcm: 1, synth: 1, midi: 1; - snd_ymfpci_playback_bank_t *bank; + struct snd_ymfpci_playback_bank *bank; dma_addr_t bank_addr; - void (*interrupt)(ymfpci_t *chip, ymfpci_voice_t *voice); - ymfpci_pcm_t *ypcm; + void (*interrupt)(struct snd_ymfpci *chip, struct snd_ymfpci_voice *voice); + struct snd_ymfpci_pcm *ypcm; }; -typedef enum { +enum snd_ymfpci_pcm_type { PLAYBACK_VOICE, CAPTURE_REC, CAPTURE_AC97, @@ -263,13 +262,13 @@ typedef enum { EFFECT_EFF1, EFFECT_EFF2, EFFECT_EFF3 -} snd_ymfpci_pcm_type_t; +}; -struct _snd_ymfpci_pcm { - ymfpci_t *chip; - snd_ymfpci_pcm_type_t type; - snd_pcm_substream_t *substream; - ymfpci_voice_t *voices[2]; /* playback only */ +struct snd_ymfpci_pcm { + struct snd_ymfpci *chip; + enum snd_ymfpci_pcm_type type; + struct snd_pcm_substream *substream; + struct snd_ymfpci_voice *voices[2]; /* playback only */ unsigned int running: 1; unsigned int output_front: 1; unsigned int output_rear: 1; @@ -282,7 +281,7 @@ struct _snd_ymfpci_pcm { u32 shift; }; -struct _snd_ymfpci { +struct snd_ymfpci { int irq; unsigned int device_id; /* PCI device ID */ @@ -316,47 +315,47 @@ struct _snd_ymfpci { struct snd_dma_buffer ac3_tmp_base; u32 *ctrl_playback; - snd_ymfpci_playback_bank_t *bank_playback[YDSXG_PLAYBACK_VOICES][2]; - snd_ymfpci_capture_bank_t *bank_capture[YDSXG_CAPTURE_VOICES][2]; - snd_ymfpci_effect_bank_t *bank_effect[YDSXG_EFFECT_VOICES][2]; + struct snd_ymfpci_playback_bank *bank_playback[YDSXG_PLAYBACK_VOICES][2]; + struct snd_ymfpci_capture_bank *bank_capture[YDSXG_CAPTURE_VOICES][2]; + struct snd_ymfpci_effect_bank *bank_effect[YDSXG_EFFECT_VOICES][2]; int start_count; u32 active_bank; - ymfpci_voice_t voices[64]; + struct snd_ymfpci_voice voices[64]; - ac97_bus_t *ac97_bus; - ac97_t *ac97; - snd_rawmidi_t *rawmidi; - snd_timer_t *timer; + struct snd_ac97_bus *ac97_bus; + struct snd_ac97 *ac97; + struct snd_rawmidi *rawmidi; + struct snd_timer *timer; struct pci_dev *pci; - snd_card_t *card; - snd_pcm_t *pcm; - snd_pcm_t *pcm2; - snd_pcm_t *pcm_spdif; - snd_pcm_t *pcm_4ch; - snd_pcm_substream_t *capture_substream[YDSXG_CAPTURE_VOICES]; - snd_pcm_substream_t *effect_substream[YDSXG_EFFECT_VOICES]; - snd_kcontrol_t *ctl_vol_recsrc; - snd_kcontrol_t *ctl_vol_adcrec; - snd_kcontrol_t *ctl_vol_spdifrec; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_pcm *pcm2; + struct snd_pcm *pcm_spdif; + struct snd_pcm *pcm_4ch; + struct snd_pcm_substream *capture_substream[YDSXG_CAPTURE_VOICES]; + struct snd_pcm_substream *effect_substream[YDSXG_EFFECT_VOICES]; + struct snd_kcontrol *ctl_vol_recsrc; + struct snd_kcontrol *ctl_vol_adcrec; + struct snd_kcontrol *ctl_vol_spdifrec; unsigned short spdif_bits, spdif_pcm_bits; - snd_kcontrol_t *spdif_pcm_ctl; + struct snd_kcontrol *spdif_pcm_ctl; int mode_dup4ch; int rear_opened; int spdif_opened; struct { u16 left; u16 right; - snd_kcontrol_t *ctl; + struct snd_kcontrol *ctl; } pcm_mixer[32]; spinlock_t reg_lock; spinlock_t voice_lock; wait_queue_head_t interrupt_sleep; atomic_t interrupt_sleep_count; - snd_info_entry_t *proc_entry; + struct snd_info_entry *proc_entry; #ifdef CONFIG_PM u32 *saved_regs; @@ -364,17 +363,20 @@ struct _snd_ymfpci { #endif }; -int snd_ymfpci_create(snd_card_t * card, +int snd_ymfpci_create(struct snd_card *card, struct pci_dev *pci, unsigned short old_legacy_ctrl, - ymfpci_t ** rcodec); -void snd_ymfpci_free_gameport(ymfpci_t *chip); - -int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); -int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); -int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm); -int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); -int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); -int snd_ymfpci_timer(ymfpci_t *chip, int device); + struct snd_ymfpci ** rcodec); +void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); + +int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state); +int snd_ymfpci_resume(struct pci_dev *pci); + +int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); +int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); +int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); +int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); +int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); +int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); #endif /* __SOUND_YMFPCI_H */ |