1 /**
2  * @file lv_pxp_cfg.c
3  *
4  */
5 
6 /**
7  * Copyright 2020-2023 NXP
8  *
9  * SPDX-License-Identifier: MIT
10  */
11 
12 /*********************
13  *      INCLUDES
14  *********************/
15 
16 #include "lv_pxp_cfg.h"
17 
18 #if LV_USE_PXP
19 #if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
20 #include "lv_pxp_osa.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 
26 /**********************
27  *      TYPEDEFS
28  **********************/
29 
30 /**********************
31  *  STATIC PROTOTYPES
32  **********************/
33 
34 /**********************
35  *  STATIC VARIABLES
36  **********************/
37 
38 static pxp_cfg_t * _pxp_cfg;
39 
40 /**********************
41  *      MACROS
42  **********************/
43 
44 /**********************
45  *   GLOBAL FUNCTIONS
46  **********************/
47 
lv_pxp_init(void)48 void lv_pxp_init(void)
49 {
50     _pxp_cfg = pxp_get_default_cfg();
51 
52     PXP_Init(PXP_ID);
53 
54     PXP_EnableCsc1(PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
55     PXP_SetProcessBlockSize(PXP_ID, kPXP_BlockSize16); /*Block size 16x16 for higher performance*/
56 
57     PXP_EnableInterrupts(PXP_ID, kPXP_CompleteInterruptEnable);
58 
59     _pxp_cfg->pxp_interrupt_init();
60 }
61 
lv_pxp_deinit(void)62 void lv_pxp_deinit(void)
63 {
64     _pxp_cfg->pxp_interrupt_deinit();
65     PXP_DisableInterrupts(PXP_ID, kPXP_CompleteInterruptEnable);
66     PXP_Deinit(PXP_ID);
67 }
68 
lv_pxp_reset(void)69 void lv_pxp_reset(void)
70 {
71     PXP_ResetControl(PXP_ID);
72 
73     PXP_EnableCsc1(PXP_ID, false); /*Disable CSC1, it is enabled by default.*/
74     PXP_SetProcessBlockSize(PXP_ID, kPXP_BlockSize16); /*Block size 16x16 for higher performance*/
75 }
76 
lv_pxp_run(void)77 void lv_pxp_run(void)
78 {
79     _pxp_cfg->pxp_run();
80     _pxp_cfg->pxp_wait();
81 }
82 
lv_pxp_wait(void)83 void lv_pxp_wait(void)
84 {
85     _pxp_cfg->pxp_wait();
86 }
87 
88 /**********************
89  *   STATIC FUNCTIONS
90  **********************/
91 
92 #endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
93 #endif /*LV_USE_PXP*/
94