Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Dependents:   ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more

License

When you use this library, we judge you have agreed to the following contents.

https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Note

If you import the GraphicsFramework library, please import GR-PEACH_video library and R_BSP library together.



JPEG Converter

The JPEG Converter driver implements encode and decode functionality which uses the JCU of the RZ/A Series.

Hello World!

Import programJCU_HelloWorld

Hello World for JCU(JPEG Codec Unit). JCU is JPEG codec unit of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

API

Import library

Data Structures

struct bitmap_buff_info_t
Bitmap data setting struct. More...
struct encode_options_t
Encode option setting. More...

Public Types

enum jpeg_conv_error_t {
JPEG_CONV_OK = 0, JPEG_CONV_JCU_ERR = -1, JPEG_CONV_FORMA_ERR = -2, JPEG_CONV_PARAM_ERR = -3,
JPEG_CONV_BUSY = -4, JPEG_CONV_PARAM_RANGE_ERR = -7
}

Error codes.

More...
enum wr_rd_swa_t {
WR_RD_WRSWA_NON = 0, WR_RD_WRSWA_8BIT = 1, WR_RD_WRSWA_16BIT = 2, WR_RD_WRSWA_16_8BIT = 3,
WR_RD_WRSWA_32BIT = 4, WR_RD_WRSWA_32_8BIT = 5, WR_RD_WRSWA_32_16BIT = 6, WR_RD_WRSWA_32_16_8BIT = 7
}

Write/Read image pixcel frame buffer swap setting.

More...
enum wr_rd_format_t { WR_RD_YCbCr422 = 0x00, WR_RD_ARGB8888 = 0x01, WR_RD_RGB565 = 0x02 }

Write/Read image pixcel format selects.

More...
enum sub_sampling_t { SUB_SAMPLING_1_1 = 0x00, SUB_SAMPLING_1_2 = 0x01, SUB_SAMPLING_1_4 = 0x02, SUB_SAMPLING_1_8 = 0x03 }

Thinning output image selects.

More...
enum cbcr_offset_t { CBCR_OFFSET_0 = 0x00, CBCR_OFFSET_128 = 0x01 }

Cb/Cr range selects for decode.

More...

Public Member Functions

JPEG_Converter ()
Constructor method of JPEG converter(encode/decode)
virtual ~JPEG_Converter ()
Destructor method of JPEG converter(encode/decode)
JPEG_Converter::jpeg_conv_error_t decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff)
Decode JPEG to rinear data.
JPEG_Converter::jpeg_conv_error_t decode (void *pJpegBuff, bitmap_buff_info_t *psOutputBuff, decode_options_t *pOptions)
JPEG data decode to bitmap.
JPEG_Converter::jpeg_conv_error_t encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize)
Encode rinear data to JPEG.
JPEG_Converter::jpeg_conv_error_t encode ( bitmap_buff_info_t *psInputBuff, void *pJpegBuff, size_t *pEncodeSize, encode_options_t *pOptions)
Bitmap data encode to JPEG.
JPEG_Converter::jpeg_conv_error_t SetQuality (const uint8_t qual)
Set encode quality.

Correspondence file

A correspondence file of JPEG Converter is as the following table.

JPEGCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr444, YCbCr422, YCbCr420, YCbCr411
BitmapCorrespondence
Width>0(greater than 0)
Height>0(greater than 0)
Color formatYCbCr422

Notice

You run JPEG converter once destruction each time.

You set whether these JPEG files aren't input, or it check error setting decode(set in "flag" = true). The JPEG file which becomes correspondence outside will be the following condition.

  • File besides the above-mentioned correspondence file.
  • As information in the JPEG file, WIDTH or HEIGHT is larger than output buffer setting.

Buffer area is used encode/decode, set 8 bytes align and non-cash memory area. The output buffer when decoding, is made beyond the size decided in the size of the JPEG file, the format, setting of thinning out. You make output buffer for decode/encode to enough big size in order to stock this result. JPEG Converter, if you do not particularly perform specified, does not check size against the output data at the time of encoding and decoding. You set the output buffer so that there is no effect of corruption by the output data.

Color format

Color format in case to be converted from Bitmap to JPEG is either ARGB8888 or RGB555, YCbCr422. Color format of the If you want to convert from JPEG file to Bitmap file is YCbCr422. You correct "alpha(member of decode_options_t)" of setting and "output_cb_cr_offset(member of decode_options_t)" according to color format when decoding.

  • example
    decode to ARGB8888(WR_RD_ARGB8888 set in format member of bitmap_buff_info_t)
    alpha = 0x01-0xFF
    output_cb_cr_offset = CBCR_OFFSET_0

    decode to YCbCr422(WR_RD_YCbCr422 set in format member of bitmap_buff_info_t)
    alpha = 0
    output_cb_cr_offset = CBCR_OFFSET_0 or CBCR_OFFSET_128

    decode to RGB565(WR_RD_RGB565 set in format member of bitmap_buff_info_t)
    alpha = 0
    output_cb_cr_offset = CBCR_OFFSET_0

Decode/encode settings are optional

If omitted encode/decode settings, it will work with the following settings.
[Decode option setting (member of decode_options_t)]

  • Vertical sub sampling is thinning output image to 1/1.
  • Horizontal sub sampling is thinning output image to 1/1.
  • Output data of Cb/Cr range is -128 to 127.
  • Output data of swap in 8-bit units: 2-1-4-3-6-5-8-7.
  • Alpha value of 0.
  • JPEG format correspondence outside error check.
  • It decode in a synchronous function.

[Encode option setting (member of encode_options_t)]

  • DRI value is 0.
  • Encoding JPEG file start width offset is 0.
  • Encoding JPEG file start height offset is 0.
  • Input data of Cb/Cr range of input data is -128 to 127.
  • Input data swap in 8-bit units: 2-1-4-3-6-5-8-7.
  • It don't check encode size.
  • Quantization Y use default table(Quality75).
  • Quantization C use default table(Quality75).
  • Huffman Y DC use default table.
  • Huffman C DC use default table.
  • Huffman Y AC use default table.
  • Huffman C AC use default table.
  • It encode in a synchronous function.

Synchronous/asynchronous switching

Decoding and encoding setting to operate asynchronously by setting a callback function(decode_options_t and encode_options_t).

Quality

Quality changes are possible. If you want to change the Quality, please specify the table made of Quality you want to change the address of the setting. If you do not want to change the Quality, it will operate at Quality75.

RGA

The RGA library implements fast drawing functionality which uses the RGA of the RZ/A Series.
Supporting compiler is ARMCC, GCC ARM and IAR.

Hello World!

Import programRGA_HelloWorld

Hello World for RGA(Renesas Graphics Architecture). RGA is the Graphics Library of RZ/A1. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Committer:
dkato
Date:
Mon Apr 24 08:16:23 2017 +0000
Revision:
13:1ee2176ef13f
Parent:
3:9f857750e4e9
Add "SetQuality()" to JCU.
; Bug fixes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:37e1e6a45ced 1 /*******************************************************************************
dkato 0:37e1e6a45ced 2 * DISCLAIMER
dkato 0:37e1e6a45ced 3 * This software is supplied by Renesas Electronics Corporation and is only
dkato 0:37e1e6a45ced 4 * intended for use with Renesas products. No other uses are authorized. This
dkato 0:37e1e6a45ced 5 * software is owned by Renesas Electronics Corporation and is protected under
dkato 0:37e1e6a45ced 6 * all applicable laws, including copyright laws.
dkato 0:37e1e6a45ced 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
dkato 0:37e1e6a45ced 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
dkato 0:37e1e6a45ced 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
dkato 0:37e1e6a45ced 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
dkato 0:37e1e6a45ced 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
dkato 0:37e1e6a45ced 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
dkato 0:37e1e6a45ced 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
dkato 0:37e1e6a45ced 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
dkato 0:37e1e6a45ced 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
dkato 0:37e1e6a45ced 16 * Renesas reserves the right, without notice, to make changes to this software
dkato 0:37e1e6a45ced 17 * and to discontinue the availability of this software. By using this software,
dkato 0:37e1e6a45ced 18 * you agree to the additional terms and conditions found by accessing the
dkato 0:37e1e6a45ced 19 * following link:
dkato 0:37e1e6a45ced 20 * http://www.renesas.com/disclaimer
dkato 0:37e1e6a45ced 21 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
dkato 0:37e1e6a45ced 22 *******************************************************************************/
dkato 0:37e1e6a45ced 23 /**
dkato 0:37e1e6a45ced 24 * @file r_ospl_typedef.h
dkato 0:37e1e6a45ced 25 * @brief OS Porting Layer. Data types.
dkato 0:37e1e6a45ced 26 *
dkato 0:37e1e6a45ced 27 * $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
dkato 0:37e1e6a45ced 28 * $Rev: 35 $
dkato 0:37e1e6a45ced 29 * $Date:: 2014-04-15 21:38:18 +0900#$
dkato 0:37e1e6a45ced 30 */
dkato 0:37e1e6a45ced 31
dkato 0:37e1e6a45ced 32 #ifndef R_OSPL_TYPEDEF_H
dkato 0:37e1e6a45ced 33 #define R_OSPL_TYPEDEF_H
dkato 0:37e1e6a45ced 34
dkato 0:37e1e6a45ced 35
dkato 0:37e1e6a45ced 36 /******************************************************************************
dkato 0:37e1e6a45ced 37 Includes <System Includes> , "Project Includes"
dkato 0:37e1e6a45ced 38 ******************************************************************************/
dkato 0:37e1e6a45ced 39 #ifdef __GNUC__
dkato 0:37e1e6a45ced 40 #include <stdint.h>
dkato 0:37e1e6a45ced 41 #include <stdbool.h>
dkato 0:37e1e6a45ced 42 #endif
dkato 0:37e1e6a45ced 43 #include "Project_Config.h"
dkato 0:37e1e6a45ced 44 #include "r_typedefs.h"
dkato 0:37e1e6a45ced 45 #include "mcu_interrupts_typedef.h"
dkato 0:37e1e6a45ced 46
dkato 0:37e1e6a45ced 47 #ifdef __cplusplus
dkato 0:37e1e6a45ced 48 extern "C" {
dkato 0:37e1e6a45ced 49 #endif /* __cplusplus */
dkato 0:37e1e6a45ced 50
dkato 0:37e1e6a45ced 51
dkato 0:37e1e6a45ced 52 /******************************************************************************
dkato 0:37e1e6a45ced 53 Typedef definitions
dkato 0:37e1e6a45ced 54 ******************************************************************************/
dkato 0:37e1e6a45ced 55
dkato 0:37e1e6a45ced 56 typedef struct st_r_ospl_async_t r_ospl_async_t;
dkato 0:37e1e6a45ced 57 typedef struct st_r_ospl_async_status_t r_ospl_async_status_t;
dkato 0:37e1e6a45ced 58 typedef struct st_r_ospl_flag32_t r_ospl_flag32_t;
dkato 0:37e1e6a45ced 59 typedef struct st_r_ospl_interrupt_t r_ospl_interrupt_t;
dkato 0:37e1e6a45ced 60 typedef struct st_r_ospl_irq_mask_t r_ospl_irq_mask_t;
dkato 0:37e1e6a45ced 61 typedef struct st_r_ospl_memory_spec_t r_ospl_memory_spec_t;
dkato 0:37e1e6a45ced 62 typedef struct st_r_ospl_ftimer_spec_t r_ospl_ftimer_spec_t;
dkato 0:37e1e6a45ced 63 typedef struct st_r_ospl_table_t r_ospl_table_t;
dkato 0:37e1e6a45ced 64 typedef struct st_r_ospl_i_lock_vtable_t r_ospl_i_lock_vtable_t;
dkato 0:37e1e6a45ced 65 typedef struct st_r_ospl_caller_t r_ospl_caller_t;
dkato 0:37e1e6a45ced 66
dkato 0:37e1e6a45ced 67
dkato 0:37e1e6a45ced 68 /**
dkato 0:37e1e6a45ced 69 * @typedef errnum_t
dkato 0:37e1e6a45ced 70 * @brief Error number
dkato 0:37e1e6a45ced 71 */
dkato 0:37e1e6a45ced 72 typedef int_fast32_t errnum_t;
dkato 0:37e1e6a45ced 73
dkato 0:37e1e6a45ced 74
dkato 0:37e1e6a45ced 75 /**
dkato 0:37e1e6a45ced 76 * @typedef bit_flags_fast32_t
dkato 0:37e1e6a45ced 77 * @brief Bit flags as "uint_fast32_t"
dkato 0:37e1e6a45ced 78 */
dkato 0:37e1e6a45ced 79 typedef uint_fast32_t bit_flags_fast32_t;
dkato 0:37e1e6a45ced 80
dkato 0:37e1e6a45ced 81
dkato 0:37e1e6a45ced 82 /**
dkato 0:37e1e6a45ced 83 * @typedef bit_flags32_t
dkato 0:37e1e6a45ced 84 * @brief Bit flags as "uint32_t"
dkato 0:37e1e6a45ced 85 */
dkato 0:37e1e6a45ced 86 typedef uint32_t bit_flags32_t;
dkato 0:37e1e6a45ced 87
dkato 0:37e1e6a45ced 88
dkato 0:37e1e6a45ced 89 /**
dkato 0:37e1e6a45ced 90 * @typedef bit_flags16_t
dkato 0:37e1e6a45ced 91 * @brief Bit flags as "uint16_t"
dkato 0:37e1e6a45ced 92 */
dkato 0:37e1e6a45ced 93 typedef uint16_t bit_flags16_t;
dkato 0:37e1e6a45ced 94
dkato 0:37e1e6a45ced 95
dkato 0:37e1e6a45ced 96 /**
dkato 0:37e1e6a45ced 97 * @typedef bit_flags8_t
dkato 0:37e1e6a45ced 98 * @brief Bit flags as "uint8_t"
dkato 0:37e1e6a45ced 99 */
dkato 0:37e1e6a45ced 100 typedef uint8_t bit_flags8_t;
dkato 0:37e1e6a45ced 101
dkato 0:37e1e6a45ced 102
dkato 0:37e1e6a45ced 103 /**
dkato 0:37e1e6a45ced 104 * @typedef byte_t
dkato 0:37e1e6a45ced 105 * @brief Byte type
dkato 0:37e1e6a45ced 106 */
dkato 0:37e1e6a45ced 107 typedef uint8_t byte_t;
dkato 0:37e1e6a45ced 108
dkato 0:37e1e6a45ced 109
1050186 3:9f857750e4e9 110 /**
1050186 3:9f857750e4e9 111 * @typedef ssize_t
1050186 3:9f857750e4e9 112 * @brief Signed size type. This is a POSIX specification.
1050186 3:9f857750e4e9 113 */
1050186 3:9f857750e4e9 114 #if ! defined( __GNUC__ ) || defined( __CC_ARM )
1050186 3:9f857750e4e9 115 typedef int ssize_t;
1050186 3:9f857750e4e9 116 #endif
1050186 3:9f857750e4e9 117
1050186 3:9f857750e4e9 118
dkato 0:37e1e6a45ced 119 /***********************************************************************
dkato 0:37e1e6a45ced 120 * Section: Global
dkato 0:37e1e6a45ced 121 ************************************************************************/
dkato 0:37e1e6a45ced 122 /* Start of a part of CMSIS : Copy from cmsys_os.h */
dkato 0:37e1e6a45ced 123 /* This is for not calling CMSIS function */
dkato 0:37e1e6a45ced 124
dkato 0:37e1e6a45ced 125
dkato 0:37e1e6a45ced 126 /**
dkato 0:37e1e6a45ced 127 * @typedef osMailQId
dkato 0:37e1e6a45ced 128 * @brief osMailQId
dkato 0:37e1e6a45ced 129 */
dkato 0:37e1e6a45ced 130 #ifdef IS_CMSIS_USED
dkato 0:37e1e6a45ced 131 typedef struct os_mailQ_cb *osMailQId;
dkato 0:37e1e6a45ced 132 #endif
dkato 0:37e1e6a45ced 133
dkato 0:37e1e6a45ced 134
dkato 0:37e1e6a45ced 135 /**
dkato 0:37e1e6a45ced 136 * @struct r_ospl_rtx_osMailQDef_t
dkato 0:37e1e6a45ced 137 * @brief RTX:osMailQDef_t
dkato 0:37e1e6a45ced 138 */
dkato 0:37e1e6a45ced 139 #ifdef IS_CMSIS_USED
dkato 0:37e1e6a45ced 140 typedef struct r_ospl_rtx_os_mailQ_def {
dkato 0:37e1e6a45ced 141 uint32_t queue_sz; ///< number of elements in the queue
dkato 0:37e1e6a45ced 142 uint32_t item_sz; ///< size of an item
dkato 0:37e1e6a45ced 143 void *pool; ///< memory array for mail
dkato 0:37e1e6a45ced 144 } r_ospl_rtx_osMailQDef_t;
dkato 0:37e1e6a45ced 145 #endif
dkato 0:37e1e6a45ced 146
dkato 0:37e1e6a45ced 147
dkato 0:37e1e6a45ced 148 /* Section: Global */
dkato 0:37e1e6a45ced 149 /**
dkato 0:37e1e6a45ced 150 * @def r_ospl_rtx_osMailQDef
dkato 0:37e1e6a45ced 151 * @brief RTX:osMailQDef
dkato 0:37e1e6a45ced 152 * @par Parameters
dkato 0:37e1e6a45ced 153 * None
dkato 0:37e1e6a45ced 154 * @return None.
dkato 0:37e1e6a45ced 155 */
dkato 0:37e1e6a45ced 156 #ifdef IS_CMSIS_USED
dkato 0:37e1e6a45ced 157 #if defined (osObjectsExternal) // object is external
dkato 0:37e1e6a45ced 158 #define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
dkato 0:37e1e6a45ced 159 extern const osMailQDef_t os_mailQ_def_##name
dkato 0:37e1e6a45ced 160 #else // define the object
dkato 0:37e1e6a45ced 161 #define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
dkato 0:37e1e6a45ced 162 uint32_t os_mailQ_q_##name[4+(queue_sz)] = { 0 }; \
dkato 0:37e1e6a45ced 163 uint32_t os_mailQ_m_##name[3+((sizeof(type)+3)/4)*(queue_sz)]; \
dkato 0:37e1e6a45ced 164 void * os_mailQ_p_##name[2] = { (os_mailQ_q_##name), os_mailQ_m_##name }; \
dkato 0:37e1e6a45ced 165 const r_ospl_rtx_osMailQDef_t os_mailQ_def_##name = \
dkato 0:37e1e6a45ced 166 { (queue_sz), sizeof(type), (os_mailQ_p_##name) }
dkato 0:37e1e6a45ced 167 #endif
dkato 0:37e1e6a45ced 168 #endif
dkato 0:37e1e6a45ced 169
dkato 0:37e1e6a45ced 170
dkato 0:37e1e6a45ced 171 /**
dkato 0:37e1e6a45ced 172 * @def osMailQ
dkato 0:37e1e6a45ced 173 * @brief osMailQ
dkato 0:37e1e6a45ced 174 * @par Parameters
dkato 0:37e1e6a45ced 175 * None
dkato 0:37e1e6a45ced 176 * @return None.
dkato 0:37e1e6a45ced 177 */
dkato 0:37e1e6a45ced 178 #ifdef IS_CMSIS_USED
dkato 0:37e1e6a45ced 179 #define osMailQ(name) \
dkato 0:37e1e6a45ced 180 &os_mailQ_def_##name
dkato 0:37e1e6a45ced 181 #endif
dkato 0:37e1e6a45ced 182
dkato 0:37e1e6a45ced 183
dkato 0:37e1e6a45ced 184 /***********************************************************************
dkato 0:37e1e6a45ced 185 * Section: Global
dkato 0:37e1e6a45ced 186 ************************************************************************/
dkato 0:37e1e6a45ced 187 /* End of a part of CMSIS */
dkato 0:37e1e6a45ced 188
dkato 0:37e1e6a45ced 189
dkato 0:37e1e6a45ced 190 /**
dkato 0:37e1e6a45ced 191 * @struct r_ospl_thread_id_t
dkato 0:37e1e6a45ced 192 * @brief Pointer to a thread
dkato 0:37e1e6a45ced 193 */
dkato 0:37e1e6a45ced 194 #ifdef IS_CMSIS_USED
dkato 0:37e1e6a45ced 195 typedef void * /*<r_ospl_thread_def_t*>*/ r_ospl_thread_id_t;
dkato 0:37e1e6a45ced 196 #define R_OSPL_THREAD_INTERRUPT ((void*) 0 )
dkato 0:37e1e6a45ced 197 #endif
dkato 0:37e1e6a45ced 198
dkato 0:37e1e6a45ced 199
dkato 0:37e1e6a45ced 200 /* Section: Global */
dkato 0:37e1e6a45ced 201 /**
dkato 0:37e1e6a45ced 202 * @brief The function type of interrupt callback
dkato 0:37e1e6a45ced 203 *
dkato 0:37e1e6a45ced 204 * @param InterruptSource Source of interrupt
dkato 0:37e1e6a45ced 205 * @param Caller Driver's internal parameters about interrupt operations
dkato 0:37e1e6a45ced 206 * @return Error code. If there is no error, the return value is 0. The value set to "r_ospl_async_t::ReturnValue"
dkato 0:37e1e6a45ced 207 *
dkato 0:37e1e6a45ced 208 * @par Description
dkato 0:37e1e6a45ced 209 * This is type of the interrupt callback function running in the
dkato 0:37e1e6a45ced 210 * interrupt context and called from the interrupt handler.
dkato 0:37e1e6a45ced 211 *
dkato 0:37e1e6a45ced 212 * It is possible to replace to application defined interrupt callback function
dkato 0:37e1e6a45ced 213 * by setting to "r_ospl_async_t::InterruptCallback". But it is usually not
dkato 0:37e1e6a45ced 214 * necessary to replace.
dkato 0:37e1e6a45ced 215 *
dkato 0:37e1e6a45ced 216 * As interrupt callback function, the default interrupt callback function
dkato 0:37e1e6a45ced 217 * provided from the driver is used. It is unusual to use application defined
dkato 0:37e1e6a45ced 218 * interrupt callback function.
dkato 0:37e1e6a45ced 219 * Write the response code of the interrupt (event driven code) next to the
dkato 0:37e1e6a45ced 220 * code calling @ref R_OSPL_EVENT_Wait function
dkato 0:37e1e6a45ced 221 *
dkato 0:37e1e6a45ced 222 * Whether the asynchronous operation was ended is possible to know whether
dkato 0:37e1e6a45ced 223 * the variable of "r_ospl_async_state_t" type referred from
dkato 0:37e1e6a45ced 224 * @ref R_DRIVER_GetAsyncStatus function is set to @ref R_OSPL_RUNNABLE value.
dkato 0:37e1e6a45ced 225 *
dkato 0:37e1e6a45ced 226 * It is not necessary to write the code of interrupt return (IRET) in
dkato 0:37e1e6a45ced 227 * the interrupt callback function. The interrupt handlers calling interrupt
dkato 0:37e1e6a45ced 228 * callback function calls IRET, if necessary.
dkato 0:37e1e6a45ced 229 *
dkato 0:37e1e6a45ced 230 * It is not possible to divide interrupt callback functions by the kind of
dkato 0:37e1e6a45ced 231 * interrupt. Alternatively, it is possible to write operations in interrupt
dkato 0:37e1e6a45ced 232 * handlers calling interrupt callback function in porting layer under the driver.
dkato 0:37e1e6a45ced 233 * There are interrupt handlers by each interrupt numbers.
dkato 0:37e1e6a45ced 234 *
dkato 0:37e1e6a45ced 235 * It is possible to signal any event from application defined interrupt
dkato 0:37e1e6a45ced 236 * @par callback function. But it is necessary to do following operations
dkato 0:37e1e6a45ced 237 */
dkato 0:37e1e6a45ced 238 typedef errnum_t (* r_ospl_callback_t )( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller );
dkato 0:37e1e6a45ced 239
dkato 0:37e1e6a45ced 240
dkato 0:37e1e6a45ced 241 /**
dkato 0:37e1e6a45ced 242 * @enum r_ospl_async_state_t
dkato 0:37e1e6a45ced 243 * @brief Asynchronous State
dkato 0:37e1e6a45ced 244 *
dkato 0:37e1e6a45ced 245 * - R_OSPL_UNINITIALIZED - 0
dkato 0:37e1e6a45ced 246 * - R_OSPL_RUNNABLE - 1, Runnable or Waitable
dkato 0:37e1e6a45ced 247 * - R_OSPL_RUNNING - 2, Running or Waiting
dkato 0:37e1e6a45ced 248 * - R_OSPL_INTERRUPTING - 3
dkato 0:37e1e6a45ced 249 * - R_OSPL_INTERRUPTED - 4
dkato 0:37e1e6a45ced 250 */
dkato 0:37e1e6a45ced 251 typedef enum {
dkato 0:37e1e6a45ced 252 R_OSPL_UNINITIALIZED = 0,
dkato 0:37e1e6a45ced 253 R_OSPL_RUNNABLE,
dkato 0:37e1e6a45ced 254 R_OSPL_RUNNING,
dkato 0:37e1e6a45ced 255 R_OSPL_INTERRUPTING,
dkato 0:37e1e6a45ced 256 R_OSPL_INTERRUPTED
dkato 0:37e1e6a45ced 257 } r_ospl_async_state_t;
dkato 0:37e1e6a45ced 258
dkato 0:37e1e6a45ced 259
dkato 0:37e1e6a45ced 260 /**
dkato 0:37e1e6a45ced 261 * @enum r_ospl_async_type_t
dkato 0:37e1e6a45ced 262 * @brief Asynchronous State
dkato 0:37e1e6a45ced 263 *
dkato 0:37e1e6a45ced 264 * - R_OSPL_ASYNC_TYPE_NORMAL - 1
dkato 0:37e1e6a45ced 265 * - R_OSPL_ASYNC_TYPE_FINALIZE - 2, Asynchronous finalizing
dkato 0:37e1e6a45ced 266 */
dkato 0:37e1e6a45ced 267 typedef enum {
dkato 0:37e1e6a45ced 268 R_OSPL_ASYNC_TYPE_NORMAL = 1,
dkato 0:37e1e6a45ced 269 R_OSPL_ASYNC_TYPE_FINALIZE = 2
dkato 0:37e1e6a45ced 270 } r_ospl_async_type_t;
dkato 0:37e1e6a45ced 271
dkato 0:37e1e6a45ced 272
dkato 0:37e1e6a45ced 273 /**
dkato 0:37e1e6a45ced 274 * @struct r_ospl_block_t
dkato 0:37e1e6a45ced 275 * @brief Block in queue
dkato 0:37e1e6a45ced 276 *
dkato 0:37e1e6a45ced 277 * @par Description
dkato 0:37e1e6a45ced 278 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 279 */
dkato 0:37e1e6a45ced 280 typedef struct st_r_ospl_block_t r_ospl_block_t;
dkato 0:37e1e6a45ced 281 struct st_r_ospl_block_t {
dkato 0:37e1e6a45ced 282 r_ospl_block_t *Next;
dkato 0:37e1e6a45ced 283 };
dkato 0:37e1e6a45ced 284
dkato 0:37e1e6a45ced 285
dkato 0:37e1e6a45ced 286 /**
dkato 0:37e1e6a45ced 287 * @struct r_ospl_queue_status_t
dkato 0:37e1e6a45ced 288 * @brief r_ospl_queue_status_t
dkato 0:37e1e6a45ced 289 */
dkato 0:37e1e6a45ced 290 typedef struct st_r_ospl_queue_status_t {
dkato 0:37e1e6a45ced 291
dkato 0:37e1e6a45ced 292 /** UsedCount */
dkato 0:37e1e6a45ced 293 int_fast32_t UsedCount;
dkato 0:37e1e6a45ced 294
dkato 0:37e1e6a45ced 295 /** MaxCount */
dkato 0:37e1e6a45ced 296 int_fast32_t MaxCount;
dkato 0:37e1e6a45ced 297 } r_ospl_queue_status_t;
dkato 0:37e1e6a45ced 298
dkato 0:37e1e6a45ced 299
dkato 0:37e1e6a45ced 300 /**
dkato 0:37e1e6a45ced 301 * @struct r_ospl_queue_def_t
dkato 0:37e1e6a45ced 302 * @brief r_ospl_queue_def_t
dkato 0:37e1e6a45ced 303 * @par Description
dkato 0:37e1e6a45ced 304 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 305 */
dkato 0:37e1e6a45ced 306 typedef struct st_r_ospl_queue_def_t {
dkato 0:37e1e6a45ced 307 osMailQId MailQId;
dkato 0:37e1e6a45ced 308 r_ospl_queue_status_t PublicStatus;
dkato 0:37e1e6a45ced 309 const r_ospl_rtx_osMailQDef_t *MailQDef;
dkato 0:37e1e6a45ced 310 } r_ospl_queue_def_t;
dkato 0:37e1e6a45ced 311
dkato 0:37e1e6a45ced 312
dkato 0:37e1e6a45ced 313 /**
dkato 0:37e1e6a45ced 314 * @struct r_ospl_queue_t
dkato 0:37e1e6a45ced 315 * @brief r_ospl_queue_t
dkato 0:37e1e6a45ced 316 * @par Description
dkato 0:37e1e6a45ced 317 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 318 */
dkato 0:37e1e6a45ced 319 typedef r_ospl_queue_def_t r_ospl_queue_t;
dkato 0:37e1e6a45ced 320
dkato 0:37e1e6a45ced 321
dkato 0:37e1e6a45ced 322 /* Section: Global */
dkato 0:37e1e6a45ced 323 /**
dkato 0:37e1e6a45ced 324 * @def R_OSPL_QUEUE_DEF
dkato 0:37e1e6a45ced 325 * @brief Defines attributes of queue and work area.
dkato 0:37e1e6a45ced 326 * @param Name Thread name. Do not bracket by ""
dkato 0:37e1e6a45ced 327 * @param MaxCount Max count of elements in the queue
dkato 0:37e1e6a45ced 328 * @param Type Output
dkato 0:37e1e6a45ced 329 * @return None.
dkato 0:37e1e6a45ced 330 *
dkato 0:37e1e6a45ced 331 * @par Description
dkato 0:37e1e6a45ced 332 * It is not possible to use this macro in the library.
dkato 0:37e1e6a45ced 333 * If implement of OSPL was changed, the library must be recompiled.
dkato 0:37e1e6a45ced 334 */
dkato 0:37e1e6a45ced 335 #define R_OSPL_QUEUE_DEF( Name, MaxCount, Type ) \
dkato 0:37e1e6a45ced 336 r_ospl_rtx_osMailQDef( Name, MaxCount, Type ); \
dkato 0:37e1e6a45ced 337 r_ospl_queue_def_t Name##_OSPL_DEF = { NULL, 0, (MaxCount), osMailQ( Name ) }
dkato 0:37e1e6a45ced 338
dkato 0:37e1e6a45ced 339
dkato 0:37e1e6a45ced 340 /**
dkato 0:37e1e6a45ced 341 * @def R_OSPL_QUEUE
dkato 0:37e1e6a45ced 342 * @brief Returns initial attributes of queue and work area.
dkato 0:37e1e6a45ced 343 * @param Name Queue's name. Do not bracket by ""
dkato 0:37e1e6a45ced 344 * @return None.
dkato 0:37e1e6a45ced 345 *
dkato 0:37e1e6a45ced 346 * @par Description
dkato 0:37e1e6a45ced 347 * It is not possible to use this macro in the library.
dkato 0:37e1e6a45ced 348 * If implement of OSPL was changed, the library must be recompiled.
dkato 0:37e1e6a45ced 349 */
dkato 0:37e1e6a45ced 350 #define R_OSPL_QUEUE( Name ) (&Name##_OSPL_DEF)
dkato 0:37e1e6a45ced 351
dkato 0:37e1e6a45ced 352
dkato 0:37e1e6a45ced 353 /**
dkato 0:37e1e6a45ced 354 * @typedef r_ospl_flush_t
dkato 0:37e1e6a45ced 355 * @brief r_ospl_flush_t
dkato 0:37e1e6a45ced 356 */
dkato 0:37e1e6a45ced 357 typedef bit_flags_fast32_t r_ospl_flush_t;
dkato 0:37e1e6a45ced 358 #define /*<uint_fast32_t>*/ R_OSPL_FLUSH_INVALIDATE 0u
dkato 0:37e1e6a45ced 359 #define /*<uint_fast32_t>*/ R_OSPL_FLUSH_WRITEBACK_INVALIDATE 2u
dkato 0:37e1e6a45ced 360 #define /*<uint_fast32_t>*/ R_OSPL_FLUSH_WRITEBACK_INVALIDATE_2ND 8u
dkato 0:37e1e6a45ced 361
dkato 0:37e1e6a45ced 362
dkato 0:37e1e6a45ced 363 /**
dkato 0:37e1e6a45ced 364 * @struct r_ospl_flag32_t
dkato 0:37e1e6a45ced 365 * @brief This is the type of flags having 32bit
dkato 0:37e1e6a45ced 366 *
dkato 0:37e1e6a45ced 367 * @par Description
dkato 0:37e1e6a45ced 368 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 369 */
dkato 0:37e1e6a45ced 370 struct st_r_ospl_flag32_t {
dkato 0:37e1e6a45ced 371 volatile uint32_t Flags;
dkato 0:37e1e6a45ced 372 };
dkato 0:37e1e6a45ced 373
dkato 0:37e1e6a45ced 374
dkato 0:37e1e6a45ced 375 /**
dkato 0:37e1e6a45ced 376 * @struct r_ospl_interrupt_t
dkato 0:37e1e6a45ced 377 * @brief Structure related to interrupt source. e.g. interrupt number
dkato 0:37e1e6a45ced 378 */
dkato 0:37e1e6a45ced 379 struct st_r_ospl_interrupt_t {
dkato 0:37e1e6a45ced 380
dkato 0:37e1e6a45ced 381 /** <bsp_int_src_t> */
dkato 0:37e1e6a45ced 382 bsp_int_src_t IRQ_Num;
dkato 0:37e1e6a45ced 383
dkato 0:37e1e6a45ced 384 /** ChannelNum */
dkato 0:37e1e6a45ced 385 int_fast32_t ChannelNum;
dkato 0:37e1e6a45ced 386
dkato 0:37e1e6a45ced 387 /** Type */
dkato 0:37e1e6a45ced 388 int_fast32_t Type;
dkato 0:37e1e6a45ced 389
dkato 0:37e1e6a45ced 390 /** Delegate */
dkato 0:37e1e6a45ced 391 void *Delegate;
dkato 0:37e1e6a45ced 392 };
dkato 0:37e1e6a45ced 393
dkato 0:37e1e6a45ced 394
dkato 0:37e1e6a45ced 395 /**
dkato 0:37e1e6a45ced 396 * @struct r_ospl_async_status_t
dkato 0:37e1e6a45ced 397 * @brief Structure of driver's status and interrupt status defined by OSPL
dkato 0:37e1e6a45ced 398 */
dkato 0:37e1e6a45ced 399 struct st_r_ospl_async_status_t {
dkato 0:37e1e6a45ced 400
dkato 0:37e1e6a45ced 401 /** <r_ospl_async_state_t> */
dkato 0:37e1e6a45ced 402 volatile r_ospl_async_state_t State;
dkato 0:37e1e6a45ced 403
dkato 0:37e1e6a45ced 404 /** IsEnabledInterrupt */
dkato 0:37e1e6a45ced 405 volatile bool_t IsEnabledInterrupt;
dkato 0:37e1e6a45ced 406
dkato 0:37e1e6a45ced 407 /** InterruptEnables */
dkato 0:37e1e6a45ced 408 volatile r_ospl_flag32_t InterruptEnables;
dkato 0:37e1e6a45ced 409
dkato 0:37e1e6a45ced 410 /** InterruptFlags */
dkato 0:37e1e6a45ced 411 volatile r_ospl_flag32_t InterruptFlags;
dkato 0:37e1e6a45ced 412
dkato 0:37e1e6a45ced 413 /** r_ospl_flag32_t < <r_ospl_cancel_flag_t> > */
dkato 0:37e1e6a45ced 414 volatile r_ospl_flag32_t CancelFlags; /*<r_ospl_cancel_flag_t>*/
dkato 0:37e1e6a45ced 415 #if R_OSPL_IS_PREEMPTION
dkato 0:37e1e6a45ced 416 union {
dkato 0:37e1e6a45ced 417
dkato 0:37e1e6a45ced 418 /** LockOwner */
dkato 0:37e1e6a45ced 419 volatile r_ospl_thread_id_t Thread;
dkato 0:37e1e6a45ced 420
dkato 0:37e1e6a45ced 421 /** LockOwner */
dkato 0:37e1e6a45ced 422 volatile void *Context;
dkato 0:37e1e6a45ced 423 } LockOwner;
dkato 0:37e1e6a45ced 424 #endif
dkato 0:37e1e6a45ced 425 };
dkato 0:37e1e6a45ced 426
dkato 0:37e1e6a45ced 427
dkato 0:37e1e6a45ced 428 /**
dkato 0:37e1e6a45ced 429 * @struct r_ospl_async_t
dkato 0:37e1e6a45ced 430 * @brief Setting of notifications
dkato 0:37e1e6a45ced 431 */
dkato 0:37e1e6a45ced 432 struct st_r_ospl_async_t {
dkato 0:37e1e6a45ced 433
dkato 0:37e1e6a45ced 434 /** Flags */
dkato 0:37e1e6a45ced 435 bit_flags_fast32_t Flags;
dkato 0:37e1e6a45ced 436
dkato 0:37e1e6a45ced 437 /** Delegate */
dkato 0:37e1e6a45ced 438 void *Delegate;
dkato 0:37e1e6a45ced 439
dkato 0:37e1e6a45ced 440 /** A_Thread */
dkato 0:37e1e6a45ced 441 r_ospl_thread_id_t A_Thread;
dkato 0:37e1e6a45ced 442
dkato 0:37e1e6a45ced 443 /** A_EventValue */
dkato 0:37e1e6a45ced 444 uint32_t A_EventValue; /* QAC 4130 */
dkato 0:37e1e6a45ced 445
dkato 0:37e1e6a45ced 446 /** I_Thread */
dkato 0:37e1e6a45ced 447 r_ospl_thread_id_t I_Thread;
dkato 0:37e1e6a45ced 448
dkato 0:37e1e6a45ced 449 /** I_EventValue */
dkato 0:37e1e6a45ced 450 uint32_t I_EventValue; /* QAC 4130 */
dkato 0:37e1e6a45ced 451
dkato 0:37e1e6a45ced 452 /** InterruptCallback */
dkato 0:37e1e6a45ced 453 r_ospl_callback_t InterruptCallback;
dkato 0:37e1e6a45ced 454
dkato 0:37e1e6a45ced 455 /** ReturnValue */
dkato 0:37e1e6a45ced 456 errnum_t ReturnValue;
dkato 0:37e1e6a45ced 457 };
dkato 0:37e1e6a45ced 458
dkato 0:37e1e6a45ced 459 enum {
dkato 0:37e1e6a45ced 460 R_F_OSPL_A_Thread = 0x0001,
dkato 0:37e1e6a45ced 461 R_F_OSPL_A_EventValue = 0x0002,
dkato 0:37e1e6a45ced 462 R_F_OSPL_I_Thread = 0x0004,
dkato 0:37e1e6a45ced 463 R_F_OSPL_I_EventValue = 0x0008,
dkato 0:37e1e6a45ced 464 R_F_OSPL_InterruptCallback = 0x0010,
dkato 0:37e1e6a45ced 465 R_F_OSPL_Delegate = 0x0080
dkato 0:37e1e6a45ced 466 };
dkato 0:37e1e6a45ced 467
dkato 0:37e1e6a45ced 468
dkato 0:37e1e6a45ced 469 /* Section: Global */
dkato 0:37e1e6a45ced 470 /***********************************************************************
dkato 0:37e1e6a45ced 471 * Macros: r_ospl_internal_sentinel
dkato 0:37e1e6a45ced 472 *
dkato 0:37e1e6a45ced 473 * : R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK - 0x7FFFFF40
dkato 0:37e1e6a45ced 474 * : R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE - 0x4A5C0000
dkato 0:37e1e6a45ced 475 ************************************************************************/
dkato 0:37e1e6a45ced 476 #ifndef R_OSPL_NDEBUG
dkato 0:37e1e6a45ced 477 enum {
dkato 0:37e1e6a45ced 478 R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK = 0x7FFFFF40,
dkato 0:37e1e6a45ced 479 R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE = 0x4A5C0000
dkato 0:37e1e6a45ced 480 };
dkato 0:37e1e6a45ced 481 #endif
dkato 0:37e1e6a45ced 482
dkato 0:37e1e6a45ced 483
dkato 0:37e1e6a45ced 484 /**
dkato 0:37e1e6a45ced 485 * @struct r_ospl_caller_t
dkato 0:37e1e6a45ced 486 * @brief Context of interrupt callback function caller
dkato 0:37e1e6a45ced 487 *
dkato 0:37e1e6a45ced 488 * @par Description
dkato 0:37e1e6a45ced 489 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 490 */
dkato 0:37e1e6a45ced 491 struct st_r_ospl_caller_t {
dkato 0:37e1e6a45ced 492 r_ospl_async_t *Async;
dkato 0:37e1e6a45ced 493 volatile int_fast32_t *PointerToState;
dkato 0:37e1e6a45ced 494 int_fast32_t StateValueOfOnInterrupting;
dkato 0:37e1e6a45ced 495 void *I_Lock;
dkato 0:37e1e6a45ced 496 const r_ospl_i_lock_vtable_t *I_LockVTable;
dkato 0:37e1e6a45ced 497 };
dkato 0:37e1e6a45ced 498
dkato 0:37e1e6a45ced 499
dkato 0:37e1e6a45ced 500 /***********************************************************************
dkato 0:37e1e6a45ced 501 * Class: r_ospl_i_lock_vtable_t
dkato 0:37e1e6a45ced 502 * I-Lock V-Table
dkato 0:37e1e6a45ced 503 ************************************************************************/
dkato 0:37e1e6a45ced 504 typedef bool_t (* r_ospl_i_lock_lock_func_t )( void *const self_ );
dkato 0:37e1e6a45ced 505 typedef void (* r_ospl_i_lock_unlock_func_t )( void *const self_ );
dkato 0:37e1e6a45ced 506 typedef void (* r_ospl_i_lock_get_rf_func_t )( void *const self_ ); /* rf = RequestFinalize */
dkato 0:37e1e6a45ced 507 typedef bool_t (* r_ospl_i_lock_get_rcn_func_t )( const void *const self_ ); /* rcn = RootChannelNum */
dkato 0:37e1e6a45ced 508
dkato 0:37e1e6a45ced 509 struct st_r_ospl_i_lock_vtable_t {
dkato 0:37e1e6a45ced 510
dkato 0:37e1e6a45ced 511 /**
dkato 0:37e1e6a45ced 512 * @brief Lock
dkato 0:37e1e6a45ced 513 *
dkato 0:37e1e6a45ced 514 * @par Parameters
dkato 0:37e1e6a45ced 515 * None
dkato 0:37e1e6a45ced 516 * @return None.
dkato 0:37e1e6a45ced 517 */
dkato 0:37e1e6a45ced 518 bool_t (* Lock )( void *const self_ );
dkato 0:37e1e6a45ced 519
dkato 0:37e1e6a45ced 520 /**
dkato 0:37e1e6a45ced 521 * @brief Unlock
dkato 0:37e1e6a45ced 522 *
dkato 0:37e1e6a45ced 523 * @par Parameters
dkato 0:37e1e6a45ced 524 * None
dkato 0:37e1e6a45ced 525 * @return None.
dkato 0:37e1e6a45ced 526 */
dkato 0:37e1e6a45ced 527 void (* Unlock )( void *const self_ );
dkato 0:37e1e6a45ced 528
dkato 0:37e1e6a45ced 529 /**
dkato 0:37e1e6a45ced 530 * @brief RequestFinalize
dkato 0:37e1e6a45ced 531 *
dkato 0:37e1e6a45ced 532 * @par Parameters
dkato 0:37e1e6a45ced 533 * None
dkato 0:37e1e6a45ced 534 * @return None.
dkato 0:37e1e6a45ced 535 */
dkato 0:37e1e6a45ced 536 void (* RequestFinalize )( void *const self_ );
dkato 0:37e1e6a45ced 537
dkato 0:37e1e6a45ced 538 /**
dkato 0:37e1e6a45ced 539 * @brief GetRootChannelNum
dkato 0:37e1e6a45ced 540 *
dkato 0:37e1e6a45ced 541 * @par Parameters
dkato 0:37e1e6a45ced 542 * None
dkato 0:37e1e6a45ced 543 * @return None.
dkato 0:37e1e6a45ced 544 */
dkato 0:37e1e6a45ced 545 int_fast32_t (* GetRootChannelNum )( const void *const self_ );
dkato 0:37e1e6a45ced 546 };
dkato 0:37e1e6a45ced 547
dkato 0:37e1e6a45ced 548
dkato 0:37e1e6a45ced 549 /**
dkato 0:37e1e6a45ced 550 * @struct r_ospl_memory_spec_t
dkato 0:37e1e6a45ced 551 * @brief Memory specification
dkato 0:37e1e6a45ced 552 */
dkato 0:37e1e6a45ced 553 struct st_r_ospl_memory_spec_t {
dkato 0:37e1e6a45ced 554
dkato 0:37e1e6a45ced 555 /** (byte) */
dkato 0:37e1e6a45ced 556 uint_fast32_t CacheLineSize;
dkato 0:37e1e6a45ced 557 };
dkato 0:37e1e6a45ced 558
dkato 0:37e1e6a45ced 559
dkato 0:37e1e6a45ced 560 /**
dkato 0:37e1e6a45ced 561 * @struct r_ospl_ftimer_spec_t
dkato 0:37e1e6a45ced 562 * @brief Free run timer specification
dkato 0:37e1e6a45ced 563 */
dkato 0:37e1e6a45ced 564 struct st_r_ospl_ftimer_spec_t {
dkato 0:37e1e6a45ced 565
dkato 0:37e1e6a45ced 566 /** msec_Numerator */
dkato 0:37e1e6a45ced 567 uint32_t msec_Numerator;
dkato 0:37e1e6a45ced 568
dkato 0:37e1e6a45ced 569 /** msec_Denominator */
dkato 0:37e1e6a45ced 570 uint32_t msec_Denominator;
dkato 0:37e1e6a45ced 571
dkato 0:37e1e6a45ced 572 /** MaxCount */
dkato 0:37e1e6a45ced 573 uint32_t MaxCount;
dkato 0:37e1e6a45ced 574
dkato 0:37e1e6a45ced 575 /** ExtensionOfCount */
dkato 0:37e1e6a45ced 576 uint32_t ExtensionOfCount;
dkato 0:37e1e6a45ced 577 };
dkato 0:37e1e6a45ced 578
dkato 0:37e1e6a45ced 579
dkato 0:37e1e6a45ced 580 /**
dkato 0:37e1e6a45ced 581 * @struct r_ospl_table_t
dkato 0:37e1e6a45ced 582 * @brief Index table
dkato 0:37e1e6a45ced 583 *
dkato 0:37e1e6a45ced 584 * @par Description
dkato 0:37e1e6a45ced 585 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 586 */
dkato 0:37e1e6a45ced 587 struct st_r_ospl_table_t {
dkato 0:37e1e6a45ced 588 void *Area;
dkato 0:37e1e6a45ced 589 int_fast32_t Count;
dkato 0:37e1e6a45ced 590 int_fast32_t MaxCount;
dkato 0:37e1e6a45ced 591 const void *KeyCache;
dkato 0:37e1e6a45ced 592 int_fast32_t IndexCache; /* Not SortedKeyIndex */
dkato 0:37e1e6a45ced 593 int16_t FirstFreeIndex;
dkato 0:37e1e6a45ced 594 #if R_OSPL_IS_PREEMPTION
dkato 0:37e1e6a45ced 595 bool_t Is_T_Lock;
dkato 0:37e1e6a45ced 596 #endif
dkato 0:37e1e6a45ced 597 };
dkato 0:37e1e6a45ced 598
dkato 0:37e1e6a45ced 599
dkato 0:37e1e6a45ced 600 /* Section: Global */
dkato 0:37e1e6a45ced 601 /**
dkato 0:37e1e6a45ced 602 * @enum r_ospl_if_not_t
dkato 0:37e1e6a45ced 603 * @brief Operation if not exists
dkato 0:37e1e6a45ced 604 *
dkato 0:37e1e6a45ced 605 * - R_OSPL_ERROR_IF_NOT - 0
dkato 0:37e1e6a45ced 606 * - R_OSPL_ALLOCATE_IF_NOT - 1
dkato 0:37e1e6a45ced 607 * - R_OSPL_DO_NOTHING_IF_NOT - 2
dkato 0:37e1e6a45ced 608 */
dkato 0:37e1e6a45ced 609 typedef enum {
dkato 0:37e1e6a45ced 610 R_OSPL_ERROR_IF_NOT = 0,
dkato 0:37e1e6a45ced 611 R_OSPL_ALLOCATE_IF_NOT = 1,
dkato 0:37e1e6a45ced 612 R_OSPL_DO_NOTHING_IF_NOT = 2
dkato 0:37e1e6a45ced 613 } r_ospl_if_not_t;
dkato 0:37e1e6a45ced 614
dkato 0:37e1e6a45ced 615
dkato 0:37e1e6a45ced 616 /**
dkato 0:37e1e6a45ced 617 * @struct r_ospl_error_t
dkato 0:37e1e6a45ced 618 * @brief Error status of a thread
dkato 0:37e1e6a45ced 619 *
dkato 0:37e1e6a45ced 620 * @par Description
dkato 0:37e1e6a45ced 621 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 622 */
dkato 0:37e1e6a45ced 623 #if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
dkato 0:37e1e6a45ced 624 typedef struct st_r_ospl_error_t r_ospl_error_t;
dkato 0:37e1e6a45ced 625 struct st_r_ospl_error_t {
dkato 0:37e1e6a45ced 626 #if R_OSPL_ERROR_BREAK
dkato 0:37e1e6a45ced 627 bool_t IsError;
dkato 0:37e1e6a45ced 628 int_fast32_t ErrorID;
dkato 0:37e1e6a45ced 629 const char_t *FilePath;
dkato 0:37e1e6a45ced 630 int_fast32_t LineNum;
dkato 0:37e1e6a45ced 631 #if R_OSPL_IS_PREEMPTION
dkato 0:37e1e6a45ced 632 int_fast32_t ThreadLockedCount;
dkato 0:37e1e6a45ced 633 #endif
dkato 0:37e1e6a45ced 634 #endif
dkato 0:37e1e6a45ced 635 #if R_OSPL_TLS_ERROR_CODE
dkato 0:37e1e6a45ced 636 errnum_t ErrNum;
dkato 0:37e1e6a45ced 637 #endif
dkato 0:37e1e6a45ced 638 };
dkato 0:37e1e6a45ced 639 #endif
dkato 0:37e1e6a45ced 640
dkato 0:37e1e6a45ced 641
dkato 0:37e1e6a45ced 642 /**
dkato 0:37e1e6a45ced 643 * @struct r_ospl_global_error_t
dkato 0:37e1e6a45ced 644 * @brief Error status of global
dkato 0:37e1e6a45ced 645 *
dkato 0:37e1e6a45ced 646 * @par Description
dkato 0:37e1e6a45ced 647 * Member variables should not be accessed.
dkato 0:37e1e6a45ced 648 */
dkato 0:37e1e6a45ced 649 #if R_OSPL_ERROR_BREAK || R_OSPL_TLS_ERROR_CODE
dkato 0:37e1e6a45ced 650 typedef struct st_r_ospl_global_error_t r_ospl_global_error_t;
dkato 0:37e1e6a45ced 651 struct st_r_ospl_global_error_t {
dkato 0:37e1e6a45ced 652 r_ospl_table_t ThreadIndexTable;
dkato 0:37e1e6a45ced 653 r_ospl_error_t *ErrorArray;
dkato 0:37e1e6a45ced 654
dkato 0:37e1e6a45ced 655 #if R_OSPL_ERROR_BREAK
dkato 0:37e1e6a45ced 656 int_fast32_t RaisedGlobalErrorID;
dkato 0:37e1e6a45ced 657 int_fast32_t BreakGlobalErrorID;
dkato 0:37e1e6a45ced 658 #endif
dkato 0:37e1e6a45ced 659 };
dkato 0:37e1e6a45ced 660 #endif
dkato 0:37e1e6a45ced 661
dkato 0:37e1e6a45ced 662
dkato 0:37e1e6a45ced 663 /* Section: Global */
dkato 0:37e1e6a45ced 664 /**
dkato 0:37e1e6a45ced 665 * @enum r_ospl_axi_cache_attribute_t
dkato 0:37e1e6a45ced 666 * @brief Cache attribute on AXI bus.
dkato 0:37e1e6a45ced 667 *
dkato 0:37e1e6a45ced 668 * - R_OSPL_AXI_CACHE_ZERO - Not AXI
dkato 0:37e1e6a45ced 669 * - R_OSPL_AXI_STRONGLY - Strongly order access
dkato 0:37e1e6a45ced 670 * - R_OSPL_AXI_DEVICE - DEVICE
dkato 0:37e1e6a45ced 671 * - R_OSPL_AXI_UNCACHED - Normal access (Out of order) uncached
dkato 0:37e1e6a45ced 672 * - R_OSPL_AXI_WRITE_BACK_W - Write back, allocate on write
dkato 0:37e1e6a45ced 673 * - R_OSPL_AXI_WRITE_BACK - Write back, allocate on both read and write
dkato 0:37e1e6a45ced 674 */
dkato 0:37e1e6a45ced 675 typedef enum {
dkato 0:37e1e6a45ced 676 R_OSPL_AXI_CACHE_ZERO = 0,
dkato 0:37e1e6a45ced 677 R_OSPL_AXI_STRONGLY = 0,
dkato 0:37e1e6a45ced 678 R_OSPL_AXI_DEVICE = 1,
dkato 0:37e1e6a45ced 679 R_OSPL_AXI_UNCACHED = 3,
dkato 0:37e1e6a45ced 680 R_OSPL_AXI_WRITE_BACK_W = 11,
dkato 0:37e1e6a45ced 681 R_OSPL_AXI_WRITE_BACK = 15
dkato 0:37e1e6a45ced 682 } r_ospl_axi_cache_attribute_t;
dkato 0:37e1e6a45ced 683
dkato 0:37e1e6a45ced 684
dkato 0:37e1e6a45ced 685 /**
dkato 0:37e1e6a45ced 686 * @enum r_ospl_axi_protection_t
dkato 0:37e1e6a45ced 687 * @brief Protection on AXI bus.
dkato 0:37e1e6a45ced 688 *
dkato 0:37e1e6a45ced 689 * - R_OSPL_AXI_PROTECTION_ZERO - Not AXI
dkato 0:37e1e6a45ced 690 * - R_OSPL_AXI_SECURE - TrustZone secure acccess
dkato 0:37e1e6a45ced 691 * - R_OSPL_AXI_NON_SECURE - TrustZone non-secure acccess
dkato 0:37e1e6a45ced 692 */
dkato 0:37e1e6a45ced 693 typedef enum {
dkato 0:37e1e6a45ced 694 R_OSPL_AXI_PROTECTION_ZERO = 0,
dkato 0:37e1e6a45ced 695 R_OSPL_AXI_SECURE = 0,
dkato 0:37e1e6a45ced 696 R_OSPL_AXI_NON_SECURE = 2
dkato 0:37e1e6a45ced 697 } r_ospl_axi_protection_t;
dkato 0:37e1e6a45ced 698
dkato 0:37e1e6a45ced 699
dkato 0:37e1e6a45ced 700 /******************************************************************************
dkato 0:37e1e6a45ced 701 Macro definitions
dkato 0:37e1e6a45ced 702 ******************************************************************************/
dkato 0:37e1e6a45ced 703
dkato 0:37e1e6a45ced 704 /**
dkato 0:37e1e6a45ced 705 * @enum Event_Bit_Name
dkato 0:37e1e6a45ced 706 * @brief Event_Bit_Name
dkato 0:37e1e6a45ced 707 * - R_OSPL_ANY_FLAG - 0x0000
dkato 0:37e1e6a45ced 708 * - R_OSPL_A_FLAG - 0x0001
dkato 0:37e1e6a45ced 709 * - R_OSPL_I_FLAG - 0x0002
dkato 0:37e1e6a45ced 710 * - R_OSPL_FINAL_A_FLAG - 0x0004
dkato 0:37e1e6a45ced 711 */
dkato 0:37e1e6a45ced 712 enum {
dkato 0:37e1e6a45ced 713 R_OSPL_ANY_FLAG = 0x00000000,
dkato 0:37e1e6a45ced 714 R_OSPL_A_FLAG = 0x00000001,
dkato 0:37e1e6a45ced 715 R_OSPL_I_FLAG = 0x00000002,
dkato 0:37e1e6a45ced 716 R_OSPL_FINAL_A_FLAG = 0x00000004
dkato 0:37e1e6a45ced 717 };
dkato 0:37e1e6a45ced 718
dkato 0:37e1e6a45ced 719
dkato 0:37e1e6a45ced 720 /**
dkato 0:37e1e6a45ced 721 * @typedef r_ospl_cancel_flag_t
dkato 0:37e1e6a45ced 722 * @brief Bit flags of <r_ospl_cancel_bit_t>
dkato 0:37e1e6a45ced 723 */
dkato 0:37e1e6a45ced 724 typedef int_t r_ospl_cancel_flag_t;
dkato 0:37e1e6a45ced 725
dkato 0:37e1e6a45ced 726
dkato 0:37e1e6a45ced 727 /**
dkato 0:37e1e6a45ced 728 * @enum r_ospl_cancel_bit_t
dkato 0:37e1e6a45ced 729 * @brief r_ospl_cancel_bit_t
dkato 0:37e1e6a45ced 730 * - R_OSPL_CANNEL_REQUEST - 0x0001
dkato 0:37e1e6a45ced 731 * - R_OSPL_CANNELING - 0x0002
dkato 0:37e1e6a45ced 732 * - R_OSPL_CANNELED - 0x0004
dkato 0:37e1e6a45ced 733 * - R_OSPL_FINALIZE_REQUEST - 0x0010
dkato 0:37e1e6a45ced 734 * - R_OSPL_FINALIZING - 0x0020
dkato 0:37e1e6a45ced 735 * - R_OSPL_FINALIZED - 0x0040
dkato 0:37e1e6a45ced 736 */
dkato 0:37e1e6a45ced 737 enum {
dkato 0:37e1e6a45ced 738 R_OSPL_CANNEL_REQUEST = 0x00000001,
dkato 0:37e1e6a45ced 739 R_OSPL_CANNELING = 0x00000002,
dkato 0:37e1e6a45ced 740 R_OSPL_CANNELED = 0x00000004,
dkato 0:37e1e6a45ced 741 R_OSPL_FINALIZE_REQUEST = 0x00000010,
dkato 0:37e1e6a45ced 742 R_OSPL_FINALIZING = 0x00000020,
dkato 0:37e1e6a45ced 743 R_OSPL_FINALIZED = 0x00000040
dkato 0:37e1e6a45ced 744 };
dkato 0:37e1e6a45ced 745
dkato 0:37e1e6a45ced 746
dkato 0:37e1e6a45ced 747 /***********************************************************************
dkato 0:37e1e6a45ced 748 * Macros: OSPL_Others
dkato 0:37e1e6a45ced 749 *
dkato 0:37e1e6a45ced 750 * : R_OSPL_INFINITE - One of time out value
dkato 0:37e1e6a45ced 751 * : R_OSPL_FLAG32_ALL_BITS - R_OSPL_FLAG32_ALL_BITS
dkato 0:37e1e6a45ced 752 * : R_OSPL_EVENT_ALL_BITS - R_OSPL_EVENT_ALL_BITS
dkato 0:37e1e6a45ced 753 * : R_OSPL_TIMEOUT - Raised time out
dkato 0:37e1e6a45ced 754 * : R_OSPL_MAX_TIME_OUT - Max value of time out
dkato 0:37e1e6a45ced 755 * : R_OSPL_NO_INDEX - R_OSPL_NO_INDEX
dkato 0:37e1e6a45ced 756 * : R_OSPL_UNLOCKED_CHANNEL - R_OSPL_UNLOCKED_CHANNEL
dkato 0:37e1e6a45ced 757 ************************************************************************/
dkato 0:37e1e6a45ced 758 #define R_OSPL_INFINITE 0xFFFFFFFFu /* uint32_t */
dkato 0:37e1e6a45ced 759 #define R_OSPL_FLAG32_ALL_BITS 0xFFFFFFFFu /* uint32_t */
dkato 0:37e1e6a45ced 760 enum { R_OSPL_EVENT_ALL_BITS = 0x0000FFFF };
dkato 0:37e1e6a45ced 761 enum { R_OSPL_TIMEOUT = 0x40000000 };
dkato 0:37e1e6a45ced 762 enum { R_OSPL_MAX_TIME_OUT = 65533 };
dkato 0:37e1e6a45ced 763 enum { R_OSPL_NO_INDEX = -1 };
dkato 0:37e1e6a45ced 764 enum { R_OSPL_UNLOCKED_CHANNEL = 0x00000FEE };
dkato 0:37e1e6a45ced 765
dkato 0:37e1e6a45ced 766
dkato 0:37e1e6a45ced 767 /**
dkato 0:37e1e6a45ced 768 * @def R_OSPL_TABLE_SIZE
dkato 0:37e1e6a45ced 769 * @brief Calculates the size of <r_ospl_table_t> type index table
dkato 0:37e1e6a45ced 770 * @param MaxCount Max index count
dkato 0:37e1e6a45ced 771 * @return Table size
dkato 0:37e1e6a45ced 772 */
dkato 0:37e1e6a45ced 773 /* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
dkato 0:37e1e6a45ced 774 #define R_OSPL_TABLE_1_SIZE 8 /* sizeof(r_ospl_table_block_t) */
dkato 0:37e1e6a45ced 775 #define R_OSPL_TABLE_SIZE( MaxCount ) \
dkato 0:37e1e6a45ced 776 ( (MaxCount) * R_OSPL_TABLE_1_SIZE )
dkato 0:37e1e6a45ced 777 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
dkato 0:37e1e6a45ced 778
dkato 0:37e1e6a45ced 779
dkato 0:37e1e6a45ced 780 /**
dkato 0:37e1e6a45ced 781 * @def R_OSPL_DEBUG_WORK_SIZE
dkato 0:37e1e6a45ced 782 * @brief Calculates the size of debug work area
dkato 0:37e1e6a45ced 783 * @param ThreadMaxCount Max thread count using error breaking system of OSPL
dkato 0:37e1e6a45ced 784 * @return Size of debug work area
dkato 0:37e1e6a45ced 785 */
dkato 0:37e1e6a45ced 786 /* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
dkato 0:37e1e6a45ced 787 #define R_OSPL_DEBUG_WORK_1_SIZE 32 /* sizeof(r_ospl_table_block_t) + sizeof(r_ospl_error_t) */
dkato 0:37e1e6a45ced 788 #define R_OSPL_DEBUG_WORK_SIZE( ThreadMaxCount ) \
dkato 0:37e1e6a45ced 789 ( (ThreadMaxCount) * R_OSPL_DEBUG_WORK_1_SIZE )
dkato 0:37e1e6a45ced 790 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
dkato 0:37e1e6a45ced 791
dkato 0:37e1e6a45ced 792
dkato 0:37e1e6a45ced 793 /**
dkato 0:37e1e6a45ced 794 * @enum errnum_t
dkato 0:37e1e6a45ced 795 * @brief Error code defined by OSPL
dkato 0:37e1e6a45ced 796 *
dkato 0:37e1e6a45ced 797 * - E_OTHERS - 0x01
dkato 0:37e1e6a45ced 798 * - E_FEW_ARRAY - 0x02
dkato 0:37e1e6a45ced 799 * - E_FEW_MEMORY - 0x03
dkato 0:37e1e6a45ced 800 * - E_FIFO_OVER - 0x04
dkato 0:37e1e6a45ced 801 * - E_NOT_FOUND_SYMBOL - 0x05
dkato 0:37e1e6a45ced 802 * - E_NO_NEXT - 0x06
dkato 0:37e1e6a45ced 803 * - E_ACCESS_DENIED - 0x07
dkato 0:37e1e6a45ced 804 * - E_NOT_IMPLEMENT_YET - 0x09
dkato 0:37e1e6a45ced 805 * - E_ERRNO - 0x0E
dkato 0:37e1e6a45ced 806 * - E_LIMITATION - 0x0F
dkato 0:37e1e6a45ced 807 * - E_STATE - 0x10
dkato 0:37e1e6a45ced 808 * - E_NOT_THREAD - 0x11
dkato 0:37e1e6a45ced 809 * - E_PATH_NOT_FOUND - 0x12
dkato 0:37e1e6a45ced 810 * - E_BAD_COMMAND_ID - 0x16
dkato 0:37e1e6a45ced 811 * - E_TIME_OUT - 0x17
dkato 0:37e1e6a45ced 812 * - E_NO_DEBUG_TLS - 0x1D
dkato 0:37e1e6a45ced 813 * - E_EXIT_TEST - 0x1E
dkato 0:37e1e6a45ced 814 */
dkato 0:37e1e6a45ced 815 #define E_CATEGORY_MASK 0xFFFFFFE0u /* E_CATEGORY_* */
dkato 0:37e1e6a45ced 816 enum { E_OFFSET_MASK = 0x0000001F };
dkato 0:37e1e6a45ced 817
dkato 0:37e1e6a45ced 818 #ifndef E_CATEGORY_COMMON /* Overwritable */
dkato 0:37e1e6a45ced 819 #define E_CATEGORY_COMMON E_CATEGORY_COMMON
dkato 0:37e1e6a45ced 820 enum { E_CATEGORY_COMMON = 0x00000000 }; /* 0x01, 0x02 .. 0x1F : Reseved */
dkato 0:37e1e6a45ced 821 #endif
dkato 0:37e1e6a45ced 822
dkato 0:37e1e6a45ced 823 enum { E_OTHERS = E_CATEGORY_COMMON | 0x01 }; /* 1 */
dkato 0:37e1e6a45ced 824 enum { E_FEW_ARRAY = E_CATEGORY_COMMON | 0x02 }; /* 2 */
dkato 0:37e1e6a45ced 825 enum { E_FEW_MEMORY = E_CATEGORY_COMMON | 0x03 }; /* 3 */
dkato 0:37e1e6a45ced 826 enum { E_FIFO_OVER = E_CATEGORY_COMMON | 0x04 }; /* 4 */
dkato 0:37e1e6a45ced 827 enum { E_NOT_FOUND_SYMBOL = E_CATEGORY_COMMON | 0x05 }; /* 5 */
dkato 0:37e1e6a45ced 828 enum { E_NO_NEXT = E_CATEGORY_COMMON | 0x06 }; /* 6 */
dkato 0:37e1e6a45ced 829 enum { E_ACCESS_DENIED = E_CATEGORY_COMMON | 0x07 }; /* 7 */
dkato 0:37e1e6a45ced 830 enum { E_NOT_IMPLEMENT_YET = E_CATEGORY_COMMON | 0x09 }; /* 9 */
dkato 0:37e1e6a45ced 831 enum { E_ERRNO = E_CATEGORY_COMMON | 0x0E }; /* 14 */
dkato 0:37e1e6a45ced 832 enum { E_LIMITATION = E_CATEGORY_COMMON | 0x0F }; /* 15 */
dkato 0:37e1e6a45ced 833 enum { E_STATE = E_CATEGORY_COMMON | 0x10 }; /* 16 */
dkato 0:37e1e6a45ced 834 enum { E_NOT_THREAD = E_CATEGORY_COMMON | 0x11 }; /* 17 */
dkato 0:37e1e6a45ced 835 enum { E_PATH_NOT_FOUND = E_CATEGORY_COMMON | 0x12 }; /* 18 */
dkato 0:37e1e6a45ced 836 enum { E_BAD_COMMAND_ID = E_CATEGORY_COMMON | 0x16 }; /* 22 */
dkato 0:37e1e6a45ced 837 enum { E_TIME_OUT = E_CATEGORY_COMMON | 0x17 }; /* 23 */
dkato 0:37e1e6a45ced 838 enum { E_NO_DEBUG_TLS = E_CATEGORY_COMMON | 0x1D }; /* 29 */
dkato 0:37e1e6a45ced 839 enum { E_EXIT_TEST = E_CATEGORY_COMMON | 0x1E }; /* 30 */
dkato 0:37e1e6a45ced 840
dkato 0:37e1e6a45ced 841
dkato 0:37e1e6a45ced 842 /**
dkato 0:37e1e6a45ced 843 * @def R_JOIN_SYMBOL_FOR_ASSERT
dkato 0:37e1e6a45ced 844 * @brief Sub routine of <R_STATIC_ASSERT>
dkato 0:37e1e6a45ced 845 * @par Parameters
dkato 0:37e1e6a45ced 846 * None
dkato 0:37e1e6a45ced 847 * @return None.
dkato 0:37e1e6a45ced 848 *
dkato 0:37e1e6a45ced 849 * - This macro extends "x", "y"
dkato 0:37e1e6a45ced 850 * - This code is referenced by CERT secure coding standard PRE05-C
dkato 0:37e1e6a45ced 851 */
dkato 0:37e1e6a45ced 852 /* ->MISRA 19.7 : Extend macro arguments */ /* ->SEC M5.1.3 */
dkato 0:37e1e6a45ced 853 #define R_JOIN_SYMBOL_FOR_ASSERT(x, y) R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y)
dkato 0:37e1e6a45ced 854 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
dkato 0:37e1e6a45ced 855 /* ->MISRA 19.13 : This is used only assertion in compiling */ /* ->SEC M5.1.2 (1) */
dkato 0:37e1e6a45ced 856 #define R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y) x##y
dkato 0:37e1e6a45ced 857 /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
dkato 0:37e1e6a45ced 858
dkato 0:37e1e6a45ced 859
dkato 0:37e1e6a45ced 860 /**
dkato 0:37e1e6a45ced 861 * @def R_STATIC_ASSERT
dkato 0:37e1e6a45ced 862 * @brief "static_assert" for in function
dkato 0:37e1e6a45ced 863 * @par Parameters
dkato 0:37e1e6a45ced 864 * None
dkato 0:37e1e6a45ced 865 * @return None.
dkato 0:37e1e6a45ced 866 *
dkato 0:37e1e6a45ced 867 * @par Description
dkato 0:37e1e6a45ced 868 * Compatible with static_assert (C++0x). But our naming rule is not match.
dkato 0:37e1e6a45ced 869 * - This code is referenced by CERT secure coding standard DCL03 - C.
dkato 0:37e1e6a45ced 870 * This macro raised QAC warning 3205. This is no problem.
dkato 0:37e1e6a45ced 871 */
dkato 0:37e1e6a45ced 872 /* ->SEC M1.1.1 */
dkato 0:37e1e6a45ced 873 #define R_STATIC_ASSERT( ConstantExpression, StringLiteral ) \
dkato 0:37e1e6a45ced 874 do { typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
dkato 0:37e1e6a45ced 875 [(ConstantExpression) ? 1 : -1]; } while(0)
dkato 0:37e1e6a45ced 876 /* If "ConstantExpression" is false, illegal array size error will be raised. */
dkato 0:37e1e6a45ced 877 /* <-SEC M1.1.1 */
dkato 0:37e1e6a45ced 878
dkato 0:37e1e6a45ced 879
dkato 0:37e1e6a45ced 880 /**
dkato 0:37e1e6a45ced 881 * @def R_STATIC_ASSERT_GLOBAL
dkato 0:37e1e6a45ced 882 * @brief "static_assert" for in global scope
dkato 0:37e1e6a45ced 883 * @par Parameters
dkato 0:37e1e6a45ced 884 * None
dkato 0:37e1e6a45ced 885 * @return None.
dkato 0:37e1e6a45ced 886 */
dkato 0:37e1e6a45ced 887 /* ->SEC M1.1.1 */
dkato 0:37e1e6a45ced 888 /* ->MISRA 19.4 : There is not if statement in global */ /* ->SEC M1.8.2 */
dkato 0:37e1e6a45ced 889 /* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
dkato 0:37e1e6a45ced 890 #define R_STATIC_ASSERT_GLOBAL( ConstantExpression, StringLiteral ) \
dkato 0:37e1e6a45ced 891 typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
dkato 0:37e1e6a45ced 892 [(ConstantExpression) ? 1 : -1]
dkato 0:37e1e6a45ced 893 /* If "ConstantExpression" is false, illegal array size error will be raised. */
dkato 0:37e1e6a45ced 894 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
dkato 0:37e1e6a45ced 895 /* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
dkato 0:37e1e6a45ced 896 /* <-SEC M1.1.1 */
dkato 0:37e1e6a45ced 897
dkato 0:37e1e6a45ced 898
dkato 0:37e1e6a45ced 899 /******************************************************************************
dkato 0:37e1e6a45ced 900 Variable Externs
dkato 0:37e1e6a45ced 901 ******************************************************************************/
dkato 0:37e1e6a45ced 902
dkato 0:37e1e6a45ced 903 /******************************************************************************
dkato 0:37e1e6a45ced 904 Functions Prototypes
dkato 0:37e1e6a45ced 905 ******************************************************************************/
dkato 0:37e1e6a45ced 906 /* In "r_ospl.h" */
dkato 0:37e1e6a45ced 907
dkato 0:37e1e6a45ced 908
dkato 0:37e1e6a45ced 909 /***********************************************************************
dkato 0:37e1e6a45ced 910 * End of File:
dkato 0:37e1e6a45ced 911 ************************************************************************/
dkato 0:37e1e6a45ced 912 #ifdef __cplusplus
dkato 0:37e1e6a45ced 913 } /* extern "C" */
dkato 0:37e1e6a45ced 914 #endif /* __cplusplus */
dkato 0:37e1e6a45ced 915
dkato 0:37e1e6a45ced 916 #endif /* R_OSPL_H */
dkato 0:37e1e6a45ced 917