Lines Matching refs:hfc

151 	struct hfcusb_data *hfc;	/* pointer to main structure */
223 ctrl_start_transfer(hfcusb_data *hfc)
225 if (hfc->ctrl_cnt) {
226 hfc->ctrl_urb->pipe = hfc->ctrl_out_pipe;
227 hfc->ctrl_urb->setup_packet = (u_char *)&hfc->ctrl_write;
228 hfc->ctrl_urb->transfer_buffer = NULL;
229 hfc->ctrl_urb->transfer_buffer_length = 0;
230 hfc->ctrl_write.wIndex =
231 cpu_to_le16(hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg);
232 hfc->ctrl_write.wValue =
233 cpu_to_le16(hfc->ctrl_buff[hfc->ctrl_out_idx].reg_val);
235 usb_submit_urb(hfc->ctrl_urb, GFP_ATOMIC); /* start transfer */
240 queue_control_request(hfcusb_data *hfc, __u8 reg, __u8 val, int action)
244 if (hfc->ctrl_cnt >= HFC_CTRL_BUFSIZE)
246 buf = &hfc->ctrl_buff[hfc->ctrl_in_idx]; /* pointer to new index */
250 if (++hfc->ctrl_in_idx >= HFC_CTRL_BUFSIZE)
251 hfc->ctrl_in_idx = 0; /* pointer wrap */
252 if (++hfc->ctrl_cnt == 1)
253 ctrl_start_transfer(hfc);
260 hfcusb_data *hfc = (hfcusb_data *) urb->context;
262 urb->dev = hfc->dev;
263 if (hfc->ctrl_cnt) {
264 hfc->ctrl_cnt--; /* decrement actual count */
265 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
266 hfc->ctrl_out_idx = 0; /* pointer wrap */
268 ctrl_start_transfer(hfc); /* start next transfer */
274 write_led(hfcusb_data *hfc, __u8 led_state)
276 if (led_state != hfc->old_led_state) {
277 hfc->old_led_state = led_state;
278 queue_control_request(hfc, HFCUSB_P_DATA, led_state, 1);
283 set_led_bit(hfcusb_data *hfc, signed short led_bits, int on)
287 hfc->led_state &= ~abs(led_bits);
289 hfc->led_state |= led_bits;
292 hfc->led_state |= abs(led_bits);
294 hfc->led_state &= ~led_bits;
300 handle_led(hfcusb_data *hfc, int event)
303 (hfcsusb_vdata *) hfcusb_idtab[hfc->vend_idx].driver_info;
311 set_led_bit(hfc, driver_info->led_bits[0], 1);
312 set_led_bit(hfc, driver_info->led_bits[1], 0);
313 set_led_bit(hfc, driver_info->led_bits[2], 0);
314 set_led_bit(hfc, driver_info->led_bits[3], 0);
317 set_led_bit(hfc, driver_info->led_bits[0], 0);
318 set_led_bit(hfc, driver_info->led_bits[1], 0);
319 set_led_bit(hfc, driver_info->led_bits[2], 0);
320 set_led_bit(hfc, driver_info->led_bits[3], 0);
323 set_led_bit(hfc, driver_info->led_bits[1], 1);
326 set_led_bit(hfc, driver_info->led_bits[1], 0);
329 set_led_bit(hfc, driver_info->led_bits[2], 1);
332 set_led_bit(hfc, driver_info->led_bits[2], 0);
335 set_led_bit(hfc, driver_info->led_bits[3], 1);
338 set_led_bit(hfc, driver_info->led_bits[3], 0);
341 write_led(hfc, hfc->led_state);
346 l1_timer_expire_t3(hfcusb_data *hfc)
348 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
354 hfc->l1_activated = 0;
355 handle_led(hfc, LED_S0_OFF);
357 queue_control_request(hfc, HFCUSB_STATES, 0x10, 1);
358 queue_control_request(hfc, HFCUSB_STATES, 3, 1);
363 l1_timer_expire_t4(hfcusb_data *hfc)
365 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
371 hfc->l1_activated = 0;
372 handle_led(hfc, LED_S0_OFF);
377 s0_state_handler(hfcusb_data *hfc, __u8 state)
381 old_state = hfc->l1_state;
389 if (timer_pending(&hfc->t3_timer))
390 del_timer(&hfc->t3_timer);
394 if (timer_pending(&hfc->t4_timer))
395 del_timer(&hfc->t4_timer);
399 if (state == 7 && !hfc->l1_activated) {
400 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
403 hfc->l1_activated = 1;
404 handle_led(hfc, LED_S0_ON);
408 if (!timer_pending(&hfc->t4_timer)) {
409 hfc->t4_timer.expires =
411 add_timer(&hfc->t4_timer);
414 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
419 hfc->l1_activated = 0;
420 handle_led(hfc, LED_S0_OFF);
423 hfc->l1_state = state;
479 fifo->hfc->dev, fifo->pipe,
546 hfcusb_data *hfc = fifo->hfc;
578 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS)
582 threshbit = (hfc->threshold_mask & (1 << fifon));
591 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe,
671 if (status && !hfc->disc_flag) {
684 hfcusb_data *hfc = fifo->hfc;
718 if (iso_status && !hfc->disc_flag)
736 hfc->threshold_mask = buf[1];
742 s0_state_handler(hfc, buf[0] >> 4);
759 fill_isoc_urb(urb, fifo->hfc->dev, fifo->pipe,
770 if (status && !hfc->disc_flag) {
783 hfcusb_data *hfc = fifo->hfc;
788 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS)
856 hfcusb_data *hfc = fifo->hfc;
859 urb->dev = hfc->dev; /* security init */
888 hfc->threshold_mask = buf[1];
890 s0_state_handler(hfc, buf[0] >> 4);
924 usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe,
939 setup_bchannel(hfcusb_data *hfc, int channel, int mode)
943 if (hfc->disc_flag) {
948 hfc->b_mode[channel] = mode;
958 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel], 1);
959 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1);
961 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1);
963 queue_control_request(hfc, HFCUSB_FIFO, idx_table[channel] + 1, 1);
964 queue_control_request(hfc, HFCUSB_CON_HDLC, val, 1);
966 queue_control_request(hfc, HFCUSB_INC_RES_F, 2, 1);
969 if (hfc->b_mode[0])
971 if (hfc->b_mode[1])
973 queue_control_request(hfc, HFCUSB_SCTRL, val, 1);
976 if (hfc->b_mode[0])
978 if (hfc->b_mode[1])
980 queue_control_request(hfc, HFCUSB_SCTRL_R, val, 1);
984 handle_led(hfc, LED_B2_OFF);
986 handle_led(hfc, LED_B1_OFF);
989 handle_led(hfc, LED_B2_ON);
991 handle_led(hfc, LED_B1_ON);
999 hfcusb_data *hfc = fifo->hfc;
1007 if (hfc->l1_state != 3
1008 && hfc->l1_state != 7) {
1009 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
1016 if (hfc->l1_state == 7) { /* l1 already active */
1017 hfc->d_if.ifc.l1l2(&hfc->
1028 queue_control_request(hfc,
1034 queue_control_request(hfc,
1039 (&hfc->t3_timer)) {
1040 hfc->t3_timer.
1045 add_timer(&hfc->
1053 setup_bchannel(hfc,
1069 setup_bchannel(hfc,
1095 hfc_usb_init(hfcusb_data *hfc)
1103 if (read_usb(hfc, HFCUSB_CHIP_ID, &b) != 1) {
1113 usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used);
1116 write_usb(hfc, HFCUSB_CIRM, 8);
1118 write_usb(hfc, HFCUSB_CIRM, 0x10);
1121 write_usb(hfc, HFCUSB_USB_SIZE,
1122 (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4));
1125 write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size);
1128 write_usb(hfc, HFCUSB_MST_MODE1, 0); /* set default values */
1129 write_usb(hfc, HFCUSB_MST_MODE0, 1); /* enable master mode */
1132 write_usb(hfc, HFCUSB_F_THRES,
1136 fifo = hfc->fifos;
1138 write_usb(hfc, HFCUSB_FIFO, i); /* select the desired fifo */
1144 write_usb(hfc, HFCUSB_HDLC_PAR,
1147 write_usb(hfc, HFCUSB_CON_HDLC,
1149 write_usb(hfc, HFCUSB_INC_RES_F, 2); /* reset the fifo */
1152 write_usb(hfc, HFCUSB_CLKDEL, 0x0f); /* clock delay value */
1153 write_usb(hfc, HFCUSB_STATES, 3 | 0x10); /* set deactivated mode */
1154 write_usb(hfc, HFCUSB_STATES, 3); /* enable state machine */
1156 write_usb(hfc, HFCUSB_SCTRL_R, 0); /* disable both B receivers */
1157 write_usb(hfc, HFCUSB_SCTRL, 0x40); /* disable B transmitters + capacitive mode */
1160 hfc->b_mode[0] = L1_MODE_NULL;
1161 hfc->b_mode[1] = L1_MODE_NULL;
1163 hfc->l1_activated = 0;
1164 hfc->disc_flag = 0;
1165 hfc->led_state = 0;
1166 hfc->old_led_state = 0;
1169 init_timer(&hfc->t3_timer);
1170 hfc->t3_timer.data = (long) hfc;
1171 hfc->t3_timer.function = (void *) l1_timer_expire_t3;
1174 init_timer(&hfc->t4_timer);
1175 hfc->t4_timer.data = (long) hfc;
1176 hfc->t4_timer.function = (void *) l1_timer_expire_t4;
1179 hfc->ctrl_read.bRequestType = 0xc0;
1180 hfc->ctrl_read.bRequest = 1;
1181 hfc->ctrl_read.wLength = cpu_to_le16(1);
1182 hfc->ctrl_write.bRequestType = 0x40;
1183 hfc->ctrl_write.bRequest = 0;
1184 hfc->ctrl_write.wLength = 0;
1185 usb_fill_control_urb(hfc->ctrl_urb,
1186 hfc->dev,
1187 hfc->ctrl_out_pipe,
1188 (u_char *)&hfc->ctrl_write,
1189 NULL, 0, ctrl_complete, hfc);
1192 hfc->fifos[i].iso[0].purb = NULL;
1193 hfc->fifos[i].iso[1].purb = NULL;
1194 hfc->fifos[i].active = 0;
1197 hfc->d_if.owner = THIS_MODULE;
1198 hfc->d_if.ifc.priv = &hfc->fifos[HFCUSB_D_TX];
1199 hfc->d_if.ifc.l2l1 = hfc_usb_l2l1;
1201 hfc->b_if[i].ifc.priv = &hfc->fifos[HFCUSB_B1_TX + i * 2];
1202 hfc->b_if[i].ifc.l2l1 = hfc_usb_l2l1;
1203 p_b_if[i] = &hfc->b_if[i];
1206 hfc->protocol = 2;
1207 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
1218 hfc->fifos[i].hif = &p_b_if[i / 2]->ifc;
1220 hfc->fifos[i].hif = &hfc->d_if.ifc;
1223 if (hfc->cfg_used == CNF_3INT3ISO || hfc->cfg_used == CNF_4INT3ISO) {
1224 start_int_fifo(hfc->fifos + HFCUSB_D_RX);
1225 if (hfc->fifos[HFCUSB_PCM_RX].pipe)
1226 start_int_fifo(hfc->fifos + HFCUSB_PCM_RX);
1227 start_int_fifo(hfc->fifos + HFCUSB_B1_RX);
1228 start_int_fifo(hfc->fifos + HFCUSB_B2_RX);
1231 if (hfc->cfg_used == CNF_3ISO3ISO || hfc->cfg_used == CNF_4ISO3ISO) {
1232 start_isoc_chain(hfc->fifos + HFCUSB_D_RX, ISOC_PACKETS_D,
1234 if (hfc->fifos[HFCUSB_PCM_RX].pipe)
1235 start_isoc_chain(hfc->fifos + HFCUSB_PCM_RX,
1238 start_isoc_chain(hfc->fifos + HFCUSB_B1_RX, ISOC_PACKETS_B,
1240 start_isoc_chain(hfc->fifos + HFCUSB_B2_RX, ISOC_PACKETS_B,
1244 start_isoc_chain(hfc->fifos + HFCUSB_D_TX, ISOC_PACKETS_D,
1246 start_isoc_chain(hfc->fifos + HFCUSB_B1_TX, ISOC_PACKETS_B,
1248 start_isoc_chain(hfc->fifos + HFCUSB_B2_TX, ISOC_PACKETS_B,
1251 handle_led(hfc, LED_POWER_ON);
1459 context->fifos[cidx].hfc =