cx25821-video-upstream.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Driver for the Conexant CX25821 PCIe bridge
  3. *
  4. * Copyright (C) 2009 Conexant Systems Inc.
  5. * Authors <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. *
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #include <linux/mutex.h>
  23. #include <linux/workqueue.h>
  24. #define OUTPUT_FRMT_656 0
  25. #define OPEN_FILE_1 0
  26. #define NUM_PROGS 8
  27. #define NUM_FRAMES 2
  28. #define ODD_FIELD 0
  29. #define EVEN_FIELD 1
  30. #define TOP_OFFSET 0
  31. #define FIFO_DISABLE 0
  32. #define FIFO_ENABLE 1
  33. #define TEST_FRAMES 5
  34. #define END_OF_FILE 0
  35. #define IN_PROGRESS 1
  36. #define RESET_STATUS -1
  37. #define NUM_NO_OPS 5
  38. /* PAL and NTSC line sizes and number of lines. */
  39. #define WIDTH_D1 720
  40. #define NTSC_LINES_PER_FRAME 480
  41. #define PAL_LINES_PER_FRAME 576
  42. #define PAL_LINE_SZ 1440
  43. #define Y422_LINE_SZ 1440
  44. #define Y411_LINE_SZ 1080
  45. #define NTSC_FIELD_HEIGHT 240
  46. #define NTSC_ODD_FLD_LINES 241
  47. #define PAL_FIELD_HEIGHT 288
  48. #define FRAME_SIZE_NTSC_Y422 (NTSC_LINES_PER_FRAME * Y422_LINE_SZ)
  49. #define FRAME_SIZE_NTSC_Y411 (NTSC_LINES_PER_FRAME * Y411_LINE_SZ)
  50. #define FRAME_SIZE_PAL_Y422 (PAL_LINES_PER_FRAME * Y422_LINE_SZ)
  51. #define FRAME_SIZE_PAL_Y411 (PAL_LINES_PER_FRAME * Y411_LINE_SZ)
  52. #define NTSC_DATA_BUF_SZ (Y422_LINE_SZ * NTSC_LINES_PER_FRAME)
  53. #define PAL_DATA_BUF_SZ (Y422_LINE_SZ * PAL_LINES_PER_FRAME)
  54. #define RISC_WRITECR_INSTRUCTION_SIZE 16
  55. #define RISC_SYNC_INSTRUCTION_SIZE 4
  56. #define JUMP_INSTRUCTION_SIZE 12
  57. #define MAXSIZE_NO_OPS 36
  58. #define DWORD_SIZE 4
  59. #define USE_RISC_NOOP_VIDEO 1
  60. #ifdef USE_RISC_NOOP_VIDEO
  61. #define PAL_US_VID_PROG_SIZE \
  62. (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
  63. RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE + \
  64. NUM_NO_OPS * DWORD_SIZE)
  65. #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
  66. #define PAL_VID_PROG_SIZE \
  67. ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE + \
  68. 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  69. JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
  70. #define ODD_FLD_PAL_PROG_SIZE \
  71. (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
  72. RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  73. NUM_NO_OPS * DWORD_SIZE)
  74. #define ODD_FLD_NTSC_PROG_SIZE \
  75. (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE + \
  76. RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  77. NUM_NO_OPS * DWORD_SIZE)
  78. #define NTSC_US_VID_PROG_SIZE \
  79. ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE + \
  80. RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE + \
  81. NUM_NO_OPS * DWORD_SIZE)
  82. #define NTSC_RISC_BUF_SIZE \
  83. (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
  84. #define FRAME1_VID_PROG_SIZE \
  85. ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE + \
  86. 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  87. JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
  88. #endif
  89. #ifndef USE_RISC_NOOP_VIDEO
  90. #define PAL_US_VID_PROG_SIZE \
  91. (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
  92. RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE + \
  93. JUMP_INSTRUCTION_SIZE)
  94. #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
  95. #define PAL_VID_PROG_SIZE \
  96. ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE + \
  97. 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  98. JUMP_INSTRUCTION_SIZE)
  99. #define ODD_FLD_PAL_PROG_SIZE \
  100. (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
  101. RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
  102. #define ODD_FLD_NTSC_PROG_SIZE \
  103. (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE + \
  104. RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
  105. #define NTSC_US_VID_PROG_SIZE \
  106. ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE + \
  107. RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE)
  108. #define NTSC_RISC_BUF_SIZE \
  109. (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
  110. #define FRAME1_VID_PROG_SIZE \
  111. ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE + \
  112. 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
  113. JUMP_INSTRUCTION_SIZE)
  114. #endif