• 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 #pragma once
16 
17 #include <soc/soc.h>
18 #include "dma2d_ll.h"
19 #include <driver/hal/hal_dma2d_types.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 typedef struct
26 {
27 	dma2d_hw_t *hw;
28 } dma2d_hal_t;
29 
30 
31 bk_err_t dma2d_hal_init(DMA2D_HandleTypeDef *dma2d);
32 
33 bk_err_t dma2d_hal_deinit(void);
34 
35 /**
36   * @brief  Set the DMA2D transfer parameters.
37   * @param  dma2d     Pointer to a DMA2D_HandleTypeDef structure that contains
38   *                     the configuration information for the specified DMA2D.
39   * @param  src_addr      The source memory Buffer address
40   * @param  DstAddress The destination memory Buffer address
41   * @param  Width      The width of data to be transferred from source to destination.(number of pixel every line)
42   * @param  Height     The height of data to be transferred from source to destination.(number of line)
43   * @retval HAL status, uint32_t src_addr, uint32_t dst_addr, uint32_t width, uint32_t height
44   */
45 bk_err_t dma2d_hal_config(DMA2D_HandleTypeDef *dma2d, uint32_t src_addr, uint32_t dst_addr, uint32_t width, uint32_t height);
46 
47 bk_err_t dma2d_hal_start_transfer(bool start_transfer);
48 
49 bool dma2d_hal_is_transfer_done(void);
50 
51 bk_err_t dma2d_hal_suspend(bool suspend);
52 
53 bk_err_t dma2d_hal_blending_start(DMA2D_HandleTypeDef *dma2d, uint32_t src_addr1, uint32_t src_addr2, uint32_t dst_addr, uint32_t Width,  uint32_t Height);
54 
55 /**
56   * @brief  Configure the DMA2D CLUT Transfer.
57   * @param  hdma2d   Pointer to a DMA2D_HandleTypeDef structure that contains
58   *                   the configuration information for the DMA2D.
59   * @param  CLUTCfg  Pointer to a DMA2D_CLUTCfgTypeDef structure that contains
60   *                   the configuration information for the color look up table.
61   * @param  LayerIdx DMA2D Layer index.
62   *                   This parameter can be one of the following values:
63   *                   DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
64   * @note API obsolete and maintained for compatibility with legacy. User is invited
65   *      to resort to HAL_DMA2D_CLUTStartLoad() instead to benefit from code compactness,
66   *      code size and improved heap usage.
67   * @retval HAL status
68   */
69 bk_err_t dma2d_hal_clut_config(DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
70 
71 
72 /**
73   * @brief  Configure the DMA2D Layer according to the specified
74   *         parameters in the DMA2D_HandleTypeDef.
75   * @param  hdma2d Pointer to a DMA2D_HandleTypeDef structure that contains
76   *                 the configuration information for the DMA2D.
77   * @param  LayerIdx DMA2D Layer index.
78   *                   This parameter can be one of the following values:
79   *                   DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
80   * @retval HAL status
81   */
82 bk_err_t dma2d_hal_layer_config(DMA2D_HandleTypeDef *dma2d, uint32_t LayerIdx);
83 
84 bk_err_t dma2d_hal_abort(bool abort);
85 
86 bk_err_t dma2d_hal_int_config(DMA2D_INT_TYPE int_type, bool enable);
87 
88 bk_err_t dma2d_hal_int_status_get(void);
89 
90 bk_err_t dma2d_hal_int_status_clear(DMA2D_INT_STATUS int_status);
91 
92 bk_err_t dma2d_hal_line_Watermar_cfg(uint32_t Line);
93 
94 
95 /**
96   * @brief  Start the multi-source DMA2D Transfer.
97   * @param  hdma2d      Pointer to a DMA2D_HandleTypeDef structure that contains
98   *                      the configuration information for the DMA2D.
99   * @param  SrcAddress1 The source memory Buffer address for the foreground layer.
100   * @param  SrcAddress2 The source memory Buffer address for the background layer.
101   * @param  DstAddress  The destination memory Buffer address.
102   * @param  Width       The width of data to be transferred from source to destination (expressed in number of pixels per line).
103   * @param  Height      The height of data to be transferred from source to destination (expressed in number of lines).
104   * @retval HAL status
105   */
106 bk_err_t dma2d_hal_blending_config(uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
107 
108 /**
109   * @brief Configure dead time.
110   * @note The dead time value represents the guaranteed minimum number of cycles between
111   *       two consecutive transactions on the AHB bus.
112   * @param DeadTime dead time value.
113   * @param en.
114   * @retval HAL status
115   */
116 bk_err_t dma2d_hal_deadtime_config(uint8_t DeadTime, bool en);
117 
118 
119 #ifdef __cplusplus
120 }
121 #endif
122