19 #define ST_VENDOR_ID 0x0483
20 #define ST5481_PRODUCT_ID 0x4810
21 #define ST5481_PRODUCT_ID_MASK 0xFFF0
28 #define EP_B1_OUT 0x02U
29 #define EP_B1_IN 0x03U
30 #define EP_B2_OUT 0x04U
31 #define EP_B2_IN 0x05U
32 #define EP_D_OUT 0x06U
38 #define NUM_ISO_PACKETS_D 20
39 #define NUM_ISO_PACKETS_B 20
45 #define SIZE_ISO_PACKETS_D_IN 16
46 #define SIZE_ISO_PACKETS_D_OUT 2
47 #define SIZE_ISO_PACKETS_B_IN 32
48 #define SIZE_ISO_PACKETS_B_OUT 8
51 #define B_FLOW_ADJUST 2
57 #define SET_DEFAULT 0x06
62 #define SDELAY_VALUE 0x22
63 #define IN_D_COUNTER 0x36
64 #define OUT_D_COUNTER 0x37
65 #define IN_B1_COUNTER 0x38
66 #define OUT_B1_COUNTER 0x39
67 #define IN_B2_COUNTER 0x3a
68 #define OUT_B2_COUNTER 0x3b
69 #define FFCTRL_IN_D 0x3C
70 #define FFCTRH_IN_D 0x3D
71 #define FFCTRL_OUT_D 0x3E
72 #define FFCTRH_OUT_D 0x3F
73 #define FFCTRL_IN_B1 0x40
74 #define FFCTRH_IN_B1 0x41
75 #define FFCTRL_OUT_B1 0x42
76 #define FFCTRH_OUT_B1 0x43
77 #define FFCTRL_IN_B2 0x44
78 #define FFCTRH_IN_B2 0x45
79 #define FFCTRL_OUT_B2 0x46
80 #define FFCTRH_OUT_B2 0x47
105 #define INT_PKT_SIZE 6
109 #define RXCI_INT 0x40
111 #define DCOLL_INT 0x10
112 #define AMIVN_INT 0x04
113 #define INFOI_INT 0x04
114 #define DRXON_INT 0x02
115 #define GPCHG_INT 0x01
118 #define IN_OVERRUN 0x80
119 #define OUT_UNDERRUN 0x40
123 #define OUT_DOWN 0x04
124 #define IN_COUNTER_ZEROED 0x02
125 #define OUT_COUNTER_ZEROED 0x01
127 #define ANY_REC_INT (IN_OVERRUN + IN_UP + IN_DOWN + IN_COUNTER_ZEROED)
128 #define ANY_XMIT_INT (OUT_UNDERRUN + OUT_UP + OUT_DOWN + OUT_COUNTER_ZEROED)
132 #define ST5481_CMD_DR 0x0
133 #define ST5481_CMD_RES 0x1
134 #define ST5481_CMD_TM1 0x2
135 #define ST5481_CMD_TM2 0x3
136 #define ST5481_CMD_PUP 0x7
137 #define ST5481_CMD_AR8 0x8
138 #define ST5481_CMD_AR10 0x9
139 #define ST5481_CMD_ARL 0xA
140 #define ST5481_CMD_PDN 0xF
146 #define GREEN_LED 0x40U
147 #define RED_LED 0x80U
166 #define DOUT_STATE_COUNT (ST_DOUT_WAIT_FOR_RESET + 1)
179 #define DOUT_EVENT_COUNT (EV_DOUT_UNDERRUN + 1)
191 #define L1_STATE_COUNT (ST_L1_F8 + 1)
218 #define L1_EVENT_COUNT (EV_TIMER3 + 1)
220 #define ERR(format, arg...) \
221 printk(KERN_ERR "%s:%s: " format "\n" , __FILE__, __func__ , ## arg)
223 #define WARNING(format, arg...) \
224 printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __func__ , ## arg)
226 #define INFO(format, arg...) \
227 printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __func__ , ## arg)
247 static inline void fifo_init(
struct fifo *
fifo,
int size)
249 fifo->
r = fifo->
w = fifo->
count = 0;
257 static inline int fifo_add(
struct fifo *
fifo)
272 index = fifo->
w++ & (fifo->
size - 1);
275 spin_unlock_irqrestore(&fifo->
lock, flags);
282 static inline int fifo_remove(
struct fifo *fifo)
297 index = fifo->
r++ & (fifo->
size - 1);
300 spin_unlock_irqrestore(&fifo->
lock, flags);
317 #define MAX_EP0_MSG 16
323 #define MAX_DFRAME_LEN_L1 300
324 #define HSCX_BUFMAX 4096
400 #define TIMER3_VALUE 7000
410 #define SUBMIT_URB(urb, mem_flags) \
413 if ((status = usb_submit_urb(urb, mem_flags)) < 0) { \
414 WARNING("usb_submit_urb failed,status=%d", status); \
422 static inline int get_buf_nr(
struct urb *urbs[],
struct urb *
urb)
424 return (urbs[0] == urb ? 0 : 1);
446 unsigned int pipe,
int num_packets,
464 #define __debug_variable st5481_debug
469 #ifdef CONFIG_HISAX_DEBUG
471 #define DBG_ISO_PACKET(level, urb) \
472 if (level & __debug_variable) dump_iso_packet(__func__, urb)
482 name, urb->number_of_packets, urb->error_count);
483 for (i = 0; i < urb->number_of_packets; ++
i) {
485 len = urb->iso_frame_desc[
i].actual_length;
487 len = urb->iso_frame_desc[
i].length;
489 ofs = urb->iso_frame_desc[
i].offset;
492 data = urb->transfer_buffer + ofs;
493 for (j = 0; j < len; j++) {
501 static inline const char *ST5481_CMD_string(
int evt)
523 #define DBG_ISO_PACKET(level, urb) do {} while (0)