61 #define NETUP_CI_INT_CTRL 0x00
62 #define NETUP_CI_BUSCTRL2 0x01
63 #define NETUP_CI_ADDR0 0x04
64 #define NETUP_CI_ADDR1 0x05
65 #define NETUP_CI_DATA 0x06
66 #define NETUP_CI_BUSCTRL 0x07
67 #define NETUP_CI_PID_ADDR0 0x08
68 #define NETUP_CI_PID_ADDR1 0x09
69 #define NETUP_CI_PID_DATA 0x0a
70 #define NETUP_CI_TSA_DIV 0x0c
71 #define NETUP_CI_TSB_DIV 0x0d
72 #define NETUP_CI_REVISION 0x0f
75 #define NETUP_CI_FLG_CTL 1
76 #define NETUP_CI_FLG_RD 1
77 #define NETUP_CI_FLG_AD 1
79 static unsigned int ci_dbg;
83 static unsigned int pid_dbg;
91 #define ci_dbg_print(args...) \
94 printk(KERN_DEBUG args); \
97 #define pid_dbg_print(args...) \
100 printk(KERN_DEBUG args); \
151 struct fpga_inode *temp_chip = fpga_first_inode;
153 if (temp_chip ==
NULL)
159 while ((temp_chip !=
NULL) &&
167 void *demux_dev,
int filt_nr)
169 if (temp_int ==
NULL)
175 if (temp_int->
pid_filt[filt_nr]->demux == demux_dev)
182 static struct fpga_inode *find_dinode(
void *demux_dev)
184 struct fpga_inode *temp_chip = fpga_first_inode;
191 while (temp_chip !=
NULL) {
194 if (check_filter(temp_int, demux_dev, 0))
196 if (check_filter(temp_int, demux_dev, 1))
209 struct fpga_inode *prev_node = fpga_first_inode;
212 if (del_node !=
NULL) {
213 if (del_node == fpga_first_inode) {
233 struct fpga_inode *new_node = fpga_first_inode;
235 if (new_node ==
NULL) {
237 fpga_first_inode = new_node;
250 if (new_node !=
NULL) {
262 return inter->
fpga_rw(inter->
dev, 0, val, read);
286 store |= ((state->
nr << 7) | (flag << 6));
293 ci_dbg_print(
"%s: %s: addr=[0x%02x], %s=%x\n", __func__,
294 (read) ?
"read" :
"write", addr,
342 (ret & 0xcf) | (1 << (5 - state->
nr)), 0);
355 if ((ret & (1 << (5 - state->
nr))) == 0)
389 (ret & 0x0f) | (1 << (3 - state->
nr)), 0);
413 inter->
state[1]->status =
418 __func__, inter->
state[1]->status);
422 inter->
state[0]->status =
427 __func__, inter->
state[0]->status);
440 temp_int = find_inode(dev);
441 if (temp_int !=
NULL) {
464 struct fpga_inode *temp_int = find_inode(main_dev);
469 if (temp_int !=
NULL) {
470 pid_filt = temp_int->
internal->pid_filt[filt_nr - 1];
475 if (((--(temp_int->
internal->filts_used)) <= 0) &&
476 ((temp_int->
internal->cis_used) <= 0)) {
493 struct fpga_inode *temp_int = find_inode(dev);
498 if (temp_int !=
NULL) {
499 state = temp_int->
internal->state[ci_nr - 1];
503 if (((temp_int->
internal->filts_used) <= 0) &&
504 ((--(temp_int->
internal->cis_used)) <= 0)) {
513 if (state->
ca.data !=
NULL)
530 if ((pid == 0x2000) || (pid < 0x20))
537 ((pid >> 11) & 0x03) | (pid_filt->
nr << 2), 0);
542 store |= (1 << (pid & 7));
544 store &= ~(1 << (pid & 7));
550 pid_dbg_print(
"%s: (%d) set pid: %5d 0x%04x '%s'\n", __func__,
551 pid_filt->
nr, pid, pid, onoff ?
"off" :
"on");
555 int filt_nr,
int onoff)
562 onoff ?
"off" :
"on");
571 for (i = 0; i < 1024; i++) {
575 ((i >> 8) & 0x03) | (pid_filt->
nr << 2), 0);
578 (i > 3 ? store : 0), 0);
587 struct fpga_inode *temp_int = find_dinode(demux_dev);
591 altera_pid_control(pid_filt, feed->
pid, onoff ? 0 : 1);
598 if (feed->
pid == 0x2000)
599 altera_toggle_fullts_streaming(pid_filt, filt_nr,
656 if (temp_int !=
NULL) {
659 ci_dbg_print(
"%s: Find Internal Structure!\n", __func__);
667 temp_int = append_internal(inter);
673 ci_dbg_print(
"%s: Create New Internal Structure!\n", __func__);
676 ci_dbg_print(
"%s: setting hw pid filter = %p for ci = %d\n", __func__,
677 pid_filt, hw_filt_nr - 1);
681 pid_filt->
nr = hw_filt_nr - 1;
686 if (hw_filt_nr == 1) {
689 }
else if (hw_filt_nr == 2) {
694 altera_toggle_fullts_streaming(pid_filt, 0, 1);
698 ci_dbg_print(
"%s: Can't init hardware filter: Error %d\n",
724 if (temp_int !=
NULL) {
728 ci_dbg_print(
"%s: Find Internal Structure!\n", __func__);
736 temp_int = append_internal(inter);
742 ci_dbg_print(
"%s: Create New Internal Structure!\n", __func__);
745 ci_dbg_print(
"%s: setting state = %p for ci = %d\n", __func__,
748 state->
nr = ci_nr - 1;
796 ci_dbg_print(
"%s: NetUP CI Revision = 0x%x\n", __func__, ret);
802 ci_dbg_print(
"%s: Cannot initialize CI: Error %d.\n", __func__, ret);
812 struct fpga_inode *temp_int = find_inode(dev);
818 if (temp_int ==
NULL)
829 store &= ~(4 << (2 - ci_nr));
832 store |= (4 << (2 - ci_nr));