vcd_api.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef _VCD_API_H_
  14. #define _VCD_API_H_
  15. #include <linux/types.h>
  16. #include "vcd_property.h"
  17. #include "vcd_status.h"
  18. #define VCD_FRAME_FLAG_EOS 0x00000001
  19. #define VCD_FRAME_FLAG_DECODEONLY 0x00000004
  20. #define VCD_FRAME_FLAG_DATACORRUPT 0x00000008
  21. #define VCD_FRAME_FLAG_ENDOFFRAME 0x00000010
  22. #define VCD_FRAME_FLAG_SYNCFRAME 0x00000020
  23. #define VCD_FRAME_FLAG_EXTRADATA 0x00000040
  24. #define VCD_FRAME_FLAG_CODECCONFIG 0x00000080
  25. #define VCD_FRAME_FLAG_BFRAME 0x00100000
  26. #define VCD_FRAME_FLAG_EOSEQ 0x00200000
  27. #define VCD_FLUSH_INPUT 0x0001
  28. #define VCD_FLUSH_OUTPUT 0x0002
  29. #define VCD_FLUSH_ALL 0x0003
  30. #define VCD_FRAMETAG_INVALID 0xffffffff
  31. struct vcd_handle_container {
  32. void *handle;
  33. };
  34. struct vcd_flush_cmd {
  35. u32 mode;
  36. };
  37. enum vcd_frame {
  38. VCD_FRAME_YUV = 1,
  39. VCD_FRAME_I,
  40. VCD_FRAME_P,
  41. VCD_FRAME_B,
  42. VCD_FRAME_NOTCODED,
  43. VCD_FRAME_IDR,
  44. VCD_FRAME_32BIT = 0x7fffffff
  45. };
  46. enum vcd_power_state {
  47. VCD_PWR_STATE_ON = 1,
  48. VCD_PWR_STATE_SLEEP,
  49. };
  50. struct vcd_aspect_ratio {
  51. u32 aspect_ratio;
  52. u32 par_width;
  53. u32 par_height;
  54. };
  55. struct vcd_frame_data {
  56. u8 *virtual;
  57. u8 *physical;
  58. u32 ion_flag;
  59. u32 alloc_len;
  60. u32 data_len;
  61. u32 offset;
  62. s64 time_stamp; /* in usecs*/
  63. u32 flags;
  64. u32 frm_clnt_data;
  65. struct vcd_property_dec_output_buffer dec_op_prop;
  66. u32 interlaced;
  67. enum vcd_frame frame;
  68. u32 ip_frm_tag;
  69. u32 intrlcd_ip_frm_tag;
  70. u8 *desc_buf;
  71. u32 desc_size;
  72. struct ion_handle *buff_ion_handle;
  73. struct vcd_aspect_ratio aspect_ratio_info;
  74. };
  75. struct vcd_sequence_hdr {
  76. u8 *sequence_header;
  77. u32 sequence_header_len;
  78. };
  79. enum vcd_buffer_type {
  80. VCD_BUFFER_INPUT = 0x1,
  81. VCD_BUFFER_OUTPUT = 0x2,
  82. VCD_BUFFER_INVALID = 0x3,
  83. VCD_BUFFER_32BIT = 0x7FFFFFFF
  84. };
  85. struct vcd_buffer_requirement {
  86. u32 min_count;
  87. u32 actual_count;
  88. u32 max_count;
  89. size_t sz;
  90. u32 align;
  91. u32 buf_pool_id;
  92. size_t meta_buffer_size;
  93. };
  94. struct vcd_init_config {
  95. void *device_name;
  96. void *(*map_dev_base_addr) (void *device_name);
  97. void (*un_map_dev_base_addr) (void);
  98. void (*interrupt_clr) (void);
  99. void (*register_isr) (void *device_name);
  100. void (*deregister_isr) (void);
  101. u32 (*timer_create) (void (*timer_handler)(void *),
  102. void *user_data, void **timer_handle);
  103. void (*timer_release) (void *timer_handle);
  104. void (*timer_start) (void *timer_handle, u32 time_out);
  105. void (*timer_stop) (void *timer_handle);
  106. };
  107. /*Flags passed to vcd_open*/
  108. #define VCD_CP_SESSION 0x00000001
  109. u32 vcd_init(struct vcd_init_config *config, s32 *driver_handle);
  110. u32 vcd_term(s32 driver_handle);
  111. u32 vcd_open(s32 driver_handle, u32 decoding,
  112. void (*callback) (u32 event, u32 status, void *info, size_t sz,
  113. void *handle, void *const client_data), void *client_data, int flags);
  114. u32 vcd_close(void *handle);
  115. u32 vcd_encode_start(void *handle);
  116. u32 vcd_encode_frame(void *handle, struct vcd_frame_data *input_frame);
  117. u32 vcd_decode_start(void *handle, struct vcd_sequence_hdr *seq_hdr);
  118. u32 vcd_decode_frame(void *handle, struct vcd_frame_data *input_frame);
  119. u32 vcd_pause(void *handle);
  120. u32 vcd_resume(void *handle);
  121. u32 vcd_flush(void *handle, u32 mode);
  122. u32 vcd_stop(void *handle);
  123. u32 vcd_set_property(void *handle, struct vcd_property_hdr *prop_hdr,
  124. void *prop_val);
  125. u32 vcd_get_property(void *handle, struct vcd_property_hdr *prop_hdr,
  126. void *prop_val);
  127. u32 vcd_set_buffer_requirements(void *handle, enum vcd_buffer_type buffer,
  128. struct vcd_buffer_requirement *buffer_req);
  129. u32 vcd_get_buffer_requirements(void *handle, enum vcd_buffer_type buffer,
  130. struct vcd_buffer_requirement *buffer_req);
  131. u32 vcd_set_buffer(void *handle, enum vcd_buffer_type buffer_type,
  132. u8 *buffer, u32 buf_size);
  133. u32 vcd_allocate_buffer(void *handle, enum vcd_buffer_type buffer,
  134. u32 buf_size, u8 **vir_buf_addr, u8 **phy_buf_addr);
  135. u32 vcd_free_buffer(void *handle, enum vcd_buffer_type buffer_type, u8 *buffer);
  136. u32 vcd_fill_output_buffer(void *handle, struct vcd_frame_data *buffer);
  137. u32 vcd_set_device_power(s32 driver_handle,
  138. enum vcd_power_state pwr_state);
  139. void vcd_read_and_clear_interrupt(void);
  140. void vcd_response_handler(void);
  141. u8 vcd_get_num_of_clients(void);
  142. u32 vcd_get_ion_status(void);
  143. struct ion_client *vcd_get_ion_client(void);
  144. #endif