jpeg.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version 2
  5. * of the License, or (at your option) any later version.
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  14. * MA 02110-1301, USA.
  15. *
  16. * Name:
  17. * ark_jpeg.h
  18. *
  19. * Description:
  20. *
  21. *
  22. * Author:
  23. * Sim
  24. * Remarks:
  25. *
  26. */
  27. #ifndef __ARK_JPEG_H__
  28. #define __ARK_JPEG_H__
  29. /*************************************************************************
  30. * Driver information definitions
  31. *************************************************************************/
  32. #define ARK_JPEG_MAJOR_RELEASE 0
  33. #define ARK_JPEG_MINOR_RELEASE 0
  34. #define ARK_JPEG_BUILD 1
  35. #define ARK_JPEG_VERSION_CODE ((ARK_JPEG_MAJOR_RELEASE << 16) | \
  36. (ARK_JPEG_MINOR_RELEASE << 8) | ARK_JPEG_BUILD)
  37. //#define ARK_JPEG_DBG
  38. /*************************************************************************
  39. * Debug print functions
  40. *************************************************************************/
  41. #ifdef ARK_JPEG_DBG
  42. #define ARKJPEG_DBGPRTK(...) printk(KERN_ALERT __VA_ARGS__)
  43. #else
  44. #define ARKJPEG_DBGPRTK(...)
  45. #endif
  46. /*************************************************************************
  47. * register definitions
  48. *************************************************************************/
  49. #define ARK_JPEG_REG_BASE JPEG_BASE
  50. #define ARK_JPEG_REG_SIZE 0x1000
  51. /*************************************************************************
  52. * driver control structures
  53. *************************************************************************/
  54. #define JPEG_API_TIMEOUT 3000
  55. #define JPEG_TIMEOUT 30000
  56. #define JPEG_BLOCK_HEIGHT 32
  57. #define JPEG_MAX_HEADERSIZE 100*1024
  58. //#define JPEG_FILE_BUFFERSIZE 4
  59. #define JPEG_FILE_BUFFERSIZE 200
  60. #define JPEG_INPUT_BUFFERSIZE JPEG_FILE_BUFFERSIZE*1024
  61. #define MAXIMAGEWIDTH 8000
  62. #define MAXIMAGEHEIGHT 8000
  63. /* JPEG Registers */
  64. #define JPEG_0 0x00
  65. #define JPEG_1 0x04
  66. #define JPEG_2 0x08
  67. #define JPEG_3 0x0C
  68. #define JPEG_4 0x10
  69. #define JPEG_5 0x14
  70. #define JPEG_6 0x18
  71. #define JPEG_7 0x1C
  72. #define JPEG_STATUS 0x20
  73. #define JPEG_WRSTA 0x24
  74. #define JPEG_WREND 0x28
  75. #define JPEG_CTRL 0x2c
  76. #define JPEG_START 0x30
  77. #define JPEG_INTCTRL 0x34
  78. #define JPEG_INTMASK 0x38
  79. #define JPEG_INTCLR 0x3c
  80. #define JPEG_LINE_NUM 0x40
  81. #define JPEG_FIFO 0x44
  82. #define JPEG_WRSTA1 0x48
  83. #define JPEG_WREND1 0x4c
  84. #define JPEG_COUNT 0x50
  85. #define JPEG_WRSTA2 0x54
  86. #define JPEG_WREND2 0x58
  87. #define JPEG_TEST 0x88
  88. #define JPEG_DEC_RD_BASE_ADDR 0x5c
  89. #define JPEG_ENC_RD_BASE_ADDR 0x60
  90. #define JPEG_ENC_WR_BASE_ADDR 0x64
  91. #define JPEG_QT 0x100
  92. #define JPEG_SYMB 0x500
  93. #define JPEG_BASE 0xe00
  94. #define JPEG_MIN 0xf00
  95. /* PRE-SCALER */
  96. #define PRESCALE_SRC_ADDR 0x00
  97. #define PRESCALE_DES_ADDR 0x04
  98. #define PRESCALE_HV_ADDR1 0x08
  99. #define PRESCALE_HV_ADDR2 0x0c
  100. #define PRESCALE_HV_ADDR3 0x10
  101. #define PRESCALE_COEF_H 0x14
  102. #define PRESCALE_COEF_V 0x18
  103. #define PRESCALE_H_FILTER_COEF_3TO0 0x1c
  104. #define PRESCALE_H_FILTER_COEF_7TO4 0x20
  105. #define PRESCALE_H_FILTER_COEF_10TO8 0x24
  106. #define PRESCALE_V_FILTER_COEF_3TO0 0x28
  107. #define PRESCALE_V_FILTER_COEF_7TO4 0x2c
  108. #define PRESCALE_V_FILTER_COEF_10TO8 0x30
  109. #define PRESCALE_FILTER_CTL 0x34
  110. #define PRESCALE_LINE_CTL 0x38
  111. #define PRESCALE_HEIGHT_CTL 0x3c
  112. #define PRESCALE_CTL 0x40
  113. #define PRESCALE_BLK_HEIGHT 0x44
  114. #define PRESCALE_BLK_NUM 0x48
  115. #define PRESCALE_ROW_NUM_LAST_BLK 0x4c
  116. #define PRESCALE_FRAME_START 0x50
  117. #define PRESCALE_BLK_START 0x54
  118. #define PRESCALE_INT_STATUS 0x58
  119. #define PRESCALE_INT_CLR 0x5c
  120. #define PRESCALE_HDATA_VALID 0x60
  121. #define PRESCALE_WORK_MODE 0x64
  122. #define PRESCALE_HALF_LINE 0x68
  123. #define PRESCALE_HDATA_VALID_VIDEO 0x6c
  124. #define PRESCALE_VDATA_VALID_VIDEO 0x70
  125. #define PRESCALE_SHIFT_CTL 0x74
  126. #define PRESCALE_SCREEN_KIND 0x78
  127. #define PRESCALE_EVEN_ODD_MODE 0x7c
  128. #define PRESCALE_DES_ADDR2 0x80
  129. #define PRESCALE_SRC_MODE 0x84
  130. #define PRESCALE_FILTER3_CTL 0x88
  131. #define PRESCALE_COS 0x8c
  132. #define PRESCALE_WIN_POS 0x90
  133. #define PRESCALE_WIN_CTL 0x94
  134. #define PRESCALE_REFRESH 0x98
  135. #define PRESCALE_INT_MASK 0x9C
  136. struct ark_jpeg_context {
  137. int irq;
  138. int psirq;
  139. spinlock_t lock;
  140. wait_queue_head_t waitq;
  141. struct device *dev;
  142. void __iomem *mmio_base;
  143. void __iomem *ps_mmio_base;
  144. struct completion decstart_completion;
  145. struct completion api_completion;
  146. struct completion apidone_completion;
  147. struct completion decdone_completion;
  148. struct workqueue_struct *wrok_queue;
  149. struct work_struct jpeg_work;
  150. unsigned int intr_status;
  151. unsigned int file_size;
  152. bool break_decode;
  153. bool hard_head_parser;
  154. bool scaler_enable;
  155. JPEG_DEC_RESULT decode_result;
  156. unsigned int decode_size;
  157. unsigned int src_width;
  158. unsigned int src_height;
  159. unsigned int out_width;
  160. unsigned int out_height;
  161. unsigned int format;
  162. int read_buf_mode;
  163. JPEG_DEC_STATUS decode_status;
  164. JPEG_SCALER_MODE scaler_mode;
  165. JPEG_ZOOM_MODE zoom_mode;
  166. ROTATE_ANGLE rotate_angle;
  167. JPEG_API_INFO api_info;
  168. JPEG_API_RETINFO api_retinfo;
  169. unsigned int dst_width;
  170. unsigned int dst_height;
  171. void *buf_base_virt;
  172. unsigned int buf_base_phys;
  173. unsigned int buf_size;
  174. void *decode_buf_base_virt;
  175. unsigned int decode_buf_base_phys;
  176. unsigned int decode_buf_size;
  177. unsigned int repeat_scaler;
  178. unsigned int repeat_src_width;
  179. unsigned int repeat_src_height;
  180. unsigned int repeat_src_image_addr;
  181. unsigned int animation_data_phyaddr;
  182. unsigned int animation_data_virtaddr;
  183. unsigned int animation_display_phyaddr;
  184. unsigned int animation_display_virtaddr;
  185. unsigned int animation_display_size;
  186. unsigned int animation_display_index;
  187. unsigned int animation_file_phyaddr;
  188. struct timer_list animation_timer;
  189. bool animation_end;
  190. bool animation_dec_finish;
  191. bool animation_initdisplay;
  192. struct completion psblockint_completion;
  193. struct completion psframeint_completion;
  194. };
  195. struct ark_jpeg_device {
  196. const char *driver_name;
  197. const char *name;
  198. int major;
  199. int minor_start;
  200. int minor_num;
  201. int num;
  202. struct cdev cdev;
  203. struct class *jpeg_class;
  204. struct device *jpeg_device;
  205. struct ark_jpeg_context context;
  206. };
  207. #endif //#ifndef __ARK_JPEG_H__