blob: 7104028e1d6e1ccdbed79750ac9d50ca3576a230 [file] [log] [blame]
Vinay Kaliab5598742011-12-21 16:52:33 -08001/* 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
34struct vcd_handle_container {
35 void *handle;
36};
37struct vcd_flush_cmd {
38 u32 mode;
39};
40
41enum 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
51enum vcd_power_state {
52 VCD_PWR_STATE_ON = 1,
53 VCD_PWR_STATE_SLEEP,
54};
55
Arun Menond5a02972012-03-01 10:51:06 -080056struct vcd_aspect_ratio {
57 u32 aspect_ratio;
Deepak Verma003ba6e2012-08-02 16:25:39 +053058 u32 par_width;
59 u32 par_height;
Arun Menond5a02972012-03-01 10:51:06 -080060};
61
Vinay Kaliab5598742011-12-21 16:52:33 -080062struct vcd_frame_data {
63 u8 *virtual;
64 u8 *physical;
Deva Ramasubramanian3a7774b2012-02-10 12:09:50 -080065 u32 ion_flag;
Vinay Kaliab5598742011-12-21 16:52:33 -080066 u32 alloc_len;
67 u32 data_len;
68 u32 offset;
Deva Ramasubramanian4947d8c2012-04-03 12:41:06 -070069 s64 time_stamp; /* in usecs*/
Vinay Kaliab5598742011-12-21 16:52:33 -080070 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 Koturef091c92012-02-28 11:25:35 -080079 struct ion_handle *buff_ion_handle;
Arun Menond5a02972012-03-01 10:51:06 -080080 struct vcd_aspect_ratio aspect_ratio_info;
Vinay Kaliab5598742011-12-21 16:52:33 -080081};
82
83struct vcd_sequence_hdr {
84 u8 *sequence_header;
85 u32 sequence_header_len;
86
87};
88
89enum 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
96struct 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
105struct 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 kotur13d82f82012-03-12 11:12:32 -0700119/*Flags passed to vcd_open*/
120#define VCD_CP_SESSION 0x00000001
121
Vinay Kaliab5598742011-12-21 16:52:33 -0800122u32 vcd_init(struct vcd_init_config *config, s32 *driver_handle);
123u32 vcd_term(s32 driver_handle);
124u32 vcd_open(s32 driver_handle, u32 decoding,
125 void (*callback) (u32 event, u32 status, void *info, size_t sz,
Deepak kotur13d82f82012-03-12 11:12:32 -0700126 void *handle, void *const client_data), void *client_data, int flags);
Vinay Kaliab5598742011-12-21 16:52:33 -0800127u32 vcd_close(void *handle);
128u32 vcd_encode_start(void *handle);
129u32 vcd_encode_frame(void *handle, struct vcd_frame_data *input_frame);
130u32 vcd_decode_start(void *handle, struct vcd_sequence_hdr *seq_hdr);
131u32 vcd_decode_frame(void *handle, struct vcd_frame_data *input_frame);
132u32 vcd_pause(void *handle);
133u32 vcd_resume(void *handle);
134u32 vcd_flush(void *handle, u32 mode);
135u32 vcd_stop(void *handle);
136u32 vcd_set_property(void *handle, struct vcd_property_hdr *prop_hdr,
137 void *prop_val);
138u32 vcd_get_property(void *handle, struct vcd_property_hdr *prop_hdr,
139 void *prop_val);
140u32 vcd_set_buffer_requirements(void *handle, enum vcd_buffer_type buffer,
141 struct vcd_buffer_requirement *buffer_req);
142u32 vcd_get_buffer_requirements(void *handle, enum vcd_buffer_type buffer,
143 struct vcd_buffer_requirement *buffer_req);
144u32 vcd_set_buffer(void *handle, enum vcd_buffer_type buffer_type,
145 u8 *buffer, u32 buf_size);
146u32 vcd_allocate_buffer(void *handle, enum vcd_buffer_type buffer,
147 u32 buf_size, u8 **vir_buf_addr, u8 **phy_buf_addr);
148
149u32 vcd_free_buffer(void *handle, enum vcd_buffer_type buffer_type, u8 *buffer);
150u32 vcd_fill_output_buffer(void *handle, struct vcd_frame_data *buffer);
151u32 vcd_set_device_power(s32 driver_handle,
152 enum vcd_power_state pwr_state);
153void vcd_read_and_clear_interrupt(void);
154void vcd_response_handler(void);
155u8 vcd_get_num_of_clients(void);
156u32 vcd_get_ion_status(void);
157struct ion_client *vcd_get_ion_client(void);
158#endif