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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers r_ospl_typedef.h Source File

r_ospl_typedef.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer
00021 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 /**
00024 * @file  r_ospl_typedef.h
00025 * @brief   OS Porting Layer. Data types.
00026 *
00027 * $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
00028 * $Rev: 35 $
00029 * $Date:: 2014-04-15 21:38:18 +0900#$
00030 */
00031 
00032 #ifndef R_OSPL_TYPEDEF_H
00033 #define R_OSPL_TYPEDEF_H
00034 
00035 
00036 /******************************************************************************
00037 Includes   <System Includes> , "Project Includes"
00038 ******************************************************************************/
00039 #ifdef  __GNUC__
00040 #include  <stdint.h>
00041 #include  <stdbool.h>
00042 #endif
00043 #include  "Project_Config.h"
00044 #include  "r_typedefs.h"
00045 #include  "mcu_interrupts_typedef.h"
00046 
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif /* __cplusplus */
00050 
00051 
00052 /******************************************************************************
00053 Typedef definitions
00054 ******************************************************************************/
00055 
00056 typedef struct st_r_ospl_async_t          r_ospl_async_t;
00057 typedef struct st_r_ospl_async_status_t   r_ospl_async_status_t;
00058 typedef struct st_r_ospl_flag32_t         r_ospl_flag32_t;
00059 typedef struct st_r_ospl_interrupt_t      r_ospl_interrupt_t;
00060 typedef struct st_r_ospl_irq_mask_t       r_ospl_irq_mask_t;
00061 typedef struct st_r_ospl_memory_spec_t    r_ospl_memory_spec_t;
00062 typedef struct st_r_ospl_ftimer_spec_t    r_ospl_ftimer_spec_t;
00063 typedef struct st_r_ospl_table_t          r_ospl_table_t;
00064 typedef struct st_r_ospl_i_lock_vtable_t  r_ospl_i_lock_vtable_t;
00065 typedef struct st_r_ospl_caller_t         r_ospl_caller_t;
00066 
00067 
00068 /**
00069 * @typedef  errnum_t
00070 * @brief  Error number
00071 */
00072 typedef int_fast32_t   errnum_t;
00073 
00074 
00075 /**
00076 * @typedef  bit_flags_fast32_t
00077 * @brief  Bit flags as "uint_fast32_t"
00078 */
00079 typedef uint_fast32_t  bit_flags_fast32_t;
00080 
00081 
00082 /**
00083 * @typedef  bit_flags32_t
00084 * @brief  Bit flags as "uint32_t"
00085 */
00086 typedef uint32_t       bit_flags32_t;
00087 
00088 
00089 /**
00090 * @typedef  bit_flags16_t
00091 * @brief  Bit flags as "uint16_t"
00092 */
00093 typedef uint16_t       bit_flags16_t;
00094 
00095 
00096 /**
00097 * @typedef  bit_flags8_t
00098 * @brief  Bit flags as "uint8_t"
00099 */
00100 typedef uint8_t       bit_flags8_t;
00101 
00102 
00103 /**
00104 * @typedef  byte_t
00105 * @brief  Byte type
00106 */
00107 typedef uint8_t        byte_t;
00108 
00109 
00110 /**
00111 * @typedef  ssize_t
00112 * @brief  Signed size type. This is a POSIX specification.
00113 */
00114 #if ! defined( __GNUC__ )  ||  defined( __CC_ARM )
00115 typedef int  ssize_t;
00116 #endif
00117 
00118 
00119 /***********************************************************************
00120 * Section: Global
00121 ************************************************************************/
00122 /* Start of a part of CMSIS : Copy from cmsys_os.h */
00123 /* This is for not calling CMSIS function */
00124 
00125 
00126 /**
00127 * @typedef  osMailQId
00128 * @brief  osMailQId
00129 */
00130 #ifdef IS_CMSIS_USED
00131 typedef struct os_mailQ_cb *osMailQId;
00132 #endif
00133 
00134 
00135 /**
00136 * @struct  r_ospl_rtx_osMailQDef_t
00137 * @brief  RTX:osMailQDef_t
00138 */
00139 #ifdef IS_CMSIS_USED
00140 typedef struct r_ospl_rtx_os_mailQ_def  {
00141     uint32_t                queue_sz;    ///< number of elements in the queue
00142     uint32_t                 item_sz;    ///< size of an item
00143     void                       *pool;    ///< memory array for mail
00144 } r_ospl_rtx_osMailQDef_t;
00145 #endif
00146 
00147 
00148 /* Section: Global */
00149 /**
00150 * @def  r_ospl_rtx_osMailQDef
00151 * @brief  RTX:osMailQDef
00152 * @par Parameters
00153 *    None
00154 * @return  None.
00155 */
00156 #ifdef IS_CMSIS_USED
00157 #if defined (osObjectsExternal)  // object is external
00158 #define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
00159 extern const osMailQDef_t os_mailQ_def_##name
00160 #else                            // define the object
00161 #define r_ospl_rtx_osMailQDef(name, queue_sz, type) \
00162 uint32_t os_mailQ_q_##name[4+(queue_sz)] = { 0 }; \
00163 uint32_t os_mailQ_m_##name[3+((sizeof(type)+3)/4)*(queue_sz)]; \
00164 void *   os_mailQ_p_##name[2] = { (os_mailQ_q_##name), os_mailQ_m_##name }; \
00165 const r_ospl_rtx_osMailQDef_t os_mailQ_def_##name =  \
00166 { (queue_sz), sizeof(type), (os_mailQ_p_##name) }
00167 #endif
00168 #endif
00169 
00170 
00171 /**
00172 * @def  osMailQ
00173 * @brief  osMailQ
00174 * @par Parameters
00175 *    None
00176 * @return  None.
00177 */
00178 #ifdef IS_CMSIS_USED
00179 #define osMailQ(name)  \
00180 &os_mailQ_def_##name
00181 #endif
00182 
00183 
00184 /***********************************************************************
00185 *  Section: Global
00186 ************************************************************************/
00187 /* End of a part of CMSIS */
00188 
00189 
00190 /**
00191 * @struct  r_ospl_thread_id_t
00192 * @brief  Pointer to a thread
00193 */
00194 #ifdef IS_CMSIS_USED
00195 typedef void * /*<r_ospl_thread_def_t*>*/  r_ospl_thread_id_t;
00196 #define  R_OSPL_THREAD_INTERRUPT  ((void*) 0 )
00197 #endif
00198 
00199 
00200 /* Section: Global */
00201 /**
00202 * @brief   The function type of interrupt callback
00203 *
00204 * @param   InterruptSource Source of interrupt
00205 * @param   Caller Driver's internal parameters about interrupt operations
00206 * @return  Error code.  If there is no error, the return value is 0. The value set to "r_ospl_async_t::ReturnValue"
00207 *
00208 * @par Description
00209 *    This is type of the interrupt callback function running in the
00210 *    interrupt context and called from the interrupt handler.
00211 *
00212 *    It is possible to replace to application defined interrupt callback function
00213 *    by setting to "r_ospl_async_t::InterruptCallback". But it is usually not
00214 *    necessary to replace.
00215 *
00216 *    As interrupt callback function, the default interrupt callback function
00217 *    provided from the driver is used. It is unusual to use application defined
00218 *    interrupt callback function.
00219 *    Write the response code of the interrupt (event driven code) next to the
00220 *    code calling @ref R_OSPL_EVENT_Wait function
00221 *
00222 *    Whether the asynchronous operation was ended is possible to know whether
00223 *    the variable of "r_ospl_async_state_t" type referred from
00224 *    @ref R_DRIVER_GetAsyncStatus function is set to @ref R_OSPL_RUNNABLE value.
00225 *
00226 *    It is not necessary to write the code of interrupt return (IRET) in
00227 *    the interrupt callback function. The interrupt handlers calling interrupt
00228 *    callback function calls IRET, if necessary.
00229 *
00230 *    It is not possible to divide interrupt callback functions by the kind of
00231 *    interrupt. Alternatively, it is possible to write operations in interrupt
00232 *    handlers calling interrupt callback function in porting layer under the driver.
00233 *    There are interrupt handlers by each interrupt numbers.
00234 *
00235 *    It is possible to signal any event from application defined interrupt
00236 *    @par callback function. But it is necessary to do following operations
00237 */
00238 typedef errnum_t  (* r_ospl_callback_t )( const r_ospl_interrupt_t *InterruptSource, const r_ospl_caller_t *Caller );
00239 
00240 
00241 /**
00242 * @enum   r_ospl_async_state_t
00243 * @brief  Asynchronous State
00244 *
00245 *    - R_OSPL_UNINITIALIZED - 0
00246 *    - R_OSPL_RUNNABLE - 1, Runnable or Waitable
00247 *    - R_OSPL_RUNNING - 2, Running  or Waiting
00248 *    - R_OSPL_INTERRUPTING - 3
00249 *    - R_OSPL_INTERRUPTED - 4
00250 */
00251 typedef enum {
00252     R_OSPL_UNINITIALIZED = 0,
00253     R_OSPL_RUNNABLE,
00254     R_OSPL_RUNNING,
00255     R_OSPL_INTERRUPTING,
00256     R_OSPL_INTERRUPTED
00257 } r_ospl_async_state_t;
00258 
00259 
00260 /**
00261 * @enum   r_ospl_async_type_t
00262 * @brief  Asynchronous State
00263 *
00264 *    - R_OSPL_ASYNC_TYPE_NORMAL - 1
00265 *    - R_OSPL_ASYNC_TYPE_FINALIZE - 2, Asynchronous finalizing
00266 */
00267 typedef enum {
00268     R_OSPL_ASYNC_TYPE_NORMAL   = 1,
00269     R_OSPL_ASYNC_TYPE_FINALIZE = 2
00270 } r_ospl_async_type_t;
00271 
00272 
00273 /**
00274 * @struct  r_ospl_block_t
00275 * @brief  Block in queue
00276 *
00277 * @par Description
00278 *    Member variables should not be accessed.
00279 */
00280 typedef struct st_r_ospl_block_t  r_ospl_block_t;
00281 struct st_r_ospl_block_t {
00282     r_ospl_block_t  *Next;
00283 };
00284 
00285 
00286 /**
00287 * @struct  r_ospl_queue_status_t
00288 * @brief  r_ospl_queue_status_t
00289 */
00290 typedef struct st_r_ospl_queue_status_t {
00291 
00292     /** UsedCount */
00293     int_fast32_t  UsedCount;
00294 
00295     /** MaxCount */
00296     int_fast32_t  MaxCount;
00297 } r_ospl_queue_status_t;
00298 
00299 
00300 /**
00301 * @struct  r_ospl_queue_def_t
00302 * @brief  r_ospl_queue_def_t
00303 * @par Description
00304 *    Member variables should not be accessed.
00305 */
00306 typedef struct st_r_ospl_queue_def_t {
00307     osMailQId                       MailQId;
00308     r_ospl_queue_status_t           PublicStatus;
00309     const r_ospl_rtx_osMailQDef_t  *MailQDef;
00310 } r_ospl_queue_def_t;
00311 
00312 
00313 /**
00314 * @struct  r_ospl_queue_t
00315 * @brief  r_ospl_queue_t
00316 * @par Description
00317 *    Member variables should not be accessed.
00318 */
00319 typedef r_ospl_queue_def_t  r_ospl_queue_t;
00320 
00321 
00322 /* Section: Global */
00323 /**
00324 * @def  R_OSPL_QUEUE_DEF
00325 * @brief  Defines attributes of queue and work area.
00326 * @param   Name Thread name. Do not bracket by ""
00327 * @param   MaxCount Max count of elements in the queue
00328 * @param   Type Output
00329 * @return  None.
00330 *
00331 * @par Description
00332 *    It is not possible to use this macro in the library.
00333 *    If implement of OSPL was changed, the library must be recompiled.
00334 */
00335 #define  R_OSPL_QUEUE_DEF( Name, MaxCount, Type ) \
00336     r_ospl_rtx_osMailQDef( Name, MaxCount, Type ); \
00337     r_ospl_queue_def_t  Name##_OSPL_DEF = { NULL, 0, (MaxCount), osMailQ( Name ) }
00338 
00339 
00340 /**
00341 * @def  R_OSPL_QUEUE
00342 * @brief  Returns initial attributes of queue and work area.
00343 * @param   Name Queue's name. Do not bracket by ""
00344 * @return  None.
00345 *
00346 * @par Description
00347 *    It is not possible to use this macro in the library.
00348 *    If implement of OSPL was changed, the library must be recompiled.
00349 */
00350 #define  R_OSPL_QUEUE( Name )  (&Name##_OSPL_DEF)
00351 
00352 
00353 /**
00354 * @typedef  r_ospl_flush_t
00355 * @brief  r_ospl_flush_t
00356 */
00357 typedef bit_flags_fast32_t  r_ospl_flush_t;
00358 #define  /*<uint_fast32_t>*/  R_OSPL_FLUSH_INVALIDATE                0u
00359 #define  /*<uint_fast32_t>*/  R_OSPL_FLUSH_WRITEBACK_INVALIDATE      2u
00360 #define  /*<uint_fast32_t>*/  R_OSPL_FLUSH_WRITEBACK_INVALIDATE_2ND  8u
00361 
00362 
00363 /**
00364 * @struct  r_ospl_flag32_t
00365 * @brief  This is the type of flags having 32bit
00366 *
00367 * @par Description
00368 *    Member variables should not be accessed.
00369 */
00370 struct st_r_ospl_flag32_t {
00371     volatile uint32_t  Flags;
00372 };
00373 
00374 
00375 /**
00376 * @struct  r_ospl_interrupt_t
00377 * @brief  Structure related to interrupt source. e.g. interrupt number
00378 */
00379 struct st_r_ospl_interrupt_t {
00380 
00381     /** <bsp_int_src_t> */
00382     bsp_int_src_t  IRQ_Num;
00383 
00384     /** ChannelNum */
00385     int_fast32_t   ChannelNum;
00386 
00387     /** Type */
00388     int_fast32_t   Type;
00389 
00390     /** Delegate */
00391     void  *Delegate;
00392 };
00393 
00394 
00395 /**
00396 * @struct  r_ospl_async_status_t
00397 * @brief  Structure of driver's status and interrupt status defined by OSPL
00398 */
00399 struct st_r_ospl_async_status_t {
00400 
00401     /** <r_ospl_async_state_t> */
00402     volatile r_ospl_async_state_t  State;
00403 
00404     /** IsEnabledInterrupt */
00405     volatile bool_t  IsEnabledInterrupt;
00406 
00407     /** InterruptEnables */
00408     volatile r_ospl_flag32_t  InterruptEnables;
00409 
00410     /** InterruptFlags */
00411     volatile r_ospl_flag32_t  InterruptFlags;
00412 
00413     /** r_ospl_flag32_t < <r_ospl_cancel_flag_t> > */
00414     volatile r_ospl_flag32_t  CancelFlags;  /*<r_ospl_cancel_flag_t>*/
00415 #if  R_OSPL_IS_PREEMPTION
00416     union {
00417 
00418         /** LockOwner */
00419         volatile r_ospl_thread_id_t  Thread;
00420 
00421         /** LockOwner */
00422         volatile void  *Context;
00423     } LockOwner;
00424 #endif
00425 };
00426 
00427 
00428 /**
00429 * @struct  r_ospl_async_t
00430 * @brief  Setting of notifications
00431 */
00432 struct st_r_ospl_async_t {
00433 
00434     /** Flags */
00435     bit_flags_fast32_t  Flags;
00436 
00437     /** Delegate */
00438     void  *Delegate;
00439 
00440     /** A_Thread */
00441     r_ospl_thread_id_t  A_Thread;
00442 
00443     /** A_EventValue */
00444     uint32_t  A_EventValue;  /* QAC 4130 */
00445 
00446     /** I_Thread */
00447     r_ospl_thread_id_t  I_Thread;
00448 
00449     /** I_EventValue */
00450     uint32_t  I_EventValue;  /* QAC 4130 */
00451 
00452     /** InterruptCallback */
00453     r_ospl_callback_t  InterruptCallback;
00454 
00455     /** ReturnValue */
00456     errnum_t  ReturnValue;
00457 };
00458 
00459 enum {
00460     R_F_OSPL_A_Thread          = 0x0001,
00461     R_F_OSPL_A_EventValue      = 0x0002,
00462     R_F_OSPL_I_Thread          = 0x0004,
00463     R_F_OSPL_I_EventValue      = 0x0008,
00464     R_F_OSPL_InterruptCallback = 0x0010,
00465     R_F_OSPL_Delegate          = 0x0080
00466 };
00467 
00468 
00469 /* Section: Global */
00470 /***********************************************************************
00471 * Macros: r_ospl_internal_sentinel
00472 *
00473 *    : R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK  - 0x7FFFFF40
00474 *    : R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE - 0x4A5C0000
00475 ************************************************************************/
00476 #ifndef R_OSPL_NDEBUG
00477 enum {
00478     R_F_OSPL_ASYNC_FLAGS_SENTINEL_MASK  = 0x7FFFFF40,
00479     R_F_OSPL_ASYNC_FLAGS_SENTINEL_VALUE = 0x4A5C0000
00480 };
00481 #endif
00482 
00483 
00484 /**
00485 * @struct  r_ospl_caller_t
00486 * @brief  Context of interrupt callback function caller
00487 *
00488 * @par Description
00489 *    Member variables should not be accessed.
00490 */
00491 struct st_r_ospl_caller_t {
00492     r_ospl_async_t                *Async;
00493     volatile int_fast32_t         *PointerToState;
00494     int_fast32_t                   StateValueOfOnInterrupting;
00495     void                          *I_Lock;
00496     const r_ospl_i_lock_vtable_t  *I_LockVTable;
00497 };
00498 
00499 
00500 /***********************************************************************
00501 * Class: r_ospl_i_lock_vtable_t
00502 *    I-Lock V-Table
00503 ************************************************************************/
00504 typedef bool_t (* r_ospl_i_lock_lock_func_t )( void *const  self_ );
00505 typedef void   (* r_ospl_i_lock_unlock_func_t )( void *const  self_ );
00506 typedef void   (* r_ospl_i_lock_get_rf_func_t )( void *const  self_ );    /* rf = RequestFinalize */
00507 typedef bool_t (* r_ospl_i_lock_get_rcn_func_t )( const void *const  self_ );   /* rcn = RootChannelNum */
00508 
00509 struct st_r_ospl_i_lock_vtable_t {
00510 
00511     /**
00512     * @brief   Lock
00513     *
00514     * @par Parameters
00515     *    None
00516     * @return  None.
00517     */
00518     bool_t  (* Lock )( void *const  self_ );
00519 
00520     /**
00521     * @brief   Unlock
00522     *
00523     * @par Parameters
00524     *    None
00525     * @return  None.
00526     */
00527     void    (* Unlock )( void *const  self_ );
00528 
00529     /**
00530     * @brief   RequestFinalize
00531     *
00532     * @par Parameters
00533     *    None
00534     * @return  None.
00535     */
00536     void    (* RequestFinalize )( void *const  self_ );
00537 
00538     /**
00539     * @brief   GetRootChannelNum
00540     *
00541     * @par Parameters
00542     *    None
00543     * @return  None.
00544     */
00545     int_fast32_t  (* GetRootChannelNum )( const void *const  self_ );
00546 };
00547 
00548 
00549 /**
00550 * @struct  r_ospl_memory_spec_t
00551 * @brief  Memory specification
00552 */
00553 struct st_r_ospl_memory_spec_t {
00554 
00555     /** (byte) */
00556     uint_fast32_t  CacheLineSize;
00557 };
00558 
00559 
00560 /**
00561 * @struct  r_ospl_ftimer_spec_t
00562 * @brief  Free run timer specification
00563 */
00564 struct st_r_ospl_ftimer_spec_t {
00565 
00566     /** msec_Numerator */
00567     uint32_t  msec_Numerator;
00568 
00569     /** msec_Denominator */
00570     uint32_t  msec_Denominator;
00571 
00572     /** MaxCount */
00573     uint32_t  MaxCount;
00574 
00575     /** ExtensionOfCount */
00576     uint32_t  ExtensionOfCount;
00577 };
00578 
00579 
00580 /**
00581 * @struct  r_ospl_table_t
00582 * @brief  Index table
00583 *
00584 * @par Description
00585 *    Member variables should not be accessed.
00586 */
00587 struct st_r_ospl_table_t {
00588     void         *Area;
00589     int_fast32_t  Count;
00590     int_fast32_t  MaxCount;
00591     const void   *KeyCache;
00592     int_fast32_t  IndexCache;  /* Not SortedKeyIndex */
00593     int16_t       FirstFreeIndex;
00594 #if R_OSPL_IS_PREEMPTION
00595     bool_t        Is_T_Lock;
00596 #endif
00597 };
00598 
00599 
00600 /* Section: Global */
00601 /**
00602 * @enum   r_ospl_if_not_t
00603 * @brief  Operation if not exists
00604 *
00605 *    - R_OSPL_ERROR_IF_NOT - 0
00606 *    - R_OSPL_ALLOCATE_IF_NOT - 1
00607 *    - R_OSPL_DO_NOTHING_IF_NOT - 2
00608 */
00609 typedef enum {
00610     R_OSPL_ERROR_IF_NOT      = 0,
00611     R_OSPL_ALLOCATE_IF_NOT   = 1,
00612     R_OSPL_DO_NOTHING_IF_NOT = 2
00613 } r_ospl_if_not_t;
00614 
00615 
00616 /**
00617 * @struct  r_ospl_error_t
00618 * @brief  Error status of a thread
00619 *
00620 * @par Description
00621 *    Member variables should not be accessed.
00622 */
00623 #if R_OSPL_ERROR_BREAK  ||  R_OSPL_TLS_ERROR_CODE
00624 typedef  struct st_r_ospl_error_t  r_ospl_error_t;
00625 struct st_r_ospl_error_t {
00626 #if R_OSPL_ERROR_BREAK
00627     bool_t         IsError;
00628     int_fast32_t   ErrorID;
00629     const char_t  *FilePath;
00630     int_fast32_t   LineNum;
00631 #if R_OSPL_IS_PREEMPTION
00632     int_fast32_t   ThreadLockedCount;
00633 #endif
00634 #endif
00635 #if R_OSPL_TLS_ERROR_CODE
00636     errnum_t       ErrNum;
00637 #endif
00638 };
00639 #endif
00640 
00641 
00642 /**
00643 * @struct  r_ospl_global_error_t
00644 * @brief  Error status of global
00645 *
00646 * @par Description
00647 *    Member variables should not be accessed.
00648 */
00649 #if R_OSPL_ERROR_BREAK  ||  R_OSPL_TLS_ERROR_CODE
00650 typedef  struct st_r_ospl_global_error_t  r_ospl_global_error_t;
00651 struct st_r_ospl_global_error_t {
00652     r_ospl_table_t   ThreadIndexTable;
00653     r_ospl_error_t  *ErrorArray;
00654 
00655 #if R_OSPL_ERROR_BREAK
00656     int_fast32_t     RaisedGlobalErrorID;
00657     int_fast32_t     BreakGlobalErrorID;
00658 #endif
00659 };
00660 #endif
00661 
00662 
00663 /* Section: Global */
00664 /**
00665 * @enum   r_ospl_axi_cache_attribute_t
00666 * @brief  Cache attribute on AXI bus.
00667 *
00668 *    - R_OSPL_AXI_CACHE_ZERO - Not AXI
00669 *    - R_OSPL_AXI_STRONGLY - Strongly order access
00670 *    - R_OSPL_AXI_DEVICE - DEVICE
00671 *    - R_OSPL_AXI_UNCACHED - Normal access (Out of order) uncached
00672 *    - R_OSPL_AXI_WRITE_BACK_W - Write back, allocate on write
00673 *    - R_OSPL_AXI_WRITE_BACK - Write back, allocate on both read and write
00674 */
00675 typedef enum {
00676     R_OSPL_AXI_CACHE_ZERO     =  0,
00677     R_OSPL_AXI_STRONGLY       =  0,
00678     R_OSPL_AXI_DEVICE         =  1,
00679     R_OSPL_AXI_UNCACHED       =  3,
00680     R_OSPL_AXI_WRITE_BACK_W   = 11,
00681     R_OSPL_AXI_WRITE_BACK     = 15
00682 } r_ospl_axi_cache_attribute_t;
00683 
00684 
00685 /**
00686 * @enum   r_ospl_axi_protection_t
00687 * @brief  Protection on AXI bus.
00688 *
00689 *    - R_OSPL_AXI_PROTECTION_ZERO - Not AXI
00690 *    - R_OSPL_AXI_SECURE - TrustZone secure acccess
00691 *    - R_OSPL_AXI_NON_SECURE - TrustZone non-secure acccess
00692 */
00693 typedef enum {
00694     R_OSPL_AXI_PROTECTION_ZERO = 0,
00695     R_OSPL_AXI_SECURE          = 0,
00696     R_OSPL_AXI_NON_SECURE      = 2
00697 } r_ospl_axi_protection_t;
00698 
00699 
00700 /******************************************************************************
00701 Macro definitions
00702 ******************************************************************************/
00703 
00704 /**
00705 * @enum   Event_Bit_Name
00706 * @brief  Event_Bit_Name
00707 *    - R_OSPL_ANY_FLAG - 0x0000
00708 *    - R_OSPL_A_FLAG - 0x0001
00709 *    - R_OSPL_I_FLAG - 0x0002
00710 *    - R_OSPL_FINAL_A_FLAG - 0x0004
00711 */
00712 enum {
00713     R_OSPL_ANY_FLAG         = 0x00000000,
00714     R_OSPL_A_FLAG           = 0x00000001,
00715     R_OSPL_I_FLAG           = 0x00000002,
00716     R_OSPL_FINAL_A_FLAG     = 0x00000004
00717 };
00718 
00719 
00720 /**
00721 * @typedef  r_ospl_cancel_flag_t
00722 * @brief  Bit flags of <r_ospl_cancel_bit_t>
00723 */
00724 typedef int_t  r_ospl_cancel_flag_t;
00725 
00726 
00727 /**
00728 * @enum   r_ospl_cancel_bit_t
00729 * @brief  r_ospl_cancel_bit_t
00730 *    - R_OSPL_CANNEL_REQUEST - 0x0001
00731 *    - R_OSPL_CANNELING - 0x0002
00732 *    - R_OSPL_CANNELED - 0x0004
00733 *    - R_OSPL_FINALIZE_REQUEST - 0x0010
00734 *    - R_OSPL_FINALIZING - 0x0020
00735 *    - R_OSPL_FINALIZED - 0x0040
00736 */
00737 enum {
00738     R_OSPL_CANNEL_REQUEST   = 0x00000001,
00739     R_OSPL_CANNELING        = 0x00000002,
00740     R_OSPL_CANNELED         = 0x00000004,
00741     R_OSPL_FINALIZE_REQUEST = 0x00000010,
00742     R_OSPL_FINALIZING       = 0x00000020,
00743     R_OSPL_FINALIZED        = 0x00000040
00744 };
00745 
00746 
00747 /***********************************************************************
00748 * Macros: OSPL_Others
00749 *
00750 *    : R_OSPL_INFINITE         - One of time out value
00751 *    : R_OSPL_FLAG32_ALL_BITS  - R_OSPL_FLAG32_ALL_BITS
00752 *    : R_OSPL_EVENT_ALL_BITS   - R_OSPL_EVENT_ALL_BITS
00753 *    : R_OSPL_TIMEOUT          - Raised time out
00754 *    : R_OSPL_MAX_TIME_OUT     - Max value of time out
00755 *    : R_OSPL_NO_INDEX         - R_OSPL_NO_INDEX
00756 *    : R_OSPL_UNLOCKED_CHANNEL - R_OSPL_UNLOCKED_CHANNEL
00757 ************************************************************************/
00758 #define R_OSPL_INFINITE           0xFFFFFFFFu   /* uint32_t */
00759 #define R_OSPL_FLAG32_ALL_BITS    0xFFFFFFFFu   /* uint32_t */
00760 enum {  R_OSPL_EVENT_ALL_BITS   = 0x0000FFFF };
00761 enum {  R_OSPL_TIMEOUT          = 0x40000000 };
00762 enum {  R_OSPL_MAX_TIME_OUT     = 65533 };
00763 enum {  R_OSPL_NO_INDEX         = -1         };
00764 enum {  R_OSPL_UNLOCKED_CHANNEL = 0x00000FEE };
00765 
00766 
00767 /**
00768 * @def  R_OSPL_TABLE_SIZE
00769 * @brief  Calculates the size of <r_ospl_table_t> type index table
00770 * @param   MaxCount Max index count
00771 * @return  Table size
00772 */
00773 /* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
00774 #define  R_OSPL_TABLE_1_SIZE  8  /* sizeof(r_ospl_table_block_t) */
00775 #define  R_OSPL_TABLE_SIZE( MaxCount ) \
00776     ( (MaxCount) * R_OSPL_TABLE_1_SIZE )
00777 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00778 
00779 
00780 /**
00781 * @def  R_OSPL_DEBUG_WORK_SIZE
00782 * @brief  Calculates the size of debug work area
00783 * @param   ThreadMaxCount Max thread count using error breaking system of OSPL
00784 * @return  Size of debug work area
00785 */
00786 /* ->MISRA 19.7 : Array count must const */ /* ->SEC M5.1.3 */
00787 #define  R_OSPL_DEBUG_WORK_1_SIZE  32  /* sizeof(r_ospl_table_block_t) + sizeof(r_ospl_error_t) */
00788 #define  R_OSPL_DEBUG_WORK_SIZE( ThreadMaxCount ) \
00789     ( (ThreadMaxCount) * R_OSPL_DEBUG_WORK_1_SIZE )
00790 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00791 
00792 
00793 /**
00794 * @enum   errnum_t
00795 * @brief  Error code defined by OSPL
00796 *
00797 *    - E_OTHERS - 0x01
00798 *    - E_FEW_ARRAY - 0x02
00799 *    - E_FEW_MEMORY - 0x03
00800 *    - E_FIFO_OVER - 0x04
00801 *    - E_NOT_FOUND_SYMBOL - 0x05
00802 *    - E_NO_NEXT - 0x06
00803 *    - E_ACCESS_DENIED - 0x07
00804 *    - E_NOT_IMPLEMENT_YET - 0x09
00805 *    - E_ERRNO - 0x0E
00806 *    - E_LIMITATION - 0x0F
00807 *    - E_STATE - 0x10
00808 *    - E_NOT_THREAD - 0x11
00809 *    - E_PATH_NOT_FOUND - 0x12
00810 *    - E_BAD_COMMAND_ID - 0x16
00811 *    - E_TIME_OUT - 0x17
00812 *    - E_NO_DEBUG_TLS - 0x1D
00813 *    - E_EXIT_TEST - 0x1E
00814 */
00815 #define  E_CATEGORY_MASK   0xFFFFFFE0u  /* E_CATEGORY_* */
00816 enum {   E_OFFSET_MASK   = 0x0000001F };
00817 
00818 #ifndef  E_CATEGORY_COMMON  /* Overwritable */
00819 #define  E_CATEGORY_COMMON  E_CATEGORY_COMMON
00820 enum { E_CATEGORY_COMMON = 0x00000000 };  /* 0x01, 0x02 .. 0x1F : Reseved */
00821 #endif
00822 
00823 enum { E_OTHERS             = E_CATEGORY_COMMON | 0x01 }; /*  1 */
00824 enum { E_FEW_ARRAY          = E_CATEGORY_COMMON | 0x02 }; /*  2 */
00825 enum { E_FEW_MEMORY         = E_CATEGORY_COMMON | 0x03 }; /*  3 */
00826 enum { E_FIFO_OVER          = E_CATEGORY_COMMON | 0x04 }; /*  4 */
00827 enum { E_NOT_FOUND_SYMBOL   = E_CATEGORY_COMMON | 0x05 }; /*  5 */
00828 enum { E_NO_NEXT            = E_CATEGORY_COMMON | 0x06 }; /*  6 */
00829 enum { E_ACCESS_DENIED      = E_CATEGORY_COMMON | 0x07 }; /*  7 */
00830 enum { E_NOT_IMPLEMENT_YET  = E_CATEGORY_COMMON | 0x09 }; /*  9 */
00831 enum { E_ERRNO              = E_CATEGORY_COMMON | 0x0E }; /* 14 */
00832 enum { E_LIMITATION         = E_CATEGORY_COMMON | 0x0F }; /* 15 */
00833 enum { E_STATE              = E_CATEGORY_COMMON | 0x10 }; /* 16 */
00834 enum { E_NOT_THREAD         = E_CATEGORY_COMMON | 0x11 }; /* 17 */
00835 enum { E_PATH_NOT_FOUND     = E_CATEGORY_COMMON | 0x12 }; /* 18 */
00836 enum { E_BAD_COMMAND_ID     = E_CATEGORY_COMMON | 0x16 }; /* 22 */
00837 enum { E_TIME_OUT           = E_CATEGORY_COMMON | 0x17 }; /* 23 */
00838 enum { E_NO_DEBUG_TLS       = E_CATEGORY_COMMON | 0x1D }; /* 29 */
00839 enum { E_EXIT_TEST          = E_CATEGORY_COMMON | 0x1E }; /* 30 */
00840 
00841 
00842 /**
00843 * @def  R_JOIN_SYMBOL_FOR_ASSERT
00844 * @brief  Sub routine of <R_STATIC_ASSERT>
00845 * @par Parameters
00846 *    None
00847 * @return  None.
00848 *
00849 * - This macro extends "x", "y"
00850 * - This code is referenced by CERT secure coding standard PRE05-C
00851 */
00852 /* ->MISRA 19.7 : Extend macro arguments */ /* ->SEC M5.1.3 */
00853 #define R_JOIN_SYMBOL_FOR_ASSERT(x, y)  R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y)
00854 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00855 /* ->MISRA 19.13 : This is used only assertion in compiling */ /* ->SEC M5.1.2 (1) */
00856 #define R_JOIN_SYMBOL_FOR_ASSERT_SUB(x, y) x##y
00857 /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
00858 
00859 
00860 /**
00861 * @def  R_STATIC_ASSERT
00862 * @brief  "static_assert" for in function
00863 * @par Parameters
00864 *    None
00865 * @return  None.
00866 *
00867 * @par Description
00868 *    Compatible with static_assert (C++0x). But our naming rule is not match.
00869 *    - This code is referenced by CERT secure coding standard DCL03 - C.
00870 *    This macro raised QAC warning 3205. This is no problem.
00871 */
00872 /* ->SEC M1.1.1 */
00873 #define  R_STATIC_ASSERT( ConstantExpression, StringLiteral ) \
00874     do { typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
00875         [(ConstantExpression) ? 1 : -1]; } while(0)
00876 /* If "ConstantExpression" is false, illegal array size error will be raised. */
00877 /* <-SEC M1.1.1 */
00878 
00879 
00880 /**
00881 * @def  R_STATIC_ASSERT_GLOBAL
00882 * @brief  "static_assert" for in global scope
00883 * @par Parameters
00884 *    None
00885 * @return  None.
00886 */
00887 /* ->SEC M1.1.1 */
00888 /* ->MISRA 19.4 : There is not if statement in global */ /* ->SEC M1.8.2 */
00889 /* ->MISRA 19.7 : Cannot function */ /* ->SEC M5.1.3 */
00890 #define  R_STATIC_ASSERT_GLOBAL( ConstantExpression, StringLiteral ) \
00891          typedef char_t R_JOIN_SYMBOL_FOR_ASSERT( assertion_failed_t_, __LINE__ ) \
00892         [(ConstantExpression) ? 1 : -1]
00893 /* If "ConstantExpression" is false, illegal array size error will be raised. */
00894 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00895 /* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
00896 /* <-SEC M1.1.1 */
00897 
00898 
00899 /******************************************************************************
00900 Variable Externs
00901 ******************************************************************************/
00902 
00903 /******************************************************************************
00904 Functions Prototypes
00905 ******************************************************************************/
00906 /* In "r_ospl.h" */
00907 
00908 
00909 /***********************************************************************
00910 * End of File:
00911 ************************************************************************/
00912 #ifdef __cplusplus
00913 }  /* extern "C" */
00914 #endif /* __cplusplus */
00915 
00916 #endif /* R_OSPL_H */
00917