128 lines
4.6 KiB
C
128 lines
4.6 KiB
C
|
/**************************************************************************//**
|
||
|
* @file cmsis_cmcpp.h
|
||
|
* @brief CMSIS compiler CMCPP_ARM header file
|
||
|
* @version V5.0.2
|
||
|
* @date 13. February 2018
|
||
|
******************************************************************************/
|
||
|
/*
|
||
|
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
|
||
|
*
|
||
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||
|
* not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
#ifndef __CMSIS_CMCPP_H
|
||
|
#define __CMSIS_CMCPP_H
|
||
|
|
||
|
/* ignore some GCC warnings */
|
||
|
/*#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||
|
#pragma GCC diagnostic ignored "-Wunused-parameter" */
|
||
|
|
||
|
/* Fallback for __has_builtin */
|
||
|
#ifndef __has_builtin
|
||
|
#define __has_builtin(x) (0)
|
||
|
#endif
|
||
|
|
||
|
/* CMSIS compiler specific defines */
|
||
|
#ifndef __ASM
|
||
|
#define __ASM __asm
|
||
|
#endif
|
||
|
#ifndef __INLINE
|
||
|
#define __INLINE inline
|
||
|
#endif
|
||
|
#ifndef __STATIC_INLINE
|
||
|
#define __STATIC_INLINE static inline
|
||
|
#endif
|
||
|
#ifndef __STATIC_FORCEINLINE
|
||
|
#define __STATIC_FORCEINLINE static inline /*__attribute__((always_inline)) static inline*/
|
||
|
#endif
|
||
|
#ifndef __NO_RETURN
|
||
|
#define __NO_RETURN /*__attribute__((__noreturn__))*/
|
||
|
#endif
|
||
|
#ifndef __USED
|
||
|
#define __USED /*__attribute__((used))*/
|
||
|
#endif
|
||
|
#ifndef __WEAK
|
||
|
#define __WEAK /*__attribute__((weak))*/
|
||
|
#endif
|
||
|
#ifndef __PACKED
|
||
|
#define __PACKED __packed
|
||
|
#endif
|
||
|
#ifndef __PACKED_STRUCT
|
||
|
#define __PACKED_STRUCT __packed struct
|
||
|
#endif
|
||
|
#ifndef __PACKED_UNION
|
||
|
#define __PACKED_UNION __packed union
|
||
|
#endif
|
||
|
|
||
|
//#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||
|
/* #pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpacked"
|
||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||
|
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
|
||
|
#pragma GCC diagnostic pop
|
||
|
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
|
||
|
#endif
|
||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||
|
#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpacked"
|
||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||
|
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||
|
#pragma GCC diagnostic pop
|
||
|
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
|
||
|
#endif
|
||
|
#ifndef __UNALIGNED_UINT16_READ
|
||
|
#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpacked"
|
||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||
|
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||
|
#pragma GCC diagnostic pop
|
||
|
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
|
||
|
#endif
|
||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||
|
#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpacked"
|
||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||
|
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||
|
#pragma GCC diagnostic pop
|
||
|
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
|
||
|
#endif
|
||
|
#ifndef __UNALIGNED_UINT32_READ
|
||
|
#pragma GCC diagnostic push
|
||
|
#pragma GCC diagnostic ignored "-Wpacked"
|
||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||
|
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||
|
#pragma GCC diagnostic pop
|
||
|
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
|
||
|
#endif */
|
||
|
#ifndef __ALIGNED
|
||
|
#define __ALIGNED(x) /*__attribute__((aligned(x)))*/
|
||
|
#endif
|
||
|
#ifndef __RESTRICT
|
||
|
#define __RESTRICT /*__restrict*/
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/* ########################### Core Function Access ########################### */
|
||
|
/** \ingroup CMSIS_Core_FunctionInterface
|
||
|
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
||
|
@{
|
||
|
*/
|
||
|
|
||
|
|
||
|
#endif /* __CMSISG_CMCPP_H */
|
||
|
|