Added --terse and --mailback options to the make stylecheck target. It also does continue even if it enounters a possible error. We decided on two exceptions from the linux kernel coding standard: - Empty wait while loops may end with ; on the same line. - All blocks after while, if, for have to be in brackets even if they only contain one statement. Otherwise it is easy to introduce an error. Checkpatch needs to be adapted to reflect those changes.
102 lines
2.6 KiB
C
102 lines
2.6 KiB
C
/*
|
|
* This file is part of the libopencm3 project.
|
|
*
|
|
* Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
|
|
*
|
|
* This library is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef LIBOPENCM3_CM3_COMMON_H
|
|
#define LIBOPENCM3_CM3_COMMON_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
/* Type definitions for shorter and nicer code */
|
|
typedef int8_t s8;
|
|
typedef int16_t s16;
|
|
typedef int32_t s32;
|
|
typedef uint8_t u8;
|
|
typedef uint16_t u16;
|
|
typedef uint32_t u32;
|
|
typedef uint64_t u64;
|
|
|
|
/* This must be placed around external function declaration for C++
|
|
* support. */
|
|
#ifdef __cplusplus
|
|
# define BEGIN_DECLS extern "C" {
|
|
# define END_DECLS }
|
|
#else
|
|
# define BEGIN_DECLS
|
|
# define END_DECLS
|
|
#endif
|
|
|
|
/* Full-featured deprecation attribute with fallback for older compilers. */
|
|
|
|
#ifdef __GNUC__
|
|
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)
|
|
# define LIBOPENCM3_DEPRECATED(x) __attribute__((deprecated(x)))
|
|
# else
|
|
# define LIBOPENCM3_DEPRECATED(x) __attribute__((deprecated))
|
|
# endif
|
|
#else
|
|
# define LIBOPENCM3_DEPRECATED(x)
|
|
#endif
|
|
|
|
|
|
/* Generic memory-mapped I/O accessor functions */
|
|
#define MMIO8(addr) (*(volatile u8 *)(addr))
|
|
#define MMIO16(addr) (*(volatile u16 *)(addr))
|
|
#define MMIO32(addr) (*(volatile u32 *)(addr))
|
|
#define MMIO64(addr) (*(volatile u64 *)(addr))
|
|
|
|
/* Generic bit definition */
|
|
#define BIT0 (1<<0)
|
|
#define BIT1 (1<<1)
|
|
#define BIT2 (1<<2)
|
|
#define BIT3 (1<<3)
|
|
#define BIT4 (1<<4)
|
|
#define BIT5 (1<<5)
|
|
#define BIT6 (1<<6)
|
|
#define BIT7 (1<<7)
|
|
#define BIT8 (1<<8)
|
|
#define BIT9 (1<<9)
|
|
#define BIT10 (1<<10)
|
|
#define BIT11 (1<<11)
|
|
#define BIT12 (1<<12)
|
|
#define BIT13 (1<<13)
|
|
#define BIT14 (1<<14)
|
|
#define BIT15 (1<<15)
|
|
#define BIT16 (1<<16)
|
|
#define BIT17 (1<<17)
|
|
#define BIT18 (1<<18)
|
|
#define BIT19 (1<<19)
|
|
#define BIT20 (1<<20)
|
|
#define BIT21 (1<<21)
|
|
#define BIT22 (1<<22)
|
|
#define BIT23 (1<<23)
|
|
#define BIT24 (1<<24)
|
|
#define BIT25 (1<<25)
|
|
#define BIT26 (1<<26)
|
|
#define BIT27 (1<<27)
|
|
#define BIT28 (1<<28)
|
|
#define BIT29 (1<<29)
|
|
#define BIT30 (1<<30)
|
|
#define BIT31 (1<<31)
|
|
|
|
#define __packed __attribute__((packed))
|
|
#define __aligned(x) __attribute__((aligned(x)))
|
|
|
|
#endif
|