Arm-2D  
2D Image Processing Library for Cortex-M Processors
 
Loading...
Searching...
No Matches
arm_2d.h
1/*
2 * Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* ----------------------------------------------------------------------
20 * Project: Arm-2D Library
21 * Title: #include "arm_2d.h"
22 * Description: Public header file to contain the all avaialble Arm-2D
23 * interface header files
24 *
25 * $Date: 08. Feb 2023
26 * $Revision: V.1.0.13
27 *
28 * Target Processor: Cortex-M cores
29 * -------------------------------------------------------------------- */
30
31#ifndef __ARM_2D_H__
32#define __ARM_2D_H__
33
34/*============================ INCLUDES ======================================*/
35#include "arm_2d_types.h"
36#include "arm_2d_op.h"
37#include "arm_2d_tile.h"
38#include "arm_2d_draw.h"
39#include "arm_2d_conversion.h"
40#include "arm_2d_alpha_blending.h"
41#include "arm_2d_transform.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/* suppress some warnings for user applications when using arm-2d.
48 */
49#if defined(__clang__)
50# pragma clang diagnostic push
51# pragma clang diagnostic ignored "-Wunknown-warning-option"
52# pragma clang diagnostic ignored "-Wreserved-identifier"
53# pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end"
54# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
55# pragma clang diagnostic ignored "-Wgnu-statement-expression"
56# pragma clang diagnostic ignored "-Wextra-semi-stmt"
57# pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
58# pragma clang diagnostic ignored "-Winitializer-overrides"
59# pragma clang diagnostic ignored "-Wgcc-compat"
60#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
61# pragma diag_suppress 1296,174
62#endif
63
64/*!
65 * \addtogroup gKernel 1 Kernel
66 * @{
67 */
68
69/*============================ MACROS ========================================*/
70
71/* arm-2d version */
72#define ARM_2D_VERSION_MAJOR 1 //!< Major version
73#define ARM_2D_VERSION_MINOR 1 //!< Minor version
74#define ARM_2D_VERSION_PATCH 1 //!< Patch number
75#define ARM_2D_VERSION_STR "" //!< tag
76
77/*!
78 * \brief arm-2d version number in decimal
79 *
80 */
81#define ARM_2D_VERISON ( ARM_2D_VERSION_MAJOR * 10000ul \
82 + ARM_2D_VERSION_MINOR * 100ul \
83 ARM_2D_VERSION_PATCH)
84
85/*============================ MACROFIED FUNCTIONS ===========================*/
86/*============================ TYPES =========================================*/
87
88/*!
89 * \brief a type for arm-2d runtime configuration
90 *
91 */
92typedef struct {
93 /*! if the target region is out of the target tile, return arm_fsm_rt_cpl */
95
96 /*! indicate that there is a dedicated thread to run arm_2d_task() in RTOS env */
98 uint8_t : 6;
100
101/*!
102 * \brief a type for arm-2d version
103 *
104 */
105typedef struct {
106 uint8_t Major; //!< major version
107 uint8_t Minor; //!< minor version
108 uint8_t Patch; //!< patch number
109 uint8_t : 8;
111
112/*============================ GLOBAL VARIABLES ==============================*/
113
114/*!
115 * \brief arm-2d runtime feature configuration
116 *
117 */
118extern
120
121/*!
122 * \brief arm-2d version
123 *
124 */
125extern
127
128/*============================ PROTOTYPES ====================================*/
129
130/*!
131 * \brief initialise arm-2d
132 */
133extern
134void arm_2d_init(void);
135
136/*!
137 * \brief set the default frame buffer
138 * \param ptFrameBuffer the new frame buffer,
139 * \note Passing NULL means using no default framebuffer
140 * \return arm_2d_tile_t* the address of the old frame buffer
141 */
142extern
144 const arm_2d_tile_t *ptFrameBuffer);
145
146/*!
147 * \brief get the default frame buffer
148 * \return arm_2d_tile_t* the address of the default frame buffer
149 */
150extern
152
153/*!
154 * \brief attach a user param (which could be a pointer) to specified OP
155 *
156 * \param ptOP the address of the target OP (NULL means using the default OP)
157 *
158 * \param pUserParam a user parameter (it can be used as a pointer)
159 */
160extern
161void arm_2d_set_user_param(arm_2d_op_core_t *ptOP, uintptr_t pUserParam);
162
163/*!
164 * \brief wait asynchronous operation complete
165 * \param[in] ptOP the address of the target OP (NULL means using the default OP)
166 * \retval true sync up with operation
167 * \retval false operation is busy
168 */
169extern
171
172/*!
173 \brief get the status of a specified OP,
174 \details usually, it is used after calling arm_2d_op_wait_async().
175 E.g.
176 \code
177 //! wait for previous operation complete
178 do {
179 arm_2d_op_wait_async();
180 arm_2d_op_status_t tStatus = arm_2d_get_op_status();
181 if (tStatus.bIOError) {
182 //! error detected
183 ...
184 } else if (tStatus.bOpCpl) {
185 break;
186 }
187 } while(true);
188 \endcode
189 \param ptOP the address of the target OP (NULL means using the default OP)
190 \return arm_2d_op_status_t the operation status
191 */
192extern
194
195/*!
196 * \brief arm-2d pixel pipeline task entery
197 * \note This function is *TRHEAD-SAFE*
198 * \param ptTask the address of an arm-2d task control block
199 * \retval arm_fsm_rt_cpl The sub-task FIFO is empty, the caller can wait for a
200 * semaphore set by arm_2d_notif_sub_task_fifo_task_arrive()
201 * \retval arm_fsm_rt_on_going The arm_2d_task yields
202 * \retval arm_fsm_rt_async You shouldn't see this value
203 * \retval arm_fsm_rt_wait_for_obj hardware accelerator wants to sync-up with applications.
204 * \retval (<0) Serious error is detected.
205 */
206extern
208
209/*! @} */
210
211/*! \note delibrately comment out */
212//#if defined(__clang__)
213//# pragma clang diagnostic pop
214//#endif
215
216#ifdef __cplusplus
217}
218#endif
219
220
221#endif