blob: 871eef898eb95773cd34952f8dfed00e92ea8c3b
1 | /* |
2 | * Copyright (C) 2013 The Android Open Source Project |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | |
17 | #ifndef ANDROID_INCLUDE_HARDWARE_AML_SCREEN_H |
18 | #define ANDROID_INCLUDE_HARDWARE_AML_SCREEN_H |
19 | |
20 | #include <hardware/hardware.h> |
21 | #include <android/native_window.h> |
22 | |
23 | |
24 | __BEGIN_DECLS |
25 | |
26 | /*****************************************************************************/ |
27 | |
28 | /** |
29 | * The id of this module |
30 | */ |
31 | |
32 | #define AML_SCREEN_HARDWARE_MODULE_ID "screen_source" |
33 | #define AML_SCREEN_SOURCE "screen_source" |
34 | |
35 | |
36 | /*****************************************************************************/ |
37 | |
38 | typedef struct aml_screen_buffer_info { |
39 | long * buffer_mem; |
40 | int buffer_canvas; |
41 | long tv_sec; |
42 | long tv_usec; |
43 | } aml_screen_buffer_info_t; |
44 | |
45 | typedef void (*olStateCB)(int state); |
46 | |
47 | typedef void (*app_data_callback)(void* user, |
48 | aml_screen_buffer_info_t *buff_info); |
49 | |
50 | struct aml_screen_device; |
51 | |
52 | typedef struct aml_screen_module { |
53 | struct hw_module_t common; |
54 | } aml_screen_module_t; |
55 | |
56 | enum SOURCETYPE{ |
57 | WIFI_DISPLAY, |
58 | HDMI_IN, |
59 | }; |
60 | |
61 | enum aml_screen_mode_e { |
62 | AML_SCREEN_MODE_RATIO = 0, |
63 | AML_SCREEN_MODE_FULL, |
64 | AML_SCREEN_MODE_ADAPTIVE, |
65 | AML_SCREEN_MODE_MAX |
66 | }; |
67 | |
68 | /** |
69 | * set_port_type() parameter description: |
70 | portType is consisted by 32-bit binary. |
71 | bit 28 : start tvin service flag, 1 : enable, 0 : disable. |
72 | bit 24 : vdin device num : 0 or 1, which means use vdin0 or vdin1. |
73 | bit 15~0 : tvin port type --TVIN_PORT_VIU,TVIN_PORT_HDMI0... |
74 | (port type define in tvin.h) |
75 | */ |
76 | typedef struct aml_screen_operations { |
77 | int (*start)(struct aml_screen_device*); |
78 | int (*stop)(struct aml_screen_device*); |
79 | int (*pause)(struct aml_screen_device*); |
80 | int (*setStateCallBack)(struct aml_screen_device*, olStateCB); |
81 | int (*setPreviewWindow)(struct aml_screen_device*, ANativeWindow*); |
82 | int (*setDataCallBack)(struct aml_screen_device*,app_data_callback, void*); |
83 | int (*get_format)(struct aml_screen_device*); |
84 | int (*set_format)(struct aml_screen_device*, int, int, int); |
85 | int (*set_rotation)(struct aml_screen_device*, int); |
86 | int (*set_crop)(struct aml_screen_device*, int, int, int, int); |
87 | int (*get_amlvideo2_crop)(struct aml_screen_device*, int *, int *, int *, int *); |
88 | int (*set_amlvideo2_crop)(struct aml_screen_device*, int, int, int, int); |
89 | int (*aquire_buffer)(struct aml_screen_device*, aml_screen_buffer_info_t*); |
90 | // int (*set_buffer_refcount)(struct aml_screen_device, int*, int); |
91 | int (*release_buffer)(struct aml_screen_device*, long*); |
92 | // int (*inc_buffer_refcount)(struct aml_screen_device*, int*); |
93 | int (*set_frame_rate)(struct aml_screen_device*, int); |
94 | int (*get_current_sourcesize)(struct aml_screen_device*, int *, int *); |
95 | int (*set_screen_mode)(struct aml_screen_device*, int); |
96 | int (*start_v4l2_device)(struct aml_screen_device*); |
97 | int (*stop_v4l2_device)(struct aml_screen_device*); |
98 | int (*get_port_type)(struct aml_screen_device*); |
99 | int (*set_port_type)(struct aml_screen_device*, unsigned int); |
100 | int (*set_mode)(struct aml_screen_device*, int); |
101 | } aml_screen_operations_t; |
102 | |
103 | typedef struct aml_screen_device { |
104 | hw_device_t common; |
105 | aml_screen_operations_t ops; |
106 | int device_id; |
107 | void* priv; |
108 | } aml_screen_device_t; |
109 | |
110 | /*****************************************************************************/ |
111 | |
112 | __END_DECLS |
113 | |
114 | #endif |
115 |