1 /*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8 #include "dma350_lib_unprivileged.h"
9 #include "dma350_checker_layer.h"
10 #include "dma350_privileged_config.h"
11
12 #include <stddef.h>
13 #include <stdint.h>
14
dma350_memcpy_unpriv(uint8_t channel,const void * src,void * des,uint32_t size,enum dma350_lib_exec_type_t exec_type)15 enum dma350_lib_error_t dma350_memcpy_unpriv(uint8_t channel, const void* src,
16 void* des, uint32_t size,
17 enum dma350_lib_exec_type_t exec_type)
18 {
19 enum dma350_lib_error_t ret_val;
20 struct dma350_memcpy_config memcpy_config = {
21 .exec_type = exec_type,
22 .dst = des,
23 .src = src,
24 .size = size
25 };
26
27 ret_val = request_dma350_priv_config(DMA_CALL_MEMCPY, channel,
28 &memcpy_config);
29
30 return ret_val;
31 }
32
dma350_memmove_unpriv(uint8_t channel,const void * src,void * des,uint32_t size,enum dma350_lib_exec_type_t exec_type)33 enum dma350_lib_error_t dma350_memmove_unpriv(uint8_t channel, const void* src,
34 void* des, uint32_t size,
35 enum dma350_lib_exec_type_t exec_type)
36 {
37 enum dma350_lib_error_t ret_val;
38 struct dma350_memmove_config memmove_config = {
39 .exec_type = exec_type,
40 .dst = des,
41 .src = src,
42 .size = size
43 };
44
45 ret_val = request_dma350_priv_config(DMA_CALL_MEMMOVE, channel,
46 &memmove_config);
47
48 return ret_val;
49 }
50
dma350_draw_from_canvas_unpriv(uint8_t channel,const void * src,void * des,uint32_t src_width,uint16_t src_height,uint16_t src_line_width,uint32_t des_width,uint16_t des_height,uint16_t des_line_width,enum dma350_ch_transize_t pixelsize,enum dma350_lib_transform_t transform,enum dma350_lib_exec_type_t exec_type)51 enum dma350_lib_error_t dma350_draw_from_canvas_unpriv(uint8_t channel,
52 const void* src, void* des,
53 uint32_t src_width, uint16_t src_height,
54 uint16_t src_line_width,
55 uint32_t des_width, uint16_t des_height,
56 uint16_t des_line_width,
57 enum dma350_ch_transize_t pixelsize,
58 enum dma350_lib_transform_t transform,
59 enum dma350_lib_exec_type_t exec_type)
60 {
61 enum dma350_lib_error_t ret_val;
62 struct dma350_draw_config draw_config = {
63 .exec_type = exec_type,
64 .src = src,
65 .des = des,
66 .src_width = src_width,
67 .src_height = src_height,
68 .src_line_width = src_line_width,
69 .des_width = des_width,
70 .des_height = des_height,
71 .des_line_width = des_line_width,
72 .pixelsize = pixelsize,
73 .transform = transform
74 };
75
76 ret_val = request_dma350_priv_config(DMA_CALL_DRAW_FROM_CANVAS, channel,
77 &draw_config);
78
79 return ret_val;
80 }
81
dma350_clear_done_irq_unpriv(uint8_t channel)82 enum dma350_lib_error_t dma350_clear_done_irq_unpriv(uint8_t channel)
83 {
84 enum dma350_lib_error_t ret_val;
85
86 ret_val = request_dma350_priv_config(DMA_CLEAR_DONE_IRQ, channel, NULL);
87
88 return ret_val;
89 }
90
dma350_ch_get_status_unpriv(uint8_t channel,union dma350_ch_status_t * status)91 enum dma350_lib_error_t dma350_ch_get_status_unpriv(uint8_t channel,
92 union dma350_ch_status_t *status)
93 {
94 enum dma350_lib_error_t ret_val;
95
96 ret_val = request_dma350_priv_config(DMA_GET_STATUS, channel, status);
97
98 return ret_val;
99 }
100