• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 //#include "lcd_disp_ll.h"
17 #include "lcd_disp_ll_macro_def.h"
18 #include "lcd_disp_hal.h"
19 
20 
21 /* wr_threshold_val: 0-0xff rd_threshold_val:0-0xff */
lcd_hal_8080_set_fifo_data_thrd(uint16_t wr_threshold_val,uint16_t rd_threshold_val)22 void lcd_hal_8080_set_fifo_data_thrd(uint16_t wr_threshold_val, uint16_t rd_threshold_val)
23 {
24 	lcd_disp_ll_set_i8080thrd_dat_wr_thrd(wr_threshold_val);
25 	lcd_disp_ll_set_i8080thrd_dat_rd_thrd(rd_threshold_val);
26 }
27 
28 
29 /* wr_threshold_val: 0-0x3ff rd_threshold_val:0-0xfff */
lcd_hal_rgb_set_thrd(uint16_t wr_threshold_val,uint16_t rd_threshold_val)30 void lcd_hal_rgb_set_thrd(uint16_t wr_threshold_val, uint16_t rd_threshold_val)
31 {
32 	lcd_disp_ll_set_display_int_wr_thrd(wr_threshold_val);
33 	lcd_disp_ll_set_display_int_rd_thrd(rd_threshold_val);
34 }
35 
36 
37 /* is_sof_en :1 enable,0:disable ;  is_eof_en:1 enable,0:disable   */
lcd_hal_8080_int_enable(bool is_sof_en,bool is_eof_en)38 void lcd_hal_8080_int_enable(bool is_sof_en, bool is_eof_en)
39 {
40 	lcd_disp_ll_set_display_int_i8080_int_en(is_sof_en| (is_eof_en << 1));
41 }
42 
43 /* is_sof_en :1 enable,0:disable ;  is_eof_en:1 enable,0:disable   */
lcd_hal_rgb_int_enable(bool is_sof_en,bool is_eof_en)44 void lcd_hal_rgb_int_enable(bool         is_sof_en, bool is_eof_en)
45 {
46 	lcd_disp_ll_set_display_int_rgb_int_en(is_sof_en | (is_eof_en << 1));
47 }
48 
lcd_hal_pixel_config(uint16_t x_pixel,uint16_t y_pixel)49 void lcd_hal_pixel_config(uint16_t x_pixel, uint16_t y_pixel)
50 {
51 	lcd_disp_ll_set_status_x_pixel(x_pixel);
52 	lcd_disp_ll_set_status_y_pixel(y_pixel);
53 }
54 
lcd_hal_rgb_hsync(uint16_t rgb_hsync_back_porch,uint16_t rgb_hsync_front_porch)55 void lcd_hal_rgb_hsync(uint16_t rgb_hsync_back_porch, uint16_t rgb_hsync_front_porch)
56 {
57 	lcd_disp_ll_set_hsync_vsync_cfg_hsync_back_porch(rgb_hsync_back_porch);
58 	lcd_disp_ll_set_hsync_vsync_cfg_hsync_front_porch(rgb_hsync_front_porch);
59 }
60 
lcd_hal_rgb_vsync(uint16_t rgb_vsync_back_porch,uint16_t rgb_vsync_front_porch)61 void lcd_hal_rgb_vsync(uint16_t rgb_vsync_back_porch, uint16_t rgb_vsync_front_porch)
62 {
63 	lcd_disp_ll_set_hsync_vsync_cfg_vsync_front_porch(rgb_vsync_front_porch);
64 	lcd_disp_ll_set_hsync_vsync_cfg_vsync_back_porch(rgb_vsync_back_porch);
65 }
66 
lcd_hal_rgb_sync_config(uint16_t rgb_hsync_back_porch,uint16_t rgb_hsync_front_porch,uint16_t rgb_vsync_back_porch,uint16_t rgb_vsync_front_porch)67 void lcd_hal_rgb_sync_config(uint16_t rgb_hsync_back_porch, uint16_t rgb_hsync_front_porch, uint16_t rgb_vsync_back_porch, uint16_t rgb_vsync_front_porch)
68 {
69 	uint32_t sync = rgb_hsync_back_porch + (rgb_hsync_front_porch << 8) + (rgb_vsync_back_porch << 15) + (rgb_vsync_front_porch << 20);
70 	lcd_disp_ll_set_hsync_vsync_cfg_value(sync);
71 }
hal_lcd_8080_reset()72 void hal_lcd_8080_reset()
73 {
74 	lcd_disp_ll_set_i8080_config_reset_sleep_in(1);
75 	//reg_value |= (0x1 << 5);
76 	//reg_value |= 0xffffffdf;
77 	//bk_printf("reset value= %x \r\n", lcd_disp_ll_get_i8080_config_value());
78 }
hal_lcd_8080_unreset()79 void hal_lcd_8080_unreset()
80 {
81 	lcd_disp_ll_set_i8080_config_reset_sleep_in(0);
82 	//reg_value |= 0xffffffdf;
83 	//bk_printf("unreset value= %x \r\n", lcd_disp_ll_get_i8080_config_value());
84 }
85 
lcd_hal_int_status_clear(uint32_t int_type)86 void lcd_hal_int_status_clear(uint32_t int_type)
87 {
88 	if (I8080_OUTPUT_EOF | int_type) {
89 		lcd_disp_ll_set_display_int_i8080_eof(1);
90 	}
91 	if (I8080_OUTPUT_SOF | int_type) {
92 		lcd_disp_ll_set_display_int_i8080_sof(1);
93 	}
94 }
95 
96 
lcd_hal_eof_int_status_clear(void)97 void lcd_hal_eof_int_status_clear(void)
98 {
99 	lcd_disp_ll_set_display_int_i8080_eof(1);
100 }
lcd_hal_sof_int_status_clear(void)101 void lcd_hal_sof_int_status_clear(void)
102 {
103 	lcd_disp_ll_set_display_int_i8080_sof(1);
104 }
105 
lcd_hal_rgb_eof_int_status_clear(void)106 void lcd_hal_rgb_eof_int_status_clear(void)
107 {
108 	lcd_disp_ll_set_display_int_rgb_eof(1);
109 }
110 
lcd_hal_rgb_sof_int_status_clear(void)111 void lcd_hal_rgb_sof_int_status_clear(void)
112 {
113 	lcd_disp_ll_set_display_int_rgb_sof(1);
114 }
115 
lcd_hal_reg_deinit(void)116 void lcd_hal_reg_deinit(void)
117 {
118 	lcd_disp_ll_set_display_int_value(0);
119 	lcd_disp_ll_set_status_value(0);
120 	lcd_disp_ll_set_hsync_vsync_cfg_value(0);
121 	//lcd_disp_ll_set_i8080_config_value(0);
122 	lcd_disp_ll_set_display_int_value(0);
123 }
124 
lcd_hal_mem_clr(void)125 void lcd_hal_mem_clr(void)
126 {
127 	lcd_disp_ll_set_i8080_config_i8080_fifo_clr(1);
128 	lcd_disp_ll_set_i8080_config_i8080_cmdfifo_clr(1);
129 	lcd_disp_ll_set_status_str_fifo_clr(1);
130 }
131 
lcd_hal_rgb_display_sel(void)132 void lcd_hal_rgb_display_sel(void)
133 {
134 	lcd_disp_ll_set_status_rgb_on(1);
135 	lcd_disp_ll_set_status_lcd_display_on(1);
136 }
137 
138