1 /* Copyright (c) 2010 The Regents of the University of California
2 * Barret Rhoden <brho@cs.berkeley.edu>
3 * See LICENSE for details.
5 * Rimas's Ethernet-Audio device */
7 #ifndef ROS_KERN_ETH_AUDIO_H
8 #define ROS_KERN_ETH_AUDIO_H
13 #define ETH_AUDIO_RCV_PORT 1792 /* where we listen */
14 #define ETH_AUDIO_SRC_PORT 1792 /* where we send from */
15 #define ETH_AUDIO_DST_PORT 1793 /* where we send to */
16 /* 10 channels * 4 bytes/channel * 32 samples/packet = 1280. On inbound
17 * packets, we have + 2 bytes for a * sequence ID. On outbound packets, we have
18 * 4 bytes for control messages. For now, we'll use the greater of the two,
19 * though this does mean we copy 2 extra bytes (that should be 0) into the
20 * mmap'd region. Just don't read them. */
21 #define ETH_AUDIO_PAYLOAD_SZ 1284
22 #define ETH_AUDIO_IP_HDR_SZ 20
23 #define ETH_AUDIO_HEADER_OFF (ETH_HDR_SZ + ETH_AUDIO_IP_HDR_SZ + UDP_HDR_SZ)
24 #define ETH_AUDIO_FRAME_SZ (ETH_AUDIO_PAYLOAD_SZ + ETH_AUDIO_HEADER_OFF)
27 /* Ethernet frame for what one of our packets looks like (since we don't have
28 * the infrastructure to build one properly). This implies that there are no
29 * IP or ethernet options. */
30 struct ethaud_udp_packet {
31 struct ethernet_hdr eth_hdr;
33 struct udp_hdr udp_hdr;
34 char payload[ETH_AUDIO_PAYLOAD_SZ];
35 } __attribute__((packed));
37 void eth_audio_init(void);
38 /* This is called by net subsys when it detects an ethernet audio packet */
39 void eth_audio_newpacket(void *buf);
41 #endif /* ROS_KERN_ETH_AUDIO_H */