📄 cyg_type.h
字号:
typedef cyg_uint32 CYG_WORD;
typedef cyg_uint8 CYG_BYTE;
typedef cyg_uint16 CYG_WORD16;
typedef cyg_uint32 CYG_WORD32;
typedef cyg_uint64 CYG_WORD64;
typedef cyg_haladdress CYG_ADDRESS;
typedef cyg_haladdrword CYG_ADDRWORD;
// -------------------------------------------------------------------------
// Number of elements in a (statically allocated) array.
#define CYG_NELEM(a) (sizeof(a) / sizeof((a)[0]))
// -------------------------------------------------------------------------
// Constructor ordering macros. These are added as annotations to all
// static objects to order the constuctors appropriately.
#if defined(__cplusplus) && defined(__GNUC__) && \
!defined(CYGBLD_ATTRIB_INIT_PRI)
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) __attribute__((init_priority(_pri_)))
#elif !defined(CYGBLD_ATTRIB_INIT_PRI)
// FIXME: should maybe just bomb out if this is attempted anywhere else?
// Not sure
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ )
#endif
// The following will be removed eventually as it doesn't allow the use of
// e.g. pri+5 format
#define CYG_INIT_PRIORITY( _pri_ ) CYGBLD_ATTRIB_INIT_PRI( CYG_INIT_##_pri_ )
#define CYGBLD_ATTRIB_INIT_BEFORE( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_-100)
#define CYGBLD_ATTRIB_INIT_AFTER( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_+100)
#define CYG_INIT_HAL 10000
#define CYG_INIT_SCHEDULER 11000
#define CYG_INIT_INTERRUPTS 12000
#define CYG_INIT_DRIVERS 13000
#define CYG_INIT_CLOCK 14000
#define CYG_INIT_IDLE_THREAD 15000
#define CYG_INIT_THREADS 16000
#define CYG_INIT_KERNEL 40000
#define CYG_INIT_MEMALLOC 47000
#define CYG_INIT_IO 49000
#define CYG_INIT_IO_FS 50000
#define CYG_INIT_LIBC 52000
#define CYG_INIT_COMPAT 55000
#define CYG_INIT_APPLICATION 60000
#define CYG_INIT_PREDEFAULT 65534
#define CYG_INIT_DEFAULT 65535
// -------------------------------------------------------------------------
// Label name macros. Some toolsets generate labels with initial
// underscores and others don't. CYG_LABEL_NAME should be used on
// labels in C/C++ code that are defined in assembly code or linker
// scripts. CYG_LABEL_DEFN is for use in assembly code and linker
// scripts where we need to manufacture labels that can be used from
// C/C++.
// These are default implementations that should work for most targets.
// They may be overridden in basetype.h if necessary.
#ifndef CYG_LABEL_NAME
#define CYG_LABEL_NAME(_name_) _name_
#endif
#ifndef CYG_LABEL_DEFN
#define CYG_LABEL_DEFN(_label) _label
#endif
// -------------------------------------------------------------------------
// COMPILER-SPECIFIC STUFF
#ifdef __GNUC__
#if defined(__GNU_PATCHLEVEL__)
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#else
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)
#endif
// Force a 'C' routine to be called like a 'C++' contructor
# if !defined(CYGBLD_ATTRIB_CONSTRUCTOR)
# define CYGBLD_ATTRIB_CONSTRUCTOR __attribute__((constructor))
# endif
// Define a compiler-specific rune for saying a function doesn't return
# if !defined(CYGBLD_ATTRIB_NORET)
# define CYGBLD_ATTRIB_NORET __attribute__((noreturn))
# endif
// How to define weak symbols - this is only relevant for ELF and a.out,
// but that won't be a problem for eCos
# if !defined(CYGBLD_ATTRIB_WEAK)
# define CYGBLD_ATTRIB_WEAK __attribute__ ((weak))
# endif
// How to define alias to symbols. Just pass in the symbol itself, not
// the string name of the symbol
# if !defined(CYGBLD_ATTRIB_ALIAS)
# define CYGBLD_ATTRIB_ALIAS(__symbol__) \
__attribute__ ((alias (#__symbol__)))
# endif
// This effectively does the reverse of the previous macro. It defines
// a name that the attributed variable or function will actually have
// in assembler.
# if !defined(CYGBLD_ATTRIB_ASM_ALIAS)
# define __Str(x) #x
# define __Xstr(x) __Str(x)
# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) \
__asm__ ( __Xstr( CYG_LABEL_DEFN( __symbol__ ) ) )
# endif
// Shows that a function returns the same value when given the same args, but
// note this can't be used if there are pointer args
# if !defined(CYGBLD_ATTRIB_CONST)
# define CYGBLD_ATTRIB_CONST __attribute__((const))
#endif
// Assign a defined variable to a specific section
# if !defined(CYGBLD_ATTRIB_SECTION)
# define CYGBLD_ATTRIB_SECTION(__sect__) __attribute__((section (__sect__)))
# endif
// Give a type or object explicit minimum alignment
# if !defined(CYGBLD_ATTRIB_ALIGN)
# define CYGBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__)))
# endif
# if !defined(CYGBLD_ATTRIB_ALIGN_MAX)
# define CYGBLD_ATTRIB_ALIGN_MAX __attribute__((aligned))
# endif
# if !defined(CYGBLD_ATTRIB_ALIGNOFTYPE)
# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) \
__attribute__((aligned(__alignof__( _type_ ))))
# endif
// Teach compiler how to check format of printf-like functions
# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) \
__attribute__((format (printf, __format__, __args__)))
// Teach compiler how to check format of scanf-like functions
# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__) \
__attribute__((format (scanf, __format__, __args__)))
// Teach compiler how to check format of strftime-like functions
# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) \
__attribute__((format (strftime, __format__, __args__)))
// Tell the compiler not to throw away a variable or function. Only
// available on 3.3.4 or above. Old version's didn't throw them away,
// but using the unused attribute should stop warnings.
# if !defined(CYGBLD_ATTRIB_USED)
# if __GNUC_VERSION__ >= 30404
# define CYGBLD_ATTRIB_USED __attribute__((used))
# else
# define CYGBLD_ATTRIB_USED __attribute__((unused))
# endif
# endif
#else // non-GNU
# define CYGBLD_ATTRIB_CONSTRUCTOR
# define CYGBLD_ATTRIB_NORET
// This intentionally gives an error only if we actually try to
// use it. #error would give an error if we simply can't.
// FIXME: Had to disarm the bomb - the CYGBLD_ATTRIB_WEAK macro is now
// (indirectly) used in host tools.
# define CYGBLD_ATTRIB_WEAK /* !!!-- Attribute weak not defined --!!! */
# define CYGBLD_ATTRIB_ALIAS(__x__) !!!-- Attribute alias not defined --!!!
# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) !!!-- Asm alias not defined --!!!
# define CYGBLD_ATTRIB_CONST
# define CYGBLD_ATTRIB_ALIGN(__align__) !!!-- Alignment alias not defined --!!!
# define CYGBLD_ATTRIB_ALIGN_MAX !!!-- Alignment alias not defined --!!!
# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) !!!-- Alignment alias not defined --!!!
# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__)
# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__)
# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__)
#endif
// How to define weak aliases. Currently this is simply a mixture of the
// above
# define CYGBLD_ATTRIB_WEAK_ALIAS(__symbol__) \
CYGBLD_ATTRIB_WEAK CYGBLD_ATTRIB_ALIAS(__symbol__)
#ifdef __cplusplus
# define __THROW throw()
#else
# define __THROW
#endif
// -------------------------------------------------------------------------
// Variable annotations
// These annotations may be added to various static variables in the
// HAL and kernel to indicate which component they belong to. These
// are used by some targets to optimize memory placement of these
// variables.
#ifndef CYGBLD_ANNOTATE_VARIABLE_HAL
#define CYGBLD_ANNOTATE_VARIABLE_HAL
#endif
#ifndef CYGBLD_ANNOTATE_VARIABLE_SCHED
#define CYGBLD_ANNOTATE_VARIABLE_SCHED
#endif
#ifndef CYGBLD_ANNOTATE_VARIABLE_CLOCK
#define CYGBLD_ANNOTATE_VARIABLE_CLOCK
#endif
#ifndef CYGBLD_ANNOTATE_VARIABLE_INTR
#define CYGBLD_ANNOTATE_VARIABLE_INTR
#endif
// -------------------------------------------------------------------------
// Various "flavours" of memory regions that can be described by the
// Memory Layout Tool (MLT).
#define CYGMEM_REGION_ATTR_R 0x01 // Region can be read
#define CYGMEM_REGION_ATTR_W 0x02 // Region can be written
// -------------------------------------------------------------------------
#endif // CYGONCE_INFRA_CYG_TYPE_H multiple inclusion protection
// EOF cyg_type.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -