?? cyg_type.h
字號:
#ifndef CYGONCE_INFRA_CYG_TYPE_H
#define CYGONCE_INFRA_CYG_TYPE_H
//==========================================================================
//
// cyg_type.h
//
// Standard types, and some useful coding macros.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos 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 General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg from an original by hmt
// Contributors: nickg
// Date: 1997-09-08
// Purpose: share unambiguously sized types.
// Description: we typedef [cyg_][u]int8,16,32 &c for general use.
// Usage: #include "cyg/infra/cyg_type.h"
// ...
// cyg_int32 my_32bit_integer;
//
//####DESCRIPTIONEND####
//
#include <stddef.h> // Definition of NULL from the compiler
// -------------------------------------------------------------------------
// Some useful macros. These are defined here by default.
// __externC is used in mixed C/C++ headers to force C linkage on an external
// definition. It avoids having to put all sorts of ifdefs in.
#ifdef __cplusplus
# define __externC extern "C"
#else
# define __externC extern
#endif
// Also define externC for now - but it is deprecated
#define externC __externC
// -------------------------------------------------------------------------
// The header <basetype.h> defines the base types used here. It is
// supplied either by the target architecture HAL, or by the host
// porting kit. They are all defined as macros, and only those that
// make choices other than the defaults given below need be defined.
#define CYG_LSBFIRST 1234
#define CYG_MSBFIRST 4321
#include <cyg/hal/basetype.h>
#if (CYG_BYTEORDER != CYG_LSBFIRST) && (CYG_BYTEORDER != CYG_MSBFIRST)
# error You must define CYG_BYTEORDER to equal CYG_LSBFIRST or CYG_MSBFIRST
#endif
#ifndef CYG_DOUBLE_BYTEORDER
#define CYG_DOUBLE_BYTEORDER CYG_BYTEORDER
#endif
#ifndef cyg_halint8
# define cyg_halint8 char
#endif
#ifndef cyg_halint16
# define cyg_halint16 short
#endif
#ifndef cyg_halint32
# define cyg_halint32 int
#endif
#ifndef cyg_halint64
# define cyg_halint64 long long
#endif
#ifndef cyg_halcount8
# define cyg_halcount8 int
#endif
#ifndef cyg_halcount16
# define cyg_halcount16 int
#endif
#ifndef cyg_halcount32
# define cyg_halcount32 int
#endif
#ifndef cyg_halcount64
# define cyg_halcount64 long long
#endif
#ifndef cyg_haladdress
# define cyg_haladdress cyg_uint32
#endif
#ifndef cyg_haladdrword
# define cyg_haladdrword cyg_uint32
#endif
#ifndef cyg_halbool
# define cyg_halbool int
#endif
#ifndef cyg_halatomic
# define cyg_halatomic cyg_halint8
#endif
// -------------------------------------------------------------------------
// Provide a default architecture alignment
// This may be overridden in basetype.h if necessary.
// These should be straightforward numbers to allow use in assembly.
#ifndef CYGARC_ALIGNMENT
# define CYGARC_ALIGNMENT 8
#endif
// And corresponding power of two alignment
#ifndef CYGARC_P2ALIGNMENT
# define CYGARC_P2ALIGNMENT 3
#endif
#if (CYGARC_ALIGNMENT) != (1 << CYGARC_P2ALIGNMENT)
# error "Inconsistent CYGARC_ALIGNMENT and CYGARC_P2ALIGNMENT values"
#endif
// -------------------------------------------------------------------------
// The obvious few that compilers may define for you.
// But in case they don't:
#ifndef NULL
# define NULL 0
#endif
#ifndef __cplusplus
typedef cyg_halbool bool;
# ifndef false
# define false 0
# endif
# ifndef true
# define true (!false)
# endif
#endif
// -------------------------------------------------------------------------
// Allow creation of procedure-like macros that are a single statement,
// and must be followed by a semi-colon
#define CYG_MACRO_START do {
#define CYG_MACRO_END } while (0)
#define CYG_EMPTY_STATEMENT CYG_MACRO_START CYG_MACRO_END
#define CYG_UNUSED_PARAM( _type_, _name_ ) CYG_MACRO_START \
_type_ __tmp1 = (_name_); \
_type_ __tmp2 = __tmp1; \
__tmp1 = __tmp2; \
CYG_MACRO_END
// -------------------------------------------------------------------------
// Reference a symbol without explicitly making use of it. Ensures that
// the object containing the symbol will be included when linking.
#define CYG_REFERENCE_OBJECT(__object__) \
CYG_MACRO_START \
static void *__cygvar_discard_me__ __attribute__ ((unused)) = \
&(__object__); \
CYG_MACRO_END
// -------------------------------------------------------------------------
// Define basic types for using integers in memory and structures;
// depends on compiler defaults and CPU type.
typedef unsigned cyg_halint8 cyg_uint8 ;
typedef signed cyg_halint8 cyg_int8 ;
typedef unsigned cyg_halint16 cyg_uint16 ;
typedef signed cyg_halint16 cyg_int16 ;
typedef unsigned cyg_halint32 cyg_uint32 ;
typedef signed cyg_halint32 cyg_int32 ;
typedef unsigned cyg_halint64 cyg_uint64 ;
typedef signed cyg_halint64 cyg_int64 ;
typedef cyg_halbool cyg_bool ;
// -------------------------------------------------------------------------
// Define types for using integers in registers for looping and the like;
// depends on CPU type, choose what it is most comfortable with, with at
// least the range required.
typedef unsigned cyg_halcount8 cyg_ucount8 ;
typedef signed cyg_halcount8 cyg_count8 ;
typedef unsigned cyg_halcount16 cyg_ucount16 ;
typedef signed cyg_halcount16 cyg_count16 ;
typedef unsigned cyg_halcount32 cyg_ucount32 ;
typedef signed cyg_halcount32 cyg_count32 ;
typedef unsigned cyg_halcount64 cyg_ucount64 ;
typedef signed cyg_halcount64 cyg_count64 ;
// -------------------------------------------------------------------------
// Define a type to be used for atomic accesses. This type is guaranteed
// to be read or written in a single uninterruptible operation. This type
// is at least a single byte.
typedef volatile unsigned cyg_halatomic cyg_atomic;
typedef volatile unsigned cyg_halatomic CYG_ATOMIC;
// -------------------------------------------------------------------------
// Define types for access plain, on-the-metal memory or devices.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -