• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 #ifndef __HDMI_HAL_MACHINE_H__
19 #define __HDMI_HAL_MACHINE_H__
20 
21 #include "hdmi_product_define.h"
22 
23 #define HDMI_MACH_MAX_STAMPE_NUM   6
24 #define HDMI_MACH_MAX_NAME_SIZE    15
25 #define HDMI_MACH_DEFUALT_INTERVAL 10
26 
27 typedef hi_void (*mach_callback)(hi_void *data);
28 
29 typedef struct {
30     hi_char *name;
31     hi_u64   interval;
32     hi_void *data;
33     mach_callback callback;
34 } hdmi_mach_ctrl;
35 
36 typedef struct {
37     hi_bool valid_id;
38     hi_bool enable;
39     hi_u64  enable_time;
40     hi_u64  disable_time;
41     hi_u64  last_time;
42     hi_u32  run_cnt;
43     hi_u32  stamp_idx;
44     hi_u64  timestamp[HDMI_MACH_MAX_STAMPE_NUM];
45     hi_char name[HDMI_MACH_MAX_NAME_SIZE];
46 } hdmi_mach_run;
47 
48 typedef struct {
49     hdmi_mach_run  mach_run;
50     hdmi_mach_ctrl mach_ctrl;
51 } hdmi_mach_elem;
52 
53 typedef struct {
54     hdmi_mach_run  mach_run;
55     hdmi_mach_ctrl mach_ctrl;
56 } hdmi_mach_elem_status;
57 
58 typedef struct {
59     hi_bool init;
60     hi_u32  total;
61 } hdmi_mach_status;
62 
63 hi_s32 hal_hdmi_mach_init(hi_void);
64 
65 hi_s32 hal_hdmi_mach_deinit(hi_void);
66 
67 hi_s32 hal_hdmi_mach_invoke(hi_void);
68 
69 hi_s32 hal_hdmi_mach_register(const hdmi_mach_ctrl *mach_ctrl, hi_u32 *mach_id);
70 
71 hi_s32 hal_hdmi_mach_unregister(hi_u32 mach_id);
72 
73 hi_s32 hal_hdmi_mach_cfg_set(hi_u32 mach_id, const hdmi_mach_ctrl *mach_ctrl);
74 
75 hi_s32 hal_hdmi_mach_cfg_get(hi_u32 mach_id, hdmi_mach_ctrl *mach_ctrl);
76 
77 hi_s32 hal_hdmi_mach_start(hi_u32 mach_id);
78 
79 hi_s32 hal_hdmi_mach_stop(hi_u32 mach_id);
80 
81 hi_s32 hal_hdmi_mach_status_get(hdmi_mach_status *status);
82 
83 hi_s32 hal_hdmi_mach_elem_status_get(hi_u32 mach_id, hdmi_mach_elem_status *status);
84 
85 hi_u64 hal_hdmi_mach_ms_get(hi_void);
86 
87 #endif /* __HDMI_HAL_MACHINE_H__ */
88 
89