Arm-2D  
2D Image Processing Library for Cortex-M Processors
 
Loading...
Searching...
No Matches
arm_2d_types.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: arm_2d_types.h
22 * Description: Public header file to contain the Arm-2D structs
23 *
24 * $Date: 09. September 2025
25 * $Revision: V.1.3.2
26 *
27 * Target Processor: Cortex-M cores
28 * -------------------------------------------------------------------- */
29
30
31#ifndef __ARM_2D_TYPES_H__
32#define __ARM_2D_TYPES_H__
33
34/*============================ INCLUDES ======================================*/
35#include <string.h>
36#include <stdint.h>
37#include <stdbool.h>
38#include <assert.h>
39#include <inttypes.h>
40
41#include "arm_2d_features.h"
42#include "arm_2d_utils.h"
43#include "__arm_2d_math.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
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 "-Wmissing-declarations"
54# pragma clang diagnostic ignored "-Wpadded"
55# pragma clang diagnostic ignored "-Wc11-extensions"
56# pragma clang diagnostic ignored "-Wembedded-directive"
57#elif __IS_COMPILER_ARM_COMPILER_5__
58# pragma diag_suppress 64
59#elif __IS_COMPILER_GCC__
60# pragma GCC diagnostic push
61# pragma GCC diagnostic ignored "-Wmissing-declarations"
62# pragma GCC diagnostic ignored "-Wpadded"
63#endif
64
65/*!
66 * \addtogroup gKernel 1 Kernel
67 * @{
68 */
69
70/*============================ MACROS ========================================*/
71
72/* A patch for GCC support */
73#if defined(__IS_COMPILER_GCC__) && __IS_COMPILER_GCC__ && __ARM_2D_HAS_HELIUM__
74
75# if (__GNUC__ > 13) || \
76 (__GNUC__ == 13 && __GNUC_MINOR__ > 2) || \
77 (__GNUC__ == 13 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1)
78
79 /* require minimal gcc version: 13.2 rel1 */
80# ifndef __ARM_2D_SUPPRESS_GCC_HELIUM_PERFORMANCE_WARNING__
81# pragma GCC warning "GCC only has basic support for Helium and its\
82 performance might highly like disappoint you,You can define a macro\
83 __ARM_2D_SUPPRESS_GCC_HELIUM_PERFORMANCE_WARNING__ to suppress this warning."
84# endif
85
86# ifndef USE_MVE_INTRINSICS
87# define USE_MVE_INTRINSICS
88# endif
89
90# else
91 /* the gcc version is too low to support helium well */
92# ifndef __ARM_2D_SUPPRESS_GCC_HELIUM_PATCH_WARNING__
93# pragma GCC warning "As GCC has compilation issues for supporting Helium,\
94 the scalar version is used. You can define a macro\
95 __ARM_2D_SUPPRESS_GCC_HELIUM_PATCH_WARNING__ to suppress this warning."
96# endif
97
98# undef __ARM_2D_HAS_HELIUM__
99# undef __ARM_2D_HAS_HELIUM_INTEGER__
100# undef __ARM_2D_HAS_HELIUM_FLOAT__
101
102# define __ARM_2D_HAS_HELIUM__ 0 //!< target MCU has no Helium extension
103# define __ARM_2D_HAS_HELIUM_INTEGER__ 0 //!< target MCU has no Helium integer extension
104# define __ARM_2D_HAS_HELIUM_FLOAT__ 0 //!< target MCU has no Helium floating point extension
105
106# endif
107
108#endif
109
110#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
111# ifndef USE_MVE_INTRINSICS
112# define USE_MVE_INTRINSICS
113# endif
114#endif
115
116#if defined(__IS_COMPILER_GCC__) && __IS_COMPILER_GCC__
117# define __va_list va_list
118#endif
119
120#if defined(__IS_COMPILER_LLVM__) && __IS_COMPILER_LLVM__
121# define __va_list va_list
122#endif
123
124#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
125# define __va_list va_list
126#endif
127
128
129#if __IS_COMPILER_ARM_COMPILER_5__
130
131#define __UINT8_MAX__ UINT8_MAX
132#define __UINT16_MAX__ UINT16_MAX
133#define __UINT32_MAX__ UINT32_MAX
134
135#define __INT8_MAX__ INT8_MAX
136#define __INT16_MAX__ INT16_MAX
137#define __INT32_MAX__ INT32_MAX
138
139#endif
140
141/*============================ MACROFIED FUNCTIONS ===========================*/
142/*============================ TYPES =========================================*/
143
144
145/*----------------------------------------------------------------------------*
146 * Infrastructure *
147 *----------------------------------------------------------------------------*/
148
149/*!
150 * \brief finite-state-machine status return (Compatible with arm_status, minimal integer: int8_t)
151 *
152 */
153typedef enum {
154 arm_fsm_rt_err = -1, //!< fsm error
155 arm_fsm_rt_cpl = 0, //!< fsm complete
156 arm_fsm_rt_on_going = 1, //!< fsm on-going
157 arm_fsm_rt_wait_for_obj = 2, //!< fsm wait for IPC object
158 arm_fsm_rt_async = 3, //!< fsm work asynchronously, please check it later.
159 arm_fsm_rt_wait_for_res = 4, //!< wait for resource
160 __arm_fsm_rt_last,
162
163/*!
164 * \brief the error code for arm-2d (minimal integer: int8_t)
165 *
166 */
167typedef enum {
168 ARM_2D_ERR_INVALID_STATUS = -13, //!< the target service is in an invalid status for an API
169 ARM_2D_ERR_NOT_AVAILABLE = -12, //!< service is not available or not initialissed
170 ARM_2D_ERR_UNSUPPORTED_COLOUR = -11, //!< the specified colour is not supported
171 ARM_2D_ERR_BUSY = -10, //!< service is busy
172 ARM_2D_ERR_INSUFFICIENT_RESOURCE = -9, //!< insufficient resource
173 ARM_2D_ERR_IO_BUSY = -8, //!< HW accelerator is busy
174 ARM_2D_ERR_IO_ERROR = -7, //!< Generic HW error
175 ARM_2D_ERR_MISSING_PARAM = -6, //!< missing mandatory parameter
176 ARM_2D_ERR_INVALID_OP = -5, //!< unsupported / invalid operation
177 ARM_2D_ERR_NOT_SUPPORT = -4, //!< feature/service/operation is not supported
178 ARM_2D_ERR_OUT_OF_REGION = -3, //!< the operation is out of target area
179 ARM_2D_ERR_INVALID_PARAM = -2, //!< invalid parameter
180 ARM_2D_ERR_UNKNOWN = -1, //!< generic or unknown errors
181 ARM_2D_ERR_NONE = 0, //!< no error
182 ARM_2D_RT_FALSE = 0, //!< false
183 ARM_2D_RT_TRUE = 1, //!< true
184 ARM_2D_RT_FRAME_SKIPPED = __arm_fsm_rt_last, //!< frame is skipped
185 ARM_2D_RT_PFB_USER_DRAW,
187
188/*!
189 * \brief comparison result
190 *
191 */
192typedef enum {
193 ARM_2D_CMP_SMALLER = -1, //!< the target is smaller than the reference
194 ARM_2D_CMP_EQUALS = 0, //!< the target is equal to the reference
195 ARM_2D_CMP_LARGER = 1, //!< the target is larger than the reference
197
198/*----------------------------------------------------------------------------*
199 * Colour definitions *
200 *----------------------------------------------------------------------------*/
201
202/*!
203 * \brief the colour type for gray8 (8bit gray scale)
204 *
205 */
206typedef struct arm_2d_color_gray8_t {
207 uint8_t tValue;
209
210/*!
211 * \brief the colour type for rgb565
212 *
213 */
215 uint16_t tValue;
216 struct {
217 uint16_t u5B : 5;
218 uint16_t u6G : 6;
219 uint16_t u5R : 5;
220 };
222
223/*!
224 * \brief the colour type for brga8888
225 *
226 * \details In most cases four equal-sized pieces of adjacent memory are used,
227 * one for each channel, and a 0 in a channel indicates black color or
228 * transparent alpha, while all-1 bits indicates white or fully opaque
229 * alpha. By far the most common format is to store 8 bits (one byte)
230 * for each channel, which is 32 bits for each pixel.
231 *
232 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
233 */
235 uint32_t tValue;
236 uint8_t chChannel[4];
237 struct {
238 uint32_t u8B : 8;
239 uint32_t u8G : 8;
240 uint32_t u8R : 8;
241 uint32_t u8A : 8;
242 };
244
245/*!
246 * \brief the colour type for rgb888 (compliant with ccca888 and bgra8888)
247 *
248 * \details In most cases four equal-sized pieces of adjacent memory are used,
249 * one for each channel, and a 0 in a channel indicates black color or
250 * transparent alpha, while all-1 bits indicates white or fully opaque
251 * alpha. By far the most common format is to store 8 bits (one byte)
252 * for each channel, which is 32 bits for each pixel.
253 *
254 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
255 */
257 uint32_t tValue;
258 struct {
259 uint32_t u8B : 8;
260 uint32_t u8G : 8;
261 uint32_t u8R : 8;
262 uint32_t : 8;
263 };
265
266/*!
267 * \brief the colour type for any 32bit colour formats which has an alpha channel on its 3rd byte.
268 *
269 * \details In most cases four equal-sized pieces of adjacent memory are used,
270 * one for each channel, and a 0 in a channel indicates black color or
271 * transparent alpha, while all-1 bits indicates white or fully opaque
272 * alpha. By far the most common format is to store 8 bits (one byte)
273 * for each channel, which is 32 bits for each pixel.
274 *
275 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
276 */
278 uint32_t tValue;
279 struct {
280 uint8_t u8C[3];
281 uint8_t u8A;
282 };
284
285/*!
286 * \brief the colour type for any 32bit colour formats which has an alpha channel on its first byte.
287 *
288 * \details In most cases four equal-sized pieces of adjacent memory are used,
289 * one for each channel, and a 0 in a channel indicates black color or
290 * transparent alpha, while all-1 bits indicates white or fully opaque
291 * alpha. By far the most common format is to store 8 bits (one byte)
292 * for each channel, which is 32 bits for each pixel.
293 *
294 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
295 */
297 uint32_t tValue;
298 struct {
299 uint8_t u8A;
300 uint8_t u8C[3];
301 };
303
304/*!
305 * \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its 3rd byte.
306 *
307 * \details In most cases four equal-sized pieces of adjacent memory are used,
308 * one for each channel, and a 0 in a channel indicates black color or
309 * transparent alpha, while all-1 bits indicates white or fully opaque
310 * alpha. By far the most common format is to store 8 bits (one byte)
311 * for each channel, which is 32 bits for each pixel.
312 *
313 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
314 */
316 uint32_t tValue;
317 struct {
318 uint8_t u8C[3];
319 uint8_t : 8;
320 };
322
323/*!
324 * \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its first byte.
325 *
326 * \details In most cases four equal-sized pieces of adjacent memory are used,
327 * one for each channel, and a 0 in a channel indicates black color or
328 * transparent alpha, while all-1 bits indicates white or fully opaque
329 * alpha. By far the most common format is to store 8 bits (one byte)
330 * for each channel, which is 32 bits for each pixel.
331 *
332 * (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
333 */
335 uint32_t tValue;
336 struct {
337 uint8_t : 8;
338 uint8_t u8C[3];
339 };
341
342
343/*!
344 * \brief the generic type to hold a colour
345 *
346 */
347typedef union arm_2d_colour_t {
348
349 uint32_t wColour;
350 uint16_t hwColour;
351 uint8_t chColour;
352
361
363
364/*!
365 * \brief enumerations for colour attributes
366 */
367enum {
368 ARM_2D_COLOUR_SZ_1BIT = 0, //!< 1 bit:black and white
369 ARM_2D_COLOUR_SZ_2BIT = 1, //!< 4 colours or 4 gray-levels
370 ARM_2D_COLOUR_SZ_4BIT = 2, //!< 16 colours or 16 gray-levels
371 ARM_2D_COLOUR_SZ_8BIT = 3, //!< 256 colours
372 ARM_2D_COLOUR_SZ_16BIT = 4, //!< 16bits
373 ARM_2D_COLOUR_SZ_32BIT = 5, //!< true colour (32bit)
374 ARM_2D_COLOUR_SZ_24BIT = 6, //!< true colour (24bit)
375
376 ARM_2D_COLOUR_SZ_1BIT_msk = ARM_2D_COLOUR_SZ_1BIT << 1,
377 ARM_2D_COLOUR_SZ_2BIT_msk = ARM_2D_COLOUR_SZ_2BIT << 1,
378 ARM_2D_COLOUR_SZ_4BIT_msk = ARM_2D_COLOUR_SZ_4BIT << 1,
379 ARM_2D_COLOUR_SZ_8BIT_msk = ARM_2D_COLOUR_SZ_8BIT << 1,
380 ARM_2D_COLOUR_SZ_16BIT_msk = ARM_2D_COLOUR_SZ_16BIT<< 1,
381 ARM_2D_COLOUR_SZ_32BIT_msk = ARM_2D_COLOUR_SZ_32BIT<< 1,
382 ARM_2D_COLOUR_SZ_24BIT_msk = ARM_2D_COLOUR_SZ_24BIT<< 1,
383 ARM_2D_COLOUR_SZ_msk = (0x07 << 1),
384
385 ARM_2D_COLOUR_LITTLE_ENDIAN = 0,
386 ARM_2D_COLOUR_BIG_ENDIAN = 1,
387
388 ARM_2D_COLOUR_LITTLE_ENDIAN_msk = ARM_2D_COLOUR_LITTLE_ENDIAN << 4,
389 ARM_2D_COLOUR_BIG_ENDIAN_msk = ARM_2D_COLOUR_BIG_ENDIAN << 4,
390
391 ARM_2D_COLOUR_NO_ALPHA = 0,
392 ARM_2D_COLOUR_HAS_ALPHA = 1,
393
394 ARM_2D_COLOUR_NO_ALPHA_msk = ARM_2D_COLOUR_NO_ALPHA << 0,
395 ARM_2D_COLOUR_HAS_ALPHA_msk = ARM_2D_COLOUR_HAS_ALPHA << 0,
396
397 ARM_2D_COLOUR_VARIANT_pos = 5,
398 ARM_2D_COLOUR_VARIANT_msk = 0x03 << ARM_2D_COLOUR_VARIANT_pos,
399};
400
401/* macros for colour attributes */
402#define ARM_2D_M_COLOUR_SZ_1BIT 0 //!< 1 bit:black and white
403#define ARM_2D_M_COLOUR_SZ_2BIT 1 //!< 4 colours or 4 gray-levels
404#define ARM_2D_M_COLOUR_SZ_4BIT 2 //!< 16 colours or 16 gray-levels
405#define ARM_2D_M_COLOUR_SZ_8BIT 3 //!< 256 colours
406#define ARM_2D_M_COLOUR_SZ_16BIT 4 //!< 16bits
407#define ARM_2D_M_COLOUR_SZ_32BIT 5 //!< true colour
408#define ARM_2D_M_COLOUR_SZ_24BIT 6 //!< true colour
409
410#define ARM_2D_M_COLOUR_SZ_1BIT_msk (ARM_2D_M_COLOUR_SZ_1BIT << 1) //!< bitmask for 1bit colour formats
411#define ARM_2D_M_COLOUR_SZ_2BIT_msk (ARM_2D_M_COLOUR_SZ_2BIT << 1) //!< bitmask for 2bit colour formats
412#define ARM_2D_M_COLOUR_SZ_4BIT_msk (ARM_2D_M_COLOUR_SZ_4BIT << 1) //!< bitmask for 4bit colour formats
413#define ARM_2D_M_COLOUR_SZ_8BIT_msk (ARM_2D_M_COLOUR_SZ_8BIT << 1) //!< bitmask for 8bit colour formats
414#define ARM_2D_M_COLOUR_SZ_16BIT_msk (ARM_2D_M_COLOUR_SZ_16BIT<< 1) //!< bitmask for 16bit colour formats
415#define ARM_2D_M_COLOUR_SZ_32BIT_msk (ARM_2D_M_COLOUR_SZ_32BIT<< 1) //!< bitmask for 32bit colour formats
416#define ARM_2D_M_COLOUR_SZ_24BIT_msk (ARM_2D_M_COLOUR_SZ_24BIT<< 1) //!< bitmask for 24bit colour formats
417#define ARM_2D_M_COLOUR_SZ_msk (0x07 << 1), //!< bitmask for the SZ bitfield
418
419#define ARM_2D_M_COLOUR_LITTLE_ENDIAN 0 //!< pixels are stored in little endian
420#define ARM_2D_M_COLOUR_BIG_ENDIAN 1 //!< pixels are stored big endian
421
422#define ARM_2D_M_COLOUR_LITTLE_ENDIAN_msk (ARM_2D_M_COLOUR_LITTLE_ENDIAN << 4)//!< bitmask for little-endian
423#define ARM_2D_M_COLOUR_BIG_ENDIAN_msk (ARM_2D_M_COLOUR_BIG_ENDIAN << 4)//!< bitmask for big-endian
424
425#define ARM_2D_M_COLOUR_NO_ALPHA 0 //!< there is no alpha channel in each pixel
426#define ARM_2D_M_COLOUR_HAS_ALPHA 1 //!< there is an alpha channel in each pixel
427
428#define ARM_2D_M_COLOUR_NO_ALPHA_msk (ARM_2D_M_COLOUR_NO_ALPHA << 0) //!< bitmask for no-alpha-channel-in-pixel
429#define ARM_2D_M_COLOUR_HAS_ALPHA_msk (ARM_2D_M_COLOUR_HAS_ALPHA << 0) //!< bitmask for has-alpha-channel-in-pixel
430
431#define ARM_2D_M_COLOUR_VARIANT_pos 5 //!< offset for the VARIANT bitfield
432#define ARM_2D_M_COLOUR_VARIANT_msk (0x03<<ARM_2D_M_COLOUR_VARIANT_pos) //!< bitmask for the VARIANT bitfield
433
434/*!
435 * \brief enumerations for colour types
436 *
437 */
438enum {
439 ARM_2D_COLOUR_MONOCHROME = ARM_2D_COLOUR_SZ_1BIT_msk | ARM_2D_COLOUR_VARIANT_msk,
440 ARM_2D_COLOUR_BIN = ARM_2D_COLOUR_MONOCHROME,
441 ARM_2D_COLOUR_1BIT = ARM_2D_COLOUR_MONOCHROME,
442
443 ARM_2D_COLOUR_MASK_A1 = ARM_2D_COLOUR_MONOCHROME,
444 ARM_2D_COLOUR_MASK_A2 = ARM_2D_M_COLOUR_SZ_2BIT_msk,
445 ARM_2D_COLOUR_MASK_A4 = ARM_2D_M_COLOUR_SZ_4BIT_msk,
446
447 ARM_2D_COLOUR_2BIT = ARM_2D_M_COLOUR_SZ_2BIT_msk,
448 ARM_2D_COLOUR_4BIT = ARM_2D_M_COLOUR_SZ_4BIT_msk,
449
450 ARM_2D_COLOUR_8BIT = ARM_2D_COLOUR_SZ_8BIT_msk,
451 ARM_2D_COLOUR_GRAY8 = ARM_2D_COLOUR_SZ_8BIT_msk,
452 ARM_2D_COLOUR_MASK_A8 = ARM_2D_COLOUR_SZ_8BIT_msk,
453
454 ARM_2D_COLOUR_16BIT = ARM_2D_COLOUR_SZ_16BIT_msk,
455 ARM_2D_COLOUR_RGB16 = ARM_2D_COLOUR_SZ_16BIT_msk,
456 ARM_2D_COLOUR_RGB565 = ARM_2D_COLOUR_RGB16,
457
458/* won't support
459 ARM_2D_COLOUR_RGB565_BE = ARM_2D_COLOUR_SZ_16BIT_msk |
460 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
461 */
462
463 ARM_2D_COLOUR_24BIT = ARM_2D_COLOUR_SZ_24BIT_msk , /* not supported yet */
464 ARM_2D_COLOUR_RGB24 = ARM_2D_COLOUR_SZ_24BIT_msk , /* not supported yet */
465
466 ARM_2D_COLOUR_32BIT = ARM_2D_COLOUR_SZ_32BIT_msk ,
467 ARM_2D_COLOUR_RGB32 = ARM_2D_COLOUR_SZ_32BIT_msk ,
468
469 ARM_2D_COLOUR_CCCN888 = ARM_2D_COLOUR_RGB32 ,
470 ARM_2D_COLOUR_CCCA8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
471 ARM_2D_COLOUR_HAS_ALPHA_msk ,
472
473 ARM_2D_COLOUR_RGB888 = ARM_2D_COLOUR_CCCN888 ,
474 ARM_2D_COLOUR_BGRA8888 = ARM_2D_COLOUR_CCCA8888 ,
475
476/* not supported yet
477 ARM_2D_COLOUR_NCCC888 = ARM_2D_COLOUR_RGB32 |
478 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
479 ARM_2D_COLOUR_ACCC8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
480 ARM_2D_COLOUR_HAS_ALPHA_msk |
481 ARM_2D_COLOUR_BIG_ENDIAN_msk ,
482*/
483
484 ARM_2D_CHANNEL_8in32 = ARM_2D_COLOUR_SZ_32BIT_msk |
485 ARM_2D_COLOUR_HAS_ALPHA_msk |
486 ARM_2D_COLOUR_VARIANT_msk ,
487};
488
489/* macros for colour formats */
490#define ARM_2D_M_COLOUR_MONOCHROME ARM_2D_M_COLOUR_SZ_1BIT_msk |\
491 ARM_2D_M_COLOUR_VARIANT_msk //!< macro for the monochrome
492#define ARM_2D_M_COLOUR_BIN ARM_2D_M_COLOUR_MONOCHROME //!< macro for the 1bit colour format (alias)
493#define ARM_2D_M_COLOUR_1BIT ARM_2D_M_COLOUR_MONOCHROME //!< macro for the 1bin colour format (alias)
494
495#define ARM_2D_M_COLOUR_MASK_A1 ARM_2D_M_COLOUR_SZ_1BIT_msk //!< macro for the 1bit alpha mask
496#define ARM_2D_M_COLOUR_MASK_A2 ARM_2D_M_COLOUR_SZ_2BIT_msk //!< macro for the 2bit alpha mask
497#define ARM_2D_M_COLOUR_MASK_A4 ARM_2D_M_COLOUR_SZ_4BIT_msk //!< macro for the 4bit alpha mask
498
499#define ARM_2D_M_COLOUR_8BIT ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the generic 8bit colour formats
500#define ARM_2D_M_COLOUR_GRAY8 ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the gray8 colour format
501#define ARM_2D_M_COLOUR_MASK_A8 ARM_2D_M_COLOUR_SZ_8BIT_msk //!< macro for the 8bit alpha mask
502
503#define ARM_2D_M_COLOUR_16BIT ARM_2D_M_COLOUR_SZ_16BIT_msk //!< macro for the generic 16bit colour formats
504#define ARM_2D_M_COLOUR_RGB16 ARM_2D_M_COLOUR_SZ_16BIT_msk //!< macro for the generic 16bit colour formats
505#define ARM_2D_M_COLOUR_RGB565 ARM_2D_M_COLOUR_RGB16 //!< macro for the rgb565
506
507/* won't support
508#define ARM_2D_M_COLOUR_RGB565_BE ( ARM_2D_M_COLOUR_SZ_16BIT_msk \
509 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
510 */
511
512#define ARM_2D_M_COLOUR_24BIT ARM_2D_M_COLOUR_SZ_24BIT_msk //!< macro for the generic 24bit colour formats
513#define ARM_2D_M_COLOUR_RGB24 ARM_2D_M_COLOUR_SZ_24BIT_msk //!< macro for the generic 24bit colour formats
514
515#define ARM_2D_M_COLOUR_32BIT ARM_2D_M_COLOUR_SZ_32BIT_msk //!< macro for the generic 32bit colour formats
516#define ARM_2D_M_COLOUR_RGB32 ARM_2D_M_COLOUR_SZ_32BIT_msk //!< macro for the generic 32bit colour formats
517
518#define ARM_2D_M_COLOUR_CCCN888 ARM_2D_M_COLOUR_RGB32 //!< macro for the generic 32bit colour formats with an reserved channel at the highest byte
519
520/*! macro for the generic 32bit colour formats with an alpha channel at the highest byte */
521#define ARM_2D_M_COLOUR_CCCA8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
522 | ARM_2D_M_COLOUR_HAS_ALPHA_msk)
523
524#define ARM_2D_M_COLOUR_RGBX888 ARM_2D_M_COLOUR_CCCN888 //!< macro for the RGB888 (BGRN8888)
525#define ARM_2D_M_COLOUR_BGRA8888 ARM_2D_M_COLOUR_CCCA8888 //!< macro for the BGRA8888
526
527/* not supported yet
528#define ARM_2D_M_COLOUR_NCCC888 ( ARM_2D_M_COLOUR_RGB32 \
529 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
530#define ARM_2D_M_COLOUR_ACCC8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
531 | ARM_2D_M_COLOUR_HAS_ALPHA_msk \
532 | ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
533*/
534/*! macro for a special colour format which access only one channel in RGB32 */
535#define ARM_2D_M_CHANNEL_8in32 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
536 | ARM_2D_M_COLOUR_HAS_ALPHA_msk) \
537 | ARM_2D_M_COLOUR_VARIANT_msk )
538
539/*!
540 * \brief a type used as colour descriptor
541 *
542 */
543typedef union {
544 struct {
545 uint8_t bHasAlpha : 1; //!< whether the target colour has alpha channel
546 uint8_t u3ColourSZ : 3; //!< the size of the colour
547 uint8_t bBigEndian : 1; //!< whether the colour is stored in big endian
548 uint8_t u2Variant : 2;
549 uint8_t : 1;
550 };
551 struct {
552 uint8_t u7ColourFormat : 7;
553 uint8_t : 1;
554 };
555 uint8_t chScheme;
557
558/*----------------------------------------------------------------------------*
559 * Tile and Regions *
560 *----------------------------------------------------------------------------*/
561
562/*!
563 * \brief a type for coordinates (integer)
564 *
565 */
566typedef struct arm_2d_location_t {
567 int16_t iX; //!< x in Cartesian coordinate system
568 int16_t iY; //!< y in Cartesian coordinate system
570
571/*!
572 * \brief a type for coordinates in floating point
573 *
574 */
575typedef struct arm_2d_point_float_t {
576 float fX; //!< x in Cartesian coordinate system
577 float fY; //!< y in Cartesian coordinate system
579
580/*!
581 * \brief a type for coordinates in fixed point
582 *
583 */
584typedef struct arm_2d_point_fx_t {
585 union {
586 //int32_t X; //!< x in Cartesian coordinate system
587 q16_t q16X;
588 };
589 union {
590 //int32_t Y; //!< y in Cartesian coordinate system
591 q16_t q16Y;
592 };
594
596
597/*!
598 * \brief a type for the size of an rectangular area
599 *
600 */
601typedef struct arm_2d_size_t {
602 int16_t iWidth; //!< width of an rectangular area
603 int16_t iHeight; //!< height of an rectangular area
605
606/*!
607 * \brief a type for an rectangular area
608 *
609 */
610typedef struct arm_2d_region_t {
611 implement_ex(arm_2d_location_t, tLocation); //!< the location (top-left corner)
612 implement_ex(arm_2d_size_t, tSize); //!< the size
614
615/*!
616 * \brief the tile extension ID
617 *
618 */
619enum {
620 ARM_2D_TILE_EXTENSION_NONE = 0, //!< no extension in the tile.tInfo.Extension field
621 ARM_2D_TILE_EXTENSION_PFB, //!< contains PFB extension information
622 ARM_2D_TILE_EXTENSION_VRES, //!< contains Virtual resource extension information
623};
624
625/*!
626 * \brief a type for tile
627 *
628 */
629typedef struct arm_2d_tile_t arm_2d_tile_t;
631 implement_ex(struct {
632 uint8_t bIsRoot : 1; //!< is this tile a root tile
633 uint8_t bHasEnforcedColour : 1; //!< does this tile contains enforced colour info
634 uint8_t bDerivedResource : 1; //!< indicate whether this is a derived resources (when bIsRoot == 0)
635 uint8_t bVirtualResource : 1; //!< indicate whether the resource should be loaded on-demand
636 uint8_t bVirtualScreen : 1; //!< DO NOT USE! indicate whether the tile is considered as the virtual screen, it is used in dirty region calculation
637 uint8_t u3ExtensionID : 3; //!< Tile Extension ID
638 arm_2d_color_info_t tColourInfo; //!< enforced colour
639
640 union {
641 uint16_t : 16;
642 struct {
643 uint8_t bIsNewFrame : 1;
644 uint8_t bIsDryRun : 1;
645 }PFB;
646 struct {
647 int16_t iTargetStride;
648 }VRES;
649 } Extension;
650
651 }, tInfo);
652
653 implement_ex(arm_2d_region_t, tRegion); //!< the region of the tile
654
655 union {
656 /* when bIsRoot is true, phwBuffer is available,
657 * otherwise ptParent is available
658 */
659 arm_2d_tile_t *ptParent; //!< a pointer points to the parent tile
660 uint8_t *pchBuffer; //!< a pointer points to a buffer in a 8bit colour type
661 uint16_t *phwBuffer; //!< a pointer points to a buffer in a 16bit colour type
662 uint32_t *pwBuffer; //!< a pointer points to a buffer in a 32bit colour type
663
664 intptr_t nAddress; //!< a pointer in integer
665 };
666};
667
668/*----------------------------------------------------------------------------*
669 * Misc *
670 *----------------------------------------------------------------------------*/
671
672/*!
673 * \brief alignment
674 */
675typedef enum {
676 ARM_2D_ALIGN_LEFT = _BV(0), /*!< align to left */
677 ARM_2D_ALIGN_RIGHT = _BV(1), /*!< align to right */
678 ARM_2D_ALIGN_TOP = _BV(2), /*!< align to top */
679 ARM_2D_ALIGN_BOTTOM = _BV(3), /*!< align to bottom */
680
681 ARM_2D_ALIGN_CENTRE = 0, /*!< align to centre */
682 ARM_2D_ALIGN_CENTRE_ALIAS = ARM_2D_ALIGN_LEFT /*!< align to centre */
686
687 ARM_2D_ALIGN_TOP_LEFT = ARM_2D_ALIGN_TOP /*!< align to top left corner */
689 ARM_2D_ALIGN_TOP_RIGHT = ARM_2D_ALIGN_TOP /*!< align to top right corner */
691 ARM_2D_ALIGN_TOP_MIDDLE = ARM_2D_ALIGN_TOP /*!< align to the middle of the top */
694 ARM_2D_ALIGN_TOP_CENTRE = ARM_2D_ALIGN_TOP_MIDDLE,
695
696 ARM_2D_ALIGN_BOTTOM_LEFT = ARM_2D_ALIGN_BOTTOM /*!< align to bottom left corner */
698 ARM_2D_ALIGN_BOTTOM_RIGHT = ARM_2D_ALIGN_BOTTOM /*!< align to bottom right corner */
700 ARM_2D_ALIGN_BOTTOM_MIDDLE = ARM_2D_ALIGN_BOTTOM /*!< align to the middle of the bottom */
703 ARM_2D_ALIGN_BOTTOM_CENTRE = ARM_2D_ALIGN_BOTTOM_MIDDLE,
704
705 ARM_2D_ALIGN_MIDDLE_LEFT = ARM_2D_ALIGN_LEFT /*!< align to the middle of the left side */
708 ARM_2D_ALIGN_MIDDLE_RIGHT = ARM_2D_ALIGN_RIGHT /*!< align to the middle of the right side */
712
713/*!
714 * \brief the margin inside a region / container
715 */
716typedef struct arm_2d_margin_t {
717 uint8_t chLeft; /*!< left margin */
718 uint8_t chRight; /*!< right margin */
719 uint8_t chTop; /*!< top margin */
720 uint8_t chBottom; /*!< bottom margin */
722
723/*!
724 * \brief the padding between rectanglar areas
725 */
726typedef struct arm_2d_padding_t {
727 int8_t chLeft; /*!< left padding */
728 int8_t chRight; /*!< right padding */
729 int8_t chTop; /*!< top padding */
730 int8_t chBottom; /*!< bottom padding */
732
733/*!
734 * \brief type for 4 points alpha sample points
735 *
736 */
738 struct {
739 uint8_t chTopLeft;
740 uint8_t chTopRight;
741 uint8_t chBottomLeft;
742 uint8_t chBottomRight;
743 };
744 uint8_t chAlpha[4];
746
747/*!
748 * \brief type for 3 points alpha sample points
749 *
750 */
752 struct {
753 uint8_t chTopLeft;
754 uint8_t chTopRight;
755 uint8_t chBottomLeft;
756 };
757 uint8_t chAlpha[3];
759
760/*!
761 * \brief type for 2 points alpha sample points
762 *
763 */
765 struct {
766 uint8_t chLeft; /* chTopLeft */
767 uint8_t chRight; /* chTopRight */
768 };
769 struct {
770 uint8_t chTopLeft;
771 union {
772 uint8_t chTopRight;
773 uint8_t chBottomLeft;
774 };
775 };
776 struct {
777 uint8_t chTop; /* chTopLeft */
778 uint8_t chBottom; /* chBottomLeft */
779 };
780 uint8_t chAlpha[2];
782
783/*!
784 * \brief the enumeration type for describing memory types
785 *
786 */
787typedef enum {
788 ARM_2D_MEM_TYPE_UNSPECIFIED, //!< normal memory, we don't know its characterisics
789 ARM_2D_MEM_TYPE_SLOW, //!< for slow memories, such as SDRAM, DDRAM, external memory etc
790 ARM_2D_MEM_TYPE_FAST, //!< for fast memories, such as TCM, SRAM etc.
792
793typedef union __arm_2d_mem_info_t {
794 struct {
795 uint32_t u24SizeInByte : 24; //!< the memory size in Byte
796 uint32_t u2ItemSize : 3; //!< the size of the data item
797 uint32_t u2Align : 3; //!< the alignment
798 uint32_t u2Type : 2; //!< The memory type define in enum arm_2d_mem_type_t
799 };
800 uint32_t Value; //!< Memory Information
802
803/*!
804 * \brief scratch memory descriptor
805 * \note "manually" derived from __arm_2d_mem_info_t
806 */
807typedef struct arm_2d_scratch_mem_t {
808 implement_ex(union {
809 struct {
810 uint32_t u24SizeInByte : 24; //!< the memory size in Byte
811 uint32_t u2ItemSize : 3; //!< the size of the data item
812 uint32_t u2Align : 3; //!< the alignment
813 uint32_t u2Type : 2; //!< The memory type define in enum arm_2d_mem_type_t
814 };
815 uint32_t Value; //!< Memory Information
816 }, tInfo);
817
818 uintptr_t pBuffer;
820
821/*!
822 * \brief a type for scratch memory blocks
823 *
824 */
825typedef struct __arm_2d_mem_t __arm_2d_mem_t;
827 union {
828 __arm_2d_mem_t *ptNext; //!< a list pointer
829 uint32_t wSignature; //!< a signature for validation
830 };
831 __arm_2d_mem_info_t tInfo; //!< memory info
832 uint8_t pBuffer[]; //!< a constant pointer points to the buffer following this header
833};
834
835
836/*!
837 * \brief a type for virtual resource
838 *
839 * \note the flag tTile.tInfo.bVirtualResource must be true (1)
840 */
841typedef struct arm_2d_vres_t arm_2d_vres_t;
843
844 /*! base class: tTile */
846
847 /*! a reference of an user object */
848 uintptr_t pTarget;
849
850 /*!
851 * \brief a method to load a specific part of an image
852 * \param[in] pTarget a reference of an user object
853 * \param[in] ptVRES a reference of this virtual resource
854 * \param[in] ptRegion the target region of the image
855 * \return intptr_t the address of a resource buffer which holds the content
856 */
857 intptr_t (*Load) ( uintptr_t pTarget,
858 arm_2d_vres_t *ptVRES,
859 arm_2d_region_t *ptRegion);
860
861 /*!
862 * \brief a method to despose the buffer
863 * \param[in] pTarget a reference of an user object
864 * \param[in] ptVRES a reference of this virtual resource
865 * \param[in] pBuffer the target buffer
866 */
867 void (*Depose) ( uintptr_t pTarget,
868 arm_2d_vres_t *ptVRES,
869 intptr_t pBuffer );
870};
871
872/*----------------------------------------------------------------------------*
873 * Task *
874 *----------------------------------------------------------------------------*/
875
876/*!
877 * \brief arm-2d application level task control block
878 *
879 */
880typedef struct arm_2d_task_t {
881ARM_PRIVATE(
882 arm_fsm_rt_t tResult; //!< the temporary result of the task
883 uint8_t chState; //!< the state of the FSM
884
885 void *ptTask; //!< a pointer for an internal object
888
889/*----------------------------------------------------------------------------*
890 * Operation and Events Handling *
891 *----------------------------------------------------------------------------*/
892
893
895
896/*!
897 * \brief a prototype of event handlers for 2D operations
898 *
899 * \param[in] ptThisOP the target 2D operation descriptor
900 * \param[in] tResult the operation result
901 * \param[in] pTarget A user attached object
902 * \return bool a boolean value to indicate whether the event has been handled
903 */
905 arm_fsm_rt_t tResult,
906 void *pTarget);
907
908/*!
909 * \brief a type for 2D operation event handling
910 *
911 */
912typedef struct arm_2d_op_evt_t {
914 void *pTarget; //!< user attached target
916
917/*!
918 * \brief a prototype for generic event handlers
919 *
920 * \param pTarget A user attached object
921 * \return bool a boolean value to indicate whether the event has been handled
922 */
923typedef bool arm_2d_evt_handler_t(void *pTarget);
924
925/*!
926 * \brief a type for generic event handling
927 *
928 */
929typedef struct arm_2d_evt_t {
930 arm_2d_evt_handler_t *fnHandler; //!< event handler
931 void *pTarget; //!< user attached target
933
934#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE _BV(0) //!< opcode has source tile info
935#define ARM_2D_OP_INFO_PARAM_HAS_TARGET _BV(1) //!< opcode has target tile info
936#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK _BV(2) //!< opcode has source mask info
937#define ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK _BV(3) //!< opcode has target mask info
938#define ARM_2D_OP_INFO_PARAM_HAS_ORIGIN _BV(4) //!< opcode has original tile info
939
940/*! a bitmask for INFO_PARAM_HAS_xxxx bitfields */
941#define ARM_2D_OP_INFO_PARAM_TILES_MASK ( \
942 ARM_2D_OP_INFO_PARAM_HAS_SOURCE | \
943 ARM_2D_OP_INFO_PARAM_HAS_TARGET | \
944 ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK | \
945 ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK | \
946 ARM_2D_OP_INFO_PARAM_HAS_ORIGIN )
947
948
949//! \brief an incomplete defintion which is only used for defining pointers
951
952/*!
953 * \brief A descriptive header for 2D operations
954 */
955typedef union __arm_2d_op_info_t {
956 struct {
957 arm_2d_color_info_t Colour; //!< the colour used in thie operation
958 union {
959 struct {
960 uint8_t bHasSource : 1; //!< whether this operation contains source tile
961 uint8_t bHasTarget : 1; //!< whether this operation contains target tile
962 uint8_t bHasSrcMask : 1; //!< whether this operation has Mask layer for source tile
963 uint8_t bHasDesMask : 1; //!< whether this operation has Mask layer for target tile
964 uint8_t bHasOrigin : 1; //!< whether the Source has an origin tile
965 uint8_t : 2;
966 uint8_t bAllowEnforcedColour : 1; //!< whether this operation allow enforced colours in tiles
967 };
968 uint8_t chValue; //!< feature value
969 }Param; //!< operation feature set
970
971 uint8_t chInClassOffset; //!< some operation uses this as the offset of the key member in the class
972 uint8_t chOpIndex; //!< __ARM_2D_OP_IDX_XXXXXX
973
974 union {
975 struct {
976 uint8_t CopyLike; //!< A copy-like interface contains the target tile, the source tile and the copy size
977 uint8_t FillLike; //!< A copy-like interface contains the target tile and the source tile
978 };
979 struct {
980 uint8_t CopyOrigLike; //!< A copy-like interface contains the target tile, the dummy tile, the reference to the original source tile and the copy size
981 uint8_t FillOrigLike; //!< A copy-like interface contains the target tile, the dummy tile and the reference to the original source tile
982 };
983 struct {
984 uint8_t TileProcessLike; //!< A simple interface contains only the target tile
985 };
986 }LowLevelInterfaceIndex; //!< Low level interface index
987
988 union {
989 const __arm_2d_low_level_io_t *IO[2]; //!< array of IOs
990
991 struct {
992 const __arm_2d_low_level_io_t *ptCopyLike; //!< the function pointer for a copy-like implementation
993 const __arm_2d_low_level_io_t *ptFillLike; //!< the function pointer for a fill-like implementation
994 };
995 struct {
996 const __arm_2d_low_level_io_t *ptCopyOrigLike; //!< the function pointer for a copy-orig-like implementation
997 const __arm_2d_low_level_io_t *ptFillOrigLike; //!< the function pointer for a fill-orig-like implementation
998 };
999 struct {
1000 const __arm_2d_low_level_io_t *ptTileProcessLike; //!< the function pointer for the tile-process-like implementation
1001 };
1002 }LowLevelIO; //!< low level IO definition
1003
1004 }Info; //!< operation description
1005 uint32_t wID; //!< Operation ID
1007
1008/*!
1009 * \brief how would you want to accelerate the 2d-operation
1010 */
1011enum {
1012 //! Use hardware acceleration if possible, even if there is a long queue to wait
1014
1015 //! Only use Hardware Acceleration, if it is not supported, IO error will be issued
1017
1018 //! Only use software algorithm
1020
1021 //!< don't care, let the arm-2d library decide
1022 ARM_2D_PREF_ACC_DONT_CARE = 3,
1023};
1024
1025#define __ARM_2D_OP_STATUS_BUSY_msk (1 << 4) //!< bitmask for the busy flag
1026#define __ARM_2D_OP_STATUS_IO_ERROR_msk (1 << 5) //!< bitmask for the IO error flag
1027#define __ARM_2D_OP_STATUS_CPL_msk (1 << 6) //!< bitmask for the complete flag
1028
1029/*!
1030 * \brief a type for 2D operation status
1031 *
1032 */
1033typedef union arm_2d_op_status_t {
1034 struct {
1035 uint16_t u4SubTaskCount : 4; //!< sub task count
1036 uint16_t bIsBusy : 1; //!< busy flag
1037 uint16_t bIOError : 1; //!< HW IO Error or other errors
1038 uint16_t bOpCpl : 1; //!< the whole operation complete
1039 uint16_t : 9; //!< reserved
1040 };
1041 uint16_t tValue; //!< the host integer
1043
1044/*!
1045 * \brief the abstract class of 2D operations
1046 *
1047 */
1049ARM_PRIVATE(
1050 arm_2d_op_core_t *ptNext; //!< a pointer for a single list
1051
1052 const __arm_2d_op_info_t *ptOp; //!< the pointer for the corresponding 2D operation description
1053
1054 struct {
1055 uint8_t u2ACCMethods : 2; //!< acceleration Methods
1056 uint8_t : 6; //!< reserved
1057 }Preference;
1058
1059 int8_t tResult; //!< operation result
1060 volatile arm_2d_op_status_t Status; //!< operation status
1061
1062 arm_2d_op_evt_t evt2DOpCpl; //!< operation-complete event
1063
1064#if __ARM_2D_HAS_ASYNC__
1065 uintptr_t pSemaphore; //!< point to semaphore
1066#endif
1068
1069 uintptr_t pUserParam; //!< user attached object
1070};
1071
1072/*!
1073 * \brief the base class for operations with only a target tile
1074 * \note arm_2d_op_msk_t inherits from arm_2d_op_core_t
1075 */
1076typedef struct arm_2d_op_t {
1078 struct {
1079 const arm_2d_tile_t *ptTile; //!< target tile
1080 const arm_2d_region_t *ptRegion; //!< target region
1081 } Target;
1082} arm_2d_op_t;
1083
1084/*!
1085 * \brief the base class for operations with a target tile and a target mask
1086 * \note arm_2d_op_msk_t inherits from arm_2d_op_t
1087 */
1088typedef struct arm_2d_op_msk_t {
1090 struct {
1091 const arm_2d_tile_t *ptTile; //!< target tile
1092 const arm_2d_region_t *ptRegion; //!< target region
1093 } Target;
1094
1095 /* derived part */
1096 struct {
1097 const arm_2d_tile_t *ptTargetSide; //!< target mask tile
1098 } Mask;
1100
1101/*!
1102 * \brief the base class for operations with a target tile and a source tile
1103 * \note arm_2d_op_src_t inherits from arm_2d_op_t
1104 */
1105typedef struct arm_2d_op_src_t {
1107 struct {
1108 const arm_2d_tile_t *ptTile; //!< target tile
1109 const arm_2d_region_t *ptRegion; //!< target region
1110 } Target;
1111
1112 /* derived part */
1113 struct {
1114 const arm_2d_tile_t *ptTile; //!< source tile
1115 }Source;
1116 uint32_t wMode;
1118
1119/*!
1120 * \brief the base class for operations with a target tile and a source tile
1121 * \note arm_2d_op_src_opc_t inherits from arm_2d_op_src_t
1122 */
1123typedef struct arm_2d_op_src_opc_t {
1125 struct {
1126 const arm_2d_tile_t *ptTile; //!< target tile
1127 const arm_2d_region_t *ptRegion; //!< target region
1128 } Target;
1129
1130 /* derived part */
1131 struct {
1132 const arm_2d_tile_t *ptTile; //!< source tile
1133 }Source;
1134 uint32_t wMode;
1135
1136 uint8_t chOpacity; //!< opacity
1138
1139/*!
1140 * \brief the base class for operations with a target tile, a source tile and masks
1141 * \note arm_2d_op_src_msk_t inherits from arm_2d_op_src_t
1142 */
1143typedef struct arm_2d_op_src_msk_t {
1145 struct {
1146 const arm_2d_tile_t *ptTile; //!< target tile
1147 const arm_2d_region_t *ptRegion; //!< target region
1148 } Target;
1149 struct {
1150 const arm_2d_tile_t *ptTile; //!< source tile
1151 }Source;
1152 uint32_t wMode;
1153
1154 /* derived part */
1155 struct {
1156 const arm_2d_tile_t *ptSourceSide; //!< source side mask
1157 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1158 } Mask;
1160
1161/*!
1162 * \brief the base class for operations with a target tile, a source tile and masks
1163 * \note arm_2d_op_src_msk_opc_t inherits from arm_2d_op_src_msk_t
1164 */
1167 struct {
1168 const arm_2d_tile_t *ptTile; //!< target tile
1169 const arm_2d_region_t *ptRegion; //!< target region
1170 } Target;
1171 struct {
1172 const arm_2d_tile_t *ptTile; //!< source tile
1173 }Source;
1174 uint32_t wMode;
1175
1176 /* derived part */
1177 struct {
1178 const arm_2d_tile_t *ptSourceSide; //!< source side mask
1179 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1180 } Mask;
1181
1182 uint8_t chOpacity; //!< opacity
1184
1185/*!
1186 * \brief the base class for operations with a target tile, a dummy tile and a reference to the original source tile
1187 * \note arm_2d_op_src_orig_t inherits from arm_2d_op_src_t
1188 */
1189typedef struct arm_2d_op_src_orig_t {
1191 struct {
1192 const arm_2d_tile_t *ptTile; //!< target tile
1193 const arm_2d_region_t *ptRegion; //!< target region
1194 } Target;
1195 struct {
1196 const arm_2d_tile_t *ptTile; //!< the dummy source tile
1197 }Source;
1198 uint32_t wMode;
1199
1200 /* derived part */
1201 struct {
1202 const arm_2d_tile_t *ptTile; //!< the origin tile
1203 arm_2d_tile_t tDummySource; //!< the buffer for the source
1204 }Origin;
1205
1207
1208/*!
1209 * \brief the base class for operations with a target tile, a dummy tile, a reference to the original source tile and masks
1210 * \note arm_2d_op_src_orig_msk_t inherits from arm_2d_op_src_orig_t
1211 */
1214 struct {
1215 const arm_2d_tile_t *ptTile; //!< target tile
1216 const arm_2d_region_t *ptRegion; //!< target region
1217 } Target;
1218 struct {
1219 const arm_2d_tile_t *ptTile; //!< the dummy source tile
1220 }Source;
1221 uint32_t wMode;
1222 struct {
1223 const arm_2d_tile_t *ptTile; //!< the origin tile
1224 arm_2d_tile_t tDummySource; //!< the buffer for the source
1225 }Origin;
1226
1227 /* derived part */
1228 struct {
1229 const arm_2d_tile_t *ptOriginSide; //!< origin side mask
1230 const arm_2d_tile_t *ptTargetSide; //!< target side mask
1231 } Mask;
1233
1234
1235/*----------------------------------------------------------------------------*
1236 * Fast Rotation linear regression structure
1237 *----------------------------------------------------------------------------*/
1238
1239#if (__ARM_2D_HAS_HELIUM_FLOAT__ || __ARM_2D_HAS_FPU__) \
1240 && !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
1241/*!
1242 * \brief a type for parameters of linear interpolation (in floating point)
1243 *
1244 */
1245typedef struct arm_2d_rot_linear_regr_t {
1246 float slopeY;
1247 float interceptY;
1248 float slopeX;
1249 float interceptX;
1251
1252#else
1253/*!
1254 * \brief a type for parameters of linear interpolation (in fixed point)
1255 *
1256 */
1258 int32_t slopeY;
1259 int32_t interceptY;
1260 int32_t slopeX;
1261 int32_t interceptX;
1263
1264#endif
1265
1266/*============================ GLOBAL VARIABLES ==============================*/
1267/*============================ PROTOTYPES ====================================*/
1268
1269/*! @} */
1270
1271#if defined(__clang__)
1272#pragma clang diagnostic pop
1273#elif __IS_COMPILER_ARM_COMPILER_5__
1274#pragma diag_warning 64
1275#elif __IS_COMPILER_GCC__
1276#pragma GCC diagnostic pop
1277#endif
1278
1279#ifdef __cplusplus
1280}
1281#endif
1282
1283#endif // __ARM_2D_TYPES_H__
1284
1285