aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h
blob: 025542e3f4a72546e2ba178b579913f43effdeae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/** @file _c_arm_macros.h
 *  @brief Define macros to support shared C and ASM headers
 *
 */

/* Copyright (C) 2010 the NxOS developers
 *
 * Module Developed by: TC Wan <tcwan@cs.usm.my>
 *
 * Thanks to Bartli (forum post @ embdev.net ARM programming with GCC/GNU tools forum)
 *
 * See AUTHORS for a full list of the developers.
 *
 * See COPYING for redistribution license
 *
 */

#ifndef __C_ARM_MACROS__
#define __C_ARM_MACROS__


#ifdef __ASSEMBLY__

#define NULL   0x0
#define FALSE   0
#define TRUE    ~FALSE

#define TYPEDEF @
#define FUNCDEF @

  .set last_enum_value, 0
  .macro enum_val name
  .equiv \name, last_enum_value
  .set last_enum_value, last_enum_value + 1
  .endm

#define ENUM_BEGIN  .set last_enum_value, 0

#define ENUM_VAL(name) enum_val name
#define ENUM_VALASSIGN(name, value)            \
  .set last_enum_value, value                 ;\
  enum_val name
#define ENUM_END(enum_name)

#else  /* C Defines */
/** Macro to control typedef generation
 *
 */
#define TYPEDEF typedef

/** Macro to control extern generation
 *
 */
#ifndef FUNCDEF
#define FUNCDEF extern
#endif

/** Macro to control typedef enum generation
 *
 */
#define ENUM_BEGIN typedef enum {

/** Macro to specify enum instance (auto value assignment)
 *
 */
#define ENUM_VAL(name) name,

/** Macro to control enum specification and value assignment
*
*/
#define ENUM_VALASSIGN(name, value) name = value,

/** Macro to control enum named type generation
 *
 */
#define ENUM_END(enum_name) } enum_name;

#endif

/* Example of how to use the ENUM definition macros
ENUM_BEGIN
ENUM_VAL(INIT)
ENUM_VAL(RESET)
ENUM_VAL(CONFIGURED)
ENUM_END(enum_label)
*/

#endif /* __C_ARM_MACROS__ */