hi_mipi_tx.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /******************************************************************************
  2. Copyright (C), 2016, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_mipi_tx.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2016/11/15
  8. Last Modified :
  9. Description :
  10. Function List :
  11. ******************************************************************************/
  12. #ifndef __HI_MIPI_TX__
  13. #define __HI_MIPI_TX__
  14. #define CMD_MAX_NUM 4
  15. #define LANE_MAX_NUM 4
  16. #define HI_MIPI_TX_ERR(x...) \
  17. do { \
  18. osal_printk("%s(%d): ", __FUNCTION__, __LINE__); \
  19. osal_printk(x); \
  20. } while (0)
  21. #define MIPITX_CHECK_NULL_PTR(ptr)\
  22. do{\
  23. if(NULL == ptr)\
  24. {\
  25. HI_MIPI_TX_ERR("NULL point \r\n");\
  26. return -1;\
  27. }\
  28. } while(0)
  29. typedef enum
  30. {
  31. OUTPUT_MODE_CSI = 0x0, /* csi mode */
  32. OUTPUT_MODE_DSI_VIDEO = 0x1, /* dsi video mode */
  33. OUTPUT_MODE_DSI_CMD = 0x2, /* dsi command mode */
  34. OUTPUT_MODE_BUTT
  35. } output_mode_t;
  36. typedef enum
  37. {
  38. BRUST_MODE = 0x0,
  39. NON_BRUST_MODE_SYNC_PULSES = 0x1,
  40. NON_BRUST_MODE_SYNC_EVENTS = 0x2,
  41. } video_mode_t;
  42. typedef enum
  43. {
  44. OUT_FORMAT_RGB_16_BIT = 0x0,
  45. OUT_FORMAT_RGB_18_BIT = 0x1,
  46. OUT_FORMAT_RGB_24_BIT = 0x2,
  47. OUT_FORMAT_YUV420_8_BIT_NORMAL = 0x3,
  48. OUT_FORMAT_YUV420_8_BIT_LEGACY = 0x4,
  49. OUT_FORMAT_YUV422_8_BIT = 0x5,
  50. OUT_FORMAT_BUTT
  51. } output_format_t;
  52. typedef struct
  53. {
  54. unsigned short vid_pkt_size;
  55. unsigned short vid_hsa_pixels;
  56. unsigned short vid_hbp_pixels;
  57. unsigned short vid_hline_pixels;
  58. unsigned short vid_vsa_lines;
  59. unsigned short vid_vbp_lines;
  60. unsigned short vid_vfp_lines;
  61. unsigned short vid_active_lines;
  62. unsigned short edpi_cmd_size;
  63. } sync_info_t;
  64. typedef struct
  65. {
  66. unsigned int devno; /* device number*/
  67. short lane_id[LANE_MAX_NUM]; /* lane_id: -1 - disable */
  68. output_mode_t output_mode; /* output mode: CSI/DSI_VIDEO/DSI_CMD */
  69. video_mode_t video_mode;
  70. output_format_t output_format;
  71. sync_info_t sync_info;
  72. unsigned int phy_data_rate; /*mbps*/
  73. unsigned int pixel_clk; /*KHz*/
  74. } combo_dev_cfg_t;
  75. typedef struct
  76. {
  77. unsigned int devno; /* device number */
  78. unsigned short data_type;
  79. unsigned short cmd_size;
  80. unsigned char *cmd;
  81. } cmd_info_t;
  82. #define HI_MIPI_TX_IOC_MAGIC 't'
  83. #define HI_MIPI_TX_SET_DEV_CFG _IOW(HI_MIPI_TX_IOC_MAGIC, 0x01, combo_dev_cfg_t)
  84. #define HI_MIPI_TX_SET_CMD _IOW(HI_MIPI_TX_IOC_MAGIC, 0x02, cmd_info_t)
  85. #define HI_MIPI_TX_ENABLE _IO(HI_MIPI_TX_IOC_MAGIC, 0x03)
  86. #endif