2D Image Processing Library for Cortex-M Processors
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
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: 17. June 2022
26 * $Revision: V.1.0.4
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#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
54# pragma diag_suppress 1296,174
55#endif
56
57/*!
58 * \addtogroup gKernel 1 Kernel
59 * @{
60 */
61
62/*============================ MACROS ========================================*/
63
64//! \name arm-2d version
65//! @{
66#define ARM_2D_VERSION_MAJOR 1
67#define ARM_2D_VERSION_MINOR 0
68#define ARM_2D_VERSION_PATCH 0
69#define ARM_2D_VERSION_STR "preview"
70
71#define ARM_2D_VERISON ( ARM_2D_VERSION_MAJOR * 10000ul \
72 + ARM_2D_VERSION_MINOR * 100ul \
73 ARM_2D_VERSION_PATCH)
74//! @}
75
76/*============================ MACROFIED FUNCTIONS ===========================*/
77/*============================ TYPES =========================================*/
78
79typedef struct {
80 /*! if the target region is out of the target tile, return arm_fsm_rt_cpl */
82
83 /*! indicate that there is a dedicated thread to run arm_2d_task() in RTOS env */
85 uint8_t : 6;
87
88typedef struct {
89 uint8_t Major;
90 uint8_t Minor;
91 uint8_t Patch;
92 uint8_t : 8;
94
95/*============================ GLOBAL VARIABLES ==============================*/
96
97extern
98arm_2d_runtime_feature_t ARM_2D_RUNTIME_FEATURE;
99
100extern
101const arm_2d_version_t ARM_2D_VERSION;
102
103/*============================ PROTOTYPES ====================================*/
104
105/*!
106 * \brief initialise arm-2d
107 */
108extern
109void arm_2d_init(void);
110
111/*!
112 * \brief set the default frame buffer
113 * \param ptFrameBuffer the new frame buffer,
114 * \note Passing NULL means using no default framebuffer
115 * \return arm_2d_tile_t* the address of the old frame buffer
116 */
117extern
119 const arm_2d_tile_t *ptFrameBuffer);
120
121/*!
122 * \brief get the default frame buffer
123 * \return arm_2d_tile_t* the address of the default frame buffer
124 */
125extern
127
128/*!
129 * \brief attach a user param (which could be a pointer) to specified OP
130 * \param ptOP the address of the target OP (NULL means using the default OP)
131 * \param pUserParam a user parameter (it can be used as a pointer)
132 */
133extern
134void arm_2d_set_user_param(arm_2d_op_core_t *ptOP, uintptr_t pUserParam);
135
136/*!
137 * \brief wait asynchronouse operation complete
138 * \retval true sync up with operation
139 * \retval false operation is busy
140 */
141extern
143
144/*!
145 \brief get the status of a specified OP,
146 \details usually, it is used after calling arm_2d_op_wait_async().
147 E.g.
148 \code
149 //! wait for previous operation complete
150 do {
151 arm_2d_op_wait_async();
152 arm_2d_op_status_t tStatus = arm_2d_get_op_status();
153 if (tStatus.bIOError) {
154 //! error detected
155 ...
156 } else if (tStatus.bOpCpl) {
157 break;
158 }
159 } while(true);
160 \endcode
161 \param ptOP the address of the target OP (NULL means using the default OP)
162 \return arm_2d_op_status_t the operation status
163 */
164extern
166
167/*!
168 * \brief arm-2d pixel pipeline task entery
169 * \note This function is *TRHEAD-SAFE*
170 * \param ptTask the address of an arm-2d task control block
171 * \retval arm_fsm_rt_cpl The sub-task FIFO is empty, the caller can wait for a
172 * semaphore set by arm_2d_notif_sub_task_fifo_task_arrive()
173 * \retval arm_fsm_rt_on_going The arm_2d_task yields
174 * \retval arm_fsm_rt_async You shouldn't see this value
175 * \retval arm_fsm_rt_wait_for_obj hardware accelerator wants to sync-up with applications.
176 * \retval (<0) Serious error is detected.
177 */
178extern
179arm_fsm_rt_t arm_2d_task(arm_2d_task_t *ptTask);
180
181/*! @} */
182
183/*! \note delibrately comment out */
184//#if defined(__clang__)
185//# pragma clang diagnostic pop
186//#endif
187
188#ifdef __cplusplus
189}
190#endif
191
192
193#endif