flexcop-misc.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
  3. *
  4. * flexcop-misc.c - miscellaneous functions.
  5. *
  6. * see flexcop.c for copyright information.
  7. */
  8. #include "flexcop.h"
  9. void flexcop_determine_revision(struct flexcop_device *fc)
  10. {
  11. flexcop_ibi_value v = fc->read_ibi_reg(fc,misc_204);
  12. switch (v.misc_204.Rev_N_sig_revision_hi) {
  13. case 0x2:
  14. deb_info("found a FlexCopII.\n");
  15. fc->rev = FLEXCOP_II;
  16. break;
  17. case 0x3:
  18. deb_info("found a FlexCopIIb.\n");
  19. fc->rev = FLEXCOP_IIB;
  20. break;
  21. case 0x0:
  22. deb_info("found a FlexCopIII.\n");
  23. fc->rev = FLEXCOP_III;
  24. break;
  25. default:
  26. err("unkown FlexCop Revision: %x. Please report the linux-dvb@linuxtv.org.",v.misc_204.Rev_N_sig_revision_hi);
  27. break;
  28. }
  29. if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps))
  30. deb_info("this FlexCop has the additional 32 hardware pid filter.\n");
  31. else
  32. deb_info("this FlexCop has only the 6 basic main hardware pid filter.\n");
  33. /* bus parts have to decide if hw pid filtering is used or not. */
  34. }
  35. static const char *flexcop_revision_names[] = {
  36. "Unkown chip",
  37. "FlexCopII",
  38. "FlexCopIIb",
  39. "FlexCopIII",
  40. };
  41. static const char *flexcop_device_names[] = {
  42. "Unkown device",
  43. "Air2PC/AirStar 2 DVB-T",
  44. "Air2PC/AirStar 2 ATSC 1st generation",
  45. "Air2PC/AirStar 2 ATSC 2nd generation",
  46. "Sky2PC/SkyStar 2 DVB-S",
  47. "Sky2PC/SkyStar 2 DVB-S (old version)",
  48. "Cable2PC/CableStar 2 DVB-C",
  49. "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)",
  50. };
  51. static const char *flexcop_bus_names[] = {
  52. "USB",
  53. "PCI",
  54. };
  55. void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const
  56. char *suffix)
  57. {
  58. info("%s '%s' at the '%s' bus controlled by a '%s' %s",prefix,
  59. flexcop_device_names[fc->dev_type],flexcop_bus_names[fc->bus_type],
  60. flexcop_revision_names[fc->rev],suffix);
  61. }
  62. void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num)
  63. {
  64. flexcop_ibi_value v;
  65. int i;
  66. for (i = 0; i < num; i++) {
  67. v = fc->read_ibi_reg(fc,reg+4*i);
  68. deb_rdump("0x%03x: %08x, ",reg+4*i, v.raw);
  69. }
  70. deb_rdump("\n");
  71. }
  72. EXPORT_SYMBOL(flexcop_dump_reg);