20 #ifndef __AVR_MCU_SECTION_H__
21 #define __AVR_MCU_SECTION_H__
72 #define _MMCU_ __attribute__((section(".mmcu")))
74 struct avr_mmcu_long_t {
80 struct avr_mmcu_string_t {
86 struct avr_mmcu_addr_t {
92 struct avr_mmcu_vcd_trace_t {
100 #define AVR_MCU_STRING(_tag, _str) \
101 const struct avr_mmcu_string_t _##_tag _MMCU_ = { \
103 .len = sizeof(_str), \
111 #define DO_CONCAT2(_a, _b) _a##_b
112 #define DO_CONCAT(_a, _b) DO_CONCAT2(_a,_b)
114 #define AVR_MCU_LONG(_tag, _val) \
115 const struct avr_mmcu_long_t DO_CONCAT(DO_CONCAT(_, _tag), __LINE__) _MMCU_ = { \
117 .len = sizeof(uint32_t), \
121 #define AVR_MCU_BYTE(_tag, _val) \
122 const uint8_t _##_tag _MMCU_ = { _tag, 1, _val }
135 #define AVR_MCU_VCD_SYMBOL(_name) \
136 .tag = AVR_MMCU_TAG_VCD_TRACE, \
137 .len = sizeof(struct avr_mmcu_vcd_trace_t) - 2 + sizeof(_name), \
144 #define AVR_MCU_VCD_FILE(_name, _period) \
145 AVR_MCU_STRING(AVR_MMCU_TAG_VCD_FILENAME, _name); \
146 AVR_MCU_LONG(AVR_MMCU_TAG_VCD_PERIOD, _period)
154 #define AVR_MCU_SIMAVR_COMMAND(_register) \
155 const struct avr_mmcu_addr_t _simavr_command_register _MMCU_ = { \
156 .tag = AVR_MMCU_TAG_SIMAVR_COMMAND, \
157 .len = sizeof(void *), \
158 .what = (void*)_register, \
166 #define AVR_MCU_SIMAVR_CONSOLE(_register) \
167 const struct avr_mmcu_addr_t _simavr_console_register _MMCU_ = { \
168 .tag = AVR_MMCU_TAG_SIMAVR_CONSOLE, \
169 .len = sizeof(void *), \
170 .what = (void*)_register, \
179 #define AVR_MCU_EXTERNAL_PORT_PULL(_port, _mask, _val) \
180 AVR_MCU_LONG(AVR_MMCU_TAG_PORT_EXTERNAL_PULL, \
181 (((unsigned long)((_port)&0xff) << 16) | \
182 ((unsigned long)((_mask)&0xff) << 8) | \
191 #define AVR_MCU_VOLTAGES(_vcc, _avcc, _aref) \
192 AVR_MCU_LONG(AVR_MMCU_TAG_VCC, (_vcc)); \
193 AVR_MCU_LONG(AVR_MMCU_TAG_AVCC, (_avcc)); \
194 AVR_MCU_LONG(AVR_MMCU_TAG_AREF, (_aref));
200 #define AVR_MCU(_speed, _name) \
201 const uint8_t _mmcu[2] _MMCU_ = { AVR_MMCU_TAG, 0 }; \
202 AVR_MCU_STRING(AVR_MMCU_TAG_NAME, _name); \
203 AVR_MCU_LONG(AVR_MMCU_TAG_FREQUENCY, _speed)
Definition: avr_mcu_section.h:46
Definition: avr_mcu_section.h:57
Definition: avr_mcu_section.h:59
Definition: avr_mcu_section.h:50
Definition: avr_mcu_section.h:65
Definition: avr_mcu_section.h:47
Definition: avr_mcu_section.h:49
Definition: avr_mcu_section.h:58
Definition: avr_mcu_section.h:52
Definition: avr_mcu_section.h:60
Definition: avr_mcu_section.h:64
Definition: avr_mcu_section.h:51
Definition: avr_mcu_section.h:56
Definition: avr_mcu_section.h:45
Definition: avr_mcu_section.h:67
Definition: avr_mcu_section.h:55
static __attribute__((unused))
Definition: avr_twi.c:83
Definition: avr_mcu_section.h:66
Definition: avr_mcu_section.h:48
Definition: avr_mcu_section.h:53
Definition: avr_mcu_section.h:54