Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. 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 "vcd_property.h" |
| 16 | #include "vcd_status.h" |
| 17 | |
| 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 | |
| 28 | #define VCD_FLUSH_INPUT 0x0001 |
| 29 | #define VCD_FLUSH_OUTPUT 0x0002 |
| 30 | #define VCD_FLUSH_ALL 0x0003 |
| 31 | |
| 32 | #define VCD_FRAMETAG_INVALID 0xffffffff |
| 33 | |
| 34 | struct vcd_handle_container { |
| 35 | void *handle; |
| 36 | }; |
| 37 | struct vcd_flush_cmd { |
| 38 | u32 mode; |
| 39 | }; |
| 40 | |
| 41 | enum vcd_frame { |
| 42 | VCD_FRAME_YUV = 1, |
| 43 | VCD_FRAME_I, |
| 44 | VCD_FRAME_P, |
| 45 | VCD_FRAME_B, |
| 46 | VCD_FRAME_NOTCODED, |
| 47 | VCD_FRAME_IDR, |
| 48 | VCD_FRAME_32BIT = 0x7fffffff |
| 49 | }; |
| 50 | |
| 51 | enum vcd_power_state { |
| 52 | VCD_PWR_STATE_ON = 1, |
| 53 | VCD_PWR_STATE_SLEEP, |
| 54 | }; |
| 55 | |
Arun Menon | d5a0297 | 2012-03-01 10:51:06 -0800 | [diff] [blame] | 56 | struct vcd_aspect_ratio { |
| 57 | u32 aspect_ratio; |
| 58 | u32 extended_par_width; |
| 59 | u32 extended_par_height; |
| 60 | }; |
| 61 | |
Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 62 | struct vcd_frame_data { |
| 63 | u8 *virtual; |
| 64 | u8 *physical; |
Deva Ramasubramanian | 3a7774b | 2012-02-10 12:09:50 -0800 | [diff] [blame] | 65 | u32 ion_flag; |
Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 66 | u32 alloc_len; |
| 67 | u32 data_len; |
| 68 | u32 offset; |
| 69 | s64 time_stamp; |
| 70 | u32 flags; |
| 71 | u32 frm_clnt_data; |
| 72 | struct vcd_property_dec_output_buffer dec_op_prop; |
| 73 | u32 interlaced; |
| 74 | enum vcd_frame frame; |
| 75 | u32 ip_frm_tag; |
| 76 | u32 intrlcd_ip_frm_tag; |
| 77 | u8 *desc_buf; |
| 78 | u32 desc_size; |
Deepak Kotur | ef091c9 | 2012-02-28 11:25:35 -0800 | [diff] [blame] | 79 | struct ion_handle *buff_ion_handle; |
Arun Menon | d5a0297 | 2012-03-01 10:51:06 -0800 | [diff] [blame] | 80 | struct vcd_aspect_ratio aspect_ratio_info; |
Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | struct vcd_sequence_hdr { |
| 84 | u8 *sequence_header; |
| 85 | u32 sequence_header_len; |
| 86 | |
| 87 | }; |
| 88 | |
| 89 | enum vcd_buffer_type { |
| 90 | VCD_BUFFER_INPUT = 0x1, |
| 91 | VCD_BUFFER_OUTPUT = 0x2, |
| 92 | VCD_BUFFER_INVALID = 0x3, |
| 93 | VCD_BUFFER_32BIT = 0x7FFFFFFF |
| 94 | }; |
| 95 | |
| 96 | struct vcd_buffer_requirement { |
| 97 | u32 min_count; |
| 98 | u32 actual_count; |
| 99 | u32 max_count; |
| 100 | size_t sz; |
| 101 | u32 align; |
| 102 | u32 buf_pool_id; |
| 103 | }; |
| 104 | |
| 105 | struct vcd_init_config { |
| 106 | void *device_name; |
| 107 | void *(*map_dev_base_addr) (void *device_name); |
| 108 | void (*un_map_dev_base_addr) (void); |
| 109 | void (*interrupt_clr) (void); |
| 110 | void (*register_isr) (void *device_name); |
| 111 | void (*deregister_isr) (void); |
| 112 | u32 (*timer_create) (void (*timer_handler)(void *), |
| 113 | void *user_data, void **timer_handle); |
| 114 | void (*timer_release) (void *timer_handle); |
| 115 | void (*timer_start) (void *timer_handle, u32 time_out); |
| 116 | void (*timer_stop) (void *timer_handle); |
| 117 | }; |
| 118 | |
Deepak kotur | 13d82f8 | 2012-03-12 11:12:32 -0700 | [diff] [blame^] | 119 | /*Flags passed to vcd_open*/ |
| 120 | #define VCD_CP_SESSION 0x00000001 |
| 121 | |
Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 122 | u32 vcd_init(struct vcd_init_config *config, s32 *driver_handle); |
| 123 | u32 vcd_term(s32 driver_handle); |
| 124 | u32 vcd_open(s32 driver_handle, u32 decoding, |
| 125 | void (*callback) (u32 event, u32 status, void *info, size_t sz, |
Deepak kotur | 13d82f8 | 2012-03-12 11:12:32 -0700 | [diff] [blame^] | 126 | void *handle, void *const client_data), void *client_data, int flags); |
Vinay Kalia | b559874 | 2011-12-21 16:52:33 -0800 | [diff] [blame] | 127 | u32 vcd_close(void *handle); |
| 128 | u32 vcd_encode_start(void *handle); |
| 129 | u32 vcd_encode_frame(void *handle, struct vcd_frame_data *input_frame); |
| 130 | u32 vcd_decode_start(void *handle, struct vcd_sequence_hdr *seq_hdr); |
| 131 | u32 vcd_decode_frame(void *handle, struct vcd_frame_data *input_frame); |
| 132 | u32 vcd_pause(void *handle); |
| 133 | u32 vcd_resume(void *handle); |
| 134 | u32 vcd_flush(void *handle, u32 mode); |
| 135 | u32 vcd_stop(void *handle); |
| 136 | u32 vcd_set_property(void *handle, struct vcd_property_hdr *prop_hdr, |
| 137 | void *prop_val); |
| 138 | u32 vcd_get_property(void *handle, struct vcd_property_hdr *prop_hdr, |
| 139 | void *prop_val); |
| 140 | u32 vcd_set_buffer_requirements(void *handle, enum vcd_buffer_type buffer, |
| 141 | struct vcd_buffer_requirement *buffer_req); |
| 142 | u32 vcd_get_buffer_requirements(void *handle, enum vcd_buffer_type buffer, |
| 143 | struct vcd_buffer_requirement *buffer_req); |
| 144 | u32 vcd_set_buffer(void *handle, enum vcd_buffer_type buffer_type, |
| 145 | u8 *buffer, u32 buf_size); |
| 146 | u32 vcd_allocate_buffer(void *handle, enum vcd_buffer_type buffer, |
| 147 | u32 buf_size, u8 **vir_buf_addr, u8 **phy_buf_addr); |
| 148 | |
| 149 | u32 vcd_free_buffer(void *handle, enum vcd_buffer_type buffer_type, u8 *buffer); |
| 150 | u32 vcd_fill_output_buffer(void *handle, struct vcd_frame_data *buffer); |
| 151 | u32 vcd_set_device_power(s32 driver_handle, |
| 152 | enum vcd_power_state pwr_state); |
| 153 | void vcd_read_and_clear_interrupt(void); |
| 154 | void vcd_response_handler(void); |
| 155 | u8 vcd_get_num_of_clients(void); |
| 156 | u32 vcd_get_ion_status(void); |
| 157 | struct ion_client *vcd_get_ion_client(void); |
| 158 | #endif |