1: int32_t AG903_VidMgrGetInputHandle(int32_t *ports, int32_t num_ports,
AG903_VidMgrInputHandle **handles)
2: {
3: int32_t i;
4: _Bool num_check[
AG903_VID_MGR_MAX_IN_PORTS] = {
false};
5:
6:
if (num_ports >
AG903_VID_MGR_MAX_IN_PORTS) {
7:
return -
AG903_EINVAL;
8: }
9:
if ((ports == NULL) || (handles == NULL)) {
10:
return -
AG903_EINVAL;
11: }
12:
for (i = 0; i < num_ports; i++) {
13:
if ((ports[i] < 0) || (ports[i] >=
AG903_VID_MGR_MAX_IN_PORTS)) {
14:
return -
AG903_EINVAL;
15: }
16:
if (VidContext.used_in_ports[ports[i]] !=
false) {
17:
return -
AG903_ENOMEM;
18: }
19:
20:
if (num_check[ports[i]] ==
true) {
21:
return -
AG903_EINVAL;
22: }
23: num_check[ports[i]] =
true;
24: }
25:
26:
for (i = 0; i < num_ports; i++) {
27:
28: handles[i] = (
AG903_VidMgrInputHandle *)&VidContext.in_ports[ports[i]];
29: handles[i]->id =
AG903_VID_MGR_INPUT_HANDLE_ID;
30: handles[i]->port_no = ports[i];
31: handles[i]->is_dirty =
false;
32: handles[i]->sync_signal = 0;
33: handles[i]->inout_vsync_pol = 0;
34: handles[i]->inout_hsync_pol = 0;
35: handles[i]->in_de_pol = 0;
36: handles[i]->in_field_pol = 0;
37: handles[i]->in_clk_pol = 0;
38: handles[i]->h_pulse_width = 0x60;
39: handles[i]->h_front_porch = 0x10;
40: handles[i]->h_back_porch = 0x30;
41: handles[i]->h_frame_size = 0x280;
42: handles[i]->v_pulse_width = 0x2;
43: handles[i]->v_front_porch = 0xA;
44: handles[i]->v_back_porch = 0x21;
45: handles[i]->v_frame_size = 0x1E0;
46:
47: VidContext.used_in_ports[ports[i]] =
true;
48: }
49:
return AG903_ENONE;
50: }