From d6014994e06ebe952d51bef2e36a795f624c4b4d Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 17 Feb 2012 18:23:51 +0100 Subject: [PATCH 1/1] init --- Descriptors.c | 386 + Descriptors.h | 111 + Doxygen.conf | 1565 + DualVirtualSerial.aps | 1 + DualVirtualSerial.c | 277 + DualVirtualSerial.h | 79 + LUFA DualVirtualSerial.inf | 106 + autoconf.h | 256 + aversive.h | 251 + aversive/eeprom.h | 41 + aversive/endian.h | 65 + aversive/errno.h | 74 + aversive/error.h | 42 + aversive/irq_lock.h | 73 + aversive/list.h | 532 + aversive/parts.h | 301 + aversive/parts.h~ | 301 + aversive/parts/AT86RF401.h | 215 + aversive/parts/AT89S51.h | 74 + aversive/parts/AT89S52.h | 74 + aversive/parts/AT90CAN128.h | 1622 + aversive/parts/AT90CAN32.h | 1622 + aversive/parts/AT90CAN64.h | 1622 + aversive/parts/AT90PWM2.h | 1226 + aversive/parts/AT90PWM216.h | 1232 + aversive/parts/AT90PWM2B.h | 1232 + aversive/parts/AT90PWM3.h | 1441 + aversive/parts/AT90PWM316.h | 1450 + aversive/parts/AT90PWM3B.h | 1450 + aversive/parts/AT90S1200.h | 228 + aversive/parts/AT90S2313.h | 401 + aversive/parts/AT90S2323.h | 181 + aversive/parts/AT90S2343.h | 191 + aversive/parts/AT90S4414.h | 566 + aversive/parts/AT90S4433.h | 478 + aversive/parts/AT90S4434.h | 662 + aversive/parts/AT90S8515.h | 569 + aversive/parts/AT90S8515comp.h | 708 + aversive/parts/AT90S8535.h | 662 + aversive/parts/AT90S8535comp.h | 815 + aversive/parts/AT90USB1286.h | 1381 + aversive/parts/AT90USB1287.h | 1598 + aversive/parts/AT90USB1287.h~ | 1599 + aversive/parts/AT90USB162.h | 918 + aversive/parts/AT90USB646.h | 1599 + aversive/parts/AT90USB647.h | 1599 + aversive/parts/AT90USB82.h | 918 + aversive/parts/ATmega103.h | 811 + aversive/parts/ATmega103comp.h | 902 + aversive/parts/ATmega128.h | 1327 + aversive/parts/ATmega1280.h | 2188 + aversive/parts/ATmega1281.h | 1872 + aversive/parts/ATmega1284P.h | 1316 + aversive/parts/ATmega128A.h | 1327 + aversive/parts/ATmega16.h | 825 + aversive/parts/ATmega161.h | 781 + aversive/parts/ATmega161comp.h | 861 + aversive/parts/ATmega162.h | 1065 + aversive/parts/ATmega163.h | 763 + aversive/parts/ATmega164P.h | 1163 + aversive/parts/ATmega165.h | 892 + aversive/parts/ATmega165P.h | 892 + aversive/parts/ATmega168.h | 995 + aversive/parts/ATmega168P.h | 997 + aversive/parts/ATmega168PA.h | 997 + aversive/parts/ATmega169.h | 1052 + aversive/parts/ATmega169P.h | 1058 + aversive/parts/ATmega16A.h | 825 + aversive/parts/ATmega16HVA.h | 683 + aversive/parts/ATmega16U4.h | 1317 + aversive/parts/ATmega2560.h | 2209 + aversive/parts/ATmega2561.h | 1875 + aversive/parts/ATmega32.h | 824 + aversive/parts/ATmega323.h | 817 + aversive/parts/ATmega324P.h | 1163 + aversive/parts/ATmega324PA.h | 1163 + aversive/parts/ATmega325.h | 897 + aversive/parts/ATmega3250.h | 974 + aversive/parts/ATmega3250P.h | 976 + aversive/parts/ATmega325P.h | 900 + aversive/parts/ATmega328P.h | 999 + aversive/parts/ATmega329.h | 1064 + aversive/parts/ATmega3290.h | 1208 + aversive/parts/ATmega3290P.h | 1213 + aversive/parts/ATmega329P.h | 1069 + aversive/parts/ATmega32A.h | 824 + aversive/parts/ATmega32C1.h | 1304 + aversive/parts/ATmega32HVB.h | 882 + aversive/parts/ATmega32M1.h | 1553 + aversive/parts/ATmega32U4.h | 1317 + aversive/parts/ATmega32U6.h | 1375 + aversive/parts/ATmega406.h | 850 + aversive/parts/ATmega48.h | 989 + aversive/parts/ATmega48P.h | 991 + aversive/parts/ATmega64.h | 1328 + aversive/parts/ATmega640.h | 2188 + aversive/parts/ATmega644.h | 1104 + aversive/parts/ATmega644P.h | 1169 + aversive/parts/ATmega645.h | 899 + aversive/parts/ATmega6450.h | 975 + aversive/parts/ATmega649.h | 1065 + aversive/parts/ATmega6490.h | 1209 + aversive/parts/ATmega64A.h | 1328 + aversive/parts/ATmega8.h | 745 + aversive/parts/ATmega8515.h | 708 + aversive/parts/ATmega8535.h | 815 + aversive/parts/ATmega88.h | 995 + aversive/parts/ATmega88P.h | 997 + aversive/parts/ATmega88PA.h | 997 + aversive/parts/ATmega8A.h | 745 + aversive/parts/ATtiny10.h | 376 + aversive/parts/ATtiny11.h | 171 + aversive/parts/ATtiny12.h | 207 + aversive/parts/ATtiny13.h | 360 + aversive/parts/ATtiny13A.h | 368 + aversive/parts/ATtiny15.h | 351 + aversive/parts/ATtiny167.h | 797 + aversive/parts/ATtiny22.h | 186 + aversive/parts/ATtiny2313.h | 641 + aversive/parts/ATtiny24.h | 670 + aversive/parts/ATtiny25.h | 628 + aversive/parts/ATtiny26.h | 418 + aversive/parts/ATtiny261.h | 671 + aversive/parts/ATtiny28.h | 225 + aversive/parts/ATtiny43U.h | 524 + aversive/parts/ATtiny44.h | 673 + aversive/parts/ATtiny45.h | 634 + aversive/parts/ATtiny461.h | 674 + aversive/parts/ATtiny48.h | 873 + aversive/parts/ATtiny84.h | 674 + aversive/parts/ATtiny85.h | 632 + aversive/parts/ATtiny861.h | 675 + aversive/parts/ATtiny88.h | 874 + aversive/parts/ATxmega128A1.h | 74 + aversive/parts/ATxmega128A3.h | 74 + aversive/parts/ATxmega256A3.h | 74 + aversive/parts/ATxmega256A3B.h | 74 + aversive/parts/ATxmega64A1.h | 74 + aversive/parts/ATxmega64A3.h | 74 + aversive/pgmspace.h | 139 + aversive/pgmspace.h~ | 139 + aversive/queue.h | 517 + aversive/timers.h | 196 + aversive/timers.h~ | 196 + aversive/types.h | 57 + aversive/wait.h | 69 + callout.c | 327 + callout.h | 264 + cirbuf.c | 37 + cirbuf.h | 223 + cirbuf_add_buf_head.c | 55 + cirbuf_add_buf_tail.c | 55 + cirbuf_add_head.c | 56 + cirbuf_add_tail.c | 58 + cirbuf_align.c | 90 + cirbuf_del_buf_head.c | 45 + cirbuf_del_buf_tail.c | 45 + cirbuf_del_head.c | 54 + cirbuf_del_tail.c | 56 + cirbuf_get_buf_head.c | 49 + cirbuf_get_buf_tail.c | 51 + cirbuf_get_head.c | 34 + cirbuf_get_tail.c | 34 + clock_time.h | 95 + cmdline.c | 196 + cmdline.h | 57 + commands.c | 1255 + commands2.c | 1339 + commands_gen.c | 371 + cscope.out | 94950 +++++++++++++++++++++++++++++++ diag_host.c | 1 + diagnostic.h | 43 + diagnostic_config.h | 44 + error.c | 110 + error.h | 140 + error_config.h | 31 + general_errors.h | 80 + i2c_config.h | 30 + int_show.c | 56 + main.c | 552 + main.h | 99 + makefile | 823 + parse.c | 443 + parse.h | 146 + parse_atcmd.c | 134 + parse_atcmd.h | 64 + parse_monitor.c | 119 + parse_monitor.h | 69 + parse_neighbor.c | 138 + parse_neighbor.h | 60 + parse_num.c | 457 + parse_num.h | 53 + parse_string.c | 169 + parse_string.h | 45 + pid_config.h | 30 + rc_proto.c | 48 + rc_proto.h | 28 + rdline.c | 584 + rdline.h | 192 + rdline_config.h | 0 scheduler.c | 68 + scheduler.h | 198 + scheduler_add.c | 81 + scheduler_config.h | 51 + scheduler_del.c | 43 + scheduler_dump.c | 53 + scheduler_host.c | 47 + scheduler_interrupt.c | 203 + scheduler_private.h | 74 + scheduler_stats.c | 48 + scheduler_stats.h | 62 + spi_config.h | 36 + stack_space.c | 100 + stackdump.c | 34 + stackdump.h | 22 + time.c | 161 + time_config.h | 23 + timer.h | 83 + timer0_getset.c | 35 + timer0_prescaler.c | 48 + timer0_register_OC_at_tics.c | 46 + timer0_register_OC_in_us.c | 46 + timer0_register_OV.c | 37 + timer0_startstop.c | 36 + timer1_getset.c | 35 + timer1_prescaler.c | 48 + timer1_register_OC_at_tics.c | 46 + timer1_register_OC_in_us.c | 46 + timer1_register_OV.c | 38 + timer1_startstop.c | 35 + timer2_getset.c | 34 + timer2_prescaler.c | 48 + timer2_register_OC_at_tics.c | 38 + timer2_register_OC_in_us.c | 38 + timer2_register_OV.c | 38 + timer2_startstop.c | 35 + timer3_getset.c | 34 + timer3_prescaler.c | 48 + timer3_register_OC_at_tics.c | 46 + timer3_register_OC_in_us.c | 46 + timer3_register_OV.c | 38 + timer3_startstop.c | 35 + timer4_getset.c | 34 + timer4_prescaler.c | 48 + timer4_register_OC_at_tics.c | 46 + timer4_register_OC_in_us.c | 46 + timer4_register_OV.c | 38 + timer4_startstop.c | 35 + timer5_getset.c | 34 + timer5_prescaler.c | 48 + timer5_register_OC_at_tics.c | 46 + timer5_register_OC_in_us.c | 46 + timer5_register_OV.c | 38 + timer5_startstop.c | 35 + timer_conf_check.c | 493 + timer_config.h | 36 + timer_declarations.h | 94 + timer_definitions.h | 190 + timer_host.c | 24 + timer_init.c | 64 + timer_intr.c | 154 + timer_intr.h | 30 + timer_prescaler.h | 1113 + uart.c | 280 + uart.h | 194 + uart_config.h | 61 + uart_defs.h | 234 + uart_dev_io.c | 114 + uart_errors.h | 67 + uart_events.c | 51 + uart_getconf.c | 177 + uart_host.c | 84 + uart_host.h | 25 + uart_private.h | 93 + uart_recv.c | 34 + uart_recv9.c | 34 + uart_recv9_nowait.c | 53 + uart_recv_nowait.c | 53 + uart_send.c | 48 + uart_send9.c | 48 + uart_send9_nowait.c | 65 + uart_send_nowait.c | 69 + uart_setconf.c | 272 + vt100.c | 146 + vt100.h | 103 + xbee.c | 105 + xbee.h | 88 + xbee_atcmd.c | 1168 + xbee_atcmd.h | 61 + xbee_buf.c | 184 + xbee_buf.h | 86 + xbee_neighbor.c | 100 + xbee_neighbor.h | 58 + xbee_proto.c | 311 + xbee_proto.h | 152 + xbee_stats.c | 81 + xbee_stats.h | 67 + 297 files changed, 230868 insertions(+) create mode 100644 Descriptors.c create mode 100644 Descriptors.h create mode 100644 Doxygen.conf create mode 100644 DualVirtualSerial.aps create mode 100644 DualVirtualSerial.c create mode 100644 DualVirtualSerial.h create mode 100644 LUFA DualVirtualSerial.inf create mode 100644 autoconf.h create mode 100644 aversive.h create mode 100644 aversive/eeprom.h create mode 100644 aversive/endian.h create mode 100644 aversive/errno.h create mode 100644 aversive/error.h create mode 100644 aversive/irq_lock.h create mode 100644 aversive/list.h create mode 100644 aversive/parts.h create mode 100644 aversive/parts.h~ create mode 100644 aversive/parts/AT86RF401.h create mode 100644 aversive/parts/AT89S51.h create mode 100644 aversive/parts/AT89S52.h create mode 100644 aversive/parts/AT90CAN128.h create mode 100644 aversive/parts/AT90CAN32.h create mode 100644 aversive/parts/AT90CAN64.h create mode 100644 aversive/parts/AT90PWM2.h create mode 100644 aversive/parts/AT90PWM216.h create mode 100644 aversive/parts/AT90PWM2B.h create mode 100644 aversive/parts/AT90PWM3.h create mode 100644 aversive/parts/AT90PWM316.h create mode 100644 aversive/parts/AT90PWM3B.h create mode 100644 aversive/parts/AT90S1200.h create mode 100644 aversive/parts/AT90S2313.h create mode 100644 aversive/parts/AT90S2323.h create mode 100644 aversive/parts/AT90S2343.h create mode 100644 aversive/parts/AT90S4414.h create mode 100644 aversive/parts/AT90S4433.h create mode 100644 aversive/parts/AT90S4434.h create mode 100644 aversive/parts/AT90S8515.h create mode 100644 aversive/parts/AT90S8515comp.h create mode 100644 aversive/parts/AT90S8535.h create mode 100644 aversive/parts/AT90S8535comp.h create mode 100644 aversive/parts/AT90USB1286.h create mode 100644 aversive/parts/AT90USB1287.h create mode 100644 aversive/parts/AT90USB1287.h~ create mode 100644 aversive/parts/AT90USB162.h create mode 100644 aversive/parts/AT90USB646.h create mode 100644 aversive/parts/AT90USB647.h create mode 100644 aversive/parts/AT90USB82.h create mode 100644 aversive/parts/ATmega103.h create mode 100644 aversive/parts/ATmega103comp.h create mode 100644 aversive/parts/ATmega128.h create mode 100644 aversive/parts/ATmega1280.h create mode 100644 aversive/parts/ATmega1281.h create mode 100644 aversive/parts/ATmega1284P.h create mode 100644 aversive/parts/ATmega128A.h create mode 100644 aversive/parts/ATmega16.h create mode 100644 aversive/parts/ATmega161.h create mode 100644 aversive/parts/ATmega161comp.h create mode 100644 aversive/parts/ATmega162.h create mode 100644 aversive/parts/ATmega163.h create mode 100644 aversive/parts/ATmega164P.h create mode 100644 aversive/parts/ATmega165.h create mode 100644 aversive/parts/ATmega165P.h create mode 100644 aversive/parts/ATmega168.h create mode 100644 aversive/parts/ATmega168P.h create mode 100644 aversive/parts/ATmega168PA.h create mode 100644 aversive/parts/ATmega169.h create mode 100644 aversive/parts/ATmega169P.h create mode 100644 aversive/parts/ATmega16A.h create mode 100644 aversive/parts/ATmega16HVA.h create mode 100644 aversive/parts/ATmega16U4.h create mode 100644 aversive/parts/ATmega2560.h create mode 100644 aversive/parts/ATmega2561.h create mode 100644 aversive/parts/ATmega32.h create mode 100644 aversive/parts/ATmega323.h create mode 100644 aversive/parts/ATmega324P.h create mode 100644 aversive/parts/ATmega324PA.h create mode 100644 aversive/parts/ATmega325.h create mode 100644 aversive/parts/ATmega3250.h create mode 100644 aversive/parts/ATmega3250P.h create mode 100644 aversive/parts/ATmega325P.h create mode 100644 aversive/parts/ATmega328P.h create mode 100644 aversive/parts/ATmega329.h create mode 100644 aversive/parts/ATmega3290.h create mode 100644 aversive/parts/ATmega3290P.h create mode 100644 aversive/parts/ATmega329P.h create mode 100644 aversive/parts/ATmega32A.h create mode 100644 aversive/parts/ATmega32C1.h create mode 100644 aversive/parts/ATmega32HVB.h create mode 100644 aversive/parts/ATmega32M1.h create mode 100644 aversive/parts/ATmega32U4.h create mode 100644 aversive/parts/ATmega32U6.h create mode 100644 aversive/parts/ATmega406.h create mode 100644 aversive/parts/ATmega48.h create mode 100644 aversive/parts/ATmega48P.h create mode 100644 aversive/parts/ATmega64.h create mode 100644 aversive/parts/ATmega640.h create mode 100644 aversive/parts/ATmega644.h create mode 100644 aversive/parts/ATmega644P.h create mode 100644 aversive/parts/ATmega645.h create mode 100644 aversive/parts/ATmega6450.h create mode 100644 aversive/parts/ATmega649.h create mode 100644 aversive/parts/ATmega6490.h create mode 100644 aversive/parts/ATmega64A.h create mode 100644 aversive/parts/ATmega8.h create mode 100644 aversive/parts/ATmega8515.h create mode 100644 aversive/parts/ATmega8535.h create mode 100644 aversive/parts/ATmega88.h create mode 100644 aversive/parts/ATmega88P.h create mode 100644 aversive/parts/ATmega88PA.h create mode 100644 aversive/parts/ATmega8A.h create mode 100644 aversive/parts/ATtiny10.h create mode 100644 aversive/parts/ATtiny11.h create mode 100644 aversive/parts/ATtiny12.h create mode 100644 aversive/parts/ATtiny13.h create mode 100644 aversive/parts/ATtiny13A.h create mode 100644 aversive/parts/ATtiny15.h create mode 100644 aversive/parts/ATtiny167.h create mode 100644 aversive/parts/ATtiny22.h create mode 100644 aversive/parts/ATtiny2313.h create mode 100644 aversive/parts/ATtiny24.h create mode 100644 aversive/parts/ATtiny25.h create mode 100644 aversive/parts/ATtiny26.h create mode 100644 aversive/parts/ATtiny261.h create mode 100644 aversive/parts/ATtiny28.h create mode 100644 aversive/parts/ATtiny43U.h create mode 100644 aversive/parts/ATtiny44.h create mode 100644 aversive/parts/ATtiny45.h create mode 100644 aversive/parts/ATtiny461.h create mode 100644 aversive/parts/ATtiny48.h create mode 100644 aversive/parts/ATtiny84.h create mode 100644 aversive/parts/ATtiny85.h create mode 100644 aversive/parts/ATtiny861.h create mode 100644 aversive/parts/ATtiny88.h create mode 100644 aversive/parts/ATxmega128A1.h create mode 100644 aversive/parts/ATxmega128A3.h create mode 100644 aversive/parts/ATxmega256A3.h create mode 100644 aversive/parts/ATxmega256A3B.h create mode 100644 aversive/parts/ATxmega64A1.h create mode 100644 aversive/parts/ATxmega64A3.h create mode 100644 aversive/pgmspace.h create mode 100644 aversive/pgmspace.h~ create mode 100644 aversive/queue.h create mode 100644 aversive/timers.h create mode 100644 aversive/timers.h~ create mode 100644 aversive/types.h create mode 100644 aversive/wait.h create mode 100644 callout.c create mode 100644 callout.h create mode 100644 cirbuf.c create mode 100644 cirbuf.h create mode 100644 cirbuf_add_buf_head.c create mode 100644 cirbuf_add_buf_tail.c create mode 100644 cirbuf_add_head.c create mode 100644 cirbuf_add_tail.c create mode 100644 cirbuf_align.c create mode 100644 cirbuf_del_buf_head.c create mode 100644 cirbuf_del_buf_tail.c create mode 100644 cirbuf_del_head.c create mode 100644 cirbuf_del_tail.c create mode 100644 cirbuf_get_buf_head.c create mode 100644 cirbuf_get_buf_tail.c create mode 100644 cirbuf_get_head.c create mode 100644 cirbuf_get_tail.c create mode 100644 clock_time.h create mode 100644 cmdline.c create mode 100644 cmdline.h create mode 100644 commands.c create mode 100644 commands2.c create mode 100644 commands_gen.c create mode 100644 cscope.out create mode 100644 diag_host.c create mode 100644 diagnostic.h create mode 100644 diagnostic_config.h create mode 100644 error.c create mode 100644 error.h create mode 100644 error_config.h create mode 100644 general_errors.h create mode 100644 i2c_config.h create mode 100644 int_show.c create mode 100644 main.c create mode 100644 main.h create mode 100644 makefile create mode 100644 parse.c create mode 100644 parse.h create mode 100644 parse_atcmd.c create mode 100644 parse_atcmd.h create mode 100644 parse_monitor.c create mode 100644 parse_monitor.h create mode 100644 parse_neighbor.c create mode 100644 parse_neighbor.h create mode 100644 parse_num.c create mode 100644 parse_num.h create mode 100644 parse_string.c create mode 100644 parse_string.h create mode 100644 pid_config.h create mode 100644 rc_proto.c create mode 100644 rc_proto.h create mode 100644 rdline.c create mode 100644 rdline.h create mode 100644 rdline_config.h create mode 100644 scheduler.c create mode 100644 scheduler.h create mode 100644 scheduler_add.c create mode 100644 scheduler_config.h create mode 100644 scheduler_del.c create mode 100644 scheduler_dump.c create mode 100644 scheduler_host.c create mode 100644 scheduler_interrupt.c create mode 100644 scheduler_private.h create mode 100644 scheduler_stats.c create mode 100644 scheduler_stats.h create mode 100644 spi_config.h create mode 100644 stack_space.c create mode 100644 stackdump.c create mode 100644 stackdump.h create mode 100644 time.c create mode 100644 time_config.h create mode 100644 timer.h create mode 100644 timer0_getset.c create mode 100644 timer0_prescaler.c create mode 100644 timer0_register_OC_at_tics.c create mode 100644 timer0_register_OC_in_us.c create mode 100644 timer0_register_OV.c create mode 100644 timer0_startstop.c create mode 100644 timer1_getset.c create mode 100644 timer1_prescaler.c create mode 100644 timer1_register_OC_at_tics.c create mode 100644 timer1_register_OC_in_us.c create mode 100644 timer1_register_OV.c create mode 100644 timer1_startstop.c create mode 100644 timer2_getset.c create mode 100644 timer2_prescaler.c create mode 100644 timer2_register_OC_at_tics.c create mode 100644 timer2_register_OC_in_us.c create mode 100644 timer2_register_OV.c create mode 100644 timer2_startstop.c create mode 100644 timer3_getset.c create mode 100644 timer3_prescaler.c create mode 100644 timer3_register_OC_at_tics.c create mode 100644 timer3_register_OC_in_us.c create mode 100644 timer3_register_OV.c create mode 100644 timer3_startstop.c create mode 100644 timer4_getset.c create mode 100644 timer4_prescaler.c create mode 100644 timer4_register_OC_at_tics.c create mode 100644 timer4_register_OC_in_us.c create mode 100644 timer4_register_OV.c create mode 100644 timer4_startstop.c create mode 100644 timer5_getset.c create mode 100644 timer5_prescaler.c create mode 100644 timer5_register_OC_at_tics.c create mode 100644 timer5_register_OC_in_us.c create mode 100644 timer5_register_OV.c create mode 100644 timer5_startstop.c create mode 100644 timer_conf_check.c create mode 100644 timer_config.h create mode 100644 timer_declarations.h create mode 100644 timer_definitions.h create mode 100644 timer_host.c create mode 100644 timer_init.c create mode 100644 timer_intr.c create mode 100644 timer_intr.h create mode 100644 timer_prescaler.h create mode 100644 uart.c create mode 100644 uart.h create mode 100644 uart_config.h create mode 100644 uart_defs.h create mode 100644 uart_dev_io.c create mode 100644 uart_errors.h create mode 100644 uart_events.c create mode 100644 uart_getconf.c create mode 100644 uart_host.c create mode 100644 uart_host.h create mode 100644 uart_private.h create mode 100644 uart_recv.c create mode 100644 uart_recv9.c create mode 100644 uart_recv9_nowait.c create mode 100644 uart_recv_nowait.c create mode 100644 uart_send.c create mode 100644 uart_send9.c create mode 100644 uart_send9_nowait.c create mode 100644 uart_send_nowait.c create mode 100644 uart_setconf.c create mode 100644 vt100.c create mode 100644 vt100.h create mode 100644 xbee.c create mode 100644 xbee.h create mode 100644 xbee_atcmd.c create mode 100644 xbee_atcmd.h create mode 100644 xbee_buf.c create mode 100644 xbee_buf.h create mode 100644 xbee_neighbor.c create mode 100644 xbee_neighbor.h create mode 100644 xbee_proto.c create mode 100644 xbee_proto.h create mode 100644 xbee_stats.c create mode 100644 xbee_stats.h diff --git a/Descriptors.c b/Descriptors.c new file mode 100644 index 0000000..ff1d09e --- /dev/null +++ b/Descriptors.c @@ -0,0 +1,386 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2011. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + +/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as + * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL. + * This allows the host to track a device across insertions on different ports, allowing them to retain allocated + * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices + * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value + * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and + * port location). + */ +#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR) + #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor. +#endif + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(01.10), + .Class = USB_CSCP_IADDeviceClass, + .SubClass = USB_CSCP_IADDeviceSubclass, + .Protocol = USB_CSCP_IADDeviceProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, + .ProductID = 0x204E, + .ReleaseNumber = VERSION_BCD(00.01), + + .ManufacturerStrIndex = 0x01, + .ProductStrIndex = 0x02, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 4, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .CDC1_IAD = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation}, + + .FirstInterfaceIndex = 0, + .TotalInterfaces = 2, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .IADStrIndex = NO_DESCRIPTOR + }, + + .CDC1_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 0, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC1_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(01.10), + }, + + .CDC1_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC1_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = 0, + .SlaveInterfaceNumber = 1, + }, + + .CDC1_ManagementEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_IN | CDC1_NOTIFICATION_EPNUM), + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC1_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 1, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC1_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_OUT | CDC1_RX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + }, + + .CDC1_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_IN | CDC1_TX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + }, + + .CDC2_IAD = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation}, + + .FirstInterfaceIndex = 2, + .TotalInterfaces = 2, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .IADStrIndex = NO_DESCRIPTOR + }, + + .CDC2_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 2, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC2_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(01.10), + }, + + .CDC2_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC2_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = 2, + .SlaveInterfaceNumber = 3, + }, + + .CDC2_ManagementEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_IN | CDC2_NOTIFICATION_EPNUM), + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC2_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 3, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC2_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_OUT | CDC2_RX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + }, + + .CDC2_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DIR_IN | CDC2_TX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +const USB_Descriptor_String_t PROGMEM LanguageString = +{ + .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, + + .UnicodeString = {LANGUAGE_ID_ENG} +}; + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ManufacturerString = +{ + .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, + + .UnicodeString = L"Dean Camera" +}; + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ProductString = +{ + .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String}, + + .UnicodeString = L"LUFA Dual CDC Demo" +}; + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = &DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case 0x00: + Address = &LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + break; + case 0x01: + Address = &ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + break; + case 0x02: + Address = &ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/Descriptors.h b/Descriptors.h new file mode 100644 index 0000000..d3e9b81 --- /dev/null +++ b/Descriptors.h @@ -0,0 +1,111 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2011. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include + + #include + + /* Macros: */ + /** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */ + #define CDC1_TX_EPNUM 1 + + /** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */ + #define CDC1_RX_EPNUM 2 + + /** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */ + #define CDC1_NOTIFICATION_EPNUM 3 + + /** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */ + #define CDC2_TX_EPNUM 4 + + /** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */ + #define CDC2_RX_EPNUM 5 + + /** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */ + #define CDC2_NOTIFICATION_EPNUM 6 + + /** Size in bytes of the CDC device-to-host notification IN endpoints. */ + #define CDC_NOTIFICATION_EPSIZE 8 + + /** Size in bytes of the CDC data IN and OUT endpoints. */ + #define CDC_TXRX_EPSIZE 16 + + /* Type Defines: */ + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + + // First CDC Control Interface + USB_Descriptor_Interface_Association_t CDC1_IAD; + USB_Descriptor_Interface_t CDC1_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC1_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC1_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC1_Functional_Union; + USB_Descriptor_Endpoint_t CDC1_ManagementEndpoint; + + // First CDC Data Interface + USB_Descriptor_Interface_t CDC1_DCI_Interface; + USB_Descriptor_Endpoint_t CDC1_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC1_DataInEndpoint; + + // Second CDC Control Interface + USB_Descriptor_Interface_Association_t CDC2_IAD; + USB_Descriptor_Interface_t CDC2_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC2_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC2_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC2_Functional_Union; + USB_Descriptor_Endpoint_t CDC2_ManagementEndpoint; + + // Second CDC Data Interface + USB_Descriptor_Interface_t CDC2_DCI_Interface; + USB_Descriptor_Endpoint_t CDC2_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC2_DataInEndpoint; + } USB_Descriptor_Configuration_t; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif diff --git a/Doxygen.conf b/Doxygen.conf new file mode 100644 index 0000000..498cff7 --- /dev/null +++ b/Doxygen.conf @@ -0,0 +1,1565 @@ +# Doxyfile 1.6.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "LUFA Library - Dual Virtual Serial Device Demo" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.0.0 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./Documentation/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = NO + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = NO + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ./ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.h \ + *.c \ + *.txt + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = Documentation/ + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = __* \ + INCLUDE_FROM_* + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = NO + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = NO + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = YES + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = YES + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 1 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = NO + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = __DOXYGEN__ \ + PROGMEM + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = NO + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = NO + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = NO + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 15 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 2 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/DualVirtualSerial.aps b/DualVirtualSerial.aps new file mode 100644 index 0000000..78bf27c --- /dev/null +++ b/DualVirtualSerial.aps @@ -0,0 +1 @@ +DualVirtualSerial13-Jul-2010 15:24:2013-Jul-2010 15:25:07241013-Jul-2010 15:24:2044, 18, 0, 685AVR GCCC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Demos\Device\ClassDriver\DualVirtualSerial\AVR ONE!falseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000Descriptors.cDualVirtualSerial.cDescriptors.hDualVirtualSerial.hmakefiledefaultYESmakefileatmega128111DualVirtualSerial.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR-20100110\bin\avr-gcc.exeC:\WinAVR-20100110\utils\bin\make.exe diff --git a/DualVirtualSerial.c b/DualVirtualSerial.c new file mode 100644 index 0000000..f5f4053 --- /dev/null +++ b/DualVirtualSerial.c @@ -0,0 +1,277 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2011. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Main source file for the DualVirtualSerial demo. This file contains the main tasks of + * the demo and is responsible for the initial application hardware configuration. + */ + +#include "DualVirtualSerial.h" + + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_atcmd.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" + +#include "callout.h" +#include "main.h" +#include "cmdline.h" + +volatile uint16_t global_ms; +struct callout_manager cm; + + +/** LUFA CDC Class driver interface configuration and state information. This structure is + * passed to all CDC Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. This is for the first CDC interface, + * which sends strings to the host for each joystick movement. + */ +USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface = + { + .Config = + { + .ControlInterfaceNumber = 0, + + .DataINEndpointNumber = CDC1_TX_EPNUM, + .DataINEndpointSize = CDC_TXRX_EPSIZE, + .DataINEndpointDoubleBank = false, + + .DataOUTEndpointNumber = CDC1_RX_EPNUM, + .DataOUTEndpointSize = CDC_TXRX_EPSIZE, + .DataOUTEndpointDoubleBank = false, + + .NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM, + .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, + .NotificationEndpointDoubleBank = false, + }, + }; + +/** LUFA CDC Class driver interface configuration and state information. This structure is + * passed to all CDC Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. This is for the second CDC interface, + * which echos back all received data from the host. + */ +USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface = + { + .Config = + { + .ControlInterfaceNumber = 2, + + .DataINEndpointNumber = CDC2_TX_EPNUM, + .DataINEndpointSize = CDC_TXRX_EPSIZE, + .DataINEndpointDoubleBank = false, + + .DataOUTEndpointNumber = CDC2_RX_EPNUM, + .DataOUTEndpointSize = CDC_TXRX_EPSIZE, + .DataOUTEndpointDoubleBank = false, + + .NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM, + .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, + .NotificationEndpointDoubleBank = false, + }, + }; + + +/* return time in milliseconds on unsigned 16 bits */ +static uint16_t get_time_ms(void) +{ + return global_ms; +} + +static void do_led_blink(struct callout_manager *cm, + struct callout *clt, void *dummy) +{ + static uint8_t a = 0; + + if (a & 1) + LEDs_SetAllLEDs(0); + else + LEDs_SetAllLEDs(0xff); + a++; +} + +static void increment_ms(void *dummy) +{ + global_ms++; +} + +static void main_timer_interrupt(void) +{ + static uint8_t cpt = 0; + cpt++; + sei(); + if ((cpt & 0x3) == 0) + scheduler_interrupt(); +} + + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + struct callout t1; + FILE *xbee_file; + int8_t err; + struct xbee_dev dev; + + SetupHardware(); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + + fdevopen(usbserial1_dev_send, usbserial1_dev_recv); + xbee_file = fdevopen(usbserial2_dev_send, usbserial2_dev_recv); + scheduler_init(); + timer_init(); + timer0_register_OV_intr(main_timer_interrupt); + sei(); + + scheduler_add_periodical_event_priority(increment_ms, NULL, + 1000L / SCHEDULER_UNIT, + LED_PRIO); + cmdline_init(); + callout_manager_init(&cm, get_time_ms); + callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL); + + /* initialize libxbee */ + err = xbee_init(); + if (err < 0) + return -1; + + xbee_dev = &dev; + + /* open xbee device */ + if (xbee_open(xbee_dev, xbee_file) < 0) + return -1; + + /* register default channel with a callback */ + if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL, + xbee_rx, NULL) < 0) { + fprintf(stderr, "cannot register default channel\n"); + return -1; + } + + sei(); + xbee_mainloop(); + return 0; +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); + + /* Hardware Initialization */ + Joystick_Init(); + LEDs_Init(); + USB_Init(); +} + +/** Checks for changes in the position of the board joystick, sending strings to the host upon each change + * through the first of the CDC interfaces. + */ +void CheckJoystickMovement(void) +{ + uint8_t JoyStatus_LCL = Joystick_GetStatus(); + char* ReportString = NULL; + static bool ActionSent = false; + + if (JoyStatus_LCL & JOY_UP) + ReportString = "Joystick Up\r\n"; + else if (JoyStatus_LCL & JOY_DOWN) + ReportString = "Joystick Down\r\n"; + else if (JoyStatus_LCL & JOY_LEFT) + ReportString = "Joystick Left\r\n"; + else if (JoyStatus_LCL & JOY_RIGHT) + ReportString = "Joystick Right\r\n"; + else if (JoyStatus_LCL & JOY_PRESS) + ReportString = "Joystick Pressed\r\n"; + else + ActionSent = false; + + if ((ReportString != NULL) && (ActionSent == false)) + { + ActionSent = true; + + CDC_Device_SendString(&VirtualSerial1_CDC_Interface, ReportString); + } +} + +/** Event handler for the library USB Connection event. */ +void EVENT_USB_Device_Connect(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); +} + +/** Event handler for the library USB Disconnection event. */ +void EVENT_USB_Device_Disconnect(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + +/** Event handler for the library USB Configuration Changed event. */ +void EVENT_USB_Device_ConfigurationChanged(void) +{ + bool ConfigSuccess = true; + + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial1_CDC_Interface); + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial2_CDC_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); + + rdline_newline(&xbeeboard.rdl, xbeeboard.prompt); +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface); +} + diff --git a/DualVirtualSerial.h b/DualVirtualSerial.h new file mode 100644 index 0000000..a1a3d85 --- /dev/null +++ b/DualVirtualSerial.h @@ -0,0 +1,79 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2011. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Header file for DualVirtualSerial.c. + */ + +#ifndef _DUAL_VIRTUALSERIAL_H_ +#define _DUAL_VIRTUALSERIAL_H_ + + /* Includes: */ + #include + #include + #include + #include + #include + + #include "Descriptors.h" + + #include + #include + #include + #include + + /* Macros: */ + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /* Function Prototypes: */ + void SetupHardware(void); + void CheckJoystickMovement(void); + + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); + +extern USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface; +extern USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface; + +#endif + diff --git a/LUFA DualVirtualSerial.inf b/LUFA DualVirtualSerial.inf new file mode 100644 index 0000000..9576df5 --- /dev/null +++ b/LUFA DualVirtualSerial.inf @@ -0,0 +1,106 @@ +;************************************************************ +; Windows USB CDC ACM Setup File +; Copyright (c) 2000 Microsoft Corporation + + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MFGNAME% +LayoutFile=layout.inf +CatalogFile=%MFGFILENAME%.cat +DriverVer=11/15/2007,5.1.2600.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTamd64 + +[DestinationDirs] +DefaultDestDir=12 + + +;------------------------------------------------------------------------------ +; Windows 2000/XP/Vista-32bit Sections +;------------------------------------------------------------------------------ + +[DriverInstall.nt] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.nt +AddReg=DriverInstall.nt.AddReg + +[DriverCopyFiles.nt] +usbser.sys,,,0x20 + +[DriverInstall.nt.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,%DRIVERFILENAME%.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.nt.Services] +AddService=usbser, 0x00000002, DriverService.nt + +[DriverService.nt] +DisplayName=%SERVICE% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\%DRIVERFILENAME%.sys + +;------------------------------------------------------------------------------ +; Vista-64bit Sections +;------------------------------------------------------------------------------ + +[DriverInstall.NTamd64] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.NTamd64 +AddReg=DriverInstall.NTamd64.AddReg + +[DriverCopyFiles.NTamd64] +%DRIVERFILENAME%.sys,,,0x20 + +[DriverInstall.NTamd64.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,%DRIVERFILENAME%.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.NTamd64.Services] +AddService=usbser, 0x00000002, DriverService.NTamd64 + +[DriverService.NTamd64] +DisplayName=%SERVICE% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\%DRIVERFILENAME%.sys + + +;------------------------------------------------------------------------------ +; Vendor and Product ID Definitions +;------------------------------------------------------------------------------ +; When developing your USB device, the VID and PID used in the PC side +; application program and the firmware on the microcontroller must match. +; Modify the below line to use your VID and PID. Use the format as shown below. +; Note: One INF file can be used for multiple devices with different VID and PIDs. +; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. +;------------------------------------------------------------------------------ +[SourceDisksFiles] +[SourceDisksNames] +[DeviceList] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 + +[DeviceList.NTamd64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204E&MI_00, USB\VID_03EB&PID_204E&MI_02 + + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ +;Modify these strings to customize your device +;------------------------------------------------------------------------------ +[Strings] +MFGFILENAME="CDC_vista" +DRIVERFILENAME ="usbser" +MFGNAME="http://www.lufa-lib.org" +INSTDISK="LUFA Dual CDC Driver Installer" +DESCRIPTION="Communications Port" +SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file diff --git a/autoconf.h b/autoconf.h new file mode 100644 index 0000000..6bec9b5 --- /dev/null +++ b/autoconf.h @@ -0,0 +1,256 @@ +/* + * Automatically generated by make menuconfig: don't edit + */ +#define AUTOCONF_INCLUDED + +/* + * Hardware + */ +#undef CONFIG_MCU_AT90S2313 +#undef CONFIG_MCU_AT90S2323 +#undef CONFIG_MCU_AT90S3333 +#undef CONFIG_MCU_AT90S2343 +#undef CONFIG_MCU_ATTINY22 +#undef CONFIG_MCU_ATTINY26 +#undef CONFIG_MCU_AT90S4414 +#undef CONFIG_MCU_AT90S4433 +#undef CONFIG_MCU_AT90S4434 +#undef CONFIG_MCU_AT90S8515 +#undef CONFIG_MCU_AT90S8534 +#undef CONFIG_MCU_AT90S8535 +#undef CONFIG_MCU_AT86RF401 +#undef CONFIG_MCU_ATMEGA103 +#undef CONFIG_MCU_ATMEGA603 +#undef CONFIG_MCU_AT43USB320 +#undef CONFIG_MCU_AT43USB355 +#undef CONFIG_MCU_AT76C711 +#undef CONFIG_MCU_ATMEGA8 +#undef CONFIG_MCU_ATMEGA48 +#undef CONFIG_MCU_ATMEGA88 +#undef CONFIG_MCU_ATMEGA8515 +#undef CONFIG_MCU_ATMEGA8535 +#undef CONFIG_MCU_ATTINY13 +#undef CONFIG_MCU_ATTINY2313 +#undef CONFIG_MCU_ATMEGA16 +#undef CONFIG_MCU_ATMEGA161 +#undef CONFIG_MCU_ATMEGA162 +#undef CONFIG_MCU_ATMEGA163 +#undef CONFIG_MCU_ATMEGA165 +#undef CONFIG_MCU_ATMEGA168 +#undef CONFIG_MCU_ATMEGA169 +#undef CONFIG_MCU_ATMEGA32 +#undef CONFIG_MCU_ATMEGA323 +#undef CONFIG_MCU_ATMEGA325 +#undef CONFIG_MCU_ATMEGA3250 +#undef CONFIG_MCU_ATMEGA64 +#undef CONFIG_MCU_ATMEGA645 +#undef CONFIG_MCU_ATMEGA6450 +#undef CONFIG_MCU_ATMEGA128 +#undef CONFIG_MCU_ATMEGA1281 +#undef CONFIG_MCU_AT90CAN128 +#undef CONFIG_MCU_AT94K +#undef CONFIG_MCU_AT90S1200 +#undef CONFIG_MCU_ATMEGA2560 +#undef CONFIG_MCU_ATMEGA256 +#define CONFIG_MCU_ATMEGAUSB1287 +#define CONFIG_QUARTZ (16000000) + +/* + * Generation options + */ +#undef CONFIG_OPTM_0 +#undef CONFIG_OPTM_1 +#undef CONFIG_OPTM_2 +#undef CONFIG_OPTM_3 +#define CONFIG_OPTM_S 1 +#define CONFIG_MATH_LIB 1 +#undef CONFIG_FDEVOPEN_COMPAT +#undef CONFIG_NO_PRINTF +#undef CONFIG_MINIMAL_PRINTF +#undef CONFIG_STANDARD_PRINTF +#define CONFIG_ADVANCED_PRINTF 1 +#undef CONFIG_FORMAT_IHEX +#undef CONFIG_FORMAT_SREC +#define CONFIG_FORMAT_BINARY 1 + +/* + * Base modules + */ +#define CONFIG_MODULE_CIRBUF 1 +#undef CONFIG_MODULE_CIRBUF_LARGE +#undef CONFIG_MODULE_FIXED_POINT +#undef CONFIG_MODULE_VECT2 +#undef CONFIG_MODULE_GEOMETRY +#undef CONFIG_MODULE_HOSTSIM +#define CONFIG_MODULE_SCHEDULER 1 +#define CONFIG_MODULE_SCHEDULER_STATS 1 +#define CONFIG_MODULE_SCHEDULER_CREATE_CONFIG 1 +#undef CONFIG_MODULE_SCHEDULER_USE_TIMERS +#undef CONFIG_MODULE_SCHEDULER_TIMER0 +#define CONFIG_MODULE_SCHEDULER_MANUAL 1 +#define CONFIG_MODULE_TIME 1 +#define CONFIG_MODULE_TIME_CREATE_CONFIG 1 +#undef CONFIG_MODULE_TIME_EXT +#undef CONFIG_MODULE_TIME_EXT_CREATE_CONFIG + +/* + * Communication modules + */ +#define CONFIG_MODULE_UART 1 +#undef CONFIG_MODULE_UART_9BITS +#define CONFIG_MODULE_UART_CREATE_CONFIG 1 +#define CONFIG_MODULE_SPI 1 +#define CONFIG_MODULE_SPI_CREATE_CONFIG 1 +#define CONFIG_MODULE_I2C 1 +#define CONFIG_MODULE_I2C_MASTER 1 +#undef CONFIG_MODULE_I2C_MULTIMASTER +#define CONFIG_MODULE_I2C_CREATE_CONFIG 1 +#undef CONFIG_MODULE_MF2_CLIENT +#undef CONFIG_MODULE_MF2_CLIENT_USE_SCHEDULER +#undef CONFIG_MODULE_MF2_CLIENT_CREATE_CONFIG +#undef CONFIG_MODULE_MF2_SERVER +#undef CONFIG_MODULE_MF2_SERVER_CREATE_CONFIG + +/* + * Hardware modules + */ +#define CONFIG_MODULE_TIMER 1 +#undef CONFIG_MODULE_TIMER_CREATE_CONFIG +#undef CONFIG_MODULE_TIMER_DYNAMIC +#undef CONFIG_MODULE_PWM +#undef CONFIG_MODULE_PWM_CREATE_CONFIG +#undef CONFIG_MODULE_PWM_NG +#undef CONFIG_MODULE_ADC +#undef CONFIG_MODULE_ADC_CREATE_CONFIG + +/* + * IHM modules + */ +#undef CONFIG_MODULE_MENU +#define CONFIG_MODULE_VT100 1 +#define CONFIG_MODULE_RDLINE 1 +#define CONFIG_MODULE_RDLINE_CREATE_CONFIG 1 +#define CONFIG_MODULE_RDLINE_KILL_BUF 1 +#define CONFIG_MODULE_RDLINE_HISTORY 1 +#define CONFIG_MODULE_PARSE 1 +#undef CONFIG_MODULE_PARSE_NO_FLOAT + +/* + * External devices modules + */ +#undef CONFIG_MODULE_LCD +#undef CONFIG_MODULE_LCD_CREATE_CONFIG +#undef CONFIG_MODULE_MULTISERVO +#undef CONFIG_MODULE_MULTISERVO_CREATE_CONFIG +#undef CONFIG_MODULE_AX12 +#undef CONFIG_MODULE_AX12_CREATE_CONFIG + +/* + * Brushless motor drivers (you should enable pwm modules to see all) + */ +#undef CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL +#undef CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_CREATE_CONFIG +#undef CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE +#undef CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG + +/* + * Encoders (you need comm/spi for encoders_spi) + */ +#undef CONFIG_MODULE_ENCODERS_MICROB +#undef CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG +#undef CONFIG_MODULE_ENCODERS_EIRBOT +#undef CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG +#undef CONFIG_MODULE_ENCODERS_SPI +#undef CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG + +/* + * Robot specific modules (fixed point lib may be needed) + */ +#undef CONFIG_MODULE_ROBOT_SYSTEM +#undef CONFIG_MODULE_ROBOT_SYSTEM_USE_F64 +#undef CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT +#undef CONFIG_MODULE_POSITION_MANAGER +#undef CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE +#undef CONFIG_MODULE_TRAJECTORY_MANAGER +#undef CONFIG_MODULE_BLOCKING_DETECTION_MANAGER +#undef CONFIG_MODULE_OBSTACLE_AVOIDANCE +#undef CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG + +/* + * Control system modules + */ +#undef CONFIG_MODULE_CONTROL_SYSTEM_MANAGER +#undef CONFIG_MODULE_PID +#undef CONFIG_MODULE_PID_CREATE_CONFIG +#undef CONFIG_MODULE_RAMP +#undef CONFIG_MODULE_QUADRAMP +#undef CONFIG_MODULE_QUADRAMP_DERIVATE +#undef CONFIG_MODULE_BIQUAD + +/* + * Radio devices + */ +#undef CONFIG_MODULE_CC2420 +#undef CONFIG_MODULE_CC2420_CREATE_CONFIG + +/* + * Crypto modules + */ +#undef CONFIG_MODULE_AES +#undef CONFIG_MODULE_AES_CTR +#undef CONFIG_MODULE_MD5 +#undef CONFIG_MODULE_MD5_HMAC +#undef CONFIG_MODULE_RC4 + +/* + * Encodings modules + */ +#undef CONFIG_MODULE_BASE64 +#undef CONFIG_MODULE_HAMMING + +/* + * Debug modules + */ +#define CONFIG_MODULE_DIAGNOSTIC 1 +#define CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG 1 +#define CONFIG_MODULE_ERROR 1 +#define CONFIG_MODULE_ERROR_CREATE_CONFIG 1 + +/* + * Programmer options + */ +#undef CONFIG_AVRDUDE +#define CONFIG_AVARICE 1 + +/* + * Avrdude + */ +#undef CONFIG_AVRDUDE_PROG_FUTURELEC +#undef CONFIG_AVRDUDE_PROG_ABCMINI +#undef CONFIG_AVRDUDE_PROG_PICOWEB +#undef CONFIG_AVRDUDE_PROG_SP12 +#undef CONFIG_AVRDUDE_PROG_ALF +#undef CONFIG_AVRDUDE_PROG_BASCOM +#undef CONFIG_AVRDUDE_PROG_DT006 +#undef CONFIG_AVRDUDE_PROG_PONY_STK200 +#define CONFIG_AVRDUDE_PROG_STK200 1 +#undef CONFIG_AVRDUDE_PROG_PAVR +#undef CONFIG_AVRDUDE_PROG_BUTTERFLY +#undef CONFIG_AVRDUDE_PROG_AVR910 +#undef CONFIG_AVRDUDE_PROG_STK500 +#undef CONFIG_AVRDUDE_PROG_AVRISP +#undef CONFIG_AVRDUDE_PROG_BSD +#undef CONFIG_AVRDUDE_PROG_DAPA +#undef CONFIG_AVRDUDE_PROG_JTAG1 +#undef CONFIG_AVRDUDE_PROG_AVR109 +#define CONFIG_AVRDUDE_PORT "/dev/parport0" +#define CONFIG_AVRDUDE_BAUDRATE (19200) + +/* + * Avarice + */ +#define CONFIG_AVARICE_PORT "/dev/ttyUSB0" +#define CONFIG_AVARICE_DEBUG_PORT (1234) +#define CONFIG_AVARICE_PROG_MKI 1 +#undef CONFIG_AVARICE_PROG_MKII +#define CONFIG_AVRDUDE_CHECK_SIGNATURE 1 diff --git a/aversive.h b/aversive.h new file mode 100644 index 0000000..22a98e8 --- /dev/null +++ b/aversive.h @@ -0,0 +1,251 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2007) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: aversive.h,v 1.1.2.6 2009-05-18 12:19:51 zer0 Exp $ + * + */ + +/** + * here are some cute little macros, and other stuff, microcontroller + * related ! + */ + + +#ifndef _AVERSIVE_H_ +#define _AVERSIVE_H_ + +#include + +#ifndef HOST_VERSION +#include +#include +#endif + +#include +#include +#include + + +#ifndef __AVR_LIBC_VERSION__ /* version.h should be included by avr/io.h */ +#define __AVR_LIBC_VERSION__ 0UL +#endif + +#ifndef HOST_VERSION +#if __AVR_LIBC_VERSION__ < 10403UL +#include +#endif +#endif + +//#define F_CPU ((unsigned long)CONFIG_QUARTZ) + +#define Hz 1l +#define KHz 1000l +#define MHz 1000000l + + + +/* + * a few "mathematical" macros : maximums and minimums + */ + +/** + * signed maxmimum : both signs are tested + */ +#define S_MAX(to_saturate, value_max) \ +do { \ + if (to_saturate > value_max) \ + to_saturate = value_max; \ + else if (to_saturate < -value_max) \ + to_saturate = -value_max; \ + } while(0) + +/** + * unsigned maximum : result >0 is forced + */ +#define U_MAX(to_saturate, value_max) \ +do { \ + if (to_saturate > value_max) \ + to_saturate = value_max; \ + else if (to_saturate < 0) \ + to_saturate = 0; \ + } while(0) + +/** + * simple maximum + */ + + + +/** absolute + * while the abs() function in the libc works only with int type + * this macro works with every numerical type including floats + */ +#define ABS(val) ({ \ + __typeof(val) __val = (val); \ + if (__val < 0) \ + __val = - __val; \ + __val; \ + }) + +/* + * Extract bytes and u16 from larger integer + */ + +#if __BYTE_ORDER != __LITTLE_ENDIAN && __BYTE_ORDER != __BIG_ENDIAN +# error "Endianness not defined" +#endif + +struct extract32 { + union { + struct { +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t u8_0; + uint8_t u8_1; + uint8_t u8_2; + uint8_t u8_3; +#elif __BYTE_ORDER == __BIG_ENDIAN + uint8_t u8_3; + uint8_t u8_2; + uint8_t u8_1; + uint8_t u8_0; +#endif + } __attribute__ ((packed)) u8; + struct { +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t u16_0; + uint16_t u16_1; +#elif __BYTE_ORDER == __BIG_ENDIAN + uint16_t u16_1; + uint16_t u16_0; +#endif + } __attribute__ ((packed)) u16; + struct { +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t u8_0; + uint16_t u16_mid; + uint8_t u8_3; +#elif __BYTE_ORDER == __BIG_ENDIAN + uint8_t u8_3; + uint16_t u16_mid; + uint8_t u8_0; +#endif + } __attribute__ ((packed)) u16_b; + uint32_t u32; + } __attribute__ ((packed)) u; +} __attribute__ ((packed)); + +#define extr32_08_0(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_0; }) +#define extr32_08_1(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_1; }) +#define extr32_08_2(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_2; }) +#define extr32_08_3(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_3; }) + +#define extr32_16_0(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16.u16_0; }) +#define extr32_16_1(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16.u16_1; }) +#define extr32_16_mid(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16_b.u16_mid; }) + + +struct extract16 { + union { + struct { +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t u8_0; + uint8_t u8_1; +#elif __BYTE_ORDER == __BIG_ENDIAN + uint8_t u8_1; + uint8_t u8_0; +#endif + } __attribute__ ((packed)) u8; + uint16_t u16; + } __attribute__ ((packed)) u; +} __attribute__ ((packed)); + +#define extr16_08_0(i) ({ struct extract16 __x; __x.u.u16 = i; __x.u.u8.u8_0; }) +#define extr16_08_1(i) ({ struct extract16 __x; __x.u.u16 = i; __x.u.u8.u8_1; }) + + + +/* a few asm utilities */ + +#ifndef HOST_VERSION +#ifndef nop +#define nop() __asm__ __volatile__ ("NOP\n") /** nop instruction, 1 CPU cycle consumed */ +#endif +#ifndef nothing +#define nothing() __asm__ __volatile__ (" \n") /** nothing */ +#endif +#ifndef cli +#define cli() __asm__ __volatile__ ("CLI\n") /** disable interrupts */ +#endif +#ifndef sei +#define sei() __asm__ __volatile__ ("SEI\n") /** enable interrupts */ +#endif +/** simple software reset, but doesn't initialize the registers */ +#ifndef reset +#define reset() \ +do { \ + __asm__ __volatile__ ("ldi r30,0\n"); \ + __asm__ __volatile__ ("ldi r31,0\n"); \ + __asm__ __volatile__ ("ijmp\n"); \ +} while(0) +#endif + +#else /* HOST_VERSION */ +#define nop() do {} while(0) +#define nothing() do {} while(0) +#define cli() do {} while(0) +#define sei() do {} while(0) +#define reset() exit(1) +#endif /* HOST_VERSION */ + +/** + * little bit toggeling macro + * + * change pin state + * usage : + * BIT_TOGGLE(PORTB,2) to make the pin 2 of PORTB toggle + */ +#define BIT_TOGGLE(port,bit) do {\ + if(bit_is_set(PIN(port),bit)) \ + cbi(port,bit); \ + else \ + sbi(port,bit); \ + } while(0) + + +/** booleans */ + + +/** DDR and PINS from port adress */ +#define DDR(port) (*(&(port) -1)) +#define PIN(port) (*(&(port) -2)) + +/** open collector simulation macros */ +#define OPEN_CO_INIT(port, bit) sbi(port,bit) +#define OPEN_CO_HIGH(port, bit) cbi(DDR(port),bit) +#define OPEN_CO_LOW(port, bit) cbi(DDR(port),bit) + +/** deprecated macros in libc, but they're almost used, so we implement them again ;) */ +#ifndef cbi +#define cbi(sfr, bit) ( sfr &= ~ _BV(bit)) +#endif +#ifndef sbi +#define sbi(sfr, bit) ( sfr |= _BV(bit)) +#endif + + +#endif /* ifndef _AVERSIVE_H_ */ + diff --git a/aversive/eeprom.h b/aversive/eeprom.h new file mode 100644 index 0000000..0b165c2 --- /dev/null +++ b/aversive/eeprom.h @@ -0,0 +1,41 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: eeprom.h,v 1.1.2.4 2007-11-21 21:54:38 zer0 Exp $ + * + */ + +/** + * This file is used for compatibility between host and avr : with + * this we can emulate eeprom on a host. + */ + +#ifndef _AVERSIVE_EEPROM_H_ +#define _AVERSIVE_EEPROM_H_ + +#ifndef HOST_VERSION + +#include + +#else + +/* XXX */ + +#endif /* HOST_VERSION */ +#endif /* _AVERSIVE_EEPROM_H_ */ + + diff --git a/aversive/endian.h b/aversive/endian.h new file mode 100644 index 0000000..5e33a19 --- /dev/null +++ b/aversive/endian.h @@ -0,0 +1,65 @@ +/* + * Copyright Droids Corporation (2011) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: md5c.c,v 1.3.4.1 2006-11-26 21:06:02 zer0 Exp $ + * + */ + +#ifndef _AVERSIVE_ENDIAN_H_ +#define _AVERSIVE_ENDIAN_H_ + +static inline uint16_t bswap16(uint16_t x) +{ + return (uint16_t)(((x & 0x00ffU) << 8) | + ((x & 0xff00U) >> 8)); +} + +static inline uint32_t bswap32(uint32_t x) +{ + return ((x & 0x000000ffUL) << 24) | + ((x & 0x0000ff00UL) << 8) | + ((x & 0x00ff0000UL) >> 8) | + ((x & 0xff000000UL) >> 24); +} + +static inline uint64_t bswap64(uint64_t x) +{ + return ((x & 0x00000000000000ffULL) << 56) | + ((x & 0x000000000000ff00ULL) << 40) | + ((x & 0x0000000000ff0000ULL) << 24) | + ((x & 0x00000000ff000000ULL) << 8) | + ((x & 0x000000ff00000000ULL) >> 8) | + ((x & 0x0000ff0000000000ULL) >> 24) | + ((x & 0x00ff000000000000ULL) >> 40) | + ((x & 0xff00000000000000ULL) >> 56); +} + +#if BYTE_ORDER == LITTLE_ENDIAN +#define ntohs(x) bswap16(x) +#define ntohl(x) bswap32(x) +#define ntohll(x) bswap64(x) +#else +#define ntohs(x) (x) +#define ntohl(x) (x) +#define ntohll(x) (x) +#endif + +#define htons ntohs +#define htonl ntohl +#define htonll ntohll + +#endif diff --git a/aversive/errno.h b/aversive/errno.h new file mode 100644 index 0000000..54acf84 --- /dev/null +++ b/aversive/errno.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: errno.h,v 1.1.2.2 2009-01-23 23:05:39 zer0 Exp $ + * + */ + +/* This file contains general errors that can be returned from functions + * We have to be carreful and try to return these error as often as possible + * isntead of a function-specific value + */ + +#ifndef _AVERSIVE_ERRNO_H_ +#define _AVERSIVE_ERRNO_H_ + +/** No error */ +#define ESUCCESS 0 + +#ifndef HOST_VERSION + +/* from avr-libc, does not define a lots of errors */ +#include + +/** Operation not permitted */ +#define EPERM 1 +/** No such file or directory */ +#define ENOENT 2 +/** I/O error */ +#define EIO 5 +/** No such device or address */ +#define ENXIO 6 +/** Argument list too long */ +#define E2BIG 7 +/** Try again */ +#define EAGAIN 11 +/** Out of memory */ +#define ENOMEM 12 +/** Bad address */ +#define EFAULT 14 +/** Device or resource busy */ +#define EBUSY 16 +/** Invalid argument */ +#define EINVAL 22 +/** Domain error */ +/* #define EDOM 33 */ /* in libc */ +/** Range error */ +/* #define ERANGE 34 */ /* in libc */ +/** Not supported */ +#define ENOTSUP 126 /* the correct number is 128 */ +/** Unkwow error */ +#define EUNKNOW 127 + +/* must not be > 127 because it can be stored on an int8_t */ + +#else /* HOST_VERSION */ +#include + +#endif /* HOST_VERSION */ + +#endif /* AVERSIVE_ERRNO_H_ */ diff --git a/aversive/error.h b/aversive/error.h new file mode 100644 index 0000000..c34028a --- /dev/null +++ b/aversive/error.h @@ -0,0 +1,42 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error.h,v 1.1.2.2 2007-06-01 09:37:22 zer0 Exp $ + * + */ + +#ifndef _AVERSIVE_ERROR_H_ +#define _AVERSIVE_ERROR_H_ + +#include + +#ifdef CONFIG_MODULE_ERROR +#include +#else + +#define EMERG(num, text...) do {} while(0) + +#define ERROR(num, text...) do {} while(0) + +#define WARNING(num, text...) do {} while(0) + +#define NOTICE(num, text...) do {} while(0) + +#define DEBUG(num, text...) do {} while(0) + +#endif +#endif diff --git a/aversive/irq_lock.h b/aversive/irq_lock.h new file mode 100644 index 0000000..055c247 --- /dev/null +++ b/aversive/irq_lock.h @@ -0,0 +1,73 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: irq_lock.h,v 1.1.2.1 2007-05-23 17:18:09 zer0 Exp $ + * + */ + +/** \file modules/base/utils/irq_lock_macros.h + * \brief Interface of the utils module + * + * here are defined the three macros : + * + * IRQ_LOCK(flags); this saves interrupt state + * IRQ_UNLOCK(flags); this restores interrupt state + * + * code example follows: + * + * uint8_t flags; + * IRQ_LOCK(flags); + * // code to be protected against interrupts ... + * IRQ_UNLOCK(flags); // needs to be associated with an unlock + * + */ + + +#ifndef _AVERSIVE_IRQ_LOCK_H_ +#define _AVERSIVE_IRQ_LOCK_H_ + +#ifdef HOST_VERSION + +#ifdef CONFIG_MODULE_HOSTSIM +#include + +/* we must use 'flags' to avoid a warning */ +#define IRQ_UNLOCK(flags) do { flags=0; /* hostsim_lock(); */ } while(0) +#define IRQ_LOCK(flags) do { flags=0; /* hostsim_unlock(); */ } while(0) +#define GLOBAL_IRQ_ARE_MASKED() hostsim_islocked() +#else +#define IRQ_UNLOCK(flags) do { flags=0; } while(0) +#define IRQ_LOCK(flags) do { flags=0; } while(0) +#define GLOBAL_IRQ_ARE_MASKED() (0) +#endif /* CONFIG_MODULE_HOSTSIM */ + +#else + +#define GLOBAL_IRQ_ARE_MASKED() (!(bit_is_set(SREG,7))) + +#define IRQ_LOCK(flags) do { \ + flags = SREG; \ + cli(); \ + } while(0) + +#define IRQ_UNLOCK(flags) do { \ + SREG = flags; \ + } while ( 0 ) + +#endif /* ! HOST_VERSION */ + +#endif /* _AVERSIVE_IRQ_LOCK_H_ */ diff --git a/aversive/list.h b/aversive/list.h new file mode 100644 index 0000000..98c2e2f --- /dev/null +++ b/aversive/list.h @@ -0,0 +1,532 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: list.h,v 1.1.2.4 2007-08-19 10:35:45 zer0 Exp $ + * + */ + +/** + * This header file provides LISTs implemented in tables. Don't use + * list size > 127. + * + * WARNING --------------------- + * This header file will probably be deprecated in a soon. + * future. Consider using the 'cirbuf' module (circular buffer) instead. + * Indeed, the full-macro implementation of this header file is not + * the most efficient in terms of code size.... :) + * WARNING --------------------- + * + * + * Header + * ------ + * + * struct list_hdr { + * u08 size; < The size of the fifo + * u08 cur_size; < number of data in the fifo + * u08 beg_indice; < indice of the first elt + * u08 read_cursor; < read cursor + * } __attribute__ ((packed)); + * + * + * --------------------------------------------- + * I I I I I + * I size IcursizeI beg I rcurs I elements ... + * I I I I I + * --------------------------------------------- + * + * <-------------------------------> + * list_hdr + * + * + * Data + * ---- + * + * Data are stored in a circular buffer, beginning is specified by + * beg_indice in header. + * + * + * Type + * ---- + * + * For example, the type of a list of u08 with 10 elements is : + * + * struct list_u08_10 { + * struct list_hdr hdr; + * u08 elt[10]; + * } + * + * - With this example, an empty list is : + * size = 10 + * cursize = 0 + * beg = X + * curs = X + * + * - A full list : + * size = 10 + * cursize = 10 + * beg = X + * curs = X + * + * + * Functions & Macros + * ------------------ + * + * ********** Define and init + * + * LIST_TYPE(typename, elttype, size) -> define type : + * + * #define LIST_TYPE(typename, elttype, size) + * typedef struct typename { + * struct list_hdr hdr; + * elttype elt[size]; + * } typename; + * + * LIST_INIT(list, beginning) -> flushes the list, and set size and beginning + * + * + * ********** Control + * + * u08 LIST_FULL(list) + * u08 LIST_EMPTY(list) + * + * u08 LIST_READ_GOTO(*elt, list, i) -> place the read cursor at position i (0 means + * the beginning of the list) and set the elt if + * pointer not NULL + * + * u08 LIST_READ_LEFT(*elt, list, i) -> move the read cursor left by i + * u08 LIST_READ_RIGHT(*elt, list, i) -> move the read cursor right by i + * u08 LIST_READ_START(*elt, list) + * u08 LIST_READ_END(*elt, list) + * + * Examples : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 3 2 3 X X A B C X + * + * + * we do LIST_READ_LEFT(NULL, x,x, 1) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 3 2 2 X X A B C X + * + * + * we do LIST_READ_LEFT(NULL, x,x, 1), but return 1 instead of 0 because we + * overwrapped : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 3 4 4 X X A B C X + * + * + * we do LIST_READ_GOTO(NULL, x,x, 0) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 3 4 2 X X A B C X + * + * + * + * ********** accesses modifying the list + * + * u08 LIST_PUSH_START(elt, list) -> add at the beginning (prepend) + * u08 LIST_PUSH_END(elt, list) -> add at the end (append) + * u08 LIST_PULL_START(elt *, list) -> del at the beginning + * u08 LIST_PULL_END(elt *, list) -> del at the end + * + * u08 LIST_ARRAY_PUSH_START(*elt, list, n) -> prepend n elts + * from elt pointer + * u08 LIST_ARRAY_PUSH_END(*elt, list, n) -> append n elts + * u08 LIST_ARRAY_PULL_START(elt *, list, n) -> del n elts from buffer + * u08 LIST_ARRAY_PULL_END(elt *, list, n) -> del at the end + * + * Examples : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 4 2 3 X X B C D E + * + * + * we do LIST_PUSH_START(A, l, u08) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 5 1 3 X A B C D E + * + * + * we do LIST_PUSH_END(F, l, u08) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 6 1 3 F A B C D E + * + * we do LIST_PUSH_END(X, l, u08) -> return -1 + * + * + * + * ********** Accesses NOT modifying the list + * + * u08 LIST_FIRST(elt *, list) -> Return the first elt + * u08 LIST_LAST(elt *, list) -> Return the last elt + * + * u08 LIST_READ(elt *, list) -> Return the elt pointed by + * the read cursor + * + * u08 LIST_ARRAY_READ(elt *, list, n) -> reads n elts from read cursor + * + * u08 LIST_READ_GET_PTR(list) -> return a pointer to the read + * cursor. Warning, perhaps you need to do LIST_ALIGN_XXXX() before + * + * ********** loop functions + * + * #define LIST_FOREACH(list, elt) + * for( u08 ret = LIST_READ_START(elt, list) ; + * ret == 0 ; + * ret = LIST_READ_RIGHT(*elt, list, 1) ) + * + * + * ********** Alignement functions + * + * these functions can by quite long to execute. If possible, try to + * avoid using them by choosing a good place for the beg_indice when + * calling init of list. If you need it, prefer using + * LIST_ALIGN_CONTINUOUS if possible. + * + * u08 LIST_ALIGN_LEFT(list) + * u08 LIST_ALIGN_RIGHT(list) + * u08 LIST_ALIGN_CONTINUOUS(list) -> just try to put data in a + * countinuous memory region in + * minimum operations. + * + * Example : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 4 3 4 D X X A B C + * + * + * we do LIST_ALIGN_LEFT(list) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 4 0 1 A B C D X X + * + * we do LIST_ALIGN_RIGHT(list) : + * + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 4 2 3 X X A B C D + * + * + * With these functions, you can easily imagine a network stack, + * prepending headers to data, without copying the buffer multiple times. + * + * Example : + * + * LIST_INIT(mylist, 5) + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 0 5 5 X X X X X X + * + * LIST_ARRAY_PUSH_START("DATA", mylist, u08, strlen("DATA")) + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 4 2 5 X X D A T A + * + * LIST_PUSH_START('H', mylist, u08) (push header) + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 5 1 5 X H D A T A + * + * LIST_PUSH_START('H', mylist, u08) (push another header) + * size | cursize | beg | cursor | elt0 | elt1 | elt2 | elt3 | elt4 | elt5 | + * 6 6 0 5 H H D A T A + * + */ + + +#ifndef _AVERSIVE_LIST_H_ +#define _AVERSIVE_LIST_H_ + +#ifndef LIST_DEBUG +#define LIST_DEBUG 0 +#endif + +#include + +#define WOVERWRAPPED -1 + +#ifdef HOST_VERSION +#define CR "\n" +#else +#define CR "\r\n" +#endif + +#include + +/** + * This structure is the header of a list type. + */ +struct list_hdr { + uint8_t size; /**< The size of the list (number of elements) */ + uint8_t cur_size; /**< number of data in the list */ + uint8_t beg_indice; /**< indice of the first elt */ + int8_t read_cursor; /**< read cursor */ +} __attribute__ ((packed)); + +/** + * This is a generic kind of list, in which we suppose that elements + * are char +*/ +struct generic_list { + struct list_hdr hdr; + char elt[0]; +} __attribute__ ((packed)); + + +/** + * Define a new list type + */ +#define LIST_TYPEDEF(typename, elttype, size) \ +typedef struct typename { \ + struct list_hdr hdr; \ + elttype elt[size]; \ +} typename; + +#define LIST_INIT(list, beginning) \ +do { \ + list.hdr.size = sizeof(list.elt)/sizeof(list.elt[0]); \ + list.hdr.cur_size = 0; \ + list.hdr.beg_indice = beginning; \ + list.hdr.read_cursor = beginning; \ +} while(0) + + +/** + * Return 1 if the list is full + */ +#define LIST_FULL(list) (list.hdr.size == list.hdr.cur_size) + +/** + * Return 1 if the list is empty + */ +#define LIST_EMPTY(list) (list.hdr.cur_size == 0) + +/** + * return current size of the list (number of used elements) + */ +#define LIST_CURSIZE(list) (list.hdr.cur_size) + +/** + * return size of the list (used + free elements) + */ +#define LIST_SIZE(list) (list.hdr.size) + +/** + * return the number of free elts + */ +#define LIST_FREESIZE(list) (list.hdr.size-list.hdr.cur_size) + + + +#define LIST_READ_START(list, elt_p) ({ \ + uint8_t __ret=0; \ + list.hdr.read_cursor = 0 ; \ + *elt_p = list.elt[list.hdr.beg_indice] ; \ + if(LIST_DEBUG) \ + printf("LIST_READ_START(%s, %s) -> ret %d"CR,#list, #elt_p, __ret); \ + __ret; \ +}) + +#define LIST_READ_END(list, elt_p) ({ \ + uint8_t __ret=0; \ + list.hdr.read_cursor = list.hdr.cur_size-1; \ + *elt_p = list.elt[(list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size] ; \ + if(LIST_DEBUG) \ + printf("LIST_READ_END(%s, %s) -> ret %d"CR,#list, #elt_p, __ret); \ + __ret; \ +}) + + +#define LIST_READ_GOTO(list, elt_p, i) ({ \ + uint8_t __ret=0; \ + if( (i<0) || (i>=list.hdr.cur_size) ) \ + __ret = EINVAL; \ + else { \ + list.hdr.read_cursor = i; \ + *elt_p = list.elt[(list.hdr.beg_indice+i) % list.hdr.size] ; \ + } \ + if(LIST_DEBUG) \ + printf("LIST_READ_GOTO(%s, %s, %d) -> ret %d"CR,#list, #elt_p, i, __ret); \ + __ret; \ +}) + +#define LIST_READ_MOVE(list, elt_p, i) ({\ +uint8_t __ret=0; \ + if (i<0) { \ + if( (-i) > list.hdr.read_cursor ) \ + __ret = WOVERWRAPPED ; \ + list.hdr.read_cursor -= ((-i) % list.hdr.cur_size) ; \ + if (list.hdr.read_cursor < 0) \ + list.hdr.read_cursor += list.hdr.cur_size ; \ + } \ + else { \ + if( i >= list.hdr.cur_size - list.hdr.read_cursor ) \ + __ret = WOVERWRAPPED ; \ + list.hdr.read_cursor += (i % list.hdr.cur_size) ; \ + if (list.hdr.read_cursor >= list.hdr.cur_size) \ + list.hdr.read_cursor -= list.hdr.cur_size ; \ + } \ + if(LIST_DEBUG) \ + printf("LIST_READ_MOVE(%s, %s, %d) -> ret %d"CR,#list, #elt_p, i, __ret); \ + *elt_p = list.elt[(list.hdr.beg_indice+list.hdr.read_cursor) % list.hdr.size] ; \ + __ret; \ +}) + +#define LIST_READ(list, elt_p) ({\ + *elt_p = list.elt[(list.hdr.beg_indice+list.hdr.read_cursor) % list.hdr.size] ; \ + 0; \ +}) + +#define LIST_PUSH_START(list, e) ({ \ + uint8_t __ret=0; \ + if( LIST_FULL(list) ) \ + __ret=EINVAL; \ + else { \ + list.hdr.beg_indice = (list.hdr.beg_indice-1+list.hdr.size) % list.hdr.size; \ + list.elt [ list.hdr.beg_indice ] = e ; \ + list.hdr.cur_size ++ ; \ + } \ +if(LIST_DEBUG) \ + printf("LIST_PUSH_START(%s, %s) -> ret %d"CR,#list, #e, __ret); \ + __ret; \ +}) + +#define LIST_PUSH_END(list, e) ({ \ + uint8_t __ret=0; \ + if( LIST_FULL(list) ) \ + __ret=EINVAL; \ + else { \ + list.elt [ (list.hdr.beg_indice+list.hdr.cur_size) % list.hdr.size ] = e ; \ + list.hdr.cur_size ++ ; \ + } \ +if(LIST_DEBUG) \ + printf("LIST_PUSH_END(%s, %s) -> ret %d"CR,#list, #e, __ret); \ + __ret; \ +}) + +#define LIST_PULL_START(list, elt_p) ({ \ + uint8_t __ret=0; \ + if( LIST_EMPTY(list) ) \ + __ret=EINVAL; \ + else { \ + *elt_p = list.elt [ list.hdr.beg_indice ] ; \ + list.hdr.beg_indice = (list.hdr.beg_indice+1) % list.hdr.size; \ + list.hdr.cur_size -- ; \ + } \ +if(LIST_DEBUG) \ + printf("LIST_PULL_START(%s, %s) -> ret %d"CR,#list, #elt_p, __ret); \ + __ret; \ +}) + +#define LIST_PULL_END(list, elt_p) ({ \ + uint8_t __ret=0; \ + if( LIST_EMPTY(list) ) \ + __ret=EINVAL; \ + else { \ + *elt_p = list.elt [ (list.hdr.beg_indice-1+list.hdr.cur_size) % list.hdr.size ] ; \ + list.hdr.cur_size -- ; \ + } \ +if(LIST_DEBUG) \ + printf("LIST_PULL_END(%s, %s) -> ret %d"CR,#list, #elt_p, __ret); \ + __ret; \ +}) + +/* start by the last elt */ +#define LIST_ARRAY_PUSH_START(list, array, nb) ({\ + uint8_t __ret=0; \ + int8_t __i; \ + for(__i=nb-1 ; (__i>=0) && (!__ret) ; __i--) { \ + __ret=LIST_PUSH_START(list, array[__i]); \ + } \ + if(LIST_DEBUG) \ + printf("LIST_ARRAY_PUSH_START(%s, %s, %d) -> ret %d"CR,#list, #array, nb, __ret); \ + __ret; \ +}) + +#define LIST_ARRAY_PUSH_END(list, array, nb) ({\ + uint8_t __ret=0, __i; \ + for(__i=0 ; (__i ret %d"CR,#list, #array, nb, __ret); \ + __ret; \ +}) + +#define LIST_ARRAY_PULL_START(list, array, nb) ({\ + uint8_t __ret=0, __i; \ + for(__i=0 ; (__i ret %d"CR,#list, #array, nb, __ret); \ + __ret; \ +}) + +#define LIST_ARRAY_PULL_END(list, array, nb) ({\ + uint8_t __ret=0; \ + int8_t __i; \ + for(__i=nb-1 ; (__i>=0) && (!__ret) ; __i--) { \ + __ret=LIST_PULL_END(list, (array+__i)); \ + } \ + if(LIST_DEBUG) \ + printf("LIST_ARRAY_PULL_END(%s, %s, %d) -> ret %d"CR,#list, #array, nb, __ret); \ + __ret; \ +}) + + +/* convert a list to an array, copy nb elts or less + * if list is too small, return number of copied elts */ +#define LIST_TO_ARRAY(list, array, nb) ({\ + int8_t __i; \ + for(__i=0 ; __i ret %d"CR,#list, #array, nb, __i); \ + __i; \ +}) + + +#define LIST_ALIGN_LEFT(list) ({ \ +uint8_t __ret=0, __i; \ +if(list.hdr.beg_indice != 0) { \ + if(list.hdr.beg_indice+list.hdr.cur_size <= list.hdr.size) { \ + for(__i=0 ; __i +#elif defined (__AVR_AT89S51__) +#include +#elif defined (__AVR_AT89S52__) +#include +#elif defined (__AVR_AT90CAN128__) +#include +#elif defined (__AVR_AT90CAN32__) +#include +#elif defined (__AVR_AT90CAN64__) +#include +#elif defined (__AVR_AT90PWM2__) +#include +#elif defined (__AVR_AT90PWM216__) +#include +#elif defined (__AVR_AT90PWM2B__) +#include +#elif defined (__AVR_AT90PWM3__) +#include +#elif defined (__AVR_AT90PWM316__) +#include +#elif defined (__AVR_AT90PWM3B__) +#include +#elif defined (__AVR_AT90S1200__) +#include +#elif defined (__AVR_AT90S2313__) +#include +#elif defined (__AVR_AT90S2323__) +#include +#elif defined (__AVR_AT90S2343__) +#include +#elif defined (__AVR_AT90S4414__) +#include +#elif defined (__AVR_AT90S4433__) +#include +#elif defined (__AVR_AT90S4434__) +#include +#elif defined (__AVR_AT90S8515__) +#include +#elif defined (__AVR_AT90S8515comp__) +#include +#elif defined (__AVR_AT90S8535__) +#include +#elif defined (__AVR_AT90S8535comp__) +#include +#elif defined (__AVR_AT90USB1286__) +#include +#elif defined (__AVR_AT90USB1287__) +#include +#elif defined (__AVR_AT90USB162__) +#include +#elif defined (__AVR_AT90USB646__) +#include +#elif defined (__AVR_AT90USB647__) +#include +#elif defined (__AVR_AT90USB82__) +#include +#elif defined (__AVR_ATmega103__) +#include +#elif defined (__AVR_ATmega103comp__) +#include +#elif defined (__AVR_ATmega128__) +#include +#elif defined (__AVR_ATmega1280__) +#include +#elif defined (__AVR_ATmega1281__) +#include +#elif defined (__AVR_ATmega1284P__) +#include +#elif defined (__AVR_ATmega128A__) +#include +#elif defined (__AVR_ATmega16__) +#include +#elif defined (__AVR_ATmega161__) +#include +#elif defined (__AVR_ATmega161comp__) +#include +#elif defined (__AVR_ATmega162__) +#include +#elif defined (__AVR_ATmega163__) +#include +#elif defined (__AVR_ATmega164P__) +#include +#elif defined (__AVR_ATmega165__) +#include +#elif defined (__AVR_ATmega165P__) +#include +#elif defined (__AVR_ATmega168__) +#include +#elif defined (__AVR_ATmega168P__) +#include +#elif defined (__AVR_ATmega168PA__) +#include +#elif defined (__AVR_ATmega169__) +#include +#elif defined (__AVR_ATmega169P__) +#include +#elif defined (__AVR_ATmega16A__) +#include +#elif defined (__AVR_ATmega16HVA__) +#include +#elif defined (__AVR_ATmega16U4__) +#include +#elif defined (__AVR_ATmega2560__) +#include +#elif defined (__AVR_ATmega2561__) +#include +#elif defined (__AVR_ATmega32__) +#include +#elif defined (__AVR_ATmega323__) +#include +#elif defined (__AVR_ATmega324P__) +#include +#elif defined (__AVR_ATmega324PA__) +#include +#elif defined (__AVR_ATmega325__) +#include +#elif defined (__AVR_ATmega3250__) +#include +#elif defined (__AVR_ATmega3250P__) +#include +#elif defined (__AVR_ATmega325P__) +#include +#elif defined (__AVR_ATmega328P__) +#include +#elif defined (__AVR_ATmega329__) +#include +#elif defined (__AVR_ATmega3290__) +#include +#elif defined (__AVR_ATmega3290P__) +#include +#elif defined (__AVR_ATmega329P__) +#include +#elif defined (__AVR_ATmega32A__) +#include +#elif defined (__AVR_ATmega32C1__) +#include +#elif defined (__AVR_ATmega32HVB__) +#include +#elif defined (__AVR_ATmega32M1__) +#include +#elif defined (__AVR_ATmega32U4__) +#include +#elif defined (__AVR_ATmega32U6__) +#include +#elif defined (__AVR_ATmega406__) +#include +#elif defined (__AVR_ATmega48__) +#include +#elif defined (__AVR_ATmega48P__) +#include +#elif defined (__AVR_ATmega64__) +#include +#elif defined (__AVR_ATmega640__) +#include +#elif defined (__AVR_ATmega644__) +#include +#elif defined (__AVR_ATmega644P__) +#include +#elif defined (__AVR_ATmega645__) +#include +#elif defined (__AVR_ATmega6450__) +#include +#elif defined (__AVR_ATmega649__) +#include +#elif defined (__AVR_ATmega6490__) +#include +#elif defined (__AVR_ATmega64A__) +#include +#elif defined (__AVR_ATmega8__) +#include +#elif defined (__AVR_ATmega8515__) +#include +#elif defined (__AVR_ATmega8535__) +#include +#elif defined (__AVR_ATmega88__) +#include +#elif defined (__AVR_ATmega88P__) +#include +#elif defined (__AVR_ATmega88PA__) +#include +#elif defined (__AVR_ATmega8A__) +#include +#elif defined (__AVR_ATtiny10__) +#include +#elif defined (__AVR_ATtiny11__) +#include +#elif defined (__AVR_ATtiny12__) +#include +#elif defined (__AVR_ATtiny13__) +#include +#elif defined (__AVR_ATtiny13A__) +#include +#elif defined (__AVR_ATtiny15__) +#include +#elif defined (__AVR_ATtiny167__) +#include +#elif defined (__AVR_ATtiny22__) +#include +#elif defined (__AVR_ATtiny2313__) +#include +#elif defined (__AVR_ATtiny24__) +#include +#elif defined (__AVR_ATtiny25__) +#include +#elif defined (__AVR_ATtiny26__) +#include +#elif defined (__AVR_ATtiny261__) +#include +#elif defined (__AVR_ATtiny28__) +#include +#elif defined (__AVR_ATtiny43U__) +#include +#elif defined (__AVR_ATtiny44__) +#include +#elif defined (__AVR_ATtiny45__) +#include +#elif defined (__AVR_ATtiny461__) +#include +#elif defined (__AVR_ATtiny48__) +#include +#elif defined (__AVR_ATtiny84__) +#include +#elif defined (__AVR_ATtiny85__) +#include +#elif defined (__AVR_ATtiny861__) +#include +#elif defined (__AVR_ATtiny88__) +#include +#elif defined (__AVR_ATxmega128A1__) +#include +#elif defined (__AVR_ATxmega128A3__) +#include +#elif defined (__AVR_ATxmega256A3__) +#include +#elif defined (__AVR_ATxmega256A3B__) +#include +#elif defined (__AVR_ATxmega64A1__) +#include +#elif defined (__AVR_ATxmega64A3__) +#include +#else +#ifndef HOST_VERSION +#error "This arch is not implemented yet" +#endif +#endif + +#if defined(TIMER0_OVF_vect) && !defined(SIG_OVERFLOW0) +#define SIG_OVERFLOW0 TIMER0_OVF_vect +#endif + +#if defined(TIMER1_OVF_vect) && !defined(SIG_OVERFLOW1) +#define SIG_OVERFLOW1 TIMER1_OVF_vect +#endif + +#if defined(TIMER2_OVF_vect) && !defined(SIG_OVERFLOW2) +#define SIG_OVERFLOW2 TIMER2_OVF_vect +#endif + +#if defined(TIMER3_OVF_vect) && !defined(SIG_OVERFLOW3) +#define SIG_OVERFLOW3 TIMER3_OVF_vect +#endif + +#if defined(TIMER4_OVF_vect) && !defined(SIG_OVERFLOW4) +#define SIG_OVERFLOW4 TIMER4_OVF_vect +#endif + +#if defined(TIMER5_OVF_vect) && !defined(SIG_OVERFLOW5) +#define SIG_OVERFLOW5 TIMER5_OVF_vect +#endif + +#endif /* _AVERSIVE_PARTS_H_ */ diff --git a/aversive/parts.h~ b/aversive/parts.h~ new file mode 100644 index 0000000..f26cf9a --- /dev/null +++ b/aversive/parts.h~ @@ -0,0 +1,301 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + +#ifndef _AVERSIVE_PARTS_H_ +#define _AVERSIVE_PARTS_H_ + +#if defined (__AVR_AT86RF401__) +#include +#elif defined (__AVR_AT89S51__) +#include +#elif defined (__AVR_AT89S52__) +#include +#elif defined (__AVR_AT90CAN128__) +#include +#elif defined (__AVR_AT90CAN32__) +#include +#elif defined (__AVR_AT90CAN64__) +#include +#elif defined (__AVR_AT90PWM2__) +#include +#elif defined (__AVR_AT90PWM216__) +#include +#elif defined (__AVR_AT90PWM2B__) +#include +#elif defined (__AVR_AT90PWM3__) +#include +#elif defined (__AVR_AT90PWM316__) +#include +#elif defined (__AVR_AT90PWM3B__) +#include +#elif defined (__AVR_AT90S1200__) +#include +#elif defined (__AVR_AT90S2313__) +#include +#elif defined (__AVR_AT90S2323__) +#include +#elif defined (__AVR_AT90S2343__) +#include +#elif defined (__AVR_AT90S4414__) +#include +#elif defined (__AVR_AT90S4433__) +#include +#elif defined (__AVR_AT90S4434__) +#include +#elif defined (__AVR_AT90S8515__) +#include +#elif defined (__AVR_AT90S8515comp__) +#include +#elif defined (__AVR_AT90S8535__) +#include +#elif defined (__AVR_AT90S8535comp__) +#include +#elif defined (__AVR_AT90USB1286__) +#include +#elif defined (__AVR_AT90USB1287__) +#include +#elif defined (__AVR_AT90USB162__) +#include +#elif defined (__AVR_AT90USB646__) +#include +#elif defined (__AVR_AT90USB647__) +#include +#elif defined (__AVR_AT90USB82__) +#include +#elif defined (__AVR_ATmega103__) +#include +#elif defined (__AVR_ATmega103comp__) +#include +#elif defined (__AVR_ATmega128__) +#include +#elif defined (__AVR_ATmega1280__) +#include +#elif defined (__AVR_ATmega1281__) +#include +#elif defined (__AVR_ATmega1284P__) +#include +#elif defined (__AVR_ATmega128A__) +#include +#elif defined (__AVR_ATmega16__) +#include +#elif defined (__AVR_ATmega161__) +#include +#elif defined (__AVR_ATmega161comp__) +#include +#elif defined (__AVR_ATmega162__) +#include +#elif defined (__AVR_ATmega163__) +#include +#elif defined (__AVR_ATmega164P__) +#include +#elif defined (__AVR_ATmega165__) +#include +#elif defined (__AVR_ATmega165P__) +#include +#elif defined (__AVR_ATmega168__) +#include +#elif defined (__AVR_ATmega168P__) +#include +#elif defined (__AVR_ATmega168PA__) +#include +#elif defined (__AVR_ATmega169__) +#include +#elif defined (__AVR_ATmega169P__) +#include +#elif defined (__AVR_ATmega16A__) +#include +#elif defined (__AVR_ATmega16HVA__) +#include +#elif defined (__AVR_ATmega16U4__) +#include +#elif defined (__AVR_ATmega2560__) +#include +#elif defined (__AVR_ATmega2561__) +#include +#elif defined (__AVR_ATmega32__) +#include +#elif defined (__AVR_ATmega323__) +#include +#elif defined (__AVR_ATmega324P__) +#include +#elif defined (__AVR_ATmega324PA__) +#include +#elif defined (__AVR_ATmega325__) +#include +#elif defined (__AVR_ATmega3250__) +#include +#elif defined (__AVR_ATmega3250P__) +#include +#elif defined (__AVR_ATmega325P__) +#include +#elif defined (__AVR_ATmega328P__) +#include +#elif defined (__AVR_ATmega329__) +#include +#elif defined (__AVR_ATmega3290__) +#include +#elif defined (__AVR_ATmega3290P__) +#include +#elif defined (__AVR_ATmega329P__) +#include +#elif defined (__AVR_ATmega32A__) +#include +#elif defined (__AVR_ATmega32C1__) +#include +#elif defined (__AVR_ATmega32HVB__) +#include +#elif defined (__AVR_ATmega32M1__) +#include +#elif defined (__AVR_ATmega32U4__) +#include +#elif defined (__AVR_ATmega32U6__) +#include +#elif defined (__AVR_ATmega406__) +#include +#elif defined (__AVR_ATmega48__) +#include +#elif defined (__AVR_ATmega48P__) +#include +#elif defined (__AVR_ATmega64__) +#include +#elif defined (__AVR_ATmega640__) +#include +#elif defined (__AVR_ATmega644__) +#include +#elif defined (__AVR_ATmega644P__) +#include +#elif defined (__AVR_ATmega645__) +#include +#elif defined (__AVR_ATmega6450__) +#include +#elif defined (__AVR_ATmega649__) +#include +#elif defined (__AVR_ATmega6490__) +#include +#elif defined (__AVR_ATmega64A__) +#include +#elif defined (__AVR_ATmega8__) +#include +#elif defined (__AVR_ATmega8515__) +#include +#elif defined (__AVR_ATmega8535__) +#include +#elif defined (__AVR_ATmega88__) +#include +#elif defined (__AVR_ATmega88P__) +#include +#elif defined (__AVR_ATmega88PA__) +#include +#elif defined (__AVR_ATmega8A__) +#include +#elif defined (__AVR_ATtiny10__) +#include +#elif defined (__AVR_ATtiny11__) +#include +#elif defined (__AVR_ATtiny12__) +#include +#elif defined (__AVR_ATtiny13__) +#include +#elif defined (__AVR_ATtiny13A__) +#include +#elif defined (__AVR_ATtiny15__) +#include +#elif defined (__AVR_ATtiny167__) +#include +#elif defined (__AVR_ATtiny22__) +#include +#elif defined (__AVR_ATtiny2313__) +#include +#elif defined (__AVR_ATtiny24__) +#include +#elif defined (__AVR_ATtiny25__) +#include +#elif defined (__AVR_ATtiny26__) +#include +#elif defined (__AVR_ATtiny261__) +#include +#elif defined (__AVR_ATtiny28__) +#include +#elif defined (__AVR_ATtiny43U__) +#include +#elif defined (__AVR_ATtiny44__) +#include +#elif defined (__AVR_ATtiny45__) +#include +#elif defined (__AVR_ATtiny461__) +#include +#elif defined (__AVR_ATtiny48__) +#include +#elif defined (__AVR_ATtiny84__) +#include +#elif defined (__AVR_ATtiny85__) +#include +#elif defined (__AVR_ATtiny861__) +#include +#elif defined (__AVR_ATtiny88__) +#include +#elif defined (__AVR_ATxmega128A1__) +#include +#elif defined (__AVR_ATxmega128A3__) +#include +#elif defined (__AVR_ATxmega256A3__) +#include +#elif defined (__AVR_ATxmega256A3B__) +#include +#elif defined (__AVR_ATxmega64A1__) +#include +#elif defined (__AVR_ATxmega64A3__) +#include +#else +#ifndef HOST_VERSION +#error "This arch is not implemented yet" +#endif +#endif + +#if defined(TIMER0_OVF_vect) && !defined(SIG_OVERFLOW0) +#define SIG_OVERFLOW0 TIMER0_OVF_vect +#endif + +#if defined(TIMER1_OVF_vect) && !defined(SIG_OVERFLOW1) +#define SIG_OVERFLOW1 TIMER1_OVF_vect +#endif + +#if defined(TIMER2_OVF_vect) && !defined(SIG_OVERFLOW2) +#define SIG_OVERFLOW2 TIMER2_OVF_vect +#endif + +#if defined(TIMER3_OVF_vect) && !defined(SIG_OVERFLOW3) +#define SIG_OVERFLOW3 TIMER3_OVF_vect +#endif + +#if defined(TIMER4_OVF_vect) && !defined(SIG_OVERFLOW4) +#define SIG_OVERFLOW4 TIMER4_OVF_vect +#endif + +#if defined(TIMER5_OVF_vect) && !defined(SIG_OVERFLOW5) +#define SIG_OVERFLOW5 TIMER5_OVF_vect +#endif + +#endif /* _AVERSIVE_PARTS_H_ */ diff --git a/aversive/parts/AT86RF401.h b/aversive/parts/AT86RF401.h new file mode 100644 index 0000000..8aa9f86 --- /dev/null +++ b/aversive/parts/AT86RF401.h @@ -0,0 +1,215 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* VCOTUNE */ +#define VCOTUNE0_REG VCOTUNE +#define VCOTUNE1_REG VCOTUNE +#define VCOTUNE2_REG VCOTUNE +#define VCOTUNE3_REG VCOTUNE +#define VCOTUNE4_REG VCOTUNE +#define VCOVDET0_REG VCOTUNE +#define VCOVDET1_REG VCOTUNE + +/* BL_CONFIG */ +#define BL0_REG BL_CONFIG +#define BL1_REG BL_CONFIG +#define BL2_REG BL_CONFIG +#define BL3_REG BL_CONFIG +#define BL4_REG BL_CONFIG +#define BL5_REG BL_CONFIG +#define BLV_REG BL_CONFIG +#define BL_REG BL_CONFIG + +/* DEEDR */ +#define ED0_REG DEEDR +#define ED1_REG DEEDR +#define ED2_REG DEEDR +#define ED3_REG DEEDR +#define ED4_REG DEEDR +#define ED5_REG DEEDR +#define ED6_REG DEEDR +#define ED7_REG DEEDR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* DEEAR */ +#define BA0_REG DEEAR +#define BA1_REG DEEAR +#define BA2_REG DEEAR +#define PA3_REG DEEAR +#define PA4_REG DEEAR +#define PA5_REG DEEAR +#define PA6_REG DEEAR + +/* AVR_CONFIG */ +#define BBM_REG AVR_CONFIG +#define SLEEP_REG AVR_CONFIG +#define BLI_REG AVR_CONFIG +#define BD_REG AVR_CONFIG +#define TM_REG AVR_CONFIG +#define ACS0_REG AVR_CONFIG +#define ACS1_REG AVR_CONFIG + +/* B_DET */ +#define BD0_REG B_DET +#define BD1_REG B_DET +#define BD2_REG B_DET +#define BD3_REG B_DET +#define BD4_REG B_DET +#define BD5_REG B_DET + +/* LOCKDET2 */ +#define LC0_REG LOCKDET2 +#define LC1_REG LOCKDET2 +#define LC2_REG LOCKDET2 +#define ULC0_REG LOCKDET2 +#define ULC1_REG LOCKDET2 +#define ULC2_REG LOCKDET2 +#define LAT_REG LOCKDET2 +#define EUD_REG LOCKDET2 + +/* TX_CNTL */ +#define LOC_REG TX_CNTL +#define TXK_REG TX_CNTL +#define TXE_REG TX_CNTL +#define FSK_REG TX_CNTL + +/* BTCNT */ +#define C0_REG BTCNT +#define C1_REG BTCNT +#define C2_REG BTCNT +#define C3_REG BTCNT +#define C4_REG BTCNT +#define C5_REG BTCNT +#define C6_REG BTCNT +#define C7_REG BTCNT + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* BTCR */ +#define F0_REG BTCR +#define DATA_REG BTCR +#define F2_REG BTCR +#define IE_REG BTCR +#define M0_REG BTCR +#define M1_REG BTCR +#define C8_REG BTCR +#define C9_REG BTCR + +/* IO_DATIN */ +#define IOI0_REG IO_DATIN +#define IOI1_REG IO_DATIN +#define IOI2_REG IO_DATIN +#define IOI3_REG IO_DATIN +#define IOI4_REG IO_DATIN +#define IOI5_REG IO_DATIN + +/* IO_ENAB */ +#define IOE0_REG IO_ENAB +#define IOE1_REG IO_ENAB +#define IOE2_REG IO_ENAB +#define IOE3_REG IO_ENAB +#define IOE4_REG IO_ENAB +#define IOE5_REG IO_ENAB + +/* LOCKDET1 */ +#define CS0_REG LOCKDET1 +#define CS1_REG LOCKDET1 +#define BOD_REG LOCKDET1 +#define ENKO_REG LOCKDET1 +#define UPOK_REG LOCKDET1 + +/* IO_DATOUT */ +#define IOO0_REG IO_DATOUT +#define IOO1_REG IO_DATOUT +#define IOO2_REG IO_DATOUT +#define IOO3_REG IO_DATOUT +#define IOO4_REG IO_DATOUT +#define IOO5_REG IO_DATOUT + +/* DEECR */ +#define EER_REG DEECR +#define EEL_REG DEECR +#define EEU_REG DEECR +#define BSY_REG DEECR + +/* PWR_ATTEN */ +#define PCF0_REG PWR_ATTEN +#define PCF1_REG PWR_ATTEN +#define PCF2_REG PWR_ATTEN +#define PCC0_REG PWR_ATTEN +#define PCC1_REG PWR_ATTEN +#define PCC2_REG PWR_ATTEN + +/* pins mapping */ + diff --git a/aversive/parts/AT89S51.h b/aversive/parts/AT89S51.h new file mode 100644 index 0000000..f808b9c --- /dev/null +++ b/aversive/parts/AT89S51.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* pins mapping */ + diff --git a/aversive/parts/AT89S52.h b/aversive/parts/AT89S52.h new file mode 100644 index 0000000..f808b9c --- /dev/null +++ b/aversive/parts/AT89S52.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* pins mapping */ + diff --git a/aversive/parts/AT90CAN128.h b/aversive/parts/AT90CAN128.h new file mode 100644 index 0000000..84fee1a --- /dev/null +++ b/aversive/parts/AT90CAN128.h @@ -0,0 +1,1622 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* CANGSTA */ +#define ERRP_REG CANGSTA +#define BOFF_REG CANGSTA +#define ENFG_REG CANGSTA +#define RXBSY_REG CANGSTA +#define TXBSY_REG CANGSTA +#define OVRG_REG CANGSTA + +/* CANGCON */ +#define SWRES_REG CANGCON +#define ENASTB_REG CANGCON +#define TEST_REG CANGCON +#define LISTEN_REG CANGCON +#define SYNTTC_REG CANGCON +#define TTC_REG CANGCON +#define OVRQ_REG CANGCON +#define ABRQ_REG CANGCON + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* CANIDM1 */ +#define IDMSK21_REG CANIDM1 +#define IDMSK22_REG CANIDM1 +#define IDMSK23_REG CANIDM1 +#define IDMSK24_REG CANIDM1 +#define IDMSK25_REG CANIDM1 +#define IDMSK26_REG CANIDM1 +#define IDMSK27_REG CANIDM1 +#define IDMSK28_REG CANIDM1 + +/* CANIDM3 */ +#define IDMSK5_REG CANIDM3 +#define IDMSK6_REG CANIDM3 +#define IDMSK7_REG CANIDM3 +#define IDMSK8_REG CANIDM3 +#define IDMSK9_REG CANIDM3 +#define IDMSK10_REG CANIDM3 +#define IDMSK11_REG CANIDM3 +#define IDMSK12_REG CANIDM3 + +/* CANIDM2 */ +#define IDMSK13_REG CANIDM2 +#define IDMSK14_REG CANIDM2 +#define IDMSK15_REG CANIDM2 +#define IDMSK16_REG CANIDM2 +#define IDMSK17_REG CANIDM2 +#define IDMSK18_REG CANIDM2 +#define IDMSK19_REG CANIDM2 +#define IDMSK20_REG CANIDM2 + +/* CANIDM4 */ +#define IDEMSK_REG CANIDM4 +#define RTRMSK_REG CANIDM4 +#define IDMSK0_REG CANIDM4 +#define IDMSK1_REG CANIDM4 +#define IDMSK2_REG CANIDM4 +#define IDMSK3_REG CANIDM4 +#define IDMSK4_REG CANIDM4 + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* CANGIT */ +#define AERG_REG CANGIT +#define FERG_REG CANGIT +#define CERG_REG CANGIT +#define SERG_REG CANGIT +#define BXOK_REG CANGIT +#define OVRTIM_REG CANGIT +#define BOFFIT_REG CANGIT +#define CANIT_REG CANGIT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* CANGIE */ +#define ENOVRT_REG CANGIE +#define ENERG_REG CANGIE +#define ENBX_REG CANGIE +#define ENERR_REG CANGIE +#define ENTX_REG CANGIE +#define ENRX_REG CANGIE +#define ENBOFF_REG CANGIE +#define ENIT_REG CANGIE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* CANIE2 */ +#define IEMOB0_REG CANIE2 +#define IEMOB1_REG CANIE2 +#define IEMOB2_REG CANIE2 +#define IEMOB3_REG CANIE2 +#define IEMOB4_REG CANIE2 +#define IEMOB5_REG CANIE2 +#define IEMOB6_REG CANIE2 +#define IEMOB7_REG CANIE2 + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* CANIE1 */ +#define IEMOB8_REG CANIE1 +#define IEMOB9_REG CANIE1 +#define IEMOB10_REG CANIE1 +#define IEMOB11_REG CANIE1 +#define IEMOB12_REG CANIE1 +#define IEMOB13_REG CANIE1 +#define IEMOB14_REG CANIE1 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* CANIDT4 */ +#define RB0TAG_REG CANIDT4 +#define RB1TAG_REG CANIDT4 +#define RTRTAG_REG CANIDT4 +#define IDT0_REG CANIDT4 +#define IDT1_REG CANIDT4 +#define IDT2_REG CANIDT4 +#define IDT3_REG CANIDT4 +#define IDT4_REG CANIDT4 + +/* CANIDT2 */ +#define IDT13_REG CANIDT2 +#define IDT14_REG CANIDT2 +#define IDT15_REG CANIDT2 +#define IDT16_REG CANIDT2 +#define IDT17_REG CANIDT2 +#define IDT18_REG CANIDT2 +#define IDT19_REG CANIDT2 +#define IDT20_REG CANIDT2 + +/* CANIDT3 */ +#define IDT5_REG CANIDT3 +#define IDT6_REG CANIDT3 +#define IDT7_REG CANIDT3 +#define IDT8_REG CANIDT3 +#define IDT9_REG CANIDT3 +#define IDT10_REG CANIDT3 +#define IDT11_REG CANIDT3 +#define IDT12_REG CANIDT3 + +/* CANIDT1 */ +#define IDT21_REG CANIDT1 +#define IDT22_REG CANIDT1 +#define IDT23_REG CANIDT1 +#define IDT24_REG CANIDT1 +#define IDT25_REG CANIDT1 +#define IDT26_REG CANIDT1 +#define IDT27_REG CANIDT1 +#define IDT28_REG CANIDT1 + +/* CANSIT1 */ +#define SIT8_REG CANSIT1 +#define SIT9_REG CANSIT1 +#define SIT10_REG CANSIT1 +#define SIT11_REG CANSIT1 +#define SIT12_REG CANSIT1 +#define SIT13_REG CANSIT1 +#define SIT14_REG CANSIT1 + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* CANCDMOB */ +#define DLC0_REG CANCDMOB +#define DLC1_REG CANCDMOB +#define DLC2_REG CANCDMOB +#define DLC3_REG CANCDMOB +#define IDE_REG CANCDMOB +#define RPLV_REG CANCDMOB +#define CONMOB0_REG CANCDMOB +#define CONMOB1_REG CANCDMOB + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CANSIT2 */ +#define SIT0_REG CANSIT2 +#define SIT1_REG CANSIT2 +#define SIT2_REG CANSIT2 +#define SIT3_REG CANSIT2 +#define SIT4_REG CANSIT2 +#define SIT5_REG CANSIT2 +#define SIT6_REG CANSIT2 +#define SIT7_REG CANSIT2 + +/* CANHPMOB */ +#define CGP0_REG CANHPMOB +#define CGP1_REG CANHPMOB +#define CGP2_REG CANHPMOB +#define CGP3_REG CANHPMOB +#define HPMOB0_REG CANHPMOB +#define HPMOB1_REG CANHPMOB +#define HPMOB2_REG CANHPMOB +#define HPMOB3_REG CANHPMOB + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* CANPAGE */ +#define INDX0_REG CANPAGE +#define INDX1_REG CANPAGE +#define INDX2_REG CANPAGE +#define AINC_REG CANPAGE +#define MOBNB0_REG CANPAGE +#define MOBNB1_REG CANPAGE +#define MOBNB2_REG CANPAGE +#define MOBNB3_REG CANPAGE + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* CANSTMOB */ +#define AERR_REG CANSTMOB +#define FERR_REG CANSTMOB +#define CERR_REG CANSTMOB +#define SERR_REG CANSTMOB +#define BERR_REG CANSTMOB +#define RXOK_REG CANSTMOB +#define TXOK_REG CANSTMOB +#define DLCW_REG CANSTMOB + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* CANEN2 */ +#define ENMOB0_REG CANEN2 +#define ENMOB1_REG CANEN2 +#define ENMOB2_REG CANEN2 +#define ENMOB3_REG CANEN2 +#define ENMOB4_REG CANEN2 +#define ENMOB5_REG CANEN2 +#define ENMOB6_REG CANEN2 +#define ENMOB7_REG CANEN2 + +/* CANEN1 */ +#define ENMOB8_REG CANEN1 +#define ENMOB9_REG CANEN1 +#define ENMOB10_REG CANEN1 +#define ENMOB11_REG CANEN1 +#define ENMOB12_REG CANEN1 +#define ENMOB13_REG CANEN1 +#define ENMOB14_REG CANEN1 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* CANBT2 */ +#define PRS0_REG CANBT2 +#define PRS1_REG CANBT2 +#define PRS2_REG CANBT2 +#define SJW0_REG CANBT2 +#define SJW1_REG CANBT2 + +/* CANBT3 */ +#define SMP_REG CANBT3 +#define PHS10_REG CANBT3 +#define PHS11_REG CANBT3 +#define PHS12_REG CANBT3 +#define PHS20_REG CANBT3 +#define PHS21_REG CANBT3 +#define PHS22_REG CANBT3 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* CANBT1 */ +#define BRP0_REG CANBT1 +#define BRP1_REG CANBT1 +#define BRP2_REG CANBT1 +#define BRP3_REG CANBT1 +#define BRP4_REG CANBT1 +#define BRP5_REG CANBT1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/AT90CAN32.h b/aversive/parts/AT90CAN32.h new file mode 100644 index 0000000..84fee1a --- /dev/null +++ b/aversive/parts/AT90CAN32.h @@ -0,0 +1,1622 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* CANGSTA */ +#define ERRP_REG CANGSTA +#define BOFF_REG CANGSTA +#define ENFG_REG CANGSTA +#define RXBSY_REG CANGSTA +#define TXBSY_REG CANGSTA +#define OVRG_REG CANGSTA + +/* CANGCON */ +#define SWRES_REG CANGCON +#define ENASTB_REG CANGCON +#define TEST_REG CANGCON +#define LISTEN_REG CANGCON +#define SYNTTC_REG CANGCON +#define TTC_REG CANGCON +#define OVRQ_REG CANGCON +#define ABRQ_REG CANGCON + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* CANIDM1 */ +#define IDMSK21_REG CANIDM1 +#define IDMSK22_REG CANIDM1 +#define IDMSK23_REG CANIDM1 +#define IDMSK24_REG CANIDM1 +#define IDMSK25_REG CANIDM1 +#define IDMSK26_REG CANIDM1 +#define IDMSK27_REG CANIDM1 +#define IDMSK28_REG CANIDM1 + +/* CANIDM3 */ +#define IDMSK5_REG CANIDM3 +#define IDMSK6_REG CANIDM3 +#define IDMSK7_REG CANIDM3 +#define IDMSK8_REG CANIDM3 +#define IDMSK9_REG CANIDM3 +#define IDMSK10_REG CANIDM3 +#define IDMSK11_REG CANIDM3 +#define IDMSK12_REG CANIDM3 + +/* CANIDM2 */ +#define IDMSK13_REG CANIDM2 +#define IDMSK14_REG CANIDM2 +#define IDMSK15_REG CANIDM2 +#define IDMSK16_REG CANIDM2 +#define IDMSK17_REG CANIDM2 +#define IDMSK18_REG CANIDM2 +#define IDMSK19_REG CANIDM2 +#define IDMSK20_REG CANIDM2 + +/* CANIDM4 */ +#define IDEMSK_REG CANIDM4 +#define RTRMSK_REG CANIDM4 +#define IDMSK0_REG CANIDM4 +#define IDMSK1_REG CANIDM4 +#define IDMSK2_REG CANIDM4 +#define IDMSK3_REG CANIDM4 +#define IDMSK4_REG CANIDM4 + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* CANGIT */ +#define AERG_REG CANGIT +#define FERG_REG CANGIT +#define CERG_REG CANGIT +#define SERG_REG CANGIT +#define BXOK_REG CANGIT +#define OVRTIM_REG CANGIT +#define BOFFIT_REG CANGIT +#define CANIT_REG CANGIT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* CANGIE */ +#define ENOVRT_REG CANGIE +#define ENERG_REG CANGIE +#define ENBX_REG CANGIE +#define ENERR_REG CANGIE +#define ENTX_REG CANGIE +#define ENRX_REG CANGIE +#define ENBOFF_REG CANGIE +#define ENIT_REG CANGIE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* CANIE2 */ +#define IEMOB0_REG CANIE2 +#define IEMOB1_REG CANIE2 +#define IEMOB2_REG CANIE2 +#define IEMOB3_REG CANIE2 +#define IEMOB4_REG CANIE2 +#define IEMOB5_REG CANIE2 +#define IEMOB6_REG CANIE2 +#define IEMOB7_REG CANIE2 + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* CANIE1 */ +#define IEMOB8_REG CANIE1 +#define IEMOB9_REG CANIE1 +#define IEMOB10_REG CANIE1 +#define IEMOB11_REG CANIE1 +#define IEMOB12_REG CANIE1 +#define IEMOB13_REG CANIE1 +#define IEMOB14_REG CANIE1 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* CANIDT4 */ +#define RB0TAG_REG CANIDT4 +#define RB1TAG_REG CANIDT4 +#define RTRTAG_REG CANIDT4 +#define IDT0_REG CANIDT4 +#define IDT1_REG CANIDT4 +#define IDT2_REG CANIDT4 +#define IDT3_REG CANIDT4 +#define IDT4_REG CANIDT4 + +/* CANIDT2 */ +#define IDT13_REG CANIDT2 +#define IDT14_REG CANIDT2 +#define IDT15_REG CANIDT2 +#define IDT16_REG CANIDT2 +#define IDT17_REG CANIDT2 +#define IDT18_REG CANIDT2 +#define IDT19_REG CANIDT2 +#define IDT20_REG CANIDT2 + +/* CANIDT3 */ +#define IDT5_REG CANIDT3 +#define IDT6_REG CANIDT3 +#define IDT7_REG CANIDT3 +#define IDT8_REG CANIDT3 +#define IDT9_REG CANIDT3 +#define IDT10_REG CANIDT3 +#define IDT11_REG CANIDT3 +#define IDT12_REG CANIDT3 + +/* CANIDT1 */ +#define IDT21_REG CANIDT1 +#define IDT22_REG CANIDT1 +#define IDT23_REG CANIDT1 +#define IDT24_REG CANIDT1 +#define IDT25_REG CANIDT1 +#define IDT26_REG CANIDT1 +#define IDT27_REG CANIDT1 +#define IDT28_REG CANIDT1 + +/* CANSIT1 */ +#define SIT8_REG CANSIT1 +#define SIT9_REG CANSIT1 +#define SIT10_REG CANSIT1 +#define SIT11_REG CANSIT1 +#define SIT12_REG CANSIT1 +#define SIT13_REG CANSIT1 +#define SIT14_REG CANSIT1 + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* CANCDMOB */ +#define DLC0_REG CANCDMOB +#define DLC1_REG CANCDMOB +#define DLC2_REG CANCDMOB +#define DLC3_REG CANCDMOB +#define IDE_REG CANCDMOB +#define RPLV_REG CANCDMOB +#define CONMOB0_REG CANCDMOB +#define CONMOB1_REG CANCDMOB + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CANSIT2 */ +#define SIT0_REG CANSIT2 +#define SIT1_REG CANSIT2 +#define SIT2_REG CANSIT2 +#define SIT3_REG CANSIT2 +#define SIT4_REG CANSIT2 +#define SIT5_REG CANSIT2 +#define SIT6_REG CANSIT2 +#define SIT7_REG CANSIT2 + +/* CANHPMOB */ +#define CGP0_REG CANHPMOB +#define CGP1_REG CANHPMOB +#define CGP2_REG CANHPMOB +#define CGP3_REG CANHPMOB +#define HPMOB0_REG CANHPMOB +#define HPMOB1_REG CANHPMOB +#define HPMOB2_REG CANHPMOB +#define HPMOB3_REG CANHPMOB + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* CANPAGE */ +#define INDX0_REG CANPAGE +#define INDX1_REG CANPAGE +#define INDX2_REG CANPAGE +#define AINC_REG CANPAGE +#define MOBNB0_REG CANPAGE +#define MOBNB1_REG CANPAGE +#define MOBNB2_REG CANPAGE +#define MOBNB3_REG CANPAGE + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* CANSTMOB */ +#define AERR_REG CANSTMOB +#define FERR_REG CANSTMOB +#define CERR_REG CANSTMOB +#define SERR_REG CANSTMOB +#define BERR_REG CANSTMOB +#define RXOK_REG CANSTMOB +#define TXOK_REG CANSTMOB +#define DLCW_REG CANSTMOB + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* CANEN2 */ +#define ENMOB0_REG CANEN2 +#define ENMOB1_REG CANEN2 +#define ENMOB2_REG CANEN2 +#define ENMOB3_REG CANEN2 +#define ENMOB4_REG CANEN2 +#define ENMOB5_REG CANEN2 +#define ENMOB6_REG CANEN2 +#define ENMOB7_REG CANEN2 + +/* CANEN1 */ +#define ENMOB8_REG CANEN1 +#define ENMOB9_REG CANEN1 +#define ENMOB10_REG CANEN1 +#define ENMOB11_REG CANEN1 +#define ENMOB12_REG CANEN1 +#define ENMOB13_REG CANEN1 +#define ENMOB14_REG CANEN1 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* CANBT2 */ +#define PRS0_REG CANBT2 +#define PRS1_REG CANBT2 +#define PRS2_REG CANBT2 +#define SJW0_REG CANBT2 +#define SJW1_REG CANBT2 + +/* CANBT3 */ +#define SMP_REG CANBT3 +#define PHS10_REG CANBT3 +#define PHS11_REG CANBT3 +#define PHS12_REG CANBT3 +#define PHS20_REG CANBT3 +#define PHS21_REG CANBT3 +#define PHS22_REG CANBT3 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* CANBT1 */ +#define BRP0_REG CANBT1 +#define BRP1_REG CANBT1 +#define BRP2_REG CANBT1 +#define BRP3_REG CANBT1 +#define BRP4_REG CANBT1 +#define BRP5_REG CANBT1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/AT90CAN64.h b/aversive/parts/AT90CAN64.h new file mode 100644 index 0000000..84fee1a --- /dev/null +++ b/aversive/parts/AT90CAN64.h @@ -0,0 +1,1622 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* CANGSTA */ +#define ERRP_REG CANGSTA +#define BOFF_REG CANGSTA +#define ENFG_REG CANGSTA +#define RXBSY_REG CANGSTA +#define TXBSY_REG CANGSTA +#define OVRG_REG CANGSTA + +/* CANGCON */ +#define SWRES_REG CANGCON +#define ENASTB_REG CANGCON +#define TEST_REG CANGCON +#define LISTEN_REG CANGCON +#define SYNTTC_REG CANGCON +#define TTC_REG CANGCON +#define OVRQ_REG CANGCON +#define ABRQ_REG CANGCON + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* CANIDM1 */ +#define IDMSK21_REG CANIDM1 +#define IDMSK22_REG CANIDM1 +#define IDMSK23_REG CANIDM1 +#define IDMSK24_REG CANIDM1 +#define IDMSK25_REG CANIDM1 +#define IDMSK26_REG CANIDM1 +#define IDMSK27_REG CANIDM1 +#define IDMSK28_REG CANIDM1 + +/* CANIDM3 */ +#define IDMSK5_REG CANIDM3 +#define IDMSK6_REG CANIDM3 +#define IDMSK7_REG CANIDM3 +#define IDMSK8_REG CANIDM3 +#define IDMSK9_REG CANIDM3 +#define IDMSK10_REG CANIDM3 +#define IDMSK11_REG CANIDM3 +#define IDMSK12_REG CANIDM3 + +/* CANIDM2 */ +#define IDMSK13_REG CANIDM2 +#define IDMSK14_REG CANIDM2 +#define IDMSK15_REG CANIDM2 +#define IDMSK16_REG CANIDM2 +#define IDMSK17_REG CANIDM2 +#define IDMSK18_REG CANIDM2 +#define IDMSK19_REG CANIDM2 +#define IDMSK20_REG CANIDM2 + +/* CANIDM4 */ +#define IDEMSK_REG CANIDM4 +#define RTRMSK_REG CANIDM4 +#define IDMSK0_REG CANIDM4 +#define IDMSK1_REG CANIDM4 +#define IDMSK2_REG CANIDM4 +#define IDMSK3_REG CANIDM4 +#define IDMSK4_REG CANIDM4 + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* CANGIT */ +#define AERG_REG CANGIT +#define FERG_REG CANGIT +#define CERG_REG CANGIT +#define SERG_REG CANGIT +#define BXOK_REG CANGIT +#define OVRTIM_REG CANGIT +#define BOFFIT_REG CANGIT +#define CANIT_REG CANGIT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* CANGIE */ +#define ENOVRT_REG CANGIE +#define ENERG_REG CANGIE +#define ENBX_REG CANGIE +#define ENERR_REG CANGIE +#define ENTX_REG CANGIE +#define ENRX_REG CANGIE +#define ENBOFF_REG CANGIE +#define ENIT_REG CANGIE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* CANIE2 */ +#define IEMOB0_REG CANIE2 +#define IEMOB1_REG CANIE2 +#define IEMOB2_REG CANIE2 +#define IEMOB3_REG CANIE2 +#define IEMOB4_REG CANIE2 +#define IEMOB5_REG CANIE2 +#define IEMOB6_REG CANIE2 +#define IEMOB7_REG CANIE2 + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* CANIE1 */ +#define IEMOB8_REG CANIE1 +#define IEMOB9_REG CANIE1 +#define IEMOB10_REG CANIE1 +#define IEMOB11_REG CANIE1 +#define IEMOB12_REG CANIE1 +#define IEMOB13_REG CANIE1 +#define IEMOB14_REG CANIE1 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* CANIDT4 */ +#define RB0TAG_REG CANIDT4 +#define RB1TAG_REG CANIDT4 +#define RTRTAG_REG CANIDT4 +#define IDT0_REG CANIDT4 +#define IDT1_REG CANIDT4 +#define IDT2_REG CANIDT4 +#define IDT3_REG CANIDT4 +#define IDT4_REG CANIDT4 + +/* CANIDT2 */ +#define IDT13_REG CANIDT2 +#define IDT14_REG CANIDT2 +#define IDT15_REG CANIDT2 +#define IDT16_REG CANIDT2 +#define IDT17_REG CANIDT2 +#define IDT18_REG CANIDT2 +#define IDT19_REG CANIDT2 +#define IDT20_REG CANIDT2 + +/* CANIDT3 */ +#define IDT5_REG CANIDT3 +#define IDT6_REG CANIDT3 +#define IDT7_REG CANIDT3 +#define IDT8_REG CANIDT3 +#define IDT9_REG CANIDT3 +#define IDT10_REG CANIDT3 +#define IDT11_REG CANIDT3 +#define IDT12_REG CANIDT3 + +/* CANIDT1 */ +#define IDT21_REG CANIDT1 +#define IDT22_REG CANIDT1 +#define IDT23_REG CANIDT1 +#define IDT24_REG CANIDT1 +#define IDT25_REG CANIDT1 +#define IDT26_REG CANIDT1 +#define IDT27_REG CANIDT1 +#define IDT28_REG CANIDT1 + +/* CANSIT1 */ +#define SIT8_REG CANSIT1 +#define SIT9_REG CANSIT1 +#define SIT10_REG CANSIT1 +#define SIT11_REG CANSIT1 +#define SIT12_REG CANSIT1 +#define SIT13_REG CANSIT1 +#define SIT14_REG CANSIT1 + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* CANCDMOB */ +#define DLC0_REG CANCDMOB +#define DLC1_REG CANCDMOB +#define DLC2_REG CANCDMOB +#define DLC3_REG CANCDMOB +#define IDE_REG CANCDMOB +#define RPLV_REG CANCDMOB +#define CONMOB0_REG CANCDMOB +#define CONMOB1_REG CANCDMOB + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CANSIT2 */ +#define SIT0_REG CANSIT2 +#define SIT1_REG CANSIT2 +#define SIT2_REG CANSIT2 +#define SIT3_REG CANSIT2 +#define SIT4_REG CANSIT2 +#define SIT5_REG CANSIT2 +#define SIT6_REG CANSIT2 +#define SIT7_REG CANSIT2 + +/* CANHPMOB */ +#define CGP0_REG CANHPMOB +#define CGP1_REG CANHPMOB +#define CGP2_REG CANHPMOB +#define CGP3_REG CANHPMOB +#define HPMOB0_REG CANHPMOB +#define HPMOB1_REG CANHPMOB +#define HPMOB2_REG CANHPMOB +#define HPMOB3_REG CANHPMOB + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* CANPAGE */ +#define INDX0_REG CANPAGE +#define INDX1_REG CANPAGE +#define INDX2_REG CANPAGE +#define AINC_REG CANPAGE +#define MOBNB0_REG CANPAGE +#define MOBNB1_REG CANPAGE +#define MOBNB2_REG CANPAGE +#define MOBNB3_REG CANPAGE + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* CANSTMOB */ +#define AERR_REG CANSTMOB +#define FERR_REG CANSTMOB +#define CERR_REG CANSTMOB +#define SERR_REG CANSTMOB +#define BERR_REG CANSTMOB +#define RXOK_REG CANSTMOB +#define TXOK_REG CANSTMOB +#define DLCW_REG CANSTMOB + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* CANEN2 */ +#define ENMOB0_REG CANEN2 +#define ENMOB1_REG CANEN2 +#define ENMOB2_REG CANEN2 +#define ENMOB3_REG CANEN2 +#define ENMOB4_REG CANEN2 +#define ENMOB5_REG CANEN2 +#define ENMOB6_REG CANEN2 +#define ENMOB7_REG CANEN2 + +/* CANEN1 */ +#define ENMOB8_REG CANEN1 +#define ENMOB9_REG CANEN1 +#define ENMOB10_REG CANEN1 +#define ENMOB11_REG CANEN1 +#define ENMOB12_REG CANEN1 +#define ENMOB13_REG CANEN1 +#define ENMOB14_REG CANEN1 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* CANBT2 */ +#define PRS0_REG CANBT2 +#define PRS1_REG CANBT2 +#define PRS2_REG CANBT2 +#define SJW0_REG CANBT2 +#define SJW1_REG CANBT2 + +/* CANBT3 */ +#define SMP_REG CANBT3 +#define PHS10_REG CANBT3 +#define PHS11_REG CANBT3 +#define PHS12_REG CANBT3 +#define PHS20_REG CANBT3 +#define PHS21_REG CANBT3 +#define PHS22_REG CANBT3 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* CANBT1 */ +#define BRP0_REG CANBT1 +#define BRP1_REG CANBT1 +#define BRP2_REG CANBT1 +#define BRP3_REG CANBT1 +#define BRP4_REG CANBT1 +#define BRP5_REG CANBT1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/AT90PWM2.h b/aversive/parts/AT90PWM2.h new file mode 100644 index 0000000..cc50cf2 --- /dev/null +++ b/aversive/parts/AT90PWM2.h @@ -0,0 +1,1226 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACMP2_PORT PORTD +#define ACMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90PWM216.h b/aversive/parts/AT90PWM216.h new file mode 100644 index 0000000..05b892b --- /dev/null +++ b/aversive/parts/AT90PWM216.h @@ -0,0 +1,1232 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 +#define POAC0A_REG PIFR0 +#define POAC0B_REG PIFR0 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H +#define PCST2_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H +#define PCST0_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 +#define POAC2A_REG PIFR2 +#define POAC2B_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACMP2_PORT PORTD +#define ACMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90PWM2B.h b/aversive/parts/AT90PWM2B.h new file mode 100644 index 0000000..05b892b --- /dev/null +++ b/aversive/parts/AT90PWM2B.h @@ -0,0 +1,1232 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 +#define POAC0A_REG PIFR0 +#define POAC0B_REG PIFR0 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H +#define PCST2_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H +#define PCST0_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 +#define POAC2A_REG PIFR2 +#define POAC2B_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACMP2_PORT PORTD +#define ACMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90PWM3.h b/aversive/parts/AT90PWM3.h new file mode 100644 index 0000000..3d1452f --- /dev/null +++ b/aversive/parts/AT90PWM3.h @@ -0,0 +1,1441 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF1 */ +#define PCLKSEL1_REG PCNF1 +#define POP1_REG PCNF1 +#define PMODE10_REG PCNF1 +#define PMODE11_REG PCNF1 +#define PLOCK1_REG PCNF1 +#define PALOCK1_REG PCNF1 +#define PFIFTY1_REG PCNF1 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* PICR1H */ +#define PICR1_8_REG PICR1H +#define PICR1_9_REG PICR1H +#define PICR1_10_REG PICR1H +#define PICR1_11_REG PICR1H + +/* PICR1L */ +#define PICR1_0_REG PICR1L +#define PICR1_1_REG PICR1L +#define PICR1_2_REG PICR1L +#define PICR1_3_REG PICR1L +#define PICR1_4_REG PICR1L +#define PICR1_5_REG PICR1L +#define PICR1_6_REG PICR1L +#define PICR1_7_REG PICR1L + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* OCR1RAH */ +#define OCR1RA_8_REG OCR1RAH +#define OCR1RA_9_REG OCR1RAH +#define OCR1RA_10_REG OCR1RAH +#define OCR1RA_11_REG OCR1RAH + +/* OCR1RAL */ +#define OCR1RA_0_REG OCR1RAL +#define OCR1RA_1_REG OCR1RAL +#define OCR1RA_2_REG OCR1RAL +#define OCR1RA_3_REG OCR1RAL +#define OCR1RA_4_REG OCR1RAL +#define OCR1RA_5_REG OCR1RAL +#define OCR1RA_6_REG OCR1RAL +#define OCR1RA_7_REG OCR1RAL + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL1 */ +#define PRUN1_REG PCTL1 +#define PCCYC1_REG PCTL1 +#define PARUN1_REG PCTL1 +#define PAOC1A_REG PCTL1 +#define PAOC1B_REG PCTL1 +#define PBFM1_REG PCTL1 +#define PPRE10_REG PCTL1 +#define PPRE11_REG PCTL1 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* PFRC1B */ +#define PRFM1B0_REG PFRC1B +#define PRFM1B1_REG PFRC1B +#define PRFM1B2_REG PFRC1B +#define PRFM1B3_REG PFRC1B +#define PFLTE1B_REG PFRC1B +#define PELEV1B_REG PFRC1B +#define PISEL1B_REG PFRC1B +#define PCAE1B_REG PFRC1B + +/* PFRC1A */ +#define PRFM1A0_REG PFRC1A +#define PRFM1A1_REG PFRC1A +#define PRFM1A2_REG PFRC1A +#define PRFM1A3_REG PFRC1A +#define PFLTE1A_REG PFRC1A +#define PELEV1A_REG PFRC1A +#define PISEL1A_REG PFRC1A +#define PCAE1A_REG PFRC1A + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* OCR1SAL */ +#define OCR1SA_0_REG OCR1SAL +#define OCR1SA_1_REG OCR1SAL +#define OCR1SA_2_REG OCR1SAL +#define OCR1SA_3_REG OCR1SAL +#define OCR1SA_4_REG OCR1SAL +#define OCR1SA_5_REG OCR1SAL +#define OCR1SA_6_REG OCR1SAL +#define OCR1SA_7_REG OCR1SAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* PSOC1 */ +#define POEN1A_REG PSOC1 +#define POEN1B_REG PSOC1 +#define PSYNC1_0_REG PSOC1 +#define PSYNC1_1_REG PSOC1 + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* OCR1RBL */ +#define OCR1RB_0_REG OCR1RBL +#define OCR1RB_1_REG OCR1RBL +#define OCR1RB_2_REG OCR1RBL +#define OCR1RB_3_REG OCR1RBL +#define OCR1RB_4_REG OCR1RBL +#define OCR1RB_5_REG OCR1RBL +#define OCR1RB_6_REG OCR1RBL +#define OCR1RB_7_REG OCR1RBL + +/* OCR1SBH */ +#define OCR1SB_8_REG OCR1SBH +#define OCR1SB_9_REG OCR1SBH +#define OCR1SB_10_REG OCR1SBH +#define OCR1SB_11_REG OCR1SBH + +/* OCR1RBH */ +#define OCR1RB_8_REG OCR1RBH +#define OCR1RB_9_REG OCR1RBH +#define OCR1RB_10_REG OCR1RBH +#define OCR1RB_11_REG OCR1RBH +#define OCR1RB_12_REG OCR1RBH +#define OCR1RB_13_REG OCR1RBH +#define OCR1RB_14_REG OCR1RBH +#define OCR1RB_15_REG OCR1RBH + +/* OCR1SBL */ +#define OCR1SB_0_REG OCR1SBL +#define OCR1SB_1_REG OCR1SBL +#define OCR1SB_2_REG OCR1SBL +#define OCR1SB_3_REG OCR1SBL +#define OCR1SB_4_REG OCR1SBL +#define OCR1SB_5_REG OCR1SBL +#define OCR1SB_6_REG OCR1SBL +#define OCR1SB_7_REG OCR1SBL + +/* OCR1SAH */ +#define OCR1SA_8_REG OCR1SAH +#define OCR1SA_9_REG OCR1SAH +#define OCR1SA_10_REG OCR1SAH +#define OCR1SA_11_REG OCR1SAH + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIM1 */ +#define PEOPE1_REG PIM1 +#define PEVE1A_REG PIM1 +#define PEVE1B_REG PIM1 +#define PSEIE1_REG PIM1 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 + +/* PIFR1 */ +#define PEOP1_REG PIFR1 +#define PRN10_REG PIFR1 +#define PRN11_REG PIFR1 +#define PEV1A_REG PIFR1 +#define PEV1B_REG PIFR1 +#define PSEI1_REG PIFR1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define INT3_PORT PORTC +#define INT3_BIT 0 +#define PSCOUT10_PORT PORTC +#define PSCOUT10_BIT 0 + +#define PSCIN1_PORT PORTC +#define PSCIN1_BIT 1 +#define OC1B_PORT PORTC +#define OC1B_BIT 1 + +#define T0_PORT PORTC +#define T0_BIT 2 +#define PSCOUT22_PORT PORTC +#define PSCOUT22_BIT 2 + +#define T1_PORT PORTC +#define T1_BIT 3 +#define PSCOUT23_PORT PORTC +#define PSCOUT23_BIT 3 + +#define ADC8_PORT PORTC +#define ADC8_BIT 4 +#define AMP1-_PORT PORTC +#define AMP1-_BIT 4 + +#define ADC9_PORT PORTC +#define ADC9_BIT 5 +#define AMP1+_PORT PORTC +#define AMP1+_BIT 5 + +#define ADC10_PORT PORTC +#define ADC10_BIT 6 +#define ACMP1_PORT PORTC +#define ACMP1_BIT 6 + +#define D2A_PORT PORTC +#define D2A_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACOMP2_PORT PORTD +#define ACOMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90PWM316.h b/aversive/parts/AT90PWM316.h new file mode 100644 index 0000000..4ed1173 --- /dev/null +++ b/aversive/parts/AT90PWM316.h @@ -0,0 +1,1450 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF1 */ +#define PCLKSEL1_REG PCNF1 +#define POP1_REG PCNF1 +#define PMODE10_REG PCNF1 +#define PMODE11_REG PCNF1 +#define PLOCK1_REG PCNF1 +#define PALOCK1_REG PCNF1 +#define PFIFTY1_REG PCNF1 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* PICR1H */ +#define PICR1_8_REG PICR1H +#define PICR1_9_REG PICR1H +#define PICR1_10_REG PICR1H +#define PICR1_11_REG PICR1H +#define PCST1_REG PICR1H + +/* PICR1L */ +#define PICR1_0_REG PICR1L +#define PICR1_1_REG PICR1L +#define PICR1_2_REG PICR1L +#define PICR1_3_REG PICR1L +#define PICR1_4_REG PICR1L +#define PICR1_5_REG PICR1L +#define PICR1_6_REG PICR1L +#define PICR1_7_REG PICR1L + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* OCR1RAH */ +#define OCR1RA_8_REG OCR1RAH +#define OCR1RA_9_REG OCR1RAH +#define OCR1RA_10_REG OCR1RAH +#define OCR1RA_11_REG OCR1RAH + +/* OCR1RAL */ +#define OCR1RA_0_REG OCR1RAL +#define OCR1RA_1_REG OCR1RAL +#define OCR1RA_2_REG OCR1RAL +#define OCR1RA_3_REG OCR1RAL +#define OCR1RA_4_REG OCR1RAL +#define OCR1RA_5_REG OCR1RAL +#define OCR1RA_6_REG OCR1RAL +#define OCR1RA_7_REG OCR1RAL + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL1 */ +#define PRUN1_REG PCTL1 +#define PCCYC1_REG PCTL1 +#define PARUN1_REG PCTL1 +#define PAOC1A_REG PCTL1 +#define PAOC1B_REG PCTL1 +#define PBFM1_REG PCTL1 +#define PPRE10_REG PCTL1 +#define PPRE11_REG PCTL1 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H +#define PCST2_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H +#define PCST0_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* PFRC1B */ +#define PRFM1B0_REG PFRC1B +#define PRFM1B1_REG PFRC1B +#define PRFM1B2_REG PFRC1B +#define PRFM1B3_REG PFRC1B +#define PFLTE1B_REG PFRC1B +#define PELEV1B_REG PFRC1B +#define PISEL1B_REG PFRC1B +#define PCAE1B_REG PFRC1B + +/* PFRC1A */ +#define PRFM1A0_REG PFRC1A +#define PRFM1A1_REG PFRC1A +#define PRFM1A2_REG PFRC1A +#define PRFM1A3_REG PFRC1A +#define PFLTE1A_REG PFRC1A +#define PELEV1A_REG PFRC1A +#define PISEL1A_REG PFRC1A +#define PCAE1A_REG PFRC1A + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* OCR1SAL */ +#define OCR1SA_0_REG OCR1SAL +#define OCR1SA_1_REG OCR1SAL +#define OCR1SA_2_REG OCR1SAL +#define OCR1SA_3_REG OCR1SAL +#define OCR1SA_4_REG OCR1SAL +#define OCR1SA_5_REG OCR1SAL +#define OCR1SA_6_REG OCR1SAL +#define OCR1SA_7_REG OCR1SAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* PSOC1 */ +#define POEN1A_REG PSOC1 +#define POEN1B_REG PSOC1 +#define PSYNC1_0_REG PSOC1 +#define PSYNC1_1_REG PSOC1 + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* OCR1RBL */ +#define OCR1RB_0_REG OCR1RBL +#define OCR1RB_1_REG OCR1RBL +#define OCR1RB_2_REG OCR1RBL +#define OCR1RB_3_REG OCR1RBL +#define OCR1RB_4_REG OCR1RBL +#define OCR1RB_5_REG OCR1RBL +#define OCR1RB_6_REG OCR1RBL +#define OCR1RB_7_REG OCR1RBL + +/* OCR1SBH */ +#define OCR1SB_8_REG OCR1SBH +#define OCR1SB_9_REG OCR1SBH +#define OCR1SB_10_REG OCR1SBH +#define OCR1SB_11_REG OCR1SBH + +/* OCR1RBH */ +#define OCR1RB_8_REG OCR1RBH +#define OCR1RB_9_REG OCR1RBH +#define OCR1RB_10_REG OCR1RBH +#define OCR1RB_11_REG OCR1RBH +#define OCR1RB_12_REG OCR1RBH +#define OCR1RB_13_REG OCR1RBH +#define OCR1RB_14_REG OCR1RBH +#define OCR1RB_15_REG OCR1RBH + +/* OCR1SBL */ +#define OCR1SB_0_REG OCR1SBL +#define OCR1SB_1_REG OCR1SBL +#define OCR1SB_2_REG OCR1SBL +#define OCR1SB_3_REG OCR1SBL +#define OCR1SB_4_REG OCR1SBL +#define OCR1SB_5_REG OCR1SBL +#define OCR1SB_6_REG OCR1SBL +#define OCR1SB_7_REG OCR1SBL + +/* OCR1SAH */ +#define OCR1SA_8_REG OCR1SAH +#define OCR1SA_9_REG OCR1SAH +#define OCR1SA_10_REG OCR1SAH +#define OCR1SA_11_REG OCR1SAH + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIM1 */ +#define PEOPE1_REG PIM1 +#define PEVE1A_REG PIM1 +#define PEVE1B_REG PIM1 +#define PSEIE1_REG PIM1 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 +#define POAC2A_REG PIFR2 +#define POAC2B_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 +#define POAC0A_REG PIFR0 +#define POAC0B_REG PIFR0 + +/* PIFR1 */ +#define PEOP1_REG PIFR1 +#define PRN10_REG PIFR1 +#define PRN11_REG PIFR1 +#define PEV1A_REG PIFR1 +#define PEV1B_REG PIFR1 +#define PSEI1_REG PIFR1 +#define POAC1A_REG PIFR1 +#define POAC1B_REG PIFR1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define INT3_PORT PORTC +#define INT3_BIT 0 +#define PSCOUT10_PORT PORTC +#define PSCOUT10_BIT 0 + +#define PSCIN1_PORT PORTC +#define PSCIN1_BIT 1 +#define OC1B_PORT PORTC +#define OC1B_BIT 1 + +#define T0_PORT PORTC +#define T0_BIT 2 +#define PSCOUT22_PORT PORTC +#define PSCOUT22_BIT 2 + +#define T1_PORT PORTC +#define T1_BIT 3 +#define PSCOUT23_PORT PORTC +#define PSCOUT23_BIT 3 + +#define ADC8_PORT PORTC +#define ADC8_BIT 4 +#define AMP1-_PORT PORTC +#define AMP1-_BIT 4 + +#define ADC9_PORT PORTC +#define ADC9_BIT 5 +#define AMP1+_PORT PORTC +#define AMP1+_BIT 5 + +#define ADC10_PORT PORTC +#define ADC10_BIT 6 +#define ACMP1_PORT PORTC +#define ACMP1_BIT 6 + +#define D2A_PORT PORTC +#define D2A_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACOMP2_PORT PORTD +#define ACOMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90PWM3B.h b/aversive/parts/AT90PWM3B.h new file mode 100644 index 0000000..4ed1173 --- /dev/null +++ b/aversive/parts/AT90PWM3B.h @@ -0,0 +1,1450 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* EUDR */ +#define EUDR0_REG EUDR +#define EUDR1_REG EUDR +#define EUDR2_REG EUDR +#define EUDR3_REG EUDR +#define EUDR4_REG EUDR +#define EUDR5_REG EUDR +#define EUDR6_REG EUDR +#define EUDR7_REG EUDR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* OCR2SBH */ +#define OCR2SB_8_REG OCR2SBH +#define OCR2SB_9_REG OCR2SBH +#define OCR2SB_10_REG OCR2SBH +#define OCR2SB_11_REG OCR2SBH + +/* OCR2SBL */ +#define OCR2SB_0_REG OCR2SBL +#define OCR2SB_1_REG OCR2SBL +#define OCR2SB_2_REG OCR2SBL +#define OCR2SB_3_REG OCR2SBL +#define OCR2SB_4_REG OCR2SBL +#define OCR2SB_5_REG OCR2SBL +#define OCR2SB_6_REG OCR2SBL +#define OCR2SB_7_REG OCR2SBL + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL0_REG UCSRC + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC0_REG PRR +#define PRPSC1_REG PRR +#define PRPSC2_REG PRR + +/* PCNF0 */ +#define PCLKSEL0_REG PCNF0 +#define POP0_REG PCNF0 +#define PMODE00_REG PCNF0 +#define PMODE01_REG PCNF0 +#define PLOCK0_REG PCNF0 +#define PALOCK0_REG PCNF0 +#define PFIFTY0_REG PCNF0 + +/* PCNF1 */ +#define PCLKSEL1_REG PCNF1 +#define POP1_REG PCNF1 +#define PMODE10_REG PCNF1 +#define PMODE11_REG PCNF1 +#define PLOCK1_REG PCNF1 +#define PALOCK1_REG PCNF1 +#define PFIFTY1_REG PCNF1 + +/* PCNF2 */ +#define POME2_REG PCNF2 +#define PCLKSEL2_REG PCNF2 +#define POP2_REG PCNF2 +#define PMODE20_REG PCNF2 +#define PMODE21_REG PCNF2 +#define PLOCK2_REG PCNF2 +#define PALOCK2_REG PCNF2 +#define PFIFTY2_REG PCNF2 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* PFRC0A */ +#define PRFM0A0_REG PFRC0A +#define PRFM0A1_REG PFRC0A +#define PRFM0A2_REG PFRC0A +#define PRFM0A3_REG PFRC0A +#define PFLTE0A_REG PFRC0A +#define PELEV0A_REG PFRC0A +#define PISEL0A_REG PFRC0A +#define PCAE0A_REG PFRC0A + +/* PFRC0B */ +#define PRFM0B0_REG PFRC0B +#define PRFM0B1_REG PFRC0B +#define PRFM0B2_REG PFRC0B +#define PRFM0B3_REG PFRC0B +#define PFLTE0B_REG PFRC0B +#define PELEV0B_REG PFRC0B +#define PISEL0B_REG PFRC0B +#define PCAE0B_REG PFRC0B + +/* PICR1H */ +#define PICR1_8_REG PICR1H +#define PICR1_9_REG PICR1H +#define PICR1_10_REG PICR1H +#define PICR1_11_REG PICR1H +#define PCST1_REG PICR1H + +/* PICR1L */ +#define PICR1_0_REG PICR1L +#define PICR1_1_REG PICR1L +#define PICR1_2_REG PICR1L +#define PICR1_3_REG PICR1L +#define PICR1_4_REG PICR1L +#define PICR1_5_REG PICR1L +#define PICR1_6_REG PICR1L +#define PICR1_7_REG PICR1L + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 + +/* OCR1RAH */ +#define OCR1RA_8_REG OCR1RAH +#define OCR1RA_9_REG OCR1RAH +#define OCR1RA_10_REG OCR1RAH +#define OCR1RA_11_REG OCR1RAH + +/* OCR1RAL */ +#define OCR1RA_0_REG OCR1RAL +#define OCR1RA_1_REG OCR1RAL +#define OCR1RA_2_REG OCR1RAL +#define OCR1RA_3_REG OCR1RAL +#define OCR1RA_4_REG OCR1RAL +#define OCR1RA_5_REG OCR1RAL +#define OCR1RA_6_REG OCR1RAL +#define OCR1RA_7_REG OCR1RAL + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0RBH */ +#define OCR0RB_8_REG OCR0RBH +#define OCR0RB_9_REG OCR0RBH +#define OCR0RB_00_REG OCR0RBH +#define OCR0RB_01_REG OCR0RBH +#define OCR0RB_02_REG OCR0RBH +#define OCR0RB_03_REG OCR0RBH +#define OCR0RB_04_REG OCR0RBH +#define OCR0RB_05_REG OCR0RBH + +/* OCR0RBL */ +#define OCR0RB_0_REG OCR0RBL +#define OCR0RB_1_REG OCR0RBL +#define OCR0RB_2_REG OCR0RBL +#define OCR0RB_3_REG OCR0RBL +#define OCR0RB_4_REG OCR0RBL +#define OCR0RB_5_REG OCR0RBL +#define OCR0RB_6_REG OCR0RBL +#define OCR0RB_7_REG OCR0RBL + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* OCR0RAL */ +#define OCR0RA_0_REG OCR0RAL +#define OCR0RA_1_REG OCR0RAL +#define OCR0RA_2_REG OCR0RAL +#define OCR0RA_3_REG OCR0RAL +#define OCR0RA_4_REG OCR0RAL +#define OCR0RA_5_REG OCR0RAL +#define OCR0RA_6_REG OCR0RAL +#define OCR0RA_7_REG OCR0RAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR3 */ +#define GPIOR30_REG GPIOR3 +#define GPIOR31_REG GPIOR3 +#define GPIOR32_REG GPIOR3 +#define GPIOR33_REG GPIOR3 +#define GPIOR34_REG GPIOR3 +#define GPIOR35_REG GPIOR3 +#define GPIOR36_REG GPIOR3 +#define GPIOR37_REG GPIOR3 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* PFRC2B */ +#define PRFM2B0_REG PFRC2B +#define PRFM2B1_REG PFRC2B +#define PRFM2B2_REG PFRC2B +#define PRFM2B3_REG PFRC2B +#define PFLTE2B_REG PFRC2B +#define PELEV2B_REG PFRC2B +#define PISEL2B_REG PFRC2B +#define PCAE2B_REG PFRC2B + +/* PFRC2A */ +#define PRFM2A0_REG PFRC2A +#define PRFM2A1_REG PFRC2A +#define PRFM2A2_REG PFRC2A +#define PRFM2A3_REG PFRC2A +#define PFLTE2A_REG PFRC2A +#define PELEV2A_REG PFRC2A +#define PISEL2A_REG PFRC2A +#define PCAE2A_REG PFRC2A + +/* OCR2SAL */ +#define OCR2SA_0_REG OCR2SAL +#define OCR2SA_1_REG OCR2SAL +#define OCR2SA_2_REG OCR2SAL +#define OCR2SA_3_REG OCR2SAL +#define OCR2SA_4_REG OCR2SAL +#define OCR2SA_5_REG OCR2SAL +#define OCR2SA_6_REG OCR2SAL +#define OCR2SA_7_REG OCR2SAL + +/* EUCSRA */ +#define URxS0_REG EUCSRA +#define URxS1_REG EUCSRA +#define URxS2_REG EUCSRA +#define URxS3_REG EUCSRA +#define UTxS0_REG EUCSRA +#define UTxS1_REG EUCSRA +#define UTxS2_REG EUCSRA +#define UTxS3_REG EUCSRA + +/* EUCSRB */ +#define BODR_REG EUCSRB +#define EMCH_REG EUCSRB +#define EUSBS_REG EUCSRB +#define EUSART_REG EUCSRB + +/* EUCSRC */ +#define STP0_REG EUCSRC +#define STP1_REG EUCSRC +#define F1617_REG EUCSRC +#define FEM_REG EUCSRC + +/* PCTL0 */ +#define PRUN0_REG PCTL0 +#define PCCYC0_REG PCTL0 +#define PARUN0_REG PCTL0 +#define PAOC0A_REG PCTL0 +#define PAOC0B_REG PCTL0 +#define PBFM0_REG PCTL0 +#define PPRE00_REG PCTL0 +#define PPRE01_REG PCTL0 + +/* PCTL1 */ +#define PRUN1_REG PCTL1 +#define PCCYC1_REG PCTL1 +#define PARUN1_REG PCTL1 +#define PAOC1A_REG PCTL1 +#define PAOC1B_REG PCTL1 +#define PBFM1_REG PCTL1 +#define PPRE10_REG PCTL1 +#define PPRE11_REG PCTL1 + +/* PCTL2 */ +#define PRUN2_REG PCTL2 +#define PCCYC2_REG PCTL2 +#define PARUN2_REG PCTL2 +#define PAOC2A_REG PCTL2 +#define PAOC2B_REG PCTL2 +#define PBFM2_REG PCTL2 +#define PPRE20_REG PCTL2 +#define PPRE21_REG PCTL2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* POM2 */ +#define POMV2A0_REG POM2 +#define POMV2A1_REG POM2 +#define POMV2A2_REG POM2 +#define POMV2A3_REG POM2 +#define POMV2B0_REG POM2 +#define POMV2B1_REG POM2 +#define POMV2B2_REG POM2 +#define POMV2B3_REG POM2 + +/* OCR2RBL */ +#define OCR2RB_0_REG OCR2RBL +#define OCR2RB_1_REG OCR2RBL +#define OCR2RB_2_REG OCR2RBL +#define OCR2RB_3_REG OCR2RBL +#define OCR2RB_4_REG OCR2RBL +#define OCR2RB_5_REG OCR2RBL +#define OCR2RB_6_REG OCR2RBL +#define OCR2RB_7_REG OCR2RBL + +/* PICR2H */ +#define PICR2_8_REG PICR2H +#define PICR2_9_REG PICR2H +#define PICR2_10_REG PICR2H +#define PICR2_11_REG PICR2H +#define PCST2_REG PICR2H + +/* OCR2RBH */ +#define OCR2RB_8_REG OCR2RBH +#define OCR2RB_9_REG OCR2RBH +#define OCR2RB_10_REG OCR2RBH +#define OCR2RB_11_REG OCR2RBH +#define OCR2RB_12_REG OCR2RBH +#define OCR2RB_13_REG OCR2RBH +#define OCR2RB_14_REG OCR2RBH +#define OCR2RB_15_REG OCR2RBH + +/* PICR2L */ +#define PICR2_0_REG PICR2L +#define PICR2_1_REG PICR2L +#define PICR2_2_REG PICR2L +#define PICR2_3_REG PICR2L +#define PICR2_4_REG PICR2L +#define PICR2_5_REG PICR2L +#define PICR2_6_REG PICR2L +#define PICR2_7_REG PICR2L + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* OCR2RAH */ +#define OCR2RA_8_REG OCR2RAH +#define OCR2RA_9_REG OCR2RAH +#define OCR2RA_10_REG OCR2RAH +#define OCR2RA_11_REG OCR2RAH + +/* OCR2RAL */ +#define OCR2RA_0_REG OCR2RAL +#define OCR2RA_1_REG OCR2RAL +#define OCR2RA_2_REG OCR2RAL +#define OCR2RA_3_REG OCR2RAL +#define OCR2RA_4_REG OCR2RAL +#define OCR2RA_5_REG OCR2RAL +#define OCR2RA_6_REG OCR2RAL +#define OCR2RA_7_REG OCR2RAL + +/* OCR0SAL */ +#define OCR0SA_0_REG OCR0SAL +#define OCR0SA_1_REG OCR0SAL +#define OCR0SA_2_REG OCR0SAL +#define OCR0SA_3_REG OCR0SAL +#define OCR0SA_4_REG OCR0SAL +#define OCR0SA_5_REG OCR0SAL +#define OCR0SA_6_REG OCR0SAL +#define OCR0SA_7_REG OCR0SAL + +/* OCR0SAH */ +#define OCR0SA_8_REG OCR0SAH +#define OCR0SA_9_REG OCR0SAH +#define OCR0SA_00_REG OCR0SAH +#define OCR0SA_01_REG OCR0SAH + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* PICR0H */ +#define PICR0_8_REG PICR0H +#define PICR0_9_REG PICR0H +#define PICR0_10_REG PICR0H +#define PICR0_11_REG PICR0H +#define PCST0_REG PICR0H + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* MUBRRL */ +#define MUBRR0_REG MUBRRL +#define MUBRR1_REG MUBRRL +#define MUBRR2_REG MUBRRL +#define MUBRR3_REG MUBRRL +#define MUBRR4_REG MUBRRL +#define MUBRR5_REG MUBRRL +#define MUBRR6_REG MUBRRL +#define MUBRR7_REG MUBRRL + +/* MUBRRH */ +#define MUBRR8_REG MUBRRH +#define MUBRR9_REG MUBRRH +#define MUBRR10_REG MUBRRH +#define MUBRR11_REG MUBRRH +#define MUBRR12_REG MUBRRH +#define MUBRR13_REG MUBRRH +#define MUBRR14_REG MUBRRH +#define MUBRR15_REG MUBRRH + +/* OCR2SAH */ +#define OCR2SA_8_REG OCR2SAH +#define OCR2SA_9_REG OCR2SAH +#define OCR2SA_10_REG OCR2SAH +#define OCR2SA_11_REG OCR2SAH + +/* OCR0SBL */ +#define OCR0SB_0_REG OCR0SBL +#define OCR0SB_1_REG OCR0SBL +#define OCR0SB_2_REG OCR0SBL +#define OCR0SB_3_REG OCR0SBL +#define OCR0SB_4_REG OCR0SBL +#define OCR0SB_5_REG OCR0SBL +#define OCR0SB_6_REG OCR0SBL +#define OCR0SB_7_REG OCR0SBL + +/* OCR0SBH */ +#define OCR0SB_8_REG OCR0SBH +#define OCR0SB_9_REG OCR0SBH +#define OCR0SB_00_REG OCR0SBH +#define OCR0SB_01_REG OCR0SBH + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* PFRC1B */ +#define PRFM1B0_REG PFRC1B +#define PRFM1B1_REG PFRC1B +#define PRFM1B2_REG PFRC1B +#define PRFM1B3_REG PFRC1B +#define PFLTE1B_REG PFRC1B +#define PELEV1B_REG PFRC1B +#define PISEL1B_REG PFRC1B +#define PCAE1B_REG PFRC1B + +/* PFRC1A */ +#define PRFM1A0_REG PFRC1A +#define PRFM1A1_REG PFRC1A +#define PRFM1A2_REG PFRC1A +#define PRFM1A3_REG PFRC1A +#define PFLTE1A_REG PFRC1A +#define PELEV1A_REG PFRC1A +#define PISEL1A_REG PFRC1A +#define PCAE1A_REG PFRC1A + +/* PICR0L */ +#define PICR0_0_REG PICR0L +#define PICR0_1_REG PICR0L +#define PICR0_2_REG PICR0L +#define PICR0_3_REG PICR0L +#define PICR0_4_REG PICR0L +#define PICR0_5_REG PICR0L +#define PICR0_6_REG PICR0L +#define PICR0_7_REG PICR0L + +/* OCR1SAL */ +#define OCR1SA_0_REG OCR1SAL +#define OCR1SA_1_REG OCR1SAL +#define OCR1SA_2_REG OCR1SAL +#define OCR1SA_3_REG OCR1SAL +#define OCR1SA_4_REG OCR1SAL +#define OCR1SA_5_REG OCR1SAL +#define OCR1SA_6_REG OCR1SAL +#define OCR1SA_7_REG OCR1SAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* PSOC0 */ +#define POEN0A_REG PSOC0 +#define POEN0B_REG PSOC0 +#define PSYNC00_REG PSOC0 +#define PSYNC01_REG PSOC0 + +/* PSOC1 */ +#define POEN1A_REG PSOC1 +#define POEN1B_REG PSOC1 +#define PSYNC1_0_REG PSOC1 +#define PSYNC1_1_REG PSOC1 + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define ACCKDIV_REG ACSR + +/* OCR1RBL */ +#define OCR1RB_0_REG OCR1RBL +#define OCR1RB_1_REG OCR1RBL +#define OCR1RB_2_REG OCR1RBL +#define OCR1RB_3_REG OCR1RBL +#define OCR1RB_4_REG OCR1RBL +#define OCR1RB_5_REG OCR1RBL +#define OCR1RB_6_REG OCR1RBL +#define OCR1RB_7_REG OCR1RBL + +/* OCR1SBH */ +#define OCR1SB_8_REG OCR1SBH +#define OCR1SB_9_REG OCR1SBH +#define OCR1SB_10_REG OCR1SBH +#define OCR1SB_11_REG OCR1SBH + +/* OCR1RBH */ +#define OCR1RB_8_REG OCR1RBH +#define OCR1RB_9_REG OCR1RBH +#define OCR1RB_10_REG OCR1RBH +#define OCR1RB_11_REG OCR1RBH +#define OCR1RB_12_REG OCR1RBH +#define OCR1RB_13_REG OCR1RBH +#define OCR1RB_14_REG OCR1RBH +#define OCR1RB_15_REG OCR1RBH + +/* OCR1SBL */ +#define OCR1SB_0_REG OCR1SBL +#define OCR1SB_1_REG OCR1SBL +#define OCR1SB_2_REG OCR1SBL +#define OCR1SB_3_REG OCR1SBL +#define OCR1SB_4_REG OCR1SBL +#define OCR1SB_5_REG OCR1SBL +#define OCR1SB_6_REG OCR1SBL +#define OCR1SB_7_REG OCR1SBL + +/* OCR1SAH */ +#define OCR1SA_8_REG OCR1SAH +#define OCR1SA_9_REG OCR1SAH +#define OCR1SA_10_REG OCR1SAH +#define OCR1SA_11_REG OCR1SAH + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* OCR0RAH */ +#define OCR0RA_8_REG OCR0RAH +#define OCR0RA_9_REG OCR0RAH +#define OCR0RA_00_REG OCR0RAH +#define OCR0RA_01_REG OCR0RAH + +/* PIM2 */ +#define PEOPE2_REG PIM2 +#define PEVE2A_REG PIM2 +#define PEVE2B_REG PIM2 +#define PSEIE2_REG PIM2 + +/* PIM0 */ +#define PEOPE0_REG PIM0 +#define PEVE0A_REG PIM0 +#define PEVE0B_REG PIM0 +#define PSEIE0_REG PIM0 + +/* PIM1 */ +#define PEOPE1_REG PIM1 +#define PEVE1A_REG PIM1 +#define PEVE1B_REG PIM1 +#define PSEIE1_REG PIM1 + +/* PIFR2 */ +#define PEOP2_REG PIFR2 +#define PRN20_REG PIFR2 +#define PRN21_REG PIFR2 +#define PEV2A_REG PIFR2 +#define PEV2B_REG PIFR2 +#define PSEI2_REG PIFR2 +#define POAC2A_REG PIFR2 +#define POAC2B_REG PIFR2 + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PIFR0 */ +#define PEOP0_REG PIFR0 +#define PRN00_REG PIFR0 +#define PRN01_REG PIFR0 +#define PEV0A_REG PIFR0 +#define PEV0B_REG PIFR0 +#define PSEI0_REG PIFR0 +#define POAC0A_REG PIFR0 +#define POAC0B_REG PIFR0 + +/* PIFR1 */ +#define PEOP1_REG PIFR1 +#define PRN10_REG PIFR1 +#define PRN11_REG PIFR1 +#define PEV1A_REG PIFR1 +#define PEV1B_REG PIFR1 +#define PSEI1_REG PIFR1 +#define POAC1A_REG PIFR1 +#define POAC1B_REG PIFR1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PSOC2 */ +#define POEN2A_REG PSOC2 +#define POEN2C_REG PSOC2 +#define POEN2B_REG PSOC2 +#define POEN2D_REG PSOC2 +#define PSYNC2_0_REG PSOC2 +#define PSYNC2_1_REG PSOC2 +#define POS22_REG PSOC2 +#define POS23_REG PSOC2 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define ADASCR_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT20_PORT PORTB +#define PSCOUT20_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT21_PORT PORTB +#define PSCOUT21_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT11_PORT PORTB +#define PSCOUT11_BIT 6 +#define ICP1B_PORT PORTB +#define ICP1B_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT01_PORT PORTB +#define PSCOUT01_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define INT3_PORT PORTC +#define INT3_BIT 0 +#define PSCOUT10_PORT PORTC +#define PSCOUT10_BIT 0 + +#define PSCIN1_PORT PORTC +#define PSCIN1_BIT 1 +#define OC1B_PORT PORTC +#define OC1B_BIT 1 + +#define T0_PORT PORTC +#define T0_BIT 2 +#define PSCOUT22_PORT PORTC +#define PSCOUT22_BIT 2 + +#define T1_PORT PORTC +#define T1_BIT 3 +#define PSCOUT23_PORT PORTC +#define PSCOUT23_BIT 3 + +#define ADC8_PORT PORTC +#define ADC8_BIT 4 +#define AMP1-_PORT PORTC +#define AMP1-_BIT 4 + +#define ADC9_PORT PORTC +#define ADC9_BIT 5 +#define AMP1+_PORT PORTC +#define AMP1+_BIT 5 + +#define ADC10_PORT PORTC +#define ADC10_BIT 6 +#define ACMP1_PORT PORTC +#define ACMP1_BIT 6 + +#define D2A_PORT PORTC +#define D2A_BIT 7 + +#define PSCOUT00_PORT PORTD +#define PSCOUT00_BIT 0 +#define XCK_PORT PORTD +#define XCK_BIT 0 +#define SSA_PORT PORTD +#define SSA_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define DALI_PORT PORTD +#define DALI_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define DALI_PORT PORTD +#define DALI_BIT 4 +#define ICP1_PORT PORTD +#define ICP1_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACOMP2_PORT PORTD +#define ACOMP2_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPM_PORT PORTD +#define ACMPM_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 + + diff --git a/aversive/parts/AT90S1200.h b/aversive/parts/AT90S1200.h new file mode 100644 index 0000000..16df827 --- /dev/null +++ b/aversive/parts/AT90S1200.h @@ -0,0 +1,228 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD + +/* pins mapping */ +#define AIN0_PORT PORTB +#define AIN0_BIT 0 + +#define AIN1_PORT PORTB +#define AIN1_BIT 1 + + + + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + + + +#define INT0_PORT PORTD +#define INT0_BIT 2 + + +#define T0_PORT PORTD +#define T0_BIT 4 + + + + diff --git a/aversive/parts/AT90S2313.h b/aversive/parts/AT90S2313.h new file mode 100644 index 0000000..a9d4c0e --- /dev/null +++ b/aversive/parts/AT90S2313.h @@ -0,0 +1,401 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1_NUM 0 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 1 + +/* Pwm nums */ +#define PWM1_NUM 0 +#define PWM_TOTAL_NUM 1 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* TIFR */ +#define TOV0_REG TIFR +#define ICF1_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* pins mapping */ +#define AIN0_PORT PORTB +#define AIN0_BIT 0 + +#define AIN1_PORT PORTB +#define AIN1_BIT 1 + + +#define OC1_PORT PORTB +#define OC1_BIT 3 + + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define T0_PORT PORTD +#define T0_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + + diff --git a/aversive/parts/AT90S2323.h b/aversive/parts/AT90S2323.h new file mode 100644 index 0000000..92e212f --- /dev/null +++ b/aversive/parts/AT90S2323.h @@ -0,0 +1,181 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* GIFR */ +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* TIFR */ +#define TOV0_REG TIFR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 + + diff --git a/aversive/parts/AT90S2343.h b/aversive/parts/AT90S2343.h new file mode 100644 index 0000000..86cc1e3 --- /dev/null +++ b/aversive/parts/AT90S2343.h @@ -0,0 +1,191 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* GIFR */ +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* TIFR */ +#define TOV0_REG TIFR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 + +#define CLOCK_PORT PORTB +#define CLOCK_BIT 3 + + + diff --git a/aversive/parts/AT90S4414.h b/aversive/parts/AT90S4414.h new file mode 100644 index 0000000..8157784 --- /dev/null +++ b/aversive/parts/AT90S4414.h @@ -0,0 +1,566 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ + + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 2 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM_TOTAL_NUM 2 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK +#define TOIE0_REG TIMSK + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR +#define EEAR7_REG EEAR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* TIFR */ +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR +#define TOV0_REG TIFR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR +#define SRW_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + + diff --git a/aversive/parts/AT90S4433.h b/aversive/parts/AT90S4433.h new file mode 100644 index 0000000..dd2a1af --- /dev/null +++ b/aversive/parts/AT90S4433.h @@ -0,0 +1,478 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1_NUM 0 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 1 + +/* Pwm nums */ +#define PWM1_NUM 0 +#define PWM_TOTAL_NUM 1 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define ADCBG_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM10_REG TCCR1A +#define COM11_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1_REG TIMSK +#define TOIE1_REG TIMSK + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* UBRRHI */ +#define UBRRHI0_REG UBRRHI +#define UBRRHI1_REG UBRRHI +#define UBRRHI2_REG UBRRHI +#define UBRRHI3_REG UBRRHI + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define AINBG_REG ACSR +#define ACD_REG ACSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSRA */ +#define MPCM_REG UCSRA +#define OR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define CHR9_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* ADCL */ +#define ADC0_REG ADCL +#define ADC1_REG ADCL +#define ADC2_REG ADCL +#define ADC3_REG ADCL +#define ADC4_REG ADCL +#define ADC5_REG ADCL +#define ADC6_REG ADCL +#define ADC7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR +#define EEAR7_REG EEAR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC + +/* ADCH */ +#define ADC8_REG ADCH +#define ADC9_REG ADCH + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* TIFR */ +#define TOV0_REG TIFR +#define ICF1_REG TIFR +#define OCF1_REG TIFR +#define TOV1_REG TIFR + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* OCR1L */ +#define OCR1AL0_REG OCR1L +#define OCR1AL1_REG OCR1L +#define OCR1AL2_REG OCR1L +#define OCR1AL3_REG OCR1L +#define OCR1AL4_REG OCR1L +#define OCR1AL5_REG OCR1L +#define OCR1AL6_REG OCR1L +#define OCR1AL7_REG OCR1L + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* OCR1H */ +#define OCR1AH0_REG OCR1H +#define OCR1AH1_REG OCR1H +#define OCR1AH2_REG OCR1H +#define OCR1AH3_REG OCR1H +#define OCR1AH4_REG OCR1H +#define OCR1AH5_REG OCR1H +#define OCR1AH6_REG OCR1H +#define OCR1AH7_REG OCR1H + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* SP */ +#define SP0_REG SP +#define SP1_REG SP +#define SP2_REG SP +#define SP3_REG SP +#define SP4_REG SP +#define SP5_REG SP +#define SP6_REG SP +#define SP7_REG SP + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ADC0_PORT PORTC +#define ADC0_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + + diff --git a/aversive/parts/AT90S4434.h b/aversive/parts/AT90S4434.h new file mode 100644 index 0000000..bb6714b --- /dev/null +++ b/aversive/parts/AT90S4434.h @@ -0,0 +1,662 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE2_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM2_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ADCL */ +#define ADC0_REG ADCL +#define ADC1_REG ADCL +#define ADC2_REG ADCL +#define ADC3_REG ADCL +#define ADC4_REG ADCL +#define ADC5_REG ADCL +#define ADC6_REG ADCL +#define ADC7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADC8_REG ADCH +#define ADC9_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + + + + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/AT90S8515.h b/aversive/parts/AT90S8515.h new file mode 100644 index 0000000..15e77c7 --- /dev/null +++ b/aversive/parts/AT90S8515.h @@ -0,0 +1,569 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ + + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 2 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM_TOTAL_NUM 2 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK +#define TOIE0_REG TIMSK + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* TIFR */ +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR +#define TOV0_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR +#define SRW_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + + diff --git a/aversive/parts/AT90S8515comp.h b/aversive/parts/AT90S8515comp.h new file mode 100644 index 0000000..3335db2 --- /dev/null +++ b/aversive/parts/AT90S8515comp.h @@ -0,0 +1,708 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +/* #define URSEL_REG UCSRC */ /* dup in UBRRH */ + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define OCIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PUD_REG SFIOR +#define XMM0_REG SFIOR +#define XMM1_REG SFIOR +#define XMM2_REG SFIOR +#define XMBK_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* EMCUCR */ +#define ISC2_REG EMCUCR +#define SRW11_REG EMCUCR +#define SRW00_REG EMCUCR +#define SRW01_REG EMCUCR +#define SRL0_REG EMCUCR +#define SRL1_REG EMCUCR +#define SRL2_REG EMCUCR +#define SM0_REG EMCUCR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH +/* #define URSEL_REG UBRRH */ /* dup in UCSRC */ + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define SM2_REG MCUCSR + +/* TIFR */ +#define OCF0_REG TIFR +#define TOV0_REG TIFR +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define OC0_PORT PORTB +#define OC0_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + +#define ICP_PORT PORTE +#define ICP_BIT 0 +#define INT2_PORT PORTE +#define INT2_BIT 0 + +#define ALE_PORT PORTE +#define ALE_BIT 1 + +#define OC1B_PORT PORTE +#define OC1B_BIT 2 + + diff --git a/aversive/parts/AT90S8535.h b/aversive/parts/AT90S8535.h new file mode 100644 index 0000000..bb6714b --- /dev/null +++ b/aversive/parts/AT90S8535.h @@ -0,0 +1,662 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE2_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM2_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ADCL */ +#define ADC0_REG ADCL +#define ADC1_REG ADCL +#define ADC2_REG ADCL +#define ADC3_REG ADCL +#define ADC4_REG ADCL +#define ADC5_REG ADCL +#define ADC6_REG ADCL +#define ADC7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADC8_REG ADCH +#define ADC9_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + + + + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/AT90S8535comp.h b/aversive/parts/AT90S8535comp.h new file mode 100644 index 0000000..23cae03 --- /dev/null +++ b/aversive/parts/AT90S8535comp.h @@ -0,0 +1,815 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define ACME_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +/* #define URSEL_REG UCSRC */ /* dup in UBRRH */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH +/* #define URSEL_REG UBRRH */ /* dup in UCSRC */ + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SM2_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0_PORT PORTB +#define OC0_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/AT90USB1286.h b/aversive/parts/AT90USB1286.h new file mode 100644 index 0000000..cbccdad --- /dev/null +++ b/aversive/parts/AT90USB1286.h @@ -0,0 +1,1381 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB1287.h b/aversive/parts/AT90USB1287.h new file mode 100644 index 0000000..6a44e0b --- /dev/null +++ b/aversive/parts/AT90USB1287.h @@ -0,0 +1,1598 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UPIENX */ +#define RXINE_REG UPIENX +#define RXSTALLE_REG UPIENX +#define TXOUTE_REG UPIENX +#define TXSTPE_REG UPIENX +#define PERRE_REG UPIENX +#define NAKEDE_REG UPIENX +/* #define FLERRE_REG UPIENX */ /* dup in UEIENX */ + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +/* #define ALLOC_REG UECFG1X */ /* dup in UPCFG1X */ +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UECONX */ +#define EPEN_REG UECONX +/* #define RSTDT_REG UECONX */ /* dup in UPCONX */ +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OTGIEN */ +#define SRPE_REG OTGIEN +#define VBERRE_REG OTGIEN +#define BCERRE_REG OTGIEN +#define ROLEEXE_REG OTGIEN +#define HNPERRE_REG OTGIEN +#define STOE_REG OTGIEN + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* OTGTCON */ +#define VALUE_20_REG OTGTCON +#define VALUE_21_REG OTGTCON +#define VALUE_22_REG OTGTCON +#define PAGE0_REG OTGTCON +#define PAGE1_REG OTGTCON +#define OTGTCON_7_REG OTGTCON + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UPBCHX */ +#define PBYCT8_REG UPBCHX +#define PBYCT9_REG UPBCHX +#define PBYCT10_REG UPBCHX + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* OTGINT */ +#define SRPI_REG OTGINT +#define VBERRI_REG OTGINT +#define BCERRI_REG OTGINT +#define ROLEEXI_REG OTGINT +#define HNPERRI_REG OTGINT +#define STOI_REG OTGINT + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UHIEN */ +#define DCONNE_REG UHIEN +#define DDISCE_REG UHIEN +#define RSTE_REG UHIEN +#define RSMEDE_REG UHIEN +#define RXRSME_REG UHIEN +#define HSOFE_REG UHIEN +#define HWUPE_REG UHIEN + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* UHADDR */ +#define UHADDR_0_REG UHADDR +#define UHADDR_1_REG UHADDR +#define UHADDR_2_REG UHADDR +#define UHADDR_3_REG UHADDR +#define UHADDR_4_REG UHADDR +#define UHADDR_5_REG UHADDR +#define UHADDR_6_REG UHADDR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* UHFLEN */ +#define UHFLEN_0_REG UHFLEN +#define UHFLEN_1_REG UHFLEN +#define UHFLEN_2_REG UHFLEN +#define UHFLEN_3_REG UHFLEN +#define UHFLEN_4_REG UHFLEN +#define UHFLEN_5_REG UHFLEN +#define UHFLEN_6_REG UHFLEN +#define UHFLEN_7_REG UHFLEN + +/* UHFNUMH */ +#define UHFNUMH_0_REG UHFNUMH +#define UHFNUMH_1_REG UHFNUMH +#define UHFNUMH_2_REG UHFNUMH + +/* UHFNUML */ +#define UHFNUML_0_REG UHFNUML +#define UHFNUML_1_REG UHFNUML +#define UHFNUML_2_REG UHFNUML +#define UHFNUML_3_REG UHFNUML +#define UHFNUML_4_REG UHFNUML +#define UHFNUML_5_REG UHFNUML +#define UHFNUML_6_REG UHFNUML +#define UHFNUML_7_REG UHFNUML + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UPDATX */ +#define PDAT0_REG UPDATX +#define PDAT1_REG UPDATX +#define PDAT2_REG UPDATX +#define PDAT3_REG UPDATX +#define PDAT4_REG UPDATX +#define PDAT5_REG UPDATX +#define PDAT6_REG UPDATX +#define PDAT7_REG UPDATX + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* UHCON */ +#define SOFEN_REG UHCON +#define RESET_REG UHCON +#define RESUME_REG UHCON + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* UPINT */ +#define PINT0_REG UPINT +#define PINT1_REG UPINT +#define PINT2_REG UPINT +#define PINT3_REG UPINT +#define PINT4_REG UPINT +#define PINT5_REG UPINT +#define PINT6_REG UPINT + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* UPSTAX */ +#define NBUSYK0_REG UPSTAX +#define NBUSYK1_REG UPSTAX +/* #define DTSEQ0_REG UPSTAX */ /* dup in UESTA0X */ +/* #define DTSEQ1_REG UPSTAX */ /* dup in UESTA0X */ +/* #define UNDERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define OVERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define CFGOK_REG UPSTAX */ /* dup in UESTA0X */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +/* #define RWAL_REG UEINTX */ /* dup in UPINTX */ +#define NAKINI_REG UEINTX +/* #define FIFOCON_REG UEINTX */ /* dup in UPINTX */ + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* UPCFG0X */ +#define PEPNUM0_REG UPCFG0X +#define PEPNUM1_REG UPCFG0X +#define PEPNUM2_REG UPCFG0X +#define PEPNUM3_REG UPCFG0X +#define PTOKEN0_REG UPCFG0X +#define PTOKEN1_REG UPCFG0X +#define PTYPE0_REG UPCFG0X +#define PTYPE1_REG UPCFG0X + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* UPERRX */ +#define DATATGL_REG UPERRX +#define DATAPID_REG UPERRX +#define PID_REG UPERRX +#define TIMEOUT_REG UPERRX +#define CRC16_REG UPERRX +#define COUNTER0_REG UPERRX +#define COUNTER1_REG UPERRX + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* UPCONX */ +#define PEN_REG UPCONX +/* #define RSTDT_REG UPCONX */ /* dup in UECONX */ +#define INMODE_REG UPCONX +#define PFREEZE_REG UPCONX + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* UPBCLX */ +#define PBYCT0_REG UPBCLX +#define PBYCT1_REG UPBCLX +#define PBYCT2_REG UPBCLX +#define PBYCT3_REG UPBCLX +#define PBYCT4_REG UPBCLX +#define PBYCT5_REG UPBCLX +#define PBYCT6_REG UPBCLX +#define PBYCT7_REG UPBCLX + +/* UHINT */ +#define DCONNI_REG UHINT +#define DDISCI_REG UHINT +#define RSTI_REG UHINT +#define RSMEDI_REG UHINT +#define RXRSMI_REG UHINT +#define HSOFI_REG UHINT +#define UHUPI_REG UHINT + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UPNUM */ +#define PNUM0_REG UPNUM +#define PNUM1_REG UPNUM +#define PNUM2_REG UPNUM + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UPCFG1X */ +/* #define ALLOC_REG UPCFG1X */ /* dup in UECFG1X */ +#define PBK0_REG UPCFG1X +#define PBK1_REG UPCFG1X +#define PSIZE0_REG UPCFG1X +#define PSIZE1_REG UPCFG1X +#define PSIZE2_REG UPCFG1X + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +/* #define FLERRE_REG UEIENX */ /* dup in UPIENX */ + +/* OTGCON */ +#define VBUSRQC_REG OTGCON +#define VBUSREQ_REG OTGCON +#define VBUSHWC_REG OTGCON +#define SRPSEL_REG OTGCON +#define SRPREQ_REG OTGCON +#define HNPREQ_REG OTGCON + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UPINRQX */ +#define INRQ0_REG UPINRQX +#define INRQ1_REG UPINRQX +#define INRQ2_REG UPINRQX +#define INRQ3_REG UPINRQX +#define INRQ4_REG UPINRQX +#define INRQ5_REG UPINRQX +#define INRQ6_REG UPINRQX +#define INRQ7_REG UPINRQX + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* UPINTX */ +#define RXINI_REG UPINTX +#define RXSTALLI_REG UPINTX +#define TXOUTI_REG UPINTX +#define TXSTPI_REG UPINTX +#define PERRI_REG UPINTX +/* #define RWAL_REG UPINTX */ /* dup in UEINTX */ +#define NAKEDI_REG UPINTX +/* #define FIFOCON_REG UPINTX */ /* dup in UEINTX */ + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* UPCFG2X */ +#define UPCFG2X_0_REG UPCFG2X +#define UPCFG2X_1_REG UPCFG2X +#define UPCFG2X_2_REG UPCFG2X +#define UPCFG2X_3_REG UPCFG2X +#define UPCFG2X_4_REG UPCFG2X +#define UPCFG2X_5_REG UPCFG2X +#define UPCFG2X_6_REG UPCFG2X +#define UPCFG2X_7_REG UPCFG2X + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +/* #define DTSEQ0_REG UESTA0X */ /* dup in UPSTAX */ +/* #define DTSEQ1_REG UESTA0X */ /* dup in UPSTAX */ +/* #define UNDERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define OVERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define CFGOK_REG UESTA0X */ /* dup in UPSTAX */ + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UPRST */ +#define PRST0_REG UPRST +#define PRST1_REG UPRST +#define PRST2_REG UPRST +#define PRST3_REG UPRST +#define PRST4_REG UPRST +#define PRST5_REG UPRST +#define PRST6_REG UPRST + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB1287.h~ b/aversive/parts/AT90USB1287.h~ new file mode 100644 index 0000000..21be664 --- /dev/null +++ b/aversive/parts/AT90USB1287.h~ @@ -0,0 +1,1599 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UPIENX */ +#define RXINE_REG UPIENX +#define RXSTALLE_REG UPIENX +#define TXOUTE_REG UPIENX +#define TXSTPE_REG UPIENX +#define PERRE_REG UPIENX +#define NAKEDE_REG UPIENX +/* #define FLERRE_REG UPIENX */ /* dup in UEIENX */ + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +/* #define ALLOC_REG UECFG1X */ /* dup in UPCFG1X */ +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UECONX */ +#define EPEN_REG UECONX +/* #define RSTDT_REG UECONX */ /* dup in UPCONX */ +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OTGIEN */ +#define SRPE_REG OTGIEN +#define VBERRE_REG OTGIEN +#define BCERRE_REG OTGIEN +#define ROLEEXE_REG OTGIEN +#define HNPERRE_REG OTGIEN +#define STOE_REG OTGIEN + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* OTGTCON */ +#define VALUE_20_REG OTGTCON +#define VALUE_21_REG OTGTCON +#define VALUE_22_REG OTGTCON +#define PAGE0_REG OTGTCON +#define PAGE1_REG OTGTCON +#define OTGTCON_7_REG OTGTCON + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UPBCHX */ +#define PBYCT8_REG UPBCHX +#define PBYCT9_REG UPBCHX +#define PBYCT10_REG UPBCHX + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* OTGINT */ +#define SRPI_REG OTGINT +#define VBERRI_REG OTGINT +#define BCERRI_REG OTGINT +#define ROLEEXI_REG OTGINT +#define HNPERRI_REG OTGINT +#define STOI_REG OTGINT + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UHIEN */ +#define DCONNE_REG UHIEN +#define DDISCE_REG UHIEN +#define RSTE_REG UHIEN +#define RSMEDE_REG UHIEN +#define RXRSME_REG UHIEN +#define HSOFE_REG UHIEN +#define HWUPE_REG UHIEN + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* UHADDR */ +#define UHADDR_0_REG UHADDR +#define UHADDR_1_REG UHADDR +#define UHADDR_2_REG UHADDR +#define UHADDR_3_REG UHADDR +#define UHADDR_4_REG UHADDR +#define UHADDR_5_REG UHADDR +#define UHADDR_6_REG UHADDR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* UHFLEN */ +#define UHFLEN_0_REG UHFLEN +#define UHFLEN_1_REG UHFLEN +#define UHFLEN_2_REG UHFLEN +#define UHFLEN_3_REG UHFLEN +#define UHFLEN_4_REG UHFLEN +#define UHFLEN_5_REG UHFLEN +#define UHFLEN_6_REG UHFLEN +#define UHFLEN_7_REG UHFLEN + +/* UHFNUMH */ +#define UHFNUMH_0_REG UHFNUMH +#define UHFNUMH_1_REG UHFNUMH +#define UHFNUMH_2_REG UHFNUMH + +/* UHFNUML */ +#define UHFNUML_0_REG UHFNUML +#define UHFNUML_1_REG UHFNUML +#define UHFNUML_2_REG UHFNUML +#define UHFNUML_3_REG UHFNUML +#define UHFNUML_4_REG UHFNUML +#define UHFNUML_5_REG UHFNUML +#define UHFNUML_6_REG UHFNUML +#define UHFNUML_7_REG UHFNUML + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UPDATX */ +#define PDAT0_REG UPDATX +#define PDAT1_REG UPDATX +#define PDAT2_REG UPDATX +#define PDAT3_REG UPDATX +#define PDAT4_REG UPDATX +#define PDAT5_REG UPDATX +#define PDAT6_REG UPDATX +#define PDAT7_REG UPDATX + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* UHCON */ +#define SOFEN_REG UHCON +#define RESET_REG UHCON +#define RESUME_REG UHCON + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* UPINT */ +#define PINT0_REG UPINT +#define PINT1_REG UPINT +#define PINT2_REG UPINT +#define PINT3_REG UPINT +#define PINT4_REG UPINT +#define PINT5_REG UPINT +#define PINT6_REG UPINT + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* UPSTAX */ +#define NBUSYK0_REG UPSTAX +#define NBUSYK1_REG UPSTAX +/* #define DTSEQ0_REG UPSTAX */ /* dup in UESTA0X */ +/* #define DTSEQ1_REG UPSTAX */ /* dup in UESTA0X */ +/* #define UNDERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define OVERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define CFGOK_REG UPSTAX */ /* dup in UESTA0X */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +/* #define RWAL_REG UEINTX */ /* dup in UPINTX */ +#define NAKINI_REG UEINTX +/* #define FIFOCON_REG UEINTX */ /* dup in UPINTX */ + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* UPCFG0X */ +#define PEPNUM0_REG UPCFG0X +#define PEPNUM1_REG UPCFG0X +#define PEPNUM2_REG UPCFG0X +#define PEPNUM3_REG UPCFG0X +#define PTOKEN0_REG UPCFG0X +#define PTOKEN1_REG UPCFG0X +#define PTYPE0_REG UPCFG0X +#define PTYPE1_REG UPCFG0X + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* UPERRX */ +#define DATATGL_REG UPERRX +#define DATAPID_REG UPERRX +#define PID_REG UPERRX +#define TIMEOUT_REG UPERRX +#define CRC16_REG UPERRX +#define COUNTER0_REG UPERRX +#define COUNTER1_REG UPERRX + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* UPCONX */ +#define PEN_REG UPCONX +/* #define RSTDT_REG UPCONX */ /* dup in UECONX */ +#define INMODE_REG UPCONX +#define PFREEZE_REG UPCONX + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* UPBCLX */ +#define PBYCT0_REG UPBCLX +#define PBYCT1_REG UPBCLX +#define PBYCT2_REG UPBCLX +#define PBYCT3_REG UPBCLX +#define PBYCT4_REG UPBCLX +#define PBYCT5_REG UPBCLX +#define PBYCT6_REG UPBCLX +#define PBYCT7_REG UPBCLX + +/* UHINT */ +#define DCONNI_REG UHINT +#define DDISCI_REG UHINT +#define RSTI_REG UHINT +#define RSMEDI_REG UHINT +#define RXRSMI_REG UHINT +#define HSOFI_REG UHINT +#define UHUPI_REG UHINT + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UPNUM */ +#define PNUM0_REG UPNUM +#define PNUM1_REG UPNUM +#define PNUM2_REG UPNUM + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UPCFG1X */ +/* #define ALLOC_REG UPCFG1X */ /* dup in UECFG1X */ +#define PBK0_REG UPCFG1X +#define PBK1_REG UPCFG1X +#define PSIZE0_REG UPCFG1X +#define PSIZE1_REG UPCFG1X +#define PSIZE2_REG UPCFG1X + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +/* #define FLERRE_REG UEIENX */ /* dup in UPIENX */ + +/* OTGCON */ +#define VBUSRQC_REG OTGCON +#define VBUSREQ_REG OTGCON +#define VBUSHWC_REG OTGCON +#define SRPSEL_REG OTGCON +#define SRPREQ_REG OTGCON +#define HNPREQ_REG OTGCON + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UPINRQX */ +#define INRQ0_REG UPINRQX +#define INRQ1_REG UPINRQX +#define INRQ2_REG UPINRQX +#define INRQ3_REG UPINRQX +#define INRQ4_REG UPINRQX +#define INRQ5_REG UPINRQX +#define INRQ6_REG UPINRQX +#define INRQ7_REG UPINRQX + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* UPINTX */ +#define RXINI_REG UPINTX +#define RXSTALLI_REG UPINTX +#define TXOUTI_REG UPINTX +#define TXSTPI_REG UPINTX +#define PERRI_REG UPINTX +/* #define RWAL_REG UPINTX */ /* dup in UEINTX */ +#define NAKEDI_REG UPINTX +/* #define FIFOCON_REG UPINTX */ /* dup in UEINTX */ + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* UPCFG2X */ +#define UPCFG2X_0_REG UPCFG2X +#define UPCFG2X_1_REG UPCFG2X +#define UPCFG2X_2_REG UPCFG2X +#define UPCFG2X_3_REG UPCFG2X +#define UPCFG2X_4_REG UPCFG2X +#define UPCFG2X_5_REG UPCFG2X +#define UPCFG2X_6_REG UPCFG2X +#define UPCFG2X_7_REG UPCFG2X + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +/* #define DTSEQ0_REG UESTA0X */ /* dup in UPSTAX */ +/* #define DTSEQ1_REG UESTA0X */ /* dup in UPSTAX */ +/* #define UNDERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define OVERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define CFGOK_REG UESTA0X */ /* dup in UPSTAX */ + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UPRST */ +#define PRST0_REG UPRST +#define PRST1_REG UPRST +#define PRST2_REG UPRST +#define PRST3_REG UPRST +#define PRST4_REG UPRST +#define PRST5_REG UPRST +#define PRST6_REG UPRST + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB162.h b/aversive/parts/AT90USB162.h new file mode 100644 index 0000000..9eb8f03 --- /dev/null +++ b/aversive/parts/AT90USB162.h @@ -0,0 +1,918 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 5 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM_TOTAL_NUM 5 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PS2CON */ +#define PS2EN_REG PS2CON + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* REGCR */ +#define REGDIS_REG REGCR + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define DAT0_REG UEDATX +#define DAT1_REG UEDATX +#define DAT2_REG UEDATX +#define DAT3_REG UEDATX +#define DAT4_REG UEDATX +#define DAT5_REG UEDATX +#define DAT6_REG UEDATX +#define DAT7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* CLKSEL1 */ +#define EXCKSEL0_REG CLKSEL1 +#define EXCKSEL1_REG CLKSEL1 +#define EXCKSEL2_REG CLKSEL1 +#define EXCKSEL3_REG CLKSEL1 +#define RCCKSEL0_REG CLKSEL1 +#define RCCKSEL1_REG CLKSEL1 +#define RCCKSEL2_REG CLKSEL1 +#define RCCKSEL3_REG CLKSEL1 + +/* CLKSEL0 */ +#define CLKS_REG CLKSEL0 +#define EXTE_REG CLKSEL0 +#define RCE_REG CLKSEL0 +#define EXSUT0_REG CLKSEL0 +#define EXSUT1_REG CLKSEL0 +#define RCSUT0_REG CLKSEL0 +#define RCSUT1_REG CLKSEL0 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UPOE */ +#define DMI_REG UPOE +#define DPI_REG UPOE +#define DATAI_REG UPOE +#define SCKI_REG UPOE +#define UPDRV0_REG UPOE +#define UPDRV1_REG UPOE +#define UPWE0_REG UPOE +#define UPWE1_REG UPOE + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define EPNUM0_REG UENUM +#define EPNUM1_REG UENUM +#define EPNUM2_REG UENUM + +/* UBRR1L */ +#define UBRR1_0_REG UBRR1L +#define UBRR1_1_REG UBRR1L +#define UBRR1_2_REG UBRR1L +#define UBRR1_3_REG UBRR1L +#define UBRR1_4_REG UBRR1L +#define UBRR1_5_REG UBRR1L +#define UBRR1_6_REG UBRR1L +#define UBRR1_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define RSTCPU_REG UDCON + +/* WDTCKD */ +#define WCLKD0_REG WDTCKD +#define WCLKD1_REG WDTCKD +#define WDEWIE_REG WDTCKD +#define WDEWIF_REG WDTCKD + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* UEBCLX */ +#define BYCT0_REG UEBCLX +#define BYCT1_REG UEBCLX +#define BYCT2_REG UEBCLX +#define BYCT3_REG UEBCLX +#define BYCT4_REG UEBCLX +#define BYCT5_REG UEBCLX +#define BYCT6_REG UEBCLX +#define BYCT7_REG UEBCLX + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define FRZCLK_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define USBRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UCSR1D */ +#define RTSEN_REG UCSR1D +#define CTSEN_REG UCSR1D + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define FNUM0_REG UDFNUML +#define FNUM1_REG UDFNUML +#define FNUM2_REG UDFNUML +#define FNUM3_REG UDFNUML +#define FNUM4_REG UDFNUML +#define FNUM5_REG UDFNUML +#define FNUM6_REG UDFNUML +#define FNUM7_REG UDFNUML + +/* UDFNUMH */ +#define FNUM8_REG UDFNUMH +#define FNUM9_REG UDFNUMH +#define FNUM10_REG UDFNUMH + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* PRR0 */ +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 + +/* UBRR1H */ +#define UBRR1_8_REG UBRR1H +#define UBRR1_9_REG UBRR1H +#define UBRR1_10_REG UBRR1H +#define UBRR1_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* CLKSTA */ +#define EXTON_REG CLKSTA +#define RCON_REG CLKSTA + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSB_REG PRR1 + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB646.h b/aversive/parts/AT90USB646.h new file mode 100644 index 0000000..21be664 --- /dev/null +++ b/aversive/parts/AT90USB646.h @@ -0,0 +1,1599 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UPIENX */ +#define RXINE_REG UPIENX +#define RXSTALLE_REG UPIENX +#define TXOUTE_REG UPIENX +#define TXSTPE_REG UPIENX +#define PERRE_REG UPIENX +#define NAKEDE_REG UPIENX +/* #define FLERRE_REG UPIENX */ /* dup in UEIENX */ + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +/* #define ALLOC_REG UECFG1X */ /* dup in UPCFG1X */ +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UECONX */ +#define EPEN_REG UECONX +/* #define RSTDT_REG UECONX */ /* dup in UPCONX */ +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OTGIEN */ +#define SRPE_REG OTGIEN +#define VBERRE_REG OTGIEN +#define BCERRE_REG OTGIEN +#define ROLEEXE_REG OTGIEN +#define HNPERRE_REG OTGIEN +#define STOE_REG OTGIEN + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* OTGTCON */ +#define VALUE_20_REG OTGTCON +#define VALUE_21_REG OTGTCON +#define VALUE_22_REG OTGTCON +#define PAGE0_REG OTGTCON +#define PAGE1_REG OTGTCON +#define OTGTCON_7_REG OTGTCON + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UPBCHX */ +#define PBYCT8_REG UPBCHX +#define PBYCT9_REG UPBCHX +#define PBYCT10_REG UPBCHX + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* OTGINT */ +#define SRPI_REG OTGINT +#define VBERRI_REG OTGINT +#define BCERRI_REG OTGINT +#define ROLEEXI_REG OTGINT +#define HNPERRI_REG OTGINT +#define STOI_REG OTGINT + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UHIEN */ +#define DCONNE_REG UHIEN +#define DDISCE_REG UHIEN +#define RSTE_REG UHIEN +#define RSMEDE_REG UHIEN +#define RXRSME_REG UHIEN +#define HSOFE_REG UHIEN +#define HWUPE_REG UHIEN + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* UHADDR */ +#define UHADDR_0_REG UHADDR +#define UHADDR_1_REG UHADDR +#define UHADDR_2_REG UHADDR +#define UHADDR_3_REG UHADDR +#define UHADDR_4_REG UHADDR +#define UHADDR_5_REG UHADDR +#define UHADDR_6_REG UHADDR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* UHFLEN */ +#define UHFLEN_0_REG UHFLEN +#define UHFLEN_1_REG UHFLEN +#define UHFLEN_2_REG UHFLEN +#define UHFLEN_3_REG UHFLEN +#define UHFLEN_4_REG UHFLEN +#define UHFLEN_5_REG UHFLEN +#define UHFLEN_6_REG UHFLEN +#define UHFLEN_7_REG UHFLEN + +/* UHFNUMH */ +#define UHFNUMH_0_REG UHFNUMH +#define UHFNUMH_1_REG UHFNUMH +#define UHFNUMH_2_REG UHFNUMH + +/* UHFNUML */ +#define UHFNUML_0_REG UHFNUML +#define UHFNUML_1_REG UHFNUML +#define UHFNUML_2_REG UHFNUML +#define UHFNUML_3_REG UHFNUML +#define UHFNUML_4_REG UHFNUML +#define UHFNUML_5_REG UHFNUML +#define UHFNUML_6_REG UHFNUML +#define UHFNUML_7_REG UHFNUML + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UPDATX */ +#define PDAT0_REG UPDATX +#define PDAT1_REG UPDATX +#define PDAT2_REG UPDATX +#define PDAT3_REG UPDATX +#define PDAT4_REG UPDATX +#define PDAT5_REG UPDATX +#define PDAT6_REG UPDATX +#define PDAT7_REG UPDATX + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* UHCON */ +#define SOFEN_REG UHCON +#define RESET_REG UHCON +#define RESUME_REG UHCON + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* UPINT */ +#define PINT0_REG UPINT +#define PINT1_REG UPINT +#define PINT2_REG UPINT +#define PINT3_REG UPINT +#define PINT4_REG UPINT +#define PINT5_REG UPINT +#define PINT6_REG UPINT + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* UPSTAX */ +#define NBUSYK0_REG UPSTAX +#define NBUSYK1_REG UPSTAX +/* #define DTSEQ0_REG UPSTAX */ /* dup in UESTA0X */ +/* #define DTSEQ1_REG UPSTAX */ /* dup in UESTA0X */ +/* #define UNDERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define OVERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define CFGOK_REG UPSTAX */ /* dup in UESTA0X */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +/* #define RWAL_REG UEINTX */ /* dup in UPINTX */ +#define NAKINI_REG UEINTX +/* #define FIFOCON_REG UEINTX */ /* dup in UPINTX */ + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* UPCFG0X */ +#define PEPNUM0_REG UPCFG0X +#define PEPNUM1_REG UPCFG0X +#define PEPNUM2_REG UPCFG0X +#define PEPNUM3_REG UPCFG0X +#define PTOKEN0_REG UPCFG0X +#define PTOKEN1_REG UPCFG0X +#define PTYPE0_REG UPCFG0X +#define PTYPE1_REG UPCFG0X + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* UPERRX */ +#define DATATGL_REG UPERRX +#define DATAPID_REG UPERRX +#define PID_REG UPERRX +#define TIMEOUT_REG UPERRX +#define CRC16_REG UPERRX +#define COUNTER0_REG UPERRX +#define COUNTER1_REG UPERRX + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* UPCONX */ +#define PEN_REG UPCONX +/* #define RSTDT_REG UPCONX */ /* dup in UECONX */ +#define INMODE_REG UPCONX +#define PFREEZE_REG UPCONX + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* UPBCLX */ +#define PBYCT0_REG UPBCLX +#define PBYCT1_REG UPBCLX +#define PBYCT2_REG UPBCLX +#define PBYCT3_REG UPBCLX +#define PBYCT4_REG UPBCLX +#define PBYCT5_REG UPBCLX +#define PBYCT6_REG UPBCLX +#define PBYCT7_REG UPBCLX + +/* UHINT */ +#define DCONNI_REG UHINT +#define DDISCI_REG UHINT +#define RSTI_REG UHINT +#define RSMEDI_REG UHINT +#define RXRSMI_REG UHINT +#define HSOFI_REG UHINT +#define UHUPI_REG UHINT + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UPNUM */ +#define PNUM0_REG UPNUM +#define PNUM1_REG UPNUM +#define PNUM2_REG UPNUM + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UPCFG1X */ +/* #define ALLOC_REG UPCFG1X */ /* dup in UECFG1X */ +#define PBK0_REG UPCFG1X +#define PBK1_REG UPCFG1X +#define PSIZE0_REG UPCFG1X +#define PSIZE1_REG UPCFG1X +#define PSIZE2_REG UPCFG1X + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +/* #define FLERRE_REG UEIENX */ /* dup in UPIENX */ + +/* OTGCON */ +#define VBUSRQC_REG OTGCON +#define VBUSREQ_REG OTGCON +#define VBUSHWC_REG OTGCON +#define SRPSEL_REG OTGCON +#define SRPREQ_REG OTGCON +#define HNPREQ_REG OTGCON + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UPINRQX */ +#define INRQ0_REG UPINRQX +#define INRQ1_REG UPINRQX +#define INRQ2_REG UPINRQX +#define INRQ3_REG UPINRQX +#define INRQ4_REG UPINRQX +#define INRQ5_REG UPINRQX +#define INRQ6_REG UPINRQX +#define INRQ7_REG UPINRQX + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* UPINTX */ +#define RXINI_REG UPINTX +#define RXSTALLI_REG UPINTX +#define TXOUTI_REG UPINTX +#define TXSTPI_REG UPINTX +#define PERRI_REG UPINTX +/* #define RWAL_REG UPINTX */ /* dup in UEINTX */ +#define NAKEDI_REG UPINTX +/* #define FIFOCON_REG UPINTX */ /* dup in UEINTX */ + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* UPCFG2X */ +#define UPCFG2X_0_REG UPCFG2X +#define UPCFG2X_1_REG UPCFG2X +#define UPCFG2X_2_REG UPCFG2X +#define UPCFG2X_3_REG UPCFG2X +#define UPCFG2X_4_REG UPCFG2X +#define UPCFG2X_5_REG UPCFG2X +#define UPCFG2X_6_REG UPCFG2X +#define UPCFG2X_7_REG UPCFG2X + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +/* #define DTSEQ0_REG UESTA0X */ /* dup in UPSTAX */ +/* #define DTSEQ1_REG UESTA0X */ /* dup in UPSTAX */ +/* #define UNDERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define OVERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define CFGOK_REG UESTA0X */ /* dup in UPSTAX */ + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UPRST */ +#define PRST0_REG UPRST +#define PRST1_REG UPRST +#define PRST2_REG UPRST +#define PRST3_REG UPRST +#define PRST4_REG UPRST +#define PRST5_REG UPRST +#define PRST6_REG UPRST + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB647.h b/aversive/parts/AT90USB647.h new file mode 100644 index 0000000..21be664 --- /dev/null +++ b/aversive/parts/AT90USB647.h @@ -0,0 +1,1599 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UPIENX */ +#define RXINE_REG UPIENX +#define RXSTALLE_REG UPIENX +#define TXOUTE_REG UPIENX +#define TXSTPE_REG UPIENX +#define PERRE_REG UPIENX +#define NAKEDE_REG UPIENX +/* #define FLERRE_REG UPIENX */ /* dup in UEIENX */ + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +/* #define ALLOC_REG UECFG1X */ /* dup in UPCFG1X */ +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UECONX */ +#define EPEN_REG UECONX +/* #define RSTDT_REG UECONX */ /* dup in UPCONX */ +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OTGIEN */ +#define SRPE_REG OTGIEN +#define VBERRE_REG OTGIEN +#define BCERRE_REG OTGIEN +#define ROLEEXE_REG OTGIEN +#define HNPERRE_REG OTGIEN +#define STOE_REG OTGIEN + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* OTGTCON */ +#define VALUE_20_REG OTGTCON +#define VALUE_21_REG OTGTCON +#define VALUE_22_REG OTGTCON +#define PAGE0_REG OTGTCON +#define PAGE1_REG OTGTCON +#define OTGTCON_7_REG OTGTCON + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UPBCHX */ +#define PBYCT8_REG UPBCHX +#define PBYCT9_REG UPBCHX +#define PBYCT10_REG UPBCHX + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* OTGINT */ +#define SRPI_REG OTGINT +#define VBERRI_REG OTGINT +#define BCERRI_REG OTGINT +#define ROLEEXI_REG OTGINT +#define HNPERRI_REG OTGINT +#define STOI_REG OTGINT + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UHIEN */ +#define DCONNE_REG UHIEN +#define DDISCE_REG UHIEN +#define RSTE_REG UHIEN +#define RSMEDE_REG UHIEN +#define RXRSME_REG UHIEN +#define HSOFE_REG UHIEN +#define HWUPE_REG UHIEN + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* UHADDR */ +#define UHADDR_0_REG UHADDR +#define UHADDR_1_REG UHADDR +#define UHADDR_2_REG UHADDR +#define UHADDR_3_REG UHADDR +#define UHADDR_4_REG UHADDR +#define UHADDR_5_REG UHADDR +#define UHADDR_6_REG UHADDR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* UHFLEN */ +#define UHFLEN_0_REG UHFLEN +#define UHFLEN_1_REG UHFLEN +#define UHFLEN_2_REG UHFLEN +#define UHFLEN_3_REG UHFLEN +#define UHFLEN_4_REG UHFLEN +#define UHFLEN_5_REG UHFLEN +#define UHFLEN_6_REG UHFLEN +#define UHFLEN_7_REG UHFLEN + +/* UHFNUMH */ +#define UHFNUMH_0_REG UHFNUMH +#define UHFNUMH_1_REG UHFNUMH +#define UHFNUMH_2_REG UHFNUMH + +/* UHFNUML */ +#define UHFNUML_0_REG UHFNUML +#define UHFNUML_1_REG UHFNUML +#define UHFNUML_2_REG UHFNUML +#define UHFNUML_3_REG UHFNUML +#define UHFNUML_4_REG UHFNUML +#define UHFNUML_5_REG UHFNUML +#define UHFNUML_6_REG UHFNUML +#define UHFNUML_7_REG UHFNUML + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UPDATX */ +#define PDAT0_REG UPDATX +#define PDAT1_REG UPDATX +#define PDAT2_REG UPDATX +#define PDAT3_REG UPDATX +#define PDAT4_REG UPDATX +#define PDAT5_REG UPDATX +#define PDAT6_REG UPDATX +#define PDAT7_REG UPDATX + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* UHCON */ +#define SOFEN_REG UHCON +#define RESET_REG UHCON +#define RESUME_REG UHCON + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* UPINT */ +#define PINT0_REG UPINT +#define PINT1_REG UPINT +#define PINT2_REG UPINT +#define PINT3_REG UPINT +#define PINT4_REG UPINT +#define PINT5_REG UPINT +#define PINT6_REG UPINT + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* UPSTAX */ +#define NBUSYK0_REG UPSTAX +#define NBUSYK1_REG UPSTAX +/* #define DTSEQ0_REG UPSTAX */ /* dup in UESTA0X */ +/* #define DTSEQ1_REG UPSTAX */ /* dup in UESTA0X */ +/* #define UNDERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define OVERFI_REG UPSTAX */ /* dup in UESTA0X */ +/* #define CFGOK_REG UPSTAX */ /* dup in UESTA0X */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +/* #define RWAL_REG UEINTX */ /* dup in UPINTX */ +#define NAKINI_REG UEINTX +/* #define FIFOCON_REG UEINTX */ /* dup in UPINTX */ + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* UPCFG0X */ +#define PEPNUM0_REG UPCFG0X +#define PEPNUM1_REG UPCFG0X +#define PEPNUM2_REG UPCFG0X +#define PEPNUM3_REG UPCFG0X +#define PTOKEN0_REG UPCFG0X +#define PTOKEN1_REG UPCFG0X +#define PTYPE0_REG UPCFG0X +#define PTYPE1_REG UPCFG0X + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* UPERRX */ +#define DATATGL_REG UPERRX +#define DATAPID_REG UPERRX +#define PID_REG UPERRX +#define TIMEOUT_REG UPERRX +#define CRC16_REG UPERRX +#define COUNTER0_REG UPERRX +#define COUNTER1_REG UPERRX + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* UPCONX */ +#define PEN_REG UPCONX +/* #define RSTDT_REG UPCONX */ /* dup in UECONX */ +#define INMODE_REG UPCONX +#define PFREEZE_REG UPCONX + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* UPBCLX */ +#define PBYCT0_REG UPBCLX +#define PBYCT1_REG UPBCLX +#define PBYCT2_REG UPBCLX +#define PBYCT3_REG UPBCLX +#define PBYCT4_REG UPBCLX +#define PBYCT5_REG UPBCLX +#define PBYCT6_REG UPBCLX +#define PBYCT7_REG UPBCLX + +/* UHINT */ +#define DCONNI_REG UHINT +#define DDISCI_REG UHINT +#define RSTI_REG UHINT +#define RSMEDI_REG UHINT +#define RXRSMI_REG UHINT +#define HSOFI_REG UHINT +#define UHUPI_REG UHINT + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UPNUM */ +#define PNUM0_REG UPNUM +#define PNUM1_REG UPNUM +#define PNUM2_REG UPNUM + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UPCFG1X */ +/* #define ALLOC_REG UPCFG1X */ /* dup in UECFG1X */ +#define PBK0_REG UPCFG1X +#define PBK1_REG UPCFG1X +#define PSIZE0_REG UPCFG1X +#define PSIZE1_REG UPCFG1X +#define PSIZE2_REG UPCFG1X + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +/* #define FLERRE_REG UEIENX */ /* dup in UPIENX */ + +/* OTGCON */ +#define VBUSRQC_REG OTGCON +#define VBUSREQ_REG OTGCON +#define VBUSHWC_REG OTGCON +#define SRPSEL_REG OTGCON +#define SRPREQ_REG OTGCON +#define HNPREQ_REG OTGCON + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UPINRQX */ +#define INRQ0_REG UPINRQX +#define INRQ1_REG UPINRQX +#define INRQ2_REG UPINRQX +#define INRQ3_REG UPINRQX +#define INRQ4_REG UPINRQX +#define INRQ5_REG UPINRQX +#define INRQ6_REG UPINRQX +#define INRQ7_REG UPINRQX + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* UPINTX */ +#define RXINI_REG UPINTX +#define RXSTALLI_REG UPINTX +#define TXOUTI_REG UPINTX +#define TXSTPI_REG UPINTX +#define PERRI_REG UPINTX +/* #define RWAL_REG UPINTX */ /* dup in UEINTX */ +#define NAKEDI_REG UPINTX +/* #define FIFOCON_REG UPINTX */ /* dup in UEINTX */ + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* UPCFG2X */ +#define UPCFG2X_0_REG UPCFG2X +#define UPCFG2X_1_REG UPCFG2X +#define UPCFG2X_2_REG UPCFG2X +#define UPCFG2X_3_REG UPCFG2X +#define UPCFG2X_4_REG UPCFG2X +#define UPCFG2X_5_REG UPCFG2X +#define UPCFG2X_6_REG UPCFG2X +#define UPCFG2X_7_REG UPCFG2X + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +/* #define DTSEQ0_REG UESTA0X */ /* dup in UPSTAX */ +/* #define DTSEQ1_REG UESTA0X */ /* dup in UPSTAX */ +/* #define UNDERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define OVERFI_REG UESTA0X */ /* dup in UPSTAX */ +/* #define CFGOK_REG UESTA0X */ /* dup in UPSTAX */ + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UPRST */ +#define PRST0_REG UPRST +#define PRST1_REG UPRST +#define PRST2_REG UPRST +#define PRST3_REG UPRST +#define PRST4_REG UPRST +#define PRST5_REG UPRST +#define PRST6_REG UPRST + +/* pins mapping */ + diff --git a/aversive/parts/AT90USB82.h b/aversive/parts/AT90USB82.h new file mode 100644 index 0000000..9eb8f03 --- /dev/null +++ b/aversive/parts/AT90USB82.h @@ -0,0 +1,918 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 5 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM_TOTAL_NUM 5 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PS2CON */ +#define PS2EN_REG PS2CON + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* REGCR */ +#define REGDIS_REG REGCR + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define DAT0_REG UEDATX +#define DAT1_REG UEDATX +#define DAT2_REG UEDATX +#define DAT3_REG UEDATX +#define DAT4_REG UEDATX +#define DAT5_REG UEDATX +#define DAT6_REG UEDATX +#define DAT7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* CLKSEL1 */ +#define EXCKSEL0_REG CLKSEL1 +#define EXCKSEL1_REG CLKSEL1 +#define EXCKSEL2_REG CLKSEL1 +#define EXCKSEL3_REG CLKSEL1 +#define RCCKSEL0_REG CLKSEL1 +#define RCCKSEL1_REG CLKSEL1 +#define RCCKSEL2_REG CLKSEL1 +#define RCCKSEL3_REG CLKSEL1 + +/* CLKSEL0 */ +#define CLKS_REG CLKSEL0 +#define EXTE_REG CLKSEL0 +#define RCE_REG CLKSEL0 +#define EXSUT0_REG CLKSEL0 +#define EXSUT1_REG CLKSEL0 +#define RCSUT0_REG CLKSEL0 +#define RCSUT1_REG CLKSEL0 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* UPOE */ +#define DMI_REG UPOE +#define DPI_REG UPOE +#define DATAI_REG UPOE +#define SCKI_REG UPOE +#define UPDRV0_REG UPOE +#define UPDRV1_REG UPOE +#define UPWE0_REG UPOE +#define UPWE1_REG UPOE + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define EPNUM0_REG UENUM +#define EPNUM1_REG UENUM +#define EPNUM2_REG UENUM + +/* UBRR1L */ +#define UBRR1_0_REG UBRR1L +#define UBRR1_1_REG UBRR1L +#define UBRR1_2_REG UBRR1L +#define UBRR1_3_REG UBRR1L +#define UBRR1_4_REG UBRR1L +#define UBRR1_5_REG UBRR1L +#define UBRR1_6_REG UBRR1L +#define UBRR1_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define RSTCPU_REG UDCON + +/* WDTCKD */ +#define WCLKD0_REG WDTCKD +#define WCLKD1_REG WDTCKD +#define WDEWIE_REG WDTCKD +#define WDEWIF_REG WDTCKD + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* UEBCLX */ +#define BYCT0_REG UEBCLX +#define BYCT1_REG UEBCLX +#define BYCT2_REG UEBCLX +#define BYCT3_REG UEBCLX +#define BYCT4_REG UEBCLX +#define BYCT5_REG UEBCLX +#define BYCT6_REG UEBCLX +#define BYCT7_REG UEBCLX + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define FRZCLK_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define USBRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* UCSR1D */ +#define RTSEN_REG UCSR1D +#define CTSEN_REG UCSR1D + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define FNUM0_REG UDFNUML +#define FNUM1_REG UDFNUML +#define FNUM2_REG UDFNUML +#define FNUM3_REG UDFNUML +#define FNUM4_REG UDFNUML +#define FNUM5_REG UDFNUML +#define FNUM6_REG UDFNUML +#define FNUM7_REG UDFNUML + +/* UDFNUMH */ +#define FNUM8_REG UDFNUMH +#define FNUM9_REG UDFNUMH +#define FNUM10_REG UDFNUMH + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* PRR0 */ +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 + +/* UBRR1H */ +#define UBRR1_8_REG UBRR1H +#define UBRR1_9_REG UBRR1H +#define UBRR1_10_REG UBRR1H +#define UBRR1_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* CLKSTA */ +#define EXTON_REG CLKSTA +#define RCON_REG CLKSTA + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSB_REG PRR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATmega103.h b/aversive/parts/ATmega103.h new file mode 100644 index 0000000..a2c465a --- /dev/null +++ b/aversive/parts/ATmega103.h @@ -0,0 +1,811 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define CTC0_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define PWM0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* TIMSK */ +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* EICR */ +#define ISC40_REG EICR +#define ISC41_REG EICR +#define ISC50_REG EICR +#define ISC51_REG EICR +#define ISC60_REG EICR +#define ISC61_REG EICR +#define ISC70_REG EICR +#define ISC71_REG EICR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* ADCL */ +#define ADC0_REG ADCL +#define ADC1_REG ADCL +#define ADC2_REG ADCL +#define ADC3_REG ADCL +#define ADC4_REG ADCL +#define ADC5_REG ADCL +#define ADC6_REG ADCL +#define ADC7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADC8_REG ADCH +#define ADC9_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 + +/* TIFR */ +#define TOV2_REG TIFR +#define OCF2_REG TIFR +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR + +/* UCR */ +#define TXB8_REG UCR +#define RXB8_REG UCR +#define CHR9_REG UCR +#define TXEN_REG UCR +#define RXEN_REG UCR +#define UDRIE_REG UCR +#define TXCIE_REG UCR +#define RXCIE_REG UCR + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* MCUCR */ +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USR */ +#define OR_REG USR +#define FE_REG USR +#define UDRE_REG USR +#define TXC_REG USR +#define RXC_REG USR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define AC+_PORT PORTE +#define AC+_BIT 2 + +#define AC-_PORT PORTE +#define AC-_BIT 3 + +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 + + diff --git a/aversive/parts/ATmega103comp.h b/aversive/parts/ATmega103comp.h new file mode 100644 index 0000000..57b5ed6 --- /dev/null +++ b/aversive/parts/ATmega103comp.h @@ -0,0 +1,902 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define CTC0_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define PWM0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* TIMSK */ +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR321_REG SFIOR +#define PSR0_REG SFIOR +#define PUD_REG SFIOR +#define TSM_REG SFIOR + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 + +/* TIFR */ +#define TOV2_REG TIFR +#define OCF2_REG TIFR +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define SM2_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/ATmega128.h b/aversive/parts/ATmega128.h new file mode 100644 index 0000000..ce7bb16 --- /dev/null +++ b/aversive/parts/ATmega128.h @@ -0,0 +1,1327 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR321_REG SFIOR +#define PSR0_REG SFIOR +#define PUD_REG SFIOR +#define TSM_REG SFIOR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* ETIFR */ +#define OCF1C_REG ETIFR +#define OCF3C_REG ETIFR +#define TOV3_REG ETIFR +#define OCF3B_REG ETIFR +#define OCF3A_REG ETIFR +#define ICF3_REG ETIFR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* ETIMSK */ +#define OCIE1C_REG ETIMSK +#define OCIE3C_REG ETIMSK +#define TOIE3_REG ETIMSK +#define OCIE3B_REG ETIMSK +#define OCIE3A_REG ETIMSK +#define TICIE3_REG ETIMSK + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCN3L0_REG TCNT3L +#define TCN3L1_REG TCNT3L +#define TCN3L2_REG TCNT3L +#define TCN3L3_REG TCNT3L +#define TCN3L4_REG TCNT3L +#define TCN3L5_REG TCNT3L +#define TCN3L6_REG TCNT3L +#define TCN3L7_REG TCNT3L + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define SM2_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADFR_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW11_REG XMCRA +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/ATmega1280.h b/aversive/parts/ATmega1280.h new file mode 100644 index 0000000..b3838b0 --- /dev/null +++ b/aversive/parts/ATmega1280.h @@ -0,0 +1,2188 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ +#define TIMER4_PRESCALER_DIV_0 0 +#define TIMER4_PRESCALER_DIV_1 1 +#define TIMER4_PRESCALER_DIV_8 2 +#define TIMER4_PRESCALER_DIV_64 3 +#define TIMER4_PRESCALER_DIV_256 4 +#define TIMER4_PRESCALER_DIV_1024 5 +#define TIMER4_PRESCALER_DIV_FALL 6 +#define TIMER4_PRESCALER_DIV_RISE 7 + +#define TIMER4_PRESCALER_REG_0 0 +#define TIMER4_PRESCALER_REG_1 1 +#define TIMER4_PRESCALER_REG_2 8 +#define TIMER4_PRESCALER_REG_3 64 +#define TIMER4_PRESCALER_REG_4 256 +#define TIMER4_PRESCALER_REG_5 1024 +#define TIMER4_PRESCALER_REG_6 -1 +#define TIMER4_PRESCALER_REG_7 -2 + +/* prescalers timer 5 */ +#define TIMER5_PRESCALER_DIV_0 0 +#define TIMER5_PRESCALER_DIV_1 1 +#define TIMER5_PRESCALER_DIV_8 2 +#define TIMER5_PRESCALER_DIV_64 3 +#define TIMER5_PRESCALER_DIV_256 4 +#define TIMER5_PRESCALER_DIV_1024 5 +#define TIMER5_PRESCALER_DIV_FALL 6 +#define TIMER5_PRESCALER_DIV_RISE 7 + +#define TIMER5_PRESCALER_REG_0 0 +#define TIMER5_PRESCALER_REG_1 1 +#define TIMER5_PRESCALER_REG_2 8 +#define TIMER5_PRESCALER_REG_3 64 +#define TIMER5_PRESCALER_REG_4 256 +#define TIMER5_PRESCALER_REG_5 1024 +#define TIMER5_PRESCALER_REG_6 -1 +#define TIMER5_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE +#define TIMER4C_AVAILABLE +#define TIMER5_AVAILABLE +#define TIMER5A_AVAILABLE +#define TIMER5B_AVAILABLE +#define TIMER5C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW4_NUM 4 +#define SIG_OVERFLOW5_NUM 5 +#define SIG_OVERFLOW_TOTAL_NUM 6 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE4A_NUM 10 +#define SIG_OUTPUT_COMPARE4B_NUM 11 +#define SIG_OUTPUT_COMPARE4C_NUM 12 +#define SIG_OUTPUT_COMPARE5A_NUM 13 +#define SIG_OUTPUT_COMPARE5B_NUM 14 +#define SIG_OUTPUT_COMPARE5C_NUM 15 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 16 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM4A_NUM 10 +#define PWM4B_NUM 11 +#define PWM4C_NUM 12 +#define PWM5A_NUM 13 +#define PWM5B_NUM 14 +#define PWM5C_NUM 15 +#define PWM_TOTAL_NUM 16 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE4_NUM 2 +#define SIG_INPUT_CAPTURE5_NUM 3 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 4 + + +/* UBRR3H */ +/* #define UBRR8_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR9_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR10_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR11_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ + +/* UBRR3L */ +/* #define UBRR0_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR1_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR2_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR3_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR4_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR5_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR6_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR7_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UCSR3A */ +#define MPCM3_REG UCSR3A +#define U2X3_REG UCSR3A +#define UPE3_REG UCSR3A +#define DOR3_REG UCSR3A +#define FE3_REG UCSR3A +#define UDRE3_REG UCSR3A +#define TXC3_REG UCSR3A +#define RXC3_REG UCSR3A + +/* UCSR3B */ +#define TXB83_REG UCSR3B +#define RXB83_REG UCSR3B +#define UCSZ32_REG UCSR3B +#define TXEN3_REG UCSR3B +#define RXEN3_REG UCSR3B +#define UDRIE3_REG UCSR3B +#define TXCIE3_REG UCSR3B +#define RXCIE3_REG UCSR3B + +/* UCSR3C */ +#define UCPOL3_REG UCSR3C +#define UCSZ30_REG UCSR3C +#define UCSZ31_REG UCSR3C +#define USBS3_REG UCSR3C +#define UPM30_REG UCSR3C +#define UPM31_REG UCSR3C +#define UMSEL30_REG UCSR3C +#define UMSEL31_REG UCSR3C + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ +#define RAMPZ1_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PORTL */ +#define PORTL0_REG PORTL +#define PORTL1_REG PORTL +#define PORTL2_REG PORTL +#define PORTL3_REG PORTL +#define PORTL4_REG PORTL +#define PORTL5_REG PORTL +#define PORTL6_REG PORTL +#define PORTL7_REG PORTL + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ +#define PORTJ7_REG PORTJ + +/* PORTK */ +#define PORTK0_REG PORTK +#define PORTK1_REG PORTK +#define PORTK2_REG PORTK +#define PORTK3_REG PORTK +#define PORTK4_REG PORTK +#define PORTK5_REG PORTK +#define PORTK6_REG PORTK +#define PORTK7_REG PORTK + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* UDR3 */ +#define UDR3_0_REG UDR3 +#define UDR3_1_REG UDR3 +#define UDR3_2_REG UDR3 +#define UDR3_3_REG UDR3 +#define UDR3_4_REG UDR3 +#define UDR3_5_REG UDR3 +#define UDR3_6_REG UDR3 +#define UDR3_7_REG UDR3 + +/* UDR2 */ +#define UDR2_0_REG UDR2 +#define UDR2_1_REG UDR2 +#define UDR2_2_REG UDR2 +#define UDR2_3_REG UDR2 +#define UDR2_4_REG UDR2 +#define UDR2_5_REG UDR2 +#define UDR2_6_REG UDR2 +#define UDR2_7_REG UDR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 +#define ADC14D_REG DIDR2 +#define ADC15D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ +#define DDJ7_REG DDRJ + +/* DDRK */ +#define DDK0_REG DDRK +#define DDK1_REG DDRK +#define DDK2_REG DDRK +#define DDK3_REG DDRK +#define DDK4_REG DDRK +#define DDK5_REG DDRK +#define DDK6_REG DDRK +#define DDK7_REG DDRK + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRL */ +#define DDL0_REG DDRL +#define DDL1_REG DDRL +#define DDL2_REG DDRL +#define DDL3_REG DDRL +#define DDL4_REG DDRL +#define DDL5_REG DDRL +#define DDL6_REG DDRL +#define DDL7_REG DDRL + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCNT5H */ +#define TCNT5H0_REG TCNT5H +#define TCNT5H1_REG TCNT5H +#define TCNT5H2_REG TCNT5H +#define TCNT5H3_REG TCNT5H +#define TCNT5H4_REG TCNT5H +#define TCNT5H5_REG TCNT5H +#define TCNT5H6_REG TCNT5H +#define TCNT5H7_REG TCNT5H + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* TCNT5L */ +#define TCNT5L0_REG TCNT5L +#define TCNT5L1_REG TCNT5L +#define TCNT5L2_REG TCNT5L +#define TCNT5L3_REG TCNT5L +#define TCNT5L4_REG TCNT5L +#define TCNT5L5_REG TCNT5L +#define TCNT5L6_REG TCNT5L +#define TCNT5L7_REG TCNT5L + +/* UBRR2H */ +/* #define UBRR8_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR9_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR10_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR11_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ + +/* UBRR2L */ +/* #define UBRR0_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR1_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR2_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR3_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR4_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR5_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR6_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR7_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UCSR2B */ +#define TXB82_REG UCSR2B +#define RXB82_REG UCSR2B +#define UCSZ22_REG UCSR2B +#define TXEN2_REG UCSR2B +#define RXEN2_REG UCSR2B +#define UDRIE2_REG UCSR2B +#define TXCIE2_REG UCSR2B +#define RXCIE2_REG UCSR2B + +/* UCSR2A */ +#define MPCM2_REG UCSR2A +#define U2X2_REG UCSR2A +#define UPE2_REG UCSR2A +#define DOR2_REG UCSR2A +#define FE2_REG UCSR2A +#define UDRE2_REG UCSR2A +#define TXC2_REG UCSR2A +#define RXC2_REG UCSR2A + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UCSR2C */ +#define UCPOL2_REG UCSR2C +#define UCSZ20_REG UCSR2C +#define UCSZ21_REG UCSR2C +#define USBS2_REG UCSR2C +#define UPM20_REG UCSR2C +#define UPM21_REG UCSR2C +#define UMSEL20_REG UCSR2C +#define UMSEL21_REG UCSR2C + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4C_REG TIFR4 +#define ICF4_REG TIFR4 + +/* TIFR5 */ +#define TOV5_REG TIFR5 +#define OCF5A_REG TIFR5 +#define OCF5B_REG TIFR5 +#define OCF5C_REG TIFR5 +#define ICF5_REG TIFR5 + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* OCR4AH */ +#define OCR4AH0_REG OCR4AH +#define OCR4AH1_REG OCR4AH +#define OCR4AH2_REG OCR4AH +#define OCR4AH3_REG OCR4AH +#define OCR4AH4_REG OCR4AH +#define OCR4AH5_REG OCR4AH +#define OCR4AH6_REG OCR4AH +#define OCR4AH7_REG OCR4AH + +/* OCR5CH */ +#define OCR5CH0_REG OCR5CH +#define OCR5CH1_REG OCR5CH +#define OCR5CH2_REG OCR5CH +#define OCR5CH3_REG OCR5CH +#define OCR5CH4_REG OCR5CH +#define OCR5CH5_REG OCR5CH +#define OCR5CH6_REG OCR5CH +#define OCR5CH7_REG OCR5CH + +/* OCR4AL */ +#define OCR4AL0_REG OCR4AL +#define OCR4AL1_REG OCR4AL +#define OCR4AL2_REG OCR4AL +#define OCR4AL3_REG OCR4AL +#define OCR4AL4_REG OCR4AL +#define OCR4AL5_REG OCR4AL +#define OCR4AL6_REG OCR4AL +#define OCR4AL7_REG OCR4AL + +/* OCR5CL */ +#define OCR5CL0_REG OCR5CL +#define OCR5CL1_REG OCR5CL +#define OCR5CL2_REG OCR5CL +#define OCR5CL3_REG OCR5CL +#define OCR5CL4_REG OCR5CL +#define OCR5CL5_REG OCR5CL +#define OCR5CL6_REG OCR5CL +#define OCR5CL7_REG OCR5CL + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* ICR5L */ +#define ICR5L0_REG ICR5L +#define ICR5L1_REG ICR5L +#define ICR5L2_REG ICR5L +#define ICR5L3_REG ICR5L +#define ICR5L4_REG ICR5L +#define ICR5L5_REG ICR5L +#define ICR5L6_REG ICR5L +#define ICR5L7_REG ICR5L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ICR5H */ +#define ICR5H0_REG ICR5H +#define ICR5H1_REG ICR5H +#define ICR5H2_REG ICR5H +#define ICR5H3_REG ICR5H +#define ICR5H4_REG ICR5H +#define ICR5H5_REG ICR5H +#define ICR5H6_REG ICR5H +#define ICR5H7_REG ICR5H + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* PINK */ +#define PINK0_REG PINK +#define PINK1_REG PINK +#define PINK2_REG PINK +#define PINK3_REG PINK +#define PINK4_REG PINK +#define PINK5_REG PINK +#define PINK6_REG PINK +#define PINK7_REG PINK + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ +#define PINJ7_REG PINJ + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* ICR4H */ +#define ICR4H0_REG ICR4H +#define ICR4H1_REG ICR4H +#define ICR4H2_REG ICR4H +#define ICR4H3_REG ICR4H +#define ICR4H4_REG ICR4H +#define ICR4H5_REG ICR4H +#define ICR4H6_REG ICR4H +#define ICR4H7_REG ICR4H + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* ICR4L */ +#define ICR4L0_REG ICR4L +#define ICR4L1_REG ICR4L +#define ICR4L2_REG ICR4L +#define ICR4L3_REG ICR4L +#define ICR4L4_REG ICR4L +#define ICR4L5_REG ICR4L +#define ICR4L6_REG ICR4L +#define ICR4L7_REG ICR4L + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* TCNT4L */ +#define TCNT4L0_REG TCNT4L +#define TCNT4L1_REG TCNT4L +#define TCNT4L2_REG TCNT4L +#define TCNT4L3_REG TCNT4L +#define TCNT4L4_REG TCNT4L +#define TCNT4L5_REG TCNT4L +#define TCNT4L6_REG TCNT4L +#define TCNT4L7_REG TCNT4L + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* TCNT4H */ +#define TCNT4H0_REG TCNT4H +#define TCNT4H1_REG TCNT4H +#define TCNT4H2_REG TCNT4H +#define TCNT4H3_REG TCNT4H +#define TCNT4H4_REG TCNT4H +#define TCNT4H5_REG TCNT4H +#define TCNT4H6_REG TCNT4H +#define TCNT4H7_REG TCNT4H + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TCCR5A */ +#define WGM50_REG TCCR5A +#define WGM51_REG TCCR5A +#define COM5C0_REG TCCR5A +#define COM5C1_REG TCCR5A +#define COM5B0_REG TCCR5A +#define COM5B1_REG TCCR5A +#define COM5A0_REG TCCR5A +#define COM5A1_REG TCCR5A + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* TCCR5C */ +#define FOC5C_REG TCCR5C +#define FOC5B_REG TCCR5C +#define FOC5A_REG TCCR5C + +/* TCCR5B */ +#define CS50_REG TCCR5B +#define CS51_REG TCCR5B +#define CS52_REG TCCR5B +#define WGM52_REG TCCR5B +#define WGM53_REG TCCR5B +#define ICES5_REG TCCR5B +#define ICNC5_REG TCCR5B + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB + +/* OCR5AL */ +#define OCR5AL0_REG OCR5AL +#define OCR5AL1_REG OCR5AL +#define OCR5AL2_REG OCR5AL +#define OCR5AL3_REG OCR5AL +#define OCR5AL4_REG OCR5AL +#define OCR5AL5_REG OCR5AL +#define OCR5AL6_REG OCR5AL +#define OCR5AL7_REG OCR5AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR4CH */ +#define OCR4CH0_REG OCR4CH +#define OCR4CH1_REG OCR4CH +#define OCR4CH2_REG OCR4CH +#define OCR4CH3_REG OCR4CH +#define OCR4CH4_REG OCR4CH +#define OCR4CH5_REG OCR4CH +#define OCR4CH6_REG OCR4CH +#define OCR4CH7_REG OCR4CH + +/* OCR5AH */ +#define OCR5AH0_REG OCR5AH +#define OCR5AH1_REG OCR5AH +#define OCR5AH2_REG OCR5AH +#define OCR5AH3_REG OCR5AH +#define OCR5AH4_REG OCR5AH +#define OCR5AH5_REG OCR5AH +#define OCR5AH6_REG OCR5AH +#define OCR5AH7_REG OCR5AH + +/* OCR4CL */ +#define OCR4CL0_REG OCR4CL +#define OCR4CL1_REG OCR4CL +#define OCR4CL2_REG OCR4CL +#define OCR4CL3_REG OCR4CL +#define OCR4CL4_REG OCR4CL +#define OCR4CL5_REG OCR4CL +#define OCR4CL6_REG OCR4CL +#define OCR4CL7_REG OCR4CL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR5BH */ +#define OCR5BH0_REG OCR5BH +#define OCR5BH1_REG OCR5BH +#define OCR5BH2_REG OCR5BH +#define OCR5BH3_REG OCR5BH +#define OCR5BH4_REG OCR5BH +#define OCR5BH5_REG OCR5BH +#define OCR5BH6_REG OCR5BH +#define OCR5BH7_REG OCR5BH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR5BL */ +#define OCR5BL0_REG OCR5BL +#define OCR5BL1_REG OCR5BL +#define OCR5BL2_REG OCR5BL +#define OCR5BL3_REG OCR5BL +#define OCR5BL4_REG OCR5BL +#define OCR5BL5_REG OCR5BL +#define OCR5BL6_REG OCR5BL +#define OCR5BL7_REG OCR5BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4C_REG TIMSK4 +#define ICIE4_REG TIMSK4 + +/* TIMSK5 */ +#define TOIE5_REG TIMSK5 +#define OCIE5A_REG TIMSK5 +#define OCIE5B_REG TIMSK5 +#define OCIE5C_REG TIMSK5 +#define ICIE5_REG TIMSK5 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define WGM42_REG TCCR4B +#define WGM43_REG TCCR4B +#define ICES4_REG TCCR4B +#define ICNC4_REG TCCR4B + +/* TCCR4C */ +#define FOC4C_REG TCCR4C +#define FOC4B_REG TCCR4C +#define FOC4A_REG TCCR4C + +/* TCCR4A */ +#define WGM40_REG TCCR4A +#define WGM41_REG TCCR4A +#define COM4C0_REG TCCR4A +#define COM4C1_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINL */ +#define PINL0_REG PINL +#define PINL1_REG PINL +#define PINL2_REG PINL +#define PINL3_REG PINL +#define PINL4_REG PINL +#define PINL5_REG PINL +#define PINL6_REG PINL +#define PINL7_REG PINL + +/* OCR4BL */ +#define OCR4BL0_REG OCR4BL +#define OCR4BL1_REG OCR4BL +#define OCR4BL2_REG OCR4BL +#define OCR4BL3_REG OCR4BL +#define OCR4BL4_REG OCR4BL +#define OCR4BL5_REG OCR4BL +#define OCR4BL6_REG OCR4BL +#define OCR4BL7_REG OCR4BL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* OCR4BH */ +#define OCR4BH0_REG OCR4BH +#define OCR4BH1_REG OCR4BH +#define OCR4BH2_REG OCR4BH +#define OCR4BH3_REG OCR4BH +#define OCR4BH4_REG OCR4BH +#define OCR4BH5_REG OCR4BH +#define OCR4BH6_REG OCR4BH +#define OCR4BH7_REG OCR4BH + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSART2_REG PRR1 +#define PRUSART3_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRTIM4_REG PRR1 +#define PRTIM5_REG PRR1 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define OC0A_PORT PORTB +#define OC0A_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define OC0A_PORT PORTB +#define OC0A_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define ICP1_PORT PORTD +#define ICP1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T0_PORT PORTD +#define T0_BIT 7 + +#define RXD_PORT PORTE +#define RXD_BIT 0 +#define PCINT8_PORT PORTE +#define PCINT8_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 + +#define XCK_PORT PORTE +#define XCK_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define CLKO_PORT PORTE +#define CLKO_BIT 7 +#define ICP3_PORT PORTE +#define ICP3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TDO_PORT PORTF +#define TDO_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + +#define OC0B_PORT PORTG +#define OC0B_BIT 5 + +#define RXD2_PORT PORTH +#define RXD2_BIT 0 + +#define TXD2_PORT PORTH +#define TXD2_BIT 1 + +#define XCK2_PORT PORTH +#define XCK2_BIT 2 + +#define OC4A_PORT PORTH +#define OC4A_BIT 3 + +#define OC4B_PORT PORTH +#define OC4B_BIT 4 + +#define OC2B_PORT PORTH +#define OC2B_BIT 6 + +#define T4_PORT PORTH +#define T4_BIT 7 + +#define RXD3_PORT PORTJ +#define RXD3_BIT 0 +#define PCINT9_PORT PORTJ +#define PCINT9_BIT 0 + +#define TXD3_PORT PORTJ +#define TXD3_BIT 1 +#define PCINT10_PORT PORTJ +#define PCINT10_BIT 1 + +#define XCK3_PORT PORTJ +#define XCK3_BIT 2 +#define PCINT11_PORT PORTJ +#define PCINT11_BIT 2 + +#define PCINT12_PORT PORTJ +#define PCINT12_BIT 3 + +#define PCINT13_PORT PORTJ +#define PCINT13_BIT 4 + +#define PCINT15_PORT PORTJ +#define PCINT15_BIT 6 + +#define ADC8_PORT PORTK +#define ADC8_BIT 0 +#define PCINT16_PORT PORTK +#define PCINT16_BIT 0 + +#define ADC9_PORT PORTK +#define ADC9_BIT 1 +#define PCINT17_PORT PORTK +#define PCINT17_BIT 1 + +#define ADC10_PORT PORTK +#define ADC10_BIT 2 +#define PCINT18_PORT PORTK +#define PCINT18_BIT 2 + +#define ADC11_PORT PORTK +#define ADC11_BIT 3 +#define PCINT19_PORT PORTK +#define PCINT19_BIT 3 + +#define ADC12_PORT PORTK +#define ADC12_BIT 4 +#define PCINT20_PORT PORTK +#define PCINT20_BIT 4 + +#define ADC13_PORT PORTK +#define ADC13_BIT 5 +#define PCINT21_PORT PORTK +#define PCINT21_BIT 5 + +#define ADC14_PORT PORTK +#define ADC14_BIT 6 +#define PCINT22_PORT PORTK +#define PCINT22_BIT 6 + +#define ADC15_PORT PORTK +#define ADC15_BIT 7 +#define PCINT23_PORT PORTK +#define PCINT23_BIT 7 + +#define ICP4_PORT PORTL +#define ICP4_BIT 0 + +#define ICP5_PORT PORTL +#define ICP5_BIT 1 + +#define T5_PORT PORTL +#define T5_BIT 2 + +#define OC5A_PORT PORTL +#define OC5A_BIT 3 + +#define OC5B_PORT PORTL +#define OC5B_BIT 4 + + diff --git a/aversive/parts/ATmega1281.h b/aversive/parts/ATmega1281.h new file mode 100644 index 0000000..7f0a45c --- /dev/null +++ b/aversive/parts/ATmega1281.h @@ -0,0 +1,1872 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ +#define TIMER4_PRESCALER_DIV_0 0 +#define TIMER4_PRESCALER_DIV_1 1 +#define TIMER4_PRESCALER_DIV_8 2 +#define TIMER4_PRESCALER_DIV_64 3 +#define TIMER4_PRESCALER_DIV_256 4 +#define TIMER4_PRESCALER_DIV_1024 5 +#define TIMER4_PRESCALER_DIV_FALL 6 +#define TIMER4_PRESCALER_DIV_RISE 7 + +#define TIMER4_PRESCALER_REG_0 0 +#define TIMER4_PRESCALER_REG_1 1 +#define TIMER4_PRESCALER_REG_2 8 +#define TIMER4_PRESCALER_REG_3 64 +#define TIMER4_PRESCALER_REG_4 256 +#define TIMER4_PRESCALER_REG_5 1024 +#define TIMER4_PRESCALER_REG_6 -1 +#define TIMER4_PRESCALER_REG_7 -2 + +/* prescalers timer 5 */ +#define TIMER5_PRESCALER_DIV_0 0 +#define TIMER5_PRESCALER_DIV_1 1 +#define TIMER5_PRESCALER_DIV_8 2 +#define TIMER5_PRESCALER_DIV_64 3 +#define TIMER5_PRESCALER_DIV_256 4 +#define TIMER5_PRESCALER_DIV_1024 5 +#define TIMER5_PRESCALER_DIV_FALL 6 +#define TIMER5_PRESCALER_DIV_RISE 7 + +#define TIMER5_PRESCALER_REG_0 0 +#define TIMER5_PRESCALER_REG_1 1 +#define TIMER5_PRESCALER_REG_2 8 +#define TIMER5_PRESCALER_REG_3 64 +#define TIMER5_PRESCALER_REG_4 256 +#define TIMER5_PRESCALER_REG_5 1024 +#define TIMER5_PRESCALER_REG_6 -1 +#define TIMER5_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE +#define TIMER4C_AVAILABLE +#define TIMER5_AVAILABLE +#define TIMER5A_AVAILABLE +#define TIMER5B_AVAILABLE +#define TIMER5C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW4_NUM 4 +#define SIG_OVERFLOW5_NUM 5 +#define SIG_OVERFLOW_TOTAL_NUM 6 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE4A_NUM 10 +#define SIG_OUTPUT_COMPARE4B_NUM 11 +#define SIG_OUTPUT_COMPARE4C_NUM 12 +#define SIG_OUTPUT_COMPARE5A_NUM 13 +#define SIG_OUTPUT_COMPARE5B_NUM 14 +#define SIG_OUTPUT_COMPARE5C_NUM 15 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 16 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM4A_NUM 10 +#define PWM4B_NUM 11 +#define PWM4C_NUM 12 +#define PWM5A_NUM 13 +#define PWM5B_NUM 14 +#define PWM5C_NUM 15 +#define PWM_TOTAL_NUM 16 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE4_NUM 2 +#define SIG_INPUT_CAPTURE5_NUM 3 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 4 + + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ +#define RAMPZ1_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 +#define ADC14D_REG DIDR2 +#define ADC15D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCNT5H */ +#define TCNT5H0_REG TCNT5H +#define TCNT5H1_REG TCNT5H +#define TCNT5H2_REG TCNT5H +#define TCNT5H3_REG TCNT5H +#define TCNT5H4_REG TCNT5H +#define TCNT5H5_REG TCNT5H +#define TCNT5H6_REG TCNT5H +#define TCNT5H7_REG TCNT5H + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* TCNT5L */ +#define TCNT5L0_REG TCNT5L +#define TCNT5L1_REG TCNT5L +#define TCNT5L2_REG TCNT5L +#define TCNT5L3_REG TCNT5L +#define TCNT5L4_REG TCNT5L +#define TCNT5L5_REG TCNT5L +#define TCNT5L6_REG TCNT5L +#define TCNT5L7_REG TCNT5L + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4C_REG TIFR4 +#define ICF4_REG TIFR4 + +/* TIFR5 */ +#define TOV5_REG TIFR5 +#define OCF5A_REG TIFR5 +#define OCF5B_REG TIFR5 +#define OCF5C_REG TIFR5 +#define ICF5_REG TIFR5 + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* OCR4AH */ +#define OCR4AH0_REG OCR4AH +#define OCR4AH1_REG OCR4AH +#define OCR4AH2_REG OCR4AH +#define OCR4AH3_REG OCR4AH +#define OCR4AH4_REG OCR4AH +#define OCR4AH5_REG OCR4AH +#define OCR4AH6_REG OCR4AH +#define OCR4AH7_REG OCR4AH + +/* OCR5CH */ +#define OCR5CH0_REG OCR5CH +#define OCR5CH1_REG OCR5CH +#define OCR5CH2_REG OCR5CH +#define OCR5CH3_REG OCR5CH +#define OCR5CH4_REG OCR5CH +#define OCR5CH5_REG OCR5CH +#define OCR5CH6_REG OCR5CH +#define OCR5CH7_REG OCR5CH + +/* OCR4AL */ +#define OCR4AL0_REG OCR4AL +#define OCR4AL1_REG OCR4AL +#define OCR4AL2_REG OCR4AL +#define OCR4AL3_REG OCR4AL +#define OCR4AL4_REG OCR4AL +#define OCR4AL5_REG OCR4AL +#define OCR4AL6_REG OCR4AL +#define OCR4AL7_REG OCR4AL + +/* OCR5CL */ +#define OCR5CL0_REG OCR5CL +#define OCR5CL1_REG OCR5CL +#define OCR5CL2_REG OCR5CL +#define OCR5CL3_REG OCR5CL +#define OCR5CL4_REG OCR5CL +#define OCR5CL5_REG OCR5CL +#define OCR5CL6_REG OCR5CL +#define OCR5CL7_REG OCR5CL + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* ICR5L */ +#define ICR5L0_REG ICR5L +#define ICR5L1_REG ICR5L +#define ICR5L2_REG ICR5L +#define ICR5L3_REG ICR5L +#define ICR5L4_REG ICR5L +#define ICR5L5_REG ICR5L +#define ICR5L6_REG ICR5L +#define ICR5L7_REG ICR5L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ICR5H */ +#define ICR5H0_REG ICR5H +#define ICR5H1_REG ICR5H +#define ICR5H2_REG ICR5H +#define ICR5H3_REG ICR5H +#define ICR5H4_REG ICR5H +#define ICR5H5_REG ICR5H +#define ICR5H6_REG ICR5H +#define ICR5H7_REG ICR5H + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* ICR4H */ +#define ICR4H0_REG ICR4H +#define ICR4H1_REG ICR4H +#define ICR4H2_REG ICR4H +#define ICR4H3_REG ICR4H +#define ICR4H4_REG ICR4H +#define ICR4H5_REG ICR4H +#define ICR4H6_REG ICR4H +#define ICR4H7_REG ICR4H + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* ICR4L */ +#define ICR4L0_REG ICR4L +#define ICR4L1_REG ICR4L +#define ICR4L2_REG ICR4L +#define ICR4L3_REG ICR4L +#define ICR4L4_REG ICR4L +#define ICR4L5_REG ICR4L +#define ICR4L6_REG ICR4L +#define ICR4L7_REG ICR4L + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* TCNT4L */ +#define TCNT4L0_REG TCNT4L +#define TCNT4L1_REG TCNT4L +#define TCNT4L2_REG TCNT4L +#define TCNT4L3_REG TCNT4L +#define TCNT4L4_REG TCNT4L +#define TCNT4L5_REG TCNT4L +#define TCNT4L6_REG TCNT4L +#define TCNT4L7_REG TCNT4L + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* TCNT4H */ +#define TCNT4H0_REG TCNT4H +#define TCNT4H1_REG TCNT4H +#define TCNT4H2_REG TCNT4H +#define TCNT4H3_REG TCNT4H +#define TCNT4H4_REG TCNT4H +#define TCNT4H5_REG TCNT4H +#define TCNT4H6_REG TCNT4H +#define TCNT4H7_REG TCNT4H + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TCCR5A */ +#define WGM50_REG TCCR5A +#define WGM51_REG TCCR5A +#define COM5C0_REG TCCR5A +#define COM5C1_REG TCCR5A +#define COM5B0_REG TCCR5A +#define COM5B1_REG TCCR5A +#define COM5A0_REG TCCR5A +#define COM5A1_REG TCCR5A + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* TCCR5C */ +#define FOC5C_REG TCCR5C +#define FOC5B_REG TCCR5C +#define FOC5A_REG TCCR5C + +/* TCCR5B */ +#define CS50_REG TCCR5B +#define CS51_REG TCCR5B +#define CS52_REG TCCR5B +#define WGM52_REG TCCR5B +#define WGM53_REG TCCR5B +#define ICES5_REG TCCR5B +#define ICNC5_REG TCCR5B + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB + +/* OCR5AL */ +#define OCR5AL0_REG OCR5AL +#define OCR5AL1_REG OCR5AL +#define OCR5AL2_REG OCR5AL +#define OCR5AL3_REG OCR5AL +#define OCR5AL4_REG OCR5AL +#define OCR5AL5_REG OCR5AL +#define OCR5AL6_REG OCR5AL +#define OCR5AL7_REG OCR5AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR4CH */ +#define OCR4CH0_REG OCR4CH +#define OCR4CH1_REG OCR4CH +#define OCR4CH2_REG OCR4CH +#define OCR4CH3_REG OCR4CH +#define OCR4CH4_REG OCR4CH +#define OCR4CH5_REG OCR4CH +#define OCR4CH6_REG OCR4CH +#define OCR4CH7_REG OCR4CH + +/* OCR5AH */ +#define OCR5AH0_REG OCR5AH +#define OCR5AH1_REG OCR5AH +#define OCR5AH2_REG OCR5AH +#define OCR5AH3_REG OCR5AH +#define OCR5AH4_REG OCR5AH +#define OCR5AH5_REG OCR5AH +#define OCR5AH6_REG OCR5AH +#define OCR5AH7_REG OCR5AH + +/* OCR4CL */ +#define OCR4CL0_REG OCR4CL +#define OCR4CL1_REG OCR4CL +#define OCR4CL2_REG OCR4CL +#define OCR4CL3_REG OCR4CL +#define OCR4CL4_REG OCR4CL +#define OCR4CL5_REG OCR4CL +#define OCR4CL6_REG OCR4CL +#define OCR4CL7_REG OCR4CL + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR5BH */ +#define OCR5BH0_REG OCR5BH +#define OCR5BH1_REG OCR5BH +#define OCR5BH2_REG OCR5BH +#define OCR5BH3_REG OCR5BH +#define OCR5BH4_REG OCR5BH +#define OCR5BH5_REG OCR5BH +#define OCR5BH6_REG OCR5BH +#define OCR5BH7_REG OCR5BH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR5BL */ +#define OCR5BL0_REG OCR5BL +#define OCR5BL1_REG OCR5BL +#define OCR5BL2_REG OCR5BL +#define OCR5BL3_REG OCR5BL +#define OCR5BL4_REG OCR5BL +#define OCR5BL5_REG OCR5BL +#define OCR5BL6_REG OCR5BL +#define OCR5BL7_REG OCR5BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4C_REG TIMSK4 +#define ICIE4_REG TIMSK4 + +/* TIMSK5 */ +#define TOIE5_REG TIMSK5 +#define OCIE5A_REG TIMSK5 +#define OCIE5B_REG TIMSK5 +#define OCIE5C_REG TIMSK5 +#define ICIE5_REG TIMSK5 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define WGM42_REG TCCR4B +#define WGM43_REG TCCR4B +#define ICES4_REG TCCR4B +#define ICNC4_REG TCCR4B + +/* TCCR4C */ +#define FOC4C_REG TCCR4C +#define FOC4B_REG TCCR4C +#define FOC4A_REG TCCR4C + +/* TCCR4A */ +#define WGM40_REG TCCR4A +#define WGM41_REG TCCR4A +#define COM4C0_REG TCCR4A +#define COM4C1_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* OCR4BL */ +#define OCR4BL0_REG OCR4BL +#define OCR4BL1_REG OCR4BL +#define OCR4BL2_REG OCR4BL +#define OCR4BL3_REG OCR4BL +#define OCR4BL4_REG OCR4BL +#define OCR4BL5_REG OCR4BL +#define OCR4BL6_REG OCR4BL +#define OCR4BL7_REG OCR4BL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* OCR4BH */ +#define OCR4BH0_REG OCR4BH +#define OCR4BH1_REG OCR4BH +#define OCR4BH2_REG OCR4BH +#define OCR4BH3_REG OCR4BH +#define OCR4BH4_REG OCR4BH +#define OCR4BH5_REG OCR4BH +#define OCR4BH6_REG OCR4BH +#define OCR4BH7_REG OCR4BH + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSART2_REG PRR1 +#define PRUSART3_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRTIM4_REG PRR1 +#define PRTIM5_REG PRR1 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define OC2_PORT PORTB +#define OC2_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define OC0A_PORT PORTB +#define OC0A_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define ICP1_PORT PORTD +#define ICP1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T0_PORT PORTD +#define T0_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 +#define PCINT8_PORT PORTE +#define PCINT8_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define ICP3_PORT PORTE +#define ICP3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 +#define CLKO_PORT PORTE +#define CLKO_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + +#define OC0B_PORT PORTG +#define OC0B_BIT 5 + + diff --git a/aversive/parts/ATmega1284P.h b/aversive/parts/ATmega1284P.h new file mode 100644 index 0000000..0ed6330 --- /dev/null +++ b/aversive/parts/ATmega1284P.h @@ -0,0 +1,1316 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE3A_NUM 6 +#define SIG_OUTPUT_COMPARE3B_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM3A_NUM 6 +#define PWM3B_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +/* #define OCR3AL0_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL1_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL2_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL3_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL4_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL5_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL6_REG OCR3AL */ /* dup in OCR3BL */ +/* #define OCR3AL7_REG OCR3AL */ /* dup in OCR3BL */ + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR3AH */ +/* #define OCR3AH0_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH1_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH2_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH3_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH4_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH5_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH6_REG OCR3AH */ /* dup in OCR3BH */ +/* #define OCR3AH7_REG OCR3AH */ /* dup in OCR3BH */ + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR3C */ +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRUSART1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +/* #define OCR3AL0_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL1_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL2_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL3_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL4_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL5_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL6_REG OCR3BL */ /* dup in OCR3AL */ +/* #define OCR3AL7_REG OCR3BL */ /* dup in OCR3AL */ + +/* OCR3BH */ +/* #define OCR3AH0_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH1_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH2_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH3_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH4_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH5_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH6_REG OCR3BH */ /* dup in OCR3AH */ +/* #define OCR3AH7_REG OCR3BH */ /* dup in OCR3AH */ + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRTIM3_REG PRR1 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define RDX1_PORT PORTD +#define RDX1_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define XCK1_PORT PORTD +#define XCK1_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega128A.h b/aversive/parts/ATmega128A.h new file mode 100644 index 0000000..ce7bb16 --- /dev/null +++ b/aversive/parts/ATmega128A.h @@ -0,0 +1,1327 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR321_REG SFIOR +#define PSR0_REG SFIOR +#define PUD_REG SFIOR +#define TSM_REG SFIOR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* ETIFR */ +#define OCF1C_REG ETIFR +#define OCF3C_REG ETIFR +#define TOV3_REG ETIFR +#define OCF3B_REG ETIFR +#define OCF3A_REG ETIFR +#define ICF3_REG ETIFR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* ETIMSK */ +#define OCIE1C_REG ETIMSK +#define OCIE3C_REG ETIMSK +#define TOIE3_REG ETIMSK +#define OCIE3B_REG ETIMSK +#define OCIE3A_REG ETIMSK +#define TICIE3_REG ETIMSK + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCN3L0_REG TCNT3L +#define TCN3L1_REG TCNT3L +#define TCN3L2_REG TCNT3L +#define TCN3L3_REG TCNT3L +#define TCN3L4_REG TCNT3L +#define TCN3L5_REG TCNT3L +#define TCN3L6_REG TCNT3L +#define TCN3L7_REG TCNT3L + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define SM2_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADFR_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW11_REG XMCRA +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/ATmega16.h b/aversive/parts/ATmega16.h new file mode 100644 index 0000000..e2b16f5 --- /dev/null +++ b/aversive/parts/ATmega16.h @@ -0,0 +1,825 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define ACME_REG SFIOR +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SM2_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + +#define TMS_PORT PORTC +#define TMS_BIT 2 + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega161.h b/aversive/parts/ATmega161.h new file mode 100644 index 0000000..9147951 --- /dev/null +++ b/aversive/parts/ATmega161.h @@ -0,0 +1,781 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT2_REG GIMSK +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define CHR91_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDR1IE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define OR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UBRR1 */ +#define UBRR10_REG UBRR1 +#define UBRR11_REG UBRR1 +#define UBRR12_REG UBRR1 +#define UBRR13_REG UBRR1 +#define UBRR14_REG UBRR1 +#define UBRR15_REG UBRR1 +#define UBRR16_REG UBRR1 +#define UBRR17_REG UBRR1 + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define OCIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE2_REG TIMSK +#define TOIE2_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UBRRHI */ +#define UBRRHI00_REG UBRRHI +#define UBRRHI01_REG UBRRHI +#define UBRRHI02_REG UBRRHI +#define UBRRHI03_REG UBRRHI +#define UBRRHI10_REG UBRRHI +#define UBRRHI11_REG UBRRHI +#define UBRRHI12_REG UBRRHI +#define UBRRHI13_REG UBRRHI + +/* EMCUCR */ +#define ISC2_REG EMCUCR +#define SRW11_REG EMCUCR +#define SRW00_REG EMCUCR +#define SRW01_REG EMCUCR +#define SRL0_REG EMCUCR +#define SRL1_REG EMCUCR +#define SRL2_REG EMCUCR +#define SM0_REG EMCUCR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define AINBG_REG ACSR +#define ACD_REG ACSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* UBRR0 */ +#define UBRR00_REG UBRR0 +#define UBRR01_REG UBRR0 +#define UBRR02_REG UBRR0 +#define UBRR03_REG UBRR0 +#define UBRR04_REG UBRR0 +#define UBRR05_REG UBRR0 +#define UBRR06_REG UBRR0 +#define UBRR07_REG UBRR0 + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define CHR90_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDR0IE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define OR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 +#define FOC2_REG TCCR2 + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* TIFR */ +#define OCF0_REG TIFR +#define TOV0_REG TIFR +#define OCF2_REG TIFR +#define TOV2_REG TIFR +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define OC0/T0_PORT PORTB +#define OC0/T0_BIT 0 + +#define OC2/T1_PORT PORTB +#define OC2/T1_BIT 1 + +#define RXD1_PORT PORTB +#define RXD1_BIT 2 +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define TXD1_PORT PORTB +#define TXD1_BIT 3 +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define TOSC2_PORT PORTD +#define TOSC2_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + +#define ICP/INT2_PORT PORTE +#define ICP/INT2_BIT 0 + +#define ALE_PORT PORTE +#define ALE_BIT 1 + +#define OC1B_PORT PORTE +#define OC1B_BIT 2 + + diff --git a/aversive/parts/ATmega161comp.h b/aversive/parts/ATmega161comp.h new file mode 100644 index 0000000..984b508 --- /dev/null +++ b/aversive/parts/ATmega161comp.h @@ -0,0 +1,861 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C +#define URSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define PCIE0_REG GICR +#define PCIE1_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define OCIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ +/* #define URSEL0_REG UBRR0H */ /* dup in UCSR0C */ + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PSR310_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define XMM0_REG SFIOR +#define XMM1_REG SFIOR +#define XMM2_REG SFIOR +#define XMBK_REG SFIOR +#define TSM_REG SFIOR + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* EMCUCR */ +#define ISC2_REG EMCUCR +#define SRW11_REG EMCUCR +#define SRW00_REG EMCUCR +#define SRW01_REG EMCUCR +#define SRL0_REG EMCUCR +#define SRL1_REG EMCUCR +#define SRL2_REG EMCUCR +#define SM0_REG EMCUCR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C +/* #define URSEL0_REG UCSR0C */ /* dup in UBRR0H */ + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define SM2_REG MCUCSR +#define JDT_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* UBRR1L */ +#define UBRR1L0_REG UBRR1L +#define UBRR1L1_REG UBRR1L +#define UBRR1L2_REG UBRR1L +#define UBRR1L3_REG UBRR1L +#define UBRR1L4_REG UBRR1L +#define UBRR1L5_REG UBRR1L +#define UBRR1L6_REG UBRR1L +#define UBRR1L7_REG UBRR1L + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* TIFR */ +#define OCF0_REG TIFR +#define TOV0_REG TIFR +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define OC0/T0_PORT PORTB +#define OC0/T0_BIT 0 + +#define OC2/T1_PORT PORTB +#define OC2/T1_BIT 1 + +#define RXD1_PORT PORTB +#define RXD1_BIT 2 +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define TXD1_PORT PORTB +#define TXD1_BIT 3 +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define TOSC2_PORT PORTD +#define TOSC2_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + +#define ICP/INT2_PORT PORTE +#define ICP/INT2_BIT 0 + +#define ALE_PORT PORTE +#define ALE_BIT 1 + +#define OC1B_PORT PORTE +#define OC1B_BIT 2 + + diff --git a/aversive/parts/ATmega162.h b/aversive/parts/ATmega162.h new file mode 100644 index 0000000..29bb545 --- /dev/null +++ b/aversive/parts/ATmega162.h @@ -0,0 +1,1065 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_16 6 +#define TIMER3_PRESCALER_DIV_32 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 16 +#define TIMER3_PRESCALER_REG_7 32 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE3A_NUM 4 +#define SIG_OUTPUT_COMPARE3B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM3A_NUM 4 +#define PWM3B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C +#define URSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define PCIE0_REG GICR +#define PCIE1_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ETIMSK */ +#define TOIE3_REG ETIMSK +#define OCIE3B_REG ETIMSK +#define OCIE3A_REG ETIMSK +#define TICIE3_REG ETIMSK + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE0_REG TIMSK + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ +/* #define URSEL0_REG UBRR0H */ /* dup in UCSR0C */ + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define FOC3B_REG TCCR3A +#define FOC3A_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* SFIOR */ +#define PSR310_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define XMM0_REG SFIOR +#define XMM1_REG SFIOR +#define XMM2_REG SFIOR +#define XMBK_REG SFIOR +#define TSM_REG SFIOR + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* EMCUCR */ +#define ISC2_REG EMCUCR +#define SRW11_REG EMCUCR +#define SRW00_REG EMCUCR +#define SRW01_REG EMCUCR +#define SRL0_REG EMCUCR +#define SRL1_REG EMCUCR +#define SRL2_REG EMCUCR +#define SM0_REG EMCUCR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C +/* #define URSEL0_REG UCSR0C */ /* dup in UBRR0H */ + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define SM2_REG MCUCSR +#define JDT_REG MCUCSR +#define JTD_REG MCUCSR + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* UBRR1L */ +#define UBRR1L0_REG UBRR1L +#define UBRR1L1_REG UBRR1L +#define UBRR1L2_REG UBRR1L +#define UBRR1L3_REG UBRR1L +#define UBRR1L4_REG UBRR1L +#define UBRR1L5_REG UBRR1L +#define UBRR1L6_REG UBRR1L +#define UBRR1L7_REG UBRR1L + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* TIFR */ +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR +#define OCF0_REG TIFR +#define TOV0_REG TIFR + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* ETIFR */ +#define TOV3_REG ETIFR +#define OCF3B_REG ETIFR +#define OCF3A_REG ETIFR +#define ICF3_REG ETIFR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define OC0_PORT PORTB +#define OC0_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define OC2_PORT PORTB +#define OC2_BIT 1 +#define T1_PORT PORTB +#define T1_BIT 1 + +#define RXD1_PORT PORTB +#define RXD1_BIT 2 +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define TXD1_PORT PORTB +#define TXD1_BIT 3 +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define OC3B_PORT PORTB +#define OC3B_BIT 4 +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 +#define A8_PORT PORTC +#define A8_BIT 0 + +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 +#define A9_PORT PORTC +#define A9_BIT 1 + +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 +#define A10_PORT PORTC +#define A10_BIT 2 + +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 +#define A11_PORT PORTC +#define A11_BIT 3 + +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 +#define A12_PORT PORTC +#define A12_BIT 4 +#define TCK_PORT PORTC +#define TCK_BIT 4 + +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 +#define A13_PORT PORTC +#define A13_BIT 5 +#define TMS_PORT PORTC +#define TMS_BIT 5 + +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 +#define A14_PORT PORTC +#define A14_BIT 6 +#define TDO_PORT PORTC +#define TDO_BIT 6 + +#define PCINT15_PORT PORTC +#define PCINT15_BIT 7 +#define A15_PORT PORTC +#define A15_BIT 7 +#define TDI_PORT PORTC +#define TDI_BIT 7 + +#define TXD0_PORT PORTD +#define TXD0_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define XCK1_PORT PORTD +#define XCK1_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define XCK1_PORT PORTD +#define XCK1_BIT 3 + +#define TOSC1_PORT PORTD +#define TOSC1_BIT 4 +#define XCK0_PORT PORTD +#define XCK0_BIT 4 +#define OC3A_PORT PORTD +#define OC3A_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define TOSC2_PORT PORTD +#define TOSC2_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + +#define ICP1_PORT PORTE +#define ICP1_BIT 0 +#define INT2_PORT PORTE +#define INT2_BIT 0 + +#define ALE_PORT PORTE +#define ALE_BIT 1 + +#define OC1B_PORT PORTE +#define OC1B_BIT 2 + + diff --git a/aversive/parts/ATmega163.h b/aversive/parts/ATmega163.h new file mode 100644 index 0000000..bf32886 --- /dev/null +++ b/aversive/parts/ATmega163.h @@ -0,0 +1,763 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE2_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM2_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define PWM10_REG TCCR1A +#define PWM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define OR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define CHR9_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define ACME_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UBRRHI */ +#define UBRRHI0_REG UBRRHI +#define UBRRHI1_REG UBRRHI +#define UBRRHI2_REG UBRRHI +#define UBRRHI3_REG UBRRHI + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define ASRE_REG SPMCR +#define ASB_REG SPMCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UBRR */ +#define UBRR0_REG UBRR +#define UBRR1_REG UBRR +#define UBRR2_REG UBRR +#define UBRR3_REG UBRR +#define UBRR4_REG UBRR +#define UBRR5_REG UBRR +#define UBRR6_REG UBRR +#define UBRR7_REG UBRR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega164P.h b/aversive/parts/ATmega164P.h new file mode 100644 index 0000000..78f09a9 --- /dev/null +++ b/aversive/parts/ATmega164P.h @@ -0,0 +1,1163 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPCR0 */ +#define SPR00_REG SPCR0 +#define SPR10_REG SPCR0 +#define CPHA0_REG SPCR0 +#define CPOL0_REG SPCR0 +#define MSTR0_REG SPCR0 +#define DORD0_REG SPCR0 +#define SPE0_REG SPCR0 +#define SPIE0_REG SPCR0 + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* SPDR0 */ +#define SPDRB0_REG SPDR0 +#define SPDRB1_REG SPDR0 +#define SPDRB2_REG SPDR0 +#define SPDRB3_REG SPDR0 +#define SPDRB4_REG SPDR0 +#define SPDRB5_REG SPDR0 +#define SPDRB6_REG SPDR0 +#define SPDRB7_REG SPDR0 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* SPSR0 */ +#define SPI2X0_REG SPSR0 +#define WCOL0_REG SPSR0 +#define SPIF0_REG SPSR0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRUSART1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega165.h b/aversive/parts/ATmega165.h new file mode 100644 index 0000000..5e29de8 --- /dev/null +++ b/aversive/parts/ATmega165.h @@ -0,0 +1,892 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega165P.h b/aversive/parts/ATmega165P.h new file mode 100644 index 0000000..5e29de8 --- /dev/null +++ b/aversive/parts/ATmega165P.h @@ -0,0 +1,892 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega168.h b/aversive/parts/ATmega168.h new file mode 100644 index 0000000..cb95de2 --- /dev/null +++ b/aversive/parts/ATmega168.h @@ -0,0 +1,995 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega168P.h b/aversive/parts/ATmega168P.h new file mode 100644 index 0000000..d9de6d0 --- /dev/null +++ b/aversive/parts/ATmega168P.h @@ -0,0 +1,997 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega168PA.h b/aversive/parts/ATmega168PA.h new file mode 100644 index 0000000..d9de6d0 --- /dev/null +++ b/aversive/parts/ATmega168PA.h @@ -0,0 +1,997 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega169.h b/aversive/parts/ATmega169.h new file mode 100644 index 0000000..87038dd --- /dev/null +++ b/aversive/parts/ATmega169.h @@ -0,0 +1,1052 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega169P.h b/aversive/parts/ATmega169P.h new file mode 100644 index 0000000..6cacbff --- /dev/null +++ b/aversive/parts/ATmega169P.h @@ -0,0 +1,1058 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDCCD_REG LCDCRA +#define LCDBD_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDMDT_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega16A.h b/aversive/parts/ATmega16A.h new file mode 100644 index 0000000..e2b16f5 --- /dev/null +++ b/aversive/parts/ATmega16A.h @@ -0,0 +1,825 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define ACME_REG SFIOR +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SM2_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + +#define TMS_PORT PORTC +#define TMS_BIT 2 + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega16HVA.h b/aversive/parts/ATmega16HVA.h new file mode 100644 index 0000000..cf64578 --- /dev/null +++ b/aversive/parts/ATmega16HVA.h @@ -0,0 +1,683 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ + + +/* prescalers timer 1 */ + + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CADAC2 */ +#define CADAC16_REG CADAC2 +#define CADAC17_REG CADAC2 +#define CADAC18_REG CADAC2 +#define CADAC19_REG CADAC2 +#define CADAC20_REG CADAC2 +#define CADAC21_REG CADAC2 +#define CADAC22_REG CADAC2 +#define CADAC23_REG CADAC2 + +/* CADAC3 */ +#define CADAC24_REG CADAC3 +#define CADAC25_REG CADAC3 +#define CADAC26_REG CADAC3 +#define CADAC27_REG CADAC3 +#define CADAC28_REG CADAC3 +#define CADAC29_REG CADAC3 +#define CADAC30_REG CADAC3 +#define CADAC31_REG CADAC3 + +/* CADAC0 */ +#define CADAC00_REG CADAC0 +#define CADAC01_REG CADAC0 +#define CADAC02_REG CADAC0 +#define CADAC03_REG CADAC0 +#define CADAC04_REG CADAC0 +#define CADAC05_REG CADAC0 +#define CADAC06_REG CADAC0 +#define CADAC07_REG CADAC0 + +/* CADAC1 */ +#define CADAC08_REG CADAC1 +#define CADAC09_REG CADAC1 +#define CADAC10_REG CADAC1 +#define CADAC11_REG CADAC1 +#define CADAC12_REG CADAC1 +#define CADAC13_REG CADAC1 +#define CADAC14_REG CADAC1 +#define CADAC15_REG CADAC1 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA + +/* BPIMSK */ +#define CHCIE_REG BPIMSK +#define DHCIE_REG BPIMSK +#define COCIE_REG BPIMSK +#define DOCIE_REG BPIMSK +#define SCIE_REG BPIMSK + +/* DIDR0 */ +#define PA0DID_REG DIDR0 +#define PA1DID_REG DIDR0 + +/* TCNT0H */ +#define TCNT0H0_REG TCNT0H +#define TCNT0H1_REG TCNT0H +#define TCNT0H2_REG TCNT0H +#define TCNT0H3_REG TCNT0H +#define TCNT0H4_REG TCNT0H +#define TCNT0H5_REG TCNT0H +#define TCNT0H6_REG TCNT0H +#define TCNT0H7_REG TCNT0H + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPCE_REG CLKPR + +/* BPCR */ +#define CHCD_REG BPCR +#define DHCD_REG BPCR +#define COCD_REG BPCR +#define DOCD_REG BPCR +#define SCD_REG BPCR + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* BPSCTR */ +#define SCPT0_REG BPSCTR +#define SCPT1_REG BPSCTR +#define SCPT2_REG BPSCTR +#define SCPT3_REG BPSCTR +#define SCPT4_REG BPSCTR +#define SCPT5_REG BPSCTR +#define SCPT6_REG BPSCTR + +/* MCUCR */ +#define PUD_REG MCUCR +#define CKOE_REG MCUCR + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define ICS1_REG TCCR1A +#define ICES1_REG TCCR1A +#define ICNC1_REG TCCR1A +#define ICEN1_REG TCCR1A +#define TCW1_REG TCCR1A + +/* BPHCTR */ +#define HCPT0_REG BPHCTR +#define HCPT1_REG BPHCTR +#define HCPT2_REG BPHCTR +#define HCPT3_REG BPHCTR +#define HCPT4_REG BPHCTR +#define HCPT5_REG BPHCTR + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* BGCRR */ +#define BGCR0_REG BGCRR +#define BGCR1_REG BGCRR +#define BGCR2_REG BGCRR +#define BGCR3_REG BGCRR +#define BGCR4_REG BGCRR +#define BGCR5_REG BGCRR +#define BGCR6_REG BGCRR +#define BGCR7_REG BGCRR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA + +/* BPCHCD */ +#define CHCDL0_REG BPCHCD +#define CHCDL1_REG BPCHCD +#define CHCDL2_REG BPCHCD +#define CHCDL3_REG BPCHCD +#define CHCDL4_REG BPCHCD +#define CHCDL5_REG BPCHCD +#define CHCDL6_REG BPCHCD +#define CHCDL7_REG BPCHCD + +/* PRR0 */ +#define PRVADC_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRSPI_REG PRR0 +#define PRVRM_REG PRR0 + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ROCR */ +#define ROCWIE_REG ROCR +#define ROCWIF_REG ROCR +#define ROCS_REG ROCR + +/* OCR0B */ +#define OCR0B0_REG OCR0B +#define OCR0B1_REG OCR0B +#define OCR0B2_REG OCR0B +#define OCR0B3_REG OCR0B +#define OCR0B4_REG OCR0B +#define OCR0B5_REG OCR0B +#define OCR0B6_REG OCR0B +#define OCR0B7_REG OCR0B + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* CADICH */ +#define CADICH0_REG CADICH +#define CADICH1_REG CADICH +#define CADICH2_REG CADICH +#define CADICH3_REG CADICH +#define CADICH4_REG CADICH +#define CADICH5_REG CADICH +#define CADICH6_REG CADICH +#define CADICH7_REG CADICH + +/* FCSR */ +#define CFE_REG FCSR +#define DFE_REG FCSR +#define CPS_REG FCSR +#define DUVRD_REG FCSR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* CADCSRB */ +#define CADICIF_REG CADCSRB +#define CADRCIF_REG CADCSRB +#define CADACIF_REG CADCSRB +#define CADICIE_REG CADCSRB +#define CADRCIE_REG CADCSRB +#define CADACIE_REG CADCSRB + +/* CADICL */ +#define CADICL0_REG CADICL +#define CADICL1_REG CADICL +#define CADICL2_REG CADICL +#define CADICL3_REG CADICL +#define CADICL4_REG CADICL +#define CADICL5_REG CADICL +#define CADICL6_REG CADICL +#define CADICL7_REG CADICL + +/* BPCOCD */ +#define COCDL0_REG BPCOCD +#define COCDL1_REG BPCOCD +#define COCDL2_REG BPCOCD +#define COCDL3_REG BPCOCD +#define COCDL4_REG BPCOCD +#define COCDL5_REG BPCOCD +#define COCDL6_REG BPCOCD +#define COCDL7_REG BPCOCD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* BPPLR */ +#define BPPL_REG BPPLR +#define BPPLE_REG BPPLR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BODRF_REG MCUSR +#define WDRF_REG MCUSR +#define OCDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR +#define EEAR7_REG EEAR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR +#define SIGRD_REG SPMCSR + +/* CADCSRA */ +#define CADSE_REG CADCSRA +#define CADSI0_REG CADCSRA +#define CADSI1_REG CADCSRA +#define CADAS0_REG CADCSRA +#define CADAS1_REG CADCSRA +#define CADUB_REG CADCSRA +#define CADPOL_REG CADCSRA +#define CADEN_REG CADCSRA + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 +#define ICF0_REG TIFR0 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA + +/* BPSCD */ +#define SCDL0_REG BPSCD +#define SCDL1_REG BPSCD +#define SCDL2_REG BPSCD +#define SCDL3_REG BPSCD +#define SCDL4_REG BPSCD +#define SCDL5_REG BPSCD +#define SCDL6_REG BPSCD +#define SCDL7_REG BPSCD + +/* OSICSR */ +#define OSIEN_REG OSICSR +#define OSIST_REG OSICSR +#define OSISEL0_REG OSICSR + +/* CADRC */ +#define CADRC0_REG CADRC +#define CADRC1_REG CADRC +#define CADRC2_REG CADRC +#define CADRC3_REG CADRC +#define CADRC4_REG CADRC +#define CADRC5_REG CADRC +#define CADRC6_REG CADRC +#define CADRC7_REG CADRC + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 +#define ICIE0_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B + +/* BGCCR */ +#define BGCC0_REG BGCCR +#define BGCC1_REG BGCCR +#define BGCC2_REG BGCCR +#define BGCC3_REG BGCCR +#define BGCC4_REG BGCCR +#define BGCC5_REG BGCCR +#define BGD_REG BGCCR + +/* VADMUX */ +#define VADMUX0_REG VADMUX +#define VADMUX1_REG VADMUX +#define VADMUX2_REG VADMUX +#define VADMUX3_REG VADMUX + +/* VADCH */ +#define VADC8_REG VADCH +#define VADC9_REG VADCH +#define VADC10_REG VADCH +#define VADC11_REG VADCH + +/* BPIFR */ +#define CHCIF_REG BPIFR +#define DHCIF_REG BPIFR +#define COCIF_REG BPIFR +#define DOCIF_REG BPIFR +#define SCIF_REG BPIFR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* BPDHCD */ +#define DHCDL0_REG BPDHCD +#define DHCDL1_REG BPDHCD +#define DHCDL2_REG BPDHCD +#define DHCDL3_REG BPDHCD +#define DHCDL4_REG BPDHCD +#define DHCDL5_REG BPDHCD +#define DHCDL6_REG BPDHCD +#define DHCDL7_REG BPDHCD + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* PINC */ +#define PINC0_REG PINC + +/* VADCSR */ +#define VADCCIE_REG VADCSR +#define VADCCIF_REG VADCSR +#define VADSC_REG VADCSR +#define VADEN_REG VADCSR + +/* FOSCCAL */ +#define FCAL0_REG FOSCCAL +#define FCAL1_REG FOSCCAL +#define FCAL2_REG FOSCCAL +#define FCAL3_REG FOSCCAL +#define FCAL4_REG FOSCCAL +#define FCAL5_REG FOSCCAL +#define FCAL6_REG FOSCCAL +#define FCAL7_REG FOSCCAL + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define ICS0_REG TCCR0A +#define ICES0_REG TCCR0A +#define ICNC0_REG TCCR0A +#define ICEN0_REG TCCR0A +#define TCW0_REG TCCR0A + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB + +/* TCNT0L */ +#define TCNT0L0_REG TCNT0L +#define TCNT0L1_REG TCNT0L +#define TCNT0L2_REG TCNT0L +#define TCNT0L3_REG TCNT0L +#define TCNT0L4_REG TCNT0L +#define TCNT0L5_REG TCNT0L +#define TCNT0L6_REG TCNT0L +#define TCNT0L7_REG TCNT0L + +/* BPOCTR */ +#define OCPT0_REG BPOCTR +#define OCPT1_REG BPOCTR +#define OCPT2_REG BPOCTR +#define OCPT3_REG BPOCTR +#define OCPT4_REG BPOCTR +#define OCPT5_REG BPOCTR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* BPDOCD */ +#define DOCDL0_REG BPDOCD +#define DOCDL1_REG BPDOCD +#define DOCDL2_REG BPDOCD +#define DOCDL3_REG BPDOCD +#define DOCDL4_REG BPDOCD +#define DOCDL5_REG BPDOCD +#define DOCDL6_REG BPDOCD +#define DOCDL7_REG BPDOCD + +/* VADCL */ +#define VADC0_REG VADCL +#define VADC1_REG VADCL +#define VADC2_REG VADCL +#define VADC3_REG VADCL +#define VADC4_REG VADCL +#define VADC5_REG VADCL +#define VADC6_REG VADCL +#define VADC7_REG VADCL + +/* pins mapping */ + + + + + + + + + + + diff --git a/aversive/parts/ATmega16U4.h b/aversive/parts/ATmega16U4.h new file mode 100644 index 0000000..37b04dc --- /dev/null +++ b/aversive/parts/ATmega16U4.h @@ -0,0 +1,1317 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ + + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW3_NUM 2 +#define SIG_OVERFLOW4_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE4_NUM 8 +#define SIG_OUTPUT_COMPARE4A_NUM 9 +#define SIG_OUTPUT_COMPARE4B_NUM 10 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 11 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM4_NUM 8 +#define PWM4A_NUM 9 +#define PWM4B_NUM 10 +#define PWM_TOTAL_NUM 11 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE2_REG PORTE +#define PORTE6_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define DAT0_REG UEDATX +#define DAT1_REG UEDATX +#define DAT2_REG UEDATX +#define DAT3_REG UEDATX +#define DAT4_REG UEDATX +#define DAT5_REG UEDATX +#define DAT6_REG UEDATX +#define DAT7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* CLKSEL1 */ +#define EXCKSEL0_REG CLKSEL1 +#define EXCKSEL1_REG CLKSEL1 +#define EXCKSEL2_REG CLKSEL1 +#define EXCKSEL3_REG CLKSEL1 +#define RCCKSEL0_REG CLKSEL1 +#define RCCKSEL1_REG CLKSEL1 +#define RCCKSEL2_REG CLKSEL1 +#define RCCKSEL3_REG CLKSEL1 + +/* CLKSEL0 */ +#define CLKS_REG CLKSEL0 +#define EXTE_REG CLKSEL0 +#define RCE_REG CLKSEL0 +#define EXSUT0_REG CLKSEL0 +#define EXSUT1_REG CLKSEL0 +#define RCSUT0_REG CLKSEL0 +#define RCSUT1_REG CLKSEL0 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* OCR4A */ +#define OCR4A0_REG OCR4A +#define OCR4A1_REG OCR4A +#define OCR4A2_REG OCR4A +#define OCR4A3_REG OCR4A +#define OCR4A4_REG OCR4A +#define OCR4A5_REG OCR4A +#define OCR4A6_REG OCR4A +#define OCR4A7_REG OCR4A + +/* OCR4C */ +#define OCR4C0_REG OCR4C +#define OCR4C1_REG OCR4C +#define OCR4C2_REG OCR4C +#define OCR4C3_REG OCR4C +#define OCR4C4_REG OCR4C +#define OCR4C5_REG OCR4C +#define OCR4C6_REG OCR4C +#define OCR4C7_REG OCR4C + +/* OCR4B */ +#define OCR4B0_REG OCR4B +#define OCR4B1_REG OCR4B +#define OCR4B2_REG OCR4B +#define OCR4B3_REG OCR4B +#define OCR4B4_REG OCR4B +#define OCR4B5_REG OCR4B +#define OCR4B6_REG OCR4B +#define OCR4B7_REG OCR4B + +/* OCR4D */ +#define OCR4D0_REG OCR4D +#define OCR4D1_REG OCR4D +#define OCR4D2_REG OCR4D +#define OCR4D3_REG OCR4D +#define OCR4D4_REG OCR4D +#define OCR4D5_REG OCR4D +#define OCR4D6_REG OCR4D +#define OCR4D7_REG OCR4D + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* RCCTRL */ +#define RCFREQ_REG RCCTRL + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON +#define RSTCPU_REG UDCON + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT4 */ +#define TC40_REG TCNT4 +#define TC41_REG TCNT4 +#define TC42_REG TCNT4 +#define TC43_REG TCNT4 +#define TC44_REG TCNT4 +#define TC45_REG TCNT4 +#define TC46_REG TCNT4 +#define TC47_REG TCNT4 + +/* TC4H */ +#define TC48_REG TC4H +#define TC49_REG TC4H +#define TC410_REG TC4H + +/* UHWCON */ +#define UVREGE_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4D_REG TIFR4 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* UEBCLX */ +#define BYCT0_REG UEBCLX +#define BYCT1_REG UEBCLX +#define BYCT2_REG UEBCLX +#define BYCT3_REG UEBCLX +#define BYCT4_REG UEBCLX +#define BYCT5_REG UEBCLX +#define BYCT6_REG UEBCLX +#define BYCT7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define VBUSTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* PLLFRQ */ +#define PDIV0_REG PLLFRQ +#define PDIV1_REG PLLFRQ +#define PDIV2_REG PLLFRQ +#define PDIV3_REG PLLFRQ +#define PLLTM0_REG PLLFRQ +#define PLLTM1_REG PLLFRQ +#define PLLUSB_REG PLLFRQ +#define PINMUX_REG PLLFRQ + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* USBSTA */ +#define VBUS_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define FNUM0_REG UDFNUML +#define FNUM1_REG UDFNUML +#define FNUM2_REG UDFNUML +#define FNUM3_REG UDFNUML +#define FNUM4_REG UDFNUML +#define FNUM5_REG UDFNUML +#define FNUM6_REG UDFNUML +#define FNUM7_REG UDFNUML + +/* UDFNUMH */ +#define FNUM8_REG UDFNUMH +#define FNUM9_REG UDFNUMH +#define FNUM10_REG UDFNUMH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define MUX5_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE2_REG DDRE +#define DDE6_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* CLKSTA */ +#define EXTON_REG CLKSTA +#define RCON_REG CLKSTA + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4D_REG TIMSK4 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define CS43_REG TCCR4B +#define DTPS40_REG TCCR4B +#define DTPS41_REG TCCR4B +#define PSR4_REG TCCR4B +#define PWM4X_REG TCCR4B + +/* TCCR4C */ +#define PWM4D_REG TCCR4C +#define FOC4D_REG TCCR4C +#define COM4D0_REG TCCR4C +#define COM4D1_REG TCCR4C +#define COM4B0S_REG TCCR4C +#define COM4B1S_REG TCCR4C +#define COM4A0S_REG TCCR4C +#define COM4A1S_REG TCCR4C + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PINDIV_REG PLLCSR + +/* TCCR4A */ +#define PWM4B_REG TCCR4A +#define PWM4A_REG TCCR4A +#define FOC4B_REG TCCR4A +#define FOC4A_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* TCCR4D */ +#define WGM40_REG TCCR4D +#define WGM41_REG TCCR4D +#define FPF4_REG TCCR4D +#define FPAC4_REG TCCR4D +#define FPES4_REG TCCR4D +#define FPNC4_REG TCCR4D +#define FPEN4_REG TCCR4D +#define FPIE4_REG TCCR4D + +/* TCCR4E */ +#define OC4OE0_REG TCCR4E +#define OC4OE1_REG TCCR4E +#define OC4OE2_REG TCCR4E +#define OC4OE3_REG TCCR4E +#define OC4OE4_REG TCCR4E +#define OC4OE5_REG TCCR4E +#define ENHC4_REG TCCR4E +#define TLOCK4_REG TCCR4E + +/* PINC */ +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE2_REG PINE +#define PINE6_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DT4 */ +#define DT4L0_REG DT4 +#define DT4L1_REG DT4 +#define DT4L2_REG DT4 +#define DT4L3_REG DT4 +#define DT4L4_REG DT4 +#define DT4L5_REG DT4 +#define DT4L6_REG DT4 +#define DT4L7_REG DT4 + +/* pins mapping */ + diff --git a/aversive/parts/ATmega2560.h b/aversive/parts/ATmega2560.h new file mode 100644 index 0000000..02efe04 --- /dev/null +++ b/aversive/parts/ATmega2560.h @@ -0,0 +1,2209 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ +#define TIMER4_PRESCALER_DIV_0 0 +#define TIMER4_PRESCALER_DIV_1 1 +#define TIMER4_PRESCALER_DIV_8 2 +#define TIMER4_PRESCALER_DIV_64 3 +#define TIMER4_PRESCALER_DIV_256 4 +#define TIMER4_PRESCALER_DIV_1024 5 +#define TIMER4_PRESCALER_DIV_FALL 6 +#define TIMER4_PRESCALER_DIV_RISE 7 + +#define TIMER4_PRESCALER_REG_0 0 +#define TIMER4_PRESCALER_REG_1 1 +#define TIMER4_PRESCALER_REG_2 8 +#define TIMER4_PRESCALER_REG_3 64 +#define TIMER4_PRESCALER_REG_4 256 +#define TIMER4_PRESCALER_REG_5 1024 +#define TIMER4_PRESCALER_REG_6 -1 +#define TIMER4_PRESCALER_REG_7 -2 + +/* prescalers timer 5 */ +#define TIMER5_PRESCALER_DIV_0 0 +#define TIMER5_PRESCALER_DIV_1 1 +#define TIMER5_PRESCALER_DIV_8 2 +#define TIMER5_PRESCALER_DIV_64 3 +#define TIMER5_PRESCALER_DIV_256 4 +#define TIMER5_PRESCALER_DIV_1024 5 +#define TIMER5_PRESCALER_DIV_FALL 6 +#define TIMER5_PRESCALER_DIV_RISE 7 + +#define TIMER5_PRESCALER_REG_0 0 +#define TIMER5_PRESCALER_REG_1 1 +#define TIMER5_PRESCALER_REG_2 8 +#define TIMER5_PRESCALER_REG_3 64 +#define TIMER5_PRESCALER_REG_4 256 +#define TIMER5_PRESCALER_REG_5 1024 +#define TIMER5_PRESCALER_REG_6 -1 +#define TIMER5_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE +#define TIMER4C_AVAILABLE +#define TIMER5_AVAILABLE +#define TIMER5A_AVAILABLE +#define TIMER5B_AVAILABLE +#define TIMER5C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW4_NUM 4 +#define SIG_OVERFLOW5_NUM 5 +#define SIG_OVERFLOW_TOTAL_NUM 6 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE4A_NUM 10 +#define SIG_OUTPUT_COMPARE4B_NUM 11 +#define SIG_OUTPUT_COMPARE4C_NUM 12 +#define SIG_OUTPUT_COMPARE5A_NUM 13 +#define SIG_OUTPUT_COMPARE5B_NUM 14 +#define SIG_OUTPUT_COMPARE5C_NUM 15 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 16 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM4A_NUM 10 +#define PWM4B_NUM 11 +#define PWM4C_NUM 12 +#define PWM5A_NUM 13 +#define PWM5B_NUM 14 +#define PWM5C_NUM 15 +#define PWM_TOTAL_NUM 16 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE4_NUM 2 +#define SIG_INPUT_CAPTURE5_NUM 3 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 4 + + +/* UBRR3H */ +/* #define UBRR8_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR9_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR10_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR11_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ + +/* UBRR3L */ +/* #define UBRR0_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR1_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR2_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR3_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR4_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR5_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR6_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR7_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UCSR3A */ +#define MPCM3_REG UCSR3A +#define U2X3_REG UCSR3A +#define UPE3_REG UCSR3A +#define DOR3_REG UCSR3A +#define FE3_REG UCSR3A +#define UDRE3_REG UCSR3A +#define TXC3_REG UCSR3A +#define RXC3_REG UCSR3A + +/* UCSR3B */ +#define TXB83_REG UCSR3B +#define RXB83_REG UCSR3B +#define UCSZ32_REG UCSR3B +#define TXEN3_REG UCSR3B +#define RXEN3_REG UCSR3B +#define UDRIE3_REG UCSR3B +#define TXCIE3_REG UCSR3B +#define RXCIE3_REG UCSR3B + +/* UCSR3C */ +#define UCPOL3_REG UCSR3C +#define UCSZ30_REG UCSR3C +#define UCSZ31_REG UCSR3C +#define USBS3_REG UCSR3C +#define UPM30_REG UCSR3C +#define UPM31_REG UCSR3C +#define UMSEL30_REG UCSR3C +#define UMSEL31_REG UCSR3C + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ +#define RAMPZ1_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PORTL */ +#define PORTL0_REG PORTL +#define PORTL1_REG PORTL +#define PORTL2_REG PORTL +#define PORTL3_REG PORTL +#define PORTL4_REG PORTL +#define PORTL5_REG PORTL +#define PORTL6_REG PORTL +#define PORTL7_REG PORTL + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ +#define PORTJ7_REG PORTJ + +/* PORTK */ +#define PORTK0_REG PORTK +#define PORTK1_REG PORTK +#define PORTK2_REG PORTK +#define PORTK3_REG PORTK +#define PORTK4_REG PORTK +#define PORTK5_REG PORTK +#define PORTK6_REG PORTK +#define PORTK7_REG PORTK + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* UDR3 */ +#define UDR3_0_REG UDR3 +#define UDR3_1_REG UDR3 +#define UDR3_2_REG UDR3 +#define UDR3_3_REG UDR3 +#define UDR3_4_REG UDR3 +#define UDR3_5_REG UDR3 +#define UDR3_6_REG UDR3 +#define UDR3_7_REG UDR3 + +/* UDR2 */ +#define UDR2_0_REG UDR2 +#define UDR2_1_REG UDR2 +#define UDR2_2_REG UDR2 +#define UDR2_3_REG UDR2 +#define UDR2_4_REG UDR2 +#define UDR2_5_REG UDR2 +#define UDR2_6_REG UDR2 +#define UDR2_7_REG UDR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 +#define ADC14D_REG DIDR2 +#define ADC15D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ +#define DDJ7_REG DDRJ + +/* DDRK */ +#define DDK0_REG DDRK +#define DDK1_REG DDRK +#define DDK2_REG DDRK +#define DDK3_REG DDRK +#define DDK4_REG DDRK +#define DDK5_REG DDRK +#define DDK6_REG DDRK +#define DDK7_REG DDRK + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRL */ +#define DDL0_REG DDRL +#define DDL1_REG DDRL +#define DDL2_REG DDRL +#define DDL3_REG DDRL +#define DDL4_REG DDRL +#define DDL5_REG DDRL +#define DDL6_REG DDRL +#define DDL7_REG DDRL + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCNT5H */ +#define TCNT5H0_REG TCNT5H +#define TCNT5H1_REG TCNT5H +#define TCNT5H2_REG TCNT5H +#define TCNT5H3_REG TCNT5H +#define TCNT5H4_REG TCNT5H +#define TCNT5H5_REG TCNT5H +#define TCNT5H6_REG TCNT5H +#define TCNT5H7_REG TCNT5H + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* TCNT5L */ +#define TCNT5L0_REG TCNT5L +#define TCNT5L1_REG TCNT5L +#define TCNT5L2_REG TCNT5L +#define TCNT5L3_REG TCNT5L +#define TCNT5L4_REG TCNT5L +#define TCNT5L5_REG TCNT5L +#define TCNT5L6_REG TCNT5L +#define TCNT5L7_REG TCNT5L + +/* UBRR2H */ +/* #define UBRR8_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR9_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR10_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR11_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ + +/* UBRR2L */ +/* #define UBRR0_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR1_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR2_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR3_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR4_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR5_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR6_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR7_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UCSR2B */ +#define TXB82_REG UCSR2B +#define RXB82_REG UCSR2B +#define UCSZ22_REG UCSR2B +#define TXEN2_REG UCSR2B +#define RXEN2_REG UCSR2B +#define UDRIE2_REG UCSR2B +#define TXCIE2_REG UCSR2B +#define RXCIE2_REG UCSR2B + +/* UCSR2A */ +#define MPCM2_REG UCSR2A +#define U2X2_REG UCSR2A +#define UPE2_REG UCSR2A +#define DOR2_REG UCSR2A +#define FE2_REG UCSR2A +#define UDRE2_REG UCSR2A +#define TXC2_REG UCSR2A +#define RXC2_REG UCSR2A + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UCSR2C */ +#define UCPOL2_REG UCSR2C +#define UCSZ20_REG UCSR2C +#define UCSZ21_REG UCSR2C +#define USBS2_REG UCSR2C +#define UPM20_REG UCSR2C +#define UPM21_REG UCSR2C +#define UMSEL20_REG UCSR2C +#define UMSEL21_REG UCSR2C + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4C_REG TIFR4 +#define ICF4_REG TIFR4 + +/* TIFR5 */ +#define TOV5_REG TIFR5 +#define OCF5A_REG TIFR5 +#define OCF5B_REG TIFR5 +#define OCF5C_REG TIFR5 +#define ICF5_REG TIFR5 + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* OCR4AH */ +#define OCR4AH0_REG OCR4AH +#define OCR4AH1_REG OCR4AH +#define OCR4AH2_REG OCR4AH +#define OCR4AH3_REG OCR4AH +#define OCR4AH4_REG OCR4AH +#define OCR4AH5_REG OCR4AH +#define OCR4AH6_REG OCR4AH +#define OCR4AH7_REG OCR4AH + +/* OCR5CH */ +#define OCR5CH0_REG OCR5CH +#define OCR5CH1_REG OCR5CH +#define OCR5CH2_REG OCR5CH +#define OCR5CH3_REG OCR5CH +#define OCR5CH4_REG OCR5CH +#define OCR5CH5_REG OCR5CH +#define OCR5CH6_REG OCR5CH +#define OCR5CH7_REG OCR5CH + +/* OCR4AL */ +#define OCR4AL0_REG OCR4AL +#define OCR4AL1_REG OCR4AL +#define OCR4AL2_REG OCR4AL +#define OCR4AL3_REG OCR4AL +#define OCR4AL4_REG OCR4AL +#define OCR4AL5_REG OCR4AL +#define OCR4AL6_REG OCR4AL +#define OCR4AL7_REG OCR4AL + +/* OCR5CL */ +#define OCR5CL0_REG OCR5CL +#define OCR5CL1_REG OCR5CL +#define OCR5CL2_REG OCR5CL +#define OCR5CL3_REG OCR5CL +#define OCR5CL4_REG OCR5CL +#define OCR5CL5_REG OCR5CL +#define OCR5CL6_REG OCR5CL +#define OCR5CL7_REG OCR5CL + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* ICR5L */ +#define ICR5L0_REG ICR5L +#define ICR5L1_REG ICR5L +#define ICR5L2_REG ICR5L +#define ICR5L3_REG ICR5L +#define ICR5L4_REG ICR5L +#define ICR5L5_REG ICR5L +#define ICR5L6_REG ICR5L +#define ICR5L7_REG ICR5L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ICR5H */ +#define ICR5H0_REG ICR5H +#define ICR5H1_REG ICR5H +#define ICR5H2_REG ICR5H +#define ICR5H3_REG ICR5H +#define ICR5H4_REG ICR5H +#define ICR5H5_REG ICR5H +#define ICR5H6_REG ICR5H +#define ICR5H7_REG ICR5H + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* PINK */ +#define PINK0_REG PINK +#define PINK1_REG PINK +#define PINK2_REG PINK +#define PINK3_REG PINK +#define PINK4_REG PINK +#define PINK5_REG PINK +#define PINK6_REG PINK +#define PINK7_REG PINK + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ +#define PINJ7_REG PINJ + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* ICR4H */ +#define ICR4H0_REG ICR4H +#define ICR4H1_REG ICR4H +#define ICR4H2_REG ICR4H +#define ICR4H3_REG ICR4H +#define ICR4H4_REG ICR4H +#define ICR4H5_REG ICR4H +#define ICR4H6_REG ICR4H +#define ICR4H7_REG ICR4H + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* ICR4L */ +#define ICR4L0_REG ICR4L +#define ICR4L1_REG ICR4L +#define ICR4L2_REG ICR4L +#define ICR4L3_REG ICR4L +#define ICR4L4_REG ICR4L +#define ICR4L5_REG ICR4L +#define ICR4L6_REG ICR4L +#define ICR4L7_REG ICR4L + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* TCNT4L */ +#define TCNT4L0_REG TCNT4L +#define TCNT4L1_REG TCNT4L +#define TCNT4L2_REG TCNT4L +#define TCNT4L3_REG TCNT4L +#define TCNT4L4_REG TCNT4L +#define TCNT4L5_REG TCNT4L +#define TCNT4L6_REG TCNT4L +#define TCNT4L7_REG TCNT4L + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* TCNT4H */ +#define TCNT4H0_REG TCNT4H +#define TCNT4H1_REG TCNT4H +#define TCNT4H2_REG TCNT4H +#define TCNT4H3_REG TCNT4H +#define TCNT4H4_REG TCNT4H +#define TCNT4H5_REG TCNT4H +#define TCNT4H6_REG TCNT4H +#define TCNT4H7_REG TCNT4H + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TCCR5A */ +#define WGM50_REG TCCR5A +#define WGM51_REG TCCR5A +#define COM5C0_REG TCCR5A +#define COM5C1_REG TCCR5A +#define COM5B0_REG TCCR5A +#define COM5B1_REG TCCR5A +#define COM5A0_REG TCCR5A +#define COM5A1_REG TCCR5A + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* TCCR5C */ +#define FOC5C_REG TCCR5C +#define FOC5B_REG TCCR5C +#define FOC5A_REG TCCR5C + +/* TCCR5B */ +#define CS50_REG TCCR5B +#define CS51_REG TCCR5B +#define CS52_REG TCCR5B +#define WGM52_REG TCCR5B +#define WGM53_REG TCCR5B +#define ICES5_REG TCCR5B +#define ICNC5_REG TCCR5B + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB + +/* OCR5AL */ +#define OCR5AL0_REG OCR5AL +#define OCR5AL1_REG OCR5AL +#define OCR5AL2_REG OCR5AL +#define OCR5AL3_REG OCR5AL +#define OCR5AL4_REG OCR5AL +#define OCR5AL5_REG OCR5AL +#define OCR5AL6_REG OCR5AL +#define OCR5AL7_REG OCR5AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR4CH */ +#define OCR4CH0_REG OCR4CH +#define OCR4CH1_REG OCR4CH +#define OCR4CH2_REG OCR4CH +#define OCR4CH3_REG OCR4CH +#define OCR4CH4_REG OCR4CH +#define OCR4CH5_REG OCR4CH +#define OCR4CH6_REG OCR4CH +#define OCR4CH7_REG OCR4CH + +/* OCR5AH */ +#define OCR5AH0_REG OCR5AH +#define OCR5AH1_REG OCR5AH +#define OCR5AH2_REG OCR5AH +#define OCR5AH3_REG OCR5AH +#define OCR5AH4_REG OCR5AH +#define OCR5AH5_REG OCR5AH +#define OCR5AH6_REG OCR5AH +#define OCR5AH7_REG OCR5AH + +/* OCR4CL */ +#define OCR4CL0_REG OCR4CL +#define OCR4CL1_REG OCR4CL +#define OCR4CL2_REG OCR4CL +#define OCR4CL3_REG OCR4CL +#define OCR4CL4_REG OCR4CL +#define OCR4CL5_REG OCR4CL +#define OCR4CL6_REG OCR4CL +#define OCR4CL7_REG OCR4CL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR5BH */ +#define OCR5BH0_REG OCR5BH +#define OCR5BH1_REG OCR5BH +#define OCR5BH2_REG OCR5BH +#define OCR5BH3_REG OCR5BH +#define OCR5BH4_REG OCR5BH +#define OCR5BH5_REG OCR5BH +#define OCR5BH6_REG OCR5BH +#define OCR5BH7_REG OCR5BH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR5BL */ +#define OCR5BL0_REG OCR5BL +#define OCR5BL1_REG OCR5BL +#define OCR5BL2_REG OCR5BL +#define OCR5BL3_REG OCR5BL +#define OCR5BL4_REG OCR5BL +#define OCR5BL5_REG OCR5BL +#define OCR5BL6_REG OCR5BL +#define OCR5BL7_REG OCR5BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4C_REG TIMSK4 +#define ICIE4_REG TIMSK4 + +/* TIMSK5 */ +#define TOIE5_REG TIMSK5 +#define OCIE5A_REG TIMSK5 +#define OCIE5B_REG TIMSK5 +#define OCIE5C_REG TIMSK5 +#define ICIE5_REG TIMSK5 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define WGM42_REG TCCR4B +#define WGM43_REG TCCR4B +#define ICES4_REG TCCR4B +#define ICNC4_REG TCCR4B + +/* TCCR4C */ +#define FOC4C_REG TCCR4C +#define FOC4B_REG TCCR4C +#define FOC4A_REG TCCR4C + +/* TCCR4A */ +#define WGM40_REG TCCR4A +#define WGM41_REG TCCR4A +#define COM4C0_REG TCCR4A +#define COM4C1_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINL */ +#define PINL0_REG PINL +#define PINL1_REG PINL +#define PINL2_REG PINL +#define PINL3_REG PINL +#define PINL4_REG PINL +#define PINL5_REG PINL +#define PINL6_REG PINL +#define PINL7_REG PINL + +/* OCR4BL */ +#define OCR4BL0_REG OCR4BL +#define OCR4BL1_REG OCR4BL +#define OCR4BL2_REG OCR4BL +#define OCR4BL3_REG OCR4BL +#define OCR4BL4_REG OCR4BL +#define OCR4BL5_REG OCR4BL +#define OCR4BL6_REG OCR4BL +#define OCR4BL7_REG OCR4BL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* OCR4BH */ +#define OCR4BH0_REG OCR4BH +#define OCR4BH1_REG OCR4BH +#define OCR4BH2_REG OCR4BH +#define OCR4BH3_REG OCR4BH +#define OCR4BH4_REG OCR4BH +#define OCR4BH5_REG OCR4BH +#define OCR4BH6_REG OCR4BH +#define OCR4BH7_REG OCR4BH + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSART2_REG PRR1 +#define PRUSART3_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRTIM4_REG PRR1 +#define PRTIM5_REG PRR1 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define OC2A_PORT PORTB +#define OC2A_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define OC0A_PORT PORTB +#define OC0A_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define ICP1_PORT PORTD +#define ICP1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T0_PORT PORTD +#define T0_BIT 7 + +#define RXD_PORT PORTE +#define RXD_BIT 0 +#define PCINT8_PORT PORTE +#define PCINT8_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 + +#define XCK_PORT PORTE +#define XCK_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define CLKO_PORT PORTE +#define CLKO_BIT 7 +#define ICP3_PORT PORTE +#define ICP3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TDO_PORT PORTF +#define TDO_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + +#define OC0B_PORT PORTG +#define OC0B_BIT 5 + +#define RXD2_PORT PORTH +#define RXD2_BIT 0 + +#define TXD2_PORT PORTH +#define TXD2_BIT 1 + +#define XCK2_PORT PORTH +#define XCK2_BIT 2 + +#define OC4A_PORT PORTH +#define OC4A_BIT 3 + +#define OC4B_PORT PORTH +#define OC4B_BIT 4 + +#define OC2B_PORT PORTH +#define OC2B_BIT 6 + +#define T4_PORT PORTH +#define T4_BIT 7 + +#define RXD3_PORT PORTJ +#define RXD3_BIT 0 +#define PCINT9_PORT PORTJ +#define PCINT9_BIT 0 + +#define TXD3_PORT PORTJ +#define TXD3_BIT 1 +#define PCINT10_PORT PORTJ +#define PCINT10_BIT 1 + +#define XCK3_PORT PORTJ +#define XCK3_BIT 2 +#define PCINT11_PORT PORTJ +#define PCINT11_BIT 2 + +#define PCINT12_PORT PORTJ +#define PCINT12_BIT 3 + +#define PCINT13_PORT PORTJ +#define PCINT13_BIT 4 + +#define PCINT14_PORT PORTJ +#define PCINT14_BIT 5 + +#define PCINT15_PORT PORTJ +#define PCINT15_BIT 6 + +#define ADC8_PORT PORTK +#define ADC8_BIT 0 +#define PCINT16_PORT PORTK +#define PCINT16_BIT 0 + +#define ADC9_PORT PORTK +#define ADC9_BIT 1 +#define PCINT17_PORT PORTK +#define PCINT17_BIT 1 + +#define ADC10_PORT PORTK +#define ADC10_BIT 2 +#define PCINT18_PORT PORTK +#define PCINT18_BIT 2 + +#define ADC11_PORT PORTK +#define ADC11_BIT 3 +#define PCINT19_PORT PORTK +#define PCINT19_BIT 3 + +#define ADC12_PORT PORTK +#define ADC12_BIT 4 +#define PCINT20_PORT PORTK +#define PCINT20_BIT 4 + +#define ADC13_PORT PORTK +#define ADC13_BIT 5 +#define PCINT21_PORT PORTK +#define PCINT21_BIT 5 + +#define ADC14_PORT PORTK +#define ADC14_BIT 6 +#define PCINT22_PORT PORTK +#define PCINT22_BIT 6 + +#define ADC15_PORT PORTK +#define ADC15_BIT 7 +#define PCINT23_PORT PORTK +#define PCINT23_BIT 7 + +#define ICP4_PORT PORTL +#define ICP4_BIT 0 + +#define ICP5_PORT PORTL +#define ICP5_BIT 1 + +#define T5_PORT PORTL +#define T5_BIT 2 + +#define OC5A_PORT PORTL +#define OC5A_BIT 3 + +#define OC5B_PORT PORTL +#define OC5B_BIT 4 + +#define OC5C_PORT PORTL +#define OC5C_BIT 5 + + diff --git a/aversive/parts/ATmega2561.h b/aversive/parts/ATmega2561.h new file mode 100644 index 0000000..55840fb --- /dev/null +++ b/aversive/parts/ATmega2561.h @@ -0,0 +1,1875 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ +#define TIMER4_PRESCALER_DIV_0 0 +#define TIMER4_PRESCALER_DIV_1 1 +#define TIMER4_PRESCALER_DIV_8 2 +#define TIMER4_PRESCALER_DIV_64 3 +#define TIMER4_PRESCALER_DIV_256 4 +#define TIMER4_PRESCALER_DIV_1024 5 +#define TIMER4_PRESCALER_DIV_FALL 6 +#define TIMER4_PRESCALER_DIV_RISE 7 + +#define TIMER4_PRESCALER_REG_0 0 +#define TIMER4_PRESCALER_REG_1 1 +#define TIMER4_PRESCALER_REG_2 8 +#define TIMER4_PRESCALER_REG_3 64 +#define TIMER4_PRESCALER_REG_4 256 +#define TIMER4_PRESCALER_REG_5 1024 +#define TIMER4_PRESCALER_REG_6 -1 +#define TIMER4_PRESCALER_REG_7 -2 + +/* prescalers timer 5 */ +#define TIMER5_PRESCALER_DIV_0 0 +#define TIMER5_PRESCALER_DIV_1 1 +#define TIMER5_PRESCALER_DIV_8 2 +#define TIMER5_PRESCALER_DIV_64 3 +#define TIMER5_PRESCALER_DIV_256 4 +#define TIMER5_PRESCALER_DIV_1024 5 +#define TIMER5_PRESCALER_DIV_FALL 6 +#define TIMER5_PRESCALER_DIV_RISE 7 + +#define TIMER5_PRESCALER_REG_0 0 +#define TIMER5_PRESCALER_REG_1 1 +#define TIMER5_PRESCALER_REG_2 8 +#define TIMER5_PRESCALER_REG_3 64 +#define TIMER5_PRESCALER_REG_4 256 +#define TIMER5_PRESCALER_REG_5 1024 +#define TIMER5_PRESCALER_REG_6 -1 +#define TIMER5_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE +#define TIMER4C_AVAILABLE +#define TIMER5_AVAILABLE +#define TIMER5A_AVAILABLE +#define TIMER5B_AVAILABLE +#define TIMER5C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW4_NUM 4 +#define SIG_OVERFLOW5_NUM 5 +#define SIG_OVERFLOW_TOTAL_NUM 6 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE4A_NUM 10 +#define SIG_OUTPUT_COMPARE4B_NUM 11 +#define SIG_OUTPUT_COMPARE4C_NUM 12 +#define SIG_OUTPUT_COMPARE5A_NUM 13 +#define SIG_OUTPUT_COMPARE5B_NUM 14 +#define SIG_OUTPUT_COMPARE5C_NUM 15 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 16 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM4A_NUM 10 +#define PWM4B_NUM 11 +#define PWM4C_NUM 12 +#define PWM5A_NUM 13 +#define PWM5B_NUM 14 +#define PWM5C_NUM 15 +#define PWM_TOTAL_NUM 16 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE4_NUM 2 +#define SIG_INPUT_CAPTURE5_NUM 3 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 4 + + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ +#define RAMPZ1_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 +#define ADC14D_REG DIDR2 +#define ADC15D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCNT5H */ +#define TCNT5H0_REG TCNT5H +#define TCNT5H1_REG TCNT5H +#define TCNT5H2_REG TCNT5H +#define TCNT5H3_REG TCNT5H +#define TCNT5H4_REG TCNT5H +#define TCNT5H5_REG TCNT5H +#define TCNT5H6_REG TCNT5H +#define TCNT5H7_REG TCNT5H + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* TCNT5L */ +#define TCNT5L0_REG TCNT5L +#define TCNT5L1_REG TCNT5L +#define TCNT5L2_REG TCNT5L +#define TCNT5L3_REG TCNT5L +#define TCNT5L4_REG TCNT5L +#define TCNT5L5_REG TCNT5L +#define TCNT5L6_REG TCNT5L +#define TCNT5L7_REG TCNT5L + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4C_REG TIFR4 +#define ICF4_REG TIFR4 + +/* TIFR5 */ +#define TOV5_REG TIFR5 +#define OCF5A_REG TIFR5 +#define OCF5B_REG TIFR5 +#define OCF5C_REG TIFR5 +#define ICF5_REG TIFR5 + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* OCR4AH */ +#define OCR4AH0_REG OCR4AH +#define OCR4AH1_REG OCR4AH +#define OCR4AH2_REG OCR4AH +#define OCR4AH3_REG OCR4AH +#define OCR4AH4_REG OCR4AH +#define OCR4AH5_REG OCR4AH +#define OCR4AH6_REG OCR4AH +#define OCR4AH7_REG OCR4AH + +/* OCR5CH */ +#define OCR5CH0_REG OCR5CH +#define OCR5CH1_REG OCR5CH +#define OCR5CH2_REG OCR5CH +#define OCR5CH3_REG OCR5CH +#define OCR5CH4_REG OCR5CH +#define OCR5CH5_REG OCR5CH +#define OCR5CH6_REG OCR5CH +#define OCR5CH7_REG OCR5CH + +/* OCR4AL */ +#define OCR4AL0_REG OCR4AL +#define OCR4AL1_REG OCR4AL +#define OCR4AL2_REG OCR4AL +#define OCR4AL3_REG OCR4AL +#define OCR4AL4_REG OCR4AL +#define OCR4AL5_REG OCR4AL +#define OCR4AL6_REG OCR4AL +#define OCR4AL7_REG OCR4AL + +/* OCR5CL */ +#define OCR5CL0_REG OCR5CL +#define OCR5CL1_REG OCR5CL +#define OCR5CL2_REG OCR5CL +#define OCR5CL3_REG OCR5CL +#define OCR5CL4_REG OCR5CL +#define OCR5CL5_REG OCR5CL +#define OCR5CL6_REG OCR5CL +#define OCR5CL7_REG OCR5CL + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* ICR5L */ +#define ICR5L0_REG ICR5L +#define ICR5L1_REG ICR5L +#define ICR5L2_REG ICR5L +#define ICR5L3_REG ICR5L +#define ICR5L4_REG ICR5L +#define ICR5L5_REG ICR5L +#define ICR5L6_REG ICR5L +#define ICR5L7_REG ICR5L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ICR5H */ +#define ICR5H0_REG ICR5H +#define ICR5H1_REG ICR5H +#define ICR5H2_REG ICR5H +#define ICR5H3_REG ICR5H +#define ICR5H4_REG ICR5H +#define ICR5H5_REG ICR5H +#define ICR5H6_REG ICR5H +#define ICR5H7_REG ICR5H + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* ICR4H */ +#define ICR4H0_REG ICR4H +#define ICR4H1_REG ICR4H +#define ICR4H2_REG ICR4H +#define ICR4H3_REG ICR4H +#define ICR4H4_REG ICR4H +#define ICR4H5_REG ICR4H +#define ICR4H6_REG ICR4H +#define ICR4H7_REG ICR4H + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* ICR4L */ +#define ICR4L0_REG ICR4L +#define ICR4L1_REG ICR4L +#define ICR4L2_REG ICR4L +#define ICR4L3_REG ICR4L +#define ICR4L4_REG ICR4L +#define ICR4L5_REG ICR4L +#define ICR4L6_REG ICR4L +#define ICR4L7_REG ICR4L + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* TCNT4L */ +#define TCNT4L0_REG TCNT4L +#define TCNT4L1_REG TCNT4L +#define TCNT4L2_REG TCNT4L +#define TCNT4L3_REG TCNT4L +#define TCNT4L4_REG TCNT4L +#define TCNT4L5_REG TCNT4L +#define TCNT4L6_REG TCNT4L +#define TCNT4L7_REG TCNT4L + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* TCNT4H */ +#define TCNT4H0_REG TCNT4H +#define TCNT4H1_REG TCNT4H +#define TCNT4H2_REG TCNT4H +#define TCNT4H3_REG TCNT4H +#define TCNT4H4_REG TCNT4H +#define TCNT4H5_REG TCNT4H +#define TCNT4H6_REG TCNT4H +#define TCNT4H7_REG TCNT4H + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TCCR5A */ +#define WGM50_REG TCCR5A +#define WGM51_REG TCCR5A +#define COM5C0_REG TCCR5A +#define COM5C1_REG TCCR5A +#define COM5B0_REG TCCR5A +#define COM5B1_REG TCCR5A +#define COM5A0_REG TCCR5A +#define COM5A1_REG TCCR5A + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* TCCR5C */ +#define FOC5C_REG TCCR5C +#define FOC5B_REG TCCR5C +#define FOC5A_REG TCCR5C + +/* TCCR5B */ +#define CS50_REG TCCR5B +#define CS51_REG TCCR5B +#define CS52_REG TCCR5B +#define WGM52_REG TCCR5B +#define WGM53_REG TCCR5B +#define ICES5_REG TCCR5B +#define ICNC5_REG TCCR5B + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB + +/* OCR5AL */ +#define OCR5AL0_REG OCR5AL +#define OCR5AL1_REG OCR5AL +#define OCR5AL2_REG OCR5AL +#define OCR5AL3_REG OCR5AL +#define OCR5AL4_REG OCR5AL +#define OCR5AL5_REG OCR5AL +#define OCR5AL6_REG OCR5AL +#define OCR5AL7_REG OCR5AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR4CH */ +#define OCR4CH0_REG OCR4CH +#define OCR4CH1_REG OCR4CH +#define OCR4CH2_REG OCR4CH +#define OCR4CH3_REG OCR4CH +#define OCR4CH4_REG OCR4CH +#define OCR4CH5_REG OCR4CH +#define OCR4CH6_REG OCR4CH +#define OCR4CH7_REG OCR4CH + +/* OCR5AH */ +#define OCR5AH0_REG OCR5AH +#define OCR5AH1_REG OCR5AH +#define OCR5AH2_REG OCR5AH +#define OCR5AH3_REG OCR5AH +#define OCR5AH4_REG OCR5AH +#define OCR5AH5_REG OCR5AH +#define OCR5AH6_REG OCR5AH +#define OCR5AH7_REG OCR5AH + +/* OCR4CL */ +#define OCR4CL0_REG OCR4CL +#define OCR4CL1_REG OCR4CL +#define OCR4CL2_REG OCR4CL +#define OCR4CL3_REG OCR4CL +#define OCR4CL4_REG OCR4CL +#define OCR4CL5_REG OCR4CL +#define OCR4CL6_REG OCR4CL +#define OCR4CL7_REG OCR4CL + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR5BH */ +#define OCR5BH0_REG OCR5BH +#define OCR5BH1_REG OCR5BH +#define OCR5BH2_REG OCR5BH +#define OCR5BH3_REG OCR5BH +#define OCR5BH4_REG OCR5BH +#define OCR5BH5_REG OCR5BH +#define OCR5BH6_REG OCR5BH +#define OCR5BH7_REG OCR5BH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR5BL */ +#define OCR5BL0_REG OCR5BL +#define OCR5BL1_REG OCR5BL +#define OCR5BL2_REG OCR5BL +#define OCR5BL3_REG OCR5BL +#define OCR5BL4_REG OCR5BL +#define OCR5BL5_REG OCR5BL +#define OCR5BL6_REG OCR5BL +#define OCR5BL7_REG OCR5BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4C_REG TIMSK4 +#define ICIE4_REG TIMSK4 + +/* TIMSK5 */ +#define TOIE5_REG TIMSK5 +#define OCIE5A_REG TIMSK5 +#define OCIE5B_REG TIMSK5 +#define OCIE5C_REG TIMSK5 +#define ICIE5_REG TIMSK5 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define WGM42_REG TCCR4B +#define WGM43_REG TCCR4B +#define ICES4_REG TCCR4B +#define ICNC4_REG TCCR4B + +/* TCCR4C */ +#define FOC4C_REG TCCR4C +#define FOC4B_REG TCCR4C +#define FOC4A_REG TCCR4C + +/* TCCR4A */ +#define WGM40_REG TCCR4A +#define WGM41_REG TCCR4A +#define COM4C0_REG TCCR4A +#define COM4C1_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* OCR4BL */ +#define OCR4BL0_REG OCR4BL +#define OCR4BL1_REG OCR4BL +#define OCR4BL2_REG OCR4BL +#define OCR4BL3_REG OCR4BL +#define OCR4BL4_REG OCR4BL +#define OCR4BL5_REG OCR4BL +#define OCR4BL6_REG OCR4BL +#define OCR4BL7_REG OCR4BL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* OCR4BH */ +#define OCR4BH0_REG OCR4BH +#define OCR4BH1_REG OCR4BH +#define OCR4BH2_REG OCR4BH +#define OCR4BH3_REG OCR4BH +#define OCR4BH4_REG OCR4BH +#define OCR4BH5_REG OCR4BH +#define OCR4BH6_REG OCR4BH +#define OCR4BH7_REG OCR4BH + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSART2_REG PRR1 +#define PRUSART3_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRTIM4_REG PRR1 +#define PRTIM5_REG PRR1 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define OC2_PORT PORTB +#define OC2_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define OC0A_PORT PORTB +#define OC0A_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define ICP1_PORT PORTD +#define ICP1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T0_PORT PORTD +#define T0_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 +#define PCINT8_PORT PORTE +#define PCINT8_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define ICP3_PORT PORTE +#define ICP3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 +#define CLKO_PORT PORTE +#define CLKO_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + +#define OC0B_PORT PORTG +#define OC0B_BIT 5 + + diff --git a/aversive/parts/ATmega32.h b/aversive/parts/ATmega32.h new file mode 100644 index 0000000..729dadf --- /dev/null +++ b/aversive/parts/ATmega32.h @@ -0,0 +1,824 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ACME_REG SFIOR +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SM2_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0_PORT PORTB +#define OC0_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + +#define TMS_PORT PORTC +#define TMS_BIT 2 + +#define TCK_PORT PORTC +#define TCK_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega323.h b/aversive/parts/ATmega323.h new file mode 100644 index 0000000..39a6182 --- /dev/null +++ b/aversive/parts/ATmega323.h @@ -0,0 +1,817 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define PWM0_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define ASRE_REG SPMCR +#define ASB_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define ISC2_REG MCUCSR +#define JDT_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADATE_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define CTC2_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define PWM2_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SM2_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0_PORT PORTB +#define OC0_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + +#define TMS_PORT PORTC +#define TMS_BIT 2 + +#define TCK_PORT PORTC +#define TCK_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega324P.h b/aversive/parts/ATmega324P.h new file mode 100644 index 0000000..78f09a9 --- /dev/null +++ b/aversive/parts/ATmega324P.h @@ -0,0 +1,1163 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPCR0 */ +#define SPR00_REG SPCR0 +#define SPR10_REG SPCR0 +#define CPHA0_REG SPCR0 +#define CPOL0_REG SPCR0 +#define MSTR0_REG SPCR0 +#define DORD0_REG SPCR0 +#define SPE0_REG SPCR0 +#define SPIE0_REG SPCR0 + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* SPDR0 */ +#define SPDRB0_REG SPDR0 +#define SPDRB1_REG SPDR0 +#define SPDRB2_REG SPDR0 +#define SPDRB3_REG SPDR0 +#define SPDRB4_REG SPDR0 +#define SPDRB5_REG SPDR0 +#define SPDRB6_REG SPDR0 +#define SPDRB7_REG SPDR0 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* SPSR0 */ +#define SPI2X0_REG SPSR0 +#define WCOL0_REG SPSR0 +#define SPIF0_REG SPSR0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRUSART1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega324PA.h b/aversive/parts/ATmega324PA.h new file mode 100644 index 0000000..78f09a9 --- /dev/null +++ b/aversive/parts/ATmega324PA.h @@ -0,0 +1,1163 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPCR0 */ +#define SPR00_REG SPCR0 +#define SPR10_REG SPCR0 +#define CPHA0_REG SPCR0 +#define CPOL0_REG SPCR0 +#define MSTR0_REG SPCR0 +#define DORD0_REG SPCR0 +#define SPE0_REG SPCR0 +#define SPIE0_REG SPCR0 + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* SPDR0 */ +#define SPDRB0_REG SPDR0 +#define SPDRB1_REG SPDR0 +#define SPDRB2_REG SPDR0 +#define SPDRB3_REG SPDR0 +#define SPDRB4_REG SPDR0 +#define SPDRB5_REG SPDR0 +#define SPDRB6_REG SPDR0 +#define SPDRB7_REG SPDR0 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* SPSR0 */ +#define SPI2X0_REG SPSR0 +#define WCOL0_REG SPSR0 +#define SPIF0_REG SPSR0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRUSART1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega325.h b/aversive/parts/ATmega325.h new file mode 100644 index 0000000..c6e1d99 --- /dev/null +++ b/aversive/parts/ATmega325.h @@ -0,0 +1,897 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega3250.h b/aversive/parts/ATmega3250.h new file mode 100644 index 0000000..cfde1f1 --- /dev/null +++ b/aversive/parts/ATmega3250.h @@ -0,0 +1,974 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega3250P.h b/aversive/parts/ATmega3250P.h new file mode 100644 index 0000000..eb00606 --- /dev/null +++ b/aversive/parts/ATmega3250P.h @@ -0,0 +1,976 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega325P.h b/aversive/parts/ATmega325P.h new file mode 100644 index 0000000..b980cc4 --- /dev/null +++ b/aversive/parts/ATmega325P.h @@ -0,0 +1,900 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega328P.h b/aversive/parts/ATmega328P.h new file mode 100644 index 0000000..12f5193 --- /dev/null +++ b/aversive/parts/ATmega328P.h @@ -0,0 +1,999 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega329.h b/aversive/parts/ATmega329.h new file mode 100644 index 0000000..ca186bb --- /dev/null +++ b/aversive/parts/ATmega329.h @@ -0,0 +1,1064 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega3290.h b/aversive/parts/ATmega3290.h new file mode 100644 index 0000000..84230d3 --- /dev/null +++ b/aversive/parts/ATmega3290.h @@ -0,0 +1,1208 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 +#define SEG025_REG LCDDR3 +#define SEG026_REG LCDDR3 +#define SEG027_REG LCDDR3 +#define SEG028_REG LCDDR3 +#define SEG029_REG LCDDR3 +#define SEG030_REG LCDDR3 +#define SEG031_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* LCDDR4 */ +#define SEG032_REG LCDDR4 +#define SEG033_REG LCDDR4 +#define SEG034_REG LCDDR4 +#define SEG035_REG LCDDR4 +#define SEG036_REG LCDDR4 +#define SEG037_REG LCDDR4 +#define SEG038_REG LCDDR4 +#define SEG039_REG LCDDR4 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR9 */ +#define SEG132_REG LCDDR9 +#define SEG133_REG LCDDR9 +#define SEG134_REG LCDDR9 +#define SEG135_REG LCDDR9 +#define SEG136_REG LCDDR9 +#define SEG137_REG LCDDR9 +#define SEG138_REG LCDDR9 +#define SEG139_REG LCDDR9 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 +#define SEG125_REG LCDDR8 +#define SEG126_REG LCDDR8 +#define SEG127_REG LCDDR8 +#define SEG128_REG LCDDR8 +#define SEG129_REG LCDDR8 +#define SEG130_REG LCDDR8 +#define SEG131_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDDR19 */ +#define SEG332_REG LCDDR19 +#define SEG333_REG LCDDR19 +#define SEG334_REG LCDDR19 +#define SEG335_REG LCDDR19 +#define SEG336_REG LCDDR19 +#define SEG337_REG LCDDR19 +#define SEG338_REG LCDDR19 +#define SEG339_REG LCDDR19 + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 +#define SEG325_REG LCDDR18 +#define SEG326_REG LCDDR18 +#define SEG327_REG LCDDR18 +#define SEG328_REG LCDDR18 +#define SEG329_REG LCDDR18 +#define SEG330_REG LCDDR18 +#define SEG331_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 +#define SEG225_REG LCDDR13 +#define SEG226_REG LCDDR13 +#define SEG227_REG LCDDR13 +#define SEG228_REG LCDDR13 +#define SEG229_REG LCDDR13 +#define SEG230_REG LCDDR13 +#define SEG231_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* LCDDR14 */ +#define SEG232_REG LCDDR14 +#define SEG233_REG LCDDR14 +#define SEG234_REG LCDDR14 +#define SEG235_REG LCDDR14 +#define SEG236_REG LCDDR14 +#define SEG237_REG LCDDR14 +#define SEG238_REG LCDDR14 +#define SEG239_REG LCDDR14 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega3290P.h b/aversive/parts/ATmega3290P.h new file mode 100644 index 0000000..da8f3f2 --- /dev/null +++ b/aversive/parts/ATmega3290P.h @@ -0,0 +1,1213 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 +#define SEG025_REG LCDDR3 +#define SEG026_REG LCDDR3 +#define SEG027_REG LCDDR3 +#define SEG028_REG LCDDR3 +#define SEG029_REG LCDDR3 +#define SEG030_REG LCDDR3 +#define SEG031_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* LCDDR4 */ +#define SEG032_REG LCDDR4 +#define SEG033_REG LCDDR4 +#define SEG034_REG LCDDR4 +#define SEG035_REG LCDDR4 +#define SEG036_REG LCDDR4 +#define SEG037_REG LCDDR4 +#define SEG038_REG LCDDR4 +#define SEG039_REG LCDDR4 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR9 */ +#define SEG132_REG LCDDR9 +#define SEG133_REG LCDDR9 +#define SEG134_REG LCDDR9 +#define SEG135_REG LCDDR9 +#define SEG136_REG LCDDR9 +#define SEG137_REG LCDDR9 +#define SEG138_REG LCDDR9 +#define SEG139_REG LCDDR9 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 +#define SEG125_REG LCDDR8 +#define SEG126_REG LCDDR8 +#define SEG127_REG LCDDR8 +#define SEG128_REG LCDDR8 +#define SEG129_REG LCDDR8 +#define SEG130_REG LCDDR8 +#define SEG131_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDCCD_REG LCDCRA +#define LCDBD_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDDR19 */ +#define SEG332_REG LCDDR19 +#define SEG333_REG LCDDR19 +#define SEG334_REG LCDDR19 +#define SEG335_REG LCDDR19 +#define SEG336_REG LCDDR19 +#define SEG337_REG LCDDR19 +#define SEG338_REG LCDDR19 +#define SEG339_REG LCDDR19 + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 +#define SEG325_REG LCDDR18 +#define SEG326_REG LCDDR18 +#define SEG327_REG LCDDR18 +#define SEG328_REG LCDDR18 +#define SEG329_REG LCDDR18 +#define SEG330_REG LCDDR18 +#define SEG331_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 +#define SEG225_REG LCDDR13 +#define SEG226_REG LCDDR13 +#define SEG227_REG LCDDR13 +#define SEG228_REG LCDDR13 +#define SEG229_REG LCDDR13 +#define SEG230_REG LCDDR13 +#define SEG231_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* LCDDR14 */ +#define SEG232_REG LCDDR14 +#define SEG233_REG LCDDR14 +#define SEG234_REG LCDDR14 +#define SEG235_REG LCDDR14 +#define SEG236_REG LCDDR14 +#define SEG237_REG LCDDR14 +#define SEG238_REG LCDDR14 +#define SEG239_REG LCDDR14 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDMDT_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega329P.h b/aversive/parts/ATmega329P.h new file mode 100644 index 0000000..d6efc0d --- /dev/null +++ b/aversive/parts/ATmega329P.h @@ -0,0 +1,1069 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDCCD_REG LCDCRA +#define LCDBD_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDMDT_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega32A.h b/aversive/parts/ATmega32A.h new file mode 100644 index 0000000..729dadf --- /dev/null +++ b/aversive/parts/ATmega32A.h @@ -0,0 +1,824 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ACME_REG SFIOR +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR00_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SM2_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0_PORT PORTB +#define OC0_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + +#define TMS_PORT PORTC +#define TMS_BIT 2 + +#define TCK_PORT PORTC +#define TCK_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega32C1.h b/aversive/parts/ATmega32C1.h new file mode 100644 index 0000000..da9a428 --- /dev/null +++ b/aversive/parts/ATmega32C1.h @@ -0,0 +1,1304 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* LINBTR */ +#define LBT0_REG LINBTR +#define LBT1_REG LINBTR +#define LBT2_REG LINBTR +#define LBT3_REG LINBTR +#define LBT4_REG LINBTR +#define LBT5_REG LINBTR +#define LDISR_REG LINBTR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* LINIDR */ +#define LID0_REG LINIDR +#define LID1_REG LINIDR +#define LID2_REG LINIDR +#define LID3_REG LINIDR +#define LID4_REG LINIDR +#define LID5_REG LINIDR +#define LP0_REG LINIDR +#define LP1_REG LINIDR + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC3O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define AC3IF_REG ACSR + +/* LINSEL */ +#define LINDX0_REG LINSEL +#define LINDX1_REG LINSEL +#define LINDX2_REG LINSEL +#define LAINC_REG LINSEL + +/* LINCR */ +#define LCMD0_REG LINCR +#define LCMD1_REG LINCR +#define LCMD2_REG LINCR +#define LENA_REG LINCR +#define LCONF0_REG LINCR +#define LCONF1_REG LINCR +#define LIN13_REG LINCR +#define LSWRES_REG LINCR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRLIN_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC_REG PRR +#define PRCAN_REG PRR + +/* LINBRRL */ +#define LDIV0_REG LINBRRL +#define LDIV1_REG LINBRRL +#define LDIV2_REG LINBRRL +#define LDIV3_REG LINBRRL +#define LDIV4_REG LINBRRL +#define LDIV5_REG LINBRRL +#define LDIV6_REG LINBRRL +#define LDIV7_REG LINBRRL + +/* LINBRRH */ +#define LDIV8_REG LINBRRH +#define LDIV9_REG LINBRRH +#define LDIV10_REG LINBRRH +#define LDIV11_REG LINBRRH + +/* CANGSTA */ +#define ERRP_REG CANGSTA +#define BOFF_REG CANGSTA +#define ENFG_REG CANGSTA +#define RXBSY_REG CANGSTA +#define TXBSY_REG CANGSTA +#define OVFG_REG CANGSTA + +/* CANGCON */ +#define SWRES_REG CANGCON +#define ENASTB_REG CANGCON +#define TEST_REG CANGCON +#define LISTEN_REG CANGCON +#define SYNTTC_REG CANGCON +#define TTC_REG CANGCON +#define OVRQ_REG CANGCON +#define ABRQ_REG CANGCON + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1TS2_REG AMP1CSR +#define AMPCMP1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* LINSIR */ +#define LRXOK_REG LINSIR +#define LTXOK_REG LINSIR +#define LIDOK_REG LINSIR +#define LERR_REG LINSIR +#define LBUSY_REG LINSIR +#define LIDST0_REG LINSIR +#define LIDST1_REG LINSIR +#define LIDST2_REG LINSIR + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 +#define AMP2PD_REG DIDR1 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* CANIDM1 */ +#define IDMSK21_REG CANIDM1 +#define IDMSK22_REG CANIDM1 +#define IDMSK23_REG CANIDM1 +#define IDMSK24_REG CANIDM1 +#define IDMSK25_REG CANIDM1 +#define IDMSK26_REG CANIDM1 +#define IDMSK27_REG CANIDM1 +#define IDMSK28_REG CANIDM1 + +/* CANIDM3 */ +#define IDMSK5_REG CANIDM3 +#define IDMSK6_REG CANIDM3 +#define IDMSK7_REG CANIDM3 +#define IDMSK8_REG CANIDM3 +#define IDMSK9_REG CANIDM3 +#define IDMSK10_REG CANIDM3 +#define IDMSK11_REG CANIDM3 +#define IDMSK12_REG CANIDM3 + +/* CANIDM2 */ +#define IDMSK13_REG CANIDM2 +#define IDMSK14_REG CANIDM2 +#define IDMSK15_REG CANIDM2 +#define IDMSK16_REG CANIDM2 +#define IDMSK17_REG CANIDM2 +#define IDMSK18_REG CANIDM2 +#define IDMSK19_REG CANIDM2 +#define IDMSK20_REG CANIDM2 + +/* CANIDM4 */ +#define IDEMSK_REG CANIDM4 +#define RTRMSK_REG CANIDM4 +#define IDMSK0_REG CANIDM4 +#define IDMSK1_REG CANIDM4 +#define IDMSK2_REG CANIDM4 +#define IDMSK3_REG CANIDM4 +#define IDMSK4_REG CANIDM4 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* CANGIT */ +#define AERG_REG CANGIT +#define FERG_REG CANGIT +#define CERG_REG CANGIT +#define SERG_REG CANGIT +#define BXOK_REG CANGIT +#define OVRTIM_REG CANGIT +#define BOFFIT_REG CANGIT +#define CANIT_REG CANGIT + +/* AC3CON */ +#define AC3M0_REG AC3CON +#define AC3M1_REG AC3CON +#define AC3M2_REG AC3CON +#define AC3IS0_REG AC3CON +#define AC3IS1_REG AC3CON +#define AC3IE_REG AC3CON +#define AC3EN_REG AC3CON + +/* LINERR */ +#define LBERR_REG LINERR +#define LCERR_REG LINERR +#define LPERR_REG LINERR +#define LSERR_REG LINERR +#define LFERR_REG LINERR +#define LOVERR_REG LINERR +#define LTOERR_REG LINERR +#define LABORT_REG LINERR + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* CANGIE */ +#define ENOVRT_REG CANGIE +#define ENERG_REG CANGIE +#define ENBX_REG CANGIE +#define ENERR_REG CANGIE +#define ENTX_REG CANGIE +#define ENRX_REG CANGIE +#define ENBOFF_REG CANGIE +#define ENIT_REG CANGIE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* CANIE2 */ +#define IEMOB0_REG CANIE2 +#define IEMOB1_REG CANIE2 +#define IEMOB2_REG CANIE2 +#define IEMOB3_REG CANIE2 +#define IEMOB4_REG CANIE2 +#define IEMOB5_REG CANIE2 + +/* CANSIT2 */ +#define SIT0_REG CANSIT2 +#define SIT1_REG CANSIT2 +#define SIT2_REG CANSIT2 +#define SIT3_REG CANSIT2 +#define SIT4_REG CANSIT2 +#define SIT5_REG CANSIT2 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* CANIDT4 */ +#define RB0TAG_REG CANIDT4 +#define RB1TAG_REG CANIDT4 +#define RTRTAG_REG CANIDT4 +#define IDT0_REG CANIDT4 +#define IDT1_REG CANIDT4 +#define IDT2_REG CANIDT4 +#define IDT3_REG CANIDT4 +#define IDT4_REG CANIDT4 + +/* CANIDT2 */ +#define IDT13_REG CANIDT2 +#define IDT14_REG CANIDT2 +#define IDT15_REG CANIDT2 +#define IDT16_REG CANIDT2 +#define IDT17_REG CANIDT2 +#define IDT18_REG CANIDT2 +#define IDT19_REG CANIDT2 +#define IDT20_REG CANIDT2 + +/* CANIDT3 */ +#define IDT5_REG CANIDT3 +#define IDT6_REG CANIDT3 +#define IDT7_REG CANIDT3 +#define IDT8_REG CANIDT3 +#define IDT9_REG CANIDT3 +#define IDT10_REG CANIDT3 +#define IDT11_REG CANIDT3 +#define IDT12_REG CANIDT3 + +/* CANIDT1 */ +#define IDT21_REG CANIDT1 +#define IDT22_REG CANIDT1 +#define IDT23_REG CANIDT1 +#define IDT24_REG CANIDT1 +#define IDT25_REG CANIDT1 +#define IDT26_REG CANIDT1 +#define IDT27_REG CANIDT1 +#define IDT28_REG CANIDT1 + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* CANCDMOB */ +#define DLC0_REG CANCDMOB +#define DLC1_REG CANCDMOB +#define DLC2_REG CANCDMOB +#define DLC3_REG CANCDMOB +#define IDE_REG CANCDMOB +#define RPLV_REG CANCDMOB +#define CONMOB0_REG CANCDMOB +#define CONMOB1_REG CANCDMOB + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CANHPMOB */ +#define CGP0_REG CANHPMOB +#define CGP1_REG CANHPMOB +#define CGP2_REG CANHPMOB +#define CGP3_REG CANHPMOB +#define HPMOB0_REG CANHPMOB +#define HPMOB1_REG CANHPMOB +#define HPMOB2_REG CANHPMOB +#define HPMOB3_REG CANHPMOB + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* LINENIR */ +#define LENRXOK_REG LINENIR +#define LENTXOK_REG LINENIR +#define LENIDOK_REG LINENIR +#define LENERR_REG LINENIR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* AMP2CSR */ +#define AMP2TS0_REG AMP2CSR +#define AMP2TS1_REG AMP2CSR +#define AMP2TS2_REG AMP2CSR +#define AMPCMP2_REG AMP2CSR +#define AMP2G0_REG AMP2CSR +#define AMP2G1_REG AMP2CSR +#define AMP2IS_REG AMP2CSR +#define AMP2EN_REG AMP2CSR + +/* LINDAT */ +#define LDATA0_REG LINDAT +#define LDATA1_REG LINDAT +#define LDATA2_REG LINDAT +#define LDATA3_REG LINDAT +#define LDATA4_REG LINDAT +#define LDATA5_REG LINDAT +#define LDATA6_REG LINDAT +#define LDATA7_REG LINDAT + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* CANPAGE */ +#define INDX0_REG CANPAGE +#define INDX1_REG CANPAGE +#define INDX2_REG CANPAGE +#define AINC_REG CANPAGE +#define MOBNB0_REG CANPAGE +#define MOBNB1_REG CANPAGE +#define MOBNB2_REG CANPAGE +#define MOBNB3_REG CANPAGE + +/* LINDLR */ +#define LRXDL0_REG LINDLR +#define LRXDL1_REG LINDLR +#define LRXDL2_REG LINDLR +#define LRXDL3_REG LINDLR +#define LTXDL0_REG LINDLR +#define LTXDL1_REG LINDLR +#define LTXDL2_REG LINDLR +#define LTXDL3_REG LINDLR + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* CANSTMOB */ +#define AERR_REG CANSTMOB +#define FERR_REG CANSTMOB +#define CERR_REG CANSTMOB +#define SERR_REG CANSTMOB +#define BERR_REG CANSTMOB +#define RXOK_REG CANSTMOB +#define TXOK_REG CANSTMOB +#define DLCW_REG CANSTMOB + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* CANEN2 */ +#define ENMOB0_REG CANEN2 +#define ENMOB1_REG CANEN2 +#define ENMOB2_REG CANEN2 +#define ENMOB3_REG CANEN2 +#define ENMOB4_REG CANEN2 +#define ENMOB5_REG CANEN2 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define AREFEN_REG ADCSRB +#define ISRCEN_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* CANBT2 */ +#define PRS0_REG CANBT2 +#define PRS1_REG CANBT2 +#define PRS2_REG CANBT2 +#define SJW0_REG CANBT2 +#define SJW1_REG CANBT2 + +/* CANBT3 */ +#define SMP_REG CANBT3 +#define PHS10_REG CANBT3 +#define PHS11_REG CANBT3 +#define PHS12_REG CANBT3 +#define PHS20_REG CANBT3 +#define PHS21_REG CANBT3 +#define PHS22_REG CANBT3 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* CANBT1 */ +#define BRP0_REG CANBT1 +#define BRP1_REG CANBT1 +#define BRP2_REG CANBT1 +#define BRP3_REG CANBT1 +#define BRP4_REG CANBT1 +#define BRP5_REG CANBT1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0TS2_REG AMP0CSR +#define AMPCMP0_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define ACCKSEL_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 +#define ACMPN0_PORT PORTB +#define ACMPN0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 +#define ACMPN1_PORT PORTB +#define ACMPN1_BIT 5 +#define AMP2-_PORT PORTB +#define AMP2-_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define INT3_PORT PORTC +#define INT3_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define OC1B_PORT PORTC +#define OC1B_BIT 1 +#define SS_A_PORT PORTC +#define SS_A_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define T0_PORT PORTC +#define T0_BIT 2 +#define TXCAN_PORT PORTC +#define TXCAN_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define T1_PORT PORTC +#define T1_BIT 3 +#define RXCAN_PORT PORTC +#define RXCAN_BIT 3 +#define ICP1B_PORT PORTC +#define ICP1B_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC8_PORT PORTC +#define ADC8_BIT 4 +#define AMP1-_PORT PORTC +#define AMP1-_BIT 4 +#define ACMPN3_PORT PORTC +#define ACMPN3_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC9_PORT PORTC +#define ADC9_BIT 5 +#define AMP1+_PORT PORTC +#define AMP1+_BIT 5 +#define ACMP3_PORT PORTC +#define ACMP3_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define ADC10_PORT PORTC +#define ADC10_BIT 6 +#define ACMP1_PORT PORTC +#define ACMP1_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define D2A_PORT PORTC +#define D2A_BIT 7 +#define AMP2+_PORT PORTC +#define AMP2+_BIT 7 +#define PCINT15_PORT PORTC +#define PCINT15_BIT 7 + +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define CLK0_PORT PORTD +#define CLK0_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define TXLIN_PORT PORTD +#define TXLIN_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define RXLIN_PORT PORTD +#define RXLIN_BIT 4 +#define ICP1A_PORT PORTD +#define ICP1A_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACMP2_PORT PORTD +#define ACMP2_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPN2_PORT PORTD +#define ACMPN2_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 +#define PCINT24_PORT PORTE +#define PCINT24_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 +#define PCINT25_PORT PORTE +#define PCINT25_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 +#define PCINT26_PORT PORTE +#define PCINT26_BIT 2 + + diff --git a/aversive/parts/ATmega32HVB.h b/aversive/parts/ATmega32HVB.h new file mode 100644 index 0000000..96c42b4 --- /dev/null +++ b/aversive/parts/ATmega32HVB.h @@ -0,0 +1,882 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CADAC2 */ +#define CADAC16_REG CADAC2 +#define CADAC17_REG CADAC2 +#define CADAC18_REG CADAC2 +#define CADAC19_REG CADAC2 +#define CADAC20_REG CADAC2 +#define CADAC21_REG CADAC2 +#define CADAC22_REG CADAC2 +#define CADAC23_REG CADAC2 + +/* CADAC3 */ +#define CADAC24_REG CADAC3 +#define CADAC25_REG CADAC3 +#define CADAC26_REG CADAC3 +#define CADAC27_REG CADAC3 +#define CADAC28_REG CADAC3 +#define CADAC29_REG CADAC3 +#define CADAC30_REG CADAC3 +#define CADAC31_REG CADAC3 + +/* CADAC0 */ +#define CADAC00_REG CADAC0 +#define CADAC01_REG CADAC0 +#define CADAC02_REG CADAC0 +#define CADAC03_REG CADAC0 +#define CADAC04_REG CADAC0 +#define CADAC05_REG CADAC0 +#define CADAC06_REG CADAC0 +#define CADAC07_REG CADAC0 + +/* CADAC1 */ +#define CADAC08_REG CADAC1 +#define CADAC09_REG CADAC1 +#define CADAC10_REG CADAC1 +#define CADAC11_REG CADAC1 +#define CADAC12_REG CADAC1 +#define CADAC13_REG CADAC1 +#define CADAC14_REG CADAC1 +#define CADAC15_REG CADAC1 + +/* BPIMSK */ +#define CHCIE_REG BPIMSK +#define DHCIE_REG BPIMSK +#define COCIE_REG BPIMSK +#define DOCIE_REG BPIMSK +#define SCIE_REG BPIMSK + +/* TCNT0H */ +#define TCNT0H0_REG TCNT0H +#define TCNT0H1_REG TCNT0H +#define TCNT0H2_REG TCNT0H +#define TCNT0H3_REG TCNT0H +#define TCNT0H4_REG TCNT0H +#define TCNT0H5_REG TCNT0H +#define TCNT0H6_REG TCNT0H +#define TCNT0H7_REG TCNT0H + +/* TCNT0L */ +#define TCNT0L0_REG TCNT0L +#define TCNT0L1_REG TCNT0L +#define TCNT0L2_REG TCNT0L +#define TCNT0L3_REG TCNT0L +#define TCNT0L4_REG TCNT0L +#define TCNT0L5_REG TCNT0L +#define TCNT0L6_REG TCNT0L +#define TCNT0L7_REG TCNT0L + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* BPCOCD */ +#define COCDL0_REG BPCOCD +#define COCDL1_REG BPCOCD +#define COCDL2_REG BPCOCD +#define COCDL3_REG BPCOCD +#define COCDL4_REG BPCOCD +#define COCDL5_REG BPCOCD +#define COCDL6_REG BPCOCD +#define COCDL7_REG BPCOCD + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA + +/* BPSCD */ +#define SCDL0_REG BPSCD +#define SCDL1_REG BPSCD +#define SCDL2_REG BPSCD +#define SCDL3_REG BPSCD +#define SCDL4_REG BPSCD +#define SCDL5_REG BPSCD +#define SCDL6_REG BPSCD +#define SCDL7_REG BPSCD + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* VADCH */ +#define VADC8_REG VADCH +#define VADC9_REG VADCH +#define VADC10_REG VADCH +#define VADC11_REG VADCH + +/* VADCL */ +#define VADC0_REG VADCL +#define VADC1_REG VADCL +#define VADC2_REG VADCL +#define VADC3_REG VADCL +#define VADC4_REG VADCL +#define VADC5_REG VADCL +#define VADC6_REG VADCL +#define VADC7_REG VADCL + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* FOSCCAL */ +#define FCAL0_REG FOSCCAL +#define FCAL1_REG FOSCCAL +#define FCAL2_REG FOSCCAL +#define FCAL3_REG FOSCCAL +#define FCAL4_REG FOSCCAL +#define FCAL5_REG FOSCCAL +#define FCAL6_REG FOSCCAL +#define FCAL7_REG FOSCCAL + +/* DIDR0 */ +#define PA0DID_REG DIDR0 +#define PA1DID_REG DIDR0 + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* BPCR */ +#define CHCD_REG BPCR +#define DHCD_REG BPCR +#define COCD_REG BPCR +#define DOCD_REG BPCR +#define SCD_REG BPCR +#define EPID_REG BPCR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define ICS1_REG TCCR1A +#define ICES1_REG TCCR1A +#define ICNC1_REG TCCR1A +#define ICEN1_REG TCCR1A +#define TCW1_REG TCCR1A + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B + +/* BPCHCD */ +#define CHCDL0_REG BPCHCD +#define CHCDL1_REG BPCHCD +#define CHCDL2_REG BPCHCD +#define CHCDL3_REG BPCHCD +#define CHCDL4_REG BPCHCD +#define CHCDL5_REG BPCHCD +#define CHCDL6_REG BPCHCD +#define CHCDL7_REG BPCHCD + +/* CADCSRC */ +#define CADVSE_REG CADCSRC + +/* CADCSRB */ +#define CADICIF_REG CADCSRB +#define CADRCIF_REG CADCSRB +#define CADACIF_REG CADCSRB +#define CADICIE_REG CADCSRB +#define CADRCIE_REG CADCSRB +#define CADACIE_REG CADCSRB + +/* CADCSRA */ +#define CADSE_REG CADCSRA +#define CADSI0_REG CADCSRA +#define CADSI1_REG CADCSRA +#define CADAS0_REG CADCSRA +#define CADAS1_REG CADCSRA +#define CADUB_REG CADCSRA +#define CADPOL_REG CADCSRA +#define CADEN_REG CADCSRA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* BPPLR */ +#define BPPL_REG BPPLR +#define BPPLE_REG BPPLR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* CADRDC */ +#define CADRDC0_REG CADRDC +#define CADRDC1_REG CADRDC +#define CADRDC2_REG CADRDC +#define CADRDC3_REG CADRDC +#define CADRDC4_REG CADRDC +#define CADRDC5_REG CADRDC +#define CADRDC6_REG CADRDC +#define CADRDC7_REG CADRDC + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define ICS0_REG TCCR0A +#define ICES0_REG TCCR0A +#define ICNC0_REG TCCR0A +#define ICEN0_REG TCCR0A +#define TCW0_REG TCCR0A + +/* BPDHCD */ +#define DHCDL0_REG BPDHCD +#define DHCDL1_REG BPDHCD +#define DHCDL2_REG BPDHCD +#define DHCDL3_REG BPDHCD +#define DHCDL4_REG BPDHCD +#define DHCDL5_REG BPDHCD +#define DHCDL6_REG BPDHCD +#define DHCDL7_REG BPDHCD + +/* TWBCSR */ +#define TWBCIP_REG TWBCSR +#define TWBDT0_REG TWBCSR +#define TWBDT1_REG TWBCSR +#define TWBCIE_REG TWBCSR +#define TWBCIF_REG TWBCSR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* BGCRR */ +#define BGCR0_REG BGCRR +#define BGCR1_REG BGCRR +#define BGCR2_REG BGCRR +#define BGCR3_REG BGCRR +#define BGCR4_REG BGCRR +#define BGCR5_REG BGCRR +#define BGCR6_REG BGCRR +#define BGCR7_REG BGCRR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR + +/* FCSR */ +#define CFE_REG FCSR +#define DFE_REG FCSR +#define CPS_REG FCSR +#define DUVRD_REG FCSR + +/* VADMUX */ +#define VADMUX0_REG VADMUX +#define VADMUX1_REG VADMUX +#define VADMUX2_REG VADMUX +#define VADMUX3_REG VADMUX + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BODRF_REG MCUSR +#define WDRF_REG MCUSR +#define OCDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* BPIFR */ +#define CHCIF_REG BPIFR +#define DHCIF_REG BPIFR +#define COCIF_REG BPIFR +#define DOCIF_REG BPIFR +#define SCIF_REG BPIFR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* VADCSR */ +#define VADCCIE_REG VADCSR +#define VADCCIF_REG VADCSR +#define VADSC_REG VADCSR +#define VADEN_REG VADCSR + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define CKOE_REG MCUCR + +/* CBCR */ +#define CBE1_REG CBCR +#define CBE2_REG CBCR +#define CBE3_REG CBCR +#define CBE4_REG CBCR + +/* CADRCC */ +#define CADRCC0_REG CADRCC +#define CADRCC1_REG CADRCC +#define CADRCC2_REG CADRCC +#define CADRCC3_REG CADRCC +#define CADRCC4_REG CADRCC +#define CADRCC5_REG CADRCC +#define CADRCC6_REG CADRCC +#define CADRCC7_REG CADRCC + +/* BPOCTR */ +#define OCPT0_REG BPOCTR +#define OCPT1_REG BPOCTR +#define OCPT2_REG BPOCTR +#define OCPT3_REG BPOCTR +#define OCPT4_REG BPOCTR +#define OCPT5_REG BPOCTR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA + +/* BPDOCD */ +#define DOCDL0_REG BPDOCD +#define DOCDL1_REG BPDOCD +#define DOCDL2_REG BPDOCD +#define DOCDL3_REG BPDOCD +#define DOCDL4_REG BPDOCD +#define DOCDL5_REG BPDOCD +#define DOCDL6_REG BPDOCD +#define DOCDL7_REG BPDOCD + +/* BPSCTR */ +#define SCPT0_REG BPSCTR +#define SCPT1_REG BPSCTR +#define SCPT2_REG BPSCTR +#define SCPT3_REG BPSCTR +#define SCPT4_REG BPSCTR +#define SCPT5_REG BPSCTR +#define SCPT6_REG BPSCTR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* BPHCTR */ +#define HCPT0_REG BPHCTR +#define HCPT1_REG BPHCTR +#define HCPT2_REG BPHCTR +#define HCPT3_REG BPHCTR +#define HCPT4_REG BPHCTR +#define HCPT5_REG BPHCTR + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* PRR0 */ +#define PRVADC_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRSPI_REG PRR0 +#define PRVRM_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ROCR */ +#define ROCWIE_REG ROCR +#define ROCWIF_REG ROCR +#define ROCD_REG ROCR +#define ROCS_REG ROCR + +/* OCR0B */ +#define OCR0B0_REG OCR0B +#define OCR0B1_REG OCR0B +#define OCR0B2_REG OCR0B +#define OCR0B3_REG OCR0B +#define OCR0B4_REG OCR0B +#define OCR0B5_REG OCR0B +#define OCR0B6_REG OCR0B +#define OCR0B7_REG OCR0B + +/* CADICH */ +#define CADICH0_REG CADICH +#define CADICH1_REG CADICH +#define CADICH2_REG CADICH +#define CADICH3_REG CADICH +#define CADICH4_REG CADICH +#define CADICH5_REG CADICH +#define CADICH6_REG CADICH +#define CADICH7_REG CADICH + +/* CADICL */ +#define CADICL0_REG CADICL +#define CADICL1_REG CADICL +#define CADICL2_REG CADICL +#define CADICL3_REG CADICL +#define CADICL4_REG CADICL +#define CADICL5_REG CADICL +#define CADICL6_REG CADICL +#define CADICL7_REG CADICL + +/* OSICSR */ +#define OSIEN_REG OSICSR +#define OSIST_REG OSICSR +#define OSISEL0_REG OSICSR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define LBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* CHGDCSR */ +#define CHGDIE_REG CHGDCSR +#define CHGDIF_REG CHGDCSR +#define CHGDISC0_REG CHGDCSR +#define CHGDISC1_REG CHGDCSR +#define BATTPVL_REG CHGDCSR + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 +#define ICIE0_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* BGCCR */ +#define BGCC0_REG BGCCR +#define BGCC1_REG BGCCR +#define BGCC2_REG BGCCR +#define BGCC3_REG BGCCR +#define BGCC4_REG BGCCR +#define BGCC5_REG BGCCR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT4_REG PCMSK1 +#define PCINT5_REG PCMSK1 +#define PCINT6_REG PCMSK1 +#define PCINT7_REG PCMSK1 +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* BGCSR */ +#define BGSCDIE_REG BGCSR +#define BGSCDIF_REG BGCSR +#define BGSCDE_REG BGCSR +#define BGD_REG BGCSR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 +#define ICF0_REG TIFR0 + +/* pins mapping */ + + + + + + + + + + + diff --git a/aversive/parts/ATmega32M1.h b/aversive/parts/ATmega32M1.h new file mode 100644 index 0000000..a234d60 --- /dev/null +++ b/aversive/parts/ATmega32M1.h @@ -0,0 +1,1553 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* LINBTR */ +#define LBT0_REG LINBTR +#define LBT1_REG LINBTR +#define LBT2_REG LINBTR +#define LBT3_REG LINBTR +#define LBT4_REG LINBTR +#define LBT5_REG LINBTR +#define LDISR_REG LINBTR + +/* POCR1RAL */ +#define POCR1RA_0_REG POCR1RAL +#define POCR1RA_1_REG POCR1RAL +#define POCR1RA_2_REG POCR1RAL +#define POCR1RA_3_REG POCR1RAL +#define POCR1RA_4_REG POCR1RAL +#define POCR1RA_5_REG POCR1RAL +#define POCR1RA_6_REG POCR1RAL +#define POCR1RA_7_REG POCR1RAL + +/* LINIDR */ +#define LID0_REG LINIDR +#define LID1_REG LINIDR +#define LID2_REG LINIDR +#define LID3_REG LINIDR +#define LID4_REG LINIDR +#define LID5_REG LINIDR +#define LP0_REG LINIDR +#define LP1_REG LINIDR + +/* POCR1RAH */ +#define POCR1RA_8_REG POCR1RAH +#define POCR1RA_9_REG POCR1RAH +#define POCR1RA_00_REG POCR1RAH +#define POCR1RA_01_REG POCR1RAH + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* LINSEL */ +#define LINDX0_REG LINSEL +#define LINDX1_REG LINSEL +#define LINDX2_REG LINSEL +#define LAINC_REG LINSEL + +/* LINCR */ +#define LCMD0_REG LINCR +#define LCMD1_REG LINCR +#define LCMD2_REG LINCR +#define LENA_REG LINCR +#define LCONF0_REG LINCR +#define LCONF1_REG LINCR +#define LIN13_REG LINCR +#define LSWRES_REG LINCR + +/* PIM */ +#define PEOPE_REG PIM +#define PEVE0_REG PIM +#define PEVE1_REG PIM +#define PEVE2_REG PIM + +/* POCR2SBL */ +#define POCR2SB_0_REG POCR2SBL +#define POCR2SB_1_REG POCR2SBL +#define POCR2SB_2_REG POCR2SBL +#define POCR2SB_3_REG POCR2SBL +#define POCR2SB_4_REG POCR2SBL +#define POCR2SB_5_REG POCR2SBL +#define POCR2SB_6_REG POCR2SBL +#define POCR2SB_7_REG POCR2SBL + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* POCR2SBH */ +#define POCR2SB_8_REG POCR2SBH +#define POCR2SB_9_REG POCR2SBH +#define POCR2SB_00_REG POCR2SBH +#define POCR2SB_01_REG POCR2SBH + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* AC1CON */ +#define AC1M0_REG AC1CON +#define AC1M1_REG AC1CON +#define AC1M2_REG AC1CON +#define AC1ICE_REG AC1CON +#define AC1IS0_REG AC1CON +#define AC1IS1_REG AC1CON +#define AC1IE_REG AC1CON +#define AC1EN_REG AC1CON + +/* PRR */ +#define PRADC_REG PRR +#define PRLIN_REG PRR +#define PRSPI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRPSC_REG PRR +#define PRCAN_REG PRR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* LINBRRL */ +#define LDIV0_REG LINBRRL +#define LDIV1_REG LINBRRL +#define LDIV2_REG LINBRRL +#define LDIV3_REG LINBRRL +#define LDIV4_REG LINBRRL +#define LDIV5_REG LINBRRL +#define LDIV6_REG LINBRRL +#define LDIV7_REG LINBRRL + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH + +/* LINBRRH */ +#define LDIV8_REG LINBRRH +#define LDIV9_REG LINBRRH +#define LDIV10_REG LINBRRH +#define LDIV11_REG LINBRRH + +/* CANGSTA */ +#define ERRP_REG CANGSTA +#define BOFF_REG CANGSTA +#define ENFG_REG CANGSTA +#define RXBSY_REG CANGSTA +#define TXBSY_REG CANGSTA +#define OVFG_REG CANGSTA + +/* CANGCON */ +#define SWRES_REG CANGCON +#define ENASTB_REG CANGCON +#define TEST_REG CANGCON +#define LISTEN_REG CANGCON +#define SYNTTC_REG CANGCON +#define TTC_REG CANGCON +#define OVRQ_REG CANGCON +#define ABRQ_REG CANGCON + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* AMP1CSR */ +#define AMP1TS0_REG AMP1CSR +#define AMP1TS1_REG AMP1CSR +#define AMP1TS2_REG AMP1CSR +#define AMPCMP1_REG AMP1CSR +#define AMP1G0_REG AMP1CSR +#define AMP1G1_REG AMP1CSR +#define AMP1IS_REG AMP1CSR +#define AMP1EN_REG AMP1CSR + +/* AC2CON */ +#define AC2M0_REG AC2CON +#define AC2M1_REG AC2CON +#define AC2M2_REG AC2CON +#define AC2IS0_REG AC2CON +#define AC2IS1_REG AC2CON +#define AC2IE_REG AC2CON +#define AC2EN_REG AC2CON + +/* CANPAGE */ +#define INDX0_REG CANPAGE +#define INDX1_REG CANPAGE +#define INDX2_REG CANPAGE +#define AINC_REG CANPAGE +#define MOBNB0_REG CANPAGE +#define MOBNB1_REG CANPAGE +#define MOBNB2_REG CANPAGE +#define MOBNB3_REG CANPAGE + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* LINENIR */ +#define LENRXOK_REG LINENIR +#define LENTXOK_REG LINENIR +#define LENIDOK_REG LINENIR +#define LENERR_REG LINENIR + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* POCR2RAL */ +#define POCR2RA_0_REG POCR2RAL +#define POCR2RA_1_REG POCR2RAL +#define POCR2RA_2_REG POCR2RAL +#define POCR2RA_3_REG POCR2RAL +#define POCR2RA_4_REG POCR2RAL +#define POCR2RA_5_REG POCR2RAL +#define POCR2RA_6_REG POCR2RAL +#define POCR2RA_7_REG POCR2RAL + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 +#define AMP0ND_REG DIDR1 +#define AMP0PD_REG DIDR1 +#define ACMP0D_REG DIDR1 +#define AMP2PD_REG DIDR1 + +/* POCR2RAH */ +#define POCR2RA_8_REG POCR2RAH +#define POCR2RA_9_REG POCR2RAH +#define POCR2RA_00_REG POCR2RAH +#define POCR2RA_01_REG POCR2RAH + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* POCR1SAH */ +#define POCR1SA_8_REG POCR1SAH +#define POCR1SA_9_REG POCR1SAH +#define POCR1SA_00_REG POCR1SAH +#define POCR1SA_01_REG POCR1SAH + +/* POCR1SAL */ +#define POCR1SA_0_REG POCR1SAL +#define POCR1SA_1_REG POCR1SAL +#define POCR1SA_2_REG POCR1SAL +#define POCR1SA_3_REG POCR1SAL +#define POCR1SA_4_REG POCR1SAL +#define POCR1SA_5_REG POCR1SAL +#define POCR1SA_6_REG POCR1SAL +#define POCR1SA_7_REG POCR1SAL + +/* CANIDM1 */ +#define IDMSK21_REG CANIDM1 +#define IDMSK22_REG CANIDM1 +#define IDMSK23_REG CANIDM1 +#define IDMSK24_REG CANIDM1 +#define IDMSK25_REG CANIDM1 +#define IDMSK26_REG CANIDM1 +#define IDMSK27_REG CANIDM1 +#define IDMSK28_REG CANIDM1 + +/* CANIDM3 */ +#define IDMSK5_REG CANIDM3 +#define IDMSK6_REG CANIDM3 +#define IDMSK7_REG CANIDM3 +#define IDMSK8_REG CANIDM3 +#define IDMSK9_REG CANIDM3 +#define IDMSK10_REG CANIDM3 +#define IDMSK11_REG CANIDM3 +#define IDMSK12_REG CANIDM3 + +/* CANIDM2 */ +#define IDMSK13_REG CANIDM2 +#define IDMSK14_REG CANIDM2 +#define IDMSK15_REG CANIDM2 +#define IDMSK16_REG CANIDM2 +#define IDMSK17_REG CANIDM2 +#define IDMSK18_REG CANIDM2 +#define IDMSK19_REG CANIDM2 +#define IDMSK20_REG CANIDM2 + +/* CANIDM4 */ +#define IDEMSK_REG CANIDM4 +#define RTRMSK_REG CANIDM4 +#define IDMSK0_REG CANIDM4 +#define IDMSK1_REG CANIDM4 +#define IDMSK2_REG CANIDM4 +#define IDMSK3_REG CANIDM4 +#define IDMSK4_REG CANIDM4 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* PMIC2 */ +#define PRFM20_REG PMIC2 +#define PRFM21_REG PMIC2 +#define PRFM22_REG PMIC2 +#define PAOC2_REG PMIC2 +#define PFLTE2_REG PMIC2 +#define PELEV2_REG PMIC2 +#define PISEL2_REG PMIC2 +#define POVEN2_REG PMIC2 + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* PMIC1 */ +#define PRFM10_REG PMIC1 +#define PRFM11_REG PMIC1 +#define PRFM12_REG PMIC1 +#define PAOC1_REG PMIC1 +#define PFLTE1_REG PMIC1 +#define PELEV1_REG PMIC1 +#define PISEL1_REG PMIC1 +#define POVEN1_REG PMIC1 + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* PCTL */ +#define PRUN_REG PCTL +#define PCCYC_REG PCTL +#define PCLKSEL_REG PCTL +#define PPRE0_REG PCTL +#define PPRE1_REG PCTL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* CANGIT */ +#define AERG_REG CANGIT +#define FERG_REG CANGIT +#define CERG_REG CANGIT +#define SERG_REG CANGIT +#define BXOK_REG CANGIT +#define OVRTIM_REG CANGIT +#define BOFFIT_REG CANGIT +#define CANIT_REG CANGIT + +/* AC3CON */ +#define AC3M0_REG AC3CON +#define AC3M1_REG AC3CON +#define AC3M2_REG AC3CON +#define AC3IS0_REG AC3CON +#define AC3IS1_REG AC3CON +#define AC3IE_REG AC3CON +#define AC3EN_REG AC3CON + +/* LINERR */ +#define LBERR_REG LINERR +#define LCERR_REG LINERR +#define LPERR_REG LINERR +#define LSERR_REG LINERR +#define LFERR_REG LINERR +#define LOVERR_REG LINERR +#define LTOERR_REG LINERR +#define LABORT_REG LINERR + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* CANGIE */ +#define ENOVRT_REG CANGIE +#define ENERG_REG CANGIE +#define ENBX_REG CANGIE +#define ENERR_REG CANGIE +#define ENTX_REG CANGIE +#define ENRX_REG CANGIE +#define ENBOFF_REG CANGIE +#define ENIT_REG CANGIE + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* CANIE2 */ +#define IEMOB0_REG CANIE2 +#define IEMOB1_REG CANIE2 +#define IEMOB2_REG CANIE2 +#define IEMOB3_REG CANIE2 +#define IEMOB4_REG CANIE2 +#define IEMOB5_REG CANIE2 + +/* POCR0RAL */ +#define POCR0RA_0_REG POCR0RAL +#define POCR0RA_1_REG POCR0RAL +#define POCR0RA_2_REG POCR0RAL +#define POCR0RA_3_REG POCR0RAL +#define POCR0RA_4_REG POCR0RAL +#define POCR0RA_5_REG POCR0RAL +#define POCR0RA_6_REG POCR0RAL +#define POCR0RA_7_REG POCR0RAL + +/* CANSIT2 */ +#define SIT0_REG CANSIT2 +#define SIT1_REG CANSIT2 +#define SIT2_REG CANSIT2 +#define SIT3_REG CANSIT2 +#define SIT4_REG CANSIT2 +#define SIT5_REG CANSIT2 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* POCR0RAH */ +#define POCR0RA_8_REG POCR0RAH +#define POCR0RA_9_REG POCR0RAH +#define POCR0RA_00_REG POCR0RAH +#define POCR0RA_01_REG POCR0RAH + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* POCR2SAH */ +#define POCR2SA_8_REG POCR2SAH +#define POCR2SA_9_REG POCR2SAH +#define POCR2SA_00_REG POCR2SAH +#define POCR2SA_01_REG POCR2SAH + +/* POCR2SAL */ +#define POCR2SA_0_REG POCR2SAL +#define POCR2SA_1_REG POCR2SAL +#define POCR2SA_2_REG POCR2SAL +#define POCR2SA_3_REG POCR2SAL +#define POCR2SA_4_REG POCR2SAL +#define POCR2SA_5_REG POCR2SAL +#define POCR2SA_6_REG POCR2SAL +#define POCR2SA_7_REG POCR2SAL + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* CANIDT4 */ +#define RB0TAG_REG CANIDT4 +#define RB1TAG_REG CANIDT4 +#define RTRTAG_REG CANIDT4 +#define IDT0_REG CANIDT4 +#define IDT1_REG CANIDT4 +#define IDT2_REG CANIDT4 +#define IDT3_REG CANIDT4 +#define IDT4_REG CANIDT4 + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* CANIDT2 */ +#define IDT13_REG CANIDT2 +#define IDT14_REG CANIDT2 +#define IDT15_REG CANIDT2 +#define IDT16_REG CANIDT2 +#define IDT17_REG CANIDT2 +#define IDT18_REG CANIDT2 +#define IDT19_REG CANIDT2 +#define IDT20_REG CANIDT2 + +/* CANIDT3 */ +#define IDT5_REG CANIDT3 +#define IDT6_REG CANIDT3 +#define IDT7_REG CANIDT3 +#define IDT8_REG CANIDT3 +#define IDT9_REG CANIDT3 +#define IDT10_REG CANIDT3 +#define IDT11_REG CANIDT3 +#define IDT12_REG CANIDT3 + +/* CANIDT1 */ +#define IDT21_REG CANIDT1 +#define IDT22_REG CANIDT1 +#define IDT23_REG CANIDT1 +#define IDT24_REG CANIDT1 +#define IDT25_REG CANIDT1 +#define IDT26_REG CANIDT1 +#define IDT27_REG CANIDT1 +#define IDT28_REG CANIDT1 + +/* PSYNC */ +#define PSYNC00_REG PSYNC +#define PSYNC01_REG PSYNC +#define PSYNC10_REG PSYNC +#define PSYNC11_REG PSYNC +#define PSYNC20_REG PSYNC +#define PSYNC21_REG PSYNC + +/* GTCCR */ +#define PSR10_REG GTCCR +#define ICPSEL1_REG GTCCR +#define TSM_REG GTCCR +#define PSRSYNC_REG GTCCR + +/* CANCDMOB */ +#define DLC0_REG CANCDMOB +#define DLC1_REG CANCDMOB +#define DLC2_REG CANCDMOB +#define DLC3_REG CANCDMOB +#define IDE_REG CANCDMOB +#define RPLV_REG CANCDMOB +#define CONMOB0_REG CANCDMOB +#define CONMOB1_REG CANCDMOB + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CANHPMOB */ +#define CGP0_REG CANHPMOB +#define CGP1_REG CANHPMOB +#define CGP2_REG CANHPMOB +#define CGP3_REG CANHPMOB +#define HPMOB0_REG CANHPMOB +#define HPMOB1_REG CANHPMOB +#define HPMOB2_REG CANHPMOB +#define HPMOB3_REG CANHPMOB + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* POCR1SBL */ +#define POCR1SB_0_REG POCR1SBL +#define POCR1SB_1_REG POCR1SBL +#define POCR1SB_2_REG POCR1SBL +#define POCR1SB_3_REG POCR1SBL +#define POCR1SB_4_REG POCR1SBL +#define POCR1SB_5_REG POCR1SBL +#define POCR1SB_6_REG POCR1SBL +#define POCR1SB_7_REG POCR1SBL + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLF_REG PLLCSR + +/* POCR1SBH */ +#define POCR1SB_8_REG POCR1SBH +#define POCR1SB_9_REG POCR1SBH +#define POCR1SB_00_REG POCR1SBH +#define POCR1SB_01_REG POCR1SBH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* AMP2CSR */ +#define AMP2TS0_REG AMP2CSR +#define AMP2TS1_REG AMP2CSR +#define AMP2TS2_REG AMP2CSR +#define AMPCMP2_REG AMP2CSR +#define AMP2G0_REG AMP2CSR +#define AMP2G1_REG AMP2CSR +#define AMP2IS_REG AMP2CSR +#define AMP2EN_REG AMP2CSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* LINDAT */ +#define LDATA0_REG LINDAT +#define LDATA1_REG LINDAT +#define LDATA2_REG LINDAT +#define LDATA3_REG LINDAT +#define LDATA4_REG LINDAT +#define LDATA5_REG LINDAT +#define LDATA6_REG LINDAT +#define LDATA7_REG LINDAT + +/* POCR0SAH */ +#define POCR0SA_8_REG POCR0SAH +#define POCR0SA_9_REG POCR0SAH +#define POCR0SA_00_REG POCR0SAH +#define POCR0SA_01_REG POCR0SAH + +/* POCR_RBL */ +#define POCR_RB_0_REG POCR_RBL +#define POCR_RB_1_REG POCR_RBL +#define POCR_RB_2_REG POCR_RBL +#define POCR_RB_3_REG POCR_RBL +#define POCR_RB_4_REG POCR_RBL +#define POCR_RB_5_REG POCR_RBL +#define POCR_RB_6_REG POCR_RBL +#define POCR_RB_7_REG POCR_RBL + +/* POCR0SAL */ +#define POCR0SA_0_REG POCR0SAL +#define POCR0SA_1_REG POCR0SAL +#define POCR0SA_2_REG POCR0SAL +#define POCR0SA_3_REG POCR0SAL +#define POCR0SA_4_REG POCR0SAL +#define POCR0SA_5_REG POCR0SAL +#define POCR0SA_6_REG POCR0SAL +#define POCR0SA_7_REG POCR0SAL + +/* POCR_RBH */ +#define POCR_RB_8_REG POCR_RBH +#define POCR_RB_9_REG POCR_RBH +#define POCR_RB_00_REG POCR_RBH +#define POCR_RB_01_REG POCR_RBH + +/* LINDLR */ +#define LRXDL0_REG LINDLR +#define LRXDL1_REG LINDLR +#define LRXDL2_REG LINDLR +#define LRXDL3_REG LINDLR +#define LTXDL0_REG LINDLR +#define LTXDL1_REG LINDLR +#define LTXDL2_REG LINDLR +#define LTXDL3_REG LINDLR + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define SPIPS_REG MCUCR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* CANSTMOB */ +#define AERR_REG CANSTMOB +#define FERR_REG CANSTMOB +#define CERR_REG CANSTMOB +#define SERR_REG CANSTMOB +#define BERR_REG CANSTMOB +#define RXOK_REG CANSTMOB +#define TXOK_REG CANSTMOB +#define DLCW_REG CANSTMOB + +/* PIFR */ +#define PEOP_REG PIFR +#define PEV0_REG PIFR +#define PEV1_REG PIFR +#define PEV2_REG PIFR + +/* LINSIR */ +#define LRXOK_REG LINSIR +#define LTXOK_REG LINSIR +#define LIDOK_REG LINSIR +#define LERR_REG LINSIR +#define LBUSY_REG LINSIR +#define LIDST0_REG LINSIR +#define LIDST1_REG LINSIR +#define LIDST2_REG LINSIR + +/* DACH */ +#define DACH0_REG DACH +#define DACH1_REG DACH +#define DACH2_REG DACH +#define DACH3_REG DACH +#define DACH4_REG DACH +#define DACH5_REG DACH +#define DACH6_REG DACH +#define DACH7_REG DACH + +/* DACL */ +#define DACL0_REG DACL +#define DACL1_REG DACL +#define DACL2_REG DACL +#define DACL3_REG DACL +#define DACL4_REG DACL +#define DACL5_REG DACL +#define DACL6_REG DACL +#define DACL7_REG DACL + +/* CANEN2 */ +#define ENMOB0_REG CANEN2 +#define ENMOB1_REG CANEN2 +#define ENMOB2_REG CANEN2 +#define ENMOB3_REG CANEN2 +#define ENMOB4_REG CANEN2 +#define ENMOB5_REG CANEN2 + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define AREFEN_REG ADCSRB +#define ISRCEN_REG ADCSRB +#define ADHSM_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* POCR0SBL */ +#define POCR0SB_0_REG POCR0SBL +#define POCR0SB_1_REG POCR0SBL +#define POCR0SB_2_REG POCR0SBL +#define POCR0SB_3_REG POCR0SBL +#define POCR0SB_4_REG POCR0SBL +#define POCR0SB_5_REG POCR0SBL +#define POCR0SB_6_REG POCR0SBL +#define POCR0SB_7_REG POCR0SBL + +/* ACSR */ +#define AC0O_REG ACSR +#define AC1O_REG ACSR +#define AC2O_REG ACSR +#define AC3O_REG ACSR +#define AC0IF_REG ACSR +#define AC1IF_REG ACSR +#define AC2IF_REG ACSR +#define AC3IF_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PMIC0 */ +#define PRFM00_REG PMIC0 +#define PRFM01_REG PMIC0 +#define PRFM02_REG PMIC0 +#define PAOC0_REG PMIC0 +#define PFLTE0_REG PMIC0 +#define PELEV0_REG PMIC0 +#define PISEL0_REG PMIC0 +#define POVEN0_REG PMIC0 + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* POC */ +#define POEN0A_REG POC +#define POEN0B_REG POC +#define POEN1A_REG POC +#define POEN1B_REG POC +#define POEN2A_REG POC +#define POEN2B_REG POC + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PCNF */ +#define POPA_REG PCNF +#define POPB_REG PCNF +#define PMODE_REG PCNF +#define PULOCK_REG PCNF + +/* CANBT2 */ +#define PRS0_REG CANBT2 +#define PRS1_REG CANBT2 +#define PRS2_REG CANBT2 +#define SJW0_REG CANBT2 +#define SJW1_REG CANBT2 + +/* CANBT3 */ +#define SMP_REG CANBT3 +#define PHS10_REG CANBT3 +#define PHS11_REG CANBT3 +#define PHS12_REG CANBT3 +#define PHS20_REG CANBT3 +#define PHS21_REG CANBT3 +#define PHS22_REG CANBT3 + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* CANBT1 */ +#define BRP0_REG CANBT1 +#define BRP1_REG CANBT1 +#define BRP2_REG CANBT1 +#define BRP3_REG CANBT1 +#define BRP4_REG CANBT1 +#define BRP5_REG CANBT1 + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* AMP0CSR */ +#define AMP0TS0_REG AMP0CSR +#define AMP0TS1_REG AMP0CSR +#define AMP0TS2_REG AMP0CSR +#define AMPCMP0_REG AMP0CSR +#define AMP0G0_REG AMP0CSR +#define AMP0G1_REG AMP0CSR +#define AMP0IS_REG AMP0CSR +#define AMP0EN_REG AMP0CSR + +/* DACON */ +#define DAEN_REG DACON +#define DALA_REG DACON +#define DATS0_REG DACON +#define DATS1_REG DACON +#define DATS2_REG DACON +#define DAATE_REG DACON + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* AC0CON */ +#define AC0M0_REG AC0CON +#define AC0M1_REG AC0CON +#define AC0M2_REG AC0CON +#define ACCKSEL_REG AC0CON +#define AC0IS0_REG AC0CON +#define AC0IS1_REG AC0CON +#define AC0IE_REG AC0CON +#define AC0EN_REG AC0CON + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* POCR0SBH */ +#define POCR0SB_8_REG POCR0SBH +#define POCR0SB_9_REG POCR0SBH +#define POCR0SB_00_REG POCR0SBH +#define POCR0SB_01_REG POCR0SBH + +/* pins mapping */ +#define MISO_PORT PORTB +#define MISO_BIT 0 +#define PSCOUT2A_PORT PORTB +#define PSCOUT2A_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MOSI_PORT PORTB +#define MOSI_BIT 1 +#define PSCOUT2B_PORT PORTB +#define PSCOUT2B_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define ADC5_PORT PORTB +#define ADC5_BIT 2 +#define INT1_PORT PORTB +#define INT1_BIT 2 +#define ACMPN0_PORT PORTB +#define ACMPN0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define AMP0-_PORT PORTB +#define AMP0-_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define AMP0+_PORT PORTB +#define AMP0+_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define ADC6_PORT PORTB +#define ADC6_BIT 5 +#define INT2_PORT PORTB +#define INT2_BIT 5 +#define ACMPN1_PORT PORTB +#define ACMPN1_BIT 5 +#define AMP2-_PORT PORTB +#define AMP2-_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define ADC7_PORT PORTB +#define ADC7_BIT 6 +#define PSCOUT1B_PORT PORTB +#define PSCOUT1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define ADC4_PORT PORTB +#define ADC4_BIT 7 +#define PSCOUT0B_PORT PORTB +#define PSCOUT0B_BIT 7 +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define INT3_PORT PORTC +#define INT3_BIT 0 +#define PSCOUT1A_PORT PORTC +#define PSCOUT1A_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define PSCIN1_PORT PORTC +#define PSCIN1_BIT 1 +#define OC1B_PORT PORTC +#define OC1B_BIT 1 +#define SS_A_PORT PORTC +#define SS_A_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define T0_PORT PORTC +#define T0_BIT 2 +#define TXCAN_PORT PORTC +#define TXCAN_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define T1_PORT PORTC +#define T1_BIT 3 +#define RXCAN_PORT PORTC +#define RXCAN_BIT 3 +#define ICP1B_PORT PORTC +#define ICP1B_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC8_PORT PORTC +#define ADC8_BIT 4 +#define AMP1-_PORT PORTC +#define AMP1-_BIT 4 +#define ACMPN3_PORT PORTC +#define ACMPN3_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC9_PORT PORTC +#define ADC9_BIT 5 +#define AMP1+_PORT PORTC +#define AMP1+_BIT 5 +#define ACMP3_PORT PORTC +#define ACMP3_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define ADC10_PORT PORTC +#define ADC10_BIT 6 +#define ACMP1_PORT PORTC +#define ACMP1_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define D2A_PORT PORTC +#define D2A_BIT 7 +#define AMP2+_PORT PORTC +#define AMP2+_BIT 7 +#define PCINT15_PORT PORTC +#define PCINT15_BIT 7 + +#define PSCOUT0A_PORT PORTD +#define PSCOUT0A_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define PSCIN0_PORT PORTD +#define PSCIN0_BIT 1 +#define CLK0_PORT PORTD +#define CLK0_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define PSCIN2_PORT PORTD +#define PSCIN2_BIT 2 +#define OC1A_PORT PORTD +#define OC1A_BIT 2 +#define MISO_A_PORT PORTD +#define MISO_A_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define TXD_PORT PORTD +#define TXD_BIT 3 +#define TXLIN_PORT PORTD +#define TXLIN_BIT 3 +#define OC0A_PORT PORTD +#define OC0A_BIT 3 +#define SS_PORT PORTD +#define SS_BIT 3 +#define MOSI_A_PORT PORTD +#define MOSI_A_BIT 3 +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 + +#define ADC1_PORT PORTD +#define ADC1_BIT 4 +#define RXD_PORT PORTD +#define RXD_BIT 4 +#define RXLIN_PORT PORTD +#define RXLIN_BIT 4 +#define ICP1A_PORT PORTD +#define ICP1A_BIT 4 +#define SCK_A_PORT PORTD +#define SCK_A_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define ADC2_PORT PORTD +#define ADC2_BIT 5 +#define ACMP2_PORT PORTD +#define ACMP2_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define ADC3_PORT PORTD +#define ADC3_BIT 6 +#define ACMPN2_PORT PORTD +#define ACMPN2_BIT 6 +#define INT0_PORT PORTD +#define INT0_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define ACMP0_PORT PORTD +#define ACMP0_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + +#define RESET_PORT PORTE +#define RESET_BIT 0 +#define OCD_PORT PORTE +#define OCD_BIT 0 +#define PCINT24_PORT PORTE +#define PCINT24_BIT 0 + +#define OC0B_PORT PORTE +#define OC0B_BIT 1 +#define XTAL1_PORT PORTE +#define XTAL1_BIT 1 +#define PCINT25_PORT PORTE +#define PCINT25_BIT 1 + +#define ADC0_PORT PORTE +#define ADC0_BIT 2 +#define XTAL2_PORT PORTE +#define XTAL2_BIT 2 +#define PCINT26_PORT PORTE +#define PCINT26_BIT 2 + + diff --git a/aversive/parts/ATmega32U4.h b/aversive/parts/ATmega32U4.h new file mode 100644 index 0000000..37b04dc --- /dev/null +++ b/aversive/parts/ATmega32U4.h @@ -0,0 +1,1317 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ + + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW3_NUM 2 +#define SIG_OVERFLOW4_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE4_NUM 8 +#define SIG_OUTPUT_COMPARE4A_NUM 9 +#define SIG_OUTPUT_COMPARE4B_NUM 10 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 11 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM4_NUM 8 +#define PWM4A_NUM 9 +#define PWM4B_NUM 10 +#define PWM_TOTAL_NUM 11 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE2_REG PORTE +#define PORTE6_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define DAT0_REG UEDATX +#define DAT1_REG UEDATX +#define DAT2_REG UEDATX +#define DAT3_REG UEDATX +#define DAT4_REG UEDATX +#define DAT5_REG UEDATX +#define DAT6_REG UEDATX +#define DAT7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* CLKSEL1 */ +#define EXCKSEL0_REG CLKSEL1 +#define EXCKSEL1_REG CLKSEL1 +#define EXCKSEL2_REG CLKSEL1 +#define EXCKSEL3_REG CLKSEL1 +#define RCCKSEL0_REG CLKSEL1 +#define RCCKSEL1_REG CLKSEL1 +#define RCCKSEL2_REG CLKSEL1 +#define RCCKSEL3_REG CLKSEL1 + +/* CLKSEL0 */ +#define CLKS_REG CLKSEL0 +#define EXTE_REG CLKSEL0 +#define RCE_REG CLKSEL0 +#define EXSUT0_REG CLKSEL0 +#define EXSUT1_REG CLKSEL0 +#define RCSUT0_REG CLKSEL0 +#define RCSUT1_REG CLKSEL0 + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* OCR4A */ +#define OCR4A0_REG OCR4A +#define OCR4A1_REG OCR4A +#define OCR4A2_REG OCR4A +#define OCR4A3_REG OCR4A +#define OCR4A4_REG OCR4A +#define OCR4A5_REG OCR4A +#define OCR4A6_REG OCR4A +#define OCR4A7_REG OCR4A + +/* OCR4C */ +#define OCR4C0_REG OCR4C +#define OCR4C1_REG OCR4C +#define OCR4C2_REG OCR4C +#define OCR4C3_REG OCR4C +#define OCR4C4_REG OCR4C +#define OCR4C5_REG OCR4C +#define OCR4C6_REG OCR4C +#define OCR4C7_REG OCR4C + +/* OCR4B */ +#define OCR4B0_REG OCR4B +#define OCR4B1_REG OCR4B +#define OCR4B2_REG OCR4B +#define OCR4B3_REG OCR4B +#define OCR4B4_REG OCR4B +#define OCR4B5_REG OCR4B +#define OCR4B6_REG OCR4B +#define OCR4B7_REG OCR4B + +/* OCR4D */ +#define OCR4D0_REG OCR4D +#define OCR4D1_REG OCR4D +#define OCR4D2_REG OCR4D +#define OCR4D3_REG OCR4D +#define OCR4D4_REG OCR4D +#define OCR4D5_REG OCR4D +#define OCR4D6_REG OCR4D +#define OCR4D7_REG OCR4D + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* RCCTRL */ +#define RCFREQ_REG RCCTRL + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON +#define RSTCPU_REG UDCON + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT4 */ +#define TC40_REG TCNT4 +#define TC41_REG TCNT4 +#define TC42_REG TCNT4 +#define TC43_REG TCNT4 +#define TC44_REG TCNT4 +#define TC45_REG TCNT4 +#define TC46_REG TCNT4 +#define TC47_REG TCNT4 + +/* TC4H */ +#define TC48_REG TC4H +#define TC49_REG TC4H +#define TC410_REG TC4H + +/* UHWCON */ +#define UVREGE_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4D_REG TIFR4 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* UEBCLX */ +#define BYCT0_REG UEBCLX +#define BYCT1_REG UEBCLX +#define BYCT2_REG UEBCLX +#define BYCT3_REG UEBCLX +#define BYCT4_REG UEBCLX +#define BYCT5_REG UEBCLX +#define BYCT6_REG UEBCLX +#define BYCT7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define VBUSTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* PLLFRQ */ +#define PDIV0_REG PLLFRQ +#define PDIV1_REG PLLFRQ +#define PDIV2_REG PLLFRQ +#define PDIV3_REG PLLFRQ +#define PLLTM0_REG PLLFRQ +#define PLLTM1_REG PLLFRQ +#define PLLUSB_REG PLLFRQ +#define PINMUX_REG PLLFRQ + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* USBSTA */ +#define VBUS_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* UDFNUML */ +#define FNUM0_REG UDFNUML +#define FNUM1_REG UDFNUML +#define FNUM2_REG UDFNUML +#define FNUM3_REG UDFNUML +#define FNUM4_REG UDFNUML +#define FNUM5_REG UDFNUML +#define FNUM6_REG UDFNUML +#define FNUM7_REG UDFNUML + +/* UDFNUMH */ +#define FNUM8_REG UDFNUMH +#define FNUM9_REG UDFNUMH +#define FNUM10_REG UDFNUMH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADTS3_REG ADCSRB +#define MUX5_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE2_REG DDRE +#define DDE6_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* CLKSTA */ +#define EXTON_REG CLKSTA +#define RCON_REG CLKSTA + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4D_REG TIMSK4 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define CS43_REG TCCR4B +#define DTPS40_REG TCCR4B +#define DTPS41_REG TCCR4B +#define PSR4_REG TCCR4B +#define PWM4X_REG TCCR4B + +/* TCCR4C */ +#define PWM4D_REG TCCR4C +#define FOC4D_REG TCCR4C +#define COM4D0_REG TCCR4C +#define COM4D1_REG TCCR4C +#define COM4B0S_REG TCCR4C +#define COM4B1S_REG TCCR4C +#define COM4A0S_REG TCCR4C +#define COM4A1S_REG TCCR4C + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PINDIV_REG PLLCSR + +/* TCCR4A */ +#define PWM4B_REG TCCR4A +#define PWM4A_REG TCCR4A +#define FOC4B_REG TCCR4A +#define FOC4A_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* TCCR4D */ +#define WGM40_REG TCCR4D +#define WGM41_REG TCCR4D +#define FPF4_REG TCCR4D +#define FPAC4_REG TCCR4D +#define FPES4_REG TCCR4D +#define FPNC4_REG TCCR4D +#define FPEN4_REG TCCR4D +#define FPIE4_REG TCCR4D + +/* TCCR4E */ +#define OC4OE0_REG TCCR4E +#define OC4OE1_REG TCCR4E +#define OC4OE2_REG TCCR4E +#define OC4OE3_REG TCCR4E +#define OC4OE4_REG TCCR4E +#define OC4OE5_REG TCCR4E +#define ENHC4_REG TCCR4E +#define TLOCK4_REG TCCR4E + +/* PINC */ +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE2_REG PINE +#define PINE6_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* DT4 */ +#define DT4L0_REG DT4 +#define DT4L1_REG DT4 +#define DT4L2_REG DT4 +#define DT4L3_REG DT4 +#define DT4L4_REG DT4 +#define DT4L5_REG DT4 +#define DT4L6_REG DT4 +#define DT4L7_REG DT4 + +/* pins mapping */ + diff --git a/aversive/parts/ATmega32U6.h b/aversive/parts/ATmega32U6.h new file mode 100644 index 0000000..57c0bd1 --- /dev/null +++ b/aversive/parts/ATmega32U6.h @@ -0,0 +1,1375 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 10 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM_TOTAL_NUM 10 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* UEBCHX */ +#define UEBCHX_0_REG UEBCHX +#define UEBCHX_1_REG UEBCHX +#define UEBCHX_2_REG UEBCHX + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UDIEN */ +#define SUSPE_REG UDIEN +#define SOFE_REG UDIEN +#define EORSTE_REG UDIEN +#define WAKEUPE_REG UDIEN +#define EORSME_REG UDIEN +#define UPRSME_REG UDIEN + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* UDINT */ +#define SUSPI_REG UDINT +#define SOFI_REG UDINT +#define EORSTI_REG UDINT +#define WAKEUPI_REG UDINT +#define EORSMI_REG UDINT +#define UPRSMI_REG UDINT + +/* UERST */ +#define EPRST0_REG UERST +#define EPRST1_REG UERST +#define EPRST2_REG UERST +#define EPRST3_REG UERST +#define EPRST4_REG UERST +#define EPRST5_REG UERST +#define EPRST6_REG UERST + +/* UECFG1X */ +#define ALLOC_REG UECFG1X +#define EPBK0_REG UECFG1X +#define EPBK1_REG UECFG1X +#define EPSIZE0_REG UECFG1X +#define EPSIZE1_REG UECFG1X +#define EPSIZE2_REG UECFG1X + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UEINT */ +#define EPINT0_REG UEINT +#define EPINT1_REG UEINT +#define EPINT2_REG UEINT +#define EPINT3_REG UEINT +#define EPINT4_REG UEINT +#define EPINT5_REG UEINT +#define EPINT6_REG UEINT + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* UEDATX */ +#define UEDATX_0_REG UEDATX +#define UEDATX_1_REG UEDATX +#define UEDATX_2_REG UEDATX +#define UEDATX_3_REG UEDATX +#define UEDATX_4_REG UEDATX +#define UEDATX_5_REG UEDATX +#define UEDATX_6_REG UEDATX +#define UEDATX_7_REG UEDATX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* UECFG0X */ +#define EPDIR_REG UECFG0X +#define EPTYPE0_REG UECFG0X +#define EPTYPE1_REG UECFG0X + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UENUM */ +#define UENUM_0_REG UENUM +#define UENUM_1_REG UENUM +#define UENUM_2_REG UENUM + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* UDCON */ +#define DETACH_REG UDCON +#define RMWKUP_REG UDCON +#define LSM_REG UDCON + +/* PCICR */ +#define PCIE0_REG PCICR + +/* USBINT */ +#define VBUSTI_REG USBINT +#define IDTI_REG USBINT + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* UHWCON */ +#define UVREGE_REG UHWCON +#define UVCONE_REG UHWCON +#define UIDE_REG UHWCON +#define UIMOD_REG UHWCON + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* UDMFN */ +#define FNCERR_REG UDMFN + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* UEBCLX */ +#define UEBCLX_0_REG UEBCLX +#define UEBCLX_1_REG UEBCLX +#define UEBCLX_2_REG UEBCLX +#define UEBCLX_3_REG UEBCLX +#define UEBCLX_4_REG UEBCLX +#define UEBCLX_5_REG UEBCLX +#define UEBCLX_6_REG UEBCLX +#define UEBCLX_7_REG UEBCLX + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* UESTA1X */ +#define CURRBK0_REG UESTA1X +#define CURRBK1_REG UESTA1X +#define CTRLDIR_REG UESTA1X + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* UEINTX */ +#define TXINI_REG UEINTX +#define STALLEDI_REG UEINTX +#define RXOUTI_REG UEINTX +#define RXSTPI_REG UEINTX +#define NAKOUTI_REG UEINTX +#define RWAL_REG UEINTX +#define NAKINI_REG UEINTX +#define FIFOCON_REG UEINTX + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USBCON */ +#define VBUSTE_REG USBCON +#define IDTE_REG USBCON +#define OTGPADE_REG USBCON +#define FRZCLK_REG USBCON +#define HOST_REG USBCON +#define USBE_REG USBCON + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UECONX */ +#define EPEN_REG UECONX +#define RSTDT_REG UECONX +#define STALLRQC_REG UECONX +#define STALLRQ_REG UECONX + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USBSTA */ +#define VBUS_REG USBSTA +#define ID_REG USBSTA +#define SPEED_REG USBSTA + +/* UEIENX */ +#define TXINE_REG UEIENX +#define STALLEDE_REG UEIENX +#define RXOUTE_REG UEIENX +#define RXSTPE_REG UEIENX +#define NAKOUTE_REG UEIENX +#define NAKINE_REG UEIENX +#define FLERRE_REG UEIENX + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* UDFNUML */ +#define UDFNUML_0_REG UDFNUML +#define UDFNUML_1_REG UDFNUML +#define UDFNUML_2_REG UDFNUML +#define UDFNUML_3_REG UDFNUML +#define UDFNUML_4_REG UDFNUML +#define UDFNUML_5_REG UDFNUML +#define UDFNUML_6_REG UDFNUML +#define UDFNUML_7_REG UDFNUML + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* UDFNUMH */ +#define UDFNUMH_0_REG UDFNUMH +#define UDFNUMH_1_REG UDFNUMH +#define UDFNUMH_2_REG UDFNUMH + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADHSM_REG ADCSRB +#define ACME_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* UDADDR */ +#define UADD0_REG UDADDR +#define UADD1_REG UDADDR +#define UADD2_REG UDADDR +#define UADD3_REG UDADDR +#define UADD4_REG UDADDR +#define UADD5_REG UDADDR +#define UADD6_REG UDADDR +#define ADDEN_REG UDADDR + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* UESTA0X */ +#define NBUSYBK0_REG UESTA0X +#define NBUSYBK1_REG UESTA0X +#define DTSEQ0_REG UESTA0X +#define DTSEQ1_REG UESTA0X +#define UNDERFI_REG UESTA0X +#define OVERFI_REG UESTA0X +#define CFGOK_REG UESTA0X + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PLLP0_REG PLLCSR +#define PLLP1_REG PLLCSR +#define PLLP2_REG PLLCSR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRUSB_REG PRR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATmega406.h b/aversive/parts/ATmega406.h new file mode 100644 index 0000000..e4a8e1b --- /dev/null +++ b/aversive/parts/ATmega406.h @@ -0,0 +1,850 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_32 3 +#define TIMER1_PRESCALER_DIV_64 4 +#define TIMER1_PRESCALER_DIV_128 5 +#define TIMER1_PRESCALER_DIV_256 6 +#define TIMER1_PRESCALER_DIV_1024 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 32 +#define TIMER1_PRESCALER_REG_4 64 +#define TIMER1_PRESCALER_REG_5 128 +#define TIMER1_PRESCALER_REG_6 256 +#define TIMER1_PRESCALER_REG_7 1024 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CADAC2 */ +#define CADAC16_REG CADAC2 +#define CADAC17_REG CADAC2 +#define CADAC18_REG CADAC2 +#define CADAC19_REG CADAC2 +#define CADAC20_REG CADAC2 +#define CADAC21_REG CADAC2 +#define CADAC22_REG CADAC2 +#define CADAC23_REG CADAC2 + +/* CADAC3 */ +#define CADAC24_REG CADAC3 +#define CADAC25_REG CADAC3 +#define CADAC26_REG CADAC3 +#define CADAC27_REG CADAC3 +#define CADAC28_REG CADAC3 +#define CADAC29_REG CADAC3 +#define CADAC30_REG CADAC3 +#define CADAC31_REG CADAC3 + +/* CADAC0 */ +#define CADAC00_REG CADAC0 +#define CADAC01_REG CADAC0 +#define CADAC02_REG CADAC0 +#define CADAC03_REG CADAC0 +#define CADAC04_REG CADAC0 +#define CADAC05_REG CADAC0 +#define CADAC06_REG CADAC0 +#define CADAC07_REG CADAC0 + +/* CADAC1 */ +#define CADAC08_REG CADAC1 +#define CADAC09_REG CADAC1 +#define CADAC10_REG CADAC1 +#define CADAC11_REG CADAC1 +#define CADAC12_REG CADAC1 +#define CADAC13_REG CADAC1 +#define CADAC14_REG CADAC1 +#define CADAC15_REG CADAC1 + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR + +/* WUTCSR */ +#define WUTP0_REG WUTCSR +#define WUTP1_REG WUTCSR +#define WUTP2_REG WUTCSR +#define WUTE_REG WUTCSR +#define WUTR_REG WUTCSR +#define WUTCF_REG WUTCSR +#define WUTIE_REG WUTCSR +#define WUTIF_REG WUTCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* BPCR */ +#define CCD_REG BPCR +#define DCD_REG BPCR +#define SCD_REG BPCR +#define DUVD_REG BPCR + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* BGCRR */ +#define BGCR0_REG BGCRR +#define BGCR1_REG BGCRR +#define BGCR2_REG BGCRR +#define BGCR3_REG BGCRR +#define BGCR4_REG BGCRR +#define BGCR5_REG BGCRR +#define BGCR6_REG BGCRR +#define BGCR7_REG BGCRR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK + +/* PRR0 */ +#define PRVADC_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTWI_REG PRR0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* BPOCD */ +#define CCDL0_REG BPOCD +#define CCDL1_REG BPOCD +#define CCDL2_REG BPOCD +#define CCDL3_REG BPOCD +#define DCDL0_REG BPOCD +#define DCDL1_REG BPOCD +#define DCDL2_REG BPOCD +#define DCDL3_REG BPOCD + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD + +/* OCR0B */ +#define OCR0B0_REG OCR0B +#define OCR0B1_REG OCR0B +#define OCR0B2_REG OCR0B +#define OCR0B3_REG OCR0B +#define OCR0B4_REG OCR0B +#define OCR0B5_REG OCR0B +#define OCR0B6_REG OCR0B +#define OCR0B7_REG OCR0B + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* CCSR */ +#define ACS_REG CCSR +#define XOE_REG CCSR + +/* CADICH */ +#define CADICH0_REG CADICH +#define CADICH1_REG CADICH +#define CADICH2_REG CADICH +#define CADICH3_REG CADICH +#define CADICH4_REG CADICH +#define CADICH5_REG CADICH +#define CADICH6_REG CADICH +#define CADICH7_REG CADICH + +/* FCSR */ +#define PFD_REG FCSR +#define CFE_REG FCSR +#define DFE_REG FCSR +#define CPS_REG FCSR +#define PWMOPC_REG FCSR +#define PWMOC_REG FCSR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* CADCSRB */ +#define CADICIF_REG CADCSRB +#define CADRCIF_REG CADCSRB +#define CADACIF_REG CADCSRB +#define CADICIE_REG CADCSRB +#define CADRCIE_REG CADCSRB +#define CADACIE_REG CADCSRB + +/* CADICL */ +#define CADICL0_REG CADICL +#define CADICL1_REG CADICL +#define CADICL2_REG CADICL +#define CADICL3_REG CADICL +#define CADICL4_REG CADICL +#define CADICL5_REG CADICL +#define CADICL6_REG CADICL +#define CADICL7_REG CADICL + +/* BPIR */ +#define SCIE_REG BPIR +#define DOCIE_REG BPIR +#define COCIE_REG BPIR +#define DUVIE_REG BPIR +#define SCIF_REG BPIR +#define DOCIF_REG BPIR +#define COCIF_REG BPIR +#define DUVIF_REG BPIR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* BPPLR */ +#define BPPL_REG BPPLR +#define BPPLE_REG BPPLR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CTC1_REG TCCR1B + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BODRF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* CBPTR */ +#define OCPT0_REG CBPTR +#define OCPT1_REG CBPTR +#define OCPT2_REG CBPTR +#define OCPT3_REG CBPTR +#define SCPT0_REG CBPTR +#define SCPT1_REG CBPTR +#define SCPT2_REG CBPTR +#define SCPT3_REG CBPTR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* CADCSRA */ +#define CADSE_REG CADCSRA +#define CADSI0_REG CADCSRA +#define CADSI1_REG CADCSRA +#define CADAS0_REG CADCSRA +#define CADAS1_REG CADCSRA +#define CADUB_REG CADCSRA +#define CADEN_REG CADCSRA + +/* BPDUV */ +#define DUDL0_REG BPDUV +#define DUDL1_REG BPDUV +#define DUDL2_REG BPDUV +#define DUDL3_REG BPDUV +#define DUVT0_REG BPDUV +#define DUVT1_REG BPDUV + +/* CADRDC */ +#define CADRDC0_REG CADRDC +#define CADRDC1_REG CADRDC +#define CADRDC2_REG CADRDC +#define CADRDC3_REG CADRDC +#define CADRDC4_REG CADRDC +#define CADRDC5_REG CADRDC +#define CADRDC6_REG CADRDC +#define CADRDC7_REG CADRDC + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* BPSCD */ +#define SCDL0_REG BPSCD +#define SCDL1_REG BPSCD +#define SCDL2_REG BPSCD +#define SCDL3_REG BPSCD + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* BGCCR */ +#define BGCC0_REG BGCCR +#define BGCC1_REG BGCCR +#define BGCC2_REG BGCCR +#define BGCC3_REG BGCCR +#define BGCC4_REG BGCCR +#define BGCC5_REG BGCCR +#define BGD_REG BGCCR + +/* VADMUX */ +#define VADMUX0_REG VADMUX +#define VADMUX1_REG VADMUX +#define VADMUX2_REG VADMUX +#define VADMUX3_REG VADMUX + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* VADCH */ +#define VADC8_REG VADCH +#define VADC9_REG VADCH +#define VADC10_REG VADCH +#define VADC11_REG VADCH + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* VADCL */ +#define VADC0_REG VADCL +#define VADC1_REG VADCL +#define VADC2_REG VADCL +#define VADC3_REG VADCL +#define VADC4_REG VADCL +#define VADC5_REG VADCL +#define VADC6_REG VADCL +#define VADC7_REG VADCL + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* VADCSR */ +#define VADCCIE_REG VADCSR +#define VADCCIF_REG VADCSR +#define VADSC_REG VADCSR +#define VADEN_REG VADCSR + +/* FOSCCAL */ +#define FCAL0_REG FOSCCAL +#define FCAL1_REG FOSCCAL +#define FCAL2_REG FOSCCAL +#define FCAL3_REG FOSCCAL +#define FCAL4_REG FOSCCAL +#define FCAL5_REG FOSCCAL +#define FCAL6_REG FOSCCAL +#define FCAL7_REG FOSCCAL + +/* DIDR0 */ +#define VADC0D_REG DIDR0 +#define VADC1D_REG DIDR0 +#define VADC2D_REG DIDR0 +#define VADC3D_REG DIDR0 + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* CBCR */ +#define CBE1_REG CBCR +#define CBE2_REG CBCR +#define CBE3_REG CBCR +#define CBE4_REG CBCR + +/* TWBCSR */ +#define TWBCIP_REG TWBCSR +#define TWBDT0_REG TWBCSR +#define TWBDT1_REG TWBCSR +#define TWBCIE_REG TWBCSR +#define TWBCIF_REG TWBCSR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* CADRCC */ +#define CADRCC0_REG CADRCC +#define CADRCC1_REG CADRCC +#define CADRCC2_REG CADRCC +#define CADRCC3_REG CADRCC +#define CADRCC4_REG CADRCC +#define CADRCC5_REG CADRCC +#define CADRCC6_REG CADRCC +#define CADRCC7_REG CADRCC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define INT0_PORT PORTA +#define INT0_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define INT1_PORT PORTA +#define INT1_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define INT2_PORT PORTA +#define INT2_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define INT3_PORT PORTA +#define INT3_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define TDO_PORT PORTB +#define TDO_BIT 0 +#define PCINT8_PORT PORTB +#define PCINT8_BIT 0 + +#define TDI_PORT PORTB +#define TDI_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define TMS_PORT PORTB +#define TMS_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define TCK_PORT PORTB +#define TCK_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define OC0A_PORT PORTB +#define OC0A_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define OC0B_PORT PORTB +#define OC0B_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + + +#define T0_PORT PORTD +#define T0_BIT 0 + + + + + + + diff --git a/aversive/parts/ATmega48.h b/aversive/parts/ATmega48.h new file mode 100644 index 0000000..77e16ba --- /dev/null +++ b/aversive/parts/ATmega48.h @@ -0,0 +1,989 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define PUD_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega48P.h b/aversive/parts/ATmega48P.h new file mode 100644 index 0000000..67c3167 --- /dev/null +++ b/aversive/parts/ATmega48P.h @@ -0,0 +1,991 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega64.h b/aversive/parts/ATmega64.h new file mode 100644 index 0000000..4a622c2 --- /dev/null +++ b/aversive/parts/ATmega64.h @@ -0,0 +1,1328 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR321_REG SFIOR +#define PSR0_REG SFIOR +#define PUD_REG SFIOR +#define TSM_REG SFIOR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* ETIFR */ +#define OCF1C_REG ETIFR +#define OCF3C_REG ETIFR +#define TOV3_REG ETIFR +#define OCF3B_REG ETIFR +#define OCF3A_REG ETIFR +#define ICF3_REG ETIFR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* ETIMSK */ +#define OCIE1C_REG ETIMSK +#define OCIE3C_REG ETIMSK +#define TOIE3_REG ETIMSK +#define OCIE3B_REG ETIMSK +#define OCIE3A_REG ETIMSK +#define TICIE3_REG ETIMSK + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCN3L0_REG TCNT3L +#define TCN3L1_REG TCNT3L +#define TCN3L2_REG TCNT3L +#define TCN3L3_REG TCNT3L +#define TCN3L4_REG TCNT3L +#define TCN3L5_REG TCNT3L +#define TCN3L6_REG TCNT3L +#define TCN3L7_REG TCNT3L + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define SM2_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW11_REG XMCRA +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/ATmega640.h b/aversive/parts/ATmega640.h new file mode 100644 index 0000000..b3838b0 --- /dev/null +++ b/aversive/parts/ATmega640.h @@ -0,0 +1,2188 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + +/* prescalers timer 4 */ +#define TIMER4_PRESCALER_DIV_0 0 +#define TIMER4_PRESCALER_DIV_1 1 +#define TIMER4_PRESCALER_DIV_8 2 +#define TIMER4_PRESCALER_DIV_64 3 +#define TIMER4_PRESCALER_DIV_256 4 +#define TIMER4_PRESCALER_DIV_1024 5 +#define TIMER4_PRESCALER_DIV_FALL 6 +#define TIMER4_PRESCALER_DIV_RISE 7 + +#define TIMER4_PRESCALER_REG_0 0 +#define TIMER4_PRESCALER_REG_1 1 +#define TIMER4_PRESCALER_REG_2 8 +#define TIMER4_PRESCALER_REG_3 64 +#define TIMER4_PRESCALER_REG_4 256 +#define TIMER4_PRESCALER_REG_5 1024 +#define TIMER4_PRESCALER_REG_6 -1 +#define TIMER4_PRESCALER_REG_7 -2 + +/* prescalers timer 5 */ +#define TIMER5_PRESCALER_DIV_0 0 +#define TIMER5_PRESCALER_DIV_1 1 +#define TIMER5_PRESCALER_DIV_8 2 +#define TIMER5_PRESCALER_DIV_64 3 +#define TIMER5_PRESCALER_DIV_256 4 +#define TIMER5_PRESCALER_DIV_1024 5 +#define TIMER5_PRESCALER_DIV_FALL 6 +#define TIMER5_PRESCALER_DIV_RISE 7 + +#define TIMER5_PRESCALER_REG_0 0 +#define TIMER5_PRESCALER_REG_1 1 +#define TIMER5_PRESCALER_REG_2 8 +#define TIMER5_PRESCALER_REG_3 64 +#define TIMER5_PRESCALER_REG_4 256 +#define TIMER5_PRESCALER_REG_5 1024 +#define TIMER5_PRESCALER_REG_6 -1 +#define TIMER5_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE +#define TIMER4_AVAILABLE +#define TIMER4A_AVAILABLE +#define TIMER4B_AVAILABLE +#define TIMER4C_AVAILABLE +#define TIMER5_AVAILABLE +#define TIMER5A_AVAILABLE +#define TIMER5B_AVAILABLE +#define TIMER5C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW4_NUM 4 +#define SIG_OVERFLOW5_NUM 5 +#define SIG_OVERFLOW_TOTAL_NUM 6 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE1C_NUM 4 +#define SIG_OUTPUT_COMPARE2A_NUM 5 +#define SIG_OUTPUT_COMPARE2B_NUM 6 +#define SIG_OUTPUT_COMPARE3A_NUM 7 +#define SIG_OUTPUT_COMPARE3B_NUM 8 +#define SIG_OUTPUT_COMPARE3C_NUM 9 +#define SIG_OUTPUT_COMPARE4A_NUM 10 +#define SIG_OUTPUT_COMPARE4B_NUM 11 +#define SIG_OUTPUT_COMPARE4C_NUM 12 +#define SIG_OUTPUT_COMPARE5A_NUM 13 +#define SIG_OUTPUT_COMPARE5B_NUM 14 +#define SIG_OUTPUT_COMPARE5C_NUM 15 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 16 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM1C_NUM 4 +#define PWM2A_NUM 5 +#define PWM2B_NUM 6 +#define PWM3A_NUM 7 +#define PWM3B_NUM 8 +#define PWM3C_NUM 9 +#define PWM4A_NUM 10 +#define PWM4B_NUM 11 +#define PWM4C_NUM 12 +#define PWM5A_NUM 13 +#define PWM5B_NUM 14 +#define PWM5C_NUM 15 +#define PWM_TOTAL_NUM 16 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE4_NUM 2 +#define SIG_INPUT_CAPTURE5_NUM 3 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 4 + + +/* UBRR3H */ +/* #define UBRR8_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR9_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR10_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ +/* #define UBRR11_REG UBRR3H */ /* dup in UBRR2H, UBRR0H */ + +/* UBRR3L */ +/* #define UBRR0_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR1_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR2_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR3_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR4_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR5_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR6_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ +/* #define UBRR7_REG UBRR3L */ /* dup in UBRR2L, UBRR0L */ + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* UCSR3A */ +#define MPCM3_REG UCSR3A +#define U2X3_REG UCSR3A +#define UPE3_REG UCSR3A +#define DOR3_REG UCSR3A +#define FE3_REG UCSR3A +#define UDRE3_REG UCSR3A +#define TXC3_REG UCSR3A +#define RXC3_REG UCSR3A + +/* UCSR3B */ +#define TXB83_REG UCSR3B +#define RXB83_REG UCSR3B +#define UCSZ32_REG UCSR3B +#define TXEN3_REG UCSR3B +#define RXEN3_REG UCSR3B +#define UDRIE3_REG UCSR3B +#define TXCIE3_REG UCSR3B +#define RXCIE3_REG UCSR3B + +/* UCSR3C */ +#define UCPOL3_REG UCSR3C +#define UCSZ30_REG UCSR3C +#define UCSZ31_REG UCSR3C +#define USBS3_REG UCSR3C +#define UPM30_REG UCSR3C +#define UPM31_REG UCSR3C +#define UMSEL30_REG UCSR3C +#define UMSEL31_REG UCSR3C + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ +#define RAMPZ1_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* PORTL */ +#define PORTL0_REG PORTL +#define PORTL1_REG PORTL +#define PORTL2_REG PORTL +#define PORTL3_REG PORTL +#define PORTL4_REG PORTL +#define PORTL5_REG PORTL +#define PORTL6_REG PORTL +#define PORTL7_REG PORTL + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ +#define PORTJ7_REG PORTJ + +/* PORTK */ +#define PORTK0_REG PORTK +#define PORTK1_REG PORTK +#define PORTK2_REG PORTK +#define PORTK3_REG PORTK +#define PORTK4_REG PORTK +#define PORTK5_REG PORTK +#define PORTK6_REG PORTK +#define PORTK7_REG PORTK + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG +#define PORTG5_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* UDR3 */ +#define UDR3_0_REG UDR3 +#define UDR3_1_REG UDR3 +#define UDR3_2_REG UDR3 +#define UDR3_3_REG UDR3 +#define UDR3_4_REG UDR3 +#define UDR3_5_REG UDR3 +#define UDR3_6_REG UDR3 +#define UDR3_7_REG UDR3 + +/* UDR2 */ +#define UDR2_0_REG UDR2 +#define UDR2_1_REG UDR2 +#define UDR2_2_REG UDR2 +#define UDR2_3_REG UDR2 +#define UDR2_4_REG UDR2 +#define UDR2_5_REG UDR2 +#define UDR2_6_REG UDR2 +#define UDR2_7_REG UDR2 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* DIDR2 */ +#define ADC8D_REG DIDR2 +#define ADC9D_REG DIDR2 +#define ADC10D_REG DIDR2 +#define ADC11D_REG DIDR2 +#define ADC12D_REG DIDR2 +#define ADC13D_REG DIDR2 +#define ADC14D_REG DIDR2 +#define ADC15D_REG DIDR2 + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ +#define DDJ7_REG DDRJ + +/* DDRK */ +#define DDK0_REG DDRK +#define DDK1_REG DDRK +#define DDK2_REG DDRK +#define DDK3_REG DDRK +#define DDK4_REG DDRK +#define DDK5_REG DDRK +#define DDK6_REG DDRK +#define DDK7_REG DDRK + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRL */ +#define DDL0_REG DDRL +#define DDL1_REG DDRL +#define DDL2_REG DDRL +#define DDL3_REG DDRL +#define DDL4_REG DDRL +#define DDL5_REG DDRL +#define DDL6_REG DDRL +#define DDL7_REG DDRL + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG +#define DDG5_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCNT5H */ +#define TCNT5H0_REG TCNT5H +#define TCNT5H1_REG TCNT5H +#define TCNT5H2_REG TCNT5H +#define TCNT5H3_REG TCNT5H +#define TCNT5H4_REG TCNT5H +#define TCNT5H5_REG TCNT5H +#define TCNT5H6_REG TCNT5H +#define TCNT5H7_REG TCNT5H + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* TCNT5L */ +#define TCNT5L0_REG TCNT5L +#define TCNT5L1_REG TCNT5L +#define TCNT5L2_REG TCNT5L +#define TCNT5L3_REG TCNT5L +#define TCNT5L4_REG TCNT5L +#define TCNT5L5_REG TCNT5L +#define TCNT5L6_REG TCNT5L +#define TCNT5L7_REG TCNT5L + +/* UBRR2H */ +/* #define UBRR8_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR9_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR10_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ +/* #define UBRR11_REG UBRR2H */ /* dup in UBRR3H, UBRR0H */ + +/* UBRR2L */ +/* #define UBRR0_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR1_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR2_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR3_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR4_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR5_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR6_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ +/* #define UBRR7_REG UBRR2L */ /* dup in UBRR3L, UBRR0L */ + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UCSR2B */ +#define TXB82_REG UCSR2B +#define RXB82_REG UCSR2B +#define UCSZ22_REG UCSR2B +#define TXEN2_REG UCSR2B +#define RXEN2_REG UCSR2B +#define UDRIE2_REG UCSR2B +#define TXCIE2_REG UCSR2B +#define RXCIE2_REG UCSR2B + +/* UCSR2A */ +#define MPCM2_REG UCSR2A +#define U2X2_REG UCSR2A +#define UPE2_REG UCSR2A +#define DOR2_REG UCSR2A +#define FE2_REG UCSR2A +#define UDRE2_REG UCSR2A +#define TXC2_REG UCSR2A +#define RXC2_REG UCSR2A + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UCSR2C */ +#define UCPOL2_REG UCSR2C +#define UCSZ20_REG UCSR2C +#define UCSZ21_REG UCSR2C +#define USBS2_REG UCSR2C +#define UPM20_REG UCSR2C +#define UPM21_REG UCSR2C +#define UMSEL20_REG UCSR2C +#define UMSEL21_REG UCSR2C + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TIFR4 */ +#define TOV4_REG TIFR4 +#define OCF4A_REG TIFR4 +#define OCF4B_REG TIFR4 +#define OCF4C_REG TIFR4 +#define ICF4_REG TIFR4 + +/* TIFR5 */ +#define TOV5_REG TIFR5 +#define OCF5A_REG TIFR5 +#define OCF5B_REG TIFR5 +#define OCF5C_REG TIFR5 +#define ICF5_REG TIFR5 + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR3 */ +#define TOV3_REG TIFR3 +#define OCF3A_REG TIFR3 +#define OCF3B_REG TIFR3 +#define OCF3C_REG TIFR3 +#define ICF3_REG TIFR3 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define OCF1C_REG TIFR1 +#define ICF1_REG TIFR1 + +/* OCR4AH */ +#define OCR4AH0_REG OCR4AH +#define OCR4AH1_REG OCR4AH +#define OCR4AH2_REG OCR4AH +#define OCR4AH3_REG OCR4AH +#define OCR4AH4_REG OCR4AH +#define OCR4AH5_REG OCR4AH +#define OCR4AH6_REG OCR4AH +#define OCR4AH7_REG OCR4AH + +/* OCR5CH */ +#define OCR5CH0_REG OCR5CH +#define OCR5CH1_REG OCR5CH +#define OCR5CH2_REG OCR5CH +#define OCR5CH3_REG OCR5CH +#define OCR5CH4_REG OCR5CH +#define OCR5CH5_REG OCR5CH +#define OCR5CH6_REG OCR5CH +#define OCR5CH7_REG OCR5CH + +/* OCR4AL */ +#define OCR4AL0_REG OCR4AL +#define OCR4AL1_REG OCR4AL +#define OCR4AL2_REG OCR4AL +#define OCR4AL3_REG OCR4AL +#define OCR4AL4_REG OCR4AL +#define OCR4AL5_REG OCR4AL +#define OCR4AL6_REG OCR4AL +#define OCR4AL7_REG OCR4AL + +/* OCR5CL */ +#define OCR5CL0_REG OCR5CL +#define OCR5CL1_REG OCR5CL +#define OCR5CL2_REG OCR5CL +#define OCR5CL3_REG OCR5CL +#define OCR5CL4_REG OCR5CL +#define OCR5CL5_REG OCR5CL +#define OCR5CL6_REG OCR5CL +#define OCR5CL7_REG OCR5CL + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCNT3L0_REG TCNT3L +#define TCNT3L1_REG TCNT3L +#define TCNT3L2_REG TCNT3L +#define TCNT3L3_REG TCNT3L +#define TCNT3L4_REG TCNT3L +#define TCNT3L5_REG TCNT3L +#define TCNT3L6_REG TCNT3L +#define TCNT3L7_REG TCNT3L + +/* ICR5L */ +#define ICR5L0_REG ICR5L +#define ICR5L1_REG ICR5L +#define ICR5L2_REG ICR5L +#define ICR5L3_REG ICR5L +#define ICR5L4_REG ICR5L +#define ICR5L5_REG ICR5L +#define ICR5L6_REG ICR5L +#define ICR5L7_REG ICR5L + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* ICR5H */ +#define ICR5H0_REG ICR5H +#define ICR5H1_REG ICR5H +#define ICR5H2_REG ICR5H +#define ICR5H3_REG ICR5H +#define ICR5H4_REG ICR5H +#define ICR5H5_REG ICR5H +#define ICR5H6_REG ICR5H +#define ICR5H7_REG ICR5H + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* PINK */ +#define PINK0_REG PINK +#define PINK1_REG PINK +#define PINK2_REG PINK +#define PINK3_REG PINK +#define PINK4_REG PINK +#define PINK5_REG PINK +#define PINK6_REG PINK +#define PINK7_REG PINK + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ +#define PINJ7_REG PINJ + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR3H, UBRR2H */ + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR3L, UBRR2L */ + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* ICR4H */ +#define ICR4H0_REG ICR4H +#define ICR4H1_REG ICR4H +#define ICR4H2_REG ICR4H +#define ICR4H3_REG ICR4H +#define ICR4H4_REG ICR4H +#define ICR4H5_REG ICR4H +#define ICR4H6_REG ICR4H +#define ICR4H7_REG ICR4H + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* ICR4L */ +#define ICR4L0_REG ICR4L +#define ICR4L1_REG ICR4L +#define ICR4L2_REG ICR4L +#define ICR4L3_REG ICR4L +#define ICR4L4_REG ICR4L +#define ICR4L5_REG ICR4L +#define ICR4L6_REG ICR4L +#define ICR4L7_REG ICR4L + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* TCNT4L */ +#define TCNT4L0_REG TCNT4L +#define TCNT4L1_REG TCNT4L +#define TCNT4L2_REG TCNT4L +#define TCNT4L3_REG TCNT4L +#define TCNT4L4_REG TCNT4L +#define TCNT4L5_REG TCNT4L +#define TCNT4L6_REG TCNT4L +#define TCNT4L7_REG TCNT4L + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* TCNT4H */ +#define TCNT4H0_REG TCNT4H +#define TCNT4H1_REG TCNT4H +#define TCNT4H2_REG TCNT4H +#define TCNT4H3_REG TCNT4H +#define TCNT4H4_REG TCNT4H +#define TCNT4H5_REG TCNT4H +#define TCNT4H6_REG TCNT4H +#define TCNT4H7_REG TCNT4H + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EIND */ +#define EIND0_REG EIND + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TCCR5A */ +#define WGM50_REG TCCR5A +#define WGM51_REG TCCR5A +#define COM5C0_REG TCCR5A +#define COM5C1_REG TCCR5A +#define COM5B0_REG TCCR5A +#define COM5B1_REG TCCR5A +#define COM5A0_REG TCCR5A +#define COM5A1_REG TCCR5A + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* TCCR5C */ +#define FOC5C_REG TCCR5C +#define FOC5B_REG TCCR5C +#define FOC5A_REG TCCR5C + +/* TCCR5B */ +#define CS50_REG TCCR5B +#define CS51_REG TCCR5B +#define CS52_REG TCCR5B +#define WGM52_REG TCCR5B +#define WGM53_REG TCCR5B +#define ICES5_REG TCCR5B +#define ICNC5_REG TCCR5B + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB + +/* OCR5AL */ +#define OCR5AL0_REG OCR5AL +#define OCR5AL1_REG OCR5AL +#define OCR5AL2_REG OCR5AL +#define OCR5AL3_REG OCR5AL +#define OCR5AL4_REG OCR5AL +#define OCR5AL5_REG OCR5AL +#define OCR5AL6_REG OCR5AL +#define OCR5AL7_REG OCR5AL + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR4CH */ +#define OCR4CH0_REG OCR4CH +#define OCR4CH1_REG OCR4CH +#define OCR4CH2_REG OCR4CH +#define OCR4CH3_REG OCR4CH +#define OCR4CH4_REG OCR4CH +#define OCR4CH5_REG OCR4CH +#define OCR4CH6_REG OCR4CH +#define OCR4CH7_REG OCR4CH + +/* OCR5AH */ +#define OCR5AH0_REG OCR5AH +#define OCR5AH1_REG OCR5AH +#define OCR5AH2_REG OCR5AH +#define OCR5AH3_REG OCR5AH +#define OCR5AH4_REG OCR5AH +#define OCR5AH5_REG OCR5AH +#define OCR5AH6_REG OCR5AH +#define OCR5AH7_REG OCR5AH + +/* OCR4CL */ +#define OCR4CL0_REG OCR4CL +#define OCR4CL1_REG OCR4CL +#define OCR4CL2_REG OCR4CL +#define OCR4CL3_REG OCR4CL +#define OCR4CL4_REG OCR4CL +#define OCR4CL5_REG OCR4CL +#define OCR4CL6_REG OCR4CL +#define OCR4CL7_REG OCR4CL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR5BH */ +#define OCR5BH0_REG OCR5BH +#define OCR5BH1_REG OCR5BH +#define OCR5BH2_REG OCR5BH +#define OCR5BH3_REG OCR5BH +#define OCR5BH4_REG OCR5BH +#define OCR5BH5_REG OCR5BH +#define OCR5BH6_REG OCR5BH +#define OCR5BH7_REG OCR5BH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR5BL */ +#define OCR5BL0_REG OCR5BL +#define OCR5BL1_REG OCR5BL +#define OCR5BL2_REG OCR5BL +#define OCR5BL3_REG OCR5BL +#define OCR5BL4_REG OCR5BL +#define OCR5BL5_REG OCR5BL +#define OCR5BL6_REG OCR5BL +#define OCR5BL7_REG OCR5BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* TIMSK3 */ +#define TOIE3_REG TIMSK3 +#define OCIE3A_REG TIMSK3 +#define OCIE3B_REG TIMSK3 +#define OCIE3C_REG TIMSK3 +#define ICIE3_REG TIMSK3 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define OCIE1C_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TIMSK4 */ +#define TOIE4_REG TIMSK4 +#define OCIE4A_REG TIMSK4 +#define OCIE4B_REG TIMSK4 +#define OCIE4C_REG TIMSK4 +#define ICIE4_REG TIMSK4 + +/* TIMSK5 */ +#define TOIE5_REG TIMSK5 +#define OCIE5A_REG TIMSK5 +#define OCIE5B_REG TIMSK5 +#define OCIE5C_REG TIMSK5 +#define ICIE5_REG TIMSK5 + +/* TCCR4B */ +#define CS40_REG TCCR4B +#define CS41_REG TCCR4B +#define CS42_REG TCCR4B +#define WGM42_REG TCCR4B +#define WGM43_REG TCCR4B +#define ICES4_REG TCCR4B +#define ICNC4_REG TCCR4B + +/* TCCR4C */ +#define FOC4C_REG TCCR4C +#define FOC4B_REG TCCR4C +#define FOC4A_REG TCCR4C + +/* TCCR4A */ +#define WGM40_REG TCCR4A +#define WGM41_REG TCCR4A +#define COM4C0_REG TCCR4A +#define COM4C1_REG TCCR4A +#define COM4B0_REG TCCR4A +#define COM4B1_REG TCCR4A +#define COM4A0_REG TCCR4A +#define COM4A1_REG TCCR4A + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRW10_REG XMCRA +#define SRW11_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA +#define SRE_REG XMCRA + +/* PINL */ +#define PINL0_REG PINL +#define PINL1_REG PINL +#define PINL2_REG PINL +#define PINL3_REG PINL +#define PINL4_REG PINL +#define PINL5_REG PINL +#define PINL6_REG PINL +#define PINL7_REG PINL + +/* OCR4BL */ +#define OCR4BL0_REG OCR4BL +#define OCR4BL1_REG OCR4BL +#define OCR4BL2_REG OCR4BL +#define OCR4BL3_REG OCR4BL +#define OCR4BL4_REG OCR4BL +#define OCR4BL5_REG OCR4BL +#define OCR4BL6_REG OCR4BL +#define OCR4BL7_REG OCR4BL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* OCR4BH */ +#define OCR4BH0_REG OCR4BH +#define OCR4BH1_REG OCR4BH +#define OCR4BH2_REG OCR4BH +#define OCR4BH3_REG OCR4BH +#define OCR4BH4_REG OCR4BH +#define OCR4BH5_REG OCR4BH +#define OCR4BH6_REG OCR4BH +#define OCR4BH7_REG OCR4BH + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PRR1 */ +#define PRUSART1_REG PRR1 +#define PRUSART2_REG PRR1 +#define PRUSART3_REG PRR1 +#define PRTIM3_REG PRR1 +#define PRTIM4_REG PRR1 +#define PRTIM5_REG PRR1 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define OC0A_PORT PORTB +#define OC0A_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define OC0A_PORT PORTB +#define OC0A_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define ICP1_PORT PORTD +#define ICP1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T0_PORT PORTD +#define T0_BIT 7 + +#define RXD_PORT PORTE +#define RXD_BIT 0 +#define PCINT8_PORT PORTE +#define PCINT8_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 + +#define XCK_PORT PORTE +#define XCK_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define CLKO_PORT PORTE +#define CLKO_BIT 7 +#define ICP3_PORT PORTE +#define ICP3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TDO_PORT PORTF +#define TDO_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + +#define OC0B_PORT PORTG +#define OC0B_BIT 5 + +#define RXD2_PORT PORTH +#define RXD2_BIT 0 + +#define TXD2_PORT PORTH +#define TXD2_BIT 1 + +#define XCK2_PORT PORTH +#define XCK2_BIT 2 + +#define OC4A_PORT PORTH +#define OC4A_BIT 3 + +#define OC4B_PORT PORTH +#define OC4B_BIT 4 + +#define OC2B_PORT PORTH +#define OC2B_BIT 6 + +#define T4_PORT PORTH +#define T4_BIT 7 + +#define RXD3_PORT PORTJ +#define RXD3_BIT 0 +#define PCINT9_PORT PORTJ +#define PCINT9_BIT 0 + +#define TXD3_PORT PORTJ +#define TXD3_BIT 1 +#define PCINT10_PORT PORTJ +#define PCINT10_BIT 1 + +#define XCK3_PORT PORTJ +#define XCK3_BIT 2 +#define PCINT11_PORT PORTJ +#define PCINT11_BIT 2 + +#define PCINT12_PORT PORTJ +#define PCINT12_BIT 3 + +#define PCINT13_PORT PORTJ +#define PCINT13_BIT 4 + +#define PCINT15_PORT PORTJ +#define PCINT15_BIT 6 + +#define ADC8_PORT PORTK +#define ADC8_BIT 0 +#define PCINT16_PORT PORTK +#define PCINT16_BIT 0 + +#define ADC9_PORT PORTK +#define ADC9_BIT 1 +#define PCINT17_PORT PORTK +#define PCINT17_BIT 1 + +#define ADC10_PORT PORTK +#define ADC10_BIT 2 +#define PCINT18_PORT PORTK +#define PCINT18_BIT 2 + +#define ADC11_PORT PORTK +#define ADC11_BIT 3 +#define PCINT19_PORT PORTK +#define PCINT19_BIT 3 + +#define ADC12_PORT PORTK +#define ADC12_BIT 4 +#define PCINT20_PORT PORTK +#define PCINT20_BIT 4 + +#define ADC13_PORT PORTK +#define ADC13_BIT 5 +#define PCINT21_PORT PORTK +#define PCINT21_BIT 5 + +#define ADC14_PORT PORTK +#define ADC14_BIT 6 +#define PCINT22_PORT PORTK +#define PCINT22_BIT 6 + +#define ADC15_PORT PORTK +#define ADC15_BIT 7 +#define PCINT23_PORT PORTK +#define PCINT23_BIT 7 + +#define ICP4_PORT PORTL +#define ICP4_BIT 0 + +#define ICP5_PORT PORTL +#define ICP5_BIT 1 + +#define T5_PORT PORTL +#define T5_BIT 2 + +#define OC5A_PORT PORTL +#define OC5A_BIT 3 + +#define OC5B_PORT PORTL +#define OC5B_BIT 4 + + diff --git a/aversive/parts/ATmega644.h b/aversive/parts/ATmega644.h new file mode 100644 index 0000000..688a7b1 --- /dev/null +++ b/aversive/parts/ATmega644.h @@ -0,0 +1,1104 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega644P.h b/aversive/parts/ATmega644P.h new file mode 100644 index 0000000..c55a8f3 --- /dev/null +++ b/aversive/parts/ATmega644P.h @@ -0,0 +1,1169 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* RAMPZ */ +#define RAMPZ0_REG RAMPZ + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR1_0_REG UDR1 +#define UDR1_1_REG UDR1 +#define UDR1_2_REG UDR1 +#define UDR1_3_REG UDR1 +#define UDR1_4_REG UDR1 +#define UDR1_5_REG UDR1 +#define UDR1_6_REG UDR1 +#define UDR1_7_REG UDR1 + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +#define UBRR_0_REG UBRR1L +#define UBRR_1_REG UBRR1L +#define UBRR_2_REG UBRR1L +#define UBRR_3_REG UBRR1L +#define UBRR_4_REG UBRR1L +#define UBRR_5_REG UBRR1L +#define UBRR_6_REG UBRR1L +#define UBRR_7_REG UBRR1L + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* UBRR1H */ +#define UBRR_8_REG UBRR1H +#define UBRR_9_REG UBRR1H +#define UBRR_10_REG UBRR1H +#define UBRR_11_REG UBRR1H + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH +#define EEAR11_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define JTD_REG MCUCR +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define JTRF_REG MCUSR +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL10_REG UCSR1C +#define UMSEL11_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* PRR0 */ +#define PRADC_REG PRR0 +#define PRUSART0_REG PRR0 +#define PRSPI_REG PRR0 +#define PRTIM1_REG PRR0 +#define PRUSART1_REG PRR0 +#define PRTIM0_REG PRR0 +#define PRTIM2_REG PRR0 +#define PRTWI_REG PRR0 + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 +#define PCINT31_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 +#define CLKO_PORT PORTB +#define CLKO_BIT 1 +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0A_PORT PORTB +#define OC0A_BIT 3 +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 +#define OC0B_PORT PORTB +#define OC0B_BIT 4 +#define PCINT12_PORT PORTB +#define PCINT12_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define PCINT13_PORT PORTB +#define PCINT13_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define PCINT14_PORT PORTB +#define PCINT14_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define PCINT15_PORT PORTB +#define PCINT15_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 +#define PCINT16_PORT PORTC +#define PCINT16_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 +#define PCINT17_PORT PORTC +#define PCINT17_BIT 1 + +#define TCK_PORT PORTC +#define TCK_BIT 2 +#define PCINT18_PORT PORTC +#define PCINT18_BIT 2 + +#define TMS_PORT PORTC +#define TMS_BIT 3 +#define PCINT19_PORT PORTC +#define PCINT19_BIT 3 + +#define TDO_PORT PORTC +#define TDO_BIT 4 +#define PCINT20_PORT PORTC +#define PCINT20_BIT 4 + +#define TDI_PORT PORTC +#define TDI_BIT 5 +#define PCINT21_PORT PORTC +#define PCINT21_BIT 5 + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 +#define PCINT22_PORT PORTC +#define PCINT22_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 +#define PCINT23_PORT PORTC +#define PCINT23_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT24_PORT PORTD +#define PCINT24_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT25_PORT PORTD +#define PCINT25_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define RDX1_PORT PORTD +#define RDX1_BIT 2 +#define PCINT26_PORT PORTD +#define PCINT26_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define PCINT27_PORT PORTD +#define PCINT27_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 +#define XCK1_PORT PORTD +#define XCK1_BIT 4 +#define PCINT28_PORT PORTD +#define PCINT28_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 +#define PCINT29_PORT PORTD +#define PCINT29_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 +#define OC2B_PORT PORTD +#define OC2B_BIT 6 +#define PCINT30_PORT PORTD +#define PCINT30_BIT 6 + +#define OC2A_PORT PORTD +#define OC2A_BIT 7 +#define PCINT31_PORT PORTD +#define PCINT31_BIT 7 + + diff --git a/aversive/parts/ATmega645.h b/aversive/parts/ATmega645.h new file mode 100644 index 0000000..743512d --- /dev/null +++ b/aversive/parts/ATmega645.h @@ -0,0 +1,899 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega6450.h b/aversive/parts/ATmega6450.h new file mode 100644 index 0000000..16c0e0a --- /dev/null +++ b/aversive/parts/ATmega6450.h @@ -0,0 +1,975 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega649.h b/aversive/parts/ATmega649.h new file mode 100644 index 0000000..f5d488f --- /dev/null +++ b/aversive/parts/ATmega649.h @@ -0,0 +1,1065 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega6490.h b/aversive/parts/ATmega6490.h new file mode 100644 index 0000000..983e879 --- /dev/null +++ b/aversive/parts/ATmega6490.h @@ -0,0 +1,1209 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR2A */ +#define OCR2A0_REG OCR2A +#define OCR2A1_REG OCR2A +#define OCR2A2_REG OCR2A +#define OCR2A3_REG OCR2A +#define OCR2A4_REG OCR2A +#define OCR2A5_REG OCR2A +#define OCR2A6_REG OCR2A +#define OCR2A7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRLCD_REG PRR + +/* PORTJ */ +#define PORTJ0_REG PORTJ +#define PORTJ1_REG PORTJ +#define PORTJ2_REG PORTJ +#define PORTJ3_REG PORTJ +#define PORTJ4_REG PORTJ +#define PORTJ5_REG PORTJ +#define PORTJ6_REG PORTJ + +/* PORTH */ +#define PORTH0_REG PORTH +#define PORTH1_REG PORTH +#define PORTH2_REG PORTH +#define PORTH3_REG PORTH +#define PORTH4_REG PORTH +#define PORTH5_REG PORTH +#define PORTH6_REG PORTH +#define PORTH7_REG PORTH + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRJ */ +#define DDJ0_REG DDRJ +#define DDJ1_REG DDRJ +#define DDJ2_REG DDRJ +#define DDJ3_REG DDRJ +#define DDJ4_REG DDRJ +#define DDJ5_REG DDRJ +#define DDJ6_REG DDRJ + +/* DDRH */ +#define DDH0_REG DDRH +#define DDH1_REG DDRH +#define DDH2_REG DDRH +#define DDH3_REG DDRH +#define DDH4_REG DDRH +#define DDH5_REG DDRH +#define DDH6_REG DDRH +#define DDH7_REG DDRH + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* LCDDR3 */ +#define SEG024_REG LCDDR3 +#define SEG025_REG LCDDR3 +#define SEG026_REG LCDDR3 +#define SEG027_REG LCDDR3 +#define SEG028_REG LCDDR3 +#define SEG029_REG LCDDR3 +#define SEG030_REG LCDDR3 +#define SEG031_REG LCDDR3 + +/* LCDDR2 */ +#define SEG016_REG LCDDR2 +#define SEG017_REG LCDDR2 +#define SEG018_REG LCDDR2 +#define SEG019_REG LCDDR2 +#define SEG020_REG LCDDR2 +#define SEG021_REG LCDDR2 +#define SEG022_REG LCDDR2 +#define SEG023_REG LCDDR2 + +/* LCDDR1 */ +#define SEG008_REG LCDDR1 +#define SEG009_REG LCDDR1 +#define SEG010_REG LCDDR1 +#define SEG011_REG LCDDR1 +#define SEG012_REG LCDDR1 +#define SEG013_REG LCDDR1 +#define SEG014_REG LCDDR1 +#define SEG015_REG LCDDR1 + +/* LCDDR0 */ +#define SEG000_REG LCDDR0 +#define SEG001_REG LCDDR0 +#define SEG002_REG LCDDR0 +#define SEG003_REG LCDDR0 +#define SEG004_REG LCDDR0 +#define SEG005_REG LCDDR0 +#define SEG006_REG LCDDR0 +#define SEG007_REG LCDDR0 + +/* LCDDR7 */ +#define SEG116_REG LCDDR7 +#define SEG117_REG LCDDR7 +#define SEG118_REG LCDDR7 +#define SEG119_REG LCDDR7 +#define SEG120_REG LCDDR7 +#define SEG121_REG LCDDR7 +#define SEG122_REG LCDDR7 +#define SEG123_REG LCDDR7 + +/* LCDDR6 */ +#define SEG108_REG LCDDR6 +#define SEG109_REG LCDDR6 +#define SEG110_REG LCDDR6 +#define SEG111_REG LCDDR6 +#define SEG112_REG LCDDR6 +#define SEG113_REG LCDDR6 +#define SEG114_REG LCDDR6 +#define SEG115_REG LCDDR6 + +/* LCDDR5 */ +#define SEG100_REG LCDDR5 +#define SEG101_REG LCDDR5 +#define SEG102_REG LCDDR5 +#define SEG103_REG LCDDR5 +#define SEG104_REG LCDDR5 +#define SEG105_REG LCDDR5 +#define SEG106_REG LCDDR5 +#define SEG107_REG LCDDR5 + +/* LCDDR4 */ +#define SEG032_REG LCDDR4 +#define SEG033_REG LCDDR4 +#define SEG034_REG LCDDR4 +#define SEG035_REG LCDDR4 +#define SEG036_REG LCDDR4 +#define SEG037_REG LCDDR4 +#define SEG038_REG LCDDR4 +#define SEG039_REG LCDDR4 + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* LCDDR9 */ +#define SEG132_REG LCDDR9 +#define SEG133_REG LCDDR9 +#define SEG134_REG LCDDR9 +#define SEG135_REG LCDDR9 +#define SEG136_REG LCDDR9 +#define SEG137_REG LCDDR9 +#define SEG138_REG LCDDR9 +#define SEG139_REG LCDDR9 + +/* LCDDR8 */ +#define SEG124_REG LCDDR8 +#define SEG125_REG LCDDR8 +#define SEG126_REG LCDDR8 +#define SEG127_REG LCDDR8 +#define SEG128_REG LCDDR8 +#define SEG129_REG LCDDR8 +#define SEG130_REG LCDDR8 +#define SEG131_REG LCDDR8 + +/* LCDCRA */ +#define LCDBL_REG LCDCRA +#define LCDIE_REG LCDCRA +#define LCDIF_REG LCDCRA +#define LCDAB_REG LCDCRA +#define LCDEN_REG LCDCRA + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* LCDCRB */ +#define LCDPM0_REG LCDCRB +#define LCDPM1_REG LCDCRB +#define LCDPM2_REG LCDCRB +#define LCDPM3_REG LCDCRB +#define LCDMUX0_REG LCDCRB +#define LCDMUX1_REG LCDCRB +#define LCD2B_REG LCDCRB +#define LCDCS_REG LCDCRB + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A +#define WGM00_REG TCCR0A +#define FOC0A_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSR310_REG GTCCR +#define TSM_REG GTCCR +#define PSR2_REG GTCCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* LCDDR19 */ +#define SEG332_REG LCDDR19 +#define SEG333_REG LCDDR19 +#define SEG334_REG LCDDR19 +#define SEG335_REG LCDDR19 +#define SEG336_REG LCDDR19 +#define SEG337_REG LCDDR19 +#define SEG338_REG LCDDR19 +#define SEG339_REG LCDDR19 + +/* LCDDR18 */ +#define SEG324_REG LCDDR18 +#define SEG325_REG LCDDR18 +#define SEG326_REG LCDDR18 +#define SEG327_REG LCDDR18 +#define SEG328_REG LCDDR18 +#define SEG329_REG LCDDR18 +#define SEG330_REG LCDDR18 +#define SEG331_REG LCDDR18 + +/* LCDDR13 */ +#define SEG224_REG LCDDR13 +#define SEG225_REG LCDDR13 +#define SEG226_REG LCDDR13 +#define SEG227_REG LCDDR13 +#define SEG228_REG LCDDR13 +#define SEG229_REG LCDDR13 +#define SEG230_REG LCDDR13 +#define SEG231_REG LCDDR13 + +/* LCDDR12 */ +#define SEG216_REG LCDDR12 +#define SEG217_REG LCDDR12 +#define SEG218_REG LCDDR12 +#define SEG219_REG LCDDR12 +#define SEG220_REG LCDDR12 +#define SEG221_REG LCDDR12 +#define SEG222_REG LCDDR12 +#define SEG223_REG LCDDR12 + +/* LCDDR11 */ +#define SEG208_REG LCDDR11 +#define SEG209_REG LCDDR11 +#define SEG210_REG LCDDR11 +#define SEG211_REG LCDDR11 +#define SEG212_REG LCDDR11 +#define SEG213_REG LCDDR11 +#define SEG214_REG LCDDR11 +#define SEG215_REG LCDDR11 + +/* LCDDR10 */ +#define SEG200_REG LCDDR10 +#define SEG201_REG LCDDR10 +#define SEG202_REG LCDDR10 +#define SEG203_REG LCDDR10 +#define SEG204_REG LCDDR10 +#define SEG205_REG LCDDR10 +#define SEG206_REG LCDDR10 +#define SEG207_REG LCDDR10 + +/* LCDDR17 */ +#define SEG316_REG LCDDR17 +#define SEG317_REG LCDDR17 +#define SEG318_REG LCDDR17 +#define SEG319_REG LCDDR17 +#define SEG320_REG LCDDR17 +#define SEG321_REG LCDDR17 +#define SEG322_REG LCDDR17 +#define SEG323_REG LCDDR17 + +/* LCDDR16 */ +#define SEG308_REG LCDDR16 +#define SEG309_REG LCDDR16 +#define SEG310_REG LCDDR16 +#define SEG311_REG LCDDR16 +#define SEG312_REG LCDDR16 +#define SEG313_REG LCDDR16 +#define SEG314_REG LCDDR16 +#define SEG315_REG LCDDR16 + +/* LCDDR15 */ +#define SEG300_REG LCDDR15 +#define SEG301_REG LCDDR15 +#define SEG302_REG LCDDR15 +#define SEG303_REG LCDDR15 +#define SEG304_REG LCDDR15 +#define SEG305_REG LCDDR15 +#define SEG306_REG LCDDR15 +#define SEG307_REG LCDDR15 + +/* LCDDR14 */ +#define SEG232_REG LCDDR14 +#define SEG233_REG LCDDR14 +#define SEG234_REG LCDDR14 +#define SEG235_REG LCDDR14 +#define SEG236_REG LCDDR14 +#define SEG237_REG LCDDR14 +#define SEG238_REG LCDDR14 +#define SEG239_REG LCDDR14 + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR +#define JTRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TCCR2A */ +#define CS20_REG TCCR2A +#define CS21_REG TCCR2A +#define CS22_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A +#define WGM20_REG TCCR2A +#define FOC2A_REG TCCR2A + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define JTD_REG MCUCR + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* LCDCCR */ +#define LCDCC0_REG LCDCCR +#define LCDCC1_REG LCDCCR +#define LCDCC2_REG LCDCCR +#define LCDCC3_REG LCDCCR +#define LCDDC0_REG LCDCCR +#define LCDDC1_REG LCDCCR +#define LCDDC2_REG LCDCCR + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* OCR0A */ +#define OCR0A0_REG OCR0A +#define OCR0A1_REG OCR0A +#define OCR0A2_REG OCR0A +#define OCR0A3_REG OCR0A +#define OCR0A4_REG OCR0A +#define OCR0A5_REG OCR0A +#define OCR0A6_REG OCR0A +#define OCR0A7_REG OCR0A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* LCDFRR */ +#define LCDCD0_REG LCDFRR +#define LCDCD1_REG LCDFRR +#define LCDCD2_REG LCDFRR +#define LCDPS0_REG LCDFRR +#define LCDPS1_REG LCDFRR +#define LCDPS2_REG LCDFRR + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define PCIE0_REG EIMSK +#define PCIE1_REG EIMSK +#define PCIE2_REG EIMSK +#define PCIE3_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PINJ */ +#define PINJ0_REG PINJ +#define PINJ1_REG PINJ +#define PINJ2_REG PINJ +#define PINJ3_REG PINJ +#define PINJ4_REG PINJ +#define PINJ5_REG PINJ +#define PINJ6_REG PINJ + +/* PINH */ +#define PINH0_REG PINH +#define PINH1_REG PINH +#define PINH2_REG PINH +#define PINH3_REG PINH +#define PINH4_REG PINH +#define PINH5_REG PINH +#define PINH6_REG PINH +#define PINH7_REG PINH + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 +#define PCINT28_REG PCMSK3 +#define PCINT29_REG PCMSK3 +#define PCINT30_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define PCIF0_REG EIFR +#define PCIF1_REG EIFR +#define PCIF2_REG EIFR +#define PCIF3_REG EIFR + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING +#define PING5_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATmega64A.h b/aversive/parts/ATmega64A.h new file mode 100644 index 0000000..4a622c2 --- /dev/null +++ b/aversive/parts/ATmega64A.h @@ -0,0 +1,1328 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_64 3 +#define TIMER2_PRESCALER_DIV_256 4 +#define TIMER2_PRESCALER_DIV_1024 5 +#define TIMER2_PRESCALER_DIV_FALL 6 +#define TIMER2_PRESCALER_DIV_RISE 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 64 +#define TIMER2_PRESCALER_REG_4 256 +#define TIMER2_PRESCALER_REG_5 1024 +#define TIMER2_PRESCALER_REG_6 -1 +#define TIMER2_PRESCALER_REG_7 -2 + +/* prescalers timer 3 */ +#define TIMER3_PRESCALER_DIV_0 0 +#define TIMER3_PRESCALER_DIV_1 1 +#define TIMER3_PRESCALER_DIV_8 2 +#define TIMER3_PRESCALER_DIV_64 3 +#define TIMER3_PRESCALER_DIV_256 4 +#define TIMER3_PRESCALER_DIV_1024 5 +#define TIMER3_PRESCALER_DIV_FALL 6 +#define TIMER3_PRESCALER_DIV_RISE 7 + +#define TIMER3_PRESCALER_REG_0 0 +#define TIMER3_PRESCALER_REG_1 1 +#define TIMER3_PRESCALER_REG_2 8 +#define TIMER3_PRESCALER_REG_3 64 +#define TIMER3_PRESCALER_REG_4 256 +#define TIMER3_PRESCALER_REG_5 1024 +#define TIMER3_PRESCALER_REG_6 -1 +#define TIMER3_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER1C_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER3_AVAILABLE +#define TIMER3A_AVAILABLE +#define TIMER3B_AVAILABLE +#define TIMER3C_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW3_NUM 3 +#define SIG_OVERFLOW_TOTAL_NUM 4 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE1C_NUM 3 +#define SIG_OUTPUT_COMPARE2_NUM 4 +#define SIG_OUTPUT_COMPARE3A_NUM 5 +#define SIG_OUTPUT_COMPARE3B_NUM 6 +#define SIG_OUTPUT_COMPARE3C_NUM 7 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 8 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM1C_NUM 3 +#define PWM2_NUM 4 +#define PWM3A_NUM 5 +#define PWM3B_NUM 6 +#define PWM3C_NUM 7 +#define PWM_TOTAL_NUM 8 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE3_NUM 1 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 2 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTG */ +#define PORTG0_REG PORTG +#define PORTG1_REG PORTG +#define PORTG2_REG PORTG +#define PORTG3_REG PORTG +#define PORTG4_REG PORTG + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL0_REG UCSR0C + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* UDR1 */ +#define UDR10_REG UDR1 +#define UDR11_REG UDR1 +#define UDR12_REG UDR1 +#define UDR13_REG UDR1 +#define UDR14_REG UDR1 +#define UDR15_REG UDR1 +#define UDR16_REG UDR1 +#define UDR17_REG UDR1 + +/* UDR0 */ +#define UDR00_REG UDR0 +#define UDR01_REG UDR0 +#define UDR02_REG UDR0 +#define UDR03_REG UDR0 +#define UDR04_REG UDR0 +#define UDR05_REG UDR0 +#define UDR06_REG UDR0 +#define UDR07_REG UDR0 + +/* EICRB */ +#define ISC40_REG EICRB +#define ISC41_REG EICRB +#define ISC50_REG EICRB +#define ISC51_REG EICRB +#define ISC60_REG EICRB +#define ISC61_REG EICRB +#define ISC70_REG EICRB +#define ISC71_REG EICRB + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA +#define ISC20_REG EICRA +#define ISC21_REG EICRA +#define ISC30_REG EICRA +#define ISC31_REG EICRA + +/* ASSR */ +#define TCR0UB_REG ASSR +#define OCR0UB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* UBRR1L */ +/* #define UBRR0_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR1_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR2_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR3_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR4_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR5_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR6_REG UBRR1L */ /* dup in UBRR0L */ +/* #define UBRR7_REG UBRR1L */ /* dup in UBRR0L */ + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* OCR3AL */ +#define OCR3AL0_REG OCR3AL +#define OCR3AL1_REG OCR3AL +#define OCR3AL2_REG OCR3AL +#define OCR3AL3_REG OCR3AL +#define OCR3AL4_REG OCR3AL +#define OCR3AL5_REG OCR3AL +#define OCR3AL6_REG OCR3AL +#define OCR3AL7_REG OCR3AL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* DDRF */ +#define DDF0_REG DDRF +#define DDF1_REG DDRF +#define DDF2_REG DDRF +#define DDF3_REG DDRF +#define DDF4_REG DDRF +#define DDF5_REG DDRF +#define DDF6_REG DDRF +#define DDF7_REG DDRF + +/* DDRG */ +#define DDG0_REG DDRG +#define DDG1_REG DDRG +#define DDG2_REG DDRG +#define DDG3_REG DDRG +#define DDG4_REG DDRG + +/* OCR3AH */ +#define OCR3AH0_REG OCR3AH +#define OCR3AH1_REG OCR3AH +#define OCR3AH2_REG OCR3AH +#define OCR3AH3_REG OCR3AH +#define OCR3AH4_REG OCR3AH +#define OCR3AH5_REG OCR3AH +#define OCR3AH6_REG OCR3AH +#define OCR3AH7_REG OCR3AH + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR321_REG SFIOR +#define PSR0_REG SFIOR +#define PUD_REG SFIOR +#define TSM_REG SFIOR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* UBRR1H */ +/* #define UBRR8_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR9_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR10_REG UBRR1H */ /* dup in UBRR0H */ +/* #define UBRR11_REG UBRR1H */ /* dup in UBRR0H */ + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* ETIFR */ +#define OCF1C_REG ETIFR +#define OCF3C_REG ETIFR +#define TOV3_REG ETIFR +#define OCF3B_REG ETIFR +#define OCF3A_REG ETIFR +#define ICF3_REG ETIFR + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* XDIV */ +#define XDIV0_REG XDIV +#define XDIV1_REG XDIV +#define XDIV2_REG XDIV +#define XDIV3_REG XDIV +#define XDIV4_REG XDIV +#define XDIV5_REG XDIV +#define XDIV6_REG XDIV +#define XDIVEN_REG XDIV + +/* OCR3CH */ +#define OCR3CH0_REG OCR3CH +#define OCR3CH1_REG OCR3CH +#define OCR3CH2_REG OCR3CH +#define OCR3CH3_REG OCR3CH +#define OCR3CH4_REG OCR3CH +#define OCR3CH5_REG OCR3CH +#define OCR3CH6_REG OCR3CH +#define OCR3CH7_REG OCR3CH + +/* ETIMSK */ +#define OCIE1C_REG ETIMSK +#define OCIE3C_REG ETIMSK +#define TOIE3_REG ETIMSK +#define OCIE3B_REG ETIMSK +#define OCIE3A_REG ETIMSK +#define TICIE3_REG ETIMSK + +/* OCR3CL */ +#define OCR3CL0_REG OCR3CL +#define OCR3CL1_REG OCR3CL +#define OCR3CL2_REG OCR3CL +#define OCR3CL3_REG OCR3CL +#define OCR3CL4_REG OCR3CL +#define OCR3CL5_REG OCR3CL +#define OCR3CL6_REG OCR3CL +#define OCR3CL7_REG OCR3CL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* TCCR3C */ +#define FOC3C_REG TCCR3C +#define FOC3B_REG TCCR3C +#define FOC3A_REG TCCR3C + +/* TCCR3B */ +#define CS30_REG TCCR3B +#define CS31_REG TCCR3B +#define CS32_REG TCCR3B +#define WGM32_REG TCCR3B +#define WGM33_REG TCCR3B +#define ICES3_REG TCCR3B +#define ICNC3_REG TCCR3B + +/* TCCR3A */ +#define WGM30_REG TCCR3A +#define WGM31_REG TCCR3A +#define COM3C0_REG TCCR3A +#define COM3C1_REG TCCR3A +#define COM3B0_REG TCCR3A +#define COM3B1_REG TCCR3A +#define COM3A0_REG TCCR3A +#define COM3A1_REG TCCR3A + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* TCNT3H */ +#define TCNT3H0_REG TCNT3H +#define TCNT3H1_REG TCNT3H +#define TCNT3H2_REG TCNT3H +#define TCNT3H3_REG TCNT3H +#define TCNT3H4_REG TCNT3H +#define TCNT3H5_REG TCNT3H +#define TCNT3H6_REG TCNT3H +#define TCNT3H7_REG TCNT3H + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* TCNT3L */ +#define TCN3L0_REG TCNT3L +#define TCN3L1_REG TCNT3L +#define TCN3L2_REG TCNT3L +#define TCN3L3_REG TCNT3L +#define TCN3L4_REG TCNT3L +#define TCN3L5_REG TCNT3L +#define TCN3L6_REG TCNT3L +#define TCN3L7_REG TCNT3L + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define JTRF_REG MCUCSR +#define JTD_REG MCUCSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* UBRR0H */ +/* #define UBRR8_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR9_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR10_REG UBRR0H */ /* dup in UBRR1H */ +/* #define UBRR11_REG UBRR0H */ /* dup in UBRR1H */ + +/* UBRR0L */ +/* #define UBRR0_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR1_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR2_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR3_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR4_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR5_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR6_REG UBRR0L */ /* dup in UBRR1L */ +/* #define UBRR7_REG UBRR0L */ /* dup in UBRR1L */ + +/* EEARH */ +#define EEAR8_REG EEARH +#define EEAR9_REG EEARH +#define EEAR10_REG EEARH + +/* EEARL */ +#define EEARL0_REG EEARL +#define EEARL1_REG EEARL +#define EEARL2_REG EEARL +#define EEARL3_REG EEARL +#define EEARL4_REG EEARL +#define EEARL5_REG EEARL +#define EEARL6_REG EEARL +#define EEARL7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define SM2_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1CL */ +#define OCR1CL0_REG OCR1CL +#define OCR1CL1_REG OCR1CL +#define OCR1CL2_REG OCR1CL +#define OCR1CL3_REG OCR1CL +#define OCR1CL4_REG OCR1CL +#define OCR1CL5_REG OCR1CL +#define OCR1CL6_REG OCR1CL +#define OCR1CL7_REG OCR1CL + +/* OCR1CH */ +#define OCR1CH0_REG OCR1CH +#define OCR1CH1_REG OCR1CH +#define OCR1CH2_REG OCR1CH +#define OCR1CH3_REG OCR1CH +#define OCR1CH4_REG OCR1CH +#define OCR1CH5_REG OCR1CH +#define OCR1CH6_REG OCR1CH +#define OCR1CH7_REG OCR1CH + +/* OCDR */ +#define OCDR0_REG OCDR +#define OCDR1_REG OCDR +#define OCDR2_REG OCDR +#define OCDR3_REG OCDR +#define OCDR4_REG OCDR +#define OCDR5_REG OCDR +#define OCDR6_REG OCDR +#define OCDR7_REG OCDR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR +#define INTF2_REG EIFR +#define INTF3_REG EIFR +#define INTF4_REG EIFR +#define INTF5_REG EIFR +#define INTF6_REG EIFR +#define INTF7_REG EIFR + +/* UCSR1B */ +#define TXB81_REG UCSR1B +#define RXB81_REG UCSR1B +#define UCSZ12_REG UCSR1B +#define TXEN1_REG UCSR1B +#define RXEN1_REG UCSR1B +#define UDRIE1_REG UCSR1B +#define TXCIE1_REG UCSR1B +#define RXCIE1_REG UCSR1B + +/* UCSR1C */ +#define UCPOL1_REG UCSR1C +#define UCSZ10_REG UCSR1C +#define UCSZ11_REG UCSR1C +#define USBS1_REG UCSR1C +#define UPM10_REG UCSR1C +#define UPM11_REG UCSR1C +#define UMSEL1_REG UCSR1C + +/* UCSR1A */ +#define MPCM1_REG UCSR1A +#define U2X1_REG UCSR1A +#define UPE1_REG UCSR1A +#define DOR1_REG UCSR1A +#define FE1_REG UCSR1A +#define UDRE1_REG UCSR1A +#define TXC1_REG UCSR1A +#define RXC1_REG UCSR1A + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK +#define INT2_REG EIMSK +#define INT3_REG EIMSK +#define INT4_REG EIMSK +#define INT5_REG EIMSK +#define INT6_REG EIMSK +#define INT7_REG EIMSK + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1C0_REG TCCR1A +#define COM1C1_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PORTF */ +#define PORTF0_REG PORTF +#define PORTF1_REG PORTF +#define PORTF2_REG PORTF +#define PORTF3_REG PORTF +#define PORTF4_REG PORTF +#define PORTF5_REG PORTF +#define PORTF6_REG PORTF +#define PORTF7_REG PORTF + +/* TCCR1C */ +#define FOC1C_REG TCCR1C +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* ICR3H */ +#define ICR3H0_REG ICR3H +#define ICR3H1_REG ICR3H +#define ICR3H2_REG ICR3H +#define ICR3H3_REG ICR3H +#define ICR3H4_REG ICR3H +#define ICR3H5_REG ICR3H +#define ICR3H6_REG ICR3H +#define ICR3H7_REG ICR3H + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE +#define DDE3_REG DDRE +#define DDE4_REG DDRE +#define DDE5_REG DDRE +#define DDE6_REG DDRE +#define DDE7_REG DDRE + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* ICR3L */ +#define ICR3L0_REG ICR3L +#define ICR3L1_REG ICR3L +#define ICR3L2_REG ICR3L +#define ICR3L3_REG ICR3L +#define ICR3L4_REG ICR3L +#define ICR3L5_REG ICR3L +#define ICR3L6_REG ICR3L +#define ICR3L7_REG ICR3L + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE +#define PORTE3_REG PORTE +#define PORTE4_REG PORTE +#define PORTE5_REG PORTE +#define PORTE6_REG PORTE +#define PORTE7_REG PORTE + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* OCR3BL */ +#define OCR3BL0_REG OCR3BL +#define OCR3BL1_REG OCR3BL +#define OCR3BL2_REG OCR3BL +#define OCR3BL3_REG OCR3BL +#define OCR3BL4_REG OCR3BL +#define OCR3BL5_REG OCR3BL +#define OCR3BL6_REG OCR3BL +#define OCR3BL7_REG OCR3BL + +/* OCR3BH */ +#define OCR3BH0_REG OCR3BH +#define OCR3BH1_REG OCR3BH +#define OCR3BH2_REG OCR3BH +#define OCR3BH3_REG OCR3BH +#define OCR3BH4_REG OCR3BH +#define OCR3BH5_REG OCR3BH +#define OCR3BH6_REG OCR3BH +#define OCR3BH7_REG OCR3BH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* XMCRB */ +#define XMM0_REG XMCRB +#define XMM1_REG XMCRB +#define XMM2_REG XMCRB +#define XMBK_REG XMCRB + +/* XMCRA */ +#define SRW11_REG XMCRA +#define SRW00_REG XMCRA +#define SRW01_REG XMCRA +#define SRL0_REG XMCRA +#define SRL1_REG XMCRA +#define SRL2_REG XMCRA + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PING */ +#define PING0_REG PING +#define PING1_REG PING +#define PING2_REG PING +#define PING3_REG PING +#define PING4_REG PING + +/* PINF */ +#define PINF0_REG PINF +#define PINF1_REG PINF +#define PINF2_REG PINF +#define PINF3_REG PINF +#define PINF4_REG PINF +#define PINF5_REG PINF +#define PINF6_REG PINF +#define PINF7_REG PINF + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE +#define PINE3_REG PINE +#define PINE4_REG PINE +#define PINE5_REG PINE +#define PINE6_REG PINE +#define PINE7_REG PINE + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define SS_PORT PORTB +#define SS_BIT 0 + +#define SCK_PORT PORTB +#define SCK_BIT 1 + +#define MOSI_PORT PORTB +#define MOSI_BIT 2 + +#define MISO_PORT PORTB +#define MISO_BIT 3 + +#define OC0_PORT PORTB +#define OC0_BIT 4 +#define PWM0_PORT PORTB +#define PWM0_BIT 4 + +#define OC1A_PORT PORTB +#define OC1A_BIT 5 +#define PWM1A_PORT PORTB +#define PWM1A_BIT 5 + +#define OC1B_PORT PORTB +#define OC1B_BIT 6 +#define PWM1B_PORT PORTB +#define PWM1B_BIT 6 + +#define OC2_PORT PORTB +#define OC2_BIT 7 +#define PWM2_PORT PORTB +#define PWM2_BIT 7 +#define OC1C_PORT PORTB +#define OC1C_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define SCL_PORT PORTD +#define SCL_BIT 0 +#define INT0_PORT PORTD +#define INT0_BIT 0 + +#define SDA_PORT PORTD +#define SDA_BIT 1 +#define INT1_PORT PORTD +#define INT1_BIT 1 + +#define RXD1_PORT PORTD +#define RXD1_BIT 2 +#define INT2_PORT PORTD +#define INT2_BIT 2 + +#define TXD1_PORT PORTD +#define TXD1_BIT 3 +#define INT3_PORT PORTD +#define INT3_BIT 3 + +#define IC1_PORT PORTD +#define IC1_BIT 4 + +#define XCK1_PORT PORTD +#define XCK1_BIT 5 + +#define T1_PORT PORTD +#define T1_BIT 6 + +#define T2_PORT PORTD +#define T2_BIT 7 + +#define RXD0_PORT PORTE +#define RXD0_BIT 0 +#define PDI_PORT PORTE +#define PDI_BIT 0 + +#define TXD0_PORT PORTE +#define TXD0_BIT 1 +#define PDO_PORT PORTE +#define PDO_BIT 1 + +#define XCK0_PORT PORTE +#define XCK0_BIT 2 +#define AIN0_PORT PORTE +#define AIN0_BIT 2 + +#define OC3A_PORT PORTE +#define OC3A_BIT 3 +#define AIN1_PORT PORTE +#define AIN1_BIT 3 + +#define OC3B_PORT PORTE +#define OC3B_BIT 4 +#define INT4_PORT PORTE +#define INT4_BIT 4 + +#define OC3C_PORT PORTE +#define OC3C_BIT 5 +#define INT5_PORT PORTE +#define INT5_BIT 5 + +#define T3_PORT PORTE +#define T3_BIT 6 +#define INT6_PORT PORTE +#define INT6_BIT 6 + +#define IC3_PORT PORTE +#define IC3_BIT 7 +#define INT7_PORT PORTE +#define INT7_BIT 7 + +#define ADC0_PORT PORTF +#define ADC0_BIT 0 + +#define ADC1_PORT PORTF +#define ADC1_BIT 1 + +#define ADC2_PORT PORTF +#define ADC2_BIT 2 + +#define ADC3_PORT PORTF +#define ADC3_BIT 3 + +#define ADC4_PORT PORTF +#define ADC4_BIT 4 +#define TCK_PORT PORTF +#define TCK_BIT 4 + +#define ADC5_PORT PORTF +#define ADC5_BIT 5 +#define TMS_PORT PORTF +#define TMS_BIT 5 + +#define ADC6_PORT PORTF +#define ADC6_BIT 6 +#define TD0_PORT PORTF +#define TD0_BIT 6 + +#define ADC7_PORT PORTF +#define ADC7_BIT 7 +#define TDI_PORT PORTF +#define TDI_BIT 7 + +#define WR_PORT PORTG +#define WR_BIT 0 + +#define RD_PORT PORTG +#define RD_BIT 1 + +#define ALE_PORT PORTG +#define ALE_BIT 2 + +#define TOSC2_PORT PORTG +#define TOSC2_BIT 3 + +#define TOSC1_PORT PORTG +#define TOSC1_BIT 4 + + diff --git a/aversive/parts/ATmega8.h b/aversive/parts/ATmega8.h new file mode 100644 index 0000000..9717237 --- /dev/null +++ b/aversive/parts/ATmega8.h @@ -0,0 +1,745 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE2_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM2_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADFR_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR2_REG SFIOR +#define PSR10_REG SFIOR +#define PUD_REG SFIOR +#define ADHSM_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SM2_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ICP_PORT PORTB +#define ICP_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2_PORT PORTB +#define OC2_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define IN1_PORT PORTD +#define IN1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 + + diff --git a/aversive/parts/ATmega8515.h b/aversive/parts/ATmega8515.h new file mode 100644 index 0000000..3335db2 --- /dev/null +++ b/aversive/parts/ATmega8515.h @@ -0,0 +1,708 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +/* #define URSEL_REG UCSRC */ /* dup in UBRRH */ + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define OCIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define TICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define PSR10_REG SFIOR +#define PUD_REG SFIOR +#define XMM0_REG SFIOR +#define XMM1_REG SFIOR +#define XMM2_REG SFIOR +#define XMBK_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* EMCUCR */ +#define ISC2_REG EMCUCR +#define SRW11_REG EMCUCR +#define SRW00_REG EMCUCR +#define SRW01_REG EMCUCR +#define SRL0_REG EMCUCR +#define SRL1_REG EMCUCR +#define SRL2_REG EMCUCR +#define SM0_REG EMCUCR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH +/* #define URSEL_REG UBRRH */ /* dup in UCSRC */ + +/* DDRE */ +#define DDE0_REG DDRE +#define DDE1_REG DDRE +#define DDE2_REG DDRE + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* PORTE */ +#define PORTE0_REG PORTE +#define PORTE1_REG PORTE +#define PORTE2_REG PORTE + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR +#define SM2_REG MCUCSR + +/* TIFR */ +#define OCF0_REG TIFR +#define TOV0_REG TIFR +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* PINE */ +#define PINE0_REG PINE +#define PINE1_REG PINE +#define PINE2_REG PINE + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SRW10_REG MCUCR +#define SRE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define AD0_PORT PORTA +#define AD0_BIT 0 + +#define AD1_PORT PORTA +#define AD1_BIT 1 + +#define AD2_PORT PORTA +#define AD2_BIT 2 + +#define AD3_PORT PORTA +#define AD3_BIT 3 + +#define AD4_PORT PORTA +#define AD4_BIT 4 + +#define AD5_PORT PORTA +#define AD5_BIT 5 + +#define AD6_PORT PORTA +#define AD6_BIT 6 + +#define AD7_PORT PORTA +#define AD7_BIT 7 + +#define OC0_PORT PORTB +#define OC0_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define A8_PORT PORTC +#define A8_BIT 0 + +#define A9_PORT PORTC +#define A9_BIT 1 + +#define A10_PORT PORTC +#define A10_BIT 2 + +#define A11_PORT PORTC +#define A11_BIT 3 + +#define A12_PORT PORTC +#define A12_BIT 4 + +#define A13_PORT PORTC +#define A13_BIT 5 + +#define A14_PORT PORTC +#define A14_BIT 6 + +#define A15_PORT PORTC +#define A15_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define WR_PORT PORTD +#define WR_BIT 6 + +#define RD_PORT PORTD +#define RD_BIT 7 + +#define ICP_PORT PORTE +#define ICP_BIT 0 +#define INT2_PORT PORTE +#define INT2_BIT 0 + +#define ALE_PORT PORTE +#define ALE_BIT 1 + +#define OC1B_PORT PORTE +#define OC1B_BIT 2 + + diff --git a/aversive/parts/ATmega8535.h b/aversive/parts/ATmega8535.h new file mode 100644 index 0000000..23cae03 --- /dev/null +++ b/aversive/parts/ATmega8535.h @@ -0,0 +1,815 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE2_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM2_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define WGM01_REG TCCR0 +#define COM00_REG TCCR0 +#define COM01_REG TCCR0 +#define WGM00_REG TCCR0 +#define FOC0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT2_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF2_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ADTS0_REG SFIOR +#define ADTS1_REG SFIOR +#define ADTS2_REG SFIOR +#define PSR10_REG SFIOR +#define PSR2_REG SFIOR +#define PUD_REG SFIOR +#define ACME_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +/* #define URSEL_REG UCSRC */ /* dup in UBRRH */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH +/* #define URSEL_REG UBRRH */ /* dup in UCSRC */ + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* MCUCSR */ +#define ISC2_REG MCUCSR +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define SM2_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR0 */ +#define OCR0_0_REG OCR0 +#define OCR0_1_REG OCR0 +#define OCR0_2_REG OCR0 +#define OCR0_3_REG OCR0 +#define OCR0_4_REG OCR0 +#define OCR0_5_REG OCR0 +#define OCR0_6_REG OCR0 +#define OCR0_7_REG OCR0 + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 + +#define ADc5_PORT PORTA +#define ADc5_BIT 5 + +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define XCK_PORT PORTB +#define XCK_BIT 0 +#define T0_PORT PORTB +#define T0_BIT 0 + +#define T1_PORT PORTB +#define T1_BIT 1 + +#define AIN0_PORT PORTB +#define AIN0_BIT 2 +#define INT2_PORT PORTB +#define INT2_BIT 2 + +#define AIN1_PORT PORTB +#define AIN1_BIT 3 +#define OC0_PORT PORTB +#define OC0_BIT 3 + +#define SS_PORT PORTB +#define SS_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 + +#define SCL_PORT PORTC +#define SCL_BIT 0 + +#define SDA_PORT PORTC +#define SDA_BIT 1 + + + + + +#define TOSC1_PORT PORTC +#define TOSC1_BIT 6 + +#define TOSC2_PORT PORTC +#define TOSC2_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define OC1B_PORT PORTD +#define OC1B_BIT 4 + +#define OC1A_PORT PORTD +#define OC1A_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + +#define OC2_PORT PORTD +#define OC2_BIT 7 + + diff --git a/aversive/parts/ATmega88.h b/aversive/parts/ATmega88.h new file mode 100644 index 0000000..cb95de2 --- /dev/null +++ b/aversive/parts/ATmega88.h @@ -0,0 +1,995 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega88P.h b/aversive/parts/ATmega88P.h new file mode 100644 index 0000000..d9de6d0 --- /dev/null +++ b/aversive/parts/ATmega88P.h @@ -0,0 +1,997 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega88PA.h b/aversive/parts/ATmega88PA.h new file mode 100644 index 0000000..d9de6d0 --- /dev/null +++ b/aversive/parts/ATmega88PA.h @@ -0,0 +1,997 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE +#define TIMER2A_AVAILABLE +#define TIMER2B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE2A_NUM 4 +#define SIG_OUTPUT_COMPARE2B_NUM 5 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 6 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM2A_NUM 4 +#define PWM2B_NUM 5 +#define PWM_TOTAL_NUM 6 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* OCR2B */ +#define OCR2B_0_REG OCR2B +#define OCR2B_1_REG OCR2B +#define OCR2B_2_REG OCR2B +#define OCR2B_3_REG OCR2B +#define OCR2B_4_REG OCR2B +#define OCR2B_5_REG OCR2B +#define OCR2B_6_REG OCR2B +#define OCR2B_7_REG OCR2B + +/* OCR2A */ +#define OCR2A_0_REG OCR2A +#define OCR2A_1_REG OCR2A +#define OCR2A_2_REG OCR2A +#define OCR2A_3_REG OCR2A +#define OCR2A_4_REG OCR2A +#define OCR2A_5_REG OCR2A +#define OCR2A_6_REG OCR2A +#define OCR2A_7_REG OCR2A + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* PRR */ +#define PRADC_REG PRR +#define PRUSART0_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTIM2_REG PRR +#define PRTWI_REG PRR + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* UCSR0A */ +#define MPCM0_REG UCSR0A +#define U2X0_REG UCSR0A +#define UPE0_REG UCSR0A +#define DOR0_REG UCSR0A +#define FE0_REG UCSR0A +#define UDRE0_REG UCSR0A +#define TXC0_REG UCSR0A +#define RXC0_REG UCSR0A + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* UCSR0B */ +#define TXB80_REG UCSR0B +#define RXB80_REG UCSR0B +#define UCSZ02_REG UCSR0B +#define TXEN0_REG UCSR0B +#define RXEN0_REG UCSR0B +#define UDRIE0_REG UCSR0B +#define TXCIE0_REG UCSR0B +#define RXCIE0_REG UCSR0B + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* UDR0 */ +#define UDR0_0_REG UDR0 +#define UDR0_1_REG UDR0 +#define UDR0_2_REG UDR0 +#define UDR0_3_REG UDR0 +#define UDR0_4_REG UDR0 +#define UDR0_5_REG UDR0 +#define UDR0_6_REG UDR0 +#define UDR0_7_REG UDR0 + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 + +/* ASSR */ +#define TCR2BUB_REG ASSR +#define TCR2AUB_REG ASSR +#define OCR2BUB_REG ASSR +#define OCR2AUB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR +#define EXCLK_REG ASSR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* TIFR2 */ +#define TOV2_REG TIFR2 +#define OCF2A_REG TIFR2 +#define OCF2B_REG TIFR2 + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR +#define PSRASY_REG GTCCR + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCCR2A */ +#define WGM20_REG TCCR2A +#define WGM21_REG TCCR2A +#define COM2B0_REG TCCR2A +#define COM2B1_REG TCCR2A +#define COM2A0_REG TCCR2A +#define COM2A1_REG TCCR2A + +/* TCCR2B */ +#define CS20_REG TCCR2B +#define CS21_REG TCCR2B +#define CS22_REG TCCR2B +#define WGM22_REG TCCR2B +#define FOC2B_REG TCCR2B +#define FOC2A_REG TCCR2B + +/* UBRR0H */ +#define UBRR8_REG UBRR0H +#define UBRR9_REG UBRR0H +#define UBRR10_REG UBRR0H +#define UBRR11_REG UBRR0H + +/* UBRR0L */ +#define UBRR0_REG UBRR0L +#define UBRR1_REG UBRR0L +#define UBRR2_REG UBRR0L +#define UBRR3_REG UBRR0L +#define UBRR4_REG UBRR0L +#define UBRR5_REG UBRR0L +#define UBRR6_REG UBRR0L +#define UBRR7_REG UBRR0L + +/* EEARH */ +#define EEAR8_REG EEARH + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* MCUCR */ +#define IVCE_REG MCUCR +#define IVSEL_REG MCUCR +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCROA_0_REG OCR0A +#define OCROA_1_REG OCR0A +#define OCROA_2_REG OCR0A +#define OCROA_3_REG OCR0A +#define OCROA_4_REG OCR0A +#define OCROA_5_REG OCR0A +#define OCROA_6_REG OCR0A +#define OCROA_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* UCSR0C */ +#define UCPOL0_REG UCSR0C +#define UCSZ00_REG UCSR0C +#define UCSZ01_REG UCSR0C +#define USBS0_REG UCSR0C +#define UPM00_REG UCSR0C +#define UPM01_REG UCSR0C +#define UMSEL00_REG UCSR0C +#define UMSEL01_REG UCSR0C + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define BLBSET_REG SPMCSR +#define RWWSRE_REG SPMCSR +#define RWWSB_REG SPMCSR +#define SPMIE_REG SPMCSR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TIMSK2 */ +#define TOIE2_REG TIMSK2 +#define OCIE2A_REG TIMSK2 +#define OCIE2B_REG TIMSK2 + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATmega8A.h b/aversive/parts/ATmega8A.h new file mode 100644 index 0000000..9717237 --- /dev/null +++ b/aversive/parts/ATmega8A.h @@ -0,0 +1,745 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + +/* prescalers timer 2 */ +#define TIMER2_PRESCALER_DIV_0 0 +#define TIMER2_PRESCALER_DIV_1 1 +#define TIMER2_PRESCALER_DIV_8 2 +#define TIMER2_PRESCALER_DIV_32 3 +#define TIMER2_PRESCALER_DIV_64 4 +#define TIMER2_PRESCALER_DIV_128 5 +#define TIMER2_PRESCALER_DIV_256 6 +#define TIMER2_PRESCALER_DIV_1024 7 + +#define TIMER2_PRESCALER_REG_0 0 +#define TIMER2_PRESCALER_REG_1 1 +#define TIMER2_PRESCALER_REG_2 8 +#define TIMER2_PRESCALER_REG_3 32 +#define TIMER2_PRESCALER_REG_4 64 +#define TIMER2_PRESCALER_REG_5 128 +#define TIMER2_PRESCALER_REG_6 256 +#define TIMER2_PRESCALER_REG_7 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE +#define TIMER2_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW2_NUM 2 +#define SIG_OVERFLOW_TOTAL_NUM 3 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1A_NUM 0 +#define SIG_OUTPUT_COMPARE1B_NUM 1 +#define SIG_OUTPUT_COMPARE2_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM1A_NUM 0 +#define PWM1B_NUM 1 +#define PWM2_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* GICR */ +#define IVCE_REG GICR +#define IVSEL_REG GICR +#define INT0_REG GICR +#define INT1_REG GICR + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TICIE1_REG TIMSK +#define TOIE2_REG TIMSK +#define OCIE2_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADFR_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* SFIOR */ +#define ACME_REG SFIOR +#define PSR2_REG SFIOR +#define PSR10_REG SFIOR +#define PUD_REG SFIOR +#define ADHSM_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC +#define URSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* SPMCR */ +#define SPMEN_REG SPMCR +#define PGERS_REG SPMCR +#define PGWRT_REG SPMCR +#define BLBSET_REG SPMCR +#define RWWSRE_REG SPMCR +#define RWWSB_REG SPMCR +#define SPMIE_REG SPMCR + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* MCUCSR */ +#define PORF_REG MCUCSR +#define EXTRF_REG MCUCSR +#define BORF_REG MCUCSR +#define WDRF_REG MCUCSR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* TCCR2 */ +#define CS20_REG TCCR2 +#define CS21_REG TCCR2 +#define CS22_REG TCCR2 +#define WGM21_REG TCCR2 +#define COM20_REG TCCR2 +#define COM21_REG TCCR2 +#define WGM20_REG TCCR2 +#define FOC2_REG TCCR2 + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define ICF1_REG TIFR +#define TOV2_REG TIFR +#define OCF2_REG TIFR + +/* EEARH */ +#define EEAR8_REG EEARH + +/* TCNT2 */ +#define TCNT2_0_REG TCNT2 +#define TCNT2_1_REG TCNT2 +#define TCNT2_2_REG TCNT2 +#define TCNT2_3_REG TCNT2 +#define TCNT2_4_REG TCNT2 +#define TCNT2_5_REG TCNT2 +#define TCNT2_6_REG TCNT2 +#define TCNT2_7_REG TCNT2 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SM2_REG MCUCR +#define SE_REG MCUCR + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* ASSR */ +#define TCR2UB_REG ASSR +#define OCR2UB_REG ASSR +#define TCN2UB_REG ASSR +#define AS2_REG ASSR + +/* OCR2 */ +#define OCR2_0_REG OCR2 +#define OCR2_1_REG OCR2 +#define OCR2_2_REG OCR2 +#define OCR2_3_REG OCR2 +#define OCR2_4_REG OCR2 +#define OCR2_5_REG OCR2 +#define OCR2_6_REG OCR2 +#define OCR2_7_REG OCR2 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* pins mapping */ +#define ICP_PORT PORTB +#define ICP_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2_PORT PORTB +#define OC2_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 + +#define IN1_PORT PORTD +#define IN1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 + + diff --git a/aversive/parts/ATtiny10.h b/aversive/parts/ATtiny10.h new file mode 100644 index 0000000..2300581 --- /dev/null +++ b/aversive/parts/ATtiny10.h @@ -0,0 +1,376 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPSR */ +#define CLKPS0_REG CLKPSR +#define CLKPS1_REG CLKPSR +#define CLKPS2_REG CLKPSR +#define CLKPS3_REG CLKPSR + +/* VLMCSR */ +#define VLM0_REG VLMCSR +#define VLM1_REG VLMCSR +#define VLMIE_REG VLMCSR +#define VLMF_REG VLMCSR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX + +/* TCNT0H */ +#define TCNT0_8_REG TCNT0H +#define TCNT0_9_REG TCNT0H +#define TCNT0_10_REG TCNT0H +#define TCNT0_11_REG TCNT0H +#define TCNT0_12_REG TCNT0H +#define TCNT0_13_REG TCNT0H +#define TCNT0_14_REG TCNT0H +#define TCNT0_15_REG TCNT0H + +/* PORTCR */ +#define BBMB_REG PORTCR + +/* CCP */ +#define CCP0_REG CCP +#define CCP1_REG CCP +#define CCP2_REG CCP +#define CCP3_REG CCP +#define CCP4_REG CCP +#define CCP5_REG CCP +#define CCP6_REG CCP +#define CCP7_REG CCP + +/* TCNT0L */ +#define TCNT0_0_REG TCNT0L +#define TCNT0_1_REG TCNT0L +#define TCNT0_2_REG TCNT0L +#define TCNT0_3_REG TCNT0L +#define TCNT0_4_REG TCNT0L +#define TCNT0_5_REG TCNT0L +#define TCNT0_6_REG TCNT0L +#define TCNT0_7_REG TCNT0L + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* GTCCR */ +#define PSR_REG GTCCR +#define TSM_REG GTCCR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB + +/* RSTFLR */ +#define PORF_REG RSTFLR +#define EXTRF_REG RSTFLR +#define WDRF_REG RSTFLR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PCIFR */ +#define PCIF0_REG PCIFR + +/* PRR */ +#define PRTIM0_REG PRR +#define PRADC_REG PRR + +/* OCR0BL */ +#define OCR0B0_REG OCR0BL +#define OCR0B1_REG OCR0BL +#define OCR0B2_REG OCR0BL +#define OCR0B3_REG OCR0BL +#define OCR0B4_REG OCR0BL +#define OCR0B5_REG OCR0BL +#define OCR0B6_REG OCR0BL +#define OCR0B7_REG OCR0BL + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK + +/* ADCL */ +#define ADC0_REG ADCL +#define ADC1_REG ADCL +#define ADC2_REG ADCL +#define ADC3_REG ADCL +#define ADC4_REG ADCL +#define ADC5_REG ADCL +#define ADC6_REG ADCL +#define ADC7_REG ADCL + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR +#define SM2_REG SMCR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB + +/* PCICR */ +#define PCIE0_REG PCICR + +/* NVMCSR */ +#define NVMBSY_REG NVMCSR + +/* EIMSK */ +#define INT0_REG EIMSK + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 +#define ICIE0_REG TIMSK0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define WGM03_REG TCCR0B +#define ICES0_REG TCCR0B +#define ICNC0_REG TCCR0B + +/* TCCR0C */ +#define FOC0B_REG TCCR0C +#define FOC0A_REG TCCR0C + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* CLKMSR */ +#define CLKMS0_REG CLKMSR +#define CLKMS1_REG CLKMSR + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB + +/* EIFR */ +#define INTF0_REG EIFR + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 + +/* OCR0AL */ +#define OCR0A0_REG OCR0AL +#define OCR0A1_REG OCR0AL +#define OCR0A2_REG OCR0AL +#define OCR0A3_REG OCR0AL +#define OCR0A4_REG OCR0AL +#define OCR0A5_REG OCR0AL +#define OCR0A6_REG OCR0AL +#define OCR0A7_REG OCR0AL + +/* NVMCMD */ +#define NVMCMD0_REG NVMCMD +#define NVMCMD1_REG NVMCMD +#define NVMCMD2_REG NVMCMD +#define NVMCMD3_REG NVMCMD +#define NVMCMD4_REG NVMCMD +#define NVMCMD5_REG NVMCMD + +/* ICR0L */ +#define ICR0_0_REG ICR0L +#define ICR0_1_REG ICR0L +#define ICR0_2_REG ICR0L +#define ICR0_3_REG ICR0L +#define ICR0_4_REG ICR0L +#define ICR0_5_REG ICR0L +#define ICR0_6_REG ICR0L +#define ICR0_7_REG ICR0L + +/* OCR0AH */ +#define OCR0A8_REG OCR0AH +#define OCR0A9_REG OCR0AH +#define OCR0A10_REG OCR0AH +#define OCR0A11_REG OCR0AH +#define OCR0A12_REG OCR0AH +#define OCR0A13_REG OCR0AH +#define OCR0A14_REG OCR0AH +#define OCR0A15_REG OCR0AH + +/* ICR0H */ +#define ICR0_8_REG ICR0H +#define ICR0_9_REG ICR0H +#define ICR0_10_REG ICR0H +#define ICR0_11_REG ICR0H +#define ICR0_12_REG ICR0H +#define ICR0_13_REG ICR0H +#define ICR0_14_REG ICR0H +#define ICR0_15_REG ICR0H + +/* PUEB */ +#define PUEB0_REG PUEB +#define PUEB1_REG PUEB +#define PUEB2_REG PUEB +#define PUEB3_REG PUEB + +/* OCR0BH */ +#define OCR0B8_REG OCR0BH +#define OCR0B9_REG OCR0BH +#define OCR0B10_REG OCR0BH +#define OCR0B11_REG OCR0BH +#define OCR0B12_REG OCR0BH +#define OCR0B13_REG OCR0BH +#define OCR0B14_REG OCR0BH +#define OCR0B15_REG OCR0BH + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 +#define ICF0_REG TIFR0 + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny11.h b/aversive/parts/ATtiny11.h new file mode 100644 index 0000000..7dd6238 --- /dev/null +++ b/aversive/parts/ATtiny11.h @@ -0,0 +1,171 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* pins mapping */ +#define AIN0_PORT PORTB +#define AIN0_BIT 0 + +#define INT0_PORT PORTB +#define INT0_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 + +#define T0_PORT PORTB +#define T0_BIT 2 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 3 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 4 + +#define RESET_PORT PORTB +#define RESET_BIT 5 + + diff --git a/aversive/parts/ATtiny12.h b/aversive/parts/ATtiny12.h new file mode 100644 index 0000000..df71674 --- /dev/null +++ b/aversive/parts/ATtiny12.h @@ -0,0 +1,207 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define AINBG_REG ACSR +#define ACD_REG ACSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 + +#define CLOCK_PORT PORTB +#define CLOCK_BIT 3 + + + diff --git a/aversive/parts/ATtiny13.h b/aversive/parts/ATtiny13.h new file mode 100644 index 0000000..0c1eaeb --- /dev/null +++ b/aversive/parts/ATtiny13.h @@ -0,0 +1,360 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDTIE_REG WDTCR +#define WDTIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCR0A_0_REG OCR0A +#define OCR0A_1_REG OCR0A +#define OCR0A_2_REG OCR0A +#define OCR0A_3_REG OCR0A +#define OCR0A_4_REG OCR0A +#define OCR0A_5_REG OCR0A +#define OCR0A_6_REG OCR0A +#define OCR0A_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* DIDR0 */ +#define ADC1D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC0D_REG DIDR0 +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define OC0A_PORT PORTB +#define OC0A_BIT 0 +#define TXD_PORT PORTB +#define TXD_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OC0B_PORT PORTB +#define OC0B_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 +#define RXD_PORT PORTB +#define RXD_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + + diff --git a/aversive/parts/ATtiny13A.h b/aversive/parts/ATtiny13A.h new file mode 100644 index 0000000..076baae --- /dev/null +++ b/aversive/parts/ATtiny13A.h @@ -0,0 +1,368 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDTIE_REG WDTCR +#define WDTIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* OCR0A */ +#define OCR0A_0_REG OCR0A +#define OCR0A_1_REG OCR0A +#define OCR0A_2_REG OCR0A +#define OCR0A_3_REG OCR0A +#define OCR0A_4_REG OCR0A +#define OCR0A_5_REG OCR0A +#define OCR0A_6_REG OCR0A +#define OCR0A_7_REG OCR0A + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRTIM0_REG PRR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* BODCR */ +#define BPDSE_REG BODCR +#define BPDS_REG BODCR + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* DIDR0 */ +#define ADC1D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC0D_REG DIDR0 +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define OC0A_PORT PORTB +#define OC0A_BIT 0 +#define TXD_PORT PORTB +#define TXD_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OC0B_PORT PORTB +#define OC0B_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 +#define RXD_PORT PORTB +#define RXD_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + + diff --git a/aversive/parts/ATtiny15.h b/aversive/parts/ATtiny15.h new file mode 100644 index 0000000..43acbd6 --- /dev/null +++ b/aversive/parts/ATtiny15.h @@ -0,0 +1,351 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_-3 1 +#define TIMER1_PRESCALER_DIV_-3 2 +#define TIMER1_PRESCALER_DIV_-3 3 +#define TIMER1_PRESCALER_DIV_-3 4 +#define TIMER1_PRESCALER_DIV_1 5 +#define TIMER1_PRESCALER_DIV_2 6 +#define TIMER1_PRESCALER_DIV_4 7 +#define TIMER1_PRESCALER_DIV_8 8 +#define TIMER1_PRESCALER_DIV_16 9 +#define TIMER1_PRESCALER_DIV_32 10 +#define TIMER1_PRESCALER_DIV_64 11 +#define TIMER1_PRESCALER_DIV_128 12 +#define TIMER1_PRESCALER_DIV_256 13 +#define TIMER1_PRESCALER_DIV_512 14 +#define TIMER1_PRESCALER_DIV_1024 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 -3 +#define TIMER1_PRESCALER_REG_2 -3 +#define TIMER1_PRESCALER_REG_3 -3 +#define TIMER1_PRESCALER_REG_4 -3 +#define TIMER1_PRESCALER_REG_5 1 +#define TIMER1_PRESCALER_REG_6 2 +#define TIMER1_PRESCALER_REG_7 4 +#define TIMER1_PRESCALER_REG_8 8 +#define TIMER1_PRESCALER_REG_9 16 +#define TIMER1_PRESCALER_REG_10 32 +#define TIMER1_PRESCALER_REG_11 64 +#define TIMER1_PRESCALER_REG_12 128 +#define TIMER1_PRESCALER_REG_13 256 +#define TIMER1_PRESCALER_REG_14 512 +#define TIMER1_PRESCALER_REG_15 1024 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE1_NUM 0 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 1 + +/* Pwm nums */ +#define PWM1_NUM 0 +#define PWM_TOTAL_NUM 1 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR1 */ +#define CS10_REG TCCR1 +#define CS11_REG TCCR1 +#define CS12_REG TCCR1 +#define CS13_REG TCCR1 +#define COM1A0_REG TCCR1 +#define COM1A1_REG TCCR1 +#define PWM1_REG TCCR1 +#define CTC1_REG TCCR1 + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1A_REG TIMSK + +/* SFIOR */ +#define PSR0_REG SFIOR +#define PSR1_REG SFIOR +#define FOC1A_REG SFIOR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1A_REG TIFR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define AREF_PORT PORTB +#define AREF_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OCP_PORT PORTB +#define OCP_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 + +#define ADC2_PORT PORTB +#define ADC2_BIT 3 + +#define ADC3_PORT PORTB +#define ADC3_BIT 4 + +#define RESET_PORT PORTB +#define RESET_BIT 5 +#define ADC0_PORT PORTB +#define ADC0_BIT 5 + + diff --git a/aversive/parts/ATtiny167.h b/aversive/parts/ATtiny167.h new file mode 100644 index 0000000..c8a7266 --- /dev/null +++ b/aversive/parts/ATtiny167.h @@ -0,0 +1,797 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_32 3 +#define TIMER0_PRESCALER_DIV_64 4 +#define TIMER0_PRESCALER_DIV_128 5 +#define TIMER0_PRESCALER_DIV_256 6 +#define TIMER0_PRESCALER_DIV_1024 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 32 +#define TIMER0_PRESCALER_REG_4 64 +#define TIMER0_PRESCALER_REG_5 128 +#define TIMER0_PRESCALER_REG_6 256 +#define TIMER0_PRESCALER_REG_7 1024 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE1A_NUM 1 +#define SIG_OUTPUT_COMPARE1B_NUM 2 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 3 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM1A_NUM 1 +#define PWM1B_NUM 2 +#define PWM_TOTAL_NUM 3 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* LINIDR */ +#define LID0_REG LINIDR +#define LID1_REG LINIDR +#define LID2_REG LINIDR +#define LID3_REG LINIDR +#define LID4_REG LINIDR +#define LID5_REG LINIDR +#define LP0_REG LINIDR +#define LP1_REG LINIDR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR + +/* LINBTR */ +#define LBT0_REG LINBTR +#define LBT1_REG LINBTR +#define LBT2_REG LINBTR +#define LBT3_REG LINBTR +#define LBT4_REG LINBTR +#define LBT5_REG LINBTR +#define LDISR_REG LINBTR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* PORTCR */ +#define PUDA_REG PORTCR +#define PUDB_REG PORTCR +#define BBMA_REG PORTCR +#define BBMB_REG PORTCR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* AMISCR */ +#define XREFEN_REG AMISCR +#define AREFEN_REG AMISCR +#define ISRCEN_REG AMISCR + +/* CLKSELR */ +#define CSEL0_REG CLKSELR +#define CSEL1_REG CLKSELR +#define CSEL2_REG CLKSELR +#define CSEL3_REG CLKSELR +#define CSUT0_REG CLKSELR +#define CSUT1_REG CLKSELR +#define COUT_REG CLKSELR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TCCR1D */ +#define OC1AU_REG TCCR1D +#define OC1AV_REG TCCR1D +#define OC1AW_REG TCCR1D +#define OC1AX_REG TCCR1D +#define OC1BU_REG TCCR1D +#define OC1BV_REG TCCR1D +#define OC1BW_REG TCCR1D +#define OC1BX_REG TCCR1D + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* LINSEL */ +#define LINDX0_REG LINSEL +#define LINDX1_REG LINSEL +#define LINDX2_REG LINSEL +#define LAINC_REG LINSEL + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* LINCR */ +#define LCMD0_REG LINCR +#define LCMD1_REG LINCR +#define LCMD2_REG LINCR +#define LENA_REG LINCR +#define LCONF0_REG LINCR +#define LCONF1_REG LINCR +#define LIN13_REG LINCR +#define LSWRES_REG LINCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* GTCCR */ +#define PSR1_REG GTCCR +#define PSR0_REG GTCCR +#define TSM_REG GTCCR + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define BIN_REG ADCSRB +#define ACIR0_REG ADCSRB +#define ACIR1_REG ADCSRB +#define ACME_REG ADCSRB + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OCR0A */ +#define OCR00_REG OCR0A +#define OCR01_REG OCR0A +#define OCR02_REG OCR0A +#define OCR03_REG OCR0A +#define OCR04_REG OCR0A +#define OCR05_REG OCR0A +#define OCR06_REG OCR0A +#define OCR07_REG OCR0A + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACIRS_REG ACSR +#define ACD_REG ACSR + +/* USIPP */ +#define USIPOS_REG USIPP + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR +#define PRSPI_REG PRR +#define PRLIN_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR +#define SIGRD_REG SPMCSR +#define RWWSB_REG SPMCSR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* LINBRRL */ +#define LDIV0_REG LINBRRL +#define LDIV1_REG LINBRRL +#define LDIV2_REG LINBRRL +#define LDIV3_REG LINBRRL +#define LDIV4_REG LINBRRL +#define LDIV5_REG LINBRRL +#define LDIV6_REG LINBRRL +#define LDIV7_REG LINBRRL + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR + +/* LINBRRH */ +#define LDIV8_REG LINBRRH +#define LDIV9_REG LINBRRH +#define LDIV10_REG LINBRRH +#define LDIV11_REG LINBRRH + +/* LINDAT */ +#define LDATA0_REG LINDAT +#define LDATA1_REG LINDAT +#define LDATA2_REG LINDAT +#define LDATA3_REG LINDAT +#define LDATA4_REG LINDAT +#define LDATA5_REG LINDAT +#define LDATA6_REG LINDAT +#define LDATA7_REG LINDAT + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* LINENIR */ +#define LENRXOK_REG LINENIR +#define LENTXOK_REG LINENIR +#define LENIDOK_REG LINENIR +#define LENERR_REG LINENIR + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* LINERR */ +#define LBERR_REG LINERR +#define LCERR_REG LINERR +#define LPERR_REG LINERR +#define LSERR_REG LINERR +#define LFERR_REG LINERR +#define LOVERR_REG LINERR +#define LTOERR_REG LINERR +#define LABORT_REG LINERR + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* LINDLR */ +#define LRXDL0_REG LINDLR +#define LRXDL1_REG LINDLR +#define LRXDL2_REG LINDLR +#define LRXDL3_REG LINDLR +#define LTXDL0_REG LINDLR +#define LTXDL1_REG LINDLR +#define LTXDL2_REG LINDLR +#define LTXDL3_REG LINDLR + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* LINSIR */ +#define LRXOK_REG LINSIR +#define LTXOK_REG LINSIR +#define LIDOK_REG LINSIR +#define LERR_REG LINSIR +#define LBUSY_REG LINSIR +#define LIDST0_REG LINSIR +#define LIDST1_REG LINSIR +#define LIDST2_REG LINSIR + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 + +/* CLKCSR */ +#define CLKC0_REG CLKCSR +#define CLKC1_REG CLKCSR +#define CLKC2_REG CLKCSR +#define CLKC3_REG CLKCSR +#define CLKRDY_REG CLKCSR +#define CLKCCE_REG CLKCSR + +/* MCUCR */ +#define PUD_REG MCUCR +#define BODS_REG MCUCR +#define BODSE_REG MCUCR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* ASSR */ +#define TCR0BUB_REG ASSR +#define TCR0AUB_REG ASSR +#define OCR0AUB_REG ASSR +#define TCN0UB_REG ASSR +#define AS0_REG ASSR +#define EXCLK_REG ASSR + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny22.h b/aversive/parts/ATtiny22.h new file mode 100644 index 0000000..ff39c90 --- /dev/null +++ b/aversive/parts/ATtiny22.h @@ -0,0 +1,186 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* TIMSK */ +#define TOIE0_REG TIMSK + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR +#define EEAR7_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM_REG MCUCR +#define SE_REG MCUCR + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TIFR */ +#define TOV0_REG TIFR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define INT0_PORT PORTB +#define INT0_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 + +#define CLOCK_PORT PORTB +#define CLOCK_BIT 3 + + + diff --git a/aversive/parts/ATtiny2313.h b/aversive/parts/ATtiny2313.h new file mode 100644 index 0000000..b7a1507 --- /dev/null +++ b/aversive/parts/ATtiny2313.h @@ -0,0 +1,641 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* DIDR */ +#define AIN0D_REG DIDR +#define AIN1D_REG DIDR + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* GTCCR */ +#define PSR10_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* TIMSK */ +#define OCIE0A_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define ICIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define TOIE1_REG TIMSK + +/* UCSRA */ +#define MPCM_REG UCSRA +#define U2X_REG UCSRA +#define UPE_REG UCSRA +#define DOR_REG UCSRA +#define FE_REG UCSRA +#define UDRE_REG UCSRA +#define TXC_REG UCSRA +#define RXC_REG UCSRA + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* UCSRB */ +#define TXB8_REG UCSRB +#define RXB8_REG UCSRB +#define UCSZ2_REG UCSRB +#define TXEN_REG UCSRB +#define RXEN_REG UCSRB +#define UDRIE_REG UCSRB +#define TXCIE_REG UCSRB +#define RXCIE_REG UCSRB + +/* UCSRC */ +#define UCPOL_REG UCSRC +#define UCSZ0_REG UCSRC +#define UCSZ1_REG UCSRC +#define USBS_REG UCSRC +#define UPM0_REG UCSRC +#define UPM1_REG UCSRC +#define UMSEL_REG UCSRC + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* UBRRH */ +#define UBRR8_REG UBRRH +#define UBRR9_REG UBRRH +#define UBRR10_REG UBRRH +#define UBRR11_REG UBRRH + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* UBRRL */ +#define UBRR0_REG UBRRL +#define UBRR1_REG UBRRL +#define UBRR2_REG UBRRL +#define UBRR3_REG UBRRL +#define UBRR4_REG UBRRL +#define UBRR5_REG UBRRL +#define UBRR6_REG UBRRL +#define UBRR7_REG UBRRL + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK +#define PCINT6_REG PCMSK +#define PCINT7_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TIFR */ +#define OCF0A_REG TIFR +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define ICF1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define TOV1_REG TIFR + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* UDR */ +#define UDR0_REG UDR +#define UDR1_REG UDR +#define UDR2_REG UDR +#define UDR3_REG UDR +#define UDR4_REG UDR +#define UDR5_REG UDR +#define UDR6_REG UDR +#define UDR7_REG UDR + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* EIFR */ +#define PCIF_REG EIFR +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define ISC10_REG MCUCR +#define ISC11_REG MCUCR +#define SM0_REG MCUCR +#define SE_REG MCUCR +#define SM1_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ +#define AIN0_PORT PORTB +#define AIN0_BIT 0 + +#define AIN1_PORT PORTB +#define AIN1_BIT 1 + +#define OC0A_PORT PORTB +#define OC0A_BIT 2 + +#define OC1A_PORT PORTB +#define OC1A_BIT 3 + +#define OC1B_PORT PORTB +#define OC1B_BIT 4 + +#define MOSI_PORT PORTB +#define MOSI_BIT 5 +#define DI_PORT PORTB +#define DI_BIT 5 + +#define MISO_PORT PORTB +#define MISO_BIT 6 +#define DO_PORT PORTB +#define DO_BIT 6 + +#define SCK_PORT PORTB +#define SCK_BIT 7 +#define SCL_PORT PORTB +#define SCL_BIT 7 + +#define RXD_PORT PORTD +#define RXD_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define XCK_PORT PORTD +#define XCK_BIT 2 +#define CKOUT_PORT PORTD +#define CKOUT_BIT 2 + +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define T0_PORT PORTD +#define T0_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 + +#define ICP_PORT PORTD +#define ICP_BIT 6 + + diff --git a/aversive/parts/ATtiny24.h b/aversive/parts/ATtiny24.h new file mode 100644 index 0000000..2614cfa --- /dev/null +++ b/aversive/parts/ATtiny24.h @@ -0,0 +1,670 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define MUX5_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADLAR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define AREF_PORT PORTA +#define AREF_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define AIN0_PORT PORTA +#define AIN0_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define AIN1_PORT PORTA +#define AIN1_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define T0_PORT PORTA +#define T0_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define USCK_PORT PORTA +#define USCK_BIT 4 +#define SCL_PORT PORTA +#define SCL_BIT 4 +#define T1_PORT PORTA +#define T1_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define DO_PORT PORTA +#define DO_BIT 5 +#define MISO_PORT PORTA +#define MISO_BIT 5 +#define OC1B_PORT PORTA +#define OC1B_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 +#define OC1A_PORT PORTA +#define OC1A_BIT 6 +#define DI_PORT PORTA +#define DI_BIT 6 +#define SDA_PORT PORTA +#define SDA_BIT 6 +#define MOSI_PORT PORTA +#define MOSI_BIT 6 +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 +#define ICP1_PORT PORTA +#define ICP1_BIT 7 +#define OC0B_PORT PORTA +#define OC0B_BIT 7 +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define PCINT8_PORT PORTB +#define PCINT8_BIT 0 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 0 + +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 1 + +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define OC0A_PORT PORTB +#define OC0A_BIT 2 +#define CKOUT_PORT PORTB +#define CKOUT_BIT 2 + +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 +#define RESET_PORT PORTB +#define RESET_BIT 3 +#define dW_PORT PORTB +#define dW_BIT 3 + + diff --git a/aversive/parts/ATtiny25.h b/aversive/parts/ATtiny25.h new file mode 100644 index 0000000..b838579 --- /dev/null +++ b/aversive/parts/ATtiny25.h @@ -0,0 +1,628 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* DIDR0 */ +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC0D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define REFS2_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR1 */ +#define CS10_REG TCCR1 +#define CS11_REG TCCR1 +#define CS12_REG TCCR1 +#define CS13_REG TCCR1 +#define COM1A0_REG TCCR1 +#define COM1A1_REG TCCR1 +#define PWM1A_REG TCCR1 +#define CTC1_REG TCCR1 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* GTCCR */ +#define PSR0_REG GTCCR +#define TSM_REG GTCCR +#define PSR1_REG GTCCR +#define FOC1A_REG GTCCR +#define FOC1B_REG GTCCR +#define COM1B0_REG GTCCR +#define COM1B1_REG GTCCR +#define PWM1B_REG GTCCR + +/* DTPS */ +#define DTPS0_REG DTPS +#define DTPS1_REG DTPS + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* DT1B */ +/* #define DTVL0_REG DT1B */ /* dup in DT1A */ +/* #define DTVL1_REG DT1B */ /* dup in DT1A */ +/* #define DTVL2_REG DT1B */ /* dup in DT1A */ +/* #define DTVL3_REG DT1B */ /* dup in DT1A */ +/* #define DTVH0_REG DT1B */ /* dup in DT1A */ +/* #define DTVH1_REG DT1B */ /* dup in DT1A */ +/* #define DTVH2_REG DT1B */ /* dup in DT1A */ +/* #define DTVH3_REG DT1B */ /* dup in DT1A */ + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define IPR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +#define OCR1C7_REG OCR1C + +/* DT1A */ +/* #define DTVL0_REG DT1A */ /* dup in DT1B */ +/* #define DTVL1_REG DT1A */ /* dup in DT1B */ +/* #define DTVL2_REG DT1A */ /* dup in DT1B */ +/* #define DTVL3_REG DT1A */ /* dup in DT1B */ +/* #define DTVH0_REG DT1A */ /* dup in DT1B */ +/* #define DTVH1_REG DT1A */ /* dup in DT1B */ +/* #define DTVH2_REG DT1A */ /* dup in DT1B */ +/* #define DTVH3_REG DT1A */ /* dup in DT1B */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define DI_PORT PORTB +#define DI_BIT 0 +#define SDA_PORT PORTB +#define SDA_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define OC0A_PORT PORTB +#define OC0A_BIT 0 +#define OC1A_PORT PORTB +#define OC1A_BIT 0 +#define AREF_PORT PORTB +#define AREF_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define DO_PORT PORTB +#define DO_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OC0B_PORT PORTB +#define OC0B_BIT 1 +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define USCK_PORT PORTB +#define USCK_BIT 2 +#define SCL_PORT PORTB +#define SCL_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTB +#define ADC3_BIT 3 +#define OC1B_PORT PORTB +#define OC1B_BIT 3 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 3 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 3 + +#define ADC2_PORT PORTB +#define ADC2_BIT 4 +#define OC1B_PORT PORTB +#define OC1B_BIT 4 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 4 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 4 + +#define RESET_PORT PORTB +#define RESET_BIT 5 +#define ADC0_PORT PORTB +#define ADC0_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 +#define dW_PORT PORTB +#define dW_BIT 5 + + diff --git a/aversive/parts/ATtiny26.h b/aversive/parts/ATtiny26.h new file mode 100644 index 0000000..18c9890 --- /dev/null +++ b/aversive/parts/ATtiny26.h @@ -0,0 +1,418 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER1_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define PSR0_REG TCCR0 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* TCCR1A */ +#define PWM1B_REG TCCR1A +#define PWM1A_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CS13_REG TCCR1B +#define PSR1_REG TCCR1B +#define CTC1_REG TCCR1B + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACME_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEWE_REG EECR +#define EEMWE_REG EECR +#define EERIE_REG EECR + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR +#define EEAR6_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TIFR */ +#define TOV0_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR + +/* ADCSR */ +#define ADPS0_REG ADCSR +#define ADPS1_REG ADCSR +#define ADPS2_REG ADCSR +#define ADIE_REG ADCSR +#define ADIF_REG ADCSR +#define ADFR_REG ADCSR +#define ADSC_REG ADCSR +#define ADEN_REG ADCSR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* SP */ +#define SP0_REG SP +#define SP1_REG SP +#define SP2_REG SP +#define SP3_REG SP +#define SP4_REG SP +#define SP5_REG SP +#define SP6_REG SP +#define SP7_REG SP + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +#define OCR1C7_REG OCR1C + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny261.h b/aversive/parts/ATtiny261.h new file mode 100644 index 0000000..deae71d --- /dev/null +++ b/aversive/parts/ATtiny261.h @@ -0,0 +1,671 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1_NUM 2 +#define SIG_OUTPUT_COMPARE1A_NUM 3 +#define SIG_OUTPUT_COMPARE1B_NUM 4 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 5 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1_NUM 2 +#define PWM1A_NUM 3 +#define PWM1B_NUM 4 +#define PWM_TOTAL_NUM 5 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE0_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define AREFD_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCNT0H */ +/* #define TCNT0_0_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_1_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_2_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_3_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_4_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_5_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_6_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_7_REG TCNT0H */ /* dup in TCNT0L */ + +/* TCNT0L */ +/* #define TCNT0_0_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_1_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_2_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_3_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_4_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_5_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_6_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_7_REG TCNT0L */ /* dup in TCNT0H */ + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TCCR1D */ +#define WGM10_REG TCCR1D +#define WGM11_REG TCCR1D +#define FPF1_REG TCCR1D +#define FPAC1_REG TCCR1D +#define FPES1_REG TCCR1D +#define FPNC1_REG TCCR1D +#define FPEN1_REG TCCR1D +#define FPIE1_REG TCCR1D + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* TCCR1A */ +#define PWM1B_REG TCCR1A +#define PWM1A_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define PWM1D_REG TCCR1C +#define FOC1D_REG TCCR1C +#define COM1D0_REG TCCR1C +#define COM1D1_REG TCCR1C +#define COM1B0S_REG TCCR1C +#define COM1B1S_REG TCCR1C +#define COM1A0S_REG TCCR1C +#define COM1A1S_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CS13_REG TCCR1B +#define DTPS10_REG TCCR1B +#define DTPS11_REG TCCR1B +#define PSR1_REG TCCR1B + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define OCIE1D_REG TIMSK + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ACSRB */ +#define ACM0_REG ACSRB +#define ACM1_REG ACSRB +#define ACM2_REG ACSRB +#define HLEV_REG ACSRB +#define HSEL_REG ACSRB + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB +#define REFS2_REG ADCSRB +#define IPR_REG ADCSRB +#define GSEL_REG ADCSRB +#define BIN_REG ADCSRB + +/* TC1H */ +#define TC18_REG TC1H +#define TC19_REG TC1H + +/* TCCR1E */ +#define OC1OE0_REG TCCR1E +#define OC1OE1_REG TCCR1E +#define OC1OE2_REG TCCR1E +#define OC1OE3_REG TCCR1E +#define OC1OE4_REG TCCR1E +#define OC1OE5_REG TCCR1E + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* USIPP */ +#define USIPOS_REG USIPP + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* ACSRA */ +#define ACIS0_REG ACSRA +#define ACIS1_REG ACSRA +#define ACME_REG ACSRA +#define ACIE_REG ACSRA +#define ACI_REG ACSRA +#define ACO_REG ACSRA +#define ACBG_REG ACSRA +#define ACD_REG ACSRA + +/* TCNT1 */ +#define TC1H_0_REG TCNT1 +#define TC1H_1_REG TCNT1 +#define TC1H_2_REG TCNT1 +#define TC1H_3_REG TCNT1 +#define TC1H_4_REG TCNT1 +#define TC1H_5_REG TCNT1 +#define TC1H_6_REG TCNT1 +#define TC1H_7_REG TCNT1 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define PSR0_REG TCCR0B +#define TSM_REG TCCR0B + +/* TIFR */ +#define ICF0_REG TIFR +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define OCF1D_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define ACIC0_REG TCCR0A +#define ICES0_REG TCCR0A +#define ICNC0_REG TCCR0A +#define ICEN0_REG TCCR0A +#define TCW0_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* OCR1D */ +#define OCR1D0_REG OCR1D +#define OCR1D1_REG OCR1D +#define OCR1D2_REG OCR1D +#define OCR1D3_REG OCR1D +#define OCR1D4_REG OCR1D +#define OCR1D5_REG OCR1D +#define OCR1D6_REG OCR1D +/* #define OCR1C7_REG OCR1D */ /* dup in OCR1C */ + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +/* #define OCR1C7_REG OCR1C */ /* dup in OCR1D */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* DT1 */ +#define DT1L0_REG DT1 +#define DT1L1_REG DT1 +#define DT1L2_REG DT1 +#define DT1L3_REG DT1 +#define DT1H0_REG DT1 +#define DT1H1_REG DT1 +#define DT1H2_REG DT1 +#define DT1H3_REG DT1 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* DIDR1 */ +#define ADC7D_REG DIDR1 +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny28.h b/aversive/parts/ATtiny28.h new file mode 100644 index 0000000..744bb72 --- /dev/null +++ b/aversive/parts/ATtiny28.h @@ -0,0 +1,225 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_-3 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 -3 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW_TOTAL_NUM 1 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACD_REG ACSR + +/* PACR */ +#define DDA0_REG PACR +#define DDA1_REG PACR +#define PA2HC_REG PACR +#define DDA3_REG PACR + +/* MODCR */ +#define MCONF0_REG MODCR +#define MCONF1_REG MODCR +#define MCONF2_REG MODCR +#define ONTIM0_REG MODCR +#define ONTIM1_REG MODCR +#define ONTIM2_REG MODCR +#define OTIM3_REG MODCR +#define ONTIM4_REG MODCR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA3_REG PINA + +/* TCCR0 */ +#define CS00_REG TCCR0 +#define CS01_REG TCCR0 +#define CS02_REG TCCR0 +#define OOM00_REG TCCR0 +#define OOM01_REG TCCR0 +#define FOV0_REG TCCR0 + +/* MCUCS */ +#define PORF_REG MCUCS +#define EXTRF_REG MCUCS +#define WDRF_REG MCUCS +#define SM_REG MCUCS +#define SE_REG MCUCS +#define PLUPB_REG MCUCS + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA + +/* TCNT0 */ +#define TCNT00_REG TCNT0 +#define TCNT01_REG TCNT0 +#define TCNT02_REG TCNT0 +#define TCNT03_REG TCNT0 +#define TCNT04_REG TCNT0 +#define TCNT05_REG TCNT0 +#define TCNT06_REG TCNT0 +#define TCNT07_REG TCNT0 + +/* IFR */ +#define TOV0_REG IFR +#define INTF0_REG IFR +#define INTF1_REG IFR + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* ICR */ +#define ISC00_REG ICR +#define ISC01_REG ICR +#define ICS10_REG ICR +#define ICS11_REG ICR +#define TOIE0_REG ICR +#define LLIE_REG ICR +#define INT0_REG ICR +#define INT1_REG ICR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDTOE_REG WDTCR + +/* pins mapping */ + + +#define IR_PORT PORTA +#define IR_BIT 2 + + + + + + + + + + + + + + diff --git a/aversive/parts/ATtiny43U.h b/aversive/parts/ATtiny43U.h new file mode 100644 index 0000000..9bb6c69 --- /dev/null +++ b/aversive/parts/ATtiny43U.h @@ -0,0 +1,524 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define REFS_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* OCR1A */ +/* #define OCR1_0_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_1_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_2_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_3_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_4_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_5_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_6_REG OCR1A */ /* dup in OCR1B */ +/* #define OCR1_7_REG OCR1A */ /* dup in OCR1B */ + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define FOC1B_REG TCCR1B +#define FOC1A_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADLAR_REG ADCSRB +#define BVRON_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* EEAR */ +#define EEAR0_REG EEAR +#define EEAR1_REG EEAR +#define EEAR2_REG EEAR +#define EEAR3_REG EEAR +#define EEAR4_REG EEAR +#define EEAR5_REG EEAR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* OCR1B */ +/* #define OCR1_0_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_1_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_2_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_3_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_4_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_5_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_6_REG OCR1B */ /* dup in OCR1A */ +/* #define OCR1_7_REG OCR1B */ /* dup in OCR1A */ + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define BODSE_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR +#define BODS_REG MCUCR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny44.h b/aversive/parts/ATtiny44.h new file mode 100644 index 0000000..2d70d72 --- /dev/null +++ b/aversive/parts/ATtiny44.h @@ -0,0 +1,673 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define MUX5_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADLAR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define AREF_PORT PORTA +#define AREF_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define AIN0_PORT PORTA +#define AIN0_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define AIN1_PORT PORTA +#define AIN1_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define T0_PORT PORTA +#define T0_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define USCK_PORT PORTA +#define USCK_BIT 4 +#define SCL_PORT PORTA +#define SCL_BIT 4 +#define T1_PORT PORTA +#define T1_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define DO_PORT PORTA +#define DO_BIT 5 +#define MISO_PORT PORTA +#define MISO_BIT 5 +#define OC1B_PORT PORTA +#define OC1B_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 +#define OC1A_PORT PORTA +#define OC1A_BIT 6 +#define DI_PORT PORTA +#define DI_BIT 6 +#define SDA_PORT PORTA +#define SDA_BIT 6 +#define MOSI_PORT PORTA +#define MOSI_BIT 6 +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 +#define ICP1_PORT PORTA +#define ICP1_BIT 7 +#define OC0B_PORT PORTA +#define OC0B_BIT 7 +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define PCINT8_PORT PORTB +#define PCINT8_BIT 0 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 0 + +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 1 + +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define OC0A_PORT PORTB +#define OC0A_BIT 2 +#define CKOUT_PORT PORTB +#define CKOUT_BIT 2 + +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 +#define RESET_PORT PORTB +#define RESET_BIT 3 +#define dW_PORT PORTB +#define dW_BIT 3 + + diff --git a/aversive/parts/ATtiny45.h b/aversive/parts/ATtiny45.h new file mode 100644 index 0000000..fdc13ec --- /dev/null +++ b/aversive/parts/ATtiny45.h @@ -0,0 +1,634 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* DIDR0 */ +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC0D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define REFS2_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR1 */ +#define CS10_REG TCCR1 +#define CS11_REG TCCR1 +#define CS12_REG TCCR1 +#define CS13_REG TCCR1 +#define COM1A0_REG TCCR1 +#define COM1A1_REG TCCR1 +#define PWM1A_REG TCCR1 +#define CTC1_REG TCCR1 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define BODSE_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR +#define BODS_REG MCUCR + +/* GTCCR */ +#define PSR0_REG GTCCR +#define TSM_REG GTCCR +#define PSR1_REG GTCCR +#define FOC1A_REG GTCCR +#define FOC1B_REG GTCCR +#define COM1B0_REG GTCCR +#define COM1B1_REG GTCCR +#define PWM1B_REG GTCCR + +/* DTPS */ +#define DTPS0_REG DTPS +#define DTPS1_REG DTPS + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* DT1B */ +/* #define DTVL0_REG DT1B */ /* dup in DT1A */ +/* #define DTVL1_REG DT1B */ /* dup in DT1A */ +/* #define DTVL2_REG DT1B */ /* dup in DT1A */ +/* #define DTVL3_REG DT1B */ /* dup in DT1A */ +/* #define DTVH0_REG DT1B */ /* dup in DT1A */ +/* #define DTVH1_REG DT1B */ /* dup in DT1A */ +/* #define DTVH2_REG DT1B */ /* dup in DT1A */ +/* #define DTVH3_REG DT1B */ /* dup in DT1A */ + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define IPR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +#define OCR1C7_REG OCR1C + +/* DT1A */ +/* #define DTVL0_REG DT1A */ /* dup in DT1B */ +/* #define DTVL1_REG DT1A */ /* dup in DT1B */ +/* #define DTVL2_REG DT1A */ /* dup in DT1B */ +/* #define DTVL3_REG DT1A */ /* dup in DT1B */ +/* #define DTVH0_REG DT1A */ /* dup in DT1B */ +/* #define DTVH1_REG DT1A */ /* dup in DT1B */ +/* #define DTVH2_REG DT1A */ /* dup in DT1B */ +/* #define DTVH3_REG DT1A */ /* dup in DT1B */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define DI_PORT PORTB +#define DI_BIT 0 +#define SDA_PORT PORTB +#define SDA_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define OC0A_PORT PORTB +#define OC0A_BIT 0 +#define OC1A_PORT PORTB +#define OC1A_BIT 0 +#define AREF_PORT PORTB +#define AREF_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define DO_PORT PORTB +#define DO_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OC0B_PORT PORTB +#define OC0B_BIT 1 +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define USCK_PORT PORTB +#define USCK_BIT 2 +#define SCL_PORT PORTB +#define SCL_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTB +#define ADC3_BIT 3 +#define OC1B_PORT PORTB +#define OC1B_BIT 3 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 3 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 3 + +#define ADC2_PORT PORTB +#define ADC2_BIT 4 +#define OC1B_PORT PORTB +#define OC1B_BIT 4 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 4 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 4 + +#define RESET_PORT PORTB +#define RESET_BIT 5 +#define ADC0_PORT PORTB +#define ADC0_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 +#define dW_PORT PORTB +#define dW_BIT 5 + + diff --git a/aversive/parts/ATtiny461.h b/aversive/parts/ATtiny461.h new file mode 100644 index 0000000..6a4465c --- /dev/null +++ b/aversive/parts/ATtiny461.h @@ -0,0 +1,674 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1_NUM 2 +#define SIG_OUTPUT_COMPARE1A_NUM 3 +#define SIG_OUTPUT_COMPARE1B_NUM 4 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 5 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1_NUM 2 +#define PWM1A_NUM 3 +#define PWM1B_NUM 4 +#define PWM_TOTAL_NUM 5 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE0_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define AREFD_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCNT0H */ +/* #define TCNT0_0_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_1_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_2_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_3_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_4_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_5_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_6_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_7_REG TCNT0H */ /* dup in TCNT0L */ + +/* TCNT0L */ +/* #define TCNT0_0_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_1_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_2_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_3_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_4_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_5_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_6_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_7_REG TCNT0L */ /* dup in TCNT0H */ + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TCCR1D */ +#define WGM10_REG TCCR1D +#define WGM11_REG TCCR1D +#define FPF1_REG TCCR1D +#define FPAC1_REG TCCR1D +#define FPES1_REG TCCR1D +#define FPNC1_REG TCCR1D +#define FPEN1_REG TCCR1D +#define FPIE1_REG TCCR1D + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* TCCR1A */ +#define PWM1B_REG TCCR1A +#define PWM1A_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define PWM1D_REG TCCR1C +#define FOC1D_REG TCCR1C +#define COM1D0_REG TCCR1C +#define COM1D1_REG TCCR1C +#define COM1B0S_REG TCCR1C +#define COM1B1S_REG TCCR1C +#define COM1A0S_REG TCCR1C +#define COM1A1S_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CS13_REG TCCR1B +#define DTPS10_REG TCCR1B +#define DTPS11_REG TCCR1B +#define PSR1_REG TCCR1B + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define OCIE1D_REG TIMSK + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ACSRB */ +#define ACM0_REG ACSRB +#define ACM1_REG ACSRB +#define ACM2_REG ACSRB +#define HLEV_REG ACSRB +#define HSEL_REG ACSRB + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB +#define REFS2_REG ADCSRB +#define IPR_REG ADCSRB +#define GSEL_REG ADCSRB +#define BIN_REG ADCSRB + +/* TC1H */ +#define TC18_REG TC1H +#define TC19_REG TC1H + +/* TCCR1E */ +#define OC1OE0_REG TCCR1E +#define OC1OE1_REG TCCR1E +#define OC1OE2_REG TCCR1E +#define OC1OE3_REG TCCR1E +#define OC1OE4_REG TCCR1E +#define OC1OE5_REG TCCR1E + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* ACSRA */ +#define ACIS0_REG ACSRA +#define ACIS1_REG ACSRA +#define ACME_REG ACSRA +#define ACIE_REG ACSRA +#define ACI_REG ACSRA +#define ACO_REG ACSRA +#define ACBG_REG ACSRA +#define ACD_REG ACSRA + +/* TCNT1 */ +#define TC1H_0_REG TCNT1 +#define TC1H_1_REG TCNT1 +#define TC1H_2_REG TCNT1 +#define TC1H_3_REG TCNT1 +#define TC1H_4_REG TCNT1 +#define TC1H_5_REG TCNT1 +#define TC1H_6_REG TCNT1 +#define TC1H_7_REG TCNT1 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define PSR0_REG TCCR0B +#define TSM_REG TCCR0B + +/* TIFR */ +#define ICF0_REG TIFR +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define OCF1D_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define ACIC0_REG TCCR0A +#define ICES0_REG TCCR0A +#define ICNC0_REG TCCR0A +#define ICEN0_REG TCCR0A +#define TCW0_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* OCR1D */ +#define OCR1D0_REG OCR1D +#define OCR1D1_REG OCR1D +#define OCR1D2_REG OCR1D +#define OCR1D3_REG OCR1D +#define OCR1D4_REG OCR1D +#define OCR1D5_REG OCR1D +#define OCR1D6_REG OCR1D +/* #define OCR1C7_REG OCR1D */ /* dup in OCR1C */ + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +/* #define OCR1C7_REG OCR1C */ /* dup in OCR1D */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* USIPP */ +#define USIPOS_REG USIPP + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* DT1 */ +#define DT1L0_REG DT1 +#define DT1L1_REG DT1 +#define DT1L2_REG DT1 +#define DT1L3_REG DT1 +#define DT1H0_REG DT1 +#define DT1H1_REG DT1 +#define DT1H2_REG DT1 +#define DT1H3_REG DT1 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* DIDR1 */ +#define ADC7D_REG DIDR1 +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny48.h b/aversive/parts/ATtiny48.h new file mode 100644 index 0000000..f7f662b --- /dev/null +++ b/aversive/parts/ATtiny48.h @@ -0,0 +1,873 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SPH */ +#define SP8_REG SPH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* PORTCR */ +#define PUDA_REG PORTCR +#define PUDB_REG PORTCR +#define PUDC_REG PORTCR +#define PUDD_REG PORTCR +#define BBMA_REG PORTCR +#define BBMB_REG PORTCR +#define BBMC_REG PORTCR +#define BBMD_REG PORTCR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OCR0A */ +#define OCR0A_0_REG OCR0A +#define OCR0A_1_REG OCR0A +#define OCR0A_2_REG OCR0A +#define OCR0A_3_REG OCR0A +#define OCR0A_4_REG OCR0A +#define OCR0A_5_REG OCR0A +#define OCR0A_6_REG OCR0A +#define OCR0A_7_REG OCR0A + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PRR */ +#define PRADC_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTWI_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR +#define RWWSB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TWHSR */ +#define TWIHS_REG TWHSR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define CTC0_REG TCCR0A + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 +#define AREFD_REG DIDR1 + +/* MCUCR */ +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATtiny84.h b/aversive/parts/ATtiny84.h new file mode 100644 index 0000000..686d6a7 --- /dev/null +++ b/aversive/parts/ATtiny84.h @@ -0,0 +1,674 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define MUX5_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* GTCCR */ +#define PSR10_REG GTCCR +#define TSM_REG GTCCR + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* GIFR */ +#define PCIF0_REG GIFR +#define PCIF1_REG GIFR +#define INTF0_REG GIFR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ADLAR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* OCR1BL */ +/* #define OCR1AL0_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL1_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL2_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL3_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL4_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL5_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL6_REG OCR1BL */ /* dup in OCR1AL */ +/* #define OCR1AL7_REG OCR1BL */ /* dup in OCR1AL */ + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* OCR1BH */ +/* #define OCR1AH0_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH1_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH2_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH3_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH4_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH5_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH6_REG OCR1BH */ /* dup in OCR1AH */ +/* #define OCR1AH7_REG OCR1BH */ /* dup in OCR1AH */ + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* OCR1AH */ +/* #define OCR1AH0_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH1_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH2_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH3_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH4_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH5_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH6_REG OCR1AH */ /* dup in OCR1BH */ +/* #define OCR1AH7_REG OCR1AH */ /* dup in OCR1BH */ + +/* OCR1AL */ +/* #define OCR1AL0_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL1_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL2_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL3_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL4_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL5_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL6_REG OCR1AL */ /* dup in OCR1BL */ +/* #define OCR1AL7_REG OCR1AL */ /* dup in OCR1BL */ + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* pins mapping */ +#define ADC0_PORT PORTA +#define ADC0_BIT 0 +#define AREF_PORT PORTA +#define AREF_BIT 0 +#define PCINT0_PORT PORTA +#define PCINT0_BIT 0 + +#define ADC1_PORT PORTA +#define ADC1_BIT 1 +#define AIN0_PORT PORTA +#define AIN0_BIT 1 +#define PCINT1_PORT PORTA +#define PCINT1_BIT 1 + +#define ADC2_PORT PORTA +#define ADC2_BIT 2 +#define AIN1_PORT PORTA +#define AIN1_BIT 2 +#define PCINT2_PORT PORTA +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTA +#define ADC3_BIT 3 +#define T0_PORT PORTA +#define T0_BIT 3 +#define PCINT3_PORT PORTA +#define PCINT3_BIT 3 + +#define ADC4_PORT PORTA +#define ADC4_BIT 4 +#define USCK_PORT PORTA +#define USCK_BIT 4 +#define SCL_PORT PORTA +#define SCL_BIT 4 +#define T1_PORT PORTA +#define T1_BIT 4 +#define PCINT4_PORT PORTA +#define PCINT4_BIT 4 + +#define ADC5_PORT PORTA +#define ADC5_BIT 5 +#define DO_PORT PORTA +#define DO_BIT 5 +#define MISO_PORT PORTA +#define MISO_BIT 5 +#define OC1B_PORT PORTA +#define OC1B_BIT 5 +#define PCINT5_PORT PORTA +#define PCINT5_BIT 5 + +#define PCINT6_PORT PORTA +#define PCINT6_BIT 6 +#define OC1A_PORT PORTA +#define OC1A_BIT 6 +#define DI_PORT PORTA +#define DI_BIT 6 +#define SDA_PORT PORTA +#define SDA_BIT 6 +#define MOSI_PORT PORTA +#define MOSI_BIT 6 +#define ADC6_PORT PORTA +#define ADC6_BIT 6 + +#define PCINT7_PORT PORTA +#define PCINT7_BIT 7 +#define ICP1_PORT PORTA +#define ICP1_BIT 7 +#define OC0B_PORT PORTA +#define OC0B_BIT 7 +#define ADC7_PORT PORTA +#define ADC7_BIT 7 + +#define PCINT8_PORT PORTB +#define PCINT8_BIT 0 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 0 + +#define PCINT9_PORT PORTB +#define PCINT9_BIT 1 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 1 + +#define PCINT10_PORT PORTB +#define PCINT10_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define OC0A_PORT PORTB +#define OC0A_BIT 2 +#define CKOUT_PORT PORTB +#define CKOUT_BIT 2 + +#define PCINT11_PORT PORTB +#define PCINT11_BIT 3 +#define RESET_PORT PORTB +#define RESET_BIT 3 +#define dW_PORT PORTB +#define dW_BIT 3 + + diff --git a/aversive/parts/ATtiny85.h b/aversive/parts/ATtiny85.h new file mode 100644 index 0000000..82c3eb3 --- /dev/null +++ b/aversive/parts/ATtiny85.h @@ -0,0 +1,632 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE_REG GIMSK +#define INT0_REG GIMSK + +/* DIDR0 */ +#define AIN0D_REG DIDR0 +#define AIN1D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC0D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define REFS2_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCCR1 */ +#define CS10_REG TCCR1 +#define CS11_REG TCCR1 +#define CS12_REG TCCR1 +#define CS13_REG TCCR1 +#define COM1A0_REG TCCR1 +#define COM1A1_REG TCCR1 +#define PWM1A_REG TCCR1 +#define CTC1_REG TCCR1 + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* GTCCR */ +#define PSR0_REG GTCCR +#define TSM_REG GTCCR +#define PSR1_REG GTCCR +#define FOC1A_REG GTCCR +#define FOC1B_REG GTCCR +#define COM1B0_REG GTCCR +#define COM1B1_REG GTCCR +#define PWM1B_REG GTCCR + +/* DTPS */ +#define DTPS0_REG DTPS +#define DTPS1_REG DTPS + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR + +/* TIMSK */ +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* DT1B */ +/* #define DTVL0_REG DT1B */ /* dup in DT1A */ +/* #define DTVL1_REG DT1B */ /* dup in DT1A */ +/* #define DTVL2_REG DT1B */ /* dup in DT1A */ +/* #define DTVL3_REG DT1B */ /* dup in DT1A */ +/* #define DTVH0_REG DT1B */ /* dup in DT1A */ +/* #define DTVH1_REG DT1B */ /* dup in DT1A */ +/* #define DTVH2_REG DT1B */ /* dup in DT1A */ +/* #define DTVH3_REG DT1B */ /* dup in DT1A */ + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* PCMSK */ +#define PCINT0_REG PCMSK +#define PCINT1_REG PCMSK +#define PCINT2_REG PCMSK +#define PCINT3_REG PCMSK +#define PCINT4_REG PCMSK +#define PCINT5_REG PCMSK + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* TCNT1 */ +#define TCNT1_0_REG TCNT1 +#define TCNT1_1_REG TCNT1 +#define TCNT1_2_REG TCNT1 +#define TCNT1_3_REG TCNT1 +#define TCNT1_4_REG TCNT1 +#define TCNT1_5_REG TCNT1 +#define TCNT1_6_REG TCNT1 +#define TCNT1_7_REG TCNT1 + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define WGM02_REG TCCR0B +#define FOC0B_REG TCCR0B +#define FOC0A_REG TCCR0B + +/* TIFR */ +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define WGM01_REG TCCR0A +#define COM0B0_REG TCCR0A +#define COM0B1_REG TCCR0A +#define COM0A0_REG TCCR0A +#define COM0A1_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* ADCSRB */ +#define ACME_REG ADCSRB +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define IPR_REG ADCSRB +#define BIN_REG ADCSRB + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +#define OCR1C7_REG OCR1C + +/* DT1A */ +/* #define DTVL0_REG DT1A */ /* dup in DT1B */ +/* #define DTVL1_REG DT1A */ /* dup in DT1B */ +/* #define DTVL2_REG DT1A */ /* dup in DT1B */ +/* #define DTVL3_REG DT1A */ /* dup in DT1B */ +/* #define DTVH0_REG DT1A */ /* dup in DT1B */ +/* #define DTVH1_REG DT1A */ /* dup in DT1B */ +/* #define DTVH2_REG DT1A */ /* dup in DT1B */ +/* #define DTVH3_REG DT1A */ /* dup in DT1B */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* pins mapping */ +#define MOSI_PORT PORTB +#define MOSI_BIT 0 +#define DI_PORT PORTB +#define DI_BIT 0 +#define SDA_PORT PORTB +#define SDA_BIT 0 +#define AIN0_PORT PORTB +#define AIN0_BIT 0 +#define OC0A_PORT PORTB +#define OC0A_BIT 0 +#define OC1A_PORT PORTB +#define OC1A_BIT 0 +#define AREF_PORT PORTB +#define AREF_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define MISO_PORT PORTB +#define MISO_BIT 1 +#define DO_PORT PORTB +#define DO_BIT 1 +#define AIN1_PORT PORTB +#define AIN1_BIT 1 +#define OC0B_PORT PORTB +#define OC0B_BIT 1 +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SCK_PORT PORTB +#define SCK_BIT 2 +#define USCK_PORT PORTB +#define USCK_BIT 2 +#define SCL_PORT PORTB +#define SCL_BIT 2 +#define ADC1_PORT PORTB +#define ADC1_BIT 2 +#define T0_PORT PORTB +#define T0_BIT 2 +#define INT0_PORT PORTB +#define INT0_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define ADC3_PORT PORTB +#define ADC3_BIT 3 +#define OC1B_PORT PORTB +#define OC1B_BIT 3 +#define XTAL1_PORT PORTB +#define XTAL1_BIT 3 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 3 + +#define ADC2_PORT PORTB +#define ADC2_BIT 4 +#define OC1B_PORT PORTB +#define OC1B_BIT 4 +#define XTAL2_PORT PORTB +#define XTAL2_BIT 4 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 4 + +#define RESET_PORT PORTB +#define RESET_BIT 5 +#define ADC0_PORT PORTB +#define ADC0_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 +#define dW_PORT PORTB +#define dW_BIT 5 + + diff --git a/aversive/parts/ATtiny861.h b/aversive/parts/ATtiny861.h new file mode 100644 index 0000000..a75363d --- /dev/null +++ b/aversive/parts/ATtiny861.h @@ -0,0 +1,675 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_2 2 +#define TIMER1_PRESCALER_DIV_4 3 +#define TIMER1_PRESCALER_DIV_8 4 +#define TIMER1_PRESCALER_DIV_16 5 +#define TIMER1_PRESCALER_DIV_32 6 +#define TIMER1_PRESCALER_DIV_64 7 +#define TIMER1_PRESCALER_DIV_128 8 +#define TIMER1_PRESCALER_DIV_256 9 +#define TIMER1_PRESCALER_DIV_512 10 +#define TIMER1_PRESCALER_DIV_1024 11 +#define TIMER1_PRESCALER_DIV_2048 12 +#define TIMER1_PRESCALER_DIV_4096 13 +#define TIMER1_PRESCALER_DIV_8192 14 +#define TIMER1_PRESCALER_DIV_16384 15 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 2 +#define TIMER1_PRESCALER_REG_3 4 +#define TIMER1_PRESCALER_REG_4 8 +#define TIMER1_PRESCALER_REG_5 16 +#define TIMER1_PRESCALER_REG_6 32 +#define TIMER1_PRESCALER_REG_7 64 +#define TIMER1_PRESCALER_REG_8 128 +#define TIMER1_PRESCALER_REG_9 256 +#define TIMER1_PRESCALER_REG_10 512 +#define TIMER1_PRESCALER_REG_11 1024 +#define TIMER1_PRESCALER_REG_12 2048 +#define TIMER1_PRESCALER_REG_13 4096 +#define TIMER1_PRESCALER_REG_14 8192 +#define TIMER1_PRESCALER_REG_15 16384 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1_NUM 2 +#define SIG_OUTPUT_COMPARE1A_NUM 3 +#define SIG_OUTPUT_COMPARE1B_NUM 4 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 5 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1_NUM 2 +#define PWM1A_NUM 3 +#define PWM1B_NUM 4 +#define PWM_TOTAL_NUM 5 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE0_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* WDTCR */ +#define WDP0_REG WDTCR +#define WDP1_REG WDTCR +#define WDP2_REG WDTCR +#define WDE_REG WDTCR +#define WDCE_REG WDTCR +#define WDP3_REG WDTCR +#define WDIE_REG WDTCR +#define WDIF_REG WDTCR + +/* GIMSK */ +#define PCIE0_REG GIMSK +#define PCIE1_REG GIMSK +#define INT0_REG GIMSK +#define INT1_REG GIMSK + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define AREFD_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define MUX4_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* TCNT0H */ +/* #define TCNT0_0_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_1_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_2_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_3_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_4_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_5_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_6_REG TCNT0H */ /* dup in TCNT0L */ +/* #define TCNT0_7_REG TCNT0H */ /* dup in TCNT0L */ + +/* TCNT0L */ +/* #define TCNT0_0_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_1_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_2_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_3_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_4_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_5_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_6_REG TCNT0L */ /* dup in TCNT0H */ +/* #define TCNT0_7_REG TCNT0L */ /* dup in TCNT0H */ + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TCCR1D */ +#define WGM10_REG TCCR1D +#define WGM11_REG TCCR1D +#define FPF1_REG TCCR1D +#define FPAC1_REG TCCR1D +#define FPES1_REG TCCR1D +#define FPNC1_REG TCCR1D +#define FPEN1_REG TCCR1D +#define FPIE1_REG TCCR1D + +/* MCUCR */ +#define ISC00_REG MCUCR +#define ISC01_REG MCUCR +#define SM0_REG MCUCR +#define SM1_REG MCUCR +#define SE_REG MCUCR +#define PUD_REG MCUCR + +/* TCCR1A */ +#define PWM1B_REG TCCR1A +#define PWM1A_REG TCCR1A +#define FOC1B_REG TCCR1A +#define FOC1A_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define PWM1D_REG TCCR1C +#define FOC1D_REG TCCR1C +#define COM1D0_REG TCCR1C +#define COM1D1_REG TCCR1C +#define COM1B0S_REG TCCR1C +#define COM1B1S_REG TCCR1C +#define COM1A0S_REG TCCR1C +#define COM1A1S_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define CS13_REG TCCR1B +#define DTPS10_REG TCCR1B +#define DTPS11_REG TCCR1B +#define PSR1_REG TCCR1B + +/* GIFR */ +#define PCIF_REG GIFR +#define INTF0_REG GIFR +#define INTF1_REG GIFR + +/* TIMSK */ +#define TICIE0_REG TIMSK +#define TOIE0_REG TIMSK +#define OCIE0B_REG TIMSK +#define OCIE0A_REG TIMSK +#define TOIE1_REG TIMSK +#define OCIE1B_REG TIMSK +#define OCIE1A_REG TIMSK +#define OCIE1D_REG TIMSK + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA +#define DDA4_REG DDRA +#define DDA5_REG DDRA +#define DDA6_REG DDRA +#define DDA7_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ACSRB */ +#define ACM0_REG ACSRB +#define ACM1_REG ACSRB +#define ACM2_REG ACSRB +#define HLEV_REG ACSRB +#define HSEL_REG ACSRB + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define MUX5_REG ADCSRB +#define REFS2_REG ADCSRB +#define IPR_REG ADCSRB +#define GSEL_REG ADCSRB +#define BIN_REG ADCSRB + +/* TC1H */ +#define TC18_REG TC1H +#define TC19_REG TC1H + +/* TCCR1E */ +#define OC1OE0_REG TCCR1E +#define OC1OE1_REG TCCR1E +#define OC1OE2_REG TCCR1E +#define OC1OE3_REG TCCR1E +#define OC1OE4_REG TCCR1E +#define OC1OE5_REG TCCR1E + +/* OCR0A */ +/* #define OCR0_0_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_1_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_2_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_3_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_4_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_5_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_6_REG OCR0A */ /* dup in OCR0B */ +/* #define OCR0_7_REG OCR0A */ /* dup in OCR0B */ + +/* OCR0B */ +/* #define OCR0_0_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_1_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_2_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_3_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_4_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_5_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_6_REG OCR0B */ /* dup in OCR0A */ +/* #define OCR0_7_REG OCR0B */ /* dup in OCR0A */ + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* PRR */ +#define PRADC_REG PRR +#define PRUSI_REG PRR +#define PRTIM0_REG PRR +#define PRTIM1_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* USICR */ +#define USITC_REG USICR +#define USICLK_REG USICR +#define USICS0_REG USICR +#define USICS1_REG USICR +#define USIWM0_REG USICR +#define USIWM1_REG USICR +#define USIOIE_REG USICR +#define USISIE_REG USICR + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SPMEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* USISR */ +#define USICNT0_REG USISR +#define USICNT1_REG USISR +#define USICNT2_REG USISR +#define USICNT3_REG USISR +#define USIDC_REG USISR +#define USIPF_REG USISR +#define USIOIF_REG USISR +#define USISIF_REG USISR + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA +#define PORTA4_REG PORTA +#define PORTA5_REG PORTA +#define PORTA6_REG PORTA +#define PORTA7_REG PORTA + +/* ACSRA */ +#define ACIS0_REG ACSRA +#define ACIS1_REG ACSRA +#define ACME_REG ACSRA +#define ACIE_REG ACSRA +#define ACI_REG ACSRA +#define ACO_REG ACSRA +#define ACBG_REG ACSRA +#define ACD_REG ACSRA + +/* TCNT1 */ +#define TC1H_0_REG TCNT1 +#define TC1H_1_REG TCNT1 +#define TC1H_2_REG TCNT1 +#define TC1H_3_REG TCNT1 +#define TC1H_4_REG TCNT1 +#define TC1H_5_REG TCNT1 +#define TC1H_6_REG TCNT1 +#define TC1H_7_REG TCNT1 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* TCCR0B */ +#define CS00_REG TCCR0B +#define CS01_REG TCCR0B +#define CS02_REG TCCR0B +#define PSR0_REG TCCR0B +#define TSM_REG TCCR0B + +/* TIFR */ +#define ICF0_REG TIFR +#define TOV0_REG TIFR +#define OCF0B_REG TIFR +#define OCF0A_REG TIFR +#define TOV1_REG TIFR +#define OCF1B_REG TIFR +#define OCF1A_REG TIFR +#define OCF1D_REG TIFR + +/* TCCR0A */ +#define WGM00_REG TCCR0A +#define ACIC0_REG TCCR0A +#define ICES0_REG TCCR0A +#define ICNC0_REG TCCR0A +#define ICEN0_REG TCCR0A +#define TCW0_REG TCCR0A + +/* EEARH */ +#define EEAR8_REG EEARH + +/* PLLCSR */ +#define PLOCK_REG PLLCSR +#define PLLE_REG PLLCSR +#define PCKE_REG PLLCSR +#define LSM_REG PLLCSR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* DWDR */ +#define DWDR0_REG DWDR +#define DWDR1_REG DWDR +#define DWDR2_REG DWDR +#define DWDR3_REG DWDR +#define DWDR4_REG DWDR +#define DWDR5_REG DWDR +#define DWDR6_REG DWDR +#define DWDR7_REG DWDR + +/* OCR1D */ +#define OCR1D0_REG OCR1D +#define OCR1D1_REG OCR1D +#define OCR1D2_REG OCR1D +#define OCR1D3_REG OCR1D +#define OCR1D4_REG OCR1D +#define OCR1D5_REG OCR1D +#define OCR1D6_REG OCR1D +/* #define OCR1C7_REG OCR1D */ /* dup in OCR1C */ + +/* OCR1B */ +#define OCR1B0_REG OCR1B +#define OCR1B1_REG OCR1B +#define OCR1B2_REG OCR1B +#define OCR1B3_REG OCR1B +#define OCR1B4_REG OCR1B +#define OCR1B5_REG OCR1B +#define OCR1B6_REG OCR1B +#define OCR1B7_REG OCR1B + +/* OCR1C */ +#define OCR1C0_REG OCR1C +#define OCR1C1_REG OCR1C +#define OCR1C2_REG OCR1C +#define OCR1C3_REG OCR1C +#define OCR1C4_REG OCR1C +#define OCR1C5_REG OCR1C +#define OCR1C6_REG OCR1C +/* #define OCR1C7_REG OCR1C */ /* dup in OCR1D */ + +/* OCR1A */ +#define OCR1A0_REG OCR1A +#define OCR1A1_REG OCR1A +#define OCR1A2_REG OCR1A +#define OCR1A3_REG OCR1A +#define OCR1A4_REG OCR1A +#define OCR1A5_REG OCR1A +#define OCR1A6_REG OCR1A +#define OCR1A7_REG OCR1A + +/* USIPP */ +#define USIPOS_REG USIPP + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* USIBR */ +#define USIBR0_REG USIBR +#define USIBR1_REG USIBR +#define USIBR2_REG USIBR +#define USIBR3_REG USIBR +#define USIBR4_REG USIBR +#define USIBR5_REG USIBR +#define USIBR6_REG USIBR +#define USIBR7_REG USIBR + +/* DT1 */ +#define DT1L0_REG DT1 +#define DT1L1_REG DT1 +#define DT1L2_REG DT1 +#define DT1L3_REG DT1 +#define DT1H0_REG DT1 +#define DT1H1_REG DT1 +#define DT1H2_REG DT1 +#define DT1H3_REG DT1 + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA +#define PINA4_REG PINA +#define PINA5_REG PINA +#define PINA6_REG PINA +#define PINA7_REG PINA + +/* USIDR */ +#define USIDR0_REG USIDR +#define USIDR1_REG USIDR +#define USIDR2_REG USIDR +#define USIDR3_REG USIDR +#define USIDR4_REG USIDR +#define USIDR5_REG USIDR +#define USIDR6_REG USIDR +#define USIDR7_REG USIDR + +/* DIDR1 */ +#define ADC7D_REG DIDR1 +#define ADC8D_REG DIDR1 +#define ADC9D_REG DIDR1 +#define ADC10D_REG DIDR1 + +/* pins mapping */ + diff --git a/aversive/parts/ATtiny88.h b/aversive/parts/ATtiny88.h new file mode 100644 index 0000000..6ec6cdb --- /dev/null +++ b/aversive/parts/ATtiny88.h @@ -0,0 +1,874 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + +/* prescalers timer 0 */ +#define TIMER0_PRESCALER_DIV_0 0 +#define TIMER0_PRESCALER_DIV_1 1 +#define TIMER0_PRESCALER_DIV_8 2 +#define TIMER0_PRESCALER_DIV_64 3 +#define TIMER0_PRESCALER_DIV_256 4 +#define TIMER0_PRESCALER_DIV_1024 5 +#define TIMER0_PRESCALER_DIV_FALL 6 +#define TIMER0_PRESCALER_DIV_RISE 7 + +#define TIMER0_PRESCALER_REG_0 0 +#define TIMER0_PRESCALER_REG_1 1 +#define TIMER0_PRESCALER_REG_2 8 +#define TIMER0_PRESCALER_REG_3 64 +#define TIMER0_PRESCALER_REG_4 256 +#define TIMER0_PRESCALER_REG_5 1024 +#define TIMER0_PRESCALER_REG_6 -1 +#define TIMER0_PRESCALER_REG_7 -2 + +/* prescalers timer 1 */ +#define TIMER1_PRESCALER_DIV_0 0 +#define TIMER1_PRESCALER_DIV_1 1 +#define TIMER1_PRESCALER_DIV_8 2 +#define TIMER1_PRESCALER_DIV_64 3 +#define TIMER1_PRESCALER_DIV_256 4 +#define TIMER1_PRESCALER_DIV_1024 5 +#define TIMER1_PRESCALER_DIV_FALL 6 +#define TIMER1_PRESCALER_DIV_RISE 7 + +#define TIMER1_PRESCALER_REG_0 0 +#define TIMER1_PRESCALER_REG_1 1 +#define TIMER1_PRESCALER_REG_2 8 +#define TIMER1_PRESCALER_REG_3 64 +#define TIMER1_PRESCALER_REG_4 256 +#define TIMER1_PRESCALER_REG_5 1024 +#define TIMER1_PRESCALER_REG_6 -1 +#define TIMER1_PRESCALER_REG_7 -2 + + +/* available timers */ +#define TIMER0_AVAILABLE +#define TIMER0A_AVAILABLE +#define TIMER0B_AVAILABLE +#define TIMER1_AVAILABLE +#define TIMER1A_AVAILABLE +#define TIMER1B_AVAILABLE + +/* overflow interrupt number */ +#define SIG_OVERFLOW0_NUM 0 +#define SIG_OVERFLOW1_NUM 1 +#define SIG_OVERFLOW_TOTAL_NUM 2 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE0A_NUM 0 +#define SIG_OUTPUT_COMPARE0B_NUM 1 +#define SIG_OUTPUT_COMPARE1A_NUM 2 +#define SIG_OUTPUT_COMPARE1B_NUM 3 +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 4 + +/* Pwm nums */ +#define PWM0A_NUM 0 +#define PWM0B_NUM 1 +#define PWM1A_NUM 2 +#define PWM1B_NUM 3 +#define PWM_TOTAL_NUM 4 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE1_NUM 0 +#define SIG_INPUT_CAPTURE_TOTAL_NUM 1 + + +/* CLKPR */ +#define CLKPS0_REG CLKPR +#define CLKPS1_REG CLKPR +#define CLKPS2_REG CLKPR +#define CLKPS3_REG CLKPR +#define CLKPCE_REG CLKPR + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH + +/* PCIFR */ +#define PCIF0_REG PCIFR +#define PCIF1_REG PCIFR +#define PCIF2_REG PCIFR +#define PCIF3_REG PCIFR + +/* ADMUX */ +#define MUX0_REG ADMUX +#define MUX1_REG ADMUX +#define MUX2_REG ADMUX +#define MUX3_REG ADMUX +#define ADLAR_REG ADMUX +#define REFS0_REG ADMUX +#define REFS1_REG ADMUX + +/* PORTCR */ +#define PUDA_REG PORTCR +#define PUDB_REG PORTCR +#define PUDC_REG PORTCR +#define PUDD_REG PORTCR +#define BBMA_REG PORTCR +#define BBMB_REG PORTCR +#define BBMC_REG PORTCR +#define BBMD_REG PORTCR + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* DDRB */ +#define DDB0_REG DDRB +#define DDB1_REG DDRB +#define DDB2_REG DDRB +#define DDB3_REG DDRB +#define DDB4_REG DDRB +#define DDB5_REG DDRB +#define DDB6_REG DDRB +#define DDB7_REG DDRB + +/* WDTCSR */ +#define WDP0_REG WDTCSR +#define WDP1_REG WDTCSR +#define WDP2_REG WDTCSR +#define WDE_REG WDTCSR +#define WDCE_REG WDTCSR +#define WDP3_REG WDTCSR +#define WDIE_REG WDTCSR +#define WDIF_REG WDTCSR + +/* EEDR */ +#define EEDR0_REG EEDR +#define EEDR1_REG EEDR +#define EEDR2_REG EEDR +#define EEDR3_REG EEDR +#define EEDR4_REG EEDR +#define EEDR5_REG EEDR +#define EEDR6_REG EEDR +#define EEDR7_REG EEDR + +/* TWDR */ +#define TWD0_REG TWDR +#define TWD1_REG TWDR +#define TWD2_REG TWDR +#define TWD3_REG TWDR +#define TWD4_REG TWDR +#define TWD5_REG TWDR +#define TWD6_REG TWDR +#define TWD7_REG TWDR + +/* OCR0B */ +#define OCR0B_0_REG OCR0B +#define OCR0B_1_REG OCR0B +#define OCR0B_2_REG OCR0B +#define OCR0B_3_REG OCR0B +#define OCR0B_4_REG OCR0B +#define OCR0B_5_REG OCR0B +#define OCR0B_6_REG OCR0B +#define OCR0B_7_REG OCR0B + +/* TCCR1A */ +#define WGM10_REG TCCR1A +#define WGM11_REG TCCR1A +#define COM1B0_REG TCCR1A +#define COM1B1_REG TCCR1A +#define COM1A0_REG TCCR1A +#define COM1A1_REG TCCR1A + +/* TCCR1C */ +#define FOC1B_REG TCCR1C +#define FOC1A_REG TCCR1C + +/* TCCR1B */ +#define CS10_REG TCCR1B +#define CS11_REG TCCR1B +#define CS12_REG TCCR1B +#define WGM12_REG TCCR1B +#define WGM13_REG TCCR1B +#define ICES1_REG TCCR1B +#define ICNC1_REG TCCR1B + +/* OCR1AH */ +#define OCR1AH0_REG OCR1AH +#define OCR1AH1_REG OCR1AH +#define OCR1AH2_REG OCR1AH +#define OCR1AH3_REG OCR1AH +#define OCR1AH4_REG OCR1AH +#define OCR1AH5_REG OCR1AH +#define OCR1AH6_REG OCR1AH +#define OCR1AH7_REG OCR1AH + +/* GTCCR */ +#define PSRSYNC_REG GTCCR +#define TSM_REG GTCCR + +/* DDRA */ +#define DDA0_REG DDRA +#define DDA1_REG DDRA +#define DDA2_REG DDRA +#define DDA3_REG DDRA + +/* ADCSRA */ +#define ADPS0_REG ADCSRA +#define ADPS1_REG ADCSRA +#define ADPS2_REG ADCSRA +#define ADIE_REG ADCSRA +#define ADIF_REG ADCSRA +#define ADATE_REG ADCSRA +#define ADSC_REG ADCSRA +#define ADEN_REG ADCSRA + +/* ADCSRB */ +#define ADTS0_REG ADCSRB +#define ADTS1_REG ADCSRB +#define ADTS2_REG ADCSRB +#define ACME_REG ADCSRB + +/* SPDR */ +#define SPDR0_REG SPDR +#define SPDR1_REG SPDR +#define SPDR2_REG SPDR +#define SPDR3_REG SPDR +#define SPDR4_REG SPDR +#define SPDR5_REG SPDR +#define SPDR6_REG SPDR +#define SPDR7_REG SPDR + +/* OCR0A */ +#define OCR0A_0_REG OCR0A +#define OCR0A_1_REG OCR0A +#define OCR0A_2_REG OCR0A +#define OCR0A_3_REG OCR0A +#define OCR0A_4_REG OCR0A +#define OCR0A_5_REG OCR0A +#define OCR0A_6_REG OCR0A +#define OCR0A_7_REG OCR0A + +/* SPSR */ +#define SPI2X_REG SPSR +#define WCOL_REG SPSR +#define SPIF_REG SPSR + +/* ACSR */ +#define ACIS0_REG ACSR +#define ACIS1_REG ACSR +#define ACIC_REG ACSR +#define ACIE_REG ACSR +#define ACI_REG ACSR +#define ACO_REG ACSR +#define ACBG_REG ACSR +#define ACD_REG ACSR + +/* ICR1H */ +#define ICR1H0_REG ICR1H +#define ICR1H1_REG ICR1H +#define ICR1H2_REG ICR1H +#define ICR1H3_REG ICR1H +#define ICR1H4_REG ICR1H +#define ICR1H5_REG ICR1H +#define ICR1H6_REG ICR1H +#define ICR1H7_REG ICR1H + +/* OCR1BL */ +#define OCR1BL0_REG OCR1BL +#define OCR1BL1_REG OCR1BL +#define OCR1BL2_REG OCR1BL +#define OCR1BL3_REG OCR1BL +#define OCR1BL4_REG OCR1BL +#define OCR1BL5_REG OCR1BL +#define OCR1BL6_REG OCR1BL +#define OCR1BL7_REG OCR1BL + +/* ICR1L */ +#define ICR1L0_REG ICR1L +#define ICR1L1_REG ICR1L +#define ICR1L2_REG ICR1L +#define ICR1L3_REG ICR1L +#define ICR1L4_REG ICR1L +#define ICR1L5_REG ICR1L +#define ICR1L6_REG ICR1L +#define ICR1L7_REG ICR1L + +/* OCR1BH */ +#define OCR1BH0_REG OCR1BH +#define OCR1BH1_REG OCR1BH +#define OCR1BH2_REG OCR1BH +#define OCR1BH3_REG OCR1BH +#define OCR1BH4_REG OCR1BH +#define OCR1BH5_REG OCR1BH +#define OCR1BH6_REG OCR1BH +#define OCR1BH7_REG OCR1BH + +/* PRR */ +#define PRADC_REG PRR +#define PRSPI_REG PRR +#define PRTIM1_REG PRR +#define PRTIM0_REG PRR +#define PRTWI_REG PRR + +/* GPIOR1 */ +#define GPIOR10_REG GPIOR1 +#define GPIOR11_REG GPIOR1 +#define GPIOR12_REG GPIOR1 +#define GPIOR13_REG GPIOR1 +#define GPIOR14_REG GPIOR1 +#define GPIOR15_REG GPIOR1 +#define GPIOR16_REG GPIOR1 +#define GPIOR17_REG GPIOR1 + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* TWBR */ +#define TWBR0_REG TWBR +#define TWBR1_REG TWBR +#define TWBR2_REG TWBR +#define TWBR3_REG TWBR +#define TWBR4_REG TWBR +#define TWBR5_REG TWBR +#define TWBR6_REG TWBR +#define TWBR7_REG TWBR + +/* PORTD */ +#define PORTD0_REG PORTD +#define PORTD1_REG PORTD +#define PORTD2_REG PORTD +#define PORTD3_REG PORTD +#define PORTD4_REG PORTD +#define PORTD5_REG PORTD +#define PORTD6_REG PORTD +#define PORTD7_REG PORTD + +/* MCUSR */ +#define PORF_REG MCUSR +#define EXTRF_REG MCUSR +#define BORF_REG MCUSR +#define WDRF_REG MCUSR + +/* EIMSK */ +#define INT0_REG EIMSK +#define INT1_REG EIMSK + +/* EECR */ +#define EERE_REG EECR +#define EEPE_REG EECR +#define EEMPE_REG EECR +#define EERIE_REG EECR +#define EEPM0_REG EECR +#define EEPM1_REG EECR + +/* SPMCSR */ +#define SELFPRGEN_REG SPMCSR +#define PGERS_REG SPMCSR +#define PGWRT_REG SPMCSR +#define RFLB_REG SPMCSR +#define CTPB_REG SPMCSR +#define RWWSB_REG SPMCSR + +/* OSCCAL */ +#define CAL0_REG OSCCAL +#define CAL1_REG OSCCAL +#define CAL2_REG OSCCAL +#define CAL3_REG OSCCAL +#define CAL4_REG OSCCAL +#define CAL5_REG OSCCAL +#define CAL6_REG OSCCAL +#define CAL7_REG OSCCAL + +/* TCNT1L */ +#define TCNT1L0_REG TCNT1L +#define TCNT1L1_REG TCNT1L +#define TCNT1L2_REG TCNT1L +#define TCNT1L3_REG TCNT1L +#define TCNT1L4_REG TCNT1L +#define TCNT1L5_REG TCNT1L +#define TCNT1L6_REG TCNT1L +#define TCNT1L7_REG TCNT1L + +/* PORTB */ +#define PORTB0_REG PORTB +#define PORTB1_REG PORTB +#define PORTB2_REG PORTB +#define PORTB3_REG PORTB +#define PORTB4_REG PORTB +#define PORTB5_REG PORTB +#define PORTB6_REG PORTB +#define PORTB7_REG PORTB + +/* ADCL */ +#define ADCL0_REG ADCL +#define ADCL1_REG ADCL +#define ADCL2_REG ADCL +#define ADCL3_REG ADCL +#define ADCL4_REG ADCL +#define ADCL5_REG ADCL +#define ADCL6_REG ADCL +#define ADCL7_REG ADCL + +/* SMCR */ +#define SE_REG SMCR +#define SM0_REG SMCR +#define SM1_REG SMCR + +/* TCNT1H */ +#define TCNT1H0_REG TCNT1H +#define TCNT1H1_REG TCNT1H +#define TCNT1H2_REG TCNT1H +#define TCNT1H3_REG TCNT1H +#define TCNT1H4_REG TCNT1H +#define TCNT1H5_REG TCNT1H +#define TCNT1H6_REG TCNT1H +#define TCNT1H7_REG TCNT1H + +/* PORTC */ +#define PORTC0_REG PORTC +#define PORTC1_REG PORTC +#define PORTC2_REG PORTC +#define PORTC3_REG PORTC +#define PORTC4_REG PORTC +#define PORTC5_REG PORTC +#define PORTC6_REG PORTC +#define PORTC7_REG PORTC + +/* ADCH */ +#define ADCH0_REG ADCH +#define ADCH1_REG ADCH +#define ADCH2_REG ADCH +#define ADCH3_REG ADCH +#define ADCH4_REG ADCH +#define ADCH5_REG ADCH +#define ADCH6_REG ADCH +#define ADCH7_REG ADCH + +/* TWHSR */ +#define TWIHS_REG TWHSR + +/* TWCR */ +#define TWIE_REG TWCR +#define TWEN_REG TWCR +#define TWWC_REG TWCR +#define TWSTO_REG TWCR +#define TWSTA_REG TWCR +#define TWEA_REG TWCR +#define TWINT_REG TWCR + +/* TCNT0 */ +#define TCNT0_0_REG TCNT0 +#define TCNT0_1_REG TCNT0 +#define TCNT0_2_REG TCNT0 +#define TCNT0_3_REG TCNT0 +#define TCNT0_4_REG TCNT0 +#define TCNT0_5_REG TCNT0 +#define TCNT0_6_REG TCNT0 +#define TCNT0_7_REG TCNT0 + +/* PCICR */ +#define PCIE0_REG PCICR +#define PCIE1_REG PCICR +#define PCIE2_REG PCICR +#define PCIE3_REG PCICR + +/* TWAR */ +#define TWGCE_REG TWAR +#define TWA0_REG TWAR +#define TWA1_REG TWAR +#define TWA2_REG TWAR +#define TWA3_REG TWAR +#define TWA4_REG TWAR +#define TWA5_REG TWAR +#define TWA6_REG TWAR + +/* GPIOR0 */ +#define GPIOR00_REG GPIOR0 +#define GPIOR01_REG GPIOR0 +#define GPIOR02_REG GPIOR0 +#define GPIOR03_REG GPIOR0 +#define GPIOR04_REG GPIOR0 +#define GPIOR05_REG GPIOR0 +#define GPIOR06_REG GPIOR0 +#define GPIOR07_REG GPIOR0 + +/* EEARL */ +#define EEAR0_REG EEARL +#define EEAR1_REG EEARL +#define EEAR2_REG EEARL +#define EEAR3_REG EEARL +#define EEAR4_REG EEARL +#define EEAR5_REG EEARL +#define EEAR6_REG EEARL +#define EEAR7_REG EEARL + +/* TIMSK0 */ +#define TOIE0_REG TIMSK0 +#define OCIE0A_REG TIMSK0 +#define OCIE0B_REG TIMSK0 + +/* TIMSK1 */ +#define TOIE1_REG TIMSK1 +#define OCIE1A_REG TIMSK1 +#define OCIE1B_REG TIMSK1 +#define ICIE1_REG TIMSK1 + +/* TCCR0A */ +#define CS00_REG TCCR0A +#define CS01_REG TCCR0A +#define CS02_REG TCCR0A +#define CTC0_REG TCCR0A + +/* TWSR */ +#define TWPS0_REG TWSR +#define TWPS1_REG TWSR +#define TWS3_REG TWSR +#define TWS4_REG TWSR +#define TWS5_REG TWSR +#define TWS6_REG TWSR +#define TWS7_REG TWSR + +/* GPIOR2 */ +#define GPIOR20_REG GPIOR2 +#define GPIOR21_REG GPIOR2 +#define GPIOR22_REG GPIOR2 +#define GPIOR23_REG GPIOR2 +#define GPIOR24_REG GPIOR2 +#define GPIOR25_REG GPIOR2 +#define GPIOR26_REG GPIOR2 +#define GPIOR27_REG GPIOR2 + +/* PCMSK0 */ +#define PCINT0_REG PCMSK0 +#define PCINT1_REG PCMSK0 +#define PCINT2_REG PCMSK0 +#define PCINT3_REG PCMSK0 +#define PCINT4_REG PCMSK0 +#define PCINT5_REG PCMSK0 +#define PCINT6_REG PCMSK0 +#define PCINT7_REG PCMSK0 + +/* PCMSK1 */ +#define PCINT8_REG PCMSK1 +#define PCINT9_REG PCMSK1 +#define PCINT10_REG PCMSK1 +#define PCINT11_REG PCMSK1 +#define PCINT12_REG PCMSK1 +#define PCINT13_REG PCMSK1 +#define PCINT14_REG PCMSK1 +#define PCINT15_REG PCMSK1 + +/* PCMSK2 */ +#define PCINT16_REG PCMSK2 +#define PCINT17_REG PCMSK2 +#define PCINT18_REG PCMSK2 +#define PCINT19_REG PCMSK2 +#define PCINT20_REG PCMSK2 +#define PCINT21_REG PCMSK2 +#define PCINT22_REG PCMSK2 +#define PCINT23_REG PCMSK2 + +/* PCMSK3 */ +#define PCINT24_REG PCMSK3 +#define PCINT25_REG PCMSK3 +#define PCINT26_REG PCMSK3 +#define PCINT27_REG PCMSK3 + +/* PINC */ +#define PINC0_REG PINC +#define PINC1_REG PINC +#define PINC2_REG PINC +#define PINC3_REG PINC +#define PINC4_REG PINC +#define PINC5_REG PINC +#define PINC6_REG PINC +#define PINC7_REG PINC + +/* DDRC */ +#define DDC0_REG DDRC +#define DDC1_REG DDRC +#define DDC2_REG DDRC +#define DDC3_REG DDRC +#define DDC4_REG DDRC +#define DDC5_REG DDRC +#define DDC6_REG DDRC +#define DDC7_REG DDRC + +/* EIFR */ +#define INTF0_REG EIFR +#define INTF1_REG EIFR + +/* EICRA */ +#define ISC00_REG EICRA +#define ISC01_REG EICRA +#define ISC10_REG EICRA +#define ISC11_REG EICRA + +/* DIDR0 */ +#define ADC0D_REG DIDR0 +#define ADC1D_REG DIDR0 +#define ADC2D_REG DIDR0 +#define ADC3D_REG DIDR0 +#define ADC4D_REG DIDR0 +#define ADC5D_REG DIDR0 +#define ADC6D_REG DIDR0 +#define ADC7D_REG DIDR0 + +/* DIDR1 */ +#define AIN0D_REG DIDR1 +#define AIN1D_REG DIDR1 +#define AREFD_REG DIDR1 + +/* MCUCR */ +#define PUD_REG MCUCR +#define BODSE_REG MCUCR +#define BODS_REG MCUCR + +/* TWAMR */ +#define TWAM0_REG TWAMR +#define TWAM1_REG TWAMR +#define TWAM2_REG TWAMR +#define TWAM3_REG TWAMR +#define TWAM4_REG TWAMR +#define TWAM5_REG TWAMR +#define TWAM6_REG TWAMR + +/* DDRD */ +#define DDD0_REG DDRD +#define DDD1_REG DDRD +#define DDD2_REG DDRD +#define DDD3_REG DDRD +#define DDD4_REG DDRD +#define DDD5_REG DDRD +#define DDD6_REG DDRD +#define DDD7_REG DDRD + +/* OCR1AL */ +#define OCR1AL0_REG OCR1AL +#define OCR1AL1_REG OCR1AL +#define OCR1AL2_REG OCR1AL +#define OCR1AL3_REG OCR1AL +#define OCR1AL4_REG OCR1AL +#define OCR1AL5_REG OCR1AL +#define OCR1AL6_REG OCR1AL +#define OCR1AL7_REG OCR1AL + +/* TIFR0 */ +#define TOV0_REG TIFR0 +#define OCF0A_REG TIFR0 +#define OCF0B_REG TIFR0 + +/* PINB */ +#define PINB0_REG PINB +#define PINB1_REG PINB +#define PINB2_REG PINB +#define PINB3_REG PINB +#define PINB4_REG PINB +#define PINB5_REG PINB +#define PINB6_REG PINB +#define PINB7_REG PINB + +/* PORTA */ +#define PORTA0_REG PORTA +#define PORTA1_REG PORTA +#define PORTA2_REG PORTA +#define PORTA3_REG PORTA + +/* PIND */ +#define PIND0_REG PIND +#define PIND1_REG PIND +#define PIND2_REG PIND +#define PIND3_REG PIND +#define PIND4_REG PIND +#define PIND5_REG PIND +#define PIND6_REG PIND +#define PIND7_REG PIND + +/* PINA */ +#define PINA0_REG PINA +#define PINA1_REG PINA +#define PINA2_REG PINA +#define PINA3_REG PINA + +/* SPCR */ +#define SPR0_REG SPCR +#define SPR1_REG SPCR +#define CPHA_REG SPCR +#define CPOL_REG SPCR +#define MSTR_REG SPCR +#define DORD_REG SPCR +#define SPE_REG SPCR +#define SPIE_REG SPCR + +/* TIFR1 */ +#define TOV1_REG TIFR1 +#define OCF1A_REG TIFR1 +#define OCF1B_REG TIFR1 +#define ICF1_REG TIFR1 + +/* pins mapping */ +#define ICP1_PORT PORTB +#define ICP1_BIT 0 +#define CLKO_PORT PORTB +#define CLKO_BIT 0 +#define PCINT0_PORT PORTB +#define PCINT0_BIT 0 + +#define OC1A_PORT PORTB +#define OC1A_BIT 1 +#define PCINT1_PORT PORTB +#define PCINT1_BIT 1 + +#define SS_PORT PORTB +#define SS_BIT 2 +#define OC1B_PORT PORTB +#define OC1B_BIT 2 +#define PCINT2_PORT PORTB +#define PCINT2_BIT 2 + +#define MOSI_PORT PORTB +#define MOSI_BIT 3 +#define OC2A_PORT PORTB +#define OC2A_BIT 3 +#define PCINT3_PORT PORTB +#define PCINT3_BIT 3 + +#define MISO_PORT PORTB +#define MISO_BIT 4 +#define PCINT4_PORT PORTB +#define PCINT4_BIT 4 + +#define SCK_PORT PORTB +#define SCK_BIT 5 +#define PCINT5_PORT PORTB +#define PCINT5_BIT 5 + +#define XTAL1_PORT PORTB +#define XTAL1_BIT 6 +#define TOSC1_PORT PORTB +#define TOSC1_BIT 6 +#define PCINT6_PORT PORTB +#define PCINT6_BIT 6 + +#define XTAL2_PORT PORTB +#define XTAL2_BIT 7 +#define TOSC2_PORT PORTB +#define TOSC2_BIT 7 +#define PCINT7_PORT PORTB +#define PCINT7_BIT 7 + +#define ADC0_PORT PORTC +#define ADC0_BIT 0 +#define PCINT8_PORT PORTC +#define PCINT8_BIT 0 + +#define ADC1_PORT PORTC +#define ADC1_BIT 1 +#define PCINT9_PORT PORTC +#define PCINT9_BIT 1 + +#define ADC2_PORT PORTC +#define ADC2_BIT 2 +#define PCINT10_PORT PORTC +#define PCINT10_BIT 2 + +#define ADC3_PORT PORTC +#define ADC3_BIT 3 +#define PCINT11_PORT PORTC +#define PCINT11_BIT 3 + +#define ADC4_PORT PORTC +#define ADC4_BIT 4 +#define SDA_PORT PORTC +#define SDA_BIT 4 +#define PCINT12_PORT PORTC +#define PCINT12_BIT 4 + +#define ADC5_PORT PORTC +#define ADC5_BIT 5 +#define SCL_PORT PORTC +#define SCL_BIT 5 +#define PCINT13_PORT PORTC +#define PCINT13_BIT 5 + +#define RESET_PORT PORTC +#define RESET_BIT 6 +#define PCINT14_PORT PORTC +#define PCINT14_BIT 6 + +#define RXD_PORT PORTD +#define RXD_BIT 0 +#define PCINT16_PORT PORTD +#define PCINT16_BIT 0 + +#define TXD_PORT PORTD +#define TXD_BIT 1 +#define PCINT17_PORT PORTD +#define PCINT17_BIT 1 + +#define INT0_PORT PORTD +#define INT0_BIT 2 +#define PCINT18_PORT PORTD +#define PCINT18_BIT 2 + +#define PCINT19_PORT PORTD +#define PCINT19_BIT 3 +#define OC2B_PORT PORTD +#define OC2B_BIT 3 +#define INT1_PORT PORTD +#define INT1_BIT 3 + +#define XCK_PORT PORTD +#define XCK_BIT 4 +#define T0_PORT PORTD +#define T0_BIT 4 +#define PCINT20_PORT PORTD +#define PCINT20_BIT 4 + +#define T1_PORT PORTD +#define T1_BIT 5 +#define OC0B_PORT PORTD +#define OC0B_BIT 5 +#define PCINT21_PORT PORTD +#define PCINT21_BIT 5 + +#define AIN0_PORT PORTD +#define AIN0_BIT 6 +#define OC0A_PORT PORTD +#define OC0A_BIT 6 +#define PCINT22_PORT PORTD +#define PCINT22_BIT 6 + +#define AIN1_PORT PORTD +#define AIN1_BIT 7 +#define PCINT23_PORT PORTD +#define PCINT23_BIT 7 + + diff --git a/aversive/parts/ATxmega128A1.h b/aversive/parts/ATxmega128A1.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega128A1.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/parts/ATxmega128A3.h b/aversive/parts/ATxmega128A3.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega128A3.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/parts/ATxmega256A3.h b/aversive/parts/ATxmega256A3.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega256A3.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/parts/ATxmega256A3B.h b/aversive/parts/ATxmega256A3B.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega256A3B.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/parts/ATxmega64A1.h b/aversive/parts/ATxmega64A1.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega64A1.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/parts/ATxmega64A3.h b/aversive/parts/ATxmega64A3.h new file mode 100644 index 0000000..0ea8e2b --- /dev/null +++ b/aversive/parts/ATxmega64A3.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2009) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id $ + * + */ + +/* WARNING : this file is automatically generated by scripts. + * You should not edit it. If you find something wrong in it, + * write to zer0@droids-corp.org */ + + + +/* available timers */ + +/* overflow interrupt number */ +#define SIG_OVERFLOW_TOTAL_NUM 0 + +/* output compare interrupt number */ +#define SIG_OUTPUT_COMPARE_TOTAL_NUM 0 + +/* Pwm nums */ +#define PWM_TOTAL_NUM 0 + +/* input capture interrupt number */ +#define SIG_INPUT_CAPTURE_TOTAL_NUM 0 + + +/* SPH */ +#define SP8_REG SPH +#define SP9_REG SPH +#define SP10_REG SPH +#define SP11_REG SPH +#define SP12_REG SPH +#define SP13_REG SPH +#define SP14_REG SPH +#define SP15_REG SPH + +/* SPL */ +#define SP0_REG SPL +#define SP1_REG SPL +#define SP2_REG SPL +#define SP3_REG SPL +#define SP4_REG SPL +#define SP5_REG SPL +#define SP6_REG SPL +#define SP7_REG SPL + +/* SREG */ +#define C_REG SREG +#define Z_REG SREG +#define N_REG SREG +#define V_REG SREG +#define S_REG SREG +#define H_REG SREG +#define T_REG SREG +#define I_REG SREG + +/* pins mapping */ + diff --git a/aversive/pgmspace.h b/aversive/pgmspace.h new file mode 100644 index 0000000..9ff8df4 --- /dev/null +++ b/aversive/pgmspace.h @@ -0,0 +1,139 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: pgmspace.h,v 1.1.2.4 2007-11-21 21:54:38 zer0 Exp $ + * + */ + +/** + * This file is used for compatibility between host and avr : with + * this we can emulate pgmspace on a host. + */ + +#ifndef _AVERSIVE_PGMSPACE_H_ +#define _AVERSIVE_PGMSPACE_H_ + +#ifndef HOST_VERSION + +#include +#define PGMS_FMT "%S" + + +#else + +#include +#include +#include +#include +#include + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; + + +static inline int memcmp_P(const void *s1, + const prog_void *s2, unsigned n) +{ + return memcmp(s1, s2, n); +} + +static inline void *memcpy_P(void *s1, + const prog_void *s2, unsigned n) +{ + return memcpy(s1, s2, n); +} + +static inline char *strcat_P(char *s1, const prog_char *s2) +{ + return strcat(s1, s2); +} + +static inline char *strcpy_P(char *s1, const prog_char *s2) +{ + return strcpy(s1, s2); +} + +static inline char *strncpy_P(char *s1, const prog_char *s2, + unsigned n) +{ + return strncpy(s1, s2, n); +} + +static inline int strcmp_P(const char *s1, const prog_char *s2) +{ + return strcmp(s1, s2); +} + +static inline int strncmp_P(const char *s1, const prog_char *s2, + unsigned n) +{ + return strncmp(s1, s2, n); +} + +static inline unsigned strlen_P(const prog_char *s) +{ + return strlen(s); +} + +static inline int vfprintf_P(FILE *stream, + const prog_char *s, va_list ap) +{ + return vfprintf(stream, s, ap); +} + +static inline int vsprintf_P(char *buf, const prog_char *s, + va_list ap) +{ + return vsprintf(buf, s, ap); +} + +#define PGM_P const char * +#define PSTR(x) x +#define PROGMEM +#define printf_P(args...) printf(args) +#define sprintf_P(buf, args...) sprintf(buf, args) +#define snprintf_P(buf, n, args...) snprintf(buf, n, args) + +static inline uint32_t pgm_read_dword(const prog_void *x) +{ + return *(uint32_t *)x; +} + +static inline uint16_t pgm_read_word(const prog_void *x) +{ + return *(uint16_t *)x; +} + +static inline uint8_t pgm_read_byte(const prog_void *x) +{ + return *(uint8_t *)x; +} + +#define PGMS_FMT "%s" + +#endif /* HOST_VERSION */ +#endif /* _AVERSIVE_PGMSPACE_H_ */ + + diff --git a/aversive/pgmspace.h~ b/aversive/pgmspace.h~ new file mode 100644 index 0000000..9ff8df4 --- /dev/null +++ b/aversive/pgmspace.h~ @@ -0,0 +1,139 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: pgmspace.h,v 1.1.2.4 2007-11-21 21:54:38 zer0 Exp $ + * + */ + +/** + * This file is used for compatibility between host and avr : with + * this we can emulate pgmspace on a host. + */ + +#ifndef _AVERSIVE_PGMSPACE_H_ +#define _AVERSIVE_PGMSPACE_H_ + +#ifndef HOST_VERSION + +#include +#define PGMS_FMT "%S" + + +#else + +#include +#include +#include +#include +#include + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; + + +static inline int memcmp_P(const void *s1, + const prog_void *s2, unsigned n) +{ + return memcmp(s1, s2, n); +} + +static inline void *memcpy_P(void *s1, + const prog_void *s2, unsigned n) +{ + return memcpy(s1, s2, n); +} + +static inline char *strcat_P(char *s1, const prog_char *s2) +{ + return strcat(s1, s2); +} + +static inline char *strcpy_P(char *s1, const prog_char *s2) +{ + return strcpy(s1, s2); +} + +static inline char *strncpy_P(char *s1, const prog_char *s2, + unsigned n) +{ + return strncpy(s1, s2, n); +} + +static inline int strcmp_P(const char *s1, const prog_char *s2) +{ + return strcmp(s1, s2); +} + +static inline int strncmp_P(const char *s1, const prog_char *s2, + unsigned n) +{ + return strncmp(s1, s2, n); +} + +static inline unsigned strlen_P(const prog_char *s) +{ + return strlen(s); +} + +static inline int vfprintf_P(FILE *stream, + const prog_char *s, va_list ap) +{ + return vfprintf(stream, s, ap); +} + +static inline int vsprintf_P(char *buf, const prog_char *s, + va_list ap) +{ + return vsprintf(buf, s, ap); +} + +#define PGM_P const char * +#define PSTR(x) x +#define PROGMEM +#define printf_P(args...) printf(args) +#define sprintf_P(buf, args...) sprintf(buf, args) +#define snprintf_P(buf, n, args...) snprintf(buf, n, args) + +static inline uint32_t pgm_read_dword(const prog_void *x) +{ + return *(uint32_t *)x; +} + +static inline uint16_t pgm_read_word(const prog_void *x) +{ + return *(uint16_t *)x; +} + +static inline uint8_t pgm_read_byte(const prog_void *x) +{ + return *(uint8_t *)x; +} + +#define PGMS_FMT "%s" + +#endif /* HOST_VERSION */ +#endif /* _AVERSIVE_PGMSPACE_H_ */ + + diff --git a/aversive/queue.h b/aversive/queue.h new file mode 100644 index 0000000..bad0753 --- /dev/null +++ b/aversive/queue.h @@ -0,0 +1,517 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.7 2002/04/17 14:21:02 des Exp $ + */ + +#ifndef _AVERSIVE_QUEUE_H_ +#define _AVERSIVE_QUEUE_H_ + +#ifndef __offsetof +#define __offsetof(type, field) ((size_t)(&(type *)0)->field)) +#endif + +/* + * This file defines five types of data structures: singly-linked lists, + * singly-linked tail queues, lists, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ CIRCLEQ + * _HEAD + + + + + + * _HEAD_INITIALIZER + + + + + + * _ENTRY + + + + + + * _INIT + + + + + + * _EMPTY + + + + + + * _FIRST + + + + + + * _NEXT + + + + + + * _PREV - - - + + + * _LAST - - + + + + * _FOREACH + + + + + + * _FOREACH_REVERSE - - - + + + * _INSERT_HEAD + + + + + + * _INSERT_BEFORE - + - + + + * _INSERT_AFTER + + + + + + * _INSERT_TAIL - - + + + + * _REMOVE_HEAD + - + - - + * _REMOVE + + + + + + * + */ + +/* + * Singly-linked List declarations. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define SLIST_FIRST(head) ((head)->slh_first) + +#define SLIST_FOREACH(var, head, field) \ + for ((var) = SLIST_FIRST((head)); \ + (var); \ + (var) = SLIST_NEXT((var), field)) + +#define SLIST_INIT(head) do { \ + SLIST_FIRST((head)) = NULL; \ +} while (0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ + SLIST_NEXT((slistelm), field) = (elm); \ +} while (0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ + SLIST_FIRST((head)) = (elm); \ +} while (0) + +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if (SLIST_FIRST((head)) == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = SLIST_FIRST((head)); \ + while (SLIST_NEXT(curelm, field) != (elm)) \ + curelm = SLIST_NEXT(curelm, field); \ + SLIST_NEXT(curelm, field) = \ + SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ + } \ +} while (0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ +} while (0) + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first;/* first element */ \ + struct type **stqh_last;/* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define STAILQ_FIRST(head) ((head)->stqh_first) + +#define STAILQ_FOREACH(var, head, field) \ + for((var) = STAILQ_FIRST((head)); \ + (var); \ + (var) = STAILQ_NEXT((var), field)) + +#define STAILQ_INIT(head) do { \ + STAILQ_FIRST((head)) = NULL; \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_NEXT((tqelm), field) = (elm); \ +} while (0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_FIRST((head)) = (elm); \ +} while (0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + STAILQ_NEXT((elm), field) = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ +} while (0) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY(head) ? \ + NULL : \ + ((struct type *) \ + ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) + +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if (STAILQ_FIRST((head)) == (elm)) { \ + STAILQ_REMOVE_HEAD(head, field); \ + } \ + else { \ + struct type *curelm = STAILQ_FIRST((head)); \ + while (STAILQ_NEXT(curelm, field) != (elm)) \ + curelm = STAILQ_NEXT(curelm, field); \ + if ((STAILQ_NEXT(curelm, field) = \ + STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ + (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ + } \ +} while (0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if ((STAILQ_FIRST((head)) = \ + STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ + if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +/* + * List declarations. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#define LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = LIST_FIRST((head)); \ + (var); \ + (var) = LIST_NEXT((var), field)) + +#define LIST_INIT(head) do { \ + LIST_FIRST((head)) = NULL; \ +} while (0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ + LIST_NEXT((listelm), field)->field.le_prev = \ + &LIST_NEXT((elm), field); \ + LIST_NEXT((listelm), field) = (elm); \ + (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ +} while (0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + LIST_NEXT((elm), field) = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ +} while (0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ + LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ + LIST_FIRST((head)) = (elm); \ + (elm)->field.le_prev = &LIST_FIRST((head)); \ +} while (0) + +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_REMOVE(elm, field) do { \ + if (LIST_NEXT((elm), field) != NULL) \ + LIST_NEXT((elm), field)->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = LIST_NEXT((elm), field); \ +} while (0) + +/* + * Tail queue declarations. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * Tail queue functions. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define TAILQ_FIRST(head) ((head)->tqh_first) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = TAILQ_FIRST((head)); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_INIT(head) do { \ + TAILQ_FIRST((head)) = NULL; \ + (head)->tqh_last = &TAILQ_FIRST((head)); \ +} while (0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + TAILQ_NEXT((listelm), field) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ +} while (0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + TAILQ_NEXT((elm), field) = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ +} while (0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ + TAILQ_FIRST((head))->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + TAILQ_FIRST((head)) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ +} while (0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + TAILQ_NEXT((elm), field) = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ +} while (0) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) + +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if ((TAILQ_NEXT((elm), field)) != NULL) \ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ +} while (0) + +/* + * Circular queue declarations. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&(head), (void *)&(head) } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) + +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = CIRCLEQ_FIRST((head)); \ + (var) != (void *)(head) || ((var) = NULL); \ + (var) = CIRCLEQ_NEXT((var), field)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = CIRCLEQ_LAST((head)); \ + (var) != (void *)(head) || ((var) = NULL); \ + (var) = CIRCLEQ_PREV((var), field)) + +#define CIRCLEQ_INIT(head) do { \ + CIRCLEQ_FIRST((head)) = (void *)(head); \ + CIRCLEQ_LAST((head)) = (void *)(head); \ +} while (0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = CIRCLEQ_NEXT((listelm), field); \ + CIRCLEQ_PREV((elm), field) = (listelm); \ + if (CIRCLEQ_NEXT((listelm), field) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = (elm); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_NEXT((listelm), field), field) = (elm);\ + CIRCLEQ_NEXT((listelm), field) = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = (listelm); \ + CIRCLEQ_PREV((elm), field) = CIRCLEQ_PREV((listelm), field); \ + if (CIRCLEQ_PREV((listelm), field) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = (elm); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_PREV((listelm), field), field) = (elm);\ + CIRCLEQ_PREV((listelm), field) = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = CIRCLEQ_FIRST((head)); \ + CIRCLEQ_PREV((elm), field) = (void *)(head); \ + if (CIRCLEQ_LAST((head)) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = (elm); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_FIRST((head)), field) = (elm); \ + CIRCLEQ_FIRST((head)) = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = (void *)(head); \ + CIRCLEQ_PREV((elm), field) = CIRCLEQ_LAST((head)); \ + if (CIRCLEQ_FIRST((head)) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = (elm); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_LAST((head)), field) = (elm); \ + CIRCLEQ_LAST((head)) = (elm); \ +} while (0) + +#define CIRCLEQ_LAST(head) ((head)->cqh_last) + +#define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) + +#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if (CIRCLEQ_NEXT((elm), field) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = CIRCLEQ_PREV((elm), field); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_NEXT((elm), field), field) = \ + CIRCLEQ_PREV((elm), field); \ + if (CIRCLEQ_PREV((elm), field) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = CIRCLEQ_NEXT((elm), field); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_PREV((elm), field), field) = \ + CIRCLEQ_NEXT((elm), field); \ +} while (0) + + +#endif /* !_AVERSIVE_QUEUE_H_ */ diff --git a/aversive/timers.h b/aversive/timers.h new file mode 100644 index 0000000..892c81e --- /dev/null +++ b/aversive/timers.h @@ -0,0 +1,196 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timers.h,v 1.1.2.4 2009-01-23 23:54:16 zer0 Exp $ + * + */ + +/* + * This file contains definitions used for timer use + * + * In the future, most of definitions will be added in autogenerated + * files from atmel's documentation (aversive/parts.h and + * aversive/parts/ATxxxx.h) which are not timer specific. + */ + +/* XXX won't be needed : use parts.h */ + +#ifndef _AVERSIVE_TIMERS_H_ +#define _AVERSIVE_TIMERS_H_ + +// Timer WGM bits +#define TIMER_8_MODE_NORMAL 0 +#define TIMER_8_MODE_PWM_PC 1 // phase correct PWM +#define TIMER_8_MODE_CTC 2 +#define TIMER_8_MODE_PWM 3 // fast PWM + +#define TIMER_16_MODE_NORMAL 0 +#define TIMER_16_MODE_PWM_PC_8 1 // phase correct PWM 8 bits +#define TIMER_16_MODE_PWM_PC_9 2 // phase correct PWM 9 bits +#define TIMER_16_MODE_PWM_PC_10 3 // phase correct PWM 10 bits +#define TIMER_16_MODE_CTC1 4 // clear on compare, TOP = OCRA +#define TIMER_16_MODE_PWM_8 5 // fast PWM 8 bits +#define TIMER_16_MODE_PWM_9 6 // fast PWM 9 bits +#define TIMER_16_MODE_PWM_10 7 // fast PWM 10 bits +#define TIMER_16_MODE_PWM_PFC1 8 // PWM, Phase & Freq Correct +#define TIMER_16_MODE_PWM_PFC2 9 // PWM, Phase & Freq Correct +#define TIMER_16_MODE_PWM_PC1 10 // PWM, Phase Correct +#define TIMER_16_MODE_PWM_PC2 11 // PWM, Phase Correct +#define TIMER_16_MODE_CTC2 12 // clear on compare, TOP = ICR +#define TIMER_16_MODE_PWM_F1 14 // fast PWM +#define TIMER_16_MODE_PWM_F2 15 // fast PWM + + +// ATMEGA128 //////////////////////////////////////// +#if defined (__AVR_ATmega128__) + +// OCR_BITS +#define OCR0_DDR DDRB +#define OCR0_BIT 4 +#define OCR1A_DDR DDRB +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 6 +#define OCR1C_DDR DDRB +#define OCR1C_BIT 7 +#define OCR2_DDR DDRB +#define OCR2_BIT 7 +#define OCR3A_DDR DDRE +#define OCR3A_BIT 3 +#define OCR3B_DDR DDRE +#define OCR3B_BIT 4 +#define OCR3C_DDR DDRE +#define OCR3C_BIT 5 + + + + +// ATMEGA1281 //////////////////////////////////////// +#elif defined (__AVR_ATmega1281__) + +// OCR_BITS +#define OCR0A_DDR DDRB +#define OCR0A_BIT 7 +#define OCR0B_DDR DDRG +#define OCR0B_BIT 5 +#define OCR1A_DDR DDRB +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 6 +#define OCR1C_DDR DDRB +#define OCR1C_BIT 7 +#define OCR2A_DDR DDRB +#define OCR2A_BIT 4 +#define OCR3A_DDR DDRE +#define OCR3A_BIT 3 +#define OCR3B_DDR DDRE +#define OCR3B_BIT 4 +#define OCR3C_DDR DDRE +#define OCR3C_BIT 5 + + + +// ATMEGA32 //////////////////////////////////////// +#elif defined (__AVR_ATmega32__) || defined (__AVR_ATmega323__) + +#ifdef __AVR_ATmega323__ + +// renamed bits +#define WGM20 PWM2 +#define WGM21 CTC2 + +#define WGM10 PWM10 +#define WGM11 PWM11 +#define WGM12 3//CTC1 +#define WGM13 4 // reserve bit + +#define WGM00 PWM0 +#define WGM01 CTC0 + +#endif // mega323 + + +// OCR_BITS +#define OCR0_DDR DDRB +#define OCR0_BIT 3 +#define OCR1A_DDR DDRD +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRD +#define OCR1B_BIT 4 +#define OCR2_DDR DDRD +#define OCR2_BIT 7 + + +// ATMEGA8 //////////////////////////////////////// +#elif defined (__AVR_ATmega8__) + +// OCR_BITS +#define OCR1A_DDR DDRB +#define OCR1A_BIT 1 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 2 +#define OCR2_DDR DDRB +#define OCR2_BIT 3 + + + +// ATMEGA163 //////////////////////////////////////// +#elif defined (__AVR_ATmega163__) + +// renamed bits +#define WGM20 PWM2 +#define WGM21 CTC2 + +#define WGM10 PWM10 +#define WGM11 PWM11 +#define WGM12 CTC1 +#define WGM13 4 // reserve bit + +// OCR_BITS +#define OCR1A_DDR DDRD +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRD +#define OCR1B_BIT 4 +#define OCR2_DDR DDRD +#define OCR2_BIT 7 + + +// ATMEGAx8 //////////////////////////////////////// +#elif defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega168__) + +// OCR_BITS +#define OCR0A_DDR DDRD +#define OCR0A_BIT 6 +#define OCR0B_DDR DDRD +#define OCR0B_BIT 5 + +#define OCR1A_DDR DDRB +#define OCR1A_BIT 1 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 2 + +#define OCR2A_DDR DDRB +#define OCR2A_BIT 3 +#define OCR2B_DDR DDRD +#define OCR2B_BIT 3 + + +#else +//#error No timer/prescaler definitions for your AVR type +#endif + +#endif diff --git a/aversive/timers.h~ b/aversive/timers.h~ new file mode 100644 index 0000000..892c81e --- /dev/null +++ b/aversive/timers.h~ @@ -0,0 +1,196 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timers.h,v 1.1.2.4 2009-01-23 23:54:16 zer0 Exp $ + * + */ + +/* + * This file contains definitions used for timer use + * + * In the future, most of definitions will be added in autogenerated + * files from atmel's documentation (aversive/parts.h and + * aversive/parts/ATxxxx.h) which are not timer specific. + */ + +/* XXX won't be needed : use parts.h */ + +#ifndef _AVERSIVE_TIMERS_H_ +#define _AVERSIVE_TIMERS_H_ + +// Timer WGM bits +#define TIMER_8_MODE_NORMAL 0 +#define TIMER_8_MODE_PWM_PC 1 // phase correct PWM +#define TIMER_8_MODE_CTC 2 +#define TIMER_8_MODE_PWM 3 // fast PWM + +#define TIMER_16_MODE_NORMAL 0 +#define TIMER_16_MODE_PWM_PC_8 1 // phase correct PWM 8 bits +#define TIMER_16_MODE_PWM_PC_9 2 // phase correct PWM 9 bits +#define TIMER_16_MODE_PWM_PC_10 3 // phase correct PWM 10 bits +#define TIMER_16_MODE_CTC1 4 // clear on compare, TOP = OCRA +#define TIMER_16_MODE_PWM_8 5 // fast PWM 8 bits +#define TIMER_16_MODE_PWM_9 6 // fast PWM 9 bits +#define TIMER_16_MODE_PWM_10 7 // fast PWM 10 bits +#define TIMER_16_MODE_PWM_PFC1 8 // PWM, Phase & Freq Correct +#define TIMER_16_MODE_PWM_PFC2 9 // PWM, Phase & Freq Correct +#define TIMER_16_MODE_PWM_PC1 10 // PWM, Phase Correct +#define TIMER_16_MODE_PWM_PC2 11 // PWM, Phase Correct +#define TIMER_16_MODE_CTC2 12 // clear on compare, TOP = ICR +#define TIMER_16_MODE_PWM_F1 14 // fast PWM +#define TIMER_16_MODE_PWM_F2 15 // fast PWM + + +// ATMEGA128 //////////////////////////////////////// +#if defined (__AVR_ATmega128__) + +// OCR_BITS +#define OCR0_DDR DDRB +#define OCR0_BIT 4 +#define OCR1A_DDR DDRB +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 6 +#define OCR1C_DDR DDRB +#define OCR1C_BIT 7 +#define OCR2_DDR DDRB +#define OCR2_BIT 7 +#define OCR3A_DDR DDRE +#define OCR3A_BIT 3 +#define OCR3B_DDR DDRE +#define OCR3B_BIT 4 +#define OCR3C_DDR DDRE +#define OCR3C_BIT 5 + + + + +// ATMEGA1281 //////////////////////////////////////// +#elif defined (__AVR_ATmega1281__) + +// OCR_BITS +#define OCR0A_DDR DDRB +#define OCR0A_BIT 7 +#define OCR0B_DDR DDRG +#define OCR0B_BIT 5 +#define OCR1A_DDR DDRB +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 6 +#define OCR1C_DDR DDRB +#define OCR1C_BIT 7 +#define OCR2A_DDR DDRB +#define OCR2A_BIT 4 +#define OCR3A_DDR DDRE +#define OCR3A_BIT 3 +#define OCR3B_DDR DDRE +#define OCR3B_BIT 4 +#define OCR3C_DDR DDRE +#define OCR3C_BIT 5 + + + +// ATMEGA32 //////////////////////////////////////// +#elif defined (__AVR_ATmega32__) || defined (__AVR_ATmega323__) + +#ifdef __AVR_ATmega323__ + +// renamed bits +#define WGM20 PWM2 +#define WGM21 CTC2 + +#define WGM10 PWM10 +#define WGM11 PWM11 +#define WGM12 3//CTC1 +#define WGM13 4 // reserve bit + +#define WGM00 PWM0 +#define WGM01 CTC0 + +#endif // mega323 + + +// OCR_BITS +#define OCR0_DDR DDRB +#define OCR0_BIT 3 +#define OCR1A_DDR DDRD +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRD +#define OCR1B_BIT 4 +#define OCR2_DDR DDRD +#define OCR2_BIT 7 + + +// ATMEGA8 //////////////////////////////////////// +#elif defined (__AVR_ATmega8__) + +// OCR_BITS +#define OCR1A_DDR DDRB +#define OCR1A_BIT 1 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 2 +#define OCR2_DDR DDRB +#define OCR2_BIT 3 + + + +// ATMEGA163 //////////////////////////////////////// +#elif defined (__AVR_ATmega163__) + +// renamed bits +#define WGM20 PWM2 +#define WGM21 CTC2 + +#define WGM10 PWM10 +#define WGM11 PWM11 +#define WGM12 CTC1 +#define WGM13 4 // reserve bit + +// OCR_BITS +#define OCR1A_DDR DDRD +#define OCR1A_BIT 5 +#define OCR1B_DDR DDRD +#define OCR1B_BIT 4 +#define OCR2_DDR DDRD +#define OCR2_BIT 7 + + +// ATMEGAx8 //////////////////////////////////////// +#elif defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega168__) + +// OCR_BITS +#define OCR0A_DDR DDRD +#define OCR0A_BIT 6 +#define OCR0B_DDR DDRD +#define OCR0B_BIT 5 + +#define OCR1A_DDR DDRB +#define OCR1A_BIT 1 +#define OCR1B_DDR DDRB +#define OCR1B_BIT 2 + +#define OCR2A_DDR DDRB +#define OCR2A_BIT 3 +#define OCR2B_DDR DDRD +#define OCR2B_BIT 3 + + +#else +//#error No timer/prescaler definitions for your AVR type +#endif + +#endif diff --git a/aversive/types.h b/aversive/types.h new file mode 100644 index 0000000..6eb3cca --- /dev/null +++ b/aversive/types.h @@ -0,0 +1,57 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: types.h,v 1.1.2.1 2007-05-23 17:18:09 zer0 Exp $ + * + */ + +#ifndef _AVERSIVE_TYPES_H_ +#define _AVERSIVE_TYPES_H_ + +#include + +#define U08_MIN 0x00 +#define U08_MAX 0xFF +#define U16_MIN 0x0000 +#define U16_MAX 0xFFFF +#define U32_MIN 0x00000000 +#define U32_MAX 0xFFFFFFFF +#define U64_MIN 0x0000000000000000 +#define U64_MAX 0xFFFFFFFFFFFFFFFF +#define S08_MIN 0x80 +#define S08_MAX 0x7F +#define S16_MIN 0x8000 +#define S16_MAX 0x7FFF +#define S32_MIN 0x80000000 +#define S32_MAX 0x7FFFFFFF +#define S64_MIN 0x8000000000000000 +#define S64_MAX 0x7FFFFFFFFFFFFFFF + +/* you should use uintXX_t instead of uXX which is more standard */ + +/* explicit types u = unsigned, s = signed */ +typedef uint8_t u08; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef int8_t s08; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + + +#endif /* _AVERSIVE_TYPES_H_ */ diff --git a/aversive/wait.h b/aversive/wait.h new file mode 100644 index 0000000..a845721 --- /dev/null +++ b/aversive/wait.h @@ -0,0 +1,69 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: wait.h,v 1.1.2.1 2007-05-23 17:18:09 zer0 Exp $ + * + */ + +/** + * This file is an interface for wait functions, in order to put the + * microcontroller in a loop state. + */ + +/**********************************************************/ + +#ifndef _AVERSIVE_WAIT_H_ +#define _AVERSIVE_WAIT_H_ + +#include + +#ifdef HOST_VERSION + +#include + +#define wait_3cyc(n) do { volatile int a = 0; a++; } while (0) +#define wait_4cyc(n) do { volatile int a = 0; a++; } while (0) +#define wait_ms(n) host_wait_ms(n) + +#else /* HOST_VERSION */ + +#if __AVR_LIBC_VERSION__ < 10403UL +#include +#else +#include +#endif + +/** wait n "3 cycles time" + * n is 8 bits */ +#define wait_3cyc(n) _delay_loop_1(n) + +/** wait n "4 cycles time" + * n is 16 bits */ +#define wait_4cyc(n) _delay_loop_2(n) + +/** wait n milliseconds + * n is 16 bits + */ +static inline void wait_ms(uint16_t n) +{ + while ( n -- ) + wait_4cyc(F_CPU/4000); +} + +#endif /* else HOST_VERSION */ + +#endif /* _AVERSIVE_WAIT_ */ diff --git a/callout.c b/callout.c new file mode 100644 index 0000000..1b4ffe9 --- /dev/null +++ b/callout.c @@ -0,0 +1,327 @@ +/*- + * Copyright (c) <2010>, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * - Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "callout.h" + +#ifdef CALLOUT_STATS +#define __TIMER_STAT_ADD(cm, field, x) cm->stats.field += x +#else +#define __TIMER_STAT_ADD(cm, field, x) do { } while(0) +#endif + +#ifdef CALLOUT_DEBUG +#define callout_dprintf(fmt, ...) printf("%s(): " fmt, __FUNCTION__, \ + __VA_ARGS__) +#else +#define callout_dprintf(...) do { } while (0) +#endif + +/* Initialize a callout manager */ +int +callout_manager_init(struct callout_manager *cm, get_time_t *get_time) +{ + if (get_time == NULL) + return -1; + memset(cm, 0, sizeof(*cm)); + cm->get_time = get_time; + TAILQ_INIT(&cm->pending_list); + return 0; +} + +/* Initialize the timer handle tim for use */ +void +callout_init(struct callout *tim) +{ + memset(tim, 0, sizeof(*tim)); +} + +/* + * add in list (timer must not already be in a list) + */ +static void +callout_add(struct callout_manager *cm, struct callout *tim) +{ + struct callout *t; + + callout_dprintf("cm=%p tim=%p\n", cm, tim); + + /* list is empty */ + if (TAILQ_EMPTY(&cm->pending_list)) { + TAILQ_INSERT_HEAD(&cm->pending_list, tim, next); + return; + } + + /* 'tim' expires before first entry */ + t = TAILQ_FIRST(&cm->pending_list); + if ((int16_t)(tim->expire - t->expire) < 0) { + TAILQ_INSERT_HEAD(&cm->pending_list, tim, next); + return; + } + + /* find an element that will expire after 'tim' */ + TAILQ_FOREACH(t, &cm->pending_list, next) { + if ((int16_t)(tim->expire - t->expire) < 0) { + TAILQ_INSERT_BEFORE(t, tim, next); + return; + } + } + + /* not found, insert at the end of the list */ + TAILQ_INSERT_TAIL(&cm->pending_list, tim, next); +} + +/* + * del from list (timer must be in a list) + */ +static void +callout_del(struct callout_manager *cm, struct callout *tim) +{ + callout_dprintf("cm=%p tim=%p\n", cm, tim); + TAILQ_REMOVE(&cm->pending_list, tim, next); +} + +/* Reset and start the timer associated with the timer handle tim */ +static int +__callout_reset(struct callout_manager *cm, struct callout *tim, uint16_t expire, + uint16_t period, callout_cb_t fct, void *arg) +{ + callout_dprintf("cm=%p tim=%p expire=%d period=%d\n", + cm, tim, expire, period); + + __TIMER_STAT_ADD(cm, reset, 1); + cm->updated = 1; + + /* remove it from list */ + if (tim->scheduled == 1 && tim->running == 0) { + callout_del(cm, tim); + __TIMER_STAT_ADD(cm, pending, -1); + } + + tim->period = period; + tim->expire = expire; + tim->f = fct; + tim->arg = arg; + tim->scheduled = 1; + tim->running = 0; + + __TIMER_STAT_ADD(cm, pending, 1); + callout_add(cm, tim); + + return 0; +} + +/* Reset and start the timer associated with the timer handle tim */ +int +callout_reset(struct callout_manager *cm, struct callout *tim, uint16_t ticks, + enum callout_type type, callout_cb_t fct, void *arg) +{ + uint16_t cur_time = cm->get_time(); + return __callout_reset(cm, tim, ticks + cur_time, + type == PERIODICAL ? ticks : 0, fct, arg); +} + +/* Stop the timer associated with the timer handle tim */ +void +callout_stop(struct callout_manager *cm, struct callout *tim) +{ + callout_dprintf("cm=%p tim=%p\n", cm, tim); + + __TIMER_STAT_ADD(cm, stop, 1); + cm->updated = 1; + + /* remove it from list */ + if (tim->scheduled == 1 && tim->running == 0) { + callout_del(cm, tim); + __TIMER_STAT_ADD(cm, pending, -1); + } +} + +/* Test the PENDING status of the timer handle tim */ +int +callout_pending(struct callout *tim) +{ + return tim->scheduled == 1; +} + +/* must be called periodically, run all timer that expired */ +void callout_manage(struct callout_manager *cm) +{ + struct callout_list expired_list; + struct callout *tim; + uint16_t cur_time = cm->get_time(); + + callout_dprintf("cm=%p\n", cm); + + TAILQ_INIT(&expired_list); + __TIMER_STAT_ADD(cm, manage, 1); + + /* move all expired timers in a local list */ + while (!TAILQ_EMPTY(&cm->pending_list)) { + tim = TAILQ_FIRST(&cm->pending_list); + + if ((int16_t)(cur_time - tim->expire) < 0) + break; + + TAILQ_REMOVE(&cm->pending_list, tim, next); + TAILQ_INSERT_TAIL(&expired_list, tim, next); + } + + /* for each timer of 'expired' list, execute callback */ + while (!TAILQ_EMPTY(&expired_list)) { + tim = TAILQ_FIRST(&expired_list); + TAILQ_REMOVE(&expired_list, tim, next); + + cm->updated = 0; + + /* execute callback function with list unlocked */ + __TIMER_STAT_ADD(cm, pending, -1); + __TIMER_STAT_ADD(cm, running, 1); + tim->running = 1; + tim->f(cm, tim, tim->arg); + __TIMER_STAT_ADD(cm, running, -1); + + /* the timer was stopped or reloaded by the callback + * function, we have nothing to do here */ + if (cm->updated == 1) + continue; + + tim->running = 0; + tim->scheduled = 0; + + /* if timer type is periodical, reschedule */ + if (tim->period != 0) { + __callout_reset(cm, tim, cur_time + tim->period, + tim->period, tim->f, tim->arg); + } + } +} + +/* dump statistics about timers */ +void callout_dump_stats(struct callout_manager *cm) +{ +#ifdef CALLOUT_STATS + printf("Timer statistics:\n"); + printf(" reset = %d\n", cm->stats.reset); + printf(" stop = %d\n", cm->stats.stop); + printf(" manage = %d\n", cm->stats.manage); + printf(" pending = %d\n", cm->stats.pending); + printf(" running = %d\n", cm->stats.running); +#else + printf("No timer statistics, CALLOUT_STATS is disabled\n"); +#endif +} + +#if 0 + +/******************************/ + +#include +#include + +static uint16_t get_time(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec; +} + +static void cb1(struct callout_manager *cm, struct callout *tim, void *arg); +static void cb2(struct callout_manager *cm, struct callout *tim, void *arg); +static void cb3(struct callout_manager *cm, struct callout *tim, void *arg); + +static void cb1(struct callout_manager *cm, struct callout *tim, void *arg) +{ + static int cnt; + arg = arg; /* silent compiler */ + + printf("cb1\n"); + callout_dump_stats(cm); + if (++cnt >= 4) + callout_stop(cm, tim); +} + +static void cb2(struct callout_manager *cm, struct callout *tim, void *arg) +{ + static int cnt; + struct callout *t3 = arg; + + printf("cb2\n"); + if (++cnt < 3) + callout_reset(cm, tim, 5, SINGLE, cb2, arg); + else + callout_reset(cm, t3, 1, SINGLE, cb3, NULL); +} + +static void cb3(struct callout_manager *cm, struct callout *tim, void *arg) +{ + cm = cm; /* silent compiler */ + tim = tim; /* silent compiler */ + arg = arg; /* silent compiler */ + + printf("cb3\n"); +} + +int main(void) +{ + struct callout_manager cm; + struct callout t1, t2, t3; + int i; + + if (callout_manager_init(&cm, get_time) < 0) + return -1; + + callout_init(&t1); + callout_init(&t2); + callout_init(&t3); + + callout_reset(&cm, &t1, 3, PERIODICAL, cb1, NULL); + callout_reset(&cm, &t2, 5, SINGLE, cb2, &t3); + + for (i = 0; i < 18; i++) { + callout_manage(&cm); + sleep(1); + } + + callout_dump_stats(&cm); + return 0; +} + +#endif diff --git a/callout.h b/callout.h new file mode 100644 index 0000000..dca98dd --- /dev/null +++ b/callout.h @@ -0,0 +1,264 @@ +/*- + * Copyright (c) <2010>, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * - Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _CALLOUT_H_ +#define _CALLOUT_H_ + +#define CALLOUT_STATS +//#define CALLOUT_DEBUG + +/** + * @file + * Callout + * + * This library provides a timer service to Aversive. Instead of beeing + * called from interrupt (like the scheduler lib does), these kind of timers + * are not preemptive and should (for instance) be called from a main-loop. + * + * - Timers can be periodic or single (one-shot). + * + * This library provides an interface to add, delete and restart a + * timer. The API is based on the BSD callout(9) with few + * differences. + * + */ + +#ifdef CALLOUT_STATS +/** + * A structure that stores the timer statistics (per-lcore). + */ +struct callout_debug_stats { + uint16_t reset; /**< Number of success calls to callout_reset(). */ + uint16_t stop; /**< Number of success calls to callout_stop(). */ + uint16_t manage; /**< Number of calls to callout_manage(). */ + uint16_t pending; /**< Number of pending timers. */ + uint16_t running; /**< Number of running timers. */ +}; +extern struct callout_debug_stats callout_debug_stats; +#endif + +struct callout; +struct callout_manager; + +/** + * Callback function for the timer. + */ +typedef void (callout_cb_t)(struct callout_manager *, struct callout *, void *); + +/** + * A structure describing a timer in RTE. + */ +struct callout +{ + TAILQ_ENTRY(callout) next; /**< Next and prev in list. */ + + uint8_t periodical: 1; /**< timer is periodical or not */ + uint8_t scheduled: 1; /**< true if timer is scheduled */ + uint8_t running: 1; /**< true if cb func is beeing executed */ + uint8_t reserved: 5; + + uint16_t period; /**< Period of timer (0 if not periodic). */ + uint16_t expire; /**< Time when timer expire. */ + callout_cb_t *f; /**< Callback function. */ + void *arg; /**< Argument to callback function. */ +}; + +/** + * a list of timers + */ +TAILQ_HEAD(callout_list, callout); + +/** + * A static initializer for a timer structure. + */ +#define CALLOUT_INITIALIZER { } + +/** + * Function used by a callout manager to get a time reference + */ +typedef uint16_t (get_time_t)(void); + +/** + * A instance of callout manager (it is possible to have several) + */ +struct callout_manager { + get_time_t *get_time; + uint8_t updated: 1; + uint8_t reserved: 7; + uint16_t prev_time; + struct callout_list pending_list; +#ifdef CALLOUT_STATS + /* statistics */ + struct callout_debug_stats stats; +#endif +}; + +/** + * Initialize a callout manager + * + * @param cm + * The uninitialized callout manager structure. + * @param get_time + * Pointer to a function that returns a time reference (unsigned 16 bits) + * @return + * - 0 on success + * - negative on error + */ +int +callout_manager_init(struct callout_manager *cm, get_time_t *get_time); + +/** + * Initialize a timer handle. + * + * The callout_init() function initializes the timer handle tim + * for use. No operations can be performed on the timer before it is + * initialized. + * + * @param tim + * The timer to initialize. + */ +void callout_init(struct callout *tim); + +/** + * Timer type: Periodic or single (one-shot). + */ +enum callout_type { + SINGLE, + PERIODICAL +}; + +/** + * Reset and start the timer associated with the timer handle. + * + * The callout_reset() function resets and starts the timer + * associated with the timer handle tim. When the timer expires after + * ticks/hz seconds, the function specified by *fct* will be called + * with the argument *arg* on core *tim_lcore*. + * + * If the timer associated with the timer handle is already running + * (in the RUNNING state), the function will fail. The user has to check + * the return value of the function to see if there is a chance that the + * timer is in the RUNNING state. + * + * If the timer is being configured on another core (the CONFIG state), + * it will also fail. + * + * If the timer is pending or stopped, it will be rescheduled with the + * new parameters. + * + * @param tim + * The timer handle. + * @param ticks + * The number of cycles (see rte_get_hpet_hz()) before the callback + * function is called. + * @param type + * The type can be either: + * - PERIODICAL: The timer is automatically reloaded after execution + * (returns to the PENDING state) + * - SINGLE: The timer is one-shot, that is, the timer goes to a + * STOPPED state after execution. + * @param tim_lcore + * The ID of the lcore where the timer callback function has to be + * executed. If tim_lcore is LCORE_ID_ANY, the timer library will + * launch it on a different core for each call (round-robin). + * @param fct + * The callback function of the timer. + * @param arg + * The user argument of the callback function. + * @return + * - 0: Success; the timer is scheduled. + * - (-1): Timer is in the RUNNING or CONFIG state. + */ +int callout_reset(struct callout_manager *cm, struct callout *tim, + uint16_t ticks, enum callout_type type, + callout_cb_t fct, void *arg); + + +/** + * Stop a timer. + * + * The callout_stop() function stops the timer associated with the + * timer handle tim. It may fail if the timer is currently running or + * being configured. + * + * If the timer is pending or stopped (for instance, already expired), + * the function will succeed. The timer handle tim must have been + * initialized using callout_init(), otherwise, undefined behavior + * will occur. + * + * This function can be called safely from a timer callback. If it + * succeeds, the timer is not referenced anymore by the timer library + * and the timer structure can be freed (even in the callback + * function). + * + * @param tim + * The timer handle. + */ +void callout_stop(struct callout_manager *cm, struct callout *tim); + + +/** + * Test if a timer is pending. + * + * The callout_pending() function tests the PENDING status + * of the timer handle tim. A PENDING timer is one that has been + * scheduled and whose function has not yet been called. + * + * @param tim + * The timer handle. + * @return + * - 0: The timer is not pending. + * - 1: The timer is pending. + */ +int callout_pending(struct callout *tim); + +/** + * Manage the timer list and execute callback functions. + * + * This function must be called periodically from all cores + * main_loop(). It browses the list of pending timers and runs all + * timers that are expired. + * + * The precision of the timer depends on the call frequency of this + * function. However, the more often the function is called, the more + * it will use CPU resources. + */ +void callout_manage(struct callout_manager *cm); + +/** + * Dump statistics about timers. + */ +void callout_dump_stats(struct callout_manager *cm); + +#endif /* _CALLOUT_H_ */ diff --git a/cirbuf.c b/cirbuf.c new file mode 100644 index 0000000..fb1816e --- /dev/null +++ b/cirbuf.c @@ -0,0 +1,37 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +void +cirbuf_init(struct cirbuf * cbuf, char * buf, cirbuf_uint start, cirbuf_uint maxlen) +{ + cbuf->maxlen = maxlen; + cbuf->len = 0; + cbuf->start = start; + cbuf->end = start; + cbuf->buf = buf; +} + diff --git a/cirbuf.h b/cirbuf.h new file mode 100644 index 0000000..ad16a8f --- /dev/null +++ b/cirbuf.h @@ -0,0 +1,223 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf.h,v 1.1.2.5 2009-01-03 16:24:50 zer0 Exp $ + * + * + */ + +/** + * Circular buffer implementation. You should not use a circular buffer + * size > 127. + * + * Funcs are not atomic, so if * necessary, each call should be + * protected by IRQ_LOCKs. + */ + + +#ifndef _CIRBUF_H_ +#define _CIRBUF_H_ + +#include +#include + +#ifdef CONFIG_MODULE_CIRBUF_LARGE +typedef signed int cirbuf_int; +typedef unsigned int cirbuf_uint; +#else +typedef signed char cirbuf_int; +typedef unsigned char cirbuf_uint; +#endif + +/** + * This structure is the header of a cirbuf type. + */ +struct cirbuf { + cirbuf_uint maxlen; /**< total len of the fifo (number of elements) */ + volatile cirbuf_uint start; /**< indice of the first elt */ + volatile cirbuf_uint end; /**< indice of the last elt */ + volatile cirbuf_uint len; /**< current len of fifo */ + char *buf; +}; + +/* #define CIRBUF_DEBUG */ + +#ifdef CIRBUF_DEBUG +#define dprintf(fmt, ...) printf("line %3.3d - " fmt, __LINE__, ##__VA_ARGS__) +#else +#define dprintf(args...) do {} while(0) +#endif + + +/** + * Init the circular buffer + */ +void cirbuf_init(struct cirbuf *cbuf, char *buf, cirbuf_uint start, cirbuf_uint maxlen); + + +/** + * Return 1 if the circular buffer is full + */ +#define CIRBUF_IS_FULL(cirbuf) ((cirbuf)->maxlen == (cirbuf)->len) + +/** + * Return 1 if the circular buffer is empty + */ +#define CIRBUF_IS_EMPTY(cirbuf) ((cirbuf)->len == 0) + +/** + * return current size of the circular buffer (number of used elements) + */ +#define CIRBUF_GET_LEN(cirbuf) ((cirbuf)->len) + +/** + * return size of the circular buffer (used + free elements) + */ +#define CIRBUF_GET_MAXLEN(cirbuf) ((cirbuf)->maxlen) + +/** + * return the number of free elts + */ +#define CIRBUF_GET_FREELEN(cirbuf) ((cirbuf)->maxlen - (cirbuf)->len) + +/** + * Iterator for a circular buffer + * c: struct cirbuf pointer + * i: an integer type (cirbuf_uint is enough) internally used in the macro + * e: char that takes the value for each iteration + */ +#define CIRBUF_FOREACH(c, i, e) \ + for ( i=0, e=(c)->buf[(c)->start] ; \ + i<((c)->len) ; \ + i ++, e=(c)->buf[((c)->start+i)%((c)->maxlen)]) + + +/** + * Add a character at head of the circular buffer. Return 0 on success, or + * a negative value on error. + */ +cirbuf_int cirbuf_add_head_safe(struct cirbuf *cbuf, char c); + +/** + * Add a character at head of the circular buffer. You _must_ check that you + * have enough free space in the buffer before calling this func. + */ +void cirbuf_add_head(struct cirbuf *cbuf, char c); + +/** + * Add a character at tail of the circular buffer. Return 0 on success, or + * a negative value on error. + */ +cirbuf_int cirbuf_add_tail_safe(struct cirbuf *cbuf, char c); + +/** + * Add a character at tail of the circular buffer. You _must_ check that you + * have enough free space in the buffer before calling this func. + */ +void cirbuf_add_tail(struct cirbuf *cbuf, char c); + +/** + * Remove a char at the head of the circular buffer. Return 0 on + * success, or a negative value on error. + */ +cirbuf_int cirbuf_del_head_safe(struct cirbuf *cbuf); + +/** + * Remove a char at the head of the circular buffer. You _must_ check + * that buffer is not empty before calling the function. + */ +void cirbuf_del_head(struct cirbuf *cbuf); + +/** + * Remove a char at the tail of the circular buffer. Return 0 on + * success, or a negative value on error. + */ +cirbuf_int cirbuf_del_tail_safe(struct cirbuf *cbuf); + +/** + * Remove a char at the tail of the circular buffer. You _must_ check + * that buffer is not empty before calling the function. + */ +void cirbuf_del_tail(struct cirbuf *cbuf); + +/** + * Return the head of the circular buffer. You _must_ check that + * buffer is not empty before calling the function. + */ +char cirbuf_get_head(struct cirbuf *cbuf); + +/** + * Return the tail of the circular buffer. You _must_ check that + * buffer is not empty before calling the function. + */ +char cirbuf_get_tail(struct cirbuf *cbuf); + + + +/** + * Add a buffer at head of the circular buffer. 'c' is a pointer to a + * buffer, and n is the number of char to add. Return the number of + * copied bytes on success, or a negative value on error. + */ +cirbuf_int cirbuf_add_buf_head(struct cirbuf *cbuf, const char *c, cirbuf_uint n); + +/** + * Add a buffer at tail of the circular buffer. 'c' is a pointer to a + * buffer, and n is the number of char to add. Return the number of + * copied bytes on success, or a negative value on error. + */ +cirbuf_int cirbuf_add_buf_tail(struct cirbuf *cbuf, const char *c, cirbuf_uint n); + +/** + * Remove chars at the head of the circular buffer. Return 0 on + * success, or a negative value on error. + */ +cirbuf_int cirbuf_del_buf_head(struct cirbuf *cbuf, cirbuf_uint size); + +/** + * Remove chars at the tail of the circular buffer. Return 0 on + * success, or a negative value on error. + */ +cirbuf_int cirbuf_del_buf_tail(struct cirbuf *cbuf, cirbuf_uint size); + +/** + * Copy a maximum of 'size' characters from the head of the circular + * buffer to a flat one pointed by 'c'. Return the number of copied + * chars. + */ +cirbuf_int cirbuf_get_buf_head(struct cirbuf *cbuf, char *c, cirbuf_uint size); + +/** + * Copy a maximum of 'size' characters from the tail of the circular + * buffer to a flat one pointed by 'c'. Return the number of copied + * chars. + */ +cirbuf_int cirbuf_get_buf_tail(struct cirbuf *cbuf, char *c, cirbuf_uint size); + + +/** + * Set the start of the data to the index 0 of the internal buffer. + */ +void cirbuf_align_left(struct cirbuf *cbuf); + +/** + * Set the end of the data to the last index of the internal buffer. + */ +void cirbuf_align_right(struct cirbuf *cbuf); + +#endif /* _CIRBUF_H_ */ diff --git a/cirbuf_add_buf_head.c b/cirbuf_add_buf_head.c new file mode 100644 index 0000000..c4eb595 --- /dev/null +++ b/cirbuf_add_buf_head.c @@ -0,0 +1,55 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_add_buf_head.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +/* multiple add */ + +cirbuf_int +cirbuf_add_buf_head(struct cirbuf * cbuf, const char * c, cirbuf_uint n) +{ + cirbuf_uint e; + + if (!n || n > CIRBUF_GET_FREELEN(cbuf)) + return -EINVAL; + + e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0; + + if (n < cbuf->start + e) { + dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->start - n + e, n); + memcpy(cbuf->buf + cbuf->start - n + e, c, n); + } + else { + dprintf("s[%d] -> d[%d] (%d)\n", + n - (cbuf->start + e), 0, cbuf->start + e); + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - n + (cbuf->start + e), 0, n - (cbuf->start + e)); + memcpy(cbuf->buf, c + n - (cbuf->start + e) , cbuf->start + e); + memcpy(cbuf->buf + cbuf->maxlen - n + (cbuf->start + e), c, n - (cbuf->start + e)); + } + cbuf->len += n; + cbuf->start += (cbuf->maxlen - n + e); + cbuf->start %= cbuf->maxlen; + return n; +} + diff --git a/cirbuf_add_buf_tail.c b/cirbuf_add_buf_tail.c new file mode 100644 index 0000000..d301b3e --- /dev/null +++ b/cirbuf_add_buf_tail.c @@ -0,0 +1,55 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_add_buf_tail.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +/* multiple add */ + +cirbuf_int +cirbuf_add_buf_tail(struct cirbuf * cbuf, const char * c, cirbuf_uint n) +{ + cirbuf_uint e; + + if (!n || n > CIRBUF_GET_FREELEN(cbuf)) + return -EINVAL; + + e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0; + + if (n < cbuf->maxlen - cbuf->end - 1 + e) { + dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->end + !e, n); + memcpy(cbuf->buf + cbuf->end + !e, c, n); + } + else { + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end + !e, 0, cbuf->maxlen - cbuf->end - 1 + e); + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - cbuf->end - 1 + e, 0, n - cbuf->maxlen + cbuf->end + 1 - e); + memcpy(cbuf->buf + cbuf->end + !e, c, cbuf->maxlen - cbuf->end - 1 + e); + memcpy(cbuf->buf, c + cbuf->maxlen - cbuf->end - 1 + e, n - cbuf->maxlen + cbuf->end + 1 - e); + } + cbuf->len += n; + cbuf->end += n - e; + cbuf->end %= cbuf->maxlen; + return n; +} + diff --git a/cirbuf_add_head.c b/cirbuf_add_head.c new file mode 100644 index 0000000..f093e85 --- /dev/null +++ b/cirbuf_add_head.c @@ -0,0 +1,56 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_add_head.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +/* add at head */ + +static inline void +__cirbuf_add_head(struct cirbuf * cbuf, char c) +{ + if (!CIRBUF_IS_EMPTY(cbuf)) { + cbuf->start += (cbuf->maxlen - 1); + cbuf->start %= cbuf->maxlen; + } + cbuf->buf[cbuf->start] = c; + cbuf->len ++; +} + +cirbuf_int +cirbuf_add_head_safe(struct cirbuf * cbuf, char c) +{ + if (cbuf && !CIRBUF_IS_FULL(cbuf)) { + __cirbuf_add_head(cbuf, c); + return 0; + } + return -EINVAL; +} + +void +cirbuf_add_head(struct cirbuf * cbuf, char c) +{ + __cirbuf_add_head(cbuf, c); +} + diff --git a/cirbuf_add_tail.c b/cirbuf_add_tail.c new file mode 100644 index 0000000..4e55313 --- /dev/null +++ b/cirbuf_add_tail.c @@ -0,0 +1,58 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_add_tail.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +/* add at tail */ + + +static inline void +__cirbuf_add_tail(struct cirbuf * cbuf, char c) +{ + if (!CIRBUF_IS_EMPTY(cbuf)) { + cbuf->end ++; + cbuf->end %= cbuf->maxlen; + } + cbuf->buf[cbuf->end] = c; + cbuf->len ++; +} + +cirbuf_int +cirbuf_add_tail_safe(struct cirbuf * cbuf, char c) +{ + if (cbuf && !CIRBUF_IS_FULL(cbuf)) { + __cirbuf_add_tail(cbuf, c); + return 0; + } + return -EINVAL; +} + +void +cirbuf_add_tail(struct cirbuf * cbuf, char c) +{ + __cirbuf_add_tail(cbuf, c); +} + + diff --git a/cirbuf_align.c b/cirbuf_align.c new file mode 100644 index 0000000..3ebfe57 --- /dev/null +++ b/cirbuf_align.c @@ -0,0 +1,90 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_align.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +static inline void +__cirbuf_shift_left(struct cirbuf * cbuf) +{ + cirbuf_uint i; + char tmp = cbuf->buf[cbuf->start]; + + for (i=0 ; ilen ; i++) { + cbuf->buf[(cbuf->start+i)%cbuf->maxlen] = + cbuf->buf[(cbuf->start+i+1)%cbuf->maxlen]; + } + cbuf->buf[(cbuf->start-1+cbuf->maxlen)%cbuf->maxlen] = tmp; + cbuf->start += (cbuf->maxlen - 1); + cbuf->start %= cbuf->maxlen; + cbuf->end += (cbuf->maxlen - 1); + cbuf->end %= cbuf->maxlen; +} + +static inline void +__cirbuf_shift_right(struct cirbuf * cbuf) +{ + cirbuf_uint i; + char tmp = cbuf->buf[cbuf->end]; + + for (i=0 ; ilen ; i++) { + cbuf->buf[(cbuf->end+cbuf->maxlen-i)%cbuf->maxlen] = + cbuf->buf[(cbuf->end+cbuf->maxlen-i-1)%cbuf->maxlen]; + } + cbuf->buf[(cbuf->end+1)%cbuf->maxlen] = tmp; + cbuf->start += 1; + cbuf->start %= cbuf->maxlen; + cbuf->end += 1; + cbuf->end %= cbuf->maxlen; +} + +/* XXX we could do a better algorithm here... */ +void cirbuf_align_left(struct cirbuf * cbuf) +{ + if (cbuf->start < cbuf->maxlen/2) { + while (cbuf->start != 0) { + __cirbuf_shift_left(cbuf); + } + } + else { + while (cbuf->start != 0) { + __cirbuf_shift_right(cbuf); + } + } +} + +/* XXX we could do a better algorithm here... */ +void cirbuf_align_right(struct cirbuf * cbuf) +{ + if (cbuf->start >= cbuf->maxlen/2) { + while (cbuf->end != cbuf->maxlen-1) { + __cirbuf_shift_left(cbuf); + } + } + else { + while (cbuf->start != cbuf->maxlen-1) { + __cirbuf_shift_right(cbuf); + } + } +} + diff --git a/cirbuf_del_buf_head.c b/cirbuf_del_buf_head.c new file mode 100644 index 0000000..df67d23 --- /dev/null +++ b/cirbuf_del_buf_head.c @@ -0,0 +1,45 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_del_buf_head.c,v 1.1.2.3 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +/* buffer del */ + +cirbuf_int +cirbuf_del_buf_head(struct cirbuf * cbuf, cirbuf_uint size) +{ + if (!size || size > CIRBUF_GET_LEN(cbuf)) + return -EINVAL; + + cbuf->len -= size; + if (CIRBUF_IS_EMPTY(cbuf)) { + cbuf->start += size - 1; + cbuf->start %= cbuf->maxlen; + } + else { + cbuf->start += size; + cbuf->start %= cbuf->maxlen; + } + return 0; +} diff --git a/cirbuf_del_buf_tail.c b/cirbuf_del_buf_tail.c new file mode 100644 index 0000000..159b853 --- /dev/null +++ b/cirbuf_del_buf_tail.c @@ -0,0 +1,45 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_del_buf_tail.c,v 1.1.2.3 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +/* buffer del */ + +cirbuf_int +cirbuf_del_buf_tail(struct cirbuf * cbuf, cirbuf_uint size) +{ + if (!size || size > CIRBUF_GET_LEN(cbuf)) + return -EINVAL; + + cbuf->len -= size; + if (CIRBUF_IS_EMPTY(cbuf)) { + cbuf->end += (cbuf->maxlen - size + 1); + cbuf->end %= cbuf->maxlen; + } + else { + cbuf->end += (cbuf->maxlen - size); + cbuf->end %= cbuf->maxlen; + } + return 0; +} diff --git a/cirbuf_del_head.c b/cirbuf_del_head.c new file mode 100644 index 0000000..7ebca5a --- /dev/null +++ b/cirbuf_del_head.c @@ -0,0 +1,54 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_del_head.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +/* del at head */ + +static inline void +__cirbuf_del_head(struct cirbuf * cbuf) +{ + cbuf->len --; + if (!CIRBUF_IS_EMPTY(cbuf)) { + cbuf->start ++; + cbuf->start %= cbuf->maxlen; + } +} + +cirbuf_int +cirbuf_del_head_safe(struct cirbuf * cbuf) +{ + if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) { + __cirbuf_del_head(cbuf); + return 0; + } + return -EINVAL; +} + +void +cirbuf_del_head(struct cirbuf * cbuf) +{ + __cirbuf_del_head(cbuf); +} + diff --git a/cirbuf_del_tail.c b/cirbuf_del_tail.c new file mode 100644 index 0000000..18cbe8a --- /dev/null +++ b/cirbuf_del_tail.c @@ -0,0 +1,56 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_del_tail.c,v 1.1.2.2 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + + +/* del at tail */ + +static inline void +__cirbuf_del_tail(struct cirbuf * cbuf) +{ + cbuf->len --; + if (!CIRBUF_IS_EMPTY(cbuf)) { + cbuf->end += (cbuf->maxlen - 1); + cbuf->end %= cbuf->maxlen; + } +} + +cirbuf_int +cirbuf_del_tail_safe(struct cirbuf * cbuf) +{ + if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) { + __cirbuf_del_tail(cbuf); + return 0; + } + return -EINVAL; +} + +void +cirbuf_del_tail(struct cirbuf * cbuf) +{ + __cirbuf_del_tail(cbuf); +} + + diff --git a/cirbuf_get_buf_head.c b/cirbuf_get_buf_head.c new file mode 100644 index 0000000..75bace8 --- /dev/null +++ b/cirbuf_get_buf_head.c @@ -0,0 +1,49 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_get_buf_head.c,v 1.1.2.3 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +/* convert to buffer */ + +cirbuf_int +cirbuf_get_buf_head(struct cirbuf * cbuf, char * c, cirbuf_uint size) +{ + cirbuf_uint n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf); + + if (!n) + return 0; + + if (cbuf->start <= cbuf->end) { + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0, n); + memcpy(c, cbuf->buf + cbuf->start , n); + } + else { + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0, cbuf->maxlen - cbuf->start); + dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->maxlen - cbuf->start, n - cbuf->maxlen + cbuf->start); + memcpy(c, cbuf->buf + cbuf->start , cbuf->maxlen - cbuf->start); + memcpy(c + cbuf->maxlen - cbuf->start, cbuf->buf, n - cbuf->maxlen + cbuf->start); + } + return n; +} + diff --git a/cirbuf_get_buf_tail.c b/cirbuf_get_buf_tail.c new file mode 100644 index 0000000..68b7eb3 --- /dev/null +++ b/cirbuf_get_buf_tail.c @@ -0,0 +1,51 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_get_buf_tail.c,v 1.1.2.3 2007-09-12 17:52:20 zer0 Exp $ + * + */ + +#include + +#include + +/* convert to buffer */ + + +cirbuf_int +cirbuf_get_buf_tail(struct cirbuf * cbuf, char * c, cirbuf_uint size) +{ + cirbuf_uint n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf); + + if (!n) + return 0; + + if (cbuf->start <= cbuf->end) { + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end - n + 1, 0, n); + memcpy(c, cbuf->buf + cbuf->end - n + 1, n); + } + else { + dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->maxlen - cbuf->start, cbuf->end + 1); + dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - n + cbuf->end + 1, 0, n - cbuf->end - 1); + + memcpy(c + cbuf->maxlen - cbuf->start, cbuf->buf, cbuf->end + 1); + memcpy(c, cbuf->buf + cbuf->maxlen - n + cbuf->end +1, n - cbuf->end - 1); + } + return n; +} + diff --git a/cirbuf_get_head.c b/cirbuf_get_head.c new file mode 100644 index 0000000..9a1c200 --- /dev/null +++ b/cirbuf_get_head.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_get_head.c,v 1.1.2.1 2007-08-19 10:33:55 zer0 Exp $ + * + */ + +#include + +#include + +/* get head or get tail */ + +char +cirbuf_get_head(struct cirbuf * cbuf) +{ + return cbuf->buf[cbuf->start]; +} + diff --git a/cirbuf_get_tail.c b/cirbuf_get_tail.c new file mode 100644 index 0000000..c1a5a35 --- /dev/null +++ b/cirbuf_get_tail.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cirbuf_get_tail.c,v 1.1.2.1 2007-08-19 10:33:55 zer0 Exp $ + * + */ + +#include + +#include + +/* get head or get tail */ + +char +cirbuf_get_tail(struct cirbuf * cbuf) +{ + return cbuf->buf[cbuf->end]; +} + diff --git a/clock_time.h b/clock_time.h new file mode 100644 index 0000000..02e8fe6 --- /dev/null +++ b/clock_time.h @@ -0,0 +1,95 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: time.h,v 1.3.4.2 2007-05-23 17:18:11 zer0 Exp $ + * + */ + +/* Droids-corp, Eirbot, Microb Technology 2005 - Zer0 + * Interface of the time module + */ + +/** + * This module can be used to get a human readable time. It uses the + * scheduler module. Its goal is not to be very precise, but just + * simple to use. provides two timers: one in s and us, and one in + * us which doesn't overflow on seconds (better to substract two + * times) + */ + +#ifndef _CLOCK_TIME_H_ +#define _CLOCK_TIME_H_ + +#include + +/* a 16 bit variable cannot cover one day */ +typedef int32_t seconds; +typedef int32_t microseconds; + +/** the time structure */ +typedef struct +{ + microseconds us; + seconds s; +} time_h; + + + +/**********************************************************/ + +/** init time module : schedule the event with the givent priority */ +void time_init(uint8_t priority); + +/**********************************************************/ + +/** get time in second since last init/reset */ +seconds time_get_s(void); + +/**********************************************************/ + +/** get time in microsecond since last init/reset */ +microseconds time_get_us(void); + +/**********************************************************/ + +/** get the complete time struct since last init/reset */ +time_h time_get_time(void); + +/**********************************************************/ + +/** reset time counter */ +void time_reset(void); + +/**********************************************************/ + +/** set time */ +void time_set(seconds s, microseconds us); + +/**********************************************************/ + +/** This is an equivalent of 'wait_ms(x)', but uses time value, so it + * is independant of CPU load. Warning, you should not use this + * function in a irq locked context, or in a scheduled function with + * higher priority than time module */ +void time_wait_ms(uint16_t ms); + +/**********************************************************/ + +/** get a microsecond timer that overflows naturally */ +microseconds time_get_us2(void); + +#endif diff --git a/cmdline.c b/cmdline.c new file mode 100644 index 0000000..5eafc1d --- /dev/null +++ b/cmdline.c @@ -0,0 +1,196 @@ +/* + * Copyright Droids Corporation + * Olivier Matz + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cmdline.c,v 1.7 2009-11-08 17:24:33 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "callout.h" +#include "main.h" +#include "cmdline.h" + +#include "DualVirtualSerial.h" + + + +/******** See in commands.c for the list of commands. */ +extern parse_pgm_ctx_t main_ctx[]; + +int usbserial1_dev_send(char c, FILE* f) +{ + CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, (uint8_t)c); + return 0; +} + +int usbserial1_dev_recv(FILE* f) +{ + int16_t c; + /* non-blocking ! */ + c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + if (c < 0) + return _FDEV_EOF; + + return c; +} + + +int usbserial2_dev_send(char c, FILE* f) +{ + CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)c); + return 0; +} + +int usbserial2_dev_recv(FILE* f) +{ + int16_t c; + + /* non-blocking ! */ + c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface); + if (c < 0) + return _FDEV_EOF; + + return c; +} + + +static void +valid_buffer(const char *buf, uint8_t size) +{ + int8_t ret; + + ret = parse(main_ctx, buf); + if (ret == PARSE_AMBIGUOUS) + printf_P(PSTR("Ambiguous command\r\n")); + else if (ret == PARSE_NOMATCH) + printf_P(PSTR("Command not found\r\n")); + else if (ret == PARSE_BAD_ARGS) + printf_P(PSTR("Bad arguments\r\n")); +} + +static int8_t +complete_buffer(const char *buf, char *dstbuf, uint8_t dstsize, + int16_t *state) +{ + return complete(main_ctx, buf, state, dstbuf, dstsize); +} + + +static void write_char(char c) +{ + usbserial1_dev_send(c, NULL); +} + + +void cmdline_init(void) +{ + rdline_init(&xbeeboard.rdl, write_char, valid_buffer, complete_buffer); + snprintf(xbeeboard.prompt, sizeof(xbeeboard.prompt), "mainboard > "); +} + + +/* sending "pop" on cmdline uart resets the robot */ +void emergency(char c) +{ + static uint8_t i = 0; + + if ((i == 0 && c == 'p') || + (i == 1 && c == 'o') || + (i == 2 && c == 'p')) + i++; + else if ( !(i == 1 && c == 'p') ) + i = 0; + if (i == 3) + bootloader(); +} + +/* log function, add a command to configure + * it dynamically */ +void mylog(struct error * e, ...) +{ + va_list ap; +#ifndef HOST_VERSION + u16 stream_flags = stdout->flags; +#endif + uint8_t i; + time_h tv; + + if (e->severity > ERROR_SEVERITY_ERROR) { + if (xbeeboard.log_level < e->severity) + return; + + for (i=0; ierr_num) + break; + if (i == NB_LOGS+1) + return; + } + + va_start(ap, e); + tv = time_get_time(); + printf_P(PSTR("%d.%.3d: "), (int)tv.s, (int)(tv.us/1000UL)); + + vfprintf_P(stdout, e->text, ap); + printf_P(PSTR("\r\n")); + va_end(ap); +#ifndef HOST_VERSION + stdout->flags = stream_flags; +#endif +} + +int cmdline_poll(void) +{ + const char *history, *buffer; + int8_t ret, same = 0; + int16_t c; + + c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + if (c < 0) + return -1; + + ret = rdline_char_in(&xbeeboard.rdl, c); + if (ret == 1) { + buffer = rdline_get_buffer(&xbeeboard.rdl); + history = rdline_get_history_item(&xbeeboard.rdl, 0); + if (history) { + same = !memcmp(buffer, history, strlen(history)) && + buffer[strlen(history)] == '\n'; + } + else + same = 0; + if (strlen(buffer) > 1 && !same) + rdline_add_history(&xbeeboard.rdl, buffer); + + if (xbeeboard.rdl.status != RDLINE_STOPPED) + rdline_newline(&xbeeboard.rdl, xbeeboard.prompt); + } + + return 0; +} + diff --git a/cmdline.h b/cmdline.h new file mode 100644 index 0000000..958660a --- /dev/null +++ b/cmdline.h @@ -0,0 +1,57 @@ +/* + * Copyright Droids Corporation + * Olivier Matz + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: cmdline.h,v 1.4 2009-11-08 17:24:33 zer0 Exp $ + * + */ + + +#include "DualVirtualSerial.h" + +void cmdline_init(void); + +/* uart rx callback for reset() */ +void emergency(char c); + +/* log function */ +void mylog(struct error * e, ...); + +/* poll cmdline */ +int cmdline_poll(void); + +int usbserial1_dev_send(char c, FILE* f); +int usbserial1_dev_recv(FILE* f); + +int usbserial2_dev_send(char c, FILE* f); +int usbserial2_dev_recv(FILE* f); + +static inline uint8_t cmdline_keypressed(void) { + return (CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface) >= 0); +} + +static inline int16_t cmdline_getchar(void) { + return CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); +} + +static inline uint8_t cmdline_getchar_wait(void) { + int16_t c; + do { + c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + } while (c < 0); + return c; +} diff --git a/commands.c b/commands.c new file mode 100644 index 0000000..1cacfed --- /dev/null +++ b/commands.c @@ -0,0 +1,1255 @@ +/* + * Copyright Droids Corporation (2011) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: commands.c,v 1.9 2009-11-08 17:24:33 zer0 Exp $ + * + * Olivier MATZ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xbee_atcmd.h" +#include "xbee_neighbor.h" +#include "xbee_stats.h" +#include "xbee_proto.h" +#include "xbee.h" + +#include "callout.h" +#include "parse_atcmd.h" +#include "parse_neighbor.h" +#include "parse_monitor.h" + +#include "rc_proto.h" +#include "main.h" + +/* commands_gen.c */ +extern parse_pgm_inst_t cmd_reset; +extern parse_pgm_inst_t cmd_bootloader; +extern parse_pgm_inst_t cmd_log; +extern parse_pgm_inst_t cmd_log_show; +extern parse_pgm_inst_t cmd_log_type; +extern parse_pgm_inst_t cmd_stack_space; +extern parse_pgm_inst_t cmd_scheduler; + +static int monitor_period_ms = 1000; +static int monitor_running = 0; +static int monitor_count = 0; +static struct callout monitor_event; +struct monitor_reg *monitor_current; + +static int range_period_ms = 1000; +static int range_powermask = 0x1F; +static uint8_t range_power = 0; +static int range_running = 0; +static uint64_t range_dstaddr = 0xFFFF; /* broadcast by default */ +static struct callout range_event; +static int range_count = 100; +static int range_cur_count = 0; + +static void monitor_cb(struct callout_manager *cm, + struct callout *clt, void *dummy) +{ + if (monitor_current == NULL) + monitor_current = LIST_FIRST(&xbee_monitor_list); + + xbeeapp_send_atcmd(monitor_current->atcmd, NULL, 0, 0, NULL, NULL); + monitor_current = LIST_NEXT(monitor_current, next); + callout_reset(cm, &monitor_event, + monitor_period_ms / monitor_count, + SINGLE, monitor_cb, NULL); +} + +static void range_cb(struct callout_manager *cm, + struct callout *clt, void *dummy) +{ + uint8_t i, mask; + struct rc_proto_range rangepkt; + + range_cur_count--; + + /* get new xmit power */ + for (i = 1; i <= 8; i++) { + mask = 1 << ((range_power + i) & 0x7); + if (mask & range_powermask) + break; + } + range_power = ((range_power + i) & 0x7); + + xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), 0, NULL, NULL); + + rangepkt.type = RC_PROTO_TYPE_RANGE; + rangepkt.power_level = range_power; + + xbeeapp_send_msg(range_dstaddr, &rangepkt, sizeof(rangepkt), 0); + + if (range_cur_count == 0) { + range_running = 0; + return; + } + + callout_reset(cm, &range_event, + range_period_ms, + SINGLE, range_cb, NULL); +} + +/* this structure is filled when cmd_help is parsed successfully */ +struct cmd_help_result { + fixed_string_t help; + struct xbee_atcmd_pgm *cmd; +}; + +/* function called when cmd_help is parsed successfully */ +static void cmd_help_parsed(void *parsed_result, void *data) +{ + struct cmd_help_result *res = parsed_result; + struct xbee_atcmd cmdcopy; + int type; + memcpy_P(&cmdcopy, res->cmd, sizeof(cmdcopy)); + type = (cmdcopy.flags & (XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE)); + switch (type) { + case XBEE_ATCMD_F_READ: + printf_P(PSTR("Read-only\r\n")); + break; + case XBEE_ATCMD_F_WRITE: + printf_P(PSTR("Write-only\r\n")); + break; + default: + printf_P(PSTR("Read-write\r\n")); + break; + } + if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_NONE) + printf_P(PSTR("No argument\r\n")); + else if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_U8) + printf_P(PSTR("Register is unsigned 8 bits\r\n")); + else if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_U16) + printf_P(PSTR("Register is unsigned 16 bits\r\n")); + else if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_U32) + printf_P(PSTR("Register is unsigned 32 bits\r\n")); + else if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_S16) + printf_P(PSTR("Register is signed 16 bits\r\n")); + else if (cmdcopy.flags & XBEE_ATCMD_F_PARAM_STRING_20B) + printf_P(PSTR("Register is a 20 bytes string\r\n")); + else + printf_P(PSTR("Unknown argument\r\n")); + + printf_P(PSTR("%S\r\n"), cmdcopy.help); +} +prog_char str_help_help[] = "help"; + +parse_pgm_token_string_t cmd_help_help = + TOKEN_STRING_INITIALIZER(struct cmd_help_result, help, str_help_help); + +parse_pgm_token_atcmd_t cmd_help_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_help_result, cmd, &xbee_dev, + 0, 0); + +prog_char help_help[] = "Help a register using an AT command"; +parse_pgm_inst_t cmd_help = { + .f = cmd_help_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_help, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_help_help, + (prog_void *)&cmd_help_atcmd, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_del_result { + fixed_string_t cmd; + fixed_string_t action; + struct xbee_neigh *neigh; +}; + +static void cmd_neigh_del_parsed(void *parsed_result, + void *data) +{ + struct cmd_neigh_del_result *res = parsed_result; + xbee_neigh_del(xbee_dev, res->neigh); +} + +prog_char str_neigh_del_neigh[] = "neigh"; +parse_pgm_token_string_t cmd_neigh_del_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_del_result, cmd, + str_neigh_del_neigh); +prog_char str_neigh_del_del[] = "del"; +parse_pgm_token_string_t cmd_neigh_del_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_del_result, action, + str_neigh_del_del); +parse_pgm_token_neighbor_t cmd_neigh_del_neigh = + TOKEN_NEIGHBOR_INITIALIZER(struct cmd_neigh_del_result, neigh, + &xbee_dev); + +prog_char help_neigh_del[] = "delete a neighbor"; +parse_pgm_inst_t cmd_neigh_del = { + .f = cmd_neigh_del_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_neigh_del, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_del_cmd, + (prog_void *)&cmd_neigh_del_action, + (prog_void *)&cmd_neigh_del_neigh, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_add_result { + fixed_string_t cmd; + fixed_string_t action; + fixed_string_t name; + uint64_t addr; +}; + +static void cmd_neigh_add_parsed(void *parsed_result, + void *data) +{ + struct cmd_neigh_add_result *res = parsed_result; + if (xbee_neigh_add(xbee_dev, res->name, res->addr) == NULL) + printf_P(PSTR("name or addr already exist\r\n")); +} + +prog_char str_neigh_add_neigh[] = "neigh"; +parse_pgm_token_string_t cmd_neigh_add_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, cmd, + str_neigh_add_neigh); +prog_char str_neigh_add_add[] = "add"; +parse_pgm_token_string_t cmd_neigh_add_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, action, + str_neigh_add_add); +parse_pgm_token_string_t cmd_neigh_add_name = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, name, NULL); +parse_pgm_token_num_t cmd_neigh_add_addr = + TOKEN_NUM_INITIALIZER(struct cmd_neigh_add_result, addr, UINT64); + +prog_char help_neigh_add[] = "add a neighbor"; +parse_pgm_inst_t cmd_neigh_add = { + .f = cmd_neigh_add_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_neigh_add, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_add_cmd, + (prog_void *)&cmd_neigh_add_action, + (prog_void *)&cmd_neigh_add_name, + (prog_void *)&cmd_neigh_add_addr, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_list_result { + fixed_string_t cmd; + fixed_string_t action; +}; + +static void cmd_neigh_list_parsed(void *parsed_result, + void *data) +{ + struct xbee_neigh *neigh; + + LIST_FOREACH(neigh, &xbee_dev->neigh_list, next) { + printf_P(PSTR(" %s: 0x%.8"PRIx32"%.8"PRIx32"\r\n"), + neigh->name, + (uint32_t)(neigh->addr >> 32ULL), + (uint32_t)(neigh->addr & 0xFFFFFFFF)); + } +} + +prog_char str_neigh_list_neigh[] = "neigh"; +parse_pgm_token_string_t cmd_neigh_list_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_list_result, cmd, + str_neigh_list_neigh); +prog_char str_neigh_list_list[] = "list"; +parse_pgm_token_string_t cmd_neigh_list_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_list_result, action, + str_neigh_list_list); + +prog_char help_neigh_list[] = "list all knwon neighbors"; +parse_pgm_inst_t cmd_neigh_list = { + .f = cmd_neigh_list_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_neigh_list, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_list_cmd, + (prog_void *)&cmd_neigh_list_action, + NULL, + }, +}; + + + + +/* ************* */ + +/* this structure is filled when cmd_read is parsed successfully */ +struct cmd_read_result { + fixed_string_t read; + struct xbee_atcmd_pgm *cmd; +}; + +/* function called when cmd_read is parsed successfully */ +static void cmd_read_parsed(void *parsed_result, + void *data) +{ + struct cmd_read_result *res = parsed_result; + struct xbee_atcmd copy; + char cmd[3]; + + memcpy_P(©, res->cmd, sizeof(copy)); + memcpy_P(&cmd, copy.name, 2); + cmd[2] = '\0'; + xbeeapp_send_atcmd(cmd, NULL, 0, 1, NULL, NULL); +} + +prog_char str_read_read[] = "read"; + +parse_pgm_token_string_t cmd_read_read = + TOKEN_STRING_INITIALIZER(struct cmd_read_result, read, + str_read_read); + +parse_pgm_token_atcmd_t cmd_read_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_read_result, cmd, &xbee_dev, + XBEE_ATCMD_F_READ, XBEE_ATCMD_F_READ); + +prog_char help_read[] = "Read a register using an AT command"; +parse_pgm_inst_t cmd_read = { + .f = cmd_read_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_read, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_read_read, + (prog_void *)&cmd_read_atcmd, + NULL, + }, +}; + + +/* ************* */ + +/* this structure is filled when cmd_write is parsed successfully */ +struct cmd_write_result { + fixed_string_t write; + struct xbee_atcmd_pgm *cmd; + union { + uint8_t u8; + uint16_t u16; + uint32_t u32; + }; +}; + +/* function called when cmd_write is parsed successfully */ +static void cmd_write_parsed(void *parsed_result, void *data) +{ + struct cmd_write_result *res = parsed_result; + struct xbee_atcmd copy; + char cmd[3]; + int len; + void *param; + + memcpy_P(©, res->cmd, sizeof(copy)); + + if (copy.flags & XBEE_ATCMD_F_PARAM_NONE) { + len = 0; + param = NULL; + } + else if (copy.flags & XBEE_ATCMD_F_PARAM_U8) { + len = sizeof(res->u8); + param = &res->u8; + } + else if (copy.flags & XBEE_ATCMD_F_PARAM_U16) { + len = sizeof(res->u16); + res->u16 = htons(res->u16); + param = &res->u16; + } + else if (copy.flags & XBEE_ATCMD_F_PARAM_U32) { + len = sizeof(res->u32); + res->u32 = htonl(res->u32); + param = &res->u32; + } + else { + printf("Unknown argument type\n"); + return; + } + memcpy_P(&cmd, copy.name, 2); + cmd[2] = '\0'; + xbeeapp_send_atcmd(cmd, param, len, 1, NULL, NULL); +} + +prog_char str_write_none[] = "write"; + +parse_pgm_token_string_t cmd_write_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_result, write, + str_write_none); + +parse_pgm_token_atcmd_t cmd_write_none_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_NONE, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_NONE); + +prog_char help_write_none[] = "Send an AT command (no argument)"; + +parse_pgm_inst_t cmd_write_none = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_write_none, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_none_atcmd, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u8_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U8, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U8); + +parse_pgm_token_num_t cmd_write_u8_u8 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u8, UINT8); + +prog_char help_write_u8[] = "Write a 8 bits register using an AT command"; + +parse_pgm_inst_t cmd_write_u8 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_write_u8, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u8_atcmd, + (prog_void *)&cmd_write_u8_u8, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u16_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U16, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U16); + +parse_pgm_token_num_t cmd_write_u16_u16 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u16, UINT16); + +prog_char help_write_u16[] = "Write a 16 bits register using an AT command"; + +parse_pgm_inst_t cmd_write_u16 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_write_u16, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u16_atcmd, + (prog_void *)&cmd_write_u16_u16, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u32_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U32, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U32); + +parse_pgm_token_num_t cmd_write_u32_u32 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u32, UINT32); + +prog_char help_write_u32[] = "Write a 32 bits register using an AT command"; + +parse_pgm_inst_t cmd_write_u32 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_write_u32, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u32_atcmd, + (prog_void *)&cmd_write_u32_u32, + NULL, + }, +}; + + +/* ************* */ + +/* this structure is filled when cmd_sendmsg is parsed successfully */ +struct cmd_sendmsg_result { + fixed_string_t sendmsg; + uint64_t addr; + fixed_string_t data; +}; + +/* function called when cmd_sendmsg is parsed successfully */ +static void cmd_sendmsg_parsed(void *parsed_result, void *data) +{ + struct cmd_sendmsg_result *res = parsed_result; + xbeeapp_send_msg(res->addr, res->data, strlen(res->data), 1); +} + +prog_char str_sendmsg[] = "sendmsg"; + +parse_pgm_token_string_t cmd_sendmsg_sendmsg = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_result, sendmsg, + str_sendmsg); + +parse_pgm_token_num_t cmd_sendmsg_addr = + TOKEN_NUM_INITIALIZER(struct cmd_sendmsg_result, addr, UINT64); + +parse_pgm_token_string_t cmd_sendmsg_data = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_result, data, NULL); + +prog_char help_sendmsg[] = "Send data to a node using its address"; + +parse_pgm_inst_t cmd_sendmsg = { + .f = cmd_sendmsg_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_sendmsg, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_sendmsg_sendmsg, + (prog_void *)&cmd_sendmsg_addr, + (prog_void *)&cmd_sendmsg_data, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_sendmsg_name is parsed successfully */ +struct cmd_sendmsg_name_result { + fixed_string_t sendmsg_name; + struct xbee_neigh *neigh; + fixed_string_t data; +}; + +/* function called when cmd_sendmsg_name is parsed successfully */ +static void cmd_sendmsg_name_parsed(void *parsed_result, void *data) +{ + struct cmd_sendmsg_name_result *res = parsed_result; + xbeeapp_send_msg(res->neigh->addr, res->data, strlen(res->data), 1); +} + +parse_pgm_token_string_t cmd_sendmsg_name_sendmsg_name = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_name_result, sendmsg_name, + str_sendmsg); + +parse_pgm_token_neighbor_t cmd_sendmsg_name_neigh = + TOKEN_NEIGHBOR_INITIALIZER(struct cmd_sendmsg_name_result, neigh, + &xbee_dev); + +parse_pgm_token_string_t cmd_sendmsg_name_data = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_name_result, data, NULL); + +prog_char help_sendmsg_name[] = "Send data to a node using its name"; + +parse_pgm_inst_t cmd_sendmsg_name = { + .f = cmd_sendmsg_name_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_sendmsg_name, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_sendmsg_name_sendmsg_name, + (prog_void *)&cmd_sendmsg_name_neigh, + (prog_void *)&cmd_sendmsg_name_data, + NULL, + }, +}; + + +/* ************* */ + +/* this structure is filled when cmd_range is parsed successfully */ +struct cmd_range_result { + fixed_string_t range; + fixed_string_t action; +}; + +/* function called when cmd_range is parsed successfully */ +static void cmd_range_parsed(void *parsed_result, void *data) +{ + struct cmd_range_result *res = parsed_result; + + if (!strcmp_P(res->action, PSTR("show"))) { + printf_P(PSTR("range infos:\r\n")); + printf_P(PSTR(" range period %d\r\n"), range_period_ms); + printf_P(PSTR(" range count %d\r\n"), range_count); + printf_P(PSTR(" range powermask 0x%x\r\n"), range_powermask); + printf_P(PSTR(" range dstaddr 0x%.8"PRIx32"%.8"PRIx32"\r\n"), + (uint32_t)(range_dstaddr >> 32ULL), + (uint32_t)(range_dstaddr & 0xFFFFFFFF)); + + if (range_running) + printf_P(PSTR(" range test is running\r\n")); + else + printf_P(PSTR(" range test is not running\r\n")); + } + else if (!strcmp(res->action, "start")) { + if (range_running) { + printf("already running\n"); + return; + } + range_cur_count = range_count; + callout_init(&range_event); + callout_reset(&cm, &range_event, 0, + SINGLE, range_cb, NULL); + range_running = 1; + } + else if (!strcmp(res->action, "end")) { + if (range_running == 0) { + printf("not running\n"); + return; + } + range_running = 0; + callout_stop(&cm, &range_event); + } +} + +prog_char str_range[] = "range"; +prog_char str_range_tokens[] = "show#start#end"; + +parse_pgm_token_string_t cmd_range_range = + TOKEN_STRING_INITIALIZER(struct cmd_range_result, range, + str_range); +parse_pgm_token_string_t cmd_range_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_result, action, + str_range_tokens); + +prog_char help_range[] = "start/stop/show current rangeing"; + +parse_pgm_inst_t cmd_range = { + .f = cmd_range_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_range, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_range, + (prog_void *)&cmd_range_action, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_period is parsed successfully */ +struct cmd_range_period_result { + fixed_string_t range; + fixed_string_t action; + uint32_t period; +}; + +/* function called when cmd_range_period is parsed successfully */ +static void cmd_range_period_parsed(void *parsed_result, void *data) +{ + struct cmd_range_period_result *res = parsed_result; + + if (res->period < 10) { + printf("error, minimum period is 10 ms\n"); + return; + } + + range_period_ms = res->period; +} + +prog_char str_period[] = "period"; + +parse_pgm_token_string_t cmd_range_period_range_period = + TOKEN_STRING_INITIALIZER(struct cmd_range_period_result, range, + str_range); +parse_pgm_token_string_t cmd_range_period_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_period_result, action, + str_period); +parse_pgm_token_num_t cmd_range_period_period = + TOKEN_NUM_INITIALIZER(struct cmd_range_period_result, period, UINT32); + +prog_char help_range_period[] = "set range test period"; + +parse_pgm_inst_t cmd_range_period = { + .f = cmd_range_period_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_range_period, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_period_range_period, + (prog_void *)&cmd_range_period_action, + (prog_void *)&cmd_range_period_period, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_count is parsed successfully */ +struct cmd_range_count_result { + fixed_string_t range; + fixed_string_t action; + uint32_t count; +}; + +/* function called when cmd_range_count is parsed successfully */ +static void cmd_range_count_parsed(void *parsed_result, void *data) +{ + struct cmd_range_count_result *res = parsed_result; + range_count = res->count; +} + +prog_char str_count[] = "count"; + +parse_pgm_token_string_t cmd_range_count_range_count = + TOKEN_STRING_INITIALIZER(struct cmd_range_count_result, range, + str_range); +parse_pgm_token_string_t cmd_range_count_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_count_result, action, + str_count); +parse_pgm_token_num_t cmd_range_count_count = + TOKEN_NUM_INITIALIZER(struct cmd_range_count_result, count, UINT32); + + +prog_char help_range_count[] = "set range test count"; + +parse_pgm_inst_t cmd_range_count = { + .f = cmd_range_count_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_range_count, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_count_range_count, + (prog_void *)&cmd_range_count_action, + (prog_void *)&cmd_range_count_count, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_powermask is parsed successfully */ +struct cmd_range_powermask_result { + fixed_string_t range; + fixed_string_t action; + uint8_t powermask; +}; + +/* function called when cmd_range_powermask is parsed successfully */ +static void cmd_range_powermask_parsed(void *parsed_result, void *data) +{ + struct cmd_range_powermask_result *res = parsed_result; + range_powermask = res->powermask; +} + +prog_char str_powermask[] = "powermask"; + +parse_pgm_token_string_t cmd_range_powermask_range_powermask = + TOKEN_STRING_INITIALIZER(struct cmd_range_powermask_result, range, + str_range); +parse_pgm_token_string_t cmd_range_powermask_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_powermask_result, action, + str_powermask); +parse_pgm_token_num_t cmd_range_powermask_powermask = + TOKEN_NUM_INITIALIZER(struct cmd_range_powermask_result, powermask, + UINT8); + + +prog_char help_range_powermask[] = "set range test powermask"; + +parse_pgm_inst_t cmd_range_powermask = { + .f = cmd_range_powermask_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_range_powermask, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_powermask_range_powermask, + (prog_void *)&cmd_range_powermask_action, + (prog_void *)&cmd_range_powermask_powermask, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_dstaddr is parsed successfully */ +struct cmd_range_dstaddr_result { + fixed_string_t range; + fixed_string_t action; + uint64_t dstaddr; +}; + +/* function called when cmd_range_dstaddr is parsed successfully */ +static void cmd_range_dstaddr_parsed(void *parsed_result, void *data) +{ + struct cmd_range_dstaddr_result *res = parsed_result; + range_dstaddr = res->dstaddr; +} + +prog_char str_dstaddr[] = "dstaddr"; + +parse_pgm_token_string_t cmd_range_dstaddr_range_dstaddr = + TOKEN_STRING_INITIALIZER(struct cmd_range_dstaddr_result, range, + str_range); +parse_pgm_token_string_t cmd_range_dstaddr_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_dstaddr_result, action, + str_dstaddr); +parse_pgm_token_num_t cmd_range_dstaddr_dstaddr = + TOKEN_NUM_INITIALIZER(struct cmd_range_dstaddr_result, dstaddr, UINT64); + + +prog_char help_range_dstaddr[] = "set register rangeing dstaddr"; + +parse_pgm_inst_t cmd_range_dstaddr = { + .f = cmd_range_dstaddr_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_range_dstaddr, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_dstaddr_range_dstaddr, + (prog_void *)&cmd_range_dstaddr_action, + (prog_void *)&cmd_range_dstaddr_dstaddr, + NULL, + }, +}; + + +/* ************* */ + +/* this structure is filled when cmd_monitor is parsed successfully */ +struct cmd_monitor_result { + fixed_string_t monitor; + fixed_string_t action; +}; + +/* function called when cmd_monitor is parsed successfully */ +static void cmd_monitor_parsed(void *parsed_result, void *data) +{ + struct cmd_monitor_result *res = parsed_result; + struct monitor_reg *m; + + if (!strcmp_P(res->action, PSTR("show"))) { + printf_P(PSTR("monitor period is %d ms, %d regs in list\r\n"), + monitor_period_ms, monitor_count); + LIST_FOREACH(m, &xbee_monitor_list, next) + printf_P(PSTR(" %S\n"), m->desc); + } + else if (!strcmp_P(res->action, PSTR("start"))) { + if (monitor_running) { + printf("already running\n"); + return; + } + if (monitor_count == 0) { + printf("no regs to be monitored\n"); + return; + } + callout_init(&monitor_event); + callout_reset(&cm, &monitor_event, 0, SINGLE, monitor_cb, NULL); + monitor_running = 1; + monitor_current = LIST_FIRST(&xbee_monitor_list); + printf_P(PSTR("monitor cb: %S %s\r\n"), + monitor_current->desc, + monitor_current->atcmd); + + } + else if (!strcmp_P(res->action, PSTR("end"))) { + if (monitor_running == 0) { + printf("not running\n"); + return; + } + monitor_running = 0; + callout_stop(&cm, &monitor_event); + } +} + +prog_char str_monitor[] = "monitor"; +prog_char str_monitor_tokens[] = "show#start#end"; + +parse_pgm_token_string_t cmd_monitor_monitor = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_result, monitor, + str_monitor); +parse_pgm_token_string_t cmd_monitor_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_result, action, + str_monitor_tokens); + +prog_char help_monitor[] = "start/stop/show current monitoring"; + +parse_pgm_inst_t cmd_monitor = { + .f = cmd_monitor_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_monitor, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_monitor, + (prog_void *)&cmd_monitor_action, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_add is parsed successfully */ +struct cmd_monitor_add_result { + fixed_string_t monitor; + fixed_string_t action; + struct xbee_atcmd_pgm *cmd; +}; + +/* function called when cmd_monitor_add is parsed successfully */ +static void cmd_monitor_add_parsed(void *parsed_result, void *data) +{ + struct cmd_monitor_add_result *res = parsed_result; + struct monitor_reg *m; + struct xbee_atcmd copy; + + memcpy_P(©, res->cmd, sizeof(copy)); + LIST_FOREACH(m, &xbee_monitor_list, next) { + if (!strcmp_P(m->atcmd, copy.name)) + break; + } + + if (m != NULL) { + printf("already exist\n"); + return; + } + + m = malloc(sizeof(*m)); + if (m == NULL) { + printf("no mem\n"); + return; + } + m->desc = copy.desc; + strcpy_P(m->atcmd, copy.name); + LIST_INSERT_HEAD(&xbee_monitor_list, m, next); + monitor_count ++; +} + +prog_char str_monitor_add[] = "add"; + +parse_pgm_token_string_t cmd_monitor_add_monitor_add = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_add_result, monitor, + str_monitor); +parse_pgm_token_string_t cmd_monitor_add_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_add_result, action, + str_monitor_add); +parse_pgm_token_atcmd_t cmd_monitor_add_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_monitor_add_result, cmd, &xbee_dev, + XBEE_ATCMD_F_READ, XBEE_ATCMD_F_READ); + + +prog_char help_monitor_add[] = "add a register in monitor list"; + +parse_pgm_inst_t cmd_monitor_add = { + .f = cmd_monitor_add_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_monitor_add, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_add_monitor_add, + (prog_void *)&cmd_monitor_add_action, + (prog_void *)&cmd_monitor_add_atcmd, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_period is parsed successfully */ +struct cmd_monitor_period_result { + fixed_string_t monitor; + fixed_string_t action; + uint32_t period; +}; + +/* function called when cmd_monitor_period is parsed successfully */ +static void cmd_monitor_period_parsed(void *parsed_result, void *data) +{ + struct cmd_monitor_period_result *res = parsed_result; + + if (res->period < 100) { + printf("error, minimum period is 100 ms\n"); + return; + } + + monitor_period_ms = res->period; +} + +prog_char str_monitor_period[] = "period"; + +parse_pgm_token_string_t cmd_monitor_period_monitor_period = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_period_result, monitor, + str_monitor); +parse_pgm_token_string_t cmd_monitor_period_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_period_result, action, + str_monitor_period); +parse_pgm_token_num_t cmd_monitor_period_period = + TOKEN_NUM_INITIALIZER(struct cmd_monitor_period_result, period, UINT32); + + +prog_char help_monitor_period[] = "set register monitoring period"; + +parse_pgm_inst_t cmd_monitor_period = { + .f = cmd_monitor_period_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_monitor_period, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_period_monitor_period, + (prog_void *)&cmd_monitor_period_action, + (prog_void *)&cmd_monitor_period_period, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_del is parsed successfully */ +struct cmd_monitor_del_result { + fixed_string_t monitor; + fixed_string_t action; + struct monitor_reg *m; +}; + +/* function called when cmd_monitor_del is parsed successfully */ +static void cmd_monitor_del_parsed(void *parsed_result, void *data) +{ + struct cmd_monitor_del_result *res = parsed_result; + + monitor_current = LIST_NEXT(res->m, next); + LIST_REMOVE(res->m, next); + free(res->m); + monitor_count --; + if (monitor_count == 0) { + printf("Disable monitoring, no more event\n"); + callout_stop(&cm, &monitor_event); + monitor_running = 0; + return; + } +} + +prog_char str_monitor_del[] = "del"; + +parse_pgm_token_string_t cmd_monitor_del_monitor_del = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_del_result, monitor, + str_monitor); +parse_pgm_token_string_t cmd_monitor_del_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_del_result, action, + str_monitor_del); +parse_pgm_token_monitor_t cmd_monitor_del_atcmd = + TOKEN_MONITOR_INITIALIZER(struct cmd_monitor_del_result, m); + + +prog_char help_monitor_del[] = "del a register in monitor list"; + +parse_pgm_inst_t cmd_monitor_del = { + .f = cmd_monitor_del_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_monitor_del, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_del_monitor_del, + (prog_void *)&cmd_monitor_del_action, + (prog_void *)&cmd_monitor_del_atcmd, + NULL, + }, +}; + + +/* ************* */ + +/* this structure is filled when cmd_ping is parsed successfully */ +struct cmd_ping_result { + fixed_string_t ping; +}; + +/* function called when cmd_ping is parsed successfully */ +static void cmd_ping_parsed(void *parsed_result, void *data) +{ + xbeeapp_send_atcmd("VL", NULL, 0, 1, NULL, NULL); +} + +prog_char str_ping[] = "ping"; + +parse_pgm_token_string_t cmd_ping_ping = + TOKEN_STRING_INITIALIZER(struct cmd_ping_result, ping, + str_ping); + +prog_char help_ping[] = "Send a ping to the xbee device"; + +parse_pgm_inst_t cmd_ping = { + .f = cmd_ping_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_ping, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_ping_ping, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_raw is parsed successfully */ +struct cmd_raw_result { + fixed_string_t raw; +}; + +/* function called when cmd_raw is parsed successfully */ +static void cmd_raw_parsed(void *parsed_result, void *data) +{ + printf("switched to raw mode, CTRL-D to exit\n"); + rdline_stop(&xbeeboard.rdl); /* don't display prompt when return */ + xbee_raw = 1; +} + +prog_char str_raw[] = "raw"; + +parse_pgm_token_string_t cmd_raw_raw = + TOKEN_STRING_INITIALIZER(struct cmd_raw_result, raw, + str_raw); + +prog_char help_raw[] = "Switch to raw mode"; + +parse_pgm_inst_t cmd_raw = { + .f = cmd_raw_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_raw, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_raw_raw, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_dump is parsed successfully */ +struct cmd_dump_result { + fixed_string_t dump; + fixed_string_t onoff; +}; + +/* function called when cmd_dump is parsed successfully */ +static void cmd_dump_parsed(void *parsed_result, void *data) +{ + struct cmd_dump_result *res = parsed_result; + if (!strcmp(res->onoff, "on")) + xbee_hexdump = 1; + else + xbee_hexdump = 0; +} + +prog_char str_dump[] = "dump"; +prog_char str_dump_onoff[] = "on#off"; + +parse_pgm_token_string_t cmd_dump_dump = + TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump, + str_dump); + +parse_pgm_token_string_t cmd_dump_onoff = + TOKEN_STRING_INITIALIZER(struct cmd_dump_result, onoff, + str_dump_onoff); + +prog_char help_dump[] = "enable/disable hexdump of received packets"; + +parse_pgm_inst_t cmd_dump = { + .f = cmd_dump_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_dump, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_dump_dump, + (prog_void *)&cmd_dump_onoff, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_debug is parsed successfully */ +struct cmd_debug_result { + fixed_string_t debug; + fixed_string_t onoff; +}; + +/* function called when cmd_debug is parsed successfully */ +static void cmd_debug_parsed(void *parsed_result, void *data) +{ + struct cmd_debug_result *res = parsed_result; + if (!strcmp(res->onoff, "on")) + xbee_debug = 1; + else + xbee_debug = 0; +} + +prog_char str_debug[] = "debug"; +prog_char str_debug_onoff[] = "on#off"; + +parse_pgm_token_string_t cmd_debug_debug = + TOKEN_STRING_INITIALIZER(struct cmd_debug_result, debug, + str_debug); + +parse_pgm_token_string_t cmd_debug_onoff = + TOKEN_STRING_INITIALIZER(struct cmd_debug_result, onoff, + str_debug_onoff); + +prog_char help_debug[] = "enable/disable additionnal debug"; + +parse_pgm_inst_t cmd_debug = { + .f = cmd_debug_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_debug, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_debug_debug, + (prog_void *)&cmd_debug_onoff, + NULL, + }, +}; + + + +/* in progmem */ +parse_pgm_ctx_t main_ctx[] = { + + /* commands_gen.c */ + (parse_pgm_inst_t *)&cmd_reset, + (parse_pgm_inst_t *)&cmd_bootloader, + (parse_pgm_inst_t *)&cmd_log, + (parse_pgm_inst_t *)&cmd_log_show, + (parse_pgm_inst_t *)&cmd_log_type, + (parse_pgm_inst_t *)&cmd_stack_space, + (parse_pgm_inst_t *)&cmd_scheduler, + (parse_pgm_inst_t *)&cmd_help, + (parse_pgm_inst_t *)&cmd_neigh_del, + (parse_pgm_inst_t *)&cmd_neigh_add, + (parse_pgm_inst_t *)&cmd_neigh_list, + (parse_pgm_inst_t *)&cmd_read, + (parse_pgm_inst_t *)&cmd_write_none, + (parse_pgm_inst_t *)&cmd_write_u8, + (parse_pgm_inst_t *)&cmd_write_u16, + (parse_pgm_inst_t *)&cmd_write_u32, + (parse_pgm_inst_t *)&cmd_sendmsg, + (parse_pgm_inst_t *)&cmd_sendmsg_name, + (parse_pgm_inst_t *)&cmd_range, + (parse_pgm_inst_t *)&cmd_range_period, + (parse_pgm_inst_t *)&cmd_range_count, + (parse_pgm_inst_t *)&cmd_range_powermask, + (parse_pgm_inst_t *)&cmd_range_dstaddr, + (parse_pgm_inst_t *)&cmd_monitor, + (parse_pgm_inst_t *)&cmd_monitor_period, + (parse_pgm_inst_t *)&cmd_monitor_add, + (parse_pgm_inst_t *)&cmd_monitor_del, + (parse_pgm_inst_t *)&cmd_ping, + (parse_pgm_inst_t *)&cmd_raw, + (parse_pgm_inst_t *)&cmd_dump, + (parse_pgm_inst_t *)&cmd_debug, + NULL, +}; diff --git a/commands2.c b/commands2.c new file mode 100644 index 0000000..d883951 --- /dev/null +++ b/commands2.c @@ -0,0 +1,1339 @@ +/* + * Copyright (c) 2009, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_atcmd.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" +#include "parse_atcmd.h" +#include "parse_neighbor.h" +#include "parse_monitor.h" +#include "main.h" + +static struct monitor_reg_list monitor_list = LIST_HEAD_INITIALIZER(x/*XXX*/); +static int monitor_period_ms = 1000; +static int monitor_running = 0; +static int monitor_count = 0; +static struct event monitor_event; +struct monitor_reg *monitor_current; + +static int range_period_ms = 1000; +static int range_powermask = 0x1F; +static uint8_t range_power = 0; +static int range_running = 0; +static uint64_t range_dstaddr = 0xFFFF; /* broadcast by default */ +static struct event range_event; +static int range_count = 100; +static int range_cur_count = 0; + +static const char *xbee_logfilename = "/tmp/xbee.log"; + +static void monitor_cb(int s, short event, void *arg) +{ + struct timeval tv; + struct cmdline *cl = arg; + + if (monitor_current == NULL) + monitor_current = LIST_FIRST(&monitor_list); + + xbeeapp_send_atcmd(monitor_current->atcmd, NULL, 0, 0); + monitor_current = LIST_NEXT(monitor_current, next); + + evtimer_set(&monitor_event, monitor_cb, cl); + tv.tv_sec = 0; + tv.tv_usec = (1000 * monitor_period_ms) / monitor_count; + evtimer_add(&monitor_event, &tv); +} + +static void range_cb(int s, short event, void *arg) +{ + struct timeval tv; + struct cmdline *cl = arg; + char buf[16]; + uint8_t i, mask; + + range_cur_count--; + + /* get new xmit power */ + for (i = 1; i <= 8; i++) { + mask = 1 << ((range_power + i) & 0x7); + if (mask & range_powermask) + break; + } + range_power = ((range_power + i) & 0x7); + + xbeeapp_send_atcmd("PL", &range_power, sizeof(range_power), 0, NULL, NULL); + snprintf(buf, sizeof(buf), "range%d", range_power); + xbeeapp_send_msg(range_dstaddr, buf, strlen(buf), 0); + + if (range_cur_count == 0) { + range_running = 0; + return; + } + + evtimer_set(&range_event, range_cb, cl); + tv.tv_sec = 0; + tv.tv_usec = 1000 * range_period_ms; + evtimer_add(&range_event, &tv); +} + +/* ************* */ + +/* this structure is filled when cmd_stats is parsed successfully */ +struct cmd_stats_result { + fixed_string_t stats; + fixed_string_t action; +}; + +/* function called when cmd_stats is parsed successfully */ +static void cmd_stats_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + struct cmd_stats_result *res = parsed_result; + + if (!strcmp(res->action, "show")) { + xbee_dump_stats(stdout, xbee_dev); + if (xbee_logfile != NULL) + xbee_dump_stats(xbee_logfile, xbee_dev); + } + else if (!strcmp(res->action, "reset")) + xbee_reset_stats(xbee_dev); +} + +parse_pgm_token_string_t cmd_stats_stats = + TOKEN_STRING_INITIALIZER(struct cmd_stats_result, stats, "stats"); +parse_pgm_token_string_t cmd_stats_action = + TOKEN_STRING_INITIALIZER(struct cmd_stats_result, action, "show#reset"); + +parse_pgm_inst_t cmd_stats = { + .f = cmd_stats_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Send a stats to the xbee device", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_stats_stats, + (prog_void *)&cmd_stats_action, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor is parsed successfully */ +struct cmd_monitor_result { + fixed_string_t monitor; + fixed_string_t action; +}; + +/* function called when cmd_monitor is parsed successfully */ +static void cmd_monitor_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_monitor_result *res = parsed_result; + struct monitor_reg *m; + + if (!strcmp(res->action, "show")) { + printf("monitor period is %d ms, %d regs in list\n", + monitor_period_ms, monitor_count); + LIST_FOREACH(m, &monitor_list, next) + printf(" %s\n", m->desc); + } + else if (!strcmp(res->action, "start")) { + struct timeval tv; + if (monitor_running) { + printf("already running\n"); + return; + } + if (monitor_count == 0) { + printf("no regs to be monitored\n"); + return; + } + evtimer_set(&monitor_event, monitor_cb, cl); + tv.tv_sec = 0; + tv.tv_usec = 0; + evtimer_add(&monitor_event, &tv); + monitor_running = 1; + monitor_current = LIST_FIRST(&monitor_list); + } + else if (!strcmp(res->action, "end")) { + if (monitor_running == 0) { + printf("not running\n"); + return; + } + monitor_running = 0; + evtimer_del(&monitor_event); + } +} + +parse_pgm_token_string_t cmd_monitor_monitor = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_result, monitor, "monitor"); +parse_pgm_token_string_t cmd_monitor_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_result, action, + "show#start#end"); + +parse_pgm_inst_t cmd_monitor = { + .f = cmd_monitor_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "start/stop/show current monitoring", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_monitor, + (prog_void *)&cmd_monitor_action, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_add is parsed successfully */ +struct cmd_monitor_add_result { + fixed_string_t monitor; + fixed_string_t action; + struct xbee_atcmd *cmd; +}; + +/* function called when cmd_monitor_add is parsed successfully */ +static void cmd_monitor_add_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_monitor_add_result *res = parsed_result; + struct monitor_reg *m; + + LIST_FOREACH(m, &monitor_list, next) { + if (!strcmp(m->desc, res->cmd->desc)) + break; + } + + if (m != NULL) { + printf("already exist\n"); + return; + } + + m = malloc(sizeof(*m)); + if (m == NULL) { + printf("no mem\n"); + return; + } + + m->desc = res->cmd->desc; + m->atcmd = res->cmd->name; + LIST_INSERT_HEAD(&monitor_list, m, next); + monitor_count ++; +} + +parse_pgm_token_string_t cmd_monitor_add_monitor_add = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_add_result, monitor, + "monitor"); +parse_pgm_token_string_t cmd_monitor_add_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_add_result, action, + "add"); +parse_pgm_token_atcmd_t cmd_monitor_add_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_monitor_add_result, cmd, &xbee_dev, + XBEE_ATCMD_F_READ, XBEE_ATCMD_F_READ); + + +parse_pgm_inst_t cmd_monitor_add = { + .f = cmd_monitor_add_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "add a register in monitor list", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_add_monitor_add, + (prog_void *)&cmd_monitor_add_action, + (prog_void *)&cmd_monitor_add_atcmd, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_period is parsed successfully */ +struct cmd_monitor_period_result { + fixed_string_t monitor; + fixed_string_t action; + uint32_t period; +}; + +/* function called when cmd_monitor_period is parsed successfully */ +static void cmd_monitor_period_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_monitor_period_result *res = parsed_result; + + if (res->period < 100) { + printf("error, minimum period is 100 ms\n"); + return; + } + + monitor_period_ms = res->period; +} + +parse_pgm_token_string_t cmd_monitor_period_monitor_period = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_period_result, monitor, + "monitor"); +parse_pgm_token_string_t cmd_monitor_period_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_period_result, action, + "period"); +parse_pgm_token_num_t cmd_monitor_period_period = + TOKEN_NUM_INITIALIZER(struct cmd_monitor_period_result, period, UINT32); + + +parse_pgm_inst_t cmd_monitor_period = { + .f = cmd_monitor_period_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "set register monitoring period", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_period_monitor_period, + (prog_void *)&cmd_monitor_period_action, + (prog_void *)&cmd_monitor_period_period, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_monitor_del is parsed successfully */ +struct cmd_monitor_del_result { + fixed_string_t monitor; + fixed_string_t action; + struct monitor_reg *m; +}; + +/* function called when cmd_monitor_del is parsed successfully */ +static void cmd_monitor_del_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_monitor_del_result *res = parsed_result; + + monitor_current = LIST_NEXT(res->m, next); + LIST_REMOVE(res->m, next); + free(res->m); + monitor_count --; + if (monitor_count == 0) { + printf("Disable monitoring, no more event\n"); + evtimer_del(&monitor_event); + monitor_running = 0; + return; + } +} + +parse_pgm_token_string_t cmd_monitor_del_monitor_del = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_del_result, monitor, + "monitor"); +parse_pgm_token_string_t cmd_monitor_del_action = + TOKEN_STRING_INITIALIZER(struct cmd_monitor_del_result, action, + "del"); +parse_pgm_token_monitor_t cmd_monitor_del_atcmd = + TOKEN_MONITOR_INITIALIZER(struct cmd_monitor_del_result, m, + &monitor_list); + + +parse_pgm_inst_t cmd_monitor_del = { + .f = cmd_monitor_del_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "del a register in monitor list", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_monitor_del_monitor_del, + (prog_void *)&cmd_monitor_del_action, + (prog_void *)&cmd_monitor_del_atcmd, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range is parsed successfully */ +struct cmd_range_result { + fixed_string_t range; + fixed_string_t action; +}; + +/* function called when cmd_range is parsed successfully */ +static void cmd_range_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_range_result *res = parsed_result; + + if (!strcmp(res->action, "show")) { + printf("range infos:\n"); + printf(" range period %d\n", range_period_ms); + printf(" range count %d\n", range_count); + printf(" range powermask 0x%x\n", range_powermask); + printf(" range dstaddr %"PRIx64"\n", range_dstaddr); + if (range_running) + printf(" range test is running\n"); + else + printf(" range test is not running\n"); + } + else if (!strcmp(res->action, "start")) { + struct timeval tv; + if (range_running) { + printf("already running\n"); + return; + } + range_cur_count = range_count; + evtimer_set(&range_event, range_cb, cl); + tv.tv_sec = 0; + tv.tv_usec = 0; + evtimer_add(&range_event, &tv); + range_running = 1; + } + else if (!strcmp(res->action, "end")) { + if (range_running == 0) { + printf("not running\n"); + return; + } + range_running = 0; + evtimer_del(&range_event); + } +} + +parse_pgm_token_string_t cmd_range_range = + TOKEN_STRING_INITIALIZER(struct cmd_range_result, range, "range"); +parse_pgm_token_string_t cmd_range_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_result, action, + "show#start#end"); + +parse_pgm_inst_t cmd_range = { + .f = cmd_range_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "start/stop/show current rangeing", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_range, + (prog_void *)&cmd_range_action, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_period is parsed successfully */ +struct cmd_range_period_result { + fixed_string_t range; + fixed_string_t action; + uint32_t period; +}; + +/* function called when cmd_range_period is parsed successfully */ +static void cmd_range_period_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_range_period_result *res = parsed_result; + + if (res->period < 10) { + printf("error, minimum period is 10 ms\n"); + return; + } + + range_period_ms = res->period; +} + +parse_pgm_token_string_t cmd_range_period_range_period = + TOKEN_STRING_INITIALIZER(struct cmd_range_period_result, range, + "range"); +parse_pgm_token_string_t cmd_range_period_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_period_result, action, + "period"); +parse_pgm_token_num_t cmd_range_period_period = + TOKEN_NUM_INITIALIZER(struct cmd_range_period_result, period, UINT32); + + +parse_pgm_inst_t cmd_range_period = { + .f = cmd_range_period_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "set range test period", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_period_range_period, + (prog_void *)&cmd_range_period_action, + (prog_void *)&cmd_range_period_period, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_count is parsed successfully */ +struct cmd_range_count_result { + fixed_string_t range; + fixed_string_t action; + uint32_t count; +}; + +/* function called when cmd_range_count is parsed successfully */ +static void cmd_range_count_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_range_count_result *res = parsed_result; + range_count = res->count; +} + +parse_pgm_token_string_t cmd_range_count_range_count = + TOKEN_STRING_INITIALIZER(struct cmd_range_count_result, range, + "range"); +parse_pgm_token_string_t cmd_range_count_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_count_result, action, + "count"); +parse_pgm_token_num_t cmd_range_count_count = + TOKEN_NUM_INITIALIZER(struct cmd_range_count_result, count, UINT32); + + +parse_pgm_inst_t cmd_range_count = { + .f = cmd_range_count_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "set range test count", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_count_range_count, + (prog_void *)&cmd_range_count_action, + (prog_void *)&cmd_range_count_count, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_powermask is parsed successfully */ +struct cmd_range_powermask_result { + fixed_string_t range; + fixed_string_t action; + uint8_t powermask; +}; + +/* function called when cmd_range_powermask is parsed successfully */ +static void cmd_range_powermask_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_range_powermask_result *res = parsed_result; + range_powermask = res->powermask; +} + +parse_pgm_token_string_t cmd_range_powermask_range_powermask = + TOKEN_STRING_INITIALIZER(struct cmd_range_powermask_result, range, + "range"); +parse_pgm_token_string_t cmd_range_powermask_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_powermask_result, action, + "powermask"); +parse_pgm_token_num_t cmd_range_powermask_powermask = + TOKEN_NUM_INITIALIZER(struct cmd_range_powermask_result, powermask, + UINT8); + + +parse_pgm_inst_t cmd_range_powermask = { + .f = cmd_range_powermask_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "set range test powermask", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_powermask_range_powermask, + (prog_void *)&cmd_range_powermask_action, + (prog_void *)&cmd_range_powermask_powermask, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_range_dstaddr is parsed successfully */ +struct cmd_range_dstaddr_result { + fixed_string_t range; + fixed_string_t action; + uint64_t dstaddr; +}; + +/* function called when cmd_range_dstaddr is parsed successfully */ +static void cmd_range_dstaddr_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_range_dstaddr_result *res = parsed_result; + + range_dstaddr = res->dstaddr; +} + +parse_pgm_token_string_t cmd_range_dstaddr_range_dstaddr = + TOKEN_STRING_INITIALIZER(struct cmd_range_dstaddr_result, range, + "range"); +parse_pgm_token_string_t cmd_range_dstaddr_action = + TOKEN_STRING_INITIALIZER(struct cmd_range_dstaddr_result, action, + "dstaddr"); +parse_pgm_token_num_t cmd_range_dstaddr_dstaddr = + TOKEN_NUM_INITIALIZER(struct cmd_range_dstaddr_result, dstaddr, UINT64); + + +parse_pgm_inst_t cmd_range_dstaddr = { + .f = cmd_range_dstaddr_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "set register rangeing dstaddr", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_range_dstaddr_range_dstaddr, + (prog_void *)&cmd_range_dstaddr_action, + (prog_void *)&cmd_range_dstaddr_dstaddr, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_ping is parsed successfully */ +struct cmd_ping_result { + fixed_string_t ping; +}; + +/* function called when cmd_ping is parsed successfully */ +static void cmd_ping_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + xbeeapp_send_atcmd("VL", NULL, 0, 1, NULL, NULL); +} + +parse_pgm_token_string_t cmd_ping_ping = + TOKEN_STRING_INITIALIZER(struct cmd_ping_result, ping, "ping"); + +parse_pgm_inst_t cmd_ping = { + .f = cmd_ping_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Send a ping to the xbee device", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_ping_ping, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_raw is parsed successfully */ +struct cmd_raw_result { + fixed_string_t raw; +}; + +/* function called when cmd_raw is parsed successfully */ +static void cmd_raw_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + printf("switched to raw mode, CTRL-D to exit\n"); + rdline_stop(&cl->rdl); /* don't display prompt when return */ + xbee_raw = 1; +} + +parse_pgm_token_string_t cmd_raw_raw = + TOKEN_STRING_INITIALIZER(struct cmd_raw_result, raw, "raw"); + +parse_pgm_inst_t cmd_raw = { + .f = cmd_raw_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Switch to raw mode", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_raw_raw, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_dump is parsed successfully */ +struct cmd_dump_result { + fixed_string_t dump; + fixed_string_t onoff; +}; + +/* function called when cmd_dump is parsed successfully */ +static void cmd_dump_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + struct cmd_dump_result *res = parsed_result; + if (!strcmp(res->onoff, "on")) + xbee_hexdump = 1; + else + xbee_hexdump = 0; +} + +parse_pgm_token_string_t cmd_dump_dump = + TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump, "dump"); + +parse_pgm_token_string_t cmd_dump_onoff = + TOKEN_STRING_INITIALIZER(struct cmd_dump_result, onoff, "on#off"); + +parse_pgm_inst_t cmd_dump = { + .f = cmd_dump_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "enable/disable hexdump of received packets", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_dump_dump, + (prog_void *)&cmd_dump_onoff, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_debug is parsed successfully */ +struct cmd_debug_result { + fixed_string_t debug; + fixed_string_t onoff; +}; + +/* function called when cmd_debug is parsed successfully */ +static void cmd_debug_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + struct cmd_debug_result *res = parsed_result; + if (!strcmp(res->onoff, "on")) + xbee_debug = 1; + else + xbee_debug = 0; +} + +parse_pgm_token_string_t cmd_debug_debug = + TOKEN_STRING_INITIALIZER(struct cmd_debug_result, debug, "debug"); + +parse_pgm_token_string_t cmd_debug_onoff = + TOKEN_STRING_INITIALIZER(struct cmd_debug_result, onoff, "on#off"); + +parse_pgm_inst_t cmd_debug = { + .f = cmd_debug_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "enable/disable additionnal debug", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_debug_debug, + (prog_void *)&cmd_debug_onoff, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_help is parsed successfully */ +struct cmd_help_result { + fixed_string_t help; + struct xbee_atcmd *cmd; +}; + +/* function called when cmd_help is parsed successfully */ +static void cmd_help_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_help_result *res = parsed_result; + int type; + + type = (res->cmd->flags & (XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE)); + switch (type) { + case XBEE_ATCMD_F_READ: + printf("Read-only\n"); + break; + case XBEE_ATCMD_F_WRITE: + printf("Write-only\n"); + break; + default: + printf("Read-write\n"); + break; + } + if (res->cmd->flags & XBEE_ATCMD_F_PARAM_NONE) + printf("No argument\n"); + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U8) + printf("Register is unsigned 8 bits\n"); + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U16) + printf("Register is unsigned 16 bits\n"); + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U32) + printf("Register is unsigned 32 bits\n"); + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_S16) + printf("Register is signed 16 bits\n"); + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_STRING_20B) + printf("Register is a 20 bytes string\n"); + else + printf("Unknown argument\n"); + + printf("%s\n", res->cmd->help); +} + +parse_pgm_token_string_t cmd_help_help = + TOKEN_STRING_INITIALIZER(struct cmd_help_result, help, "help"); + +parse_pgm_token_atcmd_t cmd_help_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_help_result, cmd, &xbee_dev, + 0, 0); + +parse_pgm_inst_t cmd_help = { + .f = cmd_help_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Help a register using an AT command", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_help_help, + (prog_void *)&cmd_help_atcmd, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_read is parsed successfully */ +struct cmd_read_result { + fixed_string_t read; + struct xbee_atcmd *cmd; +}; + +/* function called when cmd_read is parsed successfully */ +static void cmd_read_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_read_result *res = parsed_result; + xbeeapp_send_atcmd(res->cmd->name, NULL, 0, 1, NULL, NULL); +} + +parse_pgm_token_string_t cmd_read_read = + TOKEN_STRING_INITIALIZER(struct cmd_read_result, read, "read"); + +parse_pgm_token_atcmd_t cmd_read_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_read_result, cmd, &xbee_dev, + XBEE_ATCMD_F_READ, XBEE_ATCMD_F_READ); + +parse_pgm_inst_t cmd_read = { + .f = cmd_read_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Read a register using an AT command", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_read_read, + (prog_void *)&cmd_read_atcmd, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_write is parsed successfully */ +struct cmd_write_result { + fixed_string_t write; + struct xbee_atcmd *cmd; + union { + uint8_t u8; + uint16_t u16; + uint32_t u32; + }; +}; + +/* function called when cmd_write is parsed successfully */ +static void cmd_write_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_write_result *res = parsed_result; + int len; + void *param; + + if (res->cmd->flags & XBEE_ATCMD_F_PARAM_NONE) { + len = 0; + param = NULL; + } + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U8) { + len = sizeof(res->u8); + param = &res->u8; + } + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U16) { + len = sizeof(res->u16); + res->u16 = htons(res->u16); + param = &res->u16; + } + else if (res->cmd->flags & XBEE_ATCMD_F_PARAM_U32) { + len = sizeof(res->u32); + res->u32 = htonl(res->u32); + param = &res->u32; + } + else { + printf("Unknown argument type\n"); + return; + } + xbeeapp_send_atcmd(res->cmd->name, param, len, 1, NULL, NULL); +} + +parse_pgm_token_string_t cmd_write_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_result, write, + "write"); + +parse_pgm_token_atcmd_t cmd_write_none_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_NONE, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_NONE); + +parse_pgm_inst_t cmd_write_none = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Send an AT command (no argument)", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_none_atcmd, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u8_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U8, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U8); + +parse_pgm_token_num_t cmd_write_u8_u8 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u8, UINT8); + +parse_pgm_inst_t cmd_write_u8 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Write a 8 bits register using an AT command", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u8_atcmd, + (prog_void *)&cmd_write_u8_u8, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u16_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U16, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U16); + +parse_pgm_token_num_t cmd_write_u16_u16 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u16, UINT16); + +parse_pgm_inst_t cmd_write_u16 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Write a 16 bits register using an AT command", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u16_atcmd, + (prog_void *)&cmd_write_u16_u16, + NULL, + }, +}; + +parse_pgm_token_atcmd_t cmd_write_u32_atcmd = + TOKEN_ATCMD_INITIALIZER(struct cmd_write_result, cmd, + &xbee_dev, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U32, + XBEE_ATCMD_F_WRITE | XBEE_ATCMD_F_PARAM_U32); + +parse_pgm_token_num_t cmd_write_u32_u32 = + TOKEN_NUM_INITIALIZER(struct cmd_write_result, u32, UINT32); + +parse_pgm_inst_t cmd_write_u32 = { + .f = cmd_write_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Write a 32 bits register using an AT command", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_write_write, + (prog_void *)&cmd_write_u32_atcmd, + (prog_void *)&cmd_write_u32_u32, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_sendmsg is parsed successfully */ +struct cmd_sendmsg_result { + fixed_string_t sendmsg; + uint64_t addr; + fixed_string_t data; +}; + +/* function called when cmd_sendmsg is parsed successfully */ +static void cmd_sendmsg_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_sendmsg_result *res = parsed_result; + xbeeapp_send_msg(res->addr, res->data, strlen(res->data), 1); +} + +parse_pgm_token_string_t cmd_sendmsg_sendmsg = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_result, sendmsg, "sendmsg"); + +parse_pgm_token_num_t cmd_sendmsg_addr = + TOKEN_NUM_INITIALIZER(struct cmd_sendmsg_result, addr, UINT64); + +parse_pgm_token_string_t cmd_sendmsg_data = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_result, data, NULL); + +parse_pgm_inst_t cmd_sendmsg = { + .f = cmd_sendmsg_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Send data to a node using its address", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_sendmsg_sendmsg, + (prog_void *)&cmd_sendmsg_addr, + (prog_void *)&cmd_sendmsg_data, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_sendmsg_name is parsed successfully */ +struct cmd_sendmsg_name_result { + fixed_string_t sendmsg_name; + struct xbee_neigh *neigh; + fixed_string_t data; +}; + +/* function called when cmd_sendmsg_name is parsed successfully */ +static void cmd_sendmsg_name_parsed(void *parsed_result, struct cmdline *cl, + void *data) +{ + struct cmd_sendmsg_name_result *res = parsed_result; + xbeeapp_send_msg(res->neigh->addr, res->data, strlen(res->data), 1); +} + +parse_pgm_token_string_t cmd_sendmsg_name_sendmsg_name = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_name_result, sendmsg_name, + "sendmsg"); + +parse_pgm_token_neighbor_t cmd_sendmsg_name_neigh = + TOKEN_NEIGHBOR_INITIALIZER(struct cmd_sendmsg_name_result, neigh, + &xbee_dev); + +parse_pgm_token_string_t cmd_sendmsg_name_data = + TOKEN_STRING_INITIALIZER(struct cmd_sendmsg_name_result, data, NULL); + +parse_pgm_inst_t cmd_sendmsg_name = { + .f = cmd_sendmsg_name_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "Send data to a node using its name", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_sendmsg_name_sendmsg_name, + (prog_void *)&cmd_sendmsg_name_neigh, + (prog_void *)&cmd_sendmsg_name_data, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_del_result { + fixed_string_t cmd; + fixed_string_t action; + struct xbee_neigh *neigh; +}; + +static void cmd_neigh_del_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ + struct cmd_neigh_del_result *res = parsed_result; + xbee_neigh_del(xbee_dev, res->neigh); +} + +parse_pgm_token_string_t cmd_neigh_del_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_del_result, cmd, "neigh"); +parse_pgm_token_string_t cmd_neigh_del_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_del_result, action, "del"); +parse_pgm_token_neighbor_t cmd_neigh_del_neigh = + TOKEN_NEIGHBOR_INITIALIZER(struct cmd_neigh_del_result, neigh, + &xbee_dev); + +parse_pgm_inst_t cmd_neigh_del = { + .f = cmd_neigh_del_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "delete a neighbor", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_del_cmd, + (prog_void *)&cmd_neigh_del_action, + (prog_void *)&cmd_neigh_del_neigh, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_add_result { + fixed_string_t cmd; + fixed_string_t action; + fixed_string_t name; + uint64_t addr; +}; + +static void cmd_neigh_add_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ + struct cmd_neigh_add_result *res = parsed_result; + if (xbee_neigh_add(xbee_dev, res->name, res->addr) == NULL) + printf("name or addr already exist\n"); +} + +parse_pgm_token_string_t cmd_neigh_add_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, cmd, "neigh"); +parse_pgm_token_string_t cmd_neigh_add_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, action, "add"); +parse_pgm_token_string_t cmd_neigh_add_name = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_add_result, name, NULL); +parse_pgm_token_num_t cmd_neigh_add_addr = + TOKEN_NUM_INITIALIZER(struct cmd_neigh_add_result, addr, UINT64); + +parse_pgm_inst_t cmd_neigh_add = { + .f = cmd_neigh_add_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "add a neighbor", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_add_cmd, + (prog_void *)&cmd_neigh_add_action, + (prog_void *)&cmd_neigh_add_name, + (prog_void *)&cmd_neigh_add_addr, + NULL, + }, +}; + +/* ************* */ + +struct cmd_neigh_list_result { + fixed_string_t cmd; + fixed_string_t action; +}; + +static void cmd_neigh_list_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ + struct xbee_neigh *neigh; + + LIST_FOREACH(neigh, &xbee_dev->neigh_list, next) { + printf(" %s: 0x%"PRIx64"\n", neigh->name, neigh->addr); + } +} + +parse_pgm_token_string_t cmd_neigh_list_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_list_result, cmd, "neigh"); +parse_pgm_token_string_t cmd_neigh_list_action = + TOKEN_STRING_INITIALIZER(struct cmd_neigh_list_result, action, "list"); + +parse_pgm_inst_t cmd_neigh_list = { + .f = cmd_neigh_list_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "list all known neighbors", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_neigh_list_cmd, + (prog_void *)&cmd_neigh_list_action, + NULL, + }, +}; + +/*******************/ + +struct cmd_logfile_result { + fixed_string_t logfile; + filename_t file; +}; + +static void cmd_logfile_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ + if (xbee_logfile != NULL) + fclose(xbee_logfile); + xbee_logfile = fopen(xbee_logfilename, "a"); + if (xbee_logfile == NULL) + printf("cannot open file: %s\n", strerror(errno)); + fprintf(xbee_logfile, "-------------------start\n"); + printf("enabling log\n"); +} + +parse_pgm_token_string_t cmd_logfile_logfile = + TOKEN_STRING_INITIALIZER(struct cmd_logfile_result, logfile, "logfile"); + +parse_pgm_token_file_t cmd_logfile_file = + TOKEN_FILE_INITIALIZER(struct cmd_logfile_result, file, + PARSE_FILE_F_CREATE); + +parse_pgm_inst_t cmd_logfile = { + .f = cmd_logfile_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = " set log file", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_logfile_logfile, + (prog_void *)&cmd_logfile_file, + NULL, + }, +}; + +/* ************* */ + +/* this structure is filled when cmd_log is parsed successfully */ +struct cmd_log_result { + fixed_string_t log; + fixed_string_t onoff; +}; + +/* function called when cmd_log is parsed successfully */ +static void cmd_log_parsed(void *parsed_result, struct cmdline *cl, void *data) +{ + struct cmd_log_result *res = parsed_result; + if (!strcmp(res->onoff, "on") && xbee_logfile == NULL) { + xbee_logfile = fopen(xbee_logfilename, "a"); + if (xbee_logfile == NULL) + printf("cannot open file: %s\n", strerror(errno)); + fprintf(xbee_logfile, "-------------------start\n"); + } + else if (!strcmp(res->onoff, "off") && xbee_logfile != NULL) { + fclose(xbee_logfile); + xbee_logfile = NULL; + } +} + +parse_pgm_token_string_t cmd_log_log = + TOKEN_STRING_INITIALIZER(struct cmd_log_result, log, "log"); + +parse_pgm_token_string_t cmd_log_onoff = + TOKEN_STRING_INITIALIZER(struct cmd_log_result, onoff, "on#off"); + +parse_pgm_inst_t cmd_log = { + .f = cmd_log_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "enable/disable hexlog of received packets", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_log_log, + (prog_void *)&cmd_log_onoff, + NULL, + }, +}; + + +/*******************/ + +struct cmd_saveconfig_result { + fixed_string_t saveconfig; + filename_t file; +}; + +static void cmd_saveconfig_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ + struct cmd_saveconfig_result *res = parsed_result; + + if (xbeeapp_dump_config(res->file) < 0) + printf("cannot save config\n"); +} + +parse_pgm_token_string_t cmd_saveconfig_saveconfig = + TOKEN_STRING_INITIALIZER(struct cmd_saveconfig_result, saveconfig, + "saveconfig"); + +parse_pgm_token_file_t cmd_saveconfig_file = + TOKEN_FILE_INITIALIZER(struct cmd_saveconfig_result, file, + PARSE_FILE_F_CREATE); + +parse_pgm_inst_t cmd_saveconfig = { + .f = cmd_saveconfig_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = " set log file", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_saveconfig_saveconfig, + (prog_void *)&cmd_saveconfig_file, + NULL, + }, +}; + +/*******************/ + +struct cmd_loadconfig_result { + fixed_string_t loadconfig; + filename_t file; +}; + +static void cmd_loadconfig_parsed(void *parsed_result, + struct cmdline *cl, + void *data) +{ +} + +parse_pgm_token_string_t cmd_loadconfig_loadconfig = + TOKEN_STRING_INITIALIZER(struct cmd_loadconfig_result, loadconfig, + "loadconfig"); + +parse_pgm_token_file_t cmd_loadconfig_file = + TOKEN_FILE_INITIALIZER(struct cmd_loadconfig_result, file, + PARSE_FILE_F_CREATE); + +parse_pgm_inst_t cmd_loadconfig = { + .f = cmd_loadconfig_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = " set log file", + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_loadconfig_loadconfig, + (prog_void *)&cmd_loadconfig_file, + NULL, + }, +}; + +/**********************************************************/ +/**********************************************************/ +/****** CONTEXT (list of instruction) */ + +/* in progmem */ +parse_ctx_t main_ctx = { + .name = "main", + .insts = { + (parse_pgm_inst_t *)&cmd_stats, + (parse_pgm_inst_t *)&cmd_monitor, + (parse_pgm_inst_t *)&cmd_monitor_period, + (parse_pgm_inst_t *)&cmd_monitor_add, + (parse_pgm_inst_t *)&cmd_monitor_del, + (parse_pgm_inst_t *)&cmd_range, + (parse_pgm_inst_t *)&cmd_range_period, + (parse_pgm_inst_t *)&cmd_range_count, + (parse_pgm_inst_t *)&cmd_range_powermask, + (parse_pgm_inst_t *)&cmd_range_dstaddr, + (parse_pgm_inst_t *)&cmd_ping, + (parse_pgm_inst_t *)&cmd_raw, + (parse_pgm_inst_t *)&cmd_dump, + (parse_pgm_inst_t *)&cmd_debug, + (parse_pgm_inst_t *)&cmd_help, + (parse_pgm_inst_t *)&cmd_read, + (parse_pgm_inst_t *)&cmd_write_none, + (parse_pgm_inst_t *)&cmd_write_u8, + (parse_pgm_inst_t *)&cmd_write_u16, + (parse_pgm_inst_t *)&cmd_write_u32, + (parse_pgm_inst_t *)&cmd_sendmsg, + (parse_pgm_inst_t *)&cmd_sendmsg_name, + (parse_pgm_inst_t *)&cmd_neigh_del, + (parse_pgm_inst_t *)&cmd_neigh_add, + (parse_pgm_inst_t *)&cmd_neigh_list, + (parse_pgm_inst_t *)&cmd_logfile, + (parse_pgm_inst_t *)&cmd_log, + (parse_pgm_inst_t *)&cmd_saveconfig, + (parse_pgm_inst_t *)&cmd_loadconfig, + NULL, + }, +}; diff --git a/commands_gen.c b/commands_gen.c new file mode 100644 index 0000000..1dbb749 --- /dev/null +++ b/commands_gen.c @@ -0,0 +1,371 @@ +/* + * Copyright Droids Corporation (2011) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: commands_gen.c,v 1.8 2009-11-08 17:24:33 zer0 Exp $ + * + * Olivier MATZ + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include "callout.h" +#include "main.h" +#include "cmdline.h" + +/**********************************************************/ +/* Reset */ + +/* this structure is filled when cmd_reset is parsed successfully */ +struct cmd_reset_result { + fixed_string_t arg0; +}; + +/* function called when cmd_reset is parsed successfully */ +static void cmd_reset_parsed(void * parsed_result, void * data) +{ +#ifdef HOST_VERSION + hostsim_exit(); +#endif + reset(); +} + +prog_char str_reset_arg0[] = "reset"; +parse_pgm_token_string_t cmd_reset_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_reset_result, arg0, str_reset_arg0); + +prog_char help_reset[] = "Reset the board"; +parse_pgm_inst_t cmd_reset = { + .f = cmd_reset_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_reset, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_reset_arg0, + NULL, + }, +}; + +/**********************************************************/ +/* Bootloader */ + +/* this structure is filled when cmd_bootloader is parsed successfully */ +struct cmd_bootloader_result { + fixed_string_t arg0; +}; + +/* function called when cmd_bootloader is parsed successfully */ +static void cmd_bootloader_parsed(void *parsed_result, void *data) +{ +#ifndef HOST_VERSION + bootloader(); +#else + printf("not implemented\n"); +#endif +} + +prog_char str_bootloader_arg0[] = "bootloader"; +parse_pgm_token_string_t cmd_bootloader_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_bootloader_result, arg0, str_bootloader_arg0); + +prog_char help_bootloader[] = "Launch the bootloader"; +parse_pgm_inst_t cmd_bootloader = { + .f = cmd_bootloader_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_bootloader, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_bootloader_arg0, + NULL, + }, +}; + +/**********************************************************/ +/* Scheduler show */ + +/* this structure is filled when cmd_scheduler is parsed successfully */ +struct cmd_scheduler_result { + fixed_string_t arg0; + fixed_string_t arg1; +}; + +/* function called when cmd_scheduler is parsed successfully */ +static void cmd_scheduler_parsed(void *parsed_result, void *data) +{ + scheduler_dump_events(); + scheduler_stats_dump(); +} + +prog_char str_scheduler_arg0[] = "scheduler"; +parse_pgm_token_string_t cmd_scheduler_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg0, str_scheduler_arg0); +prog_char str_scheduler_arg1[] = "show"; +parse_pgm_token_string_t cmd_scheduler_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg1, str_scheduler_arg1); + +prog_char help_scheduler[] = "Show scheduler events"; +parse_pgm_inst_t cmd_scheduler = { + .f = cmd_scheduler_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_scheduler, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_scheduler_arg0, + (prog_void *)&cmd_scheduler_arg1, + NULL, + }, +}; + +/**********************************************************/ +/* Log */ + +/* this structure is filled when cmd_log is parsed successfully */ +struct cmd_log_result { + fixed_string_t arg0; + fixed_string_t arg1; + uint8_t arg2; + fixed_string_t arg3; +}; + +/* keep it sync with string choice */ +static const prog_char uart_log[] = "uart"; +static const prog_char i2c_log[] = "i2c"; +static const prog_char default_log[] = "default"; + +struct log_name_and_num { + const prog_char * name; + uint8_t num; +}; + +static const struct log_name_and_num log_name_and_num[] = { + { uart_log, E_UART }, + { i2c_log, E_I2C }, + { default_log, E_USER_DEFAULT }, +}; + +static uint8_t +log_name2num(const char * s) +{ + uint8_t i; + + for (i=0; iarg1, PSTR("level"))) { + xbeeboard.log_level = res->arg2; + } + + /* else it is a show */ + cmd_log_do_show(); +} + +prog_char str_log_arg0[] = "log"; +parse_pgm_token_string_t cmd_log_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg0, str_log_arg0); +prog_char str_log_arg1[] = "level"; +parse_pgm_token_string_t cmd_log_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1); +parse_pgm_token_num_t cmd_log_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, INT8); + +prog_char help_log[] = "Set log options: level (0 -> 5)"; +parse_pgm_inst_t cmd_log = { + .f = cmd_log_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_log, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_log_arg0, + (prog_void *)&cmd_log_arg1, + (prog_void *)&cmd_log_arg2, + NULL, + }, +}; + +prog_char str_log_arg1_show[] = "show"; +parse_pgm_token_string_t cmd_log_arg1_show = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1_show); + +prog_char help_log_show[] = "Show configured logs"; +parse_pgm_inst_t cmd_log_show = { + .f = cmd_log_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_log_show, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_log_arg0, + (prog_void *)&cmd_log_arg1_show, + NULL, + }, +}; + +/* this structure is filled when cmd_log is parsed successfully */ +struct cmd_log_type_result { + fixed_string_t arg0; + fixed_string_t arg1; + fixed_string_t arg2; + fixed_string_t arg3; +}; + +/* function called when cmd_log is parsed successfully */ +static void cmd_log_type_parsed(void * parsed_result, void * data) +{ + struct cmd_log_type_result *res = (struct cmd_log_type_result *) parsed_result; + uint8_t lognum; + uint8_t i; + + lognum = log_name2num(res->arg2); + if (lognum == 0) { + printf_P(PSTR("Cannot find log num\r\n")); + return; + } + + if (!strcmp_P(res->arg3, PSTR("on"))) { + for (i=0; iarg3, PSTR("off"))) { + for (i=0; i> 8); + +348 cÚ¡ +ušt8_t + +DesütÜNumb” + = ( +wV®ue + & 0xFF); + +350 cÚ¡ * +Add»ss + = +NULL +; + +351 +ušt16_t + +Size + = +NO_DESCRIPTOR +; + +353  +DesütÜTy³ +) + +355  +DTYPE_Deviû +: + +356 +Add»ss + = & +DeviûDesütÜ +; + +357 +Size + = ( +USB_DesütÜ_Deviû_t +); + +359  +DTYPE_CÚfigu¿tiÚ +: + +360 +Add»ss + = & +CÚfigu¿tiÚDesütÜ +; + +361 +Size + = ( +USB_DesütÜ_CÚfigu¿tiÚ_t +); + +363  +DTYPE_SŒšg +: + +364  +DesütÜNumb” +) + +367 +Add»ss + = & +LªguageSŒšg +; + +368 +Size + = + `pgm_»ad_by‹ +(& +LªguageSŒšg +. +H—d” +.Size); + +371 +Add»ss + = & +Mªuçùu»rSŒšg +; + +372 +Size + = + `pgm_»ad_by‹ +(& +Mªuçùu»rSŒšg +. +H—d” +.Size); + +375 +Add»ss + = & +ProduùSŒšg +; + +376 +Size + = + `pgm_»ad_by‹ +(& +ProduùSŒšg +. +H—d” +.Size); + +383 * +DesütÜAdd»ss + = +Add»ss +; + +384  +Size +; + +385 + } +} + + @Descriptors.h + +36 #iâdeà +_DESCRIPTORS_H_ + + +37  + #_DESCRIPTORS_H_ + + + ) + +40  + ~ + +42  + ~ + +46  + #CDC1_TX_EPNUM + 1 + + ) + +49  + #CDC1_RX_EPNUM + 2 + + ) + +52  + #CDC1_NOTIFICATION_EPNUM + 3 + + ) + +55  + #CDC2_TX_EPNUM + 4 + + ) + +58  + #CDC2_RX_EPNUM + 5 + + ) + +61  + #CDC2_NOTIFICATION_EPNUM + 6 + + ) + +64  + #CDC_NOTIFICATION_EPSIZE + 8 + + ) + +67  + #CDC_TXRX_EPSIZE + 16 + + ) + +76 +USB_DesütÜ_CÚfigu¿tiÚ_H—d”_t + + mCÚfig +; + +79 +USB_DesütÜ_IÁ”çû_AssocŸtiÚ_t + + mCDC1_IAD +; + +80 +USB_DesütÜ_IÁ”çû_t + + mCDC1_CCI_IÁ”çû +; + +81 +USB_CDC_DesütÜ_FunùiÚ®H—d”_t + + mCDC1_FunùiÚ®_H—d” +; + +82 +USB_CDC_DesütÜ_FunùiÚ®ACM_t + + mCDC1_FunùiÚ®_ACM +; + +83 +USB_CDC_DesütÜ_FunùiÚ®UniÚ_t + + mCDC1_FunùiÚ®_UniÚ +; + +84 +USB_DesütÜ_Endpošt_t + + mCDC1_Mªagem’tEndpošt +; + +87 +USB_DesütÜ_IÁ”çû_t + + mCDC1_DCI_IÁ”çû +; + +88 +USB_DesütÜ_Endpošt_t + + mCDC1_D©aOutEndpošt +; + +89 +USB_DesütÜ_Endpošt_t + + mCDC1_D©aInEndpošt +; + +92 +USB_DesütÜ_IÁ”çû_AssocŸtiÚ_t + + mCDC2_IAD +; + +93 +USB_DesütÜ_IÁ”çû_t + + mCDC2_CCI_IÁ”çû +; + +94 +USB_CDC_DesütÜ_FunùiÚ®H—d”_t + + mCDC2_FunùiÚ®_H—d” +; + +95 +USB_CDC_DesütÜ_FunùiÚ®ACM_t + + mCDC2_FunùiÚ®_ACM +; + +96 +USB_CDC_DesütÜ_FunùiÚ®UniÚ_t + + mCDC2_FunùiÚ®_UniÚ +; + +97 +USB_DesütÜ_Endpošt_t + + mCDC2_Mªagem’tEndpošt +; + +100 +USB_DesütÜ_IÁ”çû_t + + mCDC2_DCI_IÁ”çû +; + +101 +USB_DesütÜ_Endpošt_t + + mCDC2_D©aOutEndpošt +; + +102 +USB_DesütÜ_Endpošt_t + + mCDC2_D©aInEndpošt +; + +103 } + tUSB_DesütÜ_CÚfigu¿tiÚ_t +; + +106 +ušt16_t + + $CALLBACK_USB_G‘DesütÜ +(cÚ¡ +ušt16_t + +wV®ue +, + +107 cÚ¡ +ušt8_t + +wIndex +, + +108 cÚ¡ ** cÚ¡ +DesütÜAdd»ss +) + +109 +ATTR_WARN_UNUSED_RESULT + + `ATTR_NON_NULL_PTR_ARG +(3); + + @DualVirtualSerial.c + +37  + ~"Du®Vœtu®S”Ÿl.h +" + +40  + ~ + +41  + ~ + +42  + ~ + +44  + ~ + +45  + ~<þock_time.h +> + +46  + ~<·r£.h +> + +47  + ~ + +48  + ~ + +50  + ~"xb“_ÃighbÜ.h +" + +51  + ~"xb“_©cmd.h +" + +52  + ~"xb“_¡©s.h +" + +53  + ~"xb“_buf.h +" + +54  + ~"xb“_´Ùo.h +" + +55  + ~"xb“.h +" + +57  + ~"maš.h +" + +58  + ~"cmdlše.h +" + +59  + ~"ÿÎout.h +" + +61 vÞ©ž +ušt16_t + + gglob®_ms +; + +62  +ÿÎout_mªag” + + gcm +; + +63  + gcmdlše_šput_’abËd + = 1; + +71 +USB_CÏssInfo_CDC_Deviû_t + + gVœtu®S”Ÿl1_CDC_IÁ”çû + = + +73 . +CÚfig + = + +75 . +CڌÞIÁ”çûNumb” + = 0, + +77 . + gD©aINEndpoštNumb” + = +CDC1_TX_EPNUM +, + +78 . + gD©aINEndpoštSize + = +CDC_TXRX_EPSIZE +, + +79 . + gD©aINEndpoštDoubËBªk + = +çl£ +, + +81 . + gD©aOUTEndpoštNumb” + = +CDC1_RX_EPNUM +, + +82 . + gD©aOUTEndpoštSize + = +CDC_TXRX_EPSIZE +, + +83 . + gD©aOUTEndpoštDoubËBªk + = +çl£ +, + +85 . + gNÙifiÿtiÚEndpoštNumb” + = +CDC1_NOTIFICATION_EPNUM +, + +86 . + gNÙifiÿtiÚEndpoštSize + = +CDC_NOTIFICATION_EPSIZE +, + +87 . + gNÙifiÿtiÚEndpoštDoubËBªk + = +çl£ +, + +96 +USB_CÏssInfo_CDC_Deviû_t + + gVœtu®S”Ÿl2_CDC_IÁ”çû + = + +98 . +CÚfig + = + +100 . +CڌÞIÁ”çûNumb” + = 2, + +102 . + gD©aINEndpoštNumb” + = +CDC2_TX_EPNUM +, + +103 . + gD©aINEndpoštSize + = +CDC_TXRX_EPSIZE +, + +104 . + gD©aINEndpoštDoubËBªk + = +çl£ +, + +106 . + gD©aOUTEndpoštNumb” + = +CDC2_RX_EPNUM +, + +107 . + gD©aOUTEndpoštSize + = +CDC_TXRX_EPSIZE +, + +108 . + gD©aOUTEndpoštDoubËBªk + = +çl£ +, + +110 . + gNÙifiÿtiÚEndpoštNumb” + = +CDC2_NOTIFICATION_EPNUM +, + +111 . + gNÙifiÿtiÚEndpoštSize + = +CDC_NOTIFICATION_EPSIZE +, + +112 . + gNÙifiÿtiÚEndpoštDoubËBªk + = +çl£ +, + +118  +ušt16_t + + $g‘_time_ms +() + +120  +glob®_ms +; + +121 + } +} + +123  + $do_Ëd_blšk +( +ÿÎout_mªag” + * +cm +, + +124  +ÿÎout + * +þt +, * +dummy +) + +126  +ušt8_t + +a + = 0; + +128 ià( +a + & 1) + +129 + `LEDs_S‘AÎLEDs +(0); + +131 + `LEDs_S‘AÎLEDs +(0xff); + +132 +a +++; + +133 + } +} + +135  + $šüem’t_ms +(* +dummy +) + +137 +glob®_ms +++; + +138 + } +} + +140  + $maš_tim”_š‹¼u± +() + +142  +ušt8_t + +ýt + = 0; + +143 +ýt +++; + +144 + `£i +(); + +145 ià(( +ýt + & 0x3) == 0) + +146 + `scheduËr_š‹¼u± +(); + +147 + } +} + +153  + $maš +() + +155  +ÿÎout + +t1 +; + +156 +FILE + * +xb“_fže +; + +157 +št8_t + +”r +; + +158  +xb“_dev + +dev +; + +160 + `S‘upH¬dw¬e +(); + +162 + `LEDs_S‘AÎLEDs +( +LEDMASK_USB_NOTREADY +); + +164 + `fdevݒ +( +usb£rŸl1_dev_£nd +, +usb£rŸl1_dev_»cv +); + +165 +xb“_fže + = + `fdevݒ +( +usb£rŸl2_dev_£nd +, +usb£rŸl2_dev_»cv +); + +166 + `scheduËr_š™ +(); + +167 + `tim”_š™ +(); + +168 + `tim”0_»gi¡”_OV_šŒ +( +maš_tim”_š‹¼u± +); + +169 + `£i +(); + +171 + `scheduËr_add_³riodiÿl_ev’t_´iܙy +( +šüem’t_ms +, +NULL +, + +172 1000L / +SCHEDULER_UNIT +, + +173 +LED_PRIO +); + +174 + `cmdlše_š™ +(); + +175 + `ÿÎout_mªag”_š™ +(& +cm +, +g‘_time_ms +); + +176 + `ÿÎout_»£t +(& +cm +, & +t1 +, 500, +PERIODICAL +, +do_Ëd_blšk +, +NULL +); + +179 +”r + = + `xb“_š™ +(); + +180 ià( +”r + < 0) + +183 +xb“_dev + = & +dev +; + +186 ià( + `xb“_ݒ +( +xb“_dev +, +xb“_fže +) < 0) + +190 ià( + `xb“_»gi¡”_chªÃl +( +xb“_dev +, +XBEE_DEFAULT_CHANNEL +, + +191 +xb“_rx +, +NULL +) < 0) { + +192 + `årštf +( +¡d”r +, "cannot„egister default channel\n"); + +196 + `£i +(); + +199 + `CheckJoy¡ickMovem’t +(); + +201 + `ÿÎout_mªage +(& +cm +); + +204 +št16_t + +c +; + +207 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +); + +208 ià( +c + >= 0) + +209 + `CDC_Deviû_S’dBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +, + +210 ( +ušt8_t +) +c +); + +213 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +214 ià( +c + >= 0) + +215 + `CDC_Deviû_S’dBy‹ +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +, + +216 ( +ušt8_t +) +c +); + +219 ià( +cmdlše_šput_’abËd +) + +220 + `cmdlše_pÞl +(); + +221 + `xb“_´Ùo_rx +( +xb“_dev +); + +224 + `CDC_Deviû_USBTask +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +225 + `CDC_Deviû_USBTask +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +); + +226 + `USB_USBTask +(); + +228 + } +} + +231  + $S‘upH¬dw¬e +() + +234 +MCUSR + &ð~(1 << +WDRF +); + +235 + `wdt_di§bË +(); + +238 + `þock_´esÿË_£t +( +þock_div_1 +); + +241 + `Joy¡ick_In™ +(); + +242 + `LEDs_In™ +(); + +243 + `USB_In™ +(); + +244 + } +} + +249  + $CheckJoy¡ickMovem’t +() + +251 +ušt8_t + +JoyStus_LCL + = + `Joy¡ick_G‘Stus +(); + +252 * +R•ÜtSŒšg + = +NULL +; + +253  +boÞ + +AùiÚS’t + = +çl£ +; + +255 ià( +JoyStus_LCL + & +JOY_UP +) + +256 +R•ÜtSŒšg + = "Joystick Up\r\n"; + +257 ià( +JoyStus_LCL + & +JOY_DOWN +) + +258 +R•ÜtSŒšg + = "Joystick Down\r\n"; + +259 ià( +JoyStus_LCL + & +JOY_LEFT +) + +260 +R•ÜtSŒšg + = "Joystick Left\r\n"; + +261 ià( +JoyStus_LCL + & +JOY_RIGHT +) + +262 +R•ÜtSŒšg + = "Joystick Right\r\n"; + +263 ià( +JoyStus_LCL + & +JOY_PRESS +) + +264 +R•ÜtSŒšg + = "Joystick Pressed\r\n"; + +266 +AùiÚS’t + = +çl£ +; + +268 ià(( +R•ÜtSŒšg + !ð +NULL +è&& ( +AùiÚS’t + =ð +çl£ +)) + +270 +AùiÚS’t + = +Œue +; + +272 + `CDC_Deviû_S’dSŒšg +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +, +R•ÜtSŒšg +); + +274 + } +} + +277  + $EVENT_USB_Deviû_CÚÃù +() + +279 + `LEDs_S‘AÎLEDs +( +LEDMASK_USB_ENUMERATING +); + +280 + } +} + +283  + $EVENT_USB_Deviû_DiscÚÃù +() + +285 + `LEDs_S‘AÎLEDs +( +LEDMASK_USB_NOTREADY +); + +286 + } +} + +289  + $EVENT_USB_Deviû_CÚfigu¿tiÚChªged +() + +291 +boÞ + +CÚfigSucûss + = +Œue +; + +293 +CÚfigSucûss + &ð + `CDC_Deviû_CÚfigu»Endpošts +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +294 +CÚfigSucûss + &ð + `CDC_Deviû_CÚfigu»Endpošts +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +); + +296 + `LEDs_S‘AÎLEDs +( +CÚfigSucûss + ? +LEDMASK_USB_READY + : +LEDMASK_USB_ERROR +); + +298 + `rdlše_Ãwlše +(& +xb“bßrd +. +rdl +, xb“bßrd. +´om± +); + +299 + } +} + +302  + $EVENT_USB_Deviû_CڌÞReque¡ +() + +304 + `CDC_Deviû_ProûssCڌÞReque¡ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +305 + `CDC_Deviû_ProûssCڌÞReque¡ +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +); + +306 + } +} + + @DualVirtualSerial.h + +36 #iâdeà +_DUAL_VIRTUALSERIAL_H_ + + +37  + #_DUAL_VIRTUALSERIAL_H_ + + + ) + +40  + ~ + +41  + ~ + +42  + ~ + +43  + ~ + +44  + ~<¡ršg.h +> + +46  + ~"DesütÜs.h +" + +48  + ~ + +49  + ~ + +50  + ~ + +51  + ~ + +55  + #LEDMASK_USB_NOTREADY + +LEDS_LED1 + + + ) + +58  + #LEDMASK_USB_ENUMERATING + ( +LEDS_LED2 + | +LEDS_LED3 +) + + ) + +61  + #LEDMASK_USB_READY + ( +LEDS_LED2 + | +LEDS_LED4 +) + + ) + +64  + #LEDMASK_USB_ERROR + ( +LEDS_LED1 + | +LEDS_LED3 +) + + ) + +67  +S‘upH¬dw¬e +(); + +68  +CheckJoy¡ickMovem’t +(); + +70  +EVENT_USB_Deviû_CÚÃù +(); + +71  +EVENT_USB_Deviû_DiscÚÃù +(); + +72  +EVENT_USB_Deviû_CÚfigu¿tiÚChªged +(); + +73  +EVENT_USB_Deviû_CڌÞReque¡ +(); + +75 +USB_CÏssInfo_CDC_Deviû_t + +Vœtu®S”Ÿl1_CDC_IÁ”çû +; + +76 +USB_CÏssInfo_CDC_Deviû_t + +Vœtu®S”Ÿl2_CDC_IÁ”çû +; + + @autoconf.h + +4  + #AUTOCONF_INCLUDED + + + ) + +9 #undeà +CONFIG_MCU_AT90S2313 + + +10 #undeà +CONFIG_MCU_AT90S2323 + + +11 #undeà +CONFIG_MCU_AT90S3333 + + +12 #undeà +CONFIG_MCU_AT90S2343 + + +13 #undeà +CONFIG_MCU_ATTINY22 + + +14 #undeà +CONFIG_MCU_ATTINY26 + + +15 #undeà +CONFIG_MCU_AT90S4414 + + +16 #undeà +CONFIG_MCU_AT90S4433 + + +17 #undeà +CONFIG_MCU_AT90S4434 + + +18 #undeà +CONFIG_MCU_AT90S8515 + + +19 #undeà +CONFIG_MCU_AT90S8534 + + +20 #undeà +CONFIG_MCU_AT90S8535 + + +21 #undeà +CONFIG_MCU_AT86RF401 + + +22 #undeà +CONFIG_MCU_ATMEGA103 + + +23 #undeà +CONFIG_MCU_ATMEGA603 + + +24 #undeà +CONFIG_MCU_AT43USB320 + + +25 #undeà +CONFIG_MCU_AT43USB355 + + +26 #undeà +CONFIG_MCU_AT76C711 + + +27 #undeà +CONFIG_MCU_ATMEGA8 + + +28 #undeà +CONFIG_MCU_ATMEGA48 + + +29 #undeà +CONFIG_MCU_ATMEGA88 + + +30 #undeà +CONFIG_MCU_ATMEGA8515 + + +31 #undeà +CONFIG_MCU_ATMEGA8535 + + +32 #undeà +CONFIG_MCU_ATTINY13 + + +33 #undeà +CONFIG_MCU_ATTINY2313 + + +34 #undeà +CONFIG_MCU_ATMEGA16 + + +35 #undeà +CONFIG_MCU_ATMEGA161 + + +36 #undeà +CONFIG_MCU_ATMEGA162 + + +37 #undeà +CONFIG_MCU_ATMEGA163 + + +38 #undeà +CONFIG_MCU_ATMEGA165 + + +39 #undeà +CONFIG_MCU_ATMEGA168 + + +40 #undeà +CONFIG_MCU_ATMEGA169 + + +41 #undeà +CONFIG_MCU_ATMEGA32 + + +42 #undeà +CONFIG_MCU_ATMEGA323 + + +43 #undeà +CONFIG_MCU_ATMEGA325 + + +44 #undeà +CONFIG_MCU_ATMEGA3250 + + +45 #undeà +CONFIG_MCU_ATMEGA64 + + +46 #undeà +CONFIG_MCU_ATMEGA645 + + +47 #undeà +CONFIG_MCU_ATMEGA6450 + + +48 #undeà +CONFIG_MCU_ATMEGA128 + + +49 #undeà +CONFIG_MCU_ATMEGA1281 + + +50 #undeà +CONFIG_MCU_AT90CAN128 + + +51 #undeà +CONFIG_MCU_AT94K + + +52 #undeà +CONFIG_MCU_AT90S1200 + + +53 #undeà +CONFIG_MCU_ATMEGA2560 + + +54 #undeà +CONFIG_MCU_ATMEGA256 + + +55  + #CONFIG_MCU_ATMEGAUSB1287 + + + ) + +56  + #CONFIG_QUARTZ + (16000000) + + ) + +61 #undeà +CONFIG_OPTM_0 + + +62 #undeà +CONFIG_OPTM_1 + + +63 #undeà +CONFIG_OPTM_2 + + +64 #undeà +CONFIG_OPTM_3 + + +65  + #CONFIG_OPTM_S + 1 + + ) + +66  + #CONFIG_MATH_LIB + 1 + + ) + +67 #undeà +CONFIG_FDEVOPEN_COMPAT + + +68 #undeà +CONFIG_NO_PRINTF + + +69 #undeà +CONFIG_MINIMAL_PRINTF + + +70 #undeà +CONFIG_STANDARD_PRINTF + + +71  + #CONFIG_ADVANCED_PRINTF + 1 + + ) + +72 #undeà +CONFIG_FORMAT_IHEX + + +73 #undeà +CONFIG_FORMAT_SREC + + +74  + #CONFIG_FORMAT_BINARY + 1 + + ) + +79  + #CONFIG_MODULE_CIRBUF + 1 + + ) + +80 #undeà +CONFIG_MODULE_CIRBUF_LARGE + + +81 #undeà +CONFIG_MODULE_FIXED_POINT + + +82 #undeà +CONFIG_MODULE_VECT2 + + +83 #undeà +CONFIG_MODULE_GEOMETRY + + +84 #undeà +CONFIG_MODULE_HOSTSIM + + +85  + #CONFIG_MODULE_SCHEDULER + 1 + + ) + +86  + #CONFIG_MODULE_SCHEDULER_STATS + 1 + + ) + +87  + #CONFIG_MODULE_SCHEDULER_CREATE_CONFIG + 1 + + ) + +88 #undeà +CONFIG_MODULE_SCHEDULER_USE_TIMERS + + +89 #undeà +CONFIG_MODULE_SCHEDULER_TIMER0 + + +90  + #CONFIG_MODULE_SCHEDULER_MANUAL + 1 + + ) + +91  + #CONFIG_MODULE_TIME + 1 + + ) + +92  + #CONFIG_MODULE_TIME_CREATE_CONFIG + 1 + + ) + +93 #undeà +CONFIG_MODULE_TIME_EXT + + +94 #undeà +CONFIG_MODULE_TIME_EXT_CREATE_CONFIG + + +99  + #CONFIG_MODULE_UART + 1 + + ) + +100 #undeà +CONFIG_MODULE_UART_9BITS + + +101  + #CONFIG_MODULE_UART_CREATE_CONFIG + 1 + + ) + +102  + #CONFIG_MODULE_SPI + 1 + + ) + +103  + #CONFIG_MODULE_SPI_CREATE_CONFIG + 1 + + ) + +104  + #CONFIG_MODULE_I2C + 1 + + ) + +105  + #CONFIG_MODULE_I2C_MASTER + 1 + + ) + +106 #undeà +CONFIG_MODULE_I2C_MULTIMASTER + + +107  + #CONFIG_MODULE_I2C_CREATE_CONFIG + 1 + + ) + +108 #undeà +CONFIG_MODULE_MF2_CLIENT + + +109 #undeà +CONFIG_MODULE_MF2_CLIENT_USE_SCHEDULER + + +110 #undeà +CONFIG_MODULE_MF2_CLIENT_CREATE_CONFIG + + +111 #undeà +CONFIG_MODULE_MF2_SERVER + + +112 #undeà +CONFIG_MODULE_MF2_SERVER_CREATE_CONFIG + + +117  + #CONFIG_MODULE_TIMER + 1 + + ) + +118 #undeà +CONFIG_MODULE_TIMER_CREATE_CONFIG + + +119 #undeà +CONFIG_MODULE_TIMER_DYNAMIC + + +120 #undeà +CONFIG_MODULE_PWM + + +121 #undeà +CONFIG_MODULE_PWM_CREATE_CONFIG + + +122 #undeà +CONFIG_MODULE_PWM_NG + + +123 #undeà +CONFIG_MODULE_ADC + + +124 #undeà +CONFIG_MODULE_ADC_CREATE_CONFIG + + +129 #undeà +CONFIG_MODULE_MENU + + +130  + #CONFIG_MODULE_VT100 + 1 + + ) + +131  + #CONFIG_MODULE_RDLINE + 1 + + ) + +132  + #CONFIG_MODULE_RDLINE_CREATE_CONFIG + 1 + + ) + +133  + #CONFIG_MODULE_RDLINE_KILL_BUF + 1 + + ) + +134  + #CONFIG_MODULE_RDLINE_HISTORY + 1 + + ) + +135  + #CONFIG_MODULE_PARSE + 1 + + ) + +136 #undeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +141 #undeà +CONFIG_MODULE_LCD + + +142 #undeà +CONFIG_MODULE_LCD_CREATE_CONFIG + + +143 #undeà +CONFIG_MODULE_MULTISERVO + + +144 #undeà +CONFIG_MODULE_MULTISERVO_CREATE_CONFIG + + +145 #undeà +CONFIG_MODULE_AX12 + + +146 #undeà +CONFIG_MODULE_AX12_CREATE_CONFIG + + +151 #undeà +CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL + + +152 #undeà +CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_CREATE_CONFIG + + +153 #undeà +CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE + + +154 #undeà +CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG + + +159 #undeà +CONFIG_MODULE_ENCODERS_MICROB + + +160 #undeà +CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG + + +161 #undeà +CONFIG_MODULE_ENCODERS_EIRBOT + + +162 #undeà +CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG + + +163 #undeà +CONFIG_MODULE_ENCODERS_SPI + + +164 #undeà +CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG + + +169 #undeà +CONFIG_MODULE_ROBOT_SYSTEM + + +170 #undeà +CONFIG_MODULE_ROBOT_SYSTEM_USE_F64 + + +171 #undeà +CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT + + +172 #undeà +CONFIG_MODULE_POSITION_MANAGER + + +173 #undeà +CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE + + +174 #undeà +CONFIG_MODULE_TRAJECTORY_MANAGER + + +175 #undeà +CONFIG_MODULE_BLOCKING_DETECTION_MANAGER + + +176 #undeà +CONFIG_MODULE_OBSTACLE_AVOIDANCE + + +177 #undeà +CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG + + +182 #undeà +CONFIG_MODULE_CONTROL_SYSTEM_MANAGER + + +183 #undeà +CONFIG_MODULE_PID + + +184 #undeà +CONFIG_MODULE_PID_CREATE_CONFIG + + +185 #undeà +CONFIG_MODULE_RAMP + + +186 #undeà +CONFIG_MODULE_QUADRAMP + + +187 #undeà +CONFIG_MODULE_QUADRAMP_DERIVATE + + +188 #undeà +CONFIG_MODULE_BIQUAD + + +193 #undeà +CONFIG_MODULE_CC2420 + + +194 #undeà +CONFIG_MODULE_CC2420_CREATE_CONFIG + + +199 #undeà +CONFIG_MODULE_AES + + +200 #undeà +CONFIG_MODULE_AES_CTR + + +201 #undeà +CONFIG_MODULE_MD5 + + +202 #undeà +CONFIG_MODULE_MD5_HMAC + + +203 #undeà +CONFIG_MODULE_RC4 + + +208 #undeà +CONFIG_MODULE_BASE64 + + +209 #undeà +CONFIG_MODULE_HAMMING + + +214  + #CONFIG_MODULE_DIAGNOSTIC + 1 + + ) + +215  + #CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG + 1 + + ) + +216  + #CONFIG_MODULE_ERROR + 1 + + ) + +217  + #CONFIG_MODULE_ERROR_CREATE_CONFIG + 1 + + ) + +222 #undeà +CONFIG_AVRDUDE + + +223  + #CONFIG_AVARICE + 1 + + ) + +228 #undeà +CONFIG_AVRDUDE_PROG_FUTURELEC + + +229 #undeà +CONFIG_AVRDUDE_PROG_ABCMINI + + +230 #undeà +CONFIG_AVRDUDE_PROG_PICOWEB + + +231 #undeà +CONFIG_AVRDUDE_PROG_SP12 + + +232 #undeà +CONFIG_AVRDUDE_PROG_ALF + + +233 #undeà +CONFIG_AVRDUDE_PROG_BASCOM + + +234 #undeà +CONFIG_AVRDUDE_PROG_DT006 + + +235 #undeà +CONFIG_AVRDUDE_PROG_PONY_STK200 + + +236  + #CONFIG_AVRDUDE_PROG_STK200 + 1 + + ) + +237 #undeà +CONFIG_AVRDUDE_PROG_PAVR + + +238 #undeà +CONFIG_AVRDUDE_PROG_BUTTERFLY + + +239 #undeà +CONFIG_AVRDUDE_PROG_AVR910 + + +240 #undeà +CONFIG_AVRDUDE_PROG_STK500 + + +241 #undeà +CONFIG_AVRDUDE_PROG_AVRISP + + +242 #undeà +CONFIG_AVRDUDE_PROG_BSD + + +243 #undeà +CONFIG_AVRDUDE_PROG_DAPA + + +244 #undeà +CONFIG_AVRDUDE_PROG_JTAG1 + + +245 #undeà +CONFIG_AVRDUDE_PROG_AVR109 + + +246  + #CONFIG_AVRDUDE_PORT + "/dev/·½Üt0" + + ) + +247  + #CONFIG_AVRDUDE_BAUDRATE + (19200) + + ) + +252  + #CONFIG_AVARICE_PORT + "/dev/‰yUSB0" + + ) + +253  + #CONFIG_AVARICE_DEBUG_PORT + (1234) + + ) + +254  + #CONFIG_AVARICE_PROG_MKI + 1 + + ) + +255 #undeà +CONFIG_AVARICE_PROG_MKII + + +256  + #CONFIG_AVRDUDE_CHECK_SIGNATURE + 1 + + ) + + @aversive.h + +28 #iâdeà +_AVERSIVE_H_ + + +29  + #_AVERSIVE_H_ + + + ) + +31  + ~ + +33 #iâdeà +HOST_VERSION + + +34  + ~ + +35  + ~ + +38  + ~ + +39  + ~ + +40  + ~ + +43 #iâdeà +__AVR_LIBC_VERSION__ + + +44  + #__AVR_LIBC_VERSION__ + 0UL + + ) + +47 #iâdeà +HOST_VERSION + + +48 #ià +__AVR_LIBC_VERSION__ + < 10403UL + +49  + ~ + +55  + #Hz + 1l + + ) + +56  + #KHz + 1000l + + ) + +57  + #MHz + 1000000l + + ) + +68  + #S_MAX +( +to_§tu¿‹ +, +v®ue_max +) \ + +70 ià( +to_§tu¿‹ + > +v®ue_max +) \ + +71 +to_§tu¿‹ + = +v®ue_max +; \ + +72 ià( +to_§tu¿‹ + < - +v®ue_max +) \ + +73 +to_§tu¿‹ + = - +v®ue_max +; \ + +74 } 0) + + ) + +79  + #U_MAX +( +to_§tu¿‹ +, +v®ue_max +) \ + +81 ià( +to_§tu¿‹ + > +v®ue_max +) \ + +82 +to_§tu¿‹ + = +v®ue_max +; \ + +83 ià( +to_§tu¿‹ + < 0) \ + +84 +to_§tu¿‹ + = 0; \ + +85 } 0) + + ) + +97  + #ABS +( +v® +) ({ \ + +98 + `__ty³of +( +v® +è +__v® + = (val); \ + +99 ià( +__v® + < 0) \ + +100 +__v® + = - __val; \ + +101 +__v® +; \ + +102 }) + + ) + +108 #ià +__BYTE_ORDER + !ð +__LITTLE_ENDIAN + && __BYTE_ORDER !ð +__BIG_ENDIAN + + +112  + sexŒaù32 + { + +115 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +116 +ušt8_t + + mu8_0 +; + +117 +ušt8_t + + mu8_1 +; + +118 +ušt8_t + + mu8_2 +; + +119 +ušt8_t + + mu8_3 +; + +120 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +121 +ušt8_t + + mu8_3 +; + +122 +ušt8_t + + mu8_2 +; + +123 +ušt8_t + + mu8_1 +; + +124 +ušt8_t + + mu8_0 +; + +126 } +__©Œibu‹__ + (( +·cked +)è + mu8 +; + +128 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +129 +ušt16_t + + mu16_0 +; + +130 +ušt16_t + + mu16_1 +; + +131 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +132 +ušt16_t + + mu16_1 +; + +133 +ušt16_t + + mu16_0 +; + +135 } +__©Œibu‹__ + (( +·cked +)è + mu16 +; + +137 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +138 +ušt8_t + + mu8_0 +; + +139 +ušt16_t + + mu16_mid +; + +140 +ušt8_t + + mu8_3 +; + +141 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +142 +ušt8_t + + mu8_3 +; + +143 +ušt16_t + + mu16_mid +; + +144 +ušt8_t + + mu8_0 +; + +146 } +__©Œibu‹__ + (( +·cked +)è + mu16_b +; + +147 +ušt32_t + + mu32 +; + +148 } +__©Œibu‹__ + (( +·cked +)è + mu +; + +149 } +__©Œibu‹__ + (( +·cked +)); + +151  + #exŒ32_08_0 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u8 +. +u8_0 +; }) + + ) + +152  + #exŒ32_08_1 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u8 +. +u8_1 +; }) + + ) + +153  + #exŒ32_08_2 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u8 +. +u8_2 +; }) + + ) + +154  + #exŒ32_08_3 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u8 +. +u8_3 +; }) + + ) + +156  + #exŒ32_16_0 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u16 +. +u16_0 +; }) + + ) + +157  + #exŒ32_16_1 +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u16 +. +u16_1 +; }) + + ) + +158  + #exŒ32_16_mid +( +i +è({  +exŒaù32 + +__x +; __x. +u +. +u32 + = i; __x.u. +u16_b +. +u16_mid +; }) + + ) + +161  + sexŒaù16 + { + +164 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +165 +ušt8_t + + mu8_0 +; + +166 +ušt8_t + + mu8_1 +; + +167 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +168 +ušt8_t + + mu8_1 +; + +169 +ušt8_t + + mu8_0 +; + +171 } +__©Œibu‹__ + (( +·cked +)è + mu8 +; + +172 +ušt16_t + + mu16 +; + +173 } +__©Œibu‹__ + (( +·cked +)è + mu +; + +174 } +__©Œibu‹__ + (( +·cked +)); + +176  + #exŒ16_08_0 +( +i +è({  +exŒaù16 + +__x +; __x. +u +. +u16 + = i; __x.u. +u8 +. +u8_0 +; }) + + ) + +177  + #exŒ16_08_1 +( +i +è({  +exŒaù16 + +__x +; __x. +u +. +u16 + = i; __x.u. +u8 +. +u8_1 +; }) + + ) + +183 #iâdeà +HOST_VERSION + + +184 #iâdeà +nÝ + + +185  + #nÝ +(è +__asm__ + + `__vÞ©že__ + ("NOP\n"è + + ) + +187 #iâdeà +nÙhšg + + +188  + #nÙhšg +(è +__asm__ + + `__vÞ©že__ + (" \n"è + + ) + +190 #iâdeà +þi + + +191  + #þi +(è +__asm__ + + `__vÞ©že__ + ("CLI\n"è + + ) + +193 #iâdeà +£i + + +194  + #£i +(è +__asm__ + + `__vÞ©že__ + ("SEI\n"è + + ) + +197 #iâdeà +»£t + + +198  + #»£t +() \ + +200 +__asm__ + + `__vÞ©že__ + ("ldi„30,0\n"); \ + +201 +__asm__ + + `__vÞ©že__ + ("ldi„31,0\n"); \ + +202 +__asm__ + + `__vÞ©že__ + ("ijmp\n"); \ + +203 } 0) + + ) + +207  + #nÝ +(èdØ{} 0) + + ) + +208  + #nÙhšg +(èdØ{} 0) + + ) + +209  + #þi +(èdØ{} 0) + + ) + +210  + #£i +(èdØ{} 0) + + ) + +211  + #»£t +(è + `ex™ +(1) + + ) + +221  + #BIT_TOGGLE +( +pÜt +, +b™ +) do {\ + +222 if( + `b™_is_£t +( + `PIN +( +pÜt +), +b™ +)) \ + +223 + `cbi +( +pÜt +, +b™ +); \ + +225 + `sbi +( +pÜt +, +b™ +); \ + +226 } 0) + + ) + +233  + #DDR +( +pÜt +è(*(&ÕÜtè-1)) + + ) + +234  + #PIN +( +pÜt +è(*(&ÕÜtè-2)) + + ) + +237  + #OPEN_CO_INIT +( +pÜt +, +b™ +è + `sbi +ÕÜt,b™) + + ) + +238  + #OPEN_CO_HIGH +( +pÜt +, +b™ +è + `cbi +( + `DDR +ÕÜt),b™) + + ) + +239  + #OPEN_CO_LOW +( +pÜt +, +b™ +è + `cbi +( + `DDR +ÕÜt),b™) + + ) + +242 #iâdeà +cbi + + +243  + #cbi +( +sä +, +b™ +èÐsä &ð~ + `_BV +(b™)) + + ) + +245 #iâdeà +sbi + + +246  + #sbi +( +sä +, +b™ +èÐsä |ð + `_BV +(b™)) + + ) + + @callout.c + +35  + ~<¡ršg.h +> + +36  + ~<¡dio.h +> + +37  + ~<¡dšt.h +> + +38  + ~ + +39  + ~<š‰y³s.h +> + +41  + ~"ÿÎout.h +" + +43 #ifdeà +CALLOUT_STATS + + +44  + #__TIMER_STAT_ADD +( +cm +, +f›ld +, +x +ècm-> +¡©s +.f›ld +ð + ) +x + +46  + #__TIMER_STAT_ADD +( +cm +, +f›ld +, +x +èdØ{ } 0) + + ) + +49 #ifdeà +CALLOUT_DEBUG + + +50  + #ÿÎout_d´štf +( +fmt +, ...è + `´štf +("%s(): " fmt, +__FUNCTION__ +, \ + +51 +__VA_ARGS__ +) + + ) + +53  + #ÿÎout_d´štf +(...èdØ{ } 0) + + ) + +58 + $ÿÎout_mªag”_š™ +( +ÿÎout_mªag” + * +cm +, +g‘_time_t + * +g‘_time +) + +60 ià( +g‘_time + =ð +NULL +) + +62 + `mem£t +( +cm +, 0, (*cm)); + +63 +cm +-> +g‘_time + = get_time; + +64 + `TAILQ_INIT +(& +cm +-> +³ndšg_li¡ +); + +66 + } +} + +70 + $ÿÎout_š™ +( +ÿÎout + * +tim +) + +72 + `mem£t +( +tim +, 0, (*tim)); + +73 + } +} + +79 + $ÿÎout_add +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +) + +81  +ÿÎout + * +t +; + +83 + `ÿÎout_d´štf +("cm=%°tim=%p\n", +cm +, +tim +); + +86 ià( + `TAILQ_EMPTY +(& +cm +-> +³ndšg_li¡ +)) { + +87 + `TAILQ_INSERT_HEAD +(& +cm +-> +³ndšg_li¡ +, +tim +, +Ãxt +); + +92 +t + = + `TAILQ_FIRST +(& +cm +-> +³ndšg_li¡ +); + +93 ià(( +št16_t +)( +tim +-> +expœe + - +t +->expire) < 0) { + +94 + `TAILQ_INSERT_HEAD +(& +cm +-> +³ndšg_li¡ +, +tim +, +Ãxt +); + +99 + `TAILQ_FOREACH +( +t +, & +cm +-> +³ndšg_li¡ +, +Ãxt +) { + +100 ià(( +št16_t +)( +tim +-> +expœe + - +t +->expire) < 0) { + +101 + `TAILQ_INSERT_BEFORE +( +t +, +tim +, +Ãxt +); + +107 + `TAILQ_INSERT_TAIL +(& +cm +-> +³ndšg_li¡ +, +tim +, +Ãxt +); + +108 + } +} + +114 + $ÿÎout_d– +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +) + +116 + `ÿÎout_d´štf +("cm=%°tim=%p\n", +cm +, +tim +); + +117 + `TAILQ_REMOVE +(& +cm +-> +³ndšg_li¡ +, +tim +, +Ãxt +); + +118 + } +} + +122 + $__ÿÎout_»£t +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, +ušt16_t + +expœe +, + +123 +ušt16_t + +³riod +, +ÿÎout_cb_t + +fù +, * +¬g +) + +125 + `ÿÎout_d´štf +("cm=%pim=%pƒxpire=%d…eriod=%d\n", + +126 +cm +, +tim +, +expœe +, +³riod +); + +128 + `__TIMER_STAT_ADD +( +cm +, +»£t +, 1); + +129 +cm +-> +upd©ed + = 1; + +132 ià( +tim +-> +scheduËd + =ð1 &&im-> +rušg + == 0) { + +133 + `ÿÎout_d– +( +cm +, +tim +); + +134 + `__TIMER_STAT_ADD +( +cm +, +³ndšg +, -1); + +137 +tim +-> +³riod + =…eriod; + +138 +tim +-> +expœe + =ƒxpire; + +139 +tim +-> +f + = +fù +; + +140 +tim +-> +¬g + =‡rg; + +141 +tim +-> +scheduËd + = 1; + +142 +tim +-> +rušg + = 0; + +144 + `__TIMER_STAT_ADD +( +cm +, +³ndšg +, 1); + +145 + `ÿÎout_add +( +cm +, +tim +); + +148 + } +} + +152 + $ÿÎout_»£t +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, +ušt16_t + +ticks +, + +153 +ÿÎout_ty³ + +ty³ +, +ÿÎout_cb_t + +fù +, * +¬g +) + +155 +ušt16_t + +cur_time + = +cm +-> + `g‘_time +(); + +156  + `__ÿÎout_»£t +( +cm +, +tim +, +ticks + + +cur_time +, + +157 +ty³ + =ð +PERIODICAL + ? +ticks + : 0, +fù +, +¬g +); + +158 + } +} + +162 + $ÿÎout_¡Ý +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +) + +164 + `ÿÎout_d´štf +("cm=%°tim=%p\n", +cm +, +tim +); + +166 + `__TIMER_STAT_ADD +( +cm +, +¡Ý +, 1); + +167 +cm +-> +upd©ed + = 1; + +170 ià( +tim +-> +scheduËd + =ð1 &&im-> +rušg + == 0) { + +171 + `ÿÎout_d– +( +cm +, +tim +); + +172 + `__TIMER_STAT_ADD +( +cm +, +³ndšg +, -1); + +174 + } +} + +178 + $ÿÎout_³ndšg +( +ÿÎout + * +tim +) + +180  +tim +-> +scheduËd + == 1; + +181 + } +} + +184  + $ÿÎout_mªage +( +ÿÎout_mªag” + * +cm +) + +186  +ÿÎout_li¡ + +expœed_li¡ +; + +187  +ÿÎout + * +tim +; + +188 +ušt16_t + +cur_time + = +cm +-> + `g‘_time +(); + +190 + `ÿÎout_d´štf +("cm=%p\n", +cm +); + +192 + `TAILQ_INIT +(& +expœed_li¡ +); + +193 + `__TIMER_STAT_ADD +( +cm +, +mªage +, 1); + +196 ! + `TAILQ_EMPTY +(& +cm +-> +³ndšg_li¡ +)) { + +197 +tim + = + `TAILQ_FIRST +(& +cm +-> +³ndšg_li¡ +); + +199 ià(( +št16_t +)( +cur_time + - +tim +-> +expœe +) < 0) + +202 + `TAILQ_REMOVE +(& +cm +-> +³ndšg_li¡ +, +tim +, +Ãxt +); + +203 + `TAILQ_INSERT_TAIL +(& +expœed_li¡ +, +tim +, +Ãxt +); + +207 ! + `TAILQ_EMPTY +(& +expœed_li¡ +)) { + +208 +tim + = + `TAILQ_FIRST +(& +expœed_li¡ +); + +209 + `TAILQ_REMOVE +(& +expœed_li¡ +, +tim +, +Ãxt +); + +211 +cm +-> +upd©ed + = 0; + +214 + `__TIMER_STAT_ADD +( +cm +, +³ndšg +, -1); + +215 + `__TIMER_STAT_ADD +( +cm +, +rušg +, 1); + +216 +tim +-> +rušg + = 1; + +217 +tim +-> + `f +( +cm +,im,im-> +¬g +); + +218 + `__TIMER_STAT_ADD +( +cm +, +rušg +, -1); + +222 ià( +cm +-> +upd©ed + == 1) + +225 +tim +-> +rušg + = 0; + +226 +tim +-> +scheduËd + = 0; + +229 ià( +tim +-> +³riod + != 0) { + +230 + `__ÿÎout_»£t +( +cm +, +tim +, +cur_time + +im-> +³riod +, + +231 +tim +-> +³riod +,im-> +f +,im-> +¬g +); + +234 + } +} + +237  + $ÿÎout_dump_¡©s +( +ÿÎout_mªag” + * +cm +) + +239 #ifdeà +CALLOUT_STATS + + +240 + `´štf +("Timer statistics:\n"); + +241 + `´štf +("„e£ˆð%d\n", +cm +-> +¡©s +. +»£t +); + +242 + `´štf +(" stÝ = %d\n", +cm +-> +¡©s +. +¡Ý +); + +243 + `´štf +(" mªagð%d\n", +cm +-> +¡©s +. +mªage +); + +244 + `´štf +("…’dšg = %d\n", +cm +-> +¡©s +. +³ndšg +); + +245 + `´štf +("„ušg = %d\n", +cm +-> +¡©s +. +rušg +); + +247 + `´štf +("Noimer statistics, CALLOUT_STATS is disabled\n"); + +249 + } +} + +255  + ~ + +256  + ~ + +258  +ušt16_t + + $g‘_time +() + +260  +timev® + +tv +; + +262 + `g‘timeofday +(& +tv +, +NULL +); + +263  +tv +. +tv_£c +; + +264 + } +} + +266  +cb1 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +); + +267  +cb2 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +); + +268  +cb3 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +); + +270  + $cb1 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +) + +272  +út +; + +273 +¬g + =‡rg; + +275 + `´štf +("cb1\n"); + +276 + `ÿÎout_dump_¡©s +( +cm +); + +277 ià(++ +út + >= 4) + +278 + `ÿÎout_¡Ý +( +cm +, +tim +); + +279 + } +} + +281  + $cb2 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +) + +283  +út +; + +284  +ÿÎout + * +t3 + = +¬g +; + +286 + `´štf +("cb2\n"); + +287 ià(++ +út + < 3) + +288 + `ÿÎout_»£t +( +cm +, +tim +, 5, +SINGLE +, +cb2 +, +¬g +); + +290 + `ÿÎout_»£t +( +cm +, +t3 +, 1, +SINGLE +, +cb3 +, +NULL +); + +291 + } +} + +293  + $cb3 +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, * +¬g +) + +295 +cm + = cm; + +296 +tim + =im; + +297 +¬g + =‡rg; + +299 + `´štf +("cb3\n"); + +300 + } +} + +302  + $maš +() + +304  +ÿÎout_mªag” + +cm +; + +305  +ÿÎout + +t1 +, +t2 +, +t3 +; + +306  +i +; + +308 ià( + `ÿÎout_mªag”_š™ +(& +cm +, +g‘_time +) < 0) + +311 + `ÿÎout_š™ +(& +t1 +); + +312 + `ÿÎout_š™ +(& +t2 +); + +313 + `ÿÎout_š™ +(& +t3 +); + +315 + `ÿÎout_»£t +(& +cm +, & +t1 +, 3, +PERIODICAL +, +cb1 +, +NULL +); + +316 + `ÿÎout_»£t +(& +cm +, & +t2 +, 5, +SINGLE +, +cb2 +, & +t3 +); + +318  +i + = 0; i < 18; i++) { + +319 + `ÿÎout_mªage +(& +cm +); + +320 + `¦“p +(1); + +323 + `ÿÎout_dump_¡©s +(& +cm +); + +325 + } +} + + @callout.h + +35 #iâdeà +_CALLOUT_H_ + + +36  + #_CALLOUT_H_ + + + ) + +38  + #CALLOUT_STATS + + + ) + +57 #ifdeà +CALLOUT_STATS + + +61  + sÿÎout_debug_¡©s + { + +62 +ušt16_t + + m»£t +; + +63 +ušt16_t + + m¡Ý +; + +64 +ušt16_t + + mmªage +; + +65 +ušt16_t + + m³ndšg +; + +66 +ušt16_t + + mrušg +; + +68  +ÿÎout_debug_¡©s + callout_debug_stats; + +71  + gÿÎout +; + +72  + gÿÎout_mªag” +; + +77 ( + tÿÎout_cb_t +)( + tÿÎout_mªag” + *,  + tÿÎout + *, *); + +82  + sÿÎout + + +84 + `TAILQ_ENTRY +( +ÿÎout +è +Ãxt +; + +86 +ušt8_t + +³riodiÿl +: 1; + +87 +ušt8_t + +scheduËd +: 1; + +88 +ušt8_t + +rušg +: 1; + +89 +ušt8_t + +»£rved +: 5; + +91 +ušt16_t + +³riod +; + +92 +ušt16_t + +expœe +; + +93 +ÿÎout_cb_t + * +f +; + +94 * +¬g +; + +100 + `TAILQ_HEAD +( +ÿÎout_li¡ +, +ÿÎout +); + +105  + #CALLOUT_INITIALIZER + { + } + + ) +} + +110  + $ušt16_t + ( + tg‘_time_t +)(); + +115  + sÿÎout_mªag” + { + +116 +g‘_time_t + * +g‘_time +; + +117 +ušt8_t + +upd©ed +: 1; + +118 +ušt8_t + +»£rved +: 7; + +119 +ušt16_t + +´ev_time +; + +120  +ÿÎout_li¡ + +³ndšg_li¡ +; + +121 #ifdeà +CALLOUT_STATS + + +123  +ÿÎout_debug_¡©s + +¡©s +; + +139 + `ÿÎout_mªag”_š™ +( +ÿÎout_mªag” + * +cm +, +g‘_time_t + * +g‘_time +); + +151  + `ÿÎout_š™ +( +ÿÎout + * +tim +); + +156 + eÿÎout_ty³ + { + +157 +SINGLE +, + +158 +PERIODICAL + + +203  + `ÿÎout_»£t +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +, + +204 +ušt16_t + +ticks +, +ÿÎout_ty³ + +ty³ +, + +205 +ÿÎout_cb_t + +fù +, * +¬g +); + +228  + `ÿÎout_¡Ý +( +ÿÎout_mªag” + * +cm +,  +ÿÎout + * +tim +); + +244  + `ÿÎout_³ndšg +( +ÿÎout + * +tim +); + +257  + `ÿÎout_mªage +( +ÿÎout_mªag” + * +cm +); + +262  + `ÿÎout_dump_¡©s +( +ÿÎout_mªag” + * +cm +); + + @cirbuf.c + +23  + ~<¡ršg.h +> + +25  + ~ + +29 + $cœbuf_š™ +( +cœbuf + * +cbuf +, * +buf +, +cœbuf_ušt + +¡¬t +, cœbuf_ušˆ +maxËn +) + +31 +cbuf +-> +maxËn + = maxlen; + +32 +cbuf +-> +Ën + = 0; + +33 +cbuf +-> +¡¬t + = start; + +34 +cbuf +-> +’d + = +¡¬t +; + +35 +cbuf +-> +buf + = buf; + +36 + } +} + + @cirbuf.h + +33 #iâdeà +_CIRBUF_H_ + + +34  + #_CIRBUF_H_ + + + ) + +36  + ~ + +37  + ~<¡dio.h +> + +39 #ifdeà +CONFIG_MODULE_CIRBUF_LARGE + + +40 sigÃd  + tcœbuf_št +; + +41  + tcœbuf_ušt +; + +43 sigÃd  + tcœbuf_št +; + +44  + tcœbuf_ušt +; + +50  + scœbuf + { + +51 +cœbuf_ušt + + mmaxËn +; + +52 vÞ©ž +cœbuf_ušt + + m¡¬t +; + +53 vÞ©ž +cœbuf_ušt + + m’d +; + +54 vÞ©ž +cœbuf_ušt + + mËn +; + +55 * + mbuf +; + +60 #ifdeà +CIRBUF_DEBUG + + +61  + #d´štf +( +fmt +, ...è + `´štf +("lš%3.3d - " fmt, +__LINE__ +, ## +__VA_ARGS__ +) + + ) + +63  + #d´štf +( +¬gs +...èdØ{} 0) + + ) + +70  +cœbuf_š™ +( +cœbuf + * +cbuf +, * +buf +, +cœbuf_ušt + +¡¬t +, cœbuf_ušˆ +maxËn +); + +76  + #CIRBUF_IS_FULL +( +cœbuf +è((cœbuf)-> +maxËn + =ð(cœbuf)-> +Ën +) + + ) + +81  + #CIRBUF_IS_EMPTY +( +cœbuf +è((cœbuf)-> +Ën + =ð0) + + ) + +86  + #CIRBUF_GET_LEN +( +cœbuf +è((cœbuf)-> +Ën +) + + ) + +91  + #CIRBUF_GET_MAXLEN +( +cœbuf +è((cœbuf)-> +maxËn +) + + ) + +96  + #CIRBUF_GET_FREELEN +( +cœbuf +è((cœbuf)-> +maxËn + - (cœbuf)-> +Ën +) + + ) + +104  + #CIRBUF_FOREACH +( +c +, +i +, +e +) \ + +105  +i +=0, +e +=( +c +)-> +buf +[(c)-> +¡¬t +] ; \ + +106 +i +<(( +c +)-> +Ën +) ; \ + +107 +i + ++, +e +=( +c +)-> +buf +[((c)-> +¡¬t ++i)%((c)-> +maxËn +)]) + + ) + +114 +cœbuf_št + +cœbuf_add_h—d_§ã +( +cœbuf + * +cbuf +,  +c +); + +120  +cœbuf_add_h—d +( +cœbuf + * +cbuf +,  +c +); + +126 +cœbuf_št + +cœbuf_add_ž_§ã +( +cœbuf + * +cbuf +,  +c +); + +132  +cœbuf_add_ž +( +cœbuf + * +cbuf +,  +c +); + +138 +cœbuf_št + +cœbuf_d–_h—d_§ã +( +cœbuf + * +cbuf +); + +144  +cœbuf_d–_h—d +( +cœbuf + * +cbuf +); + +150 +cœbuf_št + +cœbuf_d–_ž_§ã +( +cœbuf + * +cbuf +); + +156  +cœbuf_d–_ž +( +cœbuf + * +cbuf +); + +162  +cœbuf_g‘_h—d +( +cœbuf + * +cbuf +); + +168  +cœbuf_g‘_ž +( +cœbuf + * +cbuf +); + +177 +cœbuf_št + +cœbuf_add_buf_h—d +( +cœbuf + * +cbuf +, cÚ¡ * +c +, +cœbuf_ušt + +n +); + +184 +cœbuf_št + +cœbuf_add_buf_ž +( +cœbuf + * +cbuf +, cÚ¡ * +c +, +cœbuf_ušt + +n +); + +190 +cœbuf_št + +cœbuf_d–_buf_h—d +( +cœbuf + * +cbuf +, +cœbuf_ušt + +size +); + +196 +cœbuf_št + +cœbuf_d–_buf_ž +( +cœbuf + * +cbuf +, +cœbuf_ušt + +size +); + +203 +cœbuf_št + +cœbuf_g‘_buf_h—d +( +cœbuf + * +cbuf +, * +c +, +cœbuf_ušt + +size +); + +210 +cœbuf_št + +cœbuf_g‘_buf_ž +( +cœbuf + * +cbuf +, * +c +, +cœbuf_ušt + +size +); + +216  +cœbuf_®ign_Ëá +( +cœbuf + * +cbuf +); + +221  +cœbuf_®ign_right +( +cœbuf + * +cbuf +); + + @cirbuf_add_buf_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30 +cœbuf_št + + +31 + $cœbuf_add_buf_h—d +( +cœbuf + * +cbuf +, cÚ¡ * +c +, +cœbuf_ušt + +n +) + +33 +cœbuf_ušt + +e +; + +35 ià(! +n + ||‚ > + `CIRBUF_GET_FREELEN +( +cbuf +)) + +36  - +EINVAL +; + +38 +e + = + `CIRBUF_IS_EMPTY +( +cbuf +) ? 1 : 0; + +40 ià( +n + < +cbuf +-> +¡¬t + + +e +) { + +41 + `d´štf +("s[%d] -> d[%d] (%d)\n", 0, +cbuf +-> +¡¬t + - +n + + +e +,‚); + +42 + `memýy +( +cbuf +-> +buf + + cbuf-> +¡¬t + - +n + + +e +, +c +,‚); + +45 + `d´štf +("s[%d] -> d[%d] (%d)\n", + +n + - ( +cbuf +-> +¡¬t + + +e +), 0, cbuf->start +ƒ); + +46 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +maxËn + - +n + + (cbuf-> +¡¬t + + +e +), 0,‚ - (cbuf->start +ƒ)); + +47 + `memýy +( +cbuf +-> +buf +, +c + + +n + - (cbuf-> +¡¬t + + +e +) , cbuf->start +ƒ); + +48 + `memýy +( +cbuf +-> +buf + + cbuf-> +maxËn + - +n + + (cbuf-> +¡¬t + + +e +), +c +,‚ - (cbuf->start +ƒ)); + +50 +cbuf +-> +Ën + +ð +n +; + +51 +cbuf +-> +¡¬t + +ð(cbuf-> +maxËn + - +n + + +e +); + +52 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +53  +n +; + +54 + } +} + + @cirbuf_add_buf_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30 +cœbuf_št + + +31 + $cœbuf_add_buf_ž +( +cœbuf + * +cbuf +, cÚ¡ * +c +, +cœbuf_ušt + +n +) + +33 +cœbuf_ušt + +e +; + +35 ià(! +n + ||‚ > + `CIRBUF_GET_FREELEN +( +cbuf +)) + +36  - +EINVAL +; + +38 +e + = + `CIRBUF_IS_EMPTY +( +cbuf +) ? 1 : 0; + +40 ià( +n + < +cbuf +-> +maxËn + - cbuf-> +’d + - 1 + +e +) { + +41 + `d´štf +("s[%d] -> d[%d] (%d)\n", 0, +cbuf +-> +’d + + ! +e +, +n +); + +42 + `memýy +( +cbuf +-> +buf + + cbuf-> +’d + + ! +e +, +c +, +n +); + +45 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +’d + + ! +e +, 0, cbuf-> +maxËn + - cbuf->end - 1 +ƒ); + +46 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +maxËn + - cbuf-> +’d + - 1 + +e +, 0, +n + - cbuf->maxlen + cbuf->end + 1 -ƒ); + +47 + `memýy +( +cbuf +-> +buf + + cbuf-> +’d + + ! +e +, +c +, cbuf-> +maxËn + - cbuf->end - 1 +ƒ); + +48 + `memýy +( +cbuf +-> +buf +, +c + + cbuf-> +maxËn + - cbuf-> +’d + - 1 + +e +, +n + - cbuf->maxlen + cbuf->end + 1 -ƒ); + +50 +cbuf +-> +Ën + +ð +n +; + +51 +cbuf +-> +’d + +ð +n + - +e +; + +52 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +53  +n +; + +54 + } +} + + @cirbuf_add_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30  +šlše +  + +31 + $__cœbuf_add_h—d +( +cœbuf + * +cbuf +,  +c +) + +33 ià(! + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +34 +cbuf +-> +¡¬t + +ð(cbuf-> +maxËn + - 1); + +35 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +37 +cbuf +-> +buf +[cbuf-> +¡¬t +] = +c +; + +38 +cbuf +-> +Ën + ++; + +39 + } +} + +41 +cœbuf_št + + +42 + $cœbuf_add_h—d_§ã +( +cœbuf + * +cbuf +,  +c +) + +44 ià( +cbuf + && ! + `CIRBUF_IS_FULL +(cbuf)) { + +45 + `__cœbuf_add_h—d +( +cbuf +, +c +); + +48  - +EINVAL +; + +49 + } +} + +52 + $cœbuf_add_h—d +( +cœbuf + * +cbuf +,  +c +) + +54 + `__cœbuf_add_h—d +( +cbuf +, +c +); + +55 + } +} + + @cirbuf_add_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +31  +šlše +  + +32 + $__cœbuf_add_ž +( +cœbuf + * +cbuf +,  +c +) + +34 ià(! + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +35 +cbuf +-> +’d + ++; + +36 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +38 +cbuf +-> +buf +[cbuf-> +’d +] = +c +; + +39 +cbuf +-> +Ën + ++; + +40 + } +} + +42 +cœbuf_št + + +43 + $cœbuf_add_ž_§ã +( +cœbuf + * +cbuf +,  +c +) + +45 ià( +cbuf + && ! + `CIRBUF_IS_FULL +(cbuf)) { + +46 + `__cœbuf_add_ž +( +cbuf +, +c +); + +49  - +EINVAL +; + +50 + } +} + +53 + $cœbuf_add_ž +( +cœbuf + * +cbuf +,  +c +) + +55 + `__cœbuf_add_ž +( +cbuf +, +c +); + +56 + } +} + + @cirbuf_align.c + +23  + ~<¡ršg.h +> + +25  + ~ + +27  +šlše +  + +28 + $__cœbuf_shiá_Ëá +( +cœbuf + * +cbuf +) + +30 +cœbuf_ušt + +i +; + +31  +tmp + = +cbuf +-> +buf +[cbuf-> +¡¬t +]; + +33  +i +=0 ; i< +cbuf +-> +Ën + ; i++) { + +34 +cbuf +-> +buf +[(cbuf-> +¡¬t ++ +i +)%cbuf-> +maxËn +] = + +35 +cbuf +-> +buf +[(cbuf-> +¡¬t ++ +i ++1)%cbuf-> +maxËn +]; + +37 +cbuf +-> +buf +[(cbuf-> +¡¬t +-1+cbuf-> +maxËn +)%cbuf->maxËn] = +tmp +; + +38 +cbuf +-> +¡¬t + +ð(cbuf-> +maxËn + - 1); + +39 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +40 +cbuf +-> +’d + +ð(cbuf-> +maxËn + - 1); + +41 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +42 + } +} + +44  +šlše +  + +45 + $__cœbuf_shiá_right +( +cœbuf + * +cbuf +) + +47 +cœbuf_ušt + +i +; + +48  +tmp + = +cbuf +-> +buf +[cbuf-> +’d +]; + +50  +i +=0 ; i< +cbuf +-> +Ën + ; i++) { + +51 +cbuf +-> +buf +[(cbuf-> +’d ++cbuf-> +maxËn +- +i +)%cbuf->maxlen] = + +52 +cbuf +-> +buf +[(cbuf-> +’d ++cbuf-> +maxËn +- +i +-1)%cbuf->maxlen]; + +54 +cbuf +-> +buf +[(cbuf-> +’d ++1)%cbuf-> +maxËn +] = +tmp +; + +55 +cbuf +-> +¡¬t + += 1; + +56 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +57 +cbuf +-> +’d + += 1; + +58 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +59 + } +} + +62  + $cœbuf_®ign_Ëá +( +cœbuf + * +cbuf +) + +64 ià( +cbuf +-> +¡¬t + < cbuf-> +maxËn +/2) { + +65  +cbuf +-> +¡¬t + != 0) { + +66 + `__cœbuf_shiá_Ëá +( +cbuf +); + +70  +cbuf +-> +¡¬t + != 0) { + +71 + `__cœbuf_shiá_right +( +cbuf +); + +74 + } +} + +77  + $cœbuf_®ign_right +( +cœbuf + * +cbuf +) + +79 ià( +cbuf +-> +¡¬t + >ðcbuf-> +maxËn +/2) { + +80  +cbuf +-> +’d + !ðcbuf-> +maxËn +-1) { + +81 + `__cœbuf_shiá_Ëá +( +cbuf +); + +85  +cbuf +-> +¡¬t + !ðcbuf-> +maxËn +-1) { + +86 + `__cœbuf_shiá_right +( +cbuf +); + +89 + } +} + + @cirbuf_del_buf_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +29 +cœbuf_št + + +30 + $cœbuf_d–_buf_h—d +( +cœbuf + * +cbuf +, +cœbuf_ušt + +size +) + +32 ià(! +size + || siz> + `CIRBUF_GET_LEN +( +cbuf +)) + +33  - +EINVAL +; + +35 +cbuf +-> +Ën + -ð +size +; + +36 ià( + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +37 +cbuf +-> +¡¬t + +ð +size + - 1; + +38 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +41 +cbuf +-> +¡¬t + +ð +size +; + +42 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +45 + } +} + + @cirbuf_del_buf_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +29 +cœbuf_št + + +30 + $cœbuf_d–_buf_ž +( +cœbuf + * +cbuf +, +cœbuf_ušt + +size +) + +32 ià(! +size + || siz> + `CIRBUF_GET_LEN +( +cbuf +)) + +33  - +EINVAL +; + +35 +cbuf +-> +Ën + -ð +size +; + +36 ià( + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +37 +cbuf +-> +’d + +ð(cbuf-> +maxËn + - +size + + 1); + +38 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +41 +cbuf +-> +’d + +ð(cbuf-> +maxËn + - +size +); + +42 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +45 + } +} + + @cirbuf_del_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +29  +šlše +  + +30 + $__cœbuf_d–_h—d +( +cœbuf + * +cbuf +) + +32 +cbuf +-> +Ën + --; + +33 ià(! + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +34 +cbuf +-> +¡¬t + ++; + +35 +cbuf +-> +¡¬t + %ðcbuf-> +maxËn +; + +37 + } +} + +39 +cœbuf_št + + +40 + $cœbuf_d–_h—d_§ã +( +cœbuf + * +cbuf +) + +42 ià( +cbuf + && ! + `CIRBUF_IS_EMPTY +(cbuf)) { + +43 + `__cœbuf_d–_h—d +( +cbuf +); + +46  - +EINVAL +; + +47 + } +} + +50 + $cœbuf_d–_h—d +( +cœbuf + * +cbuf +) + +52 + `__cœbuf_d–_h—d +( +cbuf +); + +53 + } +} + + @cirbuf_del_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30  +šlše +  + +31 + $__cœbuf_d–_ž +( +cœbuf + * +cbuf +) + +33 +cbuf +-> +Ën + --; + +34 ià(! + `CIRBUF_IS_EMPTY +( +cbuf +)) { + +35 +cbuf +-> +’d + +ð(cbuf-> +maxËn + - 1); + +36 +cbuf +-> +’d + %ðcbuf-> +maxËn +; + +38 + } +} + +40 +cœbuf_št + + +41 + $cœbuf_d–_ž_§ã +( +cœbuf + * +cbuf +) + +43 ià( +cbuf + && ! + `CIRBUF_IS_EMPTY +(cbuf)) { + +44 + `__cœbuf_d–_ž +( +cbuf +); + +47  - +EINVAL +; + +48 + } +} + +51 + $cœbuf_d–_ž +( +cœbuf + * +cbuf +) + +53 + `__cœbuf_d–_ž +( +cbuf +); + +54 + } +} + + @cirbuf_get_buf_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +29 +cœbuf_št + + +30 + $cœbuf_g‘_buf_h—d +( +cœbuf + * +cbuf +, * +c +, +cœbuf_ušt + +size +) + +32 +cœbuf_ušt + +n + = ( +size + < + `CIRBUF_GET_LEN +( +cbuf +)) ? size : CIRBUF_GET_LEN(cbuf); + +34 ià(! +n +) + +37 ià( +cbuf +-> +¡¬t + <ðcbuf-> +’d +) { + +38 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +¡¬t +, 0, +n +); + +39 + `memýy +( +c +, +cbuf +-> +buf + + cbuf-> +¡¬t + , +n +); + +42 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +¡¬t +, 0, cbuf-> +maxËn + - cbuf->start); + +43 + `d´štf +("s[%d] -> d[%d] (%d)\n", 0, +cbuf +-> +maxËn + - cbuf-> +¡¬t +, +n + - cbuf->maxlen + cbuf->start); + +44 + `memýy +( +c +, +cbuf +-> +buf + + cbuf-> +¡¬t + , cbuf-> +maxËn + - cbuf->start); + +45 + `memýy +( +c + + +cbuf +-> +maxËn + - cbuf-> +¡¬t +, cbuf-> +buf +, +n + - cbuf->maxlen + cbuf->start); + +47  +n +; + +48 + } +} + + @cirbuf_get_buf_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30 +cœbuf_št + + +31 + $cœbuf_g‘_buf_ž +( +cœbuf + * +cbuf +, * +c +, +cœbuf_ušt + +size +) + +33 +cœbuf_ušt + +n + = ( +size + < + `CIRBUF_GET_LEN +( +cbuf +)) ? size : CIRBUF_GET_LEN(cbuf); + +35 ià(! +n +) + +38 ià( +cbuf +-> +¡¬t + <ðcbuf-> +’d +) { + +39 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +’d + - +n + + 1, 0,‚); + +40 + `memýy +( +c +, +cbuf +-> +buf + + cbuf-> +’d + - +n + + 1,‚); + +43 + `d´štf +("s[%d] -> d[%d] (%d)\n", 0, +cbuf +-> +maxËn + - cbuf-> +¡¬t +, cbuf-> +’d + + 1); + +44 + `d´štf +("s[%d] -> d[%d] (%d)\n", +cbuf +-> +maxËn + - +n + + cbuf-> +’d + + 1, 0,‚ - cbuf->end - 1); + +46 + `memýy +( +c + + +cbuf +-> +maxËn + - cbuf-> +¡¬t +, cbuf-> +buf +, cbuf-> +’d + + 1); + +47 + `memýy +( +c +, +cbuf +-> +buf + + cbuf-> +maxËn + - +n + + cbuf-> +’d + +1,‚ - cbuf->end - 1); + +49  +n +; + +50 + } +} + + @cirbuf_get_head.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30 + $cœbuf_g‘_h—d +( +cœbuf + * +cbuf +) + +32  +cbuf +-> +buf +[cbuf-> +¡¬t +]; + +33 + } +} + + @cirbuf_get_tail.c + +23  + ~<¡ršg.h +> + +25  + ~ + +30 + $cœbuf_g‘_ž +( +cœbuf + * +cbuf +) + +32  +cbuf +-> +buf +[cbuf-> +’d +]; + +33 + } +} + + @clock_time.h + +34 #iâdeà +_CLOCK_TIME_H_ + + +35  + #_CLOCK_TIME_H_ + + + ) + +37  + ~ + +40  +št32_t + + t£cÚds +; + +41  +št32_t + + tmiüo£cÚds +; + +46 +miüo£cÚds + + mus +; + +47 +£cÚds + + ms +; + +48 } + ttime_h +; + +55  +time_š™ +( +ušt8_t + +´iܙy +); + +60 +£cÚds + +time_g‘_s +(); + +65 +miüo£cÚds + +time_g‘_us +(); + +70 +time_h + +time_g‘_time +(); + +75  +time_»£t +(); + +80  +time_£t +( +£cÚds + +s +, +miüo£cÚds + +us +); + +88  +time_wa™_ms +( +ušt16_t + +ms +); + +93 +miüo£cÚds + +time_g‘_us2 +(); + + @cmdline.c + +23  + ~<¡dio.h +> + +24  + ~<¡ršg.h +> + +26  + ~ + +27  + ~ + +29  + ~<·r£.h +> + +30  + ~ + +31  + ~ + +32  + ~<þock_time.h +> + +34  + ~"maš.h +" + +35  + ~"cmdlše.h +" + +37  + ~"Du®Vœtu®S”Ÿl.h +" + +42 +·r£_pgm_ùx_t + +maš_ùx +[]; + +46  + $usb£rŸl1_dev_£nd +( +c +, +FILE +* +f +) + +48 + `CDC_Deviû_S’dBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +, ( +ušt8_t +) +c +); + +49  +c +; + +50 + } +} + +52  + $usb£rŸl1_dev_»cv +( +FILE +* +f +) + +54 +št16_t + +c +; + +56 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +57 ià( +c + < 0) + +58  +_FDEV_EOF +; + +60  +c +; + +61 + } +} + +64  + $usb£rŸl2_dev_£nd +( +c +, +FILE +* +f +) + +66 + `CDC_Deviû_S’dBy‹ +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +, ( +ušt8_t +) +c +); + +67  +c +; + +68 + } +} + +70  + $usb£rŸl2_dev_»cv +( +FILE +* +f +) + +72 +št16_t + +c +; + +75 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl2_CDC_IÁ”çû +); + +76 ià( +c + < 0) + +77  +_FDEV_EOF +; + +79  +c +; + +80 + } +} + +84 + $v®id_bufãr +(cÚ¡ * +buf +, +ušt8_t + +size +) + +86 +št8_t + +»t +; + +88 +»t + = + `·r£ +( +maš_ùx +, +buf +); + +89 ià( +»t + =ð +PARSE_AMBIGUOUS +) + +90 + `´štf_P +( + `PSTR +("Ambiguous command\r\n")); + +91 ià( +»t + =ð +PARSE_NOMATCH +) + +92 + `´štf_P +( + `PSTR +("Command‚ot found\r\n")); + +93 ià( +»t + =ð +PARSE_BAD_ARGS +) + +94 + `´štf_P +( + `PSTR +("Bad‡rguments\r\n")); + +95 + } +} + +97  +št8_t + + +98 + $com¶‘e_bufãr +(cÚ¡ * +buf +, * +d¡buf +, +ušt8_t + +d¡size +, + +99 +št16_t + * +¡©e +) + +101  + `com¶‘e +( +maš_ùx +, +buf +, +¡©e +, +d¡buf +, +d¡size +); + +102 + } +} + +105  + $wr™e_ch¬ +( +c +) + +107 + `usb£rŸl1_dev_£nd +( +c +, +NULL +); + +108 + } +} + +111  + $cmdlše_š™ +() + +113 + `rdlše_š™ +(& +xb“bßrd +. +rdl +, +wr™e_ch¬ +, +v®id_bufãr +, +com¶‘e_bufãr +); + +114 + `¢´štf +( +xb“bßrd +. +´om± +, (xbeeboard.prompt), "mainboard > "); + +115 + } +} + +119  + $em”g’cy +( +c +) + +121  +ušt8_t + +i + = 0; + +123 ià(( +i + =ð0 && +c + == 'p') || + +124 ( +i + =ð1 && +c + == 'o') || + +125 ( +i + =ð2 && +c + == 'p')) + +126 +i +++; + +127 iàÐ!( +i + =ð1 && +c + == 'p') ) + +128 +i + = 0; + +129 ià( +i + == 3) + +130 + `boÙlßd” +(); + +131 + } +} + +135  + $mylog +( +”rÜ + * +e +, ...) + +137 +va_li¡ + +­ +; + +138 #iâdeà +HOST_VERSION + + +139 +u16 + +¡»am_æags + = +¡dout +-> +æags +; + +141 +ušt8_t + +i +; + +142 +time_h + +tv +; + +144 ià( +e +-> +£v”™y + > +ERROR_SEVERITY_ERROR +) { + +145 ià( +xb“bßrd +. +log_Ëv– + < +e +-> +£v”™y +) + +148  +i +=0; i< +NB_LOGS ++1; i++) + +149 ià( +xb“bßrd +. +logs +[ +i +] =ð +e +-> +”r_num +) + +151 ià( +i + =ð +NB_LOGS ++1) + +155 + `va_¡¬t +( +­ +, +e +); + +156 +tv + = + `time_g‘_time +(); + +157 + `´štf_P +( + `PSTR +("%d.%.3d: "), () +tv +. +s +, ()Ñv. +us +/1000UL)); + +159 + `vårštf_P +( +¡dout +, +e +-> +‹xt +, +­ +); + +160 + `´štf_P +( + `PSTR +("\r\n")); + +161 + `va_’d +( +­ +); + +162 #iâdeà +HOST_VERSION + + +163 +¡dout +-> +æags + = +¡»am_æags +; + +165 + } +} + +167  + $cmdlše_pÞl +() + +169 cÚ¡ * +hi¡Üy +, * +bufãr +; + +170 +št8_t + +»t +, +§me + = 0; + +171 +št16_t + +c +; + +173 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +174 ià( +c + < 0) + +176 +»t + = + `rdlše_ch¬_š +(& +xb“bßrd +. +rdl +, +c +); + +177 ià( +»t + != 2 &&„et != 0) { + +178 +bufãr + = + `rdlše_g‘_bufãr +(& +xb“bßrd +. +rdl +); + +179 +hi¡Üy + = + `rdlše_g‘_hi¡Üy_™em +(& +xb“bßrd +. +rdl +, 0); + +180 ià( +hi¡Üy +) { + +181 +§me + = ! + `memcmp +( +bufãr +, +hi¡Üy +, + `¡¾’ +(history)) && + +182 +bufãr +[ + `¡¾’ +( +hi¡Üy +)] == '\n'; + +185 +§me + = 0; + +186 ià( + `¡¾’ +( +bufãr +è> 1 && ! +§me +) + +187 + `rdlše_add_hi¡Üy +(& +xb“bßrd +. +rdl +, +bufãr +); + +188 + `rdlše_Ãwlše +(& +xb“bßrd +. +rdl +, xb“bßrd. +´om± +); + +192 + } +} + + @cmdline.h + +24  + ~"Du®Vœtu®S”Ÿl.h +" + +26  +cmdlše_š™ +(); + +29  +em”g’cy +( +c +); + +32  +mylog +( +”rÜ + * +e +, ...); + +35  +cmdlše_pÞl +(); + +37  +usb£rŸl1_dev_£nd +( +c +, +FILE +* +f +); + +38  +usb£rŸl1_dev_»cv +( +FILE +* +f +); + +40  +usb£rŸl2_dev_£nd +( +c +, +FILE +* +f +); + +41  +usb£rŸl2_dev_»cv +( +FILE +* +f +); + +43  +šlše + +ušt8_t + + $cmdlše_key´es£d +() { + +44  ( + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +) >= 0); + +45 + } +} + +47  +šlše + +št16_t + + $cmdlše_g‘ch¬ +() { + +48  + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +49 + } +} + +51  +šlše + +ušt8_t + + $cmdlše_g‘ch¬_wa™ +() { + +52 +št16_t + +c +; + +54 +c + = + `CDC_Deviû_ReûiveBy‹ +(& +Vœtu®S”Ÿl1_CDC_IÁ”çû +); + +55 }  +c + < 0); + +56  +c +; + +57 + } +} + + @commands.c + +23  + ~<¡dio.h +> + +24  + ~<¡dlib.h +> + +25  + ~<¡ršg.h +> + +26  + ~<š‰y³s.h +> + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +31  + ~<·r£.h +> + +32  + ~ + +33  + ~<·r£_¡ršg.h +> + +34  + ~<·r£_num.h +> + +36  + ~"xb“_©cmd.h +" + +37  + ~"xb“_ÃighbÜ.h +" + +38  + ~"xb“_¡©s.h +" + +39  + ~"xb“_´Ùo.h +" + +40  + ~"xb“.h +" + +42  + ~"ÿÎout.h +" + +43  + ~"·r£_©cmd.h +" + +44  + ~"·r£_ÃighbÜ.h +" + +45  + ~"·r£_mڙÜ.h +" + +47  + ~"maš.h +" + +50 +·r£_pgm_š¡_t + +cmd_»£t +; + +51 +·r£_pgm_š¡_t + +cmd_boÙlßd” +; + +52 +·r£_pgm_š¡_t + +cmd_log +; + +53 +·r£_pgm_š¡_t + +cmd_log_show +; + +54 +·r£_pgm_š¡_t + +cmd_log_ty³ +; + +55 +·r£_pgm_š¡_t + +cmd_¡ack_¥aû +; + +56 +·r£_pgm_š¡_t + +cmd_scheduËr +; + +58  + gmڙÜ_³riod_ms + = 1000; + +59  + gmڙÜ_rušg + = 0; + +60  + gmڙÜ_couÁ + = 0; + +61  +ÿÎout + + gmڙÜ_ev’t +; + +62  +mڙÜ_»g + * + gmڙÜ_cu¼’t +; + +64  + g¿nge_³riod_ms + = 1000; + +65  + g¿nge_pow”mask + = 0x1F; + +66  +ušt8_t + + g¿nge_pow” + = 0; + +67  + g¿nge_rušg + = 0; + +68  +ušt64_t + + g¿nge_d¡addr + = 0xFFFF; + +69  +ÿÎout + + g¿nge_ev’t +; + +70  + g¿nge_couÁ + = 100; + +71  + g¿nge_cur_couÁ + = 0; + +73  + $mڙÜ_cb +( +ÿÎout_mªag” + * +cm +, + +74  +ÿÎout + * +þt +, * +dummy +) + +76 ià( +mڙÜ_cu¼’t + =ð +NULL +) + +77 +mڙÜ_cu¼’t + = + `LIST_FIRST +(& +xb“_mڙÜ_li¡ +); + +80 + `´štf_P +( + `PSTR +("monitor cb: %S %s\r\n"), + +81 +mڙÜ_cu¼’t +-> +desc +, + +82 +mڙÜ_cu¼’t +-> +©cmd +); + +83 +mڙÜ_cu¼’t + = + `LIST_NEXT +(mڙÜ_cu¼’t, +Ãxt +); + +84 + `ÿÎout_»£t +( +cm +, & +mڙÜ_ev’t +, + +85 +mڙÜ_³riod_ms + / +mڙÜ_couÁ +, + +86 +SINGLE +, +mڙÜ_cb +, +NULL +); + +87 + } +} + +89  + $¿nge_cb +( +ÿÎout_mªag” + * +cm +, + +90  +ÿÎout + * +þt +, * +dummy +) + +92  +buf +[16]; + +93 +ušt8_t + +i +, +mask +; + +95 +¿nge_cur_couÁ +--; + +98  +i + = 1; i <= 8; i++) { + +99 +mask + = 1 << (( +¿nge_pow” + + +i +) & 0x7); + +100 ià( +mask + & +¿nge_pow”mask +) + +103 +¿nge_pow” + = (Ôªge_pow” + +i +) & 0x7); + +106 + `´štf +("PL %d\r\n", +¿nge_pow” +); + +108 + `¢´štf +( +buf +, (buf), "¿nge%d", +¿nge_pow” +); + +111 ià( +¿nge_cur_couÁ + == 0) { + +112 +¿nge_rušg + = 0; + +116 + `ÿÎout_»£t +( +cm +, & +¿nge_ev’t +, + +117 +¿nge_³riod_ms +, + +118 +SINGLE +, +¿nge_cb +, +NULL +); + +119 + } +} + +122  + scmd_h–p_»suÉ + { + +123 +fixed_¡ršg_t + + mh–p +; + +124  +xb“_©cmd_pgm + * + mcmd +; + +128  + $cmd_h–p_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +130  +cmd_h–p_»suÉ + * +»s + = +·r£d_»suÉ +; + +131  +xb“_©cmd + +cmdcÝy +; + +132  +ty³ +; + +133 + `memýy_P +(& +cmdcÝy +, +»s +-> +cmd +, (cmdcopy)); + +134 +ty³ + = ( +cmdcÝy +. +æags + & ( +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +)); + +135  +ty³ +) { + +136  +XBEE_ATCMD_F_READ +: + +137 + `´štf_P +( + `PSTR +("Read-only\r\n")); + +139  +XBEE_ATCMD_F_WRITE +: + +140 + `´štf_P +( + `PSTR +("Write-only\r\n")); + +143 + `´štf_P +( + `PSTR +("Read-write\r\n")); + +146 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_NONE +) + +147 + `´štf_P +( + `PSTR +("No‡rgument\r\n")); + +148 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U8 +) + +149 + `´štf_P +( + `PSTR +("Register is unsigned 8 bits\r\n")); + +150 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U16 +) + +151 + `´štf_P +( + `PSTR +("Register is unsigned 16 bits\r\n")); + +152 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U32 +) + +153 + `´štf_P +( + `PSTR +("Register is unsigned 32 bits\r\n")); + +154 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_S16 +) + +155 + `´štf_P +( + `PSTR +("Register is signed 16 bits\r\n")); + +156 ià( +cmdcÝy +. +æags + & +XBEE_ATCMD_F_PARAM_STRING_20B +) + +157 + `´štf_P +( + `PSTR +("Register is‡ 20 bytes string\r\n")); + +159 + `´štf_P +( + `PSTR +("Unknown‡rgument\r\n")); + +161 + `´štf_P +( + `PSTR +("%S\r\n"), +cmdcÝy +. +h–p +); + +162 + } +} + +163 +´og_ch¬ + + g¡r_h–p_h–p +[] = "help"; + +165 +·r£_pgm_tok’_¡ršg_t + + gcmd_h–p_h–p + = + +166 +TOKEN_STRING_INITIALIZER +( +cmd_h–p_»suÉ +, +h–p +, +¡r_h–p_h–p +); + +168 +·r£_pgm_tok’_©cmd_t + + gcmd_h–p_©cmd + = + +169 +TOKEN_ATCMD_INITIALIZER +( +cmd_h–p_»suÉ +, +cmd +, & +xb“_dev +, + +172 +´og_ch¬ + + gh–p_h–p +[] = "Help‡„egister using‡n AT command"; + +173 +·r£_pgm_š¡_t + + gcmd_h–p + = { + +174 . +f + = +cmd_h–p_·r£d +, + +175 . + gd©a + = +NULL +, + +176 . + gh–p_¡r + = +h–p_h–p +, + +177 . + gtok’s + = { + +178 ( +´og_void + *)& +cmd_h–p_h–p +, + +179 ( +´og_void + *)& +cmd_h–p_©cmd +, + +180 +NULL +, + +186  + scmd_Ãigh_d–_»suÉ + { + +187 +fixed_¡ršg_t + + mcmd +; + +188 +fixed_¡ršg_t + + maùiÚ +; + +189  +xb“_Ãigh + * + mÃigh +; + +192  + $cmd_Ãigh_d–_·r£d +(* +·r£d_»suÉ +, + +193 * +d©a +) + +195  +cmd_Ãigh_d–_»suÉ + * +»s + = +·r£d_»suÉ +; + +196 + `xb“_Ãigh_d– +( +xb“_dev +, +»s +-> +Ãigh +); + +197 + } +} + +199 +´og_ch¬ + + g¡r_Ãigh_d–_Ãigh +[] = "neigh"; + +200 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_d–_cmd + = + +201 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +cmd +, + +202 +¡r_Ãigh_d–_Ãigh +); + +203 +´og_ch¬ + + g¡r_Ãigh_d–_d– +[] = "del"; + +204 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_d–_aùiÚ + = + +205 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +aùiÚ +, + +206 +¡r_Ãigh_d–_d– +); + +207 +·r£_pgm_tok’_ÃighbÜ_t + + gcmd_Ãigh_d–_Ãigh + = + +208 +TOKEN_NEIGHBOR_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +Ãigh +, + +209 & +xb“_dev +); + +211 +´og_ch¬ + + gh–p_Ãigh_d– +[] = "delete‡‚eighbor"; + +212 +·r£_pgm_š¡_t + + gcmd_Ãigh_d– + = { + +213 . +f + = +cmd_Ãigh_d–_·r£d +, + +214 . + gd©a + = +NULL +, + +215 . + gh–p_¡r + = +h–p_Ãigh_d– +, + +216 . + gtok’s + = { + +217 ( +´og_void + *)& +cmd_Ãigh_d–_cmd +, + +218 ( +´og_void + *)& +cmd_Ãigh_d–_aùiÚ +, + +219 ( +´og_void + *)& +cmd_Ãigh_d–_Ãigh +, + +220 +NULL +, + +226  + scmd_Ãigh_add_»suÉ + { + +227 +fixed_¡ršg_t + + mcmd +; + +228 +fixed_¡ršg_t + + maùiÚ +; + +229 +fixed_¡ršg_t + + mÇme +; + +230 +ušt64_t + + maddr +; + +233  + $cmd_Ãigh_add_·r£d +(* +·r£d_»suÉ +, + +234 * +d©a +) + +236  +cmd_Ãigh_add_»suÉ + * +»s + = +·r£d_»suÉ +; + +237 ià( + `xb“_Ãigh_add +( +xb“_dev +, +»s +-> +Çme +,„es-> +addr +è=ð +NULL +) + +238 + `´štf_P +( + `PSTR +("name or‡ddr‡lreadyƒxist\r\n")); + +239 + } +} + +241 +´og_ch¬ + + g¡r_Ãigh_add_Ãigh +[] = "neigh"; + +242 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_cmd + = + +243 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +cmd +, + +244 +¡r_Ãigh_add_Ãigh +); + +245 +´og_ch¬ + + g¡r_Ãigh_add_add +[] = "add"; + +246 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_aùiÚ + = + +247 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +aùiÚ +, + +248 +¡r_Ãigh_add_add +); + +249 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_Çme + = + +250 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +Çme +, +NULL +); + +251 +·r£_pgm_tok’_num_t + + gcmd_Ãigh_add_addr + = + +252 +TOKEN_NUM_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +addr +, +UINT64 +); + +254 +´og_ch¬ + + gh–p_Ãigh_add +[] = "add‡‚eighbor"; + +255 +·r£_pgm_š¡_t + + gcmd_Ãigh_add + = { + +256 . +f + = +cmd_Ãigh_add_·r£d +, + +257 . + gd©a + = +NULL +, + +258 . + gh–p_¡r + = +h–p_Ãigh_add +, + +259 . + gtok’s + = { + +260 ( +´og_void + *)& +cmd_Ãigh_add_cmd +, + +261 ( +´og_void + *)& +cmd_Ãigh_add_aùiÚ +, + +262 ( +´og_void + *)& +cmd_Ãigh_add_Çme +, + +263 ( +´og_void + *)& +cmd_Ãigh_add_addr +, + +264 +NULL +, + +270  + scmd_Ãigh_li¡_»suÉ + { + +271 +fixed_¡ršg_t + + mcmd +; + +272 +fixed_¡ršg_t + + maùiÚ +; + +275  + $cmd_Ãigh_li¡_·r£d +(* +·r£d_»suÉ +, + +276 * +d©a +) + +278  +xb“_Ãigh + * +Ãigh +; + +280 + `LIST_FOREACH +( +Ãigh +, & +xb“_dev +-> +Ãigh_li¡ +, +Ãxt +) { + +281 + `´štf_P +( + `PSTR +(" %s: 0x%.8" +PRIx32 +"%.8"PRIx32"\r\n"), + +282 +Ãigh +-> +Çme +, + +283 ( +ušt32_t +)( +Ãigh +-> +addr + >> 32ULL), + +284 ( +ušt32_t +)( +Ãigh +-> +addr + & 0xFFFFFFFF)); + +286 + } +} + +288 +´og_ch¬ + + g¡r_Ãigh_li¡_Ãigh +[] = "neigh"; + +289 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_li¡_cmd + = + +290 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_li¡_»suÉ +, +cmd +, + +291 +¡r_Ãigh_li¡_Ãigh +); + +292 +´og_ch¬ + + g¡r_Ãigh_li¡_li¡ +[] = "list"; + +293 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_li¡_aùiÚ + = + +294 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_li¡_»suÉ +, +aùiÚ +, + +295 +¡r_Ãigh_li¡_li¡ +); + +297 +´og_ch¬ + + gh–p_Ãigh_li¡ +[] = "list‡ll knwon‚eighbors"; + +298 +·r£_pgm_š¡_t + + gcmd_Ãigh_li¡ + = { + +299 . +f + = +cmd_Ãigh_li¡_·r£d +, + +300 . + gd©a + = +NULL +, + +301 . + gh–p_¡r + = +h–p_Ãigh_li¡ +, + +302 . + gtok’s + = { + +303 ( +´og_void + *)& +cmd_Ãigh_li¡_cmd +, + +304 ( +´og_void + *)& +cmd_Ãigh_li¡_aùiÚ +, + +305 +NULL +, + +315  + scmd_»ad_»suÉ + { + +316 +fixed_¡ršg_t + + m»ad +; + +317  +xb“_©cmd_pgm + * + mcmd +; + +321  + $cmd_»ad_·r£d +(* +·r£d_»suÉ +, + +322 * +d©a +) + +324  +cmd_»ad_»suÉ + * +»s + = +·r£d_»suÉ +; + +325  +xb“_©cmd + +cÝy +; + +327 + `memýy_P +(& +cÝy +, +»s +-> +cmd +, (copy)); + +328 + `xb“­p_£nd_©cmd +( +cÝy +. +Çme +, +NULL +, 0, 1); + +329 + } +} + +331 +´og_ch¬ + + g¡r_»ad_»ad +[] = "read"; + +333 +·r£_pgm_tok’_¡ršg_t + + gcmd_»ad_»ad + = + +334 +TOKEN_STRING_INITIALIZER +( +cmd_»ad_»suÉ +, +»ad +, + +335 +¡r_»ad_»ad +); + +337 +·r£_pgm_tok’_©cmd_t + + gcmd_»ad_©cmd + = + +338 +TOKEN_ATCMD_INITIALIZER +( +cmd_»ad_»suÉ +, +cmd +, & +xb“_dev +, + +339 +XBEE_ATCMD_F_READ +, XBEE_ATCMD_F_READ); + +341 +´og_ch¬ + + gh–p_»ad +[] = "Read‡„egister using‡n AT command"; + +342 +·r£_pgm_š¡_t + + gcmd_»ad + = { + +343 . +f + = +cmd_»ad_·r£d +, + +344 . + gd©a + = +NULL +, + +345 . + gh–p_¡r + = +h–p_»ad +, + +346 . + gtok’s + = { + +347 ( +´og_void + *)& +cmd_»ad_»ad +, + +348 ( +´og_void + *)& +cmd_»ad_©cmd +, + +349 +NULL +, + +357  + scmd_wr™e_»suÉ + { + +358 +fixed_¡ršg_t + + mwr™e +; + +359  +xb“_©cmd_pgm + * + mcmd +; + +361 +ušt8_t + + mu8 +; + +362 +ušt16_t + + mu16 +; + +363 +ušt32_t + + mu32 +; + +368  + $cmd_wr™e_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +370  +cmd_wr™e_»suÉ + * +»s + = +·r£d_»suÉ +; + +371  +xb“_©cmd + +cÝy +; + +372  +Ën +; + +373 * +·¿m +; + +375 + `memýy_P +(& +cÝy +, +»s +-> +cmd +, (copy)); + +377 ià( +cÝy +. +æags + & +XBEE_ATCMD_F_PARAM_NONE +) { + +378 +Ën + = 0; + +379 +·¿m + = +NULL +; + +381 ià( +cÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U8 +) { + +382 +Ën + = ( +»s +-> +u8 +); + +383 +·¿m + = & +»s +-> +u8 +; + +385 ià( +cÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U16 +) { + +386 +Ën + = ( +»s +-> +u16 +); + +387 +»s +-> +u16 + = + `htÚs +(res->u16); + +388 +·¿m + = & +»s +-> +u16 +; + +390 ià( +cÝy +. +æags + & +XBEE_ATCMD_F_PARAM_U32 +) { + +391 +Ën + = ( +»s +-> +u32 +); + +392 +»s +-> +u32 + = + `htÚl +(res->u32); + +393 +·¿m + = & +»s +-> +u32 +; + +396 + `´štf +("Unknown‡rgumentype\n"); + +400 + } +} + +402 +´og_ch¬ + + g¡r_wr™e_nÚe +[] = "write"; + +404 +·r£_pgm_tok’_¡ršg_t + + gcmd_wr™e_wr™e + = + +405 +TOKEN_STRING_INITIALIZER +( +cmd_wr™e_»suÉ +, +wr™e +, + +406 +¡r_wr™e_nÚe +); + +408 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_nÚe_©cmd + = + +409 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +410 & +xb“_dev +, + +411 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_NONE +, + +412 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_NONE +); + +414 +´og_ch¬ + + gh–p_wr™e_nÚe +[] = "Send‡n AT command (no‡rgument)"; + +416 +·r£_pgm_š¡_t + + gcmd_wr™e_nÚe + = { + +417 . +f + = +cmd_wr™e_·r£d +, + +418 . + gd©a + = +NULL +, + +419 . + gh–p_¡r + = +h–p_wr™e_nÚe +, + +420 . + gtok’s + = { + +421 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +422 ( +´og_void + *)& +cmd_wr™e_nÚe_©cmd +, + +423 +NULL +, + +427 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u8_©cmd + = + +428 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +429 & +xb“_dev +, + +430 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U8 +, + +431 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U8 +); + +433 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u8_u8 + = + +434 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u8 +, +UINT8 +); + +436 +´og_ch¬ + + gh–p_wr™e_u8 +[] = "Write‡ 8 bits„egister using‡n AT command"; + +438 +·r£_pgm_š¡_t + + gcmd_wr™e_u8 + = { + +439 . +f + = +cmd_wr™e_·r£d +, + +440 . + gd©a + = +NULL +, + +441 . + gh–p_¡r + = +h–p_wr™e_u8 +, + +442 . + gtok’s + = { + +443 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +444 ( +´og_void + *)& +cmd_wr™e_u8_©cmd +, + +445 ( +´og_void + *)& +cmd_wr™e_u8_u8 +, + +446 +NULL +, + +450 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u16_©cmd + = + +451 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +452 & +xb“_dev +, + +453 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U16 +, + +454 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U16 +); + +456 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u16_u16 + = + +457 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u16 +, +UINT16 +); + +459 +´og_ch¬ + + gh–p_wr™e_u16 +[] = "Write‡ 16 bits„egister using‡n AT command"; + +461 +·r£_pgm_š¡_t + + gcmd_wr™e_u16 + = { + +462 . +f + = +cmd_wr™e_·r£d +, + +463 . + gd©a + = +NULL +, + +464 . + gh–p_¡r + = +h–p_wr™e_u16 +, + +465 . + gtok’s + = { + +466 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +467 ( +´og_void + *)& +cmd_wr™e_u16_©cmd +, + +468 ( +´og_void + *)& +cmd_wr™e_u16_u16 +, + +469 +NULL +, + +473 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u32_©cmd + = + +474 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +475 & +xb“_dev +, + +476 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U32 +, + +477 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U32 +); + +479 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u32_u32 + = + +480 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u32 +, +UINT32 +); + +482 +´og_ch¬ + + gh–p_wr™e_u32 +[] = "Write‡ 32 bits„egister using‡n AT command"; + +484 +·r£_pgm_š¡_t + + gcmd_wr™e_u32 + = { + +485 . +f + = +cmd_wr™e_·r£d +, + +486 . + gd©a + = +NULL +, + +487 . + gh–p_¡r + = +h–p_wr™e_u32 +, + +488 . + gtok’s + = { + +489 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +490 ( +´og_void + *)& +cmd_wr™e_u32_©cmd +, + +491 ( +´og_void + *)& +cmd_wr™e_u32_u32 +, + +492 +NULL +, + +500  + scmd_£ndmsg_»suÉ + { + +501 +fixed_¡ršg_t + + m£ndmsg +; + +502 +ušt64_t + + maddr +; + +503 +fixed_¡ršg_t + + md©a +; + +507  + $cmd_£ndmsg_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +509  +cmd_£ndmsg_»suÉ + * +»s + = +·r£d_»suÉ +; + +510 + `xb“­p_£nd_msg +( +»s +-> +addr +,„es-> +d©a +, + `¡¾’ +(res->data), 1); + +511 + } +} + +513 +´og_ch¬ + + g¡r_£ndmsg +[] = "sendmsg"; + +515 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_£ndmsg + = + +516 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +£ndmsg +, + +517 +¡r_£ndmsg +); + +519 +·r£_pgm_tok’_num_t + + gcmd_£ndmsg_addr + = + +520 +TOKEN_NUM_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +addr +, +UINT64 +); + +522 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_d©a + = + +523 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +d©a +, +NULL +); + +525 +´og_ch¬ + + gh–p_£ndmsg +[] = "Send datao‡‚ode using its‡ddress"; + +527 +·r£_pgm_š¡_t + + gcmd_£ndmsg + = { + +528 . +f + = +cmd_£ndmsg_·r£d +, + +529 . + gd©a + = +NULL +, + +530 . + gh–p_¡r + = +h–p_£ndmsg +, + +531 . + gtok’s + = { + +532 ( +´og_void + *)& +cmd_£ndmsg_£ndmsg +, + +533 ( +´og_void + *)& +cmd_£ndmsg_addr +, + +534 ( +´og_void + *)& +cmd_£ndmsg_d©a +, + +535 +NULL +, + +542  + scmd_£ndmsg_Çme_»suÉ + { + +543 +fixed_¡ršg_t + + m£ndmsg_Çme +; + +544  +xb“_Ãigh + * + mÃigh +; + +545 +fixed_¡ršg_t + + md©a +; + +549  + $cmd_£ndmsg_Çme_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +551  +cmd_£ndmsg_Çme_»suÉ + * +»s + = +·r£d_»suÉ +; + +552 + `xb“­p_£nd_msg +( +»s +-> +Ãigh +-> +addr +,„es-> +d©a +, + `¡¾’ +(res->data), 1); + +553 + } +} + +555 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_Çme_£ndmsg_Çme + = + +556 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +£ndmsg_Çme +, + +557 +¡r_£ndmsg +); + +559 +·r£_pgm_tok’_ÃighbÜ_t + + gcmd_£ndmsg_Çme_Ãigh + = + +560 +TOKEN_NEIGHBOR_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +Ãigh +, + +561 & +xb“_dev +); + +563 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_Çme_d©a + = + +564 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +d©a +, +NULL +); + +566 +´og_ch¬ + + gh–p_£ndmsg_Çme +[] = "Send datao‡‚ode using its‚ame"; + +568 +·r£_pgm_š¡_t + + gcmd_£ndmsg_Çme + = { + +569 . +f + = +cmd_£ndmsg_Çme_·r£d +, + +570 . + gd©a + = +NULL +, + +571 . + gh–p_¡r + = +h–p_£ndmsg_Çme +, + +572 . + gtok’s + = { + +573 ( +´og_void + *)& +cmd_£ndmsg_Çme_£ndmsg_Çme +, + +574 ( +´og_void + *)& +cmd_£ndmsg_Çme_Ãigh +, + +575 ( +´og_void + *)& +cmd_£ndmsg_Çme_d©a +, + +576 +NULL +, + +584  + scmd_¿nge_»suÉ + { + +585 +fixed_¡ršg_t + + m¿nge +; + +586 +fixed_¡ršg_t + + maùiÚ +; + +590  + $cmd_¿nge_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +592  +cmd_¿nge_»suÉ + * +»s + = +·r£d_»suÉ +; + +594 ià(! + `¡rcmp_P +( +»s +-> +aùiÚ +, + `PSTR +("show"))) { + +595 + `´štf_P +( + `PSTR +("range infos:\r\n")); + +596 + `´štf_P +( + `PSTR +("„ªg³riod %d\r\n"), +¿nge_³riod_ms +); + +597 + `´štf_P +( + `PSTR +("„ªgcouÁ %d\r\n"), +¿nge_couÁ +); + +598 + `´štf_P +( + `PSTR +("„ªgpow”mask 0x%x\r\n"), +¿nge_pow”mask +); + +599 + `´štf_P +( + `PSTR +("„ªgd¡add¸0x%.8" +PRIx32 +"%.8"PRIx32"\r\n"), + +600 ( +ušt32_t +)( +¿nge_d¡addr + >> 32ULL), + +601 ( +ušt32_t +)( +¿nge_d¡addr + & 0xFFFFFFFF)); + +603 ià( +¿nge_rušg +) + +604 + `´štf_P +( + `PSTR +("„angeest is„unning\r\n")); + +606 + `´štf_P +( + `PSTR +("„angeest is‚ot„unning\r\n")); + +608 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "start")) { + +609 ià( +¿nge_rušg +) { + +610 + `´štf +("already„unning\n"); + +613 +¿nge_cur_couÁ + = +¿nge_couÁ +; + +614 + `ÿÎout_š™ +(& +¿nge_ev’t +); + +615 + `ÿÎout_»£t +(& +cm +, & +¿nge_ev’t +, 0, + +616 +SINGLE +, +¿nge_cb +, +NULL +); + +617 +¿nge_rušg + = 1; + +619 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "end")) { + +620 ià( +¿nge_rušg + == 0) { + +621 + `´štf +("not„unning\n"); + +624 +¿nge_rušg + = 0; + +625 + `ÿÎout_¡Ý +(& +cm +, & +¿nge_ev’t +); + +627 + } +} + +629 +´og_ch¬ + + g¡r_¿nge +[] = "range"; + +630 +´og_ch¬ + + g¡r_¿nge_tok’s +[] = "show#start#end"; + +632 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_¿nge + = + +633 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_»suÉ +, +¿nge +, + +634 +¡r_¿nge +); + +635 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_aùiÚ + = + +636 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_»suÉ +, +aùiÚ +, + +637 +¡r_¿nge_tok’s +); + +639 +´og_ch¬ + + gh–p_¿nge +[] = "start/stop/show current„angeing"; + +641 +·r£_pgm_š¡_t + + gcmd_¿nge + = { + +642 . +f + = +cmd_¿nge_·r£d +, + +643 . + gd©a + = +NULL +, + +644 . + gh–p_¡r + = +h–p_¿nge +, + +645 . + gtok’s + = { + +646 ( +´og_void + *)& +cmd_¿nge_¿nge +, + +647 ( +´og_void + *)& +cmd_¿nge_aùiÚ +, + +648 +NULL +, + +655  + scmd_¿nge_³riod_»suÉ + { + +656 +fixed_¡ršg_t + + m¿nge +; + +657 +fixed_¡ršg_t + + maùiÚ +; + +658 +ušt32_t + + m³riod +; + +662  + $cmd_¿nge_³riod_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +664  +cmd_¿nge_³riod_»suÉ + * +»s + = +·r£d_»suÉ +; + +666 ià( +»s +-> +³riod + < 10) { + +667 + `´štf +("error, minimum…eriod is 10 ms\n"); + +671 +¿nge_³riod_ms + = +»s +-> +³riod +; + +672 + } +} + +674 +´og_ch¬ + + g¡r_³riod +[] = "period"; + +676 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_³riod_¿nge_³riod + = + +677 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +¿nge +, + +678 +¡r_¿nge +); + +679 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_³riod_aùiÚ + = + +680 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +aùiÚ +, + +681 +¡r_³riod +); + +682 +·r£_pgm_tok’_num_t + + gcmd_¿nge_³riod_³riod + = + +683 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +³riod +, +UINT32 +); + +685 +´og_ch¬ + + gh–p_¿nge_³riod +[] = "set„angeest…eriod"; + +687 +·r£_pgm_š¡_t + + gcmd_¿nge_³riod + = { + +688 . +f + = +cmd_¿nge_³riod_·r£d +, + +689 . + gd©a + = +NULL +, + +690 . + gh–p_¡r + = +h–p_¿nge_³riod +, + +691 . + gtok’s + = { + +692 ( +´og_void + *)& +cmd_¿nge_³riod_¿nge_³riod +, + +693 ( +´og_void + *)& +cmd_¿nge_³riod_aùiÚ +, + +694 ( +´og_void + *)& +cmd_¿nge_³riod_³riod +, + +695 +NULL +, + +702  + scmd_¿nge_couÁ_»suÉ + { + +703 +fixed_¡ršg_t + + m¿nge +; + +704 +fixed_¡ršg_t + + maùiÚ +; + +705 +ušt32_t + + mcouÁ +; + +709  + $cmd_¿nge_couÁ_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +711  +cmd_¿nge_couÁ_»suÉ + * +»s + = +·r£d_»suÉ +; + +712 +¿nge_couÁ + = +»s +-> +couÁ +; + +713 + } +} + +715 +´og_ch¬ + + g¡r_couÁ +[] = "count"; + +717 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_couÁ_¿nge_couÁ + = + +718 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +¿nge +, + +719 +¡r_¿nge +); + +720 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_couÁ_aùiÚ + = + +721 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +aùiÚ +, + +722 +¡r_couÁ +); + +723 +·r£_pgm_tok’_num_t + + gcmd_¿nge_couÁ_couÁ + = + +724 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +couÁ +, +UINT32 +); + +727 +´og_ch¬ + + gh–p_¿nge_couÁ +[] = "set„angeest count"; + +729 +·r£_pgm_š¡_t + + gcmd_¿nge_couÁ + = { + +730 . +f + = +cmd_¿nge_couÁ_·r£d +, + +731 . + gd©a + = +NULL +, + +732 . + gh–p_¡r + = +h–p_¿nge_couÁ +, + +733 . + gtok’s + = { + +734 ( +´og_void + *)& +cmd_¿nge_couÁ_¿nge_couÁ +, + +735 ( +´og_void + *)& +cmd_¿nge_couÁ_aùiÚ +, + +736 ( +´og_void + *)& +cmd_¿nge_couÁ_couÁ +, + +737 +NULL +, + +744  + scmd_¿nge_pow”mask_»suÉ + { + +745 +fixed_¡ršg_t + + m¿nge +; + +746 +fixed_¡ršg_t + + maùiÚ +; + +747 +ušt8_t + + mpow”mask +; + +751  + $cmd_¿nge_pow”mask_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +753  +cmd_¿nge_pow”mask_»suÉ + * +»s + = +·r£d_»suÉ +; + +754 +¿nge_pow”mask + = +»s +-> +pow”mask +; + +755 + } +} + +757 +´og_ch¬ + + g¡r_pow”mask +[] = "powermask"; + +759 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_pow”mask_¿nge_pow”mask + = + +760 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +¿nge +, + +761 +¡r_¿nge +); + +762 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_pow”mask_aùiÚ + = + +763 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +aùiÚ +, + +764 +¡r_pow”mask +); + +765 +·r£_pgm_tok’_num_t + + gcmd_¿nge_pow”mask_pow”mask + = + +766 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +pow”mask +, + +767 +UINT8 +); + +770 +´og_ch¬ + + gh–p_¿nge_pow”mask +[] = "set„angeest…owermask"; + +772 +·r£_pgm_š¡_t + + gcmd_¿nge_pow”mask + = { + +773 . +f + = +cmd_¿nge_pow”mask_·r£d +, + +774 . + gd©a + = +NULL +, + +775 . + gh–p_¡r + = +h–p_¿nge_pow”mask +, + +776 . + gtok’s + = { + +777 ( +´og_void + *)& +cmd_¿nge_pow”mask_¿nge_pow”mask +, + +778 ( +´og_void + *)& +cmd_¿nge_pow”mask_aùiÚ +, + +779 ( +´og_void + *)& +cmd_¿nge_pow”mask_pow”mask +, + +780 +NULL +, + +787  + scmd_¿nge_d¡addr_»suÉ + { + +788 +fixed_¡ršg_t + + m¿nge +; + +789 +fixed_¡ršg_t + + maùiÚ +; + +790 +ušt64_t + + md¡addr +; + +794  + $cmd_¿nge_d¡addr_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +796  +cmd_¿nge_d¡addr_»suÉ + * +»s + = +·r£d_»suÉ +; + +797 +¿nge_d¡addr + = +»s +-> +d¡addr +; + +798 + } +} + +800 +´og_ch¬ + + g¡r_d¡addr +[] = "dstaddr"; + +802 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_d¡addr_¿nge_d¡addr + = + +803 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +¿nge +, + +804 +¡r_¿nge +); + +805 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_d¡addr_aùiÚ + = + +806 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +aùiÚ +, + +807 +¡r_d¡addr +); + +808 +·r£_pgm_tok’_num_t + + gcmd_¿nge_d¡addr_d¡addr + = + +809 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +d¡addr +, +UINT64 +); + +812 +´og_ch¬ + + gh–p_¿nge_d¡addr +[] = "set„egister„angeing dstaddr"; + +814 +·r£_pgm_š¡_t + + gcmd_¿nge_d¡addr + = { + +815 . +f + = +cmd_¿nge_d¡addr_·r£d +, + +816 . + gd©a + = +NULL +, + +817 . + gh–p_¡r + = +h–p_¿nge_d¡addr +, + +818 . + gtok’s + = { + +819 ( +´og_void + *)& +cmd_¿nge_d¡addr_¿nge_d¡addr +, + +820 ( +´og_void + *)& +cmd_¿nge_d¡addr_aùiÚ +, + +821 ( +´og_void + *)& +cmd_¿nge_d¡addr_d¡addr +, + +822 +NULL +, + +830  + scmd_mڙÜ_»suÉ + { + +831 +fixed_¡ršg_t + + mmÚ™Ü +; + +832 +fixed_¡ršg_t + + maùiÚ +; + +836  + $cmd_mڙÜ_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +838  +cmd_mڙÜ_»suÉ + * +»s + = +·r£d_»suÉ +; + +839  +mڙÜ_»g + * +m +; + +841 ià(! + `¡rcmp_P +( +»s +-> +aùiÚ +, + `PSTR +("show"))) { + +842 + `´štf_P +( + `PSTR +("monitor…eriod is %d ms, %d„egs in†ist\r\n"), + +843 +mڙÜ_³riod_ms +, +mڙÜ_couÁ +); + +844 + `LIST_FOREACH +( +m +, & +xb“_mڙÜ_li¡ +, +Ãxt +) + +845 + `´štf_P +( + `PSTR +(" %S\n"), +m +-> +desc +); + +847 ià(! + `¡rcmp_P +( +»s +-> +aùiÚ +, + `PSTR +("start"))) { + +848 ià( +mڙÜ_rušg +) { + +849 + `´štf +("already„unning\n"); + +852 ià( +mڙÜ_couÁ + == 0) { + +853 + `´štf +("no„egso be monitored\n"); + +856 + `ÿÎout_š™ +(& +mڙÜ_ev’t +); + +857 + `ÿÎout_»£t +(& +cm +, & +mڙÜ_ev’t +, 0, +SINGLE +, +mڙÜ_cb +, +NULL +); + +858 +mڙÜ_rušg + = 1; + +859 +mڙÜ_cu¼’t + = + `LIST_FIRST +(& +xb“_mڙÜ_li¡ +); + +860 + `´štf_P +( + `PSTR +("monitor cb: %S %s\r\n"), + +861 +mڙÜ_cu¼’t +-> +desc +, + +862 +mڙÜ_cu¼’t +-> +©cmd +); + +865 ià(! + `¡rcmp_P +( +»s +-> +aùiÚ +, + `PSTR +("end"))) { + +866 ià( +mڙÜ_rušg + == 0) { + +867 + `´štf +("not„unning\n"); + +870 +mڙÜ_rušg + = 0; + +871 + `ÿÎout_¡Ý +(& +cm +, & +mڙÜ_ev’t +); + +873 + } +} + +875 +´og_ch¬ + + g¡r_mÚ™Ü +[] = "monitor"; + +876 +´og_ch¬ + + g¡r_mڙÜ_tok’s +[] = "show#start#end"; + +878 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_mÚ™Ü + = + +879 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_»suÉ +, +mÚ™Ü +, + +880 +¡r_mÚ™Ü +); + +881 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_aùiÚ + = + +882 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_»suÉ +, +aùiÚ +, + +883 +¡r_mڙÜ_tok’s +); + +885 +´og_ch¬ + + gh–p_mÚ™Ü +[] = "start/stop/show current monitoring"; + +887 +·r£_pgm_š¡_t + + gcmd_mÚ™Ü + = { + +888 . +f + = +cmd_mڙÜ_·r£d +, + +889 . + gd©a + = +NULL +, + +890 . + gh–p_¡r + = +h–p_mÚ™Ü +, + +891 . + gtok’s + = { + +892 ( +´og_void + *)& +cmd_mڙÜ_mÚ™Ü +, + +893 ( +´og_void + *)& +cmd_mڙÜ_aùiÚ +, + +894 +NULL +, + +901  + scmd_mڙÜ_add_»suÉ + { + +902 +fixed_¡ršg_t + + mmÚ™Ü +; + +903 +fixed_¡ršg_t + + maùiÚ +; + +904  +xb“_©cmd_pgm + * + mcmd +; + +908  + $cmd_mڙÜ_add_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +910  +cmd_mڙÜ_add_»suÉ + * +»s + = +·r£d_»suÉ +; + +911  +mڙÜ_»g + * +m +; + +912  +xb“_©cmd + +cÝy +; + +914 + `memýy_P +(& +cÝy +, +»s +-> +cmd +, (copy)); + +915 + `LIST_FOREACH +( +m +, & +xb“_mڙÜ_li¡ +, +Ãxt +) { + +916 ià(! + `¡rcmp_P +( +m +-> +©cmd +, +cÝy +. +Çme +)) + +920 ià( +m + !ð +NULL +) { + +921 + `´štf +("alreadyƒxist\n"); + +925 +m + = + `m®loc +((*m)); + +926 ià( +m + =ð +NULL +) { + +927 + `´štf +("no mem\n"); + +930 +m +-> +desc + = +cÝy +.desc; + +931 + `¡rýy_P +( +m +-> +©cmd +, +cÝy +. +Çme +); + +932 + `LIST_INSERT_HEAD +(& +xb“_mڙÜ_li¡ +, +m +, +Ãxt +); + +933 +mڙÜ_couÁ + ++; + +934 + } +} + +936 +´og_ch¬ + + g¡r_mڙÜ_add +[] = "add"; + +938 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_add_mڙÜ_add + = + +939 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +mÚ™Ü +, + +940 +¡r_mÚ™Ü +); + +941 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_add_aùiÚ + = + +942 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +aùiÚ +, + +943 +¡r_mڙÜ_add +); + +944 +·r£_pgm_tok’_©cmd_t + + gcmd_mڙÜ_add_©cmd + = + +945 +TOKEN_ATCMD_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +cmd +, & +xb“_dev +, + +946 +XBEE_ATCMD_F_READ +, XBEE_ATCMD_F_READ); + +949 +´og_ch¬ + + gh–p_mڙÜ_add +[] = "add‡„egister in monitor†ist"; + +951 +·r£_pgm_š¡_t + + gcmd_mڙÜ_add + = { + +952 . +f + = +cmd_mڙÜ_add_·r£d +, + +953 . + gd©a + = +NULL +, + +954 . + gh–p_¡r + = +h–p_mڙÜ_add +, + +955 . + gtok’s + = { + +956 ( +´og_void + *)& +cmd_mڙÜ_add_mڙÜ_add +, + +957 ( +´og_void + *)& +cmd_mڙÜ_add_aùiÚ +, + +958 ( +´og_void + *)& +cmd_mڙÜ_add_©cmd +, + +959 +NULL +, + +966  + scmd_mڙÜ_³riod_»suÉ + { + +967 +fixed_¡ršg_t + + mmÚ™Ü +; + +968 +fixed_¡ršg_t + + maùiÚ +; + +969 +ušt32_t + + m³riod +; + +973  + $cmd_mڙÜ_³riod_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +975  +cmd_mڙÜ_³riod_»suÉ + * +»s + = +·r£d_»suÉ +; + +977 ià( +»s +-> +³riod + < 100) { + +978 + `´štf +("error, minimum…eriod is 100 ms\n"); + +982 +mڙÜ_³riod_ms + = +»s +-> +³riod +; + +983 + } +} + +985 +´og_ch¬ + + g¡r_mڙÜ_³riod +[] = "period"; + +987 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_³riod_mڙÜ_³riod + = + +988 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +mÚ™Ü +, + +989 +¡r_mÚ™Ü +); + +990 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_³riod_aùiÚ + = + +991 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +aùiÚ +, + +992 +¡r_mڙÜ_³riod +); + +993 +·r£_pgm_tok’_num_t + + gcmd_mڙÜ_³riod_³riod + = + +994 +TOKEN_NUM_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +³riod +, +UINT32 +); + +997 +´og_ch¬ + + gh–p_mڙÜ_³riod +[] = "set„egister monitoring…eriod"; + +999 +·r£_pgm_š¡_t + + gcmd_mڙÜ_³riod + = { + +1000 . +f + = +cmd_mڙÜ_³riod_·r£d +, + +1001 . + gd©a + = +NULL +, + +1002 . + gh–p_¡r + = +h–p_mڙÜ_³riod +, + +1003 . + gtok’s + = { + +1004 ( +´og_void + *)& +cmd_mڙÜ_³riod_mڙÜ_³riod +, + +1005 ( +´og_void + *)& +cmd_mڙÜ_³riod_aùiÚ +, + +1006 ( +´og_void + *)& +cmd_mڙÜ_³riod_³riod +, + +1007 +NULL +, + +1014  + scmd_mڙÜ_d–_»suÉ + { + +1015 +fixed_¡ršg_t + + mmÚ™Ü +; + +1016 +fixed_¡ršg_t + + maùiÚ +; + +1017  +mڙÜ_»g + * + mm +; + +1021  + $cmd_mڙÜ_d–_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +1023  +cmd_mڙÜ_d–_»suÉ + * +»s + = +·r£d_»suÉ +; + +1025 +mڙÜ_cu¼’t + = + `LIST_NEXT +( +»s +-> +m +, +Ãxt +); + +1026 + `LIST_REMOVE +( +»s +-> +m +, +Ãxt +); + +1027 + `ä“ +( +»s +-> +m +); + +1028 +mڙÜ_couÁ + --; + +1029 ià( +mڙÜ_couÁ + == 0) { + +1030 + `´štf +("Disable monitoring,‚o moreƒvent\n"); + +1031 + `ÿÎout_¡Ý +(& +cm +, & +mڙÜ_ev’t +); + +1032 +mڙÜ_rušg + = 0; + +1035 + } +} + +1037 +´og_ch¬ + + g¡r_mڙÜ_d– +[] = "del"; + +1039 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_d–_mڙÜ_d– + = + +1040 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +mÚ™Ü +, + +1041 +¡r_mÚ™Ü +); + +1042 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_d–_aùiÚ + = + +1043 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +aùiÚ +, + +1044 +¡r_mڙÜ_d– +); + +1045 +·r£_pgm_tok’_mڙÜ_t + + gcmd_mڙÜ_d–_©cmd + = + +1046 +TOKEN_MONITOR_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +m +); + +1049 +´og_ch¬ + + gh–p_mڙÜ_d– +[] = "del‡„egister in monitor†ist"; + +1051 +·r£_pgm_š¡_t + + gcmd_mڙÜ_d– + = { + +1052 . +f + = +cmd_mڙÜ_d–_·r£d +, + +1053 . + gd©a + = +NULL +, + +1054 . + gh–p_¡r + = +h–p_mڙÜ_d– +, + +1055 . + gtok’s + = { + +1056 ( +´og_void + *)& +cmd_mڙÜ_d–_mڙÜ_d– +, + +1057 ( +´og_void + *)& +cmd_mڙÜ_d–_aùiÚ +, + +1058 ( +´og_void + *)& +cmd_mڙÜ_d–_©cmd +, + +1059 +NULL +, + +1067  + scmd_pšg_»suÉ + { + +1068 +fixed_¡ršg_t + + mpšg +; + +1072  + $cmd_pšg_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +1077 + } +} + +1079 +´og_ch¬ + + g¡r_pšg +[] = "ping"; + +1081 +·r£_pgm_tok’_¡ršg_t + + gcmd_pšg_pšg + = + +1082 +TOKEN_STRING_INITIALIZER +( +cmd_pšg_»suÉ +, +pšg +, + +1083 +¡r_pšg +); + +1085 +´og_ch¬ + + gh–p_pšg +[] = "Send‡…ingohe xbee device"; + +1087 +·r£_pgm_š¡_t + + gcmd_pšg + = { + +1088 . +f + = +cmd_pšg_·r£d +, + +1089 . + gd©a + = +NULL +, + +1090 . + gh–p_¡r + = +h–p_pšg +, + +1091 . + gtok’s + = { + +1092 ( +´og_void + *)& +cmd_pšg_pšg +, + +1093 +NULL +, + +1100  + scmd_¿w_»suÉ + { + +1101 +fixed_¡ršg_t + + m¿w +; + +1105  + $cmd_¿w_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +1108 + `´štf +("switchedo„aw mode, CTRL-Doƒxit\n"); + +1109 + `rdlše_¡Ý +(& +þ +-> +rdl +); + +1110 +xb“_¿w + = 1; + +1112 + } +} + +1114 +´og_ch¬ + + g¡r_¿w +[] = "raw"; + +1116 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿w_¿w + = + +1117 +TOKEN_STRING_INITIALIZER +( +cmd_¿w_»suÉ +, +¿w +, + +1118 +¡r_¿w +); + +1120 +´og_ch¬ + + gh–p_¿w +[] = "Switcho„aw mode"; + +1122 +·r£_pgm_š¡_t + + gcmd_¿w + = { + +1123 . +f + = +cmd_¿w_·r£d +, + +1124 . + gd©a + = +NULL +, + +1125 . + gh–p_¡r + = +h–p_¿w +, + +1126 . + gtok’s + = { + +1127 ( +´og_void + *)& +cmd_¿w_¿w +, + +1128 +NULL +, + +1135  + scmd_dump_»suÉ + { + +1136 +fixed_¡ršg_t + + mdump +; + +1137 +fixed_¡ršg_t + + mÚoff +; + +1141  + $cmd_dump_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +1143  +cmd_dump_»suÉ + * +»s + = +·r£d_»suÉ +; + +1144 ià(! + `¡rcmp +( +»s +-> +Úoff +, "on")) + +1145 +xb“_hexdump + = 1; + +1147 +xb“_hexdump + = 0; + +1148 + } +} + +1150 +´og_ch¬ + + g¡r_dump +[] = "dump"; + +1151 +´og_ch¬ + + g¡r_dump_Úoff +[] = "on#off"; + +1153 +·r£_pgm_tok’_¡ršg_t + + gcmd_dump_dump + = + +1154 +TOKEN_STRING_INITIALIZER +( +cmd_dump_»suÉ +, +dump +, + +1155 +¡r_dump_Úoff +); + +1157 +·r£_pgm_tok’_¡ršg_t + + gcmd_dump_Úoff + = + +1158 +TOKEN_STRING_INITIALIZER +( +cmd_dump_»suÉ +, +Úoff +, + +1159 +¡r_dump_Úoff +); + +1161 +´og_ch¬ + + gh–p_dump +[] = "enable/disable hexdump of„eceived…ackets"; + +1163 +·r£_pgm_š¡_t + + gcmd_dump + = { + +1164 . +f + = +cmd_dump_·r£d +, + +1165 . + gd©a + = +NULL +, + +1166 . + gh–p_¡r + = +h–p_dump +, + +1167 . + gtok’s + = { + +1168 ( +´og_void + *)& +cmd_dump_dump +, + +1169 ( +´og_void + *)& +cmd_dump_Úoff +, + +1170 +NULL +, + +1177  + scmd_debug_»suÉ + { + +1178 +fixed_¡ršg_t + + mdebug +; + +1179 +fixed_¡ršg_t + + mÚoff +; + +1183  + $cmd_debug_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +1185  +cmd_debug_»suÉ + * +»s + = +·r£d_»suÉ +; + +1186 ià(! + `¡rcmp +( +»s +-> +Úoff +, "on")) + +1187 +xb“_debug + = 1; + +1189 +xb“_debug + = 0; + +1190 + } +} + +1192 +´og_ch¬ + + g¡r_debug +[] = "debug"; + +1193 +´og_ch¬ + + g¡r_debug_Úoff +[] = "on#off"; + +1195 +·r£_pgm_tok’_¡ršg_t + + gcmd_debug_debug + = + +1196 +TOKEN_STRING_INITIALIZER +( +cmd_debug_»suÉ +, +debug +, + +1197 +¡r_debug +); + +1199 +·r£_pgm_tok’_¡ršg_t + + gcmd_debug_Úoff + = + +1200 +TOKEN_STRING_INITIALIZER +( +cmd_debug_»suÉ +, +Úoff +, + +1201 +¡r_debug_Úoff +); + +1203 +´og_ch¬ + + gh–p_debug +[] = "enable/disable‡dditionnal debug"; + +1205 +·r£_pgm_š¡_t + + gcmd_debug + = { + +1206 . +f + = +cmd_debug_·r£d +, + +1207 . + gd©a + = +NULL +, + +1208 . + gh–p_¡r + = +h–p_debug +, + +1209 . + gtok’s + = { + +1210 ( +´og_void + *)& +cmd_debug_debug +, + +1211 ( +´og_void + *)& +cmd_debug_Úoff +, + +1212 +NULL +, + +1219 +·r£_pgm_ùx_t + + gmaš_ùx +[] = { + +1222 ( +·r£_pgm_š¡_t + *)& +cmd_»£t +, + +1223 ( +·r£_pgm_š¡_t + *)& +cmd_boÙlßd” +, + +1224 ( +·r£_pgm_š¡_t + *)& +cmd_log +, + +1225 ( +·r£_pgm_š¡_t + *)& +cmd_log_show +, + +1226 ( +·r£_pgm_š¡_t + *)& +cmd_log_ty³ +, + +1227 ( +·r£_pgm_š¡_t + *)& +cmd_¡ack_¥aû +, + +1228 ( +·r£_pgm_š¡_t + *)& +cmd_scheduËr +, + +1229 ( +·r£_pgm_š¡_t + *)& +cmd_h–p +, + +1230 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_d– +, + +1231 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_add +, + +1232 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_li¡ +, + +1233 ( +·r£_pgm_š¡_t + *)& +cmd_»ad +, + +1234 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_nÚe +, + +1235 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u8 +, + +1236 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u16 +, + +1237 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u32 +, + +1238 ( +·r£_pgm_š¡_t + *)& +cmd_£ndmsg +, + +1239 ( +·r£_pgm_š¡_t + *)& +cmd_£ndmsg_Çme +, + +1240 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge +, + +1241 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_³riod +, + +1242 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_couÁ +, + +1243 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_pow”mask +, + +1244 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_d¡addr +, + +1245 ( +·r£_pgm_š¡_t + *)& +cmd_mÚ™Ü +, + +1246 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_³riod +, + +1247 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_add +, + +1248 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_d– +, + +1249 ( +·r£_pgm_š¡_t + *)& +cmd_pšg +, + +1250 ( +·r£_pgm_š¡_t + *)& +cmd_¿w +, + +1251 ( +·r£_pgm_š¡_t + *)& +cmd_dump +, + +1252 ( +·r£_pgm_š¡_t + *)& +cmd_debug +, + +1253 +NULL +, + + @commands2.c + +28  + ~<¡dio.h +> + +29  + ~<¡dšt.h +> + +30  + ~<¡ršg.h +> + +31  + ~<¡dlib.h +> + +32  + ~<¡d¬g.h +> + +33  + ~<”ºo.h +> + +34  + ~<ùy³.h +> + +35  + ~ + +36  + ~<¬·/š‘.h +> + +37  + ~<š‰y³s.h +> + +39  + ~ + +41  + ~ + +42  + ~ + +43  + ~ + +44  + ~ + +45  + ~ + +47  + ~"xb“_ÃighbÜ.h +" + +48  + ~"xb“_©cmd.h +" + +49  + ~"xb“_¡©s.h +" + +50  + ~"xb“_buf.h +" + +51  + ~"xb“_´Ùo.h +" + +52  + ~"xb“.h +" + +53  + ~"·r£_©cmd.h +" + +54  + ~"·r£_ÃighbÜ.h +" + +55  + ~"·r£_mڙÜ.h +" + +56  + ~"maš.h +" + +58  +mڙÜ_»g_li¡ + + gmڙÜ_li¡ + = +LIST_HEAD_INITIALIZER +( +x + ); + +59  + gmڙÜ_³riod_ms + = 1000; + +60  + gmڙÜ_rušg + = 0; + +61  + gmڙÜ_couÁ + = 0; + +62  +ev’t + + gmڙÜ_ev’t +; + +63  +mڙÜ_»g + * + gmڙÜ_cu¼’t +; + +65  + g¿nge_³riod_ms + = 1000; + +66  + g¿nge_pow”mask + = 0x1F; + +67  +ušt8_t + + g¿nge_pow” + = 0; + +68  + g¿nge_rušg + = 0; + +69  +ušt64_t + + g¿nge_d¡addr + = 0xFFFF; + +70  +ev’t + + g¿nge_ev’t +; + +71  + g¿nge_couÁ + = 100; + +72  + g¿nge_cur_couÁ + = 0; + +74 cÚ¡ * + gxb“_logfž’ame + = "/tmp/xbee.log"; + +76  + $mڙÜ_cb +( +s +,  +ev’t +, * +¬g +) + +78  +timev® + +tv +; + +79  +cmdlše + * +þ + = +¬g +; + +81 ià( +mڙÜ_cu¼’t + =ð +NULL +) + +82 +mڙÜ_cu¼’t + = + `LIST_FIRST +(& +mڙÜ_li¡ +); + +84 + `xb“­p_£nd_©cmd +( +mڙÜ_cu¼’t +-> +©cmd +, +NULL +, 0, 0); + +85 +mڙÜ_cu¼’t + = + `LIST_NEXT +(mڙÜ_cu¼’t, +Ãxt +); + +87 + `evtim”_£t +(& +mڙÜ_ev’t +, +mڙÜ_cb +, +þ +); + +88 +tv +. +tv_£c + = 0; + +89 +tv +. +tv_u£c + = (1000 * +mڙÜ_³riod_ms +è/ +mڙÜ_couÁ +; + +90 + `evtim”_add +(& +mڙÜ_ev’t +, & +tv +); + +91 + } +} + +93  + $¿nge_cb +( +s +,  +ev’t +, * +¬g +) + +95  +timev® + +tv +; + +96  +cmdlše + * +þ + = +¬g +; + +97  +buf +[16]; + +98 +ušt8_t + +i +, +mask +; + +100 +¿nge_cur_couÁ +--; + +103  +i + = 1; i <= 8; i++) { + +104 +mask + = 1 << (( +¿nge_pow” + + +i +) & 0x7); + +105 ià( +mask + & +¿nge_pow”mask +) + +108 +¿nge_pow” + = (Ôªge_pow” + +i +) & 0x7); + +110 + `xb“­p_£nd_©cmd +("PL", & +¿nge_pow” +, (range_power), 0); + +111 + `¢´štf +( +buf +, (buf), "¿nge%d", +¿nge_pow” +); + +112 + `xb“­p_£nd_msg +( +¿nge_d¡addr +, +buf +, + `¡¾’ +(buf), 0); + +114 ià( +¿nge_cur_couÁ + == 0) { + +115 +¿nge_rušg + = 0; + +119 + `evtim”_£t +(& +¿nge_ev’t +, +¿nge_cb +, +þ +); + +120 +tv +. +tv_£c + = 0; + +121 +tv +. +tv_u£c + = 1000 * +¿nge_³riod_ms +; + +122 + `evtim”_add +(& +¿nge_ev’t +, & +tv +); + +123 + } +} + +128  + scmd_¡©s_»suÉ + { + +129 +fixed_¡ršg_t + + m¡©s +; + +130 +fixed_¡ršg_t + + maùiÚ +; + +134  + $cmd_¡©s_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +136  +cmd_¡©s_»suÉ + * +»s + = +·r£d_»suÉ +; + +138 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "show")) { + +139 + `xb“_dump_¡©s +( +¡dout +, +xb“_dev +); + +140 ià( +xb“_logfže + !ð +NULL +) + +141 + `xb“_dump_¡©s +( +xb“_logfže +, +xb“_dev +); + +143 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "reset")) + +144 + `xb“_»£t_¡©s +( +xb“_dev +); + +145 + } +} + +147 +·r£_pgm_tok’_¡ršg_t + + gcmd_¡©s_¡©s + = + +148 +TOKEN_STRING_INITIALIZER +( +cmd_¡©s_»suÉ +, +¡©s +, "stats"); + +149 +·r£_pgm_tok’_¡ršg_t + + gcmd_¡©s_aùiÚ + = + +150 +TOKEN_STRING_INITIALIZER +( +cmd_¡©s_»suÉ +, +aùiÚ +, "show#reset"); + +152 +·r£_pgm_š¡_t + + gcmd_¡©s + = { + +153 . +f + = +cmd_¡©s_·r£d +, + +154 . + gd©a + = +NULL +, + +155 . + gh–p_¡r + = "Send‡ statsohe xbee device", + +156 . + gtok’s + = { + +157 ( +´og_void + *)& +cmd_¡©s_¡©s +, + +158 ( +´og_void + *)& +cmd_¡©s_aùiÚ +, + +159 +NULL +, + +166  + scmd_mڙÜ_»suÉ + { + +167 +fixed_¡ršg_t + + mmÚ™Ü +; + +168 +fixed_¡ršg_t + + maùiÚ +; + +172  + $cmd_mڙÜ_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +173 * +d©a +) + +175  +cmd_mڙÜ_»suÉ + * +»s + = +·r£d_»suÉ +; + +176  +mڙÜ_»g + * +m +; + +178 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "show")) { + +179 + `´štf +("monitor…eriod is %d ms, %d„egs in†ist\n", + +180 +mڙÜ_³riod_ms +, +mڙÜ_couÁ +); + +181 + `LIST_FOREACH +( +m +, & +mڙÜ_li¡ +, +Ãxt +) + +182 + `´štf +(" %s\n", +m +-> +desc +); + +184 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "start")) { + +185  +timev® + +tv +; + +186 ià( +mڙÜ_rušg +) { + +187 + `´štf +("already„unning\n"); + +190 ià( +mڙÜ_couÁ + == 0) { + +191 + `´štf +("no„egso be monitored\n"); + +194 + `evtim”_£t +(& +mڙÜ_ev’t +, +mڙÜ_cb +, +þ +); + +195 +tv +. +tv_£c + = 0; + +196 +tv +. +tv_u£c + = 0; + +197 + `evtim”_add +(& +mڙÜ_ev’t +, & +tv +); + +198 +mڙÜ_rušg + = 1; + +199 +mڙÜ_cu¼’t + = + `LIST_FIRST +(& +mڙÜ_li¡ +); + +201 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "end")) { + +202 ià( +mڙÜ_rušg + == 0) { + +203 + `´štf +("not„unning\n"); + +206 +mڙÜ_rušg + = 0; + +207 + `evtim”_d– +(& +mڙÜ_ev’t +); + +209 + } +} + +211 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_mÚ™Ü + = + +212 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_»suÉ +, +mÚ™Ü +, "monitor"); + +213 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_aùiÚ + = + +214 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_»suÉ +, +aùiÚ +, + +217 +·r£_pgm_š¡_t + + gcmd_mÚ™Ü + = { + +218 . +f + = +cmd_mڙÜ_·r£d +, + +219 . + gd©a + = +NULL +, + +220 . + gh–p_¡r + = "start/stop/show current monitoring", + +221 . + gtok’s + = { + +222 ( +´og_void + *)& +cmd_mڙÜ_mÚ™Ü +, + +223 ( +´og_void + *)& +cmd_mڙÜ_aùiÚ +, + +224 +NULL +, + +231  + scmd_mڙÜ_add_»suÉ + { + +232 +fixed_¡ršg_t + + mmÚ™Ü +; + +233 +fixed_¡ršg_t + + maùiÚ +; + +234  +xb“_©cmd + * + mcmd +; + +238  + $cmd_mڙÜ_add_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +239 * +d©a +) + +241  +cmd_mڙÜ_add_»suÉ + * +»s + = +·r£d_»suÉ +; + +242  +mڙÜ_»g + * +m +; + +244 + `LIST_FOREACH +( +m +, & +mڙÜ_li¡ +, +Ãxt +) { + +245 ià(! + `¡rcmp +( +m +-> +desc +, +»s +-> +cmd +->desc)) + +249 ià( +m + !ð +NULL +) { + +250 + `´štf +("alreadyƒxist\n"); + +254 +m + = + `m®loc +((*m)); + +255 ià( +m + =ð +NULL +) { + +256 + `´štf +("no mem\n"); + +260 +m +-> +desc + = +»s +-> +cmd +->desc; + +261 +m +-> +©cmd + = +»s +-> +cmd +-> +Çme +; + +262 + `LIST_INSERT_HEAD +(& +mڙÜ_li¡ +, +m +, +Ãxt +); + +263 +mڙÜ_couÁ + ++; + +264 + } +} + +266 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_add_mڙÜ_add + = + +267 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +mÚ™Ü +, + +269 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_add_aùiÚ + = + +270 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +aùiÚ +, + +272 +·r£_pgm_tok’_©cmd_t + + gcmd_mڙÜ_add_©cmd + = + +273 +TOKEN_ATCMD_INITIALIZER +( +cmd_mڙÜ_add_»suÉ +, +cmd +, & +xb“_dev +, + +274 +XBEE_ATCMD_F_READ +, XBEE_ATCMD_F_READ); + +277 +·r£_pgm_š¡_t + + gcmd_mڙÜ_add + = { + +278 . +f + = +cmd_mڙÜ_add_·r£d +, + +279 . + gd©a + = +NULL +, + +280 . + gh–p_¡r + = "add‡„egister in monitor†ist", + +281 . + gtok’s + = { + +282 ( +´og_void + *)& +cmd_mڙÜ_add_mڙÜ_add +, + +283 ( +´og_void + *)& +cmd_mڙÜ_add_aùiÚ +, + +284 ( +´og_void + *)& +cmd_mڙÜ_add_©cmd +, + +285 +NULL +, + +292  + scmd_mڙÜ_³riod_»suÉ + { + +293 +fixed_¡ršg_t + + mmÚ™Ü +; + +294 +fixed_¡ršg_t + + maùiÚ +; + +295 +ušt32_t + + m³riod +; + +299  + $cmd_mڙÜ_³riod_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +300 * +d©a +) + +302  +cmd_mڙÜ_³riod_»suÉ + * +»s + = +·r£d_»suÉ +; + +304 ià( +»s +-> +³riod + < 100) { + +305 + `´štf +("error, minimum…eriod is 100 ms\n"); + +309 +mڙÜ_³riod_ms + = +»s +-> +³riod +; + +310 + } +} + +312 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_³riod_mڙÜ_³riod + = + +313 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +mÚ™Ü +, + +315 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_³riod_aùiÚ + = + +316 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +aùiÚ +, + +318 +·r£_pgm_tok’_num_t + + gcmd_mڙÜ_³riod_³riod + = + +319 +TOKEN_NUM_INITIALIZER +( +cmd_mڙÜ_³riod_»suÉ +, +³riod +, +UINT32 +); + +322 +·r£_pgm_š¡_t + + gcmd_mڙÜ_³riod + = { + +323 . +f + = +cmd_mڙÜ_³riod_·r£d +, + +324 . + gd©a + = +NULL +, + +325 . + gh–p_¡r + = "set„egister monitoring…eriod", + +326 . + gtok’s + = { + +327 ( +´og_void + *)& +cmd_mڙÜ_³riod_mڙÜ_³riod +, + +328 ( +´og_void + *)& +cmd_mڙÜ_³riod_aùiÚ +, + +329 ( +´og_void + *)& +cmd_mڙÜ_³riod_³riod +, + +330 +NULL +, + +337  + scmd_mڙÜ_d–_»suÉ + { + +338 +fixed_¡ršg_t + + mmÚ™Ü +; + +339 +fixed_¡ršg_t + + maùiÚ +; + +340  +mڙÜ_»g + * + mm +; + +344  + $cmd_mڙÜ_d–_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +345 * +d©a +) + +347  +cmd_mڙÜ_d–_»suÉ + * +»s + = +·r£d_»suÉ +; + +349 +mڙÜ_cu¼’t + = + `LIST_NEXT +( +»s +-> +m +, +Ãxt +); + +350 + `LIST_REMOVE +( +»s +-> +m +, +Ãxt +); + +351 + `ä“ +( +»s +-> +m +); + +352 +mڙÜ_couÁ + --; + +353 ià( +mڙÜ_couÁ + == 0) { + +354 + `´štf +("Disable monitoring,‚o moreƒvent\n"); + +355 + `evtim”_d– +(& +mڙÜ_ev’t +); + +356 +mڙÜ_rušg + = 0; + +359 + } +} + +361 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_d–_mڙÜ_d– + = + +362 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +mÚ™Ü +, + +364 +·r£_pgm_tok’_¡ršg_t + + gcmd_mڙÜ_d–_aùiÚ + = + +365 +TOKEN_STRING_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +aùiÚ +, + +367 +·r£_pgm_tok’_mڙÜ_t + + gcmd_mڙÜ_d–_©cmd + = + +368 +TOKEN_MONITOR_INITIALIZER +( +cmd_mڙÜ_d–_»suÉ +, +m +, + +369 & +mڙÜ_li¡ +); + +372 +·r£_pgm_š¡_t + + gcmd_mڙÜ_d– + = { + +373 . +f + = +cmd_mڙÜ_d–_·r£d +, + +374 . + gd©a + = +NULL +, + +375 . + gh–p_¡r + = "del‡„egister in monitor†ist", + +376 . + gtok’s + = { + +377 ( +´og_void + *)& +cmd_mڙÜ_d–_mڙÜ_d– +, + +378 ( +´og_void + *)& +cmd_mڙÜ_d–_aùiÚ +, + +379 ( +´og_void + *)& +cmd_mڙÜ_d–_©cmd +, + +380 +NULL +, + +387  + scmd_¿nge_»suÉ + { + +388 +fixed_¡ršg_t + + m¿nge +; + +389 +fixed_¡ršg_t + + maùiÚ +; + +393  + $cmd_¿nge_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +394 * +d©a +) + +396  +cmd_¿nge_»suÉ + * +»s + = +·r£d_»suÉ +; + +398 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "show")) { + +399 + `´štf +("range infos:\n"); + +400 + `´štf +("„ªg³riod %d\n", +¿nge_³riod_ms +); + +401 + `´štf +("„ªgcouÁ %d\n", +¿nge_couÁ +); + +402 + `´štf +("„ªgpow”mask 0x%x\n", +¿nge_pow”mask +); + +403 + `´štf +("„ªgd¡add¸%" +PRIx64 +"\n", +¿nge_d¡addr +); + +404 ià( +¿nge_rušg +) + +405 + `´štf +("„angeest is„unning\n"); + +407 + `´štf +("„angeest is‚ot„unning\n"); + +409 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "start")) { + +410  +timev® + +tv +; + +411 ià( +¿nge_rušg +) { + +412 + `´štf +("already„unning\n"); + +415 +¿nge_cur_couÁ + = +¿nge_couÁ +; + +416 + `evtim”_£t +(& +¿nge_ev’t +, +¿nge_cb +, +þ +); + +417 +tv +. +tv_£c + = 0; + +418 +tv +. +tv_u£c + = 0; + +419 + `evtim”_add +(& +¿nge_ev’t +, & +tv +); + +420 +¿nge_rušg + = 1; + +422 ià(! + `¡rcmp +( +»s +-> +aùiÚ +, "end")) { + +423 ià( +¿nge_rušg + == 0) { + +424 + `´štf +("not„unning\n"); + +427 +¿nge_rušg + = 0; + +428 + `evtim”_d– +(& +¿nge_ev’t +); + +430 + } +} + +432 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_¿nge + = + +433 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_»suÉ +, +¿nge +, "range"); + +434 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_aùiÚ + = + +435 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_»suÉ +, +aùiÚ +, + +438 +·r£_pgm_š¡_t + + gcmd_¿nge + = { + +439 . +f + = +cmd_¿nge_·r£d +, + +440 . + gd©a + = +NULL +, + +441 . + gh–p_¡r + = "start/stop/show current„angeing", + +442 . + gtok’s + = { + +443 ( +´og_void + *)& +cmd_¿nge_¿nge +, + +444 ( +´og_void + *)& +cmd_¿nge_aùiÚ +, + +445 +NULL +, + +452  + scmd_¿nge_³riod_»suÉ + { + +453 +fixed_¡ršg_t + + m¿nge +; + +454 +fixed_¡ršg_t + + maùiÚ +; + +455 +ušt32_t + + m³riod +; + +459  + $cmd_¿nge_³riod_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +460 * +d©a +) + +462  +cmd_¿nge_³riod_»suÉ + * +»s + = +·r£d_»suÉ +; + +464 ià( +»s +-> +³riod + < 10) { + +465 + `´štf +("error, minimum…eriod is 10 ms\n"); + +469 +¿nge_³riod_ms + = +»s +-> +³riod +; + +470 + } +} + +472 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_³riod_¿nge_³riod + = + +473 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +¿nge +, + +475 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_³riod_aùiÚ + = + +476 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +aùiÚ +, + +478 +·r£_pgm_tok’_num_t + + gcmd_¿nge_³riod_³riod + = + +479 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_³riod_»suÉ +, +³riod +, +UINT32 +); + +482 +·r£_pgm_š¡_t + + gcmd_¿nge_³riod + = { + +483 . +f + = +cmd_¿nge_³riod_·r£d +, + +484 . + gd©a + = +NULL +, + +485 . + gh–p_¡r + = "set„angeest…eriod", + +486 . + gtok’s + = { + +487 ( +´og_void + *)& +cmd_¿nge_³riod_¿nge_³riod +, + +488 ( +´og_void + *)& +cmd_¿nge_³riod_aùiÚ +, + +489 ( +´og_void + *)& +cmd_¿nge_³riod_³riod +, + +490 +NULL +, + +497  + scmd_¿nge_couÁ_»suÉ + { + +498 +fixed_¡ršg_t + + m¿nge +; + +499 +fixed_¡ršg_t + + maùiÚ +; + +500 +ušt32_t + + mcouÁ +; + +504  + $cmd_¿nge_couÁ_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +505 * +d©a +) + +507  +cmd_¿nge_couÁ_»suÉ + * +»s + = +·r£d_»suÉ +; + +508 +¿nge_couÁ + = +»s +-> +couÁ +; + +509 + } +} + +511 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_couÁ_¿nge_couÁ + = + +512 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +¿nge +, + +514 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_couÁ_aùiÚ + = + +515 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +aùiÚ +, + +517 +·r£_pgm_tok’_num_t + + gcmd_¿nge_couÁ_couÁ + = + +518 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_couÁ_»suÉ +, +couÁ +, +UINT32 +); + +521 +·r£_pgm_š¡_t + + gcmd_¿nge_couÁ + = { + +522 . +f + = +cmd_¿nge_couÁ_·r£d +, + +523 . + gd©a + = +NULL +, + +524 . + gh–p_¡r + = "set„angeest count", + +525 . + gtok’s + = { + +526 ( +´og_void + *)& +cmd_¿nge_couÁ_¿nge_couÁ +, + +527 ( +´og_void + *)& +cmd_¿nge_couÁ_aùiÚ +, + +528 ( +´og_void + *)& +cmd_¿nge_couÁ_couÁ +, + +529 +NULL +, + +536  + scmd_¿nge_pow”mask_»suÉ + { + +537 +fixed_¡ršg_t + + m¿nge +; + +538 +fixed_¡ršg_t + + maùiÚ +; + +539 +ušt8_t + + mpow”mask +; + +543  + $cmd_¿nge_pow”mask_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +544 * +d©a +) + +546  +cmd_¿nge_pow”mask_»suÉ + * +»s + = +·r£d_»suÉ +; + +547 +¿nge_pow”mask + = +»s +-> +pow”mask +; + +548 + } +} + +550 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_pow”mask_¿nge_pow”mask + = + +551 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +¿nge +, + +553 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_pow”mask_aùiÚ + = + +554 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +aùiÚ +, + +556 +·r£_pgm_tok’_num_t + + gcmd_¿nge_pow”mask_pow”mask + = + +557 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_pow”mask_»suÉ +, +pow”mask +, + +558 +UINT8 +); + +561 +·r£_pgm_š¡_t + + gcmd_¿nge_pow”mask + = { + +562 . +f + = +cmd_¿nge_pow”mask_·r£d +, + +563 . + gd©a + = +NULL +, + +564 . + gh–p_¡r + = "set„angeest…owermask", + +565 . + gtok’s + = { + +566 ( +´og_void + *)& +cmd_¿nge_pow”mask_¿nge_pow”mask +, + +567 ( +´og_void + *)& +cmd_¿nge_pow”mask_aùiÚ +, + +568 ( +´og_void + *)& +cmd_¿nge_pow”mask_pow”mask +, + +569 +NULL +, + +576  + scmd_¿nge_d¡addr_»suÉ + { + +577 +fixed_¡ršg_t + + m¿nge +; + +578 +fixed_¡ršg_t + + maùiÚ +; + +579 +ušt64_t + + md¡addr +; + +583  + $cmd_¿nge_d¡addr_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +584 * +d©a +) + +586  +cmd_¿nge_d¡addr_»suÉ + * +»s + = +·r£d_»suÉ +; + +588 +¿nge_d¡addr + = +»s +-> +d¡addr +; + +589 + } +} + +591 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_d¡addr_¿nge_d¡addr + = + +592 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +¿nge +, + +594 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿nge_d¡addr_aùiÚ + = + +595 +TOKEN_STRING_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +aùiÚ +, + +597 +·r£_pgm_tok’_num_t + + gcmd_¿nge_d¡addr_d¡addr + = + +598 +TOKEN_NUM_INITIALIZER +( +cmd_¿nge_d¡addr_»suÉ +, +d¡addr +, +UINT64 +); + +601 +·r£_pgm_š¡_t + + gcmd_¿nge_d¡addr + = { + +602 . +f + = +cmd_¿nge_d¡addr_·r£d +, + +603 . + gd©a + = +NULL +, + +604 . + gh–p_¡r + = "set„egister„angeing dstaddr", + +605 . + gtok’s + = { + +606 ( +´og_void + *)& +cmd_¿nge_d¡addr_¿nge_d¡addr +, + +607 ( +´og_void + *)& +cmd_¿nge_d¡addr_aùiÚ +, + +608 ( +´og_void + *)& +cmd_¿nge_d¡addr_d¡addr +, + +609 +NULL +, + +616  + scmd_pšg_»suÉ + { + +617 +fixed_¡ršg_t + + mpšg +; + +621  + $cmd_pšg_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +623 + `xb“­p_£nd_©cmd +("VL", +NULL +, 0, 1); + +624 + } +} + +626 +·r£_pgm_tok’_¡ršg_t + + gcmd_pšg_pšg + = + +627 +TOKEN_STRING_INITIALIZER +( +cmd_pšg_»suÉ +, +pšg +, "ping"); + +629 +·r£_pgm_š¡_t + + gcmd_pšg + = { + +630 . +f + = +cmd_pšg_·r£d +, + +631 . + gd©a + = +NULL +, + +632 . + gh–p_¡r + = "Send‡…ingohe xbee device", + +633 . + gtok’s + = { + +634 ( +´og_void + *)& +cmd_pšg_pšg +, + +635 +NULL +, + +642  + scmd_¿w_»suÉ + { + +643 +fixed_¡ršg_t + + m¿w +; + +647  + $cmd_¿w_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +649 + `´štf +("switchedo„aw mode, CTRL-Doƒxit\n"); + +650 + `rdlše_¡Ý +(& +þ +-> +rdl +); + +651 +xb“_¿w + = 1; + +652 + } +} + +654 +·r£_pgm_tok’_¡ršg_t + + gcmd_¿w_¿w + = + +655 +TOKEN_STRING_INITIALIZER +( +cmd_¿w_»suÉ +, +¿w +, "raw"); + +657 +·r£_pgm_š¡_t + + gcmd_¿w + = { + +658 . +f + = +cmd_¿w_·r£d +, + +659 . + gd©a + = +NULL +, + +660 . + gh–p_¡r + = "Switcho„aw mode", + +661 . + gtok’s + = { + +662 ( +´og_void + *)& +cmd_¿w_¿w +, + +663 +NULL +, + +670  + scmd_dump_»suÉ + { + +671 +fixed_¡ršg_t + + mdump +; + +672 +fixed_¡ršg_t + + mÚoff +; + +676  + $cmd_dump_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +678  +cmd_dump_»suÉ + * +»s + = +·r£d_»suÉ +; + +679 ià(! + `¡rcmp +( +»s +-> +Úoff +, "on")) + +680 +xb“_hexdump + = 1; + +682 +xb“_hexdump + = 0; + +683 + } +} + +685 +·r£_pgm_tok’_¡ršg_t + + gcmd_dump_dump + = + +686 +TOKEN_STRING_INITIALIZER +( +cmd_dump_»suÉ +, +dump +, "dump"); + +688 +·r£_pgm_tok’_¡ršg_t + + gcmd_dump_Úoff + = + +689 +TOKEN_STRING_INITIALIZER +( +cmd_dump_»suÉ +, +Úoff +, "on#off"); + +691 +·r£_pgm_š¡_t + + gcmd_dump + = { + +692 . +f + = +cmd_dump_·r£d +, + +693 . + gd©a + = +NULL +, + +694 . + gh–p_¡r + = "enable/disable hexdump of„eceived…ackets", + +695 . + gtok’s + = { + +696 ( +´og_void + *)& +cmd_dump_dump +, + +697 ( +´og_void + *)& +cmd_dump_Úoff +, + +698 +NULL +, + +705  + scmd_debug_»suÉ + { + +706 +fixed_¡ršg_t + + mdebug +; + +707 +fixed_¡ršg_t + + mÚoff +; + +711  + $cmd_debug_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +713  +cmd_debug_»suÉ + * +»s + = +·r£d_»suÉ +; + +714 ià(! + `¡rcmp +( +»s +-> +Úoff +, "on")) + +715 +xb“_debug + = 1; + +717 +xb“_debug + = 0; + +718 + } +} + +720 +·r£_pgm_tok’_¡ršg_t + + gcmd_debug_debug + = + +721 +TOKEN_STRING_INITIALIZER +( +cmd_debug_»suÉ +, +debug +, "debug"); + +723 +·r£_pgm_tok’_¡ršg_t + + gcmd_debug_Úoff + = + +724 +TOKEN_STRING_INITIALIZER +( +cmd_debug_»suÉ +, +Úoff +, "on#off"); + +726 +·r£_pgm_š¡_t + + gcmd_debug + = { + +727 . +f + = +cmd_debug_·r£d +, + +728 . + gd©a + = +NULL +, + +729 . + gh–p_¡r + = "enable/disable‡dditionnal debug", + +730 . + gtok’s + = { + +731 ( +´og_void + *)& +cmd_debug_debug +, + +732 ( +´og_void + *)& +cmd_debug_Úoff +, + +733 +NULL +, + +740  + scmd_h–p_»suÉ + { + +741 +fixed_¡ršg_t + + mh–p +; + +742  +xb“_©cmd + * + mcmd +; + +746  + $cmd_h–p_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +747 * +d©a +) + +749  +cmd_h–p_»suÉ + * +»s + = +·r£d_»suÉ +; + +750  +ty³ +; + +752 +ty³ + = ( +»s +-> +cmd +-> +æags + & ( +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +)); + +753  +ty³ +) { + +754  +XBEE_ATCMD_F_READ +: + +755 + `´štf +("Read-only\n"); + +757  +XBEE_ATCMD_F_WRITE +: + +758 + `´štf +("Write-only\n"); + +761 + `´štf +("Read-write\n"); + +764 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_NONE +) + +765 + `´štf +("No‡rgument\n"); + +766 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U8 +) + +767 + `´štf +("Register is unsigned 8 bits\n"); + +768 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U16 +) + +769 + `´štf +("Register is unsigned 16 bits\n"); + +770 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U32 +) + +771 + `´štf +("Register is unsigned 32 bits\n"); + +772 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_S16 +) + +773 + `´štf +("Register is signed 16 bits\n"); + +774 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_STRING_20B +) + +775 + `´štf +("Register is‡ 20 bytes string\n"); + +777 + `´štf +("Unknown‡rgument\n"); + +779 + `´štf +("%s\n", +»s +-> +cmd +-> +h–p +); + +780 + } +} + +782 +·r£_pgm_tok’_¡ršg_t + + gcmd_h–p_h–p + = + +783 +TOKEN_STRING_INITIALIZER +( +cmd_h–p_»suÉ +, +h–p +, "help"); + +785 +·r£_pgm_tok’_©cmd_t + + gcmd_h–p_©cmd + = + +786 +TOKEN_ATCMD_INITIALIZER +( +cmd_h–p_»suÉ +, +cmd +, & +xb“_dev +, + +789 +·r£_pgm_š¡_t + + gcmd_h–p + = { + +790 . +f + = +cmd_h–p_·r£d +, + +791 . + gd©a + = +NULL +, + +792 . + gh–p_¡r + = "Help‡„egister using‡n AT command", + +793 . + gtok’s + = { + +794 ( +´og_void + *)& +cmd_h–p_h–p +, + +795 ( +´og_void + *)& +cmd_h–p_©cmd +, + +796 +NULL +, + +803  + scmd_»ad_»suÉ + { + +804 +fixed_¡ršg_t + + m»ad +; + +805  +xb“_©cmd + * + mcmd +; + +809  + $cmd_»ad_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +810 * +d©a +) + +812  +cmd_»ad_»suÉ + * +»s + = +·r£d_»suÉ +; + +813 + `xb“­p_£nd_©cmd +( +»s +-> +cmd +-> +Çme +, +NULL +, 0, 1); + +814 + } +} + +816 +·r£_pgm_tok’_¡ršg_t + + gcmd_»ad_»ad + = + +817 +TOKEN_STRING_INITIALIZER +( +cmd_»ad_»suÉ +, +»ad +, "read"); + +819 +·r£_pgm_tok’_©cmd_t + + gcmd_»ad_©cmd + = + +820 +TOKEN_ATCMD_INITIALIZER +( +cmd_»ad_»suÉ +, +cmd +, & +xb“_dev +, + +821 +XBEE_ATCMD_F_READ +, XBEE_ATCMD_F_READ); + +823 +·r£_pgm_š¡_t + + gcmd_»ad + = { + +824 . +f + = +cmd_»ad_·r£d +, + +825 . + gd©a + = +NULL +, + +826 . + gh–p_¡r + = "Read‡„egister using‡n AT command", + +827 . + gtok’s + = { + +828 ( +´og_void + *)& +cmd_»ad_»ad +, + +829 ( +´og_void + *)& +cmd_»ad_©cmd +, + +830 +NULL +, + +837  + scmd_wr™e_»suÉ + { + +838 +fixed_¡ršg_t + + mwr™e +; + +839  +xb“_©cmd + * + mcmd +; + +841 +ušt8_t + + mu8 +; + +842 +ušt16_t + + mu16 +; + +843 +ušt32_t + + mu32 +; + +848  + $cmd_wr™e_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +849 * +d©a +) + +851  +cmd_wr™e_»suÉ + * +»s + = +·r£d_»suÉ +; + +852  +Ën +; + +853 * +·¿m +; + +855 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_NONE +) { + +856 +Ën + = 0; + +857 +·¿m + = +NULL +; + +859 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U8 +) { + +860 +Ën + = ( +»s +-> +u8 +); + +861 +·¿m + = & +»s +-> +u8 +; + +863 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U16 +) { + +864 +Ën + = ( +»s +-> +u16 +); + +865 +»s +-> +u16 + = + `htÚs +(res->u16); + +866 +·¿m + = & +»s +-> +u16 +; + +868 ià( +»s +-> +cmd +-> +æags + & +XBEE_ATCMD_F_PARAM_U32 +) { + +869 +Ën + = ( +»s +-> +u32 +); + +870 +»s +-> +u32 + = + `htÚl +(res->u32); + +871 +·¿m + = & +»s +-> +u32 +; + +874 + `´štf +("Unknown‡rgumentype\n"); + +877 + `xb“­p_£nd_©cmd +( +»s +-> +cmd +-> +Çme +, +·¿m +, +Ën +, 1); + +878 + } +} + +880 +·r£_pgm_tok’_¡ršg_t + + gcmd_wr™e_wr™e + = + +881 +TOKEN_STRING_INITIALIZER +( +cmd_wr™e_»suÉ +, +wr™e +, + +884 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_nÚe_©cmd + = + +885 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +886 & +xb“_dev +, + +887 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_NONE +, + +888 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_NONE +); + +890 +·r£_pgm_š¡_t + + gcmd_wr™e_nÚe + = { + +891 . +f + = +cmd_wr™e_·r£d +, + +892 . + gd©a + = +NULL +, + +893 . + gh–p_¡r + = "Send‡n AT command (no‡rgument)", + +894 . + gtok’s + = { + +895 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +896 ( +´og_void + *)& +cmd_wr™e_nÚe_©cmd +, + +897 +NULL +, + +901 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u8_©cmd + = + +902 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +903 & +xb“_dev +, + +904 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U8 +, + +905 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U8 +); + +907 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u8_u8 + = + +908 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u8 +, +UINT8 +); + +910 +·r£_pgm_š¡_t + + gcmd_wr™e_u8 + = { + +911 . +f + = +cmd_wr™e_·r£d +, + +912 . + gd©a + = +NULL +, + +913 . + gh–p_¡r + = "Write‡ 8 bits„egister using‡n AT command", + +914 . + gtok’s + = { + +915 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +916 ( +´og_void + *)& +cmd_wr™e_u8_©cmd +, + +917 ( +´og_void + *)& +cmd_wr™e_u8_u8 +, + +918 +NULL +, + +922 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u16_©cmd + = + +923 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +924 & +xb“_dev +, + +925 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U16 +, + +926 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U16 +); + +928 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u16_u16 + = + +929 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u16 +, +UINT16 +); + +931 +·r£_pgm_š¡_t + + gcmd_wr™e_u16 + = { + +932 . +f + = +cmd_wr™e_·r£d +, + +933 . + gd©a + = +NULL +, + +934 . + gh–p_¡r + = "Write‡ 16 bits„egister using‡n AT command", + +935 . + gtok’s + = { + +936 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +937 ( +´og_void + *)& +cmd_wr™e_u16_©cmd +, + +938 ( +´og_void + *)& +cmd_wr™e_u16_u16 +, + +939 +NULL +, + +943 +·r£_pgm_tok’_©cmd_t + + gcmd_wr™e_u32_©cmd + = + +944 +TOKEN_ATCMD_INITIALIZER +( +cmd_wr™e_»suÉ +, +cmd +, + +945 & +xb“_dev +, + +946 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U32 +, + +947 +XBEE_ATCMD_F_WRITE + | +XBEE_ATCMD_F_PARAM_U32 +); + +949 +·r£_pgm_tok’_num_t + + gcmd_wr™e_u32_u32 + = + +950 +TOKEN_NUM_INITIALIZER +( +cmd_wr™e_»suÉ +, +u32 +, +UINT32 +); + +952 +·r£_pgm_š¡_t + + gcmd_wr™e_u32 + = { + +953 . +f + = +cmd_wr™e_·r£d +, + +954 . + gd©a + = +NULL +, + +955 . + gh–p_¡r + = "Write‡ 32 bits„egister using‡n AT command", + +956 . + gtok’s + = { + +957 ( +´og_void + *)& +cmd_wr™e_wr™e +, + +958 ( +´og_void + *)& +cmd_wr™e_u32_©cmd +, + +959 ( +´og_void + *)& +cmd_wr™e_u32_u32 +, + +960 +NULL +, + +967  + scmd_£ndmsg_»suÉ + { + +968 +fixed_¡ršg_t + + m£ndmsg +; + +969 +ušt64_t + + maddr +; + +970 +fixed_¡ršg_t + + md©a +; + +974  + $cmd_£ndmsg_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +975 * +d©a +) + +977  +cmd_£ndmsg_»suÉ + * +»s + = +·r£d_»suÉ +; + +978 + `xb“­p_£nd_msg +( +»s +-> +addr +,„es-> +d©a +, + `¡¾’ +(res->data), 1); + +979 + } +} + +981 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_£ndmsg + = + +982 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +£ndmsg +, "sendmsg"); + +984 +·r£_pgm_tok’_num_t + + gcmd_£ndmsg_addr + = + +985 +TOKEN_NUM_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +addr +, +UINT64 +); + +987 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_d©a + = + +988 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_»suÉ +, +d©a +, +NULL +); + +990 +·r£_pgm_š¡_t + + gcmd_£ndmsg + = { + +991 . +f + = +cmd_£ndmsg_·r£d +, + +992 . + gd©a + = +NULL +, + +993 . + gh–p_¡r + = "Send datao‡‚ode using its‡ddress", + +994 . + gtok’s + = { + +995 ( +´og_void + *)& +cmd_£ndmsg_£ndmsg +, + +996 ( +´og_void + *)& +cmd_£ndmsg_addr +, + +997 ( +´og_void + *)& +cmd_£ndmsg_d©a +, + +998 +NULL +, + +1005  + scmd_£ndmsg_Çme_»suÉ + { + +1006 +fixed_¡ršg_t + + m£ndmsg_Çme +; + +1007  +xb“_Ãigh + * + mÃigh +; + +1008 +fixed_¡ršg_t + + md©a +; + +1012  + $cmd_£ndmsg_Çme_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, + +1013 * +d©a +) + +1015  +cmd_£ndmsg_Çme_»suÉ + * +»s + = +·r£d_»suÉ +; + +1016 + `xb“­p_£nd_msg +( +»s +-> +Ãigh +-> +addr +,„es-> +d©a +, + `¡¾’ +(res->data), 1); + +1017 + } +} + +1019 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_Çme_£ndmsg_Çme + = + +1020 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +£ndmsg_Çme +, + +1023 +·r£_pgm_tok’_ÃighbÜ_t + + gcmd_£ndmsg_Çme_Ãigh + = + +1024 +TOKEN_NEIGHBOR_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +Ãigh +, + +1025 & +xb“_dev +); + +1027 +·r£_pgm_tok’_¡ršg_t + + gcmd_£ndmsg_Çme_d©a + = + +1028 +TOKEN_STRING_INITIALIZER +( +cmd_£ndmsg_Çme_»suÉ +, +d©a +, +NULL +); + +1030 +·r£_pgm_š¡_t + + gcmd_£ndmsg_Çme + = { + +1031 . +f + = +cmd_£ndmsg_Çme_·r£d +, + +1032 . + gd©a + = +NULL +, + +1033 . + gh–p_¡r + = "Send datao‡‚ode using its‚ame", + +1034 . + gtok’s + = { + +1035 ( +´og_void + *)& +cmd_£ndmsg_Çme_£ndmsg_Çme +, + +1036 ( +´og_void + *)& +cmd_£ndmsg_Çme_Ãigh +, + +1037 ( +´og_void + *)& +cmd_£ndmsg_Çme_d©a +, + +1038 +NULL +, + +1044  + scmd_Ãigh_d–_»suÉ + { + +1045 +fixed_¡ršg_t + + mcmd +; + +1046 +fixed_¡ršg_t + + maùiÚ +; + +1047  +xb“_Ãigh + * + mÃigh +; + +1050  + $cmd_Ãigh_d–_·r£d +(* +·r£d_»suÉ +, + +1051  +cmdlše + * +þ +, + +1052 * +d©a +) + +1054  +cmd_Ãigh_d–_»suÉ + * +»s + = +·r£d_»suÉ +; + +1055 + `xb“_Ãigh_d– +( +xb“_dev +, +»s +-> +Ãigh +); + +1056 + } +} + +1058 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_d–_cmd + = + +1059 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +cmd +, "neigh"); + +1060 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_d–_aùiÚ + = + +1061 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +aùiÚ +, "del"); + +1062 +·r£_pgm_tok’_ÃighbÜ_t + + gcmd_Ãigh_d–_Ãigh + = + +1063 +TOKEN_NEIGHBOR_INITIALIZER +( +cmd_Ãigh_d–_»suÉ +, +Ãigh +, + +1064 & +xb“_dev +); + +1066 +·r£_pgm_š¡_t + + gcmd_Ãigh_d– + = { + +1067 . +f + = +cmd_Ãigh_d–_·r£d +, + +1068 . + gd©a + = +NULL +, + +1069 . + gh–p_¡r + = "delete‡‚eighbor", + +1070 . + gtok’s + = { + +1071 ( +´og_void + *)& +cmd_Ãigh_d–_cmd +, + +1072 ( +´og_void + *)& +cmd_Ãigh_d–_aùiÚ +, + +1073 ( +´og_void + *)& +cmd_Ãigh_d–_Ãigh +, + +1074 +NULL +, + +1080  + scmd_Ãigh_add_»suÉ + { + +1081 +fixed_¡ršg_t + + mcmd +; + +1082 +fixed_¡ršg_t + + maùiÚ +; + +1083 +fixed_¡ršg_t + + mÇme +; + +1084 +ušt64_t + + maddr +; + +1087  + $cmd_Ãigh_add_·r£d +(* +·r£d_»suÉ +, + +1088  +cmdlše + * +þ +, + +1089 * +d©a +) + +1091  +cmd_Ãigh_add_»suÉ + * +»s + = +·r£d_»suÉ +; + +1092 ià( + `xb“_Ãigh_add +( +xb“_dev +, +»s +-> +Çme +,„es-> +addr +è=ð +NULL +) + +1093 + `´štf +("name or‡ddr‡lreadyƒxist\n"); + +1094 + } +} + +1096 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_cmd + = + +1097 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +cmd +, "neigh"); + +1098 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_aùiÚ + = + +1099 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +aùiÚ +, "add"); + +1100 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_add_Çme + = + +1101 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +Çme +, +NULL +); + +1102 +·r£_pgm_tok’_num_t + + gcmd_Ãigh_add_addr + = + +1103 +TOKEN_NUM_INITIALIZER +( +cmd_Ãigh_add_»suÉ +, +addr +, +UINT64 +); + +1105 +·r£_pgm_š¡_t + + gcmd_Ãigh_add + = { + +1106 . +f + = +cmd_Ãigh_add_·r£d +, + +1107 . + gd©a + = +NULL +, + +1108 . + gh–p_¡r + = "add‡‚eighbor", + +1109 . + gtok’s + = { + +1110 ( +´og_void + *)& +cmd_Ãigh_add_cmd +, + +1111 ( +´og_void + *)& +cmd_Ãigh_add_aùiÚ +, + +1112 ( +´og_void + *)& +cmd_Ãigh_add_Çme +, + +1113 ( +´og_void + *)& +cmd_Ãigh_add_addr +, + +1114 +NULL +, + +1120  + scmd_Ãigh_li¡_»suÉ + { + +1121 +fixed_¡ršg_t + + mcmd +; + +1122 +fixed_¡ršg_t + + maùiÚ +; + +1125  + $cmd_Ãigh_li¡_·r£d +(* +·r£d_»suÉ +, + +1126  +cmdlše + * +þ +, + +1127 * +d©a +) + +1129  +xb“_Ãigh + * +Ãigh +; + +1131 + `LIST_FOREACH +( +Ãigh +, & +xb“_dev +-> +Ãigh_li¡ +, +Ãxt +) { + +1132 + `´štf +(" %s: 0x%" +PRIx64 +"\n", +Ãigh +-> +Çme +,‚eigh-> +addr +); + +1134 + } +} + +1136 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_li¡_cmd + = + +1137 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_li¡_»suÉ +, +cmd +, "neigh"); + +1138 +·r£_pgm_tok’_¡ršg_t + + gcmd_Ãigh_li¡_aùiÚ + = + +1139 +TOKEN_STRING_INITIALIZER +( +cmd_Ãigh_li¡_»suÉ +, +aùiÚ +, "list"); + +1141 +·r£_pgm_š¡_t + + gcmd_Ãigh_li¡ + = { + +1142 . +f + = +cmd_Ãigh_li¡_·r£d +, + +1143 . + gd©a + = +NULL +, + +1144 . + gh–p_¡r + = "list‡ll known‚eighbors", + +1145 . + gtok’s + = { + +1146 ( +´og_void + *)& +cmd_Ãigh_li¡_cmd +, + +1147 ( +´og_void + *)& +cmd_Ãigh_li¡_aùiÚ +, + +1148 +NULL +, + +1154  + scmd_logfže_»suÉ + { + +1155 +fixed_¡ršg_t + + mlogfže +; + +1156 +fž’ame_t + + mfže +; + +1159  + $cmd_logfže_·r£d +(* +·r£d_»suÉ +, + +1160  +cmdlše + * +þ +, + +1161 * +d©a +) + +1163 ià( +xb“_logfže + !ð +NULL +) + +1164 + `fþo£ +( +xb“_logfže +); + +1165 +xb“_logfže + = + `fݒ +( +xb“_logfž’ame +, "a"); + +1166 ià( +xb“_logfže + =ð +NULL +) + +1167 + `´štf +("ÿÂÙ o³Àfže: %s\n", + `¡»¼Ü +( +”ºo +)); + +1168 + `årštf +( +xb“_logfže +, "-------------------start\n"); + +1169 + `´štf +("enabling†og\n"); + +1170 + } +} + +1172 +·r£_pgm_tok’_¡ršg_t + + gcmd_logfže_logfže + = + +1173 +TOKEN_STRING_INITIALIZER +( +cmd_logfže_»suÉ +, +logfže +, "logfile"); + +1175 +·r£_pgm_tok’_fže_t + + gcmd_logfže_fže + = + +1176 +TOKEN_FILE_INITIALIZER +( +cmd_logfže_»suÉ +, +fže +, + +1177 +PARSE_FILE_F_CREATE +); + +1179 +·r£_pgm_š¡_t + + gcmd_logfže + = { + +1180 . +f + = +cmd_logfže_·r£d +, + +1181 . + gd©a + = +NULL +, + +1182 . + gh–p_¡r + = " set†og file", + +1183 . + gtok’s + = { + +1184 ( +´og_void + *)& +cmd_logfže_logfže +, + +1185 ( +´og_void + *)& +cmd_logfže_fže +, + +1186 +NULL +, + +1193  + scmd_log_»suÉ + { + +1194 +fixed_¡ršg_t + + mlog +; + +1195 +fixed_¡ršg_t + + mÚoff +; + +1199  + $cmd_log_·r£d +(* +·r£d_»suÉ +,  +cmdlše + * +þ +, * +d©a +) + +1201  +cmd_log_»suÉ + * +»s + = +·r£d_»suÉ +; + +1202 ià(! + `¡rcmp +( +»s +-> +Úoff +, "Ú"è&& +xb“_logfže + =ð +NULL +) { + +1203 +xb“_logfže + = + `fݒ +( +xb“_logfž’ame +, "a"); + +1204 ià( +xb“_logfže + =ð +NULL +) + +1205 + `´štf +("ÿÂÙ o³Àfže: %s\n", + `¡»¼Ü +( +”ºo +)); + +1206 + `årštf +( +xb“_logfže +, "-------------------start\n"); + +1208 ià(! + `¡rcmp +( +»s +-> +Úoff +, "off"è&& +xb“_logfže + !ð +NULL +) { + +1209 + `fþo£ +( +xb“_logfže +); + +1210 +xb“_logfže + = +NULL +; + +1212 + } +} + +1214 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_log + = + +1215 +TOKEN_STRING_INITIALIZER +( +cmd_log_»suÉ +, +log +, "log"); + +1217 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_Úoff + = + +1218 +TOKEN_STRING_INITIALIZER +( +cmd_log_»suÉ +, +Úoff +, "on#off"); + +1220 +·r£_pgm_š¡_t + + gcmd_log + = { + +1221 . +f + = +cmd_log_·r£d +, + +1222 . + gd©a + = +NULL +, + +1223 . + gh–p_¡r + = "enable/disable hexlog of„eceived…ackets", + +1224 . + gtok’s + = { + +1225 ( +´og_void + *)& +cmd_log_log +, + +1226 ( +´og_void + *)& +cmd_log_Úoff +, + +1227 +NULL +, + +1234  + scmd_§vecÚfig_»suÉ + { + +1235 +fixed_¡ršg_t + + m§vecÚfig +; + +1236 +fž’ame_t + + mfže +; + +1239  + $cmd_§vecÚfig_·r£d +(* +·r£d_»suÉ +, + +1240  +cmdlše + * +þ +, + +1241 * +d©a +) + +1243  +cmd_§vecÚfig_»suÉ + * +»s + = +·r£d_»suÉ +; + +1245 ià( + `xb“­p_dump_cÚfig +( +»s +-> +fže +) < 0) + +1246 + `´štf +("cannot save config\n"); + +1247 + } +} + +1249 +·r£_pgm_tok’_¡ršg_t + + gcmd_§vecÚfig_§vecÚfig + = + +1250 +TOKEN_STRING_INITIALIZER +( +cmd_§vecÚfig_»suÉ +, +§vecÚfig +, + +1253 +·r£_pgm_tok’_fže_t + + gcmd_§vecÚfig_fže + = + +1254 +TOKEN_FILE_INITIALIZER +( +cmd_§vecÚfig_»suÉ +, +fže +, + +1255 +PARSE_FILE_F_CREATE +); + +1257 +·r£_pgm_š¡_t + + gcmd_§vecÚfig + = { + +1258 . +f + = +cmd_§vecÚfig_·r£d +, + +1259 . + gd©a + = +NULL +, + +1260 . + gh–p_¡r + = " set†og file", + +1261 . + gtok’s + = { + +1262 ( +´og_void + *)& +cmd_§vecÚfig_§vecÚfig +, + +1263 ( +´og_void + *)& +cmd_§vecÚfig_fže +, + +1264 +NULL +, + +1270  + scmd_lßdcÚfig_»suÉ + { + +1271 +fixed_¡ršg_t + + mlßdcÚfig +; + +1272 +fž’ame_t + + mfže +; + +1275  + $cmd_lßdcÚfig_·r£d +(* +·r£d_»suÉ +, + +1276  +cmdlše + * +þ +, + +1277 * +d©a +) + +1279 + } +} + +1281 +·r£_pgm_tok’_¡ršg_t + + gcmd_lßdcÚfig_lßdcÚfig + = + +1282 +TOKEN_STRING_INITIALIZER +( +cmd_lßdcÚfig_»suÉ +, +lßdcÚfig +, + +1285 +·r£_pgm_tok’_fže_t + + gcmd_lßdcÚfig_fže + = + +1286 +TOKEN_FILE_INITIALIZER +( +cmd_lßdcÚfig_»suÉ +, +fže +, + +1287 +PARSE_FILE_F_CREATE +); + +1289 +·r£_pgm_š¡_t + + gcmd_lßdcÚfig + = { + +1290 . +f + = +cmd_lßdcÚfig_·r£d +, + +1291 . + gd©a + = +NULL +, + +1292 . + gh–p_¡r + = " set†og file", + +1293 . + gtok’s + = { + +1294 ( +´og_void + *)& +cmd_lßdcÚfig_lßdcÚfig +, + +1295 ( +´og_void + *)& +cmd_lßdcÚfig_fže +, + +1296 +NULL +, + +1305 +·r£_ùx_t + + gmaš_ùx + = { + +1306 . +Çme + = "main", + +1307 . + gš¡s + = { + +1308 ( +·r£_pgm_š¡_t + *)& +cmd_¡©s +, + +1309 ( +·r£_pgm_š¡_t + *)& +cmd_mÚ™Ü +, + +1310 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_³riod +, + +1311 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_add +, + +1312 ( +·r£_pgm_š¡_t + *)& +cmd_mڙÜ_d– +, + +1313 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge +, + +1314 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_³riod +, + +1315 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_couÁ +, + +1316 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_pow”mask +, + +1317 ( +·r£_pgm_š¡_t + *)& +cmd_¿nge_d¡addr +, + +1318 ( +·r£_pgm_š¡_t + *)& +cmd_pšg +, + +1319 ( +·r£_pgm_š¡_t + *)& +cmd_¿w +, + +1320 ( +·r£_pgm_š¡_t + *)& +cmd_dump +, + +1321 ( +·r£_pgm_š¡_t + *)& +cmd_debug +, + +1322 ( +·r£_pgm_š¡_t + *)& +cmd_h–p +, + +1323 ( +·r£_pgm_š¡_t + *)& +cmd_»ad +, + +1324 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_nÚe +, + +1325 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u8 +, + +1326 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u16 +, + +1327 ( +·r£_pgm_š¡_t + *)& +cmd_wr™e_u32 +, + +1328 ( +·r£_pgm_š¡_t + *)& +cmd_£ndmsg +, + +1329 ( +·r£_pgm_š¡_t + *)& +cmd_£ndmsg_Çme +, + +1330 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_d– +, + +1331 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_add +, + +1332 ( +·r£_pgm_š¡_t + *)& +cmd_Ãigh_li¡ +, + +1333 ( +·r£_pgm_š¡_t + *)& +cmd_logfže +, + +1334 ( +·r£_pgm_š¡_t + *)& +cmd_log +, + +1335 ( +·r£_pgm_š¡_t + *)& +cmd_§vecÚfig +, + +1336 ( +·r£_pgm_š¡_t + *)& +cmd_lßdcÚfig +, + +1337 +NULL +, + + @commands_gen.c + +23  + ~<¡dio.h +> + +24  + ~<¡ršg.h +> + +26  + ~ + +27  + ~ + +28  + ~ + +30  + ~ + +31  + ~<þock_time.h +> + +33  + ~ + +34  + ~ + +36  + ~ + +37  + ~<·r£.h +> + +38  + ~<·r£_¡ršg.h +> + +39  + ~<·r£_num.h +> + +41  + ~ + +43  + ~"maš.h +" + +44  + ~"cmdlše.h +" + +50  + scmd_»£t_»suÉ + { + +51 +fixed_¡ršg_t + + m¬g0 +; + +55  + $cmd_»£t_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +57 #ifdeà +HOST_VERSION + + +58 + `ho¡sim_ex™ +(); + +60 + `»£t +(); + +61 + } +} + +63 +´og_ch¬ + + g¡r_»£t_¬g0 +[] = "reset"; + +64 +·r£_pgm_tok’_¡ršg_t + + gcmd_»£t_¬g0 + = +TOKEN_STRING_INITIALIZER +( +cmd_»£t_»suÉ +, +¬g0 +, +¡r_»£t_¬g0 +); + +66 +´og_ch¬ + + gh–p_»£t +[] = "Resethe board"; + +67 +·r£_pgm_š¡_t + + gcmd_»£t + = { + +68 . +f + = +cmd_»£t_·r£d +, + +69 . + gd©a + = +NULL +, + +70 . + gh–p_¡r + = +h–p_»£t +, + +71 . + gtok’s + = { + +72 ( +´og_void + *)& +cmd_»£t_¬g0 +, + +73 +NULL +, + +81  + scmd_boÙlßd”_»suÉ + { + +82 +fixed_¡ršg_t + + m¬g0 +; + +86  + $cmd_boÙlßd”_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +88 #iâdeà +HOST_VERSION + + +89 + `boÙlßd” +(); + +91 + `´štf +("not implemented\n"); + +93 + } +} + +95 +´og_ch¬ + + g¡r_boÙlßd”_¬g0 +[] = "bootloader"; + +96 +·r£_pgm_tok’_¡ršg_t + + gcmd_boÙlßd”_¬g0 + = +TOKEN_STRING_INITIALIZER +( +cmd_boÙlßd”_»suÉ +, +¬g0 +, +¡r_boÙlßd”_¬g0 +); + +98 +´og_ch¬ + + gh–p_boÙlßd” +[] = "Launchhe bootloader"; + +99 +·r£_pgm_š¡_t + + gcmd_boÙlßd” + = { + +100 . +f + = +cmd_boÙlßd”_·r£d +, + +101 . + gd©a + = +NULL +, + +102 . + gh–p_¡r + = +h–p_boÙlßd” +, + +103 . + gtok’s + = { + +104 ( +´og_void + *)& +cmd_boÙlßd”_¬g0 +, + +105 +NULL +, + +113  + scmd_scheduËr_»suÉ + { + +114 +fixed_¡ršg_t + + m¬g0 +; + +115 +fixed_¡ršg_t + + m¬g1 +; + +119  + $cmd_scheduËr_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +121 + `scheduËr_dump_ev’ts +(); + +122 + `scheduËr_¡©s_dump +(); + +123 + } +} + +125 +´og_ch¬ + + g¡r_scheduËr_¬g0 +[] = "scheduler"; + +126 +·r£_pgm_tok’_¡ršg_t + + gcmd_scheduËr_¬g0 + = +TOKEN_STRING_INITIALIZER +( +cmd_scheduËr_»suÉ +, +¬g0 +, +¡r_scheduËr_¬g0 +); + +127 +´og_ch¬ + + g¡r_scheduËr_¬g1 +[] = "show"; + +128 +·r£_pgm_tok’_¡ršg_t + + gcmd_scheduËr_¬g1 + = +TOKEN_STRING_INITIALIZER +( +cmd_scheduËr_»suÉ +, +¬g1 +, +¡r_scheduËr_¬g1 +); + +130 +´og_ch¬ + + gh–p_scheduËr +[] = "Show schedulerƒvents"; + +131 +·r£_pgm_š¡_t + + gcmd_scheduËr + = { + +132 . +f + = +cmd_scheduËr_·r£d +, + +133 . + gd©a + = +NULL +, + +134 . + gh–p_¡r + = +h–p_scheduËr +, + +135 . + gtok’s + = { + +136 ( +´og_void + *)& +cmd_scheduËr_¬g0 +, + +137 ( +´og_void + *)& +cmd_scheduËr_¬g1 +, + +138 +NULL +, + +146  + scmd_log_»suÉ + { + +147 +fixed_¡ršg_t + + m¬g0 +; + +148 +fixed_¡ršg_t + + m¬g1 +; + +149 +ušt8_t + + m¬g2 +; + +150 +fixed_¡ršg_t + + m¬g3 +; + +154 cÚ¡ +´og_ch¬ + + gu¬t_log +[] = "uart"; + +155 cÚ¡ +´og_ch¬ + + gi2c_log +[] = "i2c"; + +156 cÚ¡ +´og_ch¬ + + gdeçuÉ_log +[] = "default"; + +158  + slog_Çme_ªd_num + { + +159 cÚ¡ +´og_ch¬ + * + mÇme +; + +160 +ušt8_t + + mnum +; + +163 cÚ¡  +log_Çme_ªd_num + + glog_Çme_ªd_num +[] = { + +164 { +u¬t_log +, +E_UART + }, + +165 { +i2c_log +, +E_I2C + }, + +166 { +deçuÉ_log +, +E_USER_DEFAULT + }, + +169  +ušt8_t + + +170 + $log_Çme2num +(cÚ¡ * +s +) + +172 +ušt8_t + +i +; + +174  +i +=0; i<( +log_Çme_ªd_num +)/(log_name_and_num); i++) { + +175 ià(! + `¡rcmp_P +( +s +, +log_Çme_ªd_num +[ +i +]. +Çme +)) { + +176  +log_Çme_ªd_num +[ +i +]. +num +; + +180 + } +} + +182 cÚ¡ +´og_ch¬ + * + +183 + $log_num2Çme +( +ušt8_t + +num +) + +185 +ušt8_t + +i +; + +187  +i +=0; i<( +log_Çme_ªd_num +)/(log_name_and_num); i++) { + +188 ià( +num + =ð +log_Çme_ªd_num +[ +i +].num) { + +189  +log_Çme_ªd_num +[ +i +]. +Çme +; + +192  +NULL +; + +193 + } +} + +196  + $cmd_log_do_show +() + +198 +ušt8_t + +i +, +em±y +=1; + +199 cÚ¡ +´og_ch¬ + * +Çme +; + +201 + `´štf_P +( + `PSTR +("log†ev– i %d\r\n"), +xb“bßrd +. +log_Ëv– +); + +202  +i +=0; i< +NB_LOGS +; i++) { + +203 +Çme + = + `log_num2Çme +( +xb“bßrd +. +logs +[ +i +]); + +204 ià( +Çme +) { + +205 #ifdeà +HOST_VERSION + + +206 + `´štf_P +( + `PSTR +("logy³ % i Ú\r\n"), +Çme +); + +208 + `´štf_P +( + `PSTR +("logy³ %S i Ú\r\n"), +Çme +); + +210 +em±y + = 0; + +213 ià( +em±y +) + +214 + `´štf_P +( + `PSTR +("no†og configured\r\n")); + +215 + } +} + +218  + $cmd_log_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +220  +cmd_log_»suÉ + * +»s + = (cmd_log_»suÉ *è +·r£d_»suÉ +; + +222 ià(! + `¡rcmp_P +( +»s +-> +¬g1 +, + `PSTR +("level"))) { + +223 +xb“bßrd +. +log_Ëv– + = +»s +-> +¬g2 +; + +227 + `cmd_log_do_show +(); + +228 + } +} + +230 +´og_ch¬ + + g¡r_log_¬g0 +[] = "log"; + +231 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g0 + = +TOKEN_STRING_INITIALIZER +( +cmd_log_»suÉ +, +¬g0 +, +¡r_log_¬g0 +); + +232 +´og_ch¬ + + g¡r_log_¬g1 +[] = "level"; + +233 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g1 + = +TOKEN_STRING_INITIALIZER +( +cmd_log_»suÉ +, +¬g1 +, +¡r_log_¬g1 +); + +234 +·r£_pgm_tok’_num_t + + gcmd_log_¬g2 + = +TOKEN_NUM_INITIALIZER +( +cmd_log_»suÉ +, +¬g2 +, +INT8 +); + +236 +´og_ch¬ + + gh–p_log +[] = "Set†og options:†evel (0 -> 5)"; + +237 +·r£_pgm_š¡_t + + gcmd_log + = { + +238 . +f + = +cmd_log_·r£d +, + +239 . + gd©a + = +NULL +, + +240 . + gh–p_¡r + = +h–p_log +, + +241 . + gtok’s + = { + +242 ( +´og_void + *)& +cmd_log_¬g0 +, + +243 ( +´og_void + *)& +cmd_log_¬g1 +, + +244 ( +´og_void + *)& +cmd_log_¬g2 +, + +245 +NULL +, + +249 +´og_ch¬ + + g¡r_log_¬g1_show +[] = "show"; + +250 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g1_show + = +TOKEN_STRING_INITIALIZER +( +cmd_log_»suÉ +, +¬g1 +, +¡r_log_¬g1_show +); + +252 +´og_ch¬ + + gh–p_log_show +[] = "Show configured†ogs"; + +253 +·r£_pgm_š¡_t + + gcmd_log_show + = { + +254 . +f + = +cmd_log_·r£d +, + +255 . + gd©a + = +NULL +, + +256 . + gh–p_¡r + = +h–p_log_show +, + +257 . + gtok’s + = { + +258 ( +´og_void + *)& +cmd_log_¬g0 +, + +259 ( +´og_void + *)& +cmd_log_¬g1_show +, + +260 +NULL +, + +265  + scmd_log_ty³_»suÉ + { + +266 +fixed_¡ršg_t + + m¬g0 +; + +267 +fixed_¡ršg_t + + m¬g1 +; + +268 +fixed_¡ršg_t + + m¬g2 +; + +269 +fixed_¡ršg_t + + m¬g3 +; + +273  + $cmd_log_ty³_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +275  +cmd_log_ty³_»suÉ + * +»s + = (cmd_log_ty³_»suÉ *è +·r£d_»suÉ +; + +276 +ušt8_t + +lognum +; + +277 +ušt8_t + +i +; + +279 +lognum + = + `log_Çme2num +( +»s +-> +¬g2 +); + +280 ià( +lognum + == 0) { + +281 + `´štf_P +( + `PSTR +("Cannot find†og‚um\r\n")); + +285 ià(! + `¡rcmp_P +( +»s +-> +¬g3 +, + `PSTR +("on"))) { + +286  +i +=0; i< +NB_LOGS +; i++) { + +287 ià( +xb“bßrd +. +logs +[ +i +] =ð +lognum +) { + +288 + `´štf_P +( + `PSTR +("Already on\r\n")); + +292  +i +=0; i< +NB_LOGS +; i++) { + +293 ià( +xb“bßrd +. +logs +[ +i +] == 0) { + +294 +xb“bßrd +. +logs +[ +i +] = +lognum +; + +298 ià( +i +== +NB_LOGS +) { + +299 + `´štf_P +( + `PSTR +("no more„oom\r\n")); + +302 ià(! + `¡rcmp_P +( +»s +-> +¬g3 +, + `PSTR +("off"))) { + +303  +i +=0; i< +NB_LOGS +; i++) { + +304 ià( +xb“bßrd +. +logs +[ +i +] =ð +lognum +) { + +305 +xb“bßrd +. +logs +[ +i +] = 0; + +309 ià( +i +== +NB_LOGS +) { + +310 + `´štf_P +( + `PSTR +("already off\r\n")); + +313 + `cmd_log_do_show +(); + +314 + } +} + +316 +´og_ch¬ + + g¡r_log_¬g1_ty³ +[] = "type"; + +317 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g1_ty³ + = +TOKEN_STRING_INITIALIZER +( +cmd_log_ty³_»suÉ +, +¬g1 +, +¡r_log_¬g1_ty³ +); + +319 +´og_ch¬ + + g¡r_log_¬g2_ty³ +[] = "uart#rs#servo#traj#i2c#oa#strat#i2cproto#ext#sensor#bd#cs"; + +320 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g2_ty³ + = +TOKEN_STRING_INITIALIZER +( +cmd_log_ty³_»suÉ +, +¬g2 +, +¡r_log_¬g2_ty³ +); + +321 +´og_ch¬ + + g¡r_log_¬g3 +[] = "on#off"; + +322 +·r£_pgm_tok’_¡ršg_t + + gcmd_log_¬g3 + = +TOKEN_STRING_INITIALIZER +( +cmd_log_ty³_»suÉ +, +¬g3 +, +¡r_log_¬g3 +); + +324 +´og_ch¬ + + gh–p_log_ty³ +[] = "Set†ogype"; + +325 +·r£_pgm_š¡_t + + gcmd_log_ty³ + = { + +326 . +f + = +cmd_log_ty³_·r£d +, + +327 . + gd©a + = +NULL +, + +328 . + gh–p_¡r + = +h–p_log_ty³ +, + +329 . + gtok’s + = { + +330 ( +´og_void + *)& +cmd_log_¬g0 +, + +331 ( +´og_void + *)& +cmd_log_¬g1_ty³ +, + +332 ( +´og_void + *)& +cmd_log_¬g2_ty³ +, + +333 ( +´og_void + *)& +cmd_log_¬g3 +, + +334 +NULL +, + +343  + scmd_¡ack_¥aû_»suÉ + { + +344 +fixed_¡ršg_t + + m¬g0 +; + +348  + $cmd_¡ack_¥aû_·r£d +(* +·r£d_»suÉ +, * +d©a +) + +350 #ifdeà +HOST_VERSION + + +351 + `´štf +("not implemented\n"); + +353 + `´štf +("» ¡ack: %d\r\n", + `mš_¡ack_¥aû_avažabË +()); + +355 + } +} + +357 +´og_ch¬ + + g¡r_¡ack_¥aû_¬g0 +[] = "stack_space"; + +358 +·r£_pgm_tok’_¡ršg_t + + gcmd_¡ack_¥aû_¬g0 + = +TOKEN_STRING_INITIALIZER +( +cmd_¡ack_¥aû_»suÉ +, +¬g0 +, +¡r_¡ack_¥aû_¬g0 +); + +360 +´og_ch¬ + + gh–p_¡ack_¥aû +[] = "Display„emaining stack space"; + +361 +·r£_pgm_š¡_t + + gcmd_¡ack_¥aû + = { + +362 . +f + = +cmd_¡ack_¥aû_·r£d +, + +363 . + gd©a + = +NULL +, + +364 . + gh–p_¡r + = +h–p_¡ack_¥aû +, + +365 . + gtok’s + = { + +366 ( +´og_void + *)& +cmd_¡ack_¥aû_¬g0 +, + +367 +NULL +, + + @diag_host.c + + @diagnostic.h + +22  + ~ + +36  +show_št_loÝ +(); + +42 +ušt16_t + +mš_¡ack_¥aû_avažabË +(); + + @diagnostic_config.h + +22 #iâdeà +_DEBUG_CONFIG_ + + +23  + #_DEBUG_CONFIG_ + 1.0 + +24 + + ) + +28  + #INTERRUPT_SHOW_PORT + +PORTA + + + ) + +29  + #INTERRUPT_SHOW_BIT + 3 + + ) + +35  + #MARK + 0x55 + + ) + + @error.c + +23  + ~<¡ršg.h +> + +25 #iâdeà +HOST_VERSION + + +26  + ~ + +29  + ~ + +30  + ~ + +32  +”rÜ_fù + + gg_”rÜ_fù +; + +35  + $”rÜ_š™ +() + +37 +ušt8_t + +æags +; + +38 + `IRQ_LOCK +( +æags +); + +39 + `mem£t +(& +g_”rÜ_fù +, 0, (g_error_fct)); + +40 + `IRQ_UNLOCK +( +æags +); + +41 + } +} + +44  +”rÜ + + $”rÜ_g’”©e +( +ušt8_t + +num +, ušt8_ˆ +£v”™y +, +PGM_P + +t +, + +45 +PGM_P + +f +, +ušt16_t + +l +) { + +46  +”rÜ + +e +; + +48 +e +. +”r_num + = +num +; + +49 +e +. +£v”™y + = severity; + +50 #ifdeà +ERROR_DUMP_TEXTLOG + + +51 +e +. +‹xt + = +t +; + +53 +e +. +‹xt + = + `PSTR +(""); + +55 #ifdeà +ERROR_DUMP_FILE_LINE + + +56 +e +. +fže + = +f +; + +57 +e +. +lše + = +l +; + +59 +e +. +fže + = + `PSTR +(""); + +60 +e +. +lše + = 0; + +62  +e +; + +63 + } +} + +67  +”rÜ_»gi¡”_em”g +((* +f +)( +”rÜ + *, ...)) + +69 +ušt8_t + +æags +; + +70 + `IRQ_LOCK +( +æags +); + +71 +g_”rÜ_fù +. +em”g + = +f +; + +72 + `IRQ_UNLOCK +( +æags +); + +73 + } +} + +76  +”rÜ_»gi¡”_”rÜ +((* +f +)( +”rÜ + *, ...)) + +78 +ušt8_t + +æags +; + +79 + `IRQ_LOCK +( +æags +); + +80 +g_”rÜ_fù +. +”rÜ + = +f +; + +81 + `IRQ_UNLOCK +( +æags +); + +82 + } +} + +85  +”rÜ_»gi¡”_w¬nšg +((* +f +)( +”rÜ + *, ...)) + +87 +ušt8_t + +æags +; + +88 + `IRQ_LOCK +( +æags +); + +89 +g_”rÜ_fù +. +w¬nšg + = +f +; + +90 + `IRQ_UNLOCK +( +æags +); + +91 + } +} + +94  +”rÜ_»gi¡”_nÙiû +((* +f +)( +”rÜ + *, ...)) + +96 +ušt8_t + +æags +; + +97 + `IRQ_LOCK +( +æags +); + +98 +g_”rÜ_fù +. +nÙiû + = +f +; + +99 + `IRQ_UNLOCK +( +æags +); + +100 + } +} + +103  +”rÜ_»gi¡”_debug +((* +f +)( +”rÜ + *, ...)) + +105 +ušt8_t + +æags +; + +106 + `IRQ_LOCK +( +æags +); + +107 +g_”rÜ_fù +. +debug + = +f +; + +108 + `IRQ_UNLOCK +( +æags +); + +109 + } +} + + @error.h + +22 #iâdeà +_ERROR_H_ + + +23  + #_ERROR_H_ + + + ) + +25 #iâdeà +_AVERSIVE_ERROR_H_ + + +29  + ~ + +30  + ~ + +31  + ~ + +33  + ~"”rÜ_cÚfig.h +" + +35  + #ERROR_SEVERITY_EMERG + 0 + + ) + +36  + #ERROR_SEVERITY_ERROR + 1 + + ) + +37  + #ERROR_SEVERITY_WARNING + 2 + + ) + +38  + #ERROR_SEVERITY_NOTICE + 3 + + ) + +39  + #ERROR_SEVERITY_DEBUG + 4 + + ) + +42  + s”rÜ + { + +43 +ušt8_t + + m”r_num +; + +44 +ušt8_t + + m£v”™y +; + +45 +PGM_P + + m‹xt +; + +46 +PGM_P + + mfže +; + +47 +ušt16_t + + mlše +; + +51  + s”rÜ_fù + { + +52 (* + mem”g +)( + m”rÜ + *, ...); + +53 (* + m”rÜ +)(error *, ...); + +54 (* + mw¬nšg +)( + m”rÜ + *, ...); + +55 (* + mnÙiû +)( + m”rÜ + *, ...); + +56 (* + mdebug +)( + m”rÜ + *, ...); + +59  +”rÜ_fù + +g_”rÜ_fù +; + +62  +”rÜ + +”rÜ_g’”©e +( +ušt8_t + +num +, ušt8_ˆ +£v”™y +, +PGM_P + +t +, PGM_P +f +, +ušt16_t + +l +); + +65  +”rÜ_»gi¡”_em”g +((* +f +)( +”rÜ + *, ...)); + +68  + `”rÜ_»gi¡”_”rÜ +((* +f +)( +”rÜ + *, ...)); + +71  + `”rÜ_»gi¡”_w¬nšg +((* +f +)( +”rÜ + *, ...)); + +74  + `”rÜ_»gi¡”_nÙiû +((* +f +)( +”rÜ + *, ...)); + +77  + `”rÜ_»gi¡”_debug +((* +f +)( +”rÜ + *, ...)); + +83  + #EMERG +( +num +, +‹xt +, ...) do { \ + +84 if( +g_”rÜ_fù +. +em”g +) { \ + +85  +”rÜ + +e + = + `”rÜ_g’”©e +( +num +, +ERROR_SEVERITY_EMERG +, \ + +86 + `PSTR +( +‹xt +), \ + +87 + `PSTR +( +__FILE__ +),\ + +88 +__LINE__ +); \ + +89 +g_”rÜ_fù +. + `em”g +(& +e +, ## +__VA_ARGS__ +); \ + +91 + } +} 0) + + ) + +94  + #ERROR +( +num +, +‹xt +, ...) do { \ + +95 if( +g_”rÜ_fù +. +”rÜ +) { \ + +96  +”rÜ + +e + = + `”rÜ_g’”©e +( +num +, +ERROR_SEVERITY_ERROR +, \ + +97 + `PSTR +( +‹xt +), \ + +98 + `PSTR +( +__FILE__ +),\ + +99 +__LINE__ +); \ + +100 +g_”rÜ_fù +. + `”rÜ +(& +e +, ## +__VA_ARGS__ +); \ + +102 } 0) + + ) + +105  + #WARNING +( +num +, +‹xt +, ...) do { \ + +106 if( +g_”rÜ_fù +. +w¬nšg +) { \ + +107  +”rÜ + +e + = + `”rÜ_g’”©e +( +num +, +ERROR_SEVERITY_WARNING +, \ + +108 + `PSTR +( +‹xt +), \ + +109 + `PSTR +( +__FILE__ +),\ + +110 +__LINE__ +); \ + +111 +g_”rÜ_fù +. + `w¬nšg +(& +e +, ## +__VA_ARGS__ +); \ + +113 } 0) + + ) + +116  + #NOTICE +( +num +, +‹xt +, ...) do { \ + +117 if( +g_”rÜ_fù +. +nÙiû +) { \ + +118  +”rÜ + +e + = + `”rÜ_g’”©e +( +num +, +ERROR_SEVERITY_NOTICE +, \ + +119 + `PSTR +( +‹xt +), \ + +120 + `PSTR +( +__FILE__ +),\ + +121 +__LINE__ +); \ + +122 +g_”rÜ_fù +. + `nÙiû +(& +e +, ## +__VA_ARGS__ +); \ + +124 } 0) + + ) + +127  + #DEBUG +( +num +, +‹xt +, ...) do { \ + +128 if( +g_”rÜ_fù +. +debug +) { \ + +129  +”rÜ + +e + = + `”rÜ_g’”©e +( +num +, +ERROR_SEVERITY_DEBUG +, \ + +130 + `PSTR +( +‹xt +), \ + +131 + `PSTR +( +__FILE__ +),\ + +132 +__LINE__ +); \ + +133 +g_”rÜ_fù +. + `debug +(& +e +, ## +__VA_ARGS__ +); \ + +135 } 0) + + ) + + @error_config.h + +22 #iâdeà +_ERROR_CONFIG_ + + +23  + #_ERROR_CONFIG_ + + + ) + +26  + #ERROR_DUMP_TEXTLOG + + + ) + +29  + #ERROR_DUMP_FILE_LINE + + + ) + + @general_errors.h + +30  + #EPERM_COMMENT + "O³¿tiڂم”m™‹d" + + ) + +33  + #ENOENT_COMMENT + "NØsuch fžÜ dœeùÜy" + + ) + +36  + #EIO_COMMENT + "I/Oƒ¼Ü" + + ) + +39  + #ENXIO_COMMENT + "NØsuch deviû o¸add»ss" + + ) + +42  + #E2BIG_COMMENT + "Argum’ˆli¡oØlÚg" + + ) + +45  + #EAGAIN_COMMENT + "Try‡gaš" + + ) + +48  + #ENOMEM_COMMENT + "OuˆoàmemÜy" + + ) + +51  + #EFAULT_COMMENT + "Bad‡dd»ss" + + ) + +54  + #EBUSY_COMMENT + "Deviû o¸»sourû busy" + + ) + +57  + #EINVAL_COMMENT + "Inv®id‡rgum’t" + + ) + +60  + #EUNKNOW_COMMENT + "Unkwowƒ¼Ü" + + ) + +65  + #E_UART + 129 + + ) + +66  + #E_ROBOT_SYSTEM + 130 + + ) + +67  + #E_MULTISERVO + 131 + + ) + +68  + #E_TRAJECTORY + 132 + + ) + +69  + #E_I2C + 133 + + ) + +70  + #E_BLOCKING_DETECTION_MANAGER + 134 + + ) + +71  + #E_OA + 135 + + ) + +72  + #E_SPI + 136 + + ) + +73  + #E_CC2420 + 137 + + ) + +74  + #E_TIME_EXT + 138 + + ) + + @i2c_config.h + +23  + #I2C_BITRATE + 1 + +24  + #I2C_PRESCALER + 3 + +25 + + ) + +27  + #I2C_SEND_BUFFER_SIZE + 32 + + ) + +30  + #I2C_RECV_BUFFER_SIZE + 32 + + ) + + @int_show.c + +22  + ~ + +23  + ~ + +24  + ~ + +27 #ifdeà +INTERRUPT_SHOW_PORT + + +40  + $show_št_loÝ +() + +42 + `sbi +( + `DDR +( +INTERRUPT_SHOW_PORT +), +INTERRUPT_SHOW_BIT +); + +45 + `cbi +( +INTERRUPT_SHOW_PORT +, +INTERRUPT_SHOW_BIT +); + +47 + `£i +(); + +48 + `nÝ +(); + +49 + `þi +(); + +51 + `sbi +( +INTERRUPT_SHOW_PORT +, +INTERRUPT_SHOW_BIT +); + +53 + `nÝ +(); + +55 + } +} + + @main.c + +28  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +34  + ~ + +36  + ~<¡dio.h +> + +37  + ~<¡ršg.h +> + +38  + ~<¡dšt.h +> + +39  + ~<š‰y³s.h +> + +40  + ~<¡dlib.h +> + +41  + ~<¡d¬g.h +> + +42  + ~<”ºo.h +> + +43  + ~<ùy³.h +> + +45  + ~ + +46  + ~<þock_time.h +> + +47  + ~<·r£.h +> + +48  + ~ + +49  + ~ + +51  + ~"xb“_ÃighbÜ.h +" + +52  + ~"xb“_©cmd.h +" + +53  + ~"xb“_¡©s.h +" + +54  + ~"xb“_buf.h +" + +55  + ~"xb“_´Ùo.h +" + +56  + ~"xb“.h +" + +57  + ~"cmdlše.h +" + +58  + ~"maš.h +" + +60  +xb“bßrd + + gxb“bßrd +; + +62  + #TIMEOUT_MS + 1000 + + ) + +65  +xb“_dev + * + gxb“_dev +; + +71  + gxb“_¿w + = 0; + +72  + gxb“_hexdump + = 0; + +73  + gxb“_debug + = 0; + +75  + $hexdump +(cÚ¡ * +t™Ë +, cÚ¡ * +buf +,  +Ën +) + +77  +i +, +out +, +ofs +; + +78 cÚ¡ * +d©a + = +buf +; + +79  + #LINE_LEN + 80 + + ) + +80  +lše +[ +LINE_LEN +]; + +82 + `´štf +("% © [%p],†’=%d\n", +t™Ë +, +d©a +, +Ën +); + +83 +ofs + = 0; + +84  +ofs + < +Ën +) { + +86 +out + = + `¢´štf +( +lše +, +LINE_LEN +, "%08X", +ofs +); + +87  +i +=0; +ofs ++˜< +Ën + && i<16; i++) + +88 +out + +ð + `¢´štf +( +lše ++out, +LINE_LEN + - out, " %02X", + +89 +d©a +[ +ofs ++ +i +]&0xff); + +90 ; +i +<=16;i++) + +91 +out + +ð + `¢´štf +( +lše ++out, +LINE_LEN + - out, " "); + +92  +i +=0; +ofs + < +Ën + && i<16; i++, ofs++) { + +93  +c + = +d©a +[ +ofs +]; + +94 ià(! + `i§scii +( +c +è|| ! + `i¥ršt +(c)) + +95 +c + = '.'; + +96 +out + +ð + `¢´štf +( +lše ++out, +LINE_LEN + - out, "%c", +c +); + +98 + `´štf +("%s\n", +lše +); + +100 + } +} + +102  + $·r£_xm™_¡©us +( +xb“_ùx + * +ùx +, + +103  +xb“_xm™_¡©us_hdr + * +äame +,  +Ën +) + +105 ià( +ùx + =ð +NULL +) { + +106 + `´štf +("no context\n"); + +111 ià( +ùx +-> +©cmd_qu”y + !ð +NULL +) { + +112 + `´štf +("invalid„esponse\n"); + +117 ià( +äame +-> +d–iv”y_¡©us + == 0x00) + +118 + `´štf +("Success\n"); + +119 ià( +äame +-> +d–iv”y_¡©us + == 0x01) + +120 + `´štf +("MAC ACK Failure\n"); + +121 ià( +äame +-> +d–iv”y_¡©us + == 0x15) + +122 + `´štf +("Invalid destinationƒndpoint\n"); + +123 ià( +äame +-> +d–iv”y_¡©us + == 0x21) + +124 + `´štf +("Network ACK Failure\n"); + +125 ià( +äame +-> +d–iv”y_¡©us + == 0x25) + +126 + `´štf +("Route Not Found\n"); + +129 + } +} + +131  + $dump_©cmd +( +xb“_ùx + * +ùx +,  +xb“_©»¥_hdr + * +äame +, + +132  +Ën +) + +134  +©cmd_¡r +[3]; + +135  +xb“_©cmd_pgm + * +cmd_pgm +; + +136  +xb“_©cmd + +cmd +; + +138 +ušt8_t + +u8 +; + +139 +ušt16_t + +u16 +; + +140 +ušt32_t + +u32 +; + +141 +št16_t + +s16 +; + +142 } + `__©Œibu‹__ +(( +·cked +)è* +»suÉ +; + +144 ià( +ùx + =ð +NULL +) { + +145 + `´štf +("no context\n"); + +150 + `memýy +( +©cmd_¡r +, & +äame +-> +cmd +, 2); + +151 +©cmd_¡r +[2] = '\0'; + +154 ià( + `¡rcmp +( +©cmd_¡r +, +ùx +-> +©cmd_qu”y +)) { + +155 + `´štf +("invalid„esponse\n"); + +160 +cmd_pgm + = + `xb“_©cmd_lookup_Çme +( +©cmd_¡r +); + +161 ià( +cmd_pgm + =ð +NULL +) { + +162 + `´štf +("unknown„esponse\n"); + +165 + `memýy_P +(& +cmd +, +cmd_pgm +, (cmd)); + +168 ià( +äame +-> +¡©us + == 1) { + +169 + `´štf +("Status isƒrror\n"); + +172 ià( +äame +-> +¡©us + == 2) { + +173 + `´štf +("Invalid command\n"); + +176 ià( +äame +-> +¡©us + == 3) { + +177 + `´štf +("Invalid…arameter\n"); + +180 ià( +äame +-> +¡©us + != 0) { + +181 + `´štf +("UnknowÀ¡©u ”rÜ %d\n", +äame +-> +¡©us +); + +186 +»suÉ + = (*) +äame +-> +d©a +; + +187 +Ën + -ð + `off£tof +( +xb“_©»¥_hdr +, +d©a +); + +188 ià( +cmd +. +æags + & +XBEE_ATCMD_F_PARAM_U8 + && +Ën + =ð( +ušt8_t +)) + +189 + `´štf +("<%s> i 0x%x\n", +©cmd_¡r +, +»suÉ +-> +u8 +); + +190 ià( +cmd +. +æags + & +XBEE_ATCMD_F_PARAM_U16 + && +Ën + =ð( +ušt16_t +)) + +191 + `´štf +("<%s> i 0x%x\n", +©cmd_¡r +, + `Áohs +( +»suÉ +-> +u16 +)); + +192 ià( +cmd +. +æags + & +XBEE_ATCMD_F_PARAM_U32 + && +Ën + =ð( +ušt32_t +)) + +193 + `´štf +("<%s> i 0x%" +PRIx32 +"\n", +©cmd_¡r +, + `Áohl +( +»suÉ +-> +u32 +)); + +194 ià( +cmd +. +æags + & +XBEE_ATCMD_F_PARAM_S16 + && +Ën + =ð( +št16_t +)) + +195 + `´štf +("<%s> i %d\n", +©cmd_¡r +, + `Áohs +( +»suÉ +-> +s16 +)); + +196 ià( +Ën + == 0) + +197 + `´štf +("no data, status ok\n"); + +199 + `hexdump +("©cmd‡nsw”", +äame +-> +d©a +, +Ën +); + +202 + } +} + +205  + $xb“_rx +( +xb“_dev + * +dev +,  +chªÃl +,  +ty³ +, + +206 * +äame +,  +Ën +, * +Ýaque +) + +208  +xb“_ùx + * +ùx + = +Ýaque +; + +209  +do_hexdump + = +xb“_hexdump +; + +211 ià( +xb“_debug +) + +212 + `´štf +("ty³=0x%x, chªÃl=%d, ctx=%p\n", +ty³ +, +chªÃl +, +ùx +); + +215 ià( +ùx + !ð +NULL +) { + +217 + `xb“_uÆßd_timeout +( +ùx +); + +218 ià( +xb“_debug + && +ùx +-> +©cmd_qu”y +) + +219 + `´štf +("Received‡nswero query <%s>\n", + +220 +ùx +-> +©cmd_qu”y +); + +221 + `xb“_uÄegi¡”_chªÃl +( +dev +, +chªÃl +); + +225  +ty³ +) { + +226  +XBEE_TYPE_MODEM_STATUS +: { + +227 + `´štf +("Received Modem Status frame\n"); + +231  +XBEE_TYPE_RMT_ATRESP +: { + +233 +ušt64_t + +u64 +; + +235 #ià +BYTE_ORDER + =ð +LITTLE_ENDIAN + + +236 +ušt32_t + +low +; + +237 +ušt32_t + +high +; + +239 +ušt32_t + +high +; + +240 +ušt32_t + +low +; + +242 } +u32 +; + +243 } +addr +; + +244 + `memýy +(& +addr +, +äame +, (addr)); + +245 +addr +. +u64 + = + `ÁohÎ +(addr.u64); + +246 + `´štf +("äom„emِadd»s %" +PRIx32 +"%"PRIx32"\n", + +247 +addr +. +u32 +. +high +,‡ddr.u32. +low +); + +250 ià( + `dump_©cmd +( +ùx +, +äame + + 10, +Ën + - 10) < 0) + +251 +do_hexdump + = 1; + +254  +XBEE_TYPE_ATRESP +: { + +255 ià( + `dump_©cmd +( +ùx +, +äame +, +Ën +) < 0) + +256 +do_hexdump + = 1; + +260  +XBEE_TYPE_XMIT_STATUS +: { + +261 ià( + `·r£_xm™_¡©us +( +ùx +, +äame +, +Ën +) < 0) + +262 +do_hexdump + = 1; + +266  +XBEE_TYPE_ATCMD +: + +267  +XBEE_TYPE_ATCMD_Q +: + +268  +XBEE_TYPE_XMIT +: + +269  +XBEE_TYPE_EXPL_XMIT +: + +270  +XBEE_TYPE_RMT_ATCMD +: + +271  +XBEE_TYPE_RECV +: + +272  +XBEE_TYPE_EXPL_RECV +: + +273  +XBEE_TYPE_NODE_ID +: + +275 + `´štf +("Invalid frame\n"); + +276 +do_hexdump + = 1; + +280 ià( +do_hexdump +) + +281 + `hexdump +("undecoded„x f¿me", +äame +, +Ën +); + +284 ià( +ùx + !ð +NULL +) { + +285 ià( +ùx +-> +fÜeground +) { + +286 + `xb“_¡dš_’abË +(); + +287 + `rdlše_Ãwlše +(& +ùx +-> +þ +-> +rdl +, ctx->þ-> +´om± +); + +289 + `ä“ +( +ùx +); + +291 + } +} + +293  + $xb“­p_£nd +( +xb“_ùx + * +ùx +,  +ty³ +, * +buf +,  +Ën +, + +294  +fÜeground +) + +296  +»t +; + +297  +chªÃl +; + +299 ià( +Ën + > +XBEE_MAX_FRAME_LEN +) { + +300 + `´štf +("frameoo†arge\n"); + +305 +chªÃl + = + `xb“_»gi¡”_chªÃl +( +xb“_dev +, +XBEE_CHANNEL_ANY +, + +306 +xb“_rx +, +ùx +); + +307 ià( +chªÃl + < 0) { + +308 + `´štf +("cannot send:‚o free channel\n"); + +312 ià( +xb“_debug +) + +313 + `´štf +("send frame channel=%dype=0x%x†en=%d\n", + +314 +chªÃl +, +ty³ +, +Ën +); + +315 ià( +xb“_hexdump +) + +316 + `hexdump +("xm™ f¿me", +buf +, +Ën +); + +319 +»t + = + `xb“_´Ùo_xm™ +( +xb“_dev +, +chªÃl +, +ty³ +, +buf +, + +320 +Ën +); + +321 ià( +»t + < 0) { + +322 + `´štf +("cannot send\n"); + +323 + `xb“_uÄegi¡”_chªÃl +( +xb“_dev +, +chªÃl +); + +327 +ùx +-> +chªÃl + = channel; + +328 + `xb“_lßd_timeout +( +ùx +); + +331 ià( +fÜeground +) { + +332 +ùx +-> +fÜeground + = 1; + +333 + `rdlše_¡Ý +(& +ùx +-> +þ +-> +rdl +); + +334 + `xb“_¡dš_di§bË +(); + +338 + } +} + +342  + $xb“­p_£nd_©cmd +(cÚ¡ +´og_ch¬ + * +©cmd_¡r +, + +343 * +·¿m +,  +·¿m_Ën +,  +fÜeground +) + +345  +xb“_ùx + * +ùx +; + +347  +xb“_©cmd_hdr + +©cmd +; + +348  +buf +[ +XBEE_MAX_FRAME_LEN +]; + +349 } + `__©Œibu‹__ +(( +·cked +)è +äame +; + +352 +ùx + = + `m®loc +((*ctx)); + +353 ià( +ùx + =ð +NULL +) { + +354 + `´štf +("notƒnough memory\n"); + +358 + `mem£t +( +ùx +, 0, (*ctx)); + +359 +ùx +-> +©cmd_qu”y + = +©cmd_¡r +; + +361 + `memýy +(& +äame +. +©cmd +. +cmd +, +©cmd_¡r +, 2); + +362 + `memýy +(& +äame +. +buf +, +·¿m +, +·¿m_Ën +); + +364 ià( + `xb“­p_£nd +( +ùx +, +XBEE_TYPE_ATCMD +, & +äame +, + +365 ( +xb“_©cmd_hdr +) + + +366 +·¿m_Ën +, +fÜeground +) < 0) { + +367 + `ä“ +( +ùx +); + +372 + } +} + +374  + $xb“­p_£nd_msg +( +ušt64_t + +addr +, * +d©a +, + +375  +d©a_Ën +,  +fÜeground +) + +377  +xb“_ùx + * +ùx +; + +379  +xb“_xm™_hdr + +xm™ +; + +380  +buf +[ +XBEE_MAX_FRAME_LEN +]; + +381 } + `__©Œibu‹__ +(( +·cked +)è +äame +; + +384 +ùx + = + `m®loc +((*ctx)); + +385 ià( +ùx + =ð +NULL +) { + +386 + `´štf +("notƒnough memory\n"); + +390 + `mem£t +( +ùx +, 0, (*ctx)); + +391 +ùx +-> +©cmd_qu”y + = +NULL +; + +393 +äame +. +xm™ +. +d¡addr + = + `htÚÎ +( +addr +); + +394 +äame +. +xm™ +. +»£rved + = + `htÚs +(0xFFFE); + +395 +äame +. +xm™ +. +bÿ¡_¿dius + = 0; + +396 +äame +. +xm™ +. +Ýts + = 0; + +397 + `memýy +(& +äame +. +buf +, +d©a +, +d©a_Ën +); + +399 ià( + `xb“­p_£nd +( +ùx +, +XBEE_TYPE_XMIT +, & +äame +, + +400 ( +xb“_xm™_hdr +) + + +401 +d©a_Ën +, +fÜeground +) < 0) { + +402 + `ä“ +( +ùx +); + +407 + } +} + +409  + $xb“_¡dš_’abË +() + +411 +cmdlše_šput_’abËd + = 1; + +412 + } +} + +414  + $xb“_¡dš_di§bË +() + +416 +cmdlše_šput_’abËd + = 0; + +417 + } +} + +419  + $evt_timeout +( +s +,  +ev’t +, * +¬g +) + +421  +xb“_ùx + * +ùx + = +¬g +; + +423 + `´štf +("Timeout\n"); + +426 + `xb“_¡dš_’abË +(); + +427 + `rdlše_Ãwlše +(& +ùx +-> +þ +-> +rdl +, ctx->þ-> +´om± +); + +430 + `xb“_uÄegi¡”_chªÃl +( +xb“_dev +, +ùx +-> +chªÃl +); + +431 + `ä“ +( +ùx +); + +432 + } +} + +434  + $xb“_lßd_timeout +( +xb“_ùx + * +ùx +) + +436 + `ÿÎlout_»£t +( +cm +, & +ùx +-> +timeout +, +TIMEOUT_MS +, +SINGLE +, +evt_timeout +, ctx); + +437 + } +} + +439  + $xb“_uÆßd_timeout +( +xb“_ùx + * +ùx +) + +441 + `ÿÎout_¡Ý +(& +ùx +-> +timeout +); + +442 + } +} + +503  + $boÙlßd” +() + +505  + #BOOTLOADER_ADDR + 0x1e000 + + ) + +506 ià( + `pgm_»ad_by‹_çr +( +BOOTLOADER_ADDR +) == 0xff) { + +507 + `´štf_P +( + `PSTR +("Bootloader is‚ot…resent\r\n")); + +510 + `þi +(); + +512 +EIMSK + = 0; + +513 +SPCR + = 0; + +514 +TWCR + = 0; + +515 +ACSR + = 0; + +516 +ADCSRA + = 0; + +518 +__asm__ + + `__vÞ©že__ + ("ldi„31,0xf0\n"); + +519 +__asm__ + + `__vÞ©že__ + ("ldi„30,0x00\n"); + +520 +__asm__ + + `__vÞ©že__ + ("ijmp\n"); + +523 + } +} + +526  + $Þd_maš +( +¬gc +, ** +¬gv +) + +528  +xb“_dev + +dev +; + +529  +”r + = 0; + +532 +DDRE + |= 0x0C; + +533 +DDRB + |= 0x18; + +536 + `u¬t_š™ +(); + +537 + `fdevݒ +( +u¬t0_dev_£nd +, +u¬t0_dev_»cv +); + +538 + `u¬t_»gi¡”_rx_ev’t +( +CMDLINE_UART +, +em”g’cy +); + +548 + `tim”_š™ +(); + +549 + `tim”0_»gi¡”_OV_šŒ +( +maš_tim”_š‹¼u± +); + +552 + `scheduËr_š™ +(); + +553 + `scheduËr_add_³riodiÿl_ev’t_´iܙy +( +do_Ëd_blšk +, +NULL +, + +554 100000L / +SCHEDULER_UNIT +, + +555 +LED_PRIO +); + +557 + `time_š™ +( +TIME_PRIO +); + +559 + `mem£t +(& +xb“bßrd +, 0, (xbeeboard)); + +561 + `£i +(); + +563 + `cmdlše_š‹¿ù +(); + +581 + } +} + + @main.h + +28  + #NB_LOGS + 4 + + ) + +31  + #E_USER_DEFAULT + 194 + + ) + +33  + #LED1_ON +(è + `sbi +( +PORTE +, 2) + + ) + +34  + #LED1_OFF +(è + `cbi +( +PORTE +, 2) + + ) + +36  + #LED2_ON +(è + `sbi +( +PORTE +, 3) + + ) + +37  + #LED2_OFF +(è + `cbi +( +PORTE +, 3) + + ) + +39  + #LED3_ON +(è + `sbi +( +PORTB +, 3) + + ) + +40  + #LED3_OFF +(è + `cbi +( +PORTB +, 3) + + ) + +42  + #LED4_ON +(è + `sbi +( +PORTB +, 4) + + ) + +43  + #LED4_OFF +(è + `cbi +( +PORTB +, 4) + + ) + +45  + #LED_PRIO + 170 + + ) + +46  + #TIME_PRIO + 160 + + ) + +49  + sxb“bßrd + { + +51  +rdlše + + mrdl +; + +52  + m´om± +[ +RDLINE_PROMPT_SIZE +]; + +55 +ušt8_t + + mlogs +[ +NB_LOGS ++1]; + +56 +ušt8_t + + mlog_Ëv– +; + +57 +ušt8_t + + mdebug +; + +59  +xb“bßrd + xbeeboard; + +63  + sxb“_ùx + { + +64  + mfÜeground +; + +65  + mchªÃl +; + +66 cÚ¡ * + m©cmd_qu”y +; + +71  +xb“_dev + *xbee_dev; + +72  +xb“_¿w +; + +73  +xb“_hexdump +; + +74  +xb“_debug +; + +76  +ÿÎout_mªag” + +cm +; + +79  +boÙlßd” +(); + +81  +xb“_rx +( +xb“_dev + * +dev +,  +chªÃl +,  +ty³ +, + +82 * +äame +,  +Ën +, * +Ýaque +); + +83  +xb“­p_£nd_©cmd +(cÚ¡ +´og_ch¬ + * +©cmd_¡r +, + +84 * +·¿m +,  +·¿m_Ën +,  +fÜeground +); + +85  +xb“­p_£nd_msg +( +ušt64_t + +addr +, * +d©a +, + +86  +d©a_Ën +,  +fÜeground +); + +88  +xb“_¡dš_’abË +(); + +89  +xb“_¡dš_di§bË +(); + +91  +xb“_lßd_timeout +( +xb“_ùx + * +ùx +); + +92  +xb“_uÆßd_timeout +( +xb“_ùx + * +ùx +); + + @parse.c + +24  + ~<¡dio.h +> + +25  + ~<¡ršg.h +> + +26  + ~<š‰y³s.h +> + +27  + ~<ùy³.h +> + +29  + ~ + +31  + ~"·r£.h +" + +33 #ifdeà +HOST_VERSION + + +34  + #pgm_»ad_pgm±r +( +x +è((*)(*(x))) + + ) + +36  + #pgm_»ad_pgm±r +( +x +è(*) + `pgm_»ad_wÜd +(x) + + ) + +41  + #debug_´štf +( +¬gs +...èdØ{} 0) + + ) + +45 + $i£ndoæše +( +c +) + +47 ià( +c + == '\n' || + +48 +c + == '\r' ) + +51 + } +} + +54 + $iscomm’t +( +c +) + +56 ià( +c + == '#') + +59 + } +} + +62 + $i£ndoáok’ +( +c +) + +64 ià(! +c + || + `iscomm’t +(cè|| + `isbÏnk +(cè|| + `i£ndoæše +(c)) + +67 + } +} + +69  +ušt8_t + + +70 + $nb_commÚ_ch¬s +(cÚ¡ * +s1 +, cÚ¡ * +s2 +) + +72 +ušt8_t + +i +=0; + +74 * +s1 +==* +s2 + && *s1 && *s2) { + +75 +s1 +++; + +76 +s2 +++; + +77 +i +++; + +79  +i +; + +80 + } +} + +87  +št8_t + + +88 + $m©ch_š¡ +( +·r£_pgm_š¡_t + * +š¡ +, cÚ¡ * +buf +, +ušt8_t + +nb_m©ch_tok’ +, + +89 * +»suÉ_buf +) + +91 +ušt8_t + +tok’_num +=0; + +92 +·r£_pgm_tok’_hdr_t + * +tok’_p +; + +93 +ušt8_t + +i +=0; + +94 +št8_t + +n + = 0; + +95  +tok’_hdr +oken_hdr; + +97 +tok’_p + = ( +·r£_pgm_tok’_hdr_t + *) + `pgm_»ad_pgm±r +(& +š¡ +-> +tok’s +[ +tok’_num +]); + +98 ià( +tok’_p +) + +99 + `memýy_P +(& +tok’_hdr +, +tok’_p +, (token_hdr)); + +102  +tok’_p + && (! +nb_m©ch_tok’ + || +i + + `·r£ +( +tok’_p +, +buf +, ( +»suÉ_buf + ?„esuÉ_buf+tok’_hdr. +off£t + : +NULL +)); + +114 iàÐ +n + < 0 ) + +116 + `debug_´štf +("TK…¬£d (Ën=%d)\n", +n +); + +117 +i +++; + +118 +buf + +ð +n +; + +120 +tok’_num + ++; + +121 +tok’_p + = ( +·r£_pgm_tok’_hdr_t + *) + `pgm_»ad_pgm±r +(& +š¡ +-> +tok’s +[ +tok’_num +]); + +122 ià( +tok’_p +) + +123 + `memýy_P +(& +tok’_hdr +, +tok’_p +, (token_hdr)); + +127 ià( +i +==0) + +131 ià( +nb_m©ch_tok’ +) { + +132 ià( +i + =ð +nb_m©ch_tok’ +) { + +135  +i +; + +139 ià( +tok’_p +) { + +140  +i +; + +144  + `isbÏnk +(* +buf +)) { + +145 +buf +++; + +149 iàÐ + `i£ndoæše +(* +buf +è|| + `iscomm’t +(*buf) ) + +153  +i +; + +154 + } +} + +157 +št8_t + + +158 + $·r£ +( +·r£_pgm_ùx_t + +ùx +[], cÚ¡ * +buf +) + +160 +ušt8_t + +š¡_num +=0; + +161 +·r£_pgm_š¡_t + * +š¡ +; + +162 cÚ¡ * +curbuf +; + +163  +»suÉ_buf +[256]; + +164 (* +f +)(*, *èð +NULL +; + +165 * +d©a + = +NULL +; + +166  +comm’t + = 0; + +167  +lš–’ + = 0; + +168  +·r£_™ + = 0; + +169 +št8_t + +”r + = +PARSE_NOMATCH +; + +170 +št8_t + +tok +; + +171 #ifdeà +CMDLINE_DEBUG + + +172  +debug_buf +[64]; + +180 +curbuf + = +buf +; + +181 ! + `i£ndoæše +(* +curbuf +)) { + +182 iàÐ* +curbuf + == '\0' ) { + +183 + `debug_´štf +("Incom¶‘buà֒=%d)\n", +lš–’ +); + +186 iàÐ + `iscomm’t +(* +curbuf +) ) { + +187 +comm’t + = 1; + +189 iàÐ! + `isbÏnk +(* +curbuf +è&& ! +comm’t +) { + +190 +·r£_™ + = 1; + +192 +curbuf +++; + +193 +lš–’ +++; + +197  + `i£ndoæše +( +buf +[ +lš–’ +])) { + +198 +lš–’ +++; + +202 iàÐ +·r£_™ + == 0 ) { + +203 + `debug_´štf +("Em±y†šÖ’=%d)\n", +lš–’ +); + +204  +lš–’ +; + +207 #ifdeà +CMDLINE_DEBUG + + +208 + `¢´štf +( +debug_buf +, ( +lš–’ +>64 ? 64 :†š–’), "%s", +buf +); + +209 + `debug_´štf +("P¬£†š:†’=%d, <%s>\n", +lš–’ +, +debug_buf +); + +213 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +214  +š¡ +) { + +215 + `debug_´štf +("INST\n"); + +218 +tok + = + `m©ch_š¡ +( +š¡ +, +buf +, 0, +»suÉ_buf +); + +220 ià( +tok + > 0) + +221 +”r + = +PARSE_BAD_ARGS +; + +223 ià(! +tok +) { + +224 + `debug_´štf +("INST fully…arsed\n"); + +226  + `isbÏnk +(* +curbuf +)) { + +227 +curbuf +++; + +231 ià( + `i£ndoæše +(* +curbuf +è|| + `iscomm’t +(*curbuf)) { + +232 ià(! +f +) { + +233 + `memýy_P +(& +f +, & +š¡ +->f, (f)); + +234 + `memýy_P +(& +d©a +, & +š¡ +->data, (data)); + +238 +”r + = +PARSE_AMBIGUOUS +; + +239 +f += +NULL +; + +240 + `debug_´štf +("Ambiguous cmd\n"); + +246 +š¡_num + ++; + +247 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +251 ià( +f +) { + +252 + `f +( +»suÉ_buf +, +d©a +); + +257 + `debug_´štf +("NØm©chƒ¼=%d\n", +”r +); + +258  +”r +; + +261  +lš–’ +; + +262 + } +} + +264 +št8_t + + +265 + $com¶‘e +( +·r£_pgm_ùx_t + +ùx +[], cÚ¡ * +buf +, +št16_t + * +¡©e +, + +266 * +d¡ +, +ušt8_t + +size +) + +268 cÚ¡ * +šcom¶‘e_tok’ + = +buf +; + +269 +ušt8_t + +š¡_num + = 0; + +270 +·r£_pgm_š¡_t + * +š¡ +; + +271 +·r£_pgm_tok’_hdr_t + * +tok’_p +; + +272  +tok’_hdr +oken_hdr; + +273  +tmpbuf +[64], +com¶‘iÚ_buf +[64]; + +274 +ušt8_t + +šcom¶‘e_tok’_Ën +; + +275 +št8_t + +com¶‘iÚ_Ën + = -1; + +276 +št8_t + +nb_tok’ + = 0; + +277 +ušt8_t + +i +, +n +; + +278 +št8_t + +l +; + +279 +ušt8_t + +nb_com¶‘abË +; + +280 +ušt8_t + +nb_nÚ_com¶‘abË +; + +281 +št16_t + +loÿl_¡©e +=0; + +282 +´og_ch¬ + * +h–p_¡r +; + +284 + `debug_´štf +("% ÿÎed\n", +__FUNCTION__ +); + +286  +i +=0 ; +buf +[i] ; i++) { + +287 ià(! + `isbÏnk +( +buf +[ +i +]) && isblank(buf[i+1])) + +288 +nb_tok’ +++; + +289 ià( + `isbÏnk +( +buf +[ +i +]) && !isblank(buf[i+1])) + +290 +šcom¶‘e_tok’ + = +buf ++ +i ++1; + +292 +šcom¶‘e_tok’_Ën + = + `¡¾’ +( +šcom¶‘e_tok’ +); + +295 ià(* +¡©e + <= 0) { + +296 + `debug_´štf +("Œy com¶‘<%s>\n", +buf +); + +297 + `debug_´štf +("th”i %d com¶‘tok’s, <%s> i šcom¶‘e\n", +nb_tok’ +, +šcom¶‘e_tok’ +); + +299 +nb_com¶‘abË + = 0; + +300 +nb_nÚ_com¶‘abË + = 0; + +302 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +303  +š¡ +) { + +305 ià( +nb_tok’ + && + `m©ch_š¡ +( +š¡ +, +buf +,‚b_tok’, +NULL +)) + +306  +Ãxt +; + +308 + `debug_´štf +("instruction match \n"); + +309 +tok’_p + = ( +·r£_pgm_tok’_hdr_t + *è + `pgm_»ad_pgm±r +(& +š¡ +-> +tok’s +[ +nb_tok’ +]); + +310 ià( +tok’_p +) + +311 + `memýy_P +(& +tok’_hdr +, +tok’_p +, (token_hdr)); + +314 ià(! +tok’_p + || + +315 ! +tok’_hdr +. +Ýs +-> +com¶‘e_g‘_nb + || + +316 ! +tok’_hdr +. +Ýs +-> +com¶‘e_g‘_–t + || + +317 ( +n + = +tok’_hdr +. +Ýs +-> + `com¶‘e_g‘_nb +( +tok’_p +)) == 0) { + +318 +nb_nÚ_com¶‘abË +++; + +319  +Ãxt +; + +322 + `debug_´štf +("%d choiû f܁hi tok’\n", +n +); + +323  +i +=0 ; i< +n + ; i++) { + +324 ià( +tok’_hdr +. +Ýs +-> + `com¶‘e_g‘_–t +( +tok’_p +, +i +, +tmpbuf +, (tmpbuf)) < 0) + +326 + `¡rÿt_P +( +tmpbuf +, + `PSTR +(" ")); + +327 + `debug_´štf +(" choiû <%s>\n", +tmpbuf +); + +329 ià(! + `¡ºcmp +( +šcom¶‘e_tok’ +, +tmpbuf +, +šcom¶‘e_tok’_Ën +)) { + +330 ià( +com¶‘iÚ_Ën + == -1) { + +331 + `¡rýy +( +com¶‘iÚ_buf +, +tmpbuf ++ +šcom¶‘e_tok’_Ën +); + +332 +com¶‘iÚ_Ën + = + `¡¾’ +( +tmpbuf ++ +šcom¶‘e_tok’_Ën +); + +336 +com¶‘iÚ_Ën + = + `nb_commÚ_ch¬s +( +com¶‘iÚ_buf +, + +337 +tmpbuf ++ +šcom¶‘e_tok’_Ën +); + +338 +com¶‘iÚ_buf +[ +com¶‘iÚ_Ën +] = 0; + +340 +nb_com¶‘abË +++; + +343 +Ãxt +: + +344 +š¡_num + ++; + +345 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +348 + `debug_´štf +("tÙ® choiû %d f܁hi com¶‘iÚ\n", +nb_com¶‘abË +); + +351 ià( +nb_com¶‘abË + =ð0 && +nb_nÚ_com¶‘abË + == 0) + +355 ià(* +¡©e + =ð0 && +šcom¶‘e_tok’_Ën + > 0) { + +358 ià( +com¶‘iÚ_Ën + > 0) { + +359 ià( +com¶‘iÚ_Ën + + 1 > +size +) + +362 + `¡rýy +( +d¡ +, +com¶‘iÚ_buf +); + +369 ià(* +¡©e + == -1) + +370 * +¡©e + = 0; + +372 + `debug_´štf +("MuÉË choiû STATE=%d\n", * +¡©e +); + +374 +š¡_num + = 0; + +375 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +376  +š¡ +) { + +378 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +380 ià( +nb_tok’ + && + `m©ch_š¡ +( +š¡ +, +buf +,‚b_tok’, +NULL +)) + +381  +Ãxt2 +; + +383 +tok’_p + = ( +·r£_pgm_tok’_hdr_t + *) + `pgm_»ad_pgm±r +(& +š¡ +-> +tok’s +[ +nb_tok’ +]); + +384 ià( +tok’_p +) + +385 + `memýy_P +(& +tok’_hdr +, +tok’_p +, (token_hdr)); + +388 ià(! +tok’_p + || + +389 ! +tok’_hdr +. +Ýs +-> +com¶‘e_g‘_nb + || + +390 ! +tok’_hdr +. +Ýs +-> +com¶‘e_g‘_–t + || + +391 ( +n + = +tok’_hdr +. +Ýs +-> + `com¶‘e_g‘_nb +( +tok’_p +)) == 0) { + +392 ià( +loÿl_¡©e + < * +¡©e +) { + +393 +loÿl_¡©e +++; + +394  +Ãxt2 +; + +396 (* +¡©e +)++; + +397 ià( +tok’_p + && +tok’_hdr +. +Ýs +-> +g‘_h–p +) { + +398 +tok’_hdr +. +Ýs +-> + `g‘_h–p +( +tok’_p +, +tmpbuf +, (tmpbuf)); + +399 +h–p_¡r + = ( +´og_ch¬ + *è + `pgm_»ad_pgm±r +(& +š¡ +->help_str); + +400 ià( +h–p_¡r +) + +401 + `¢´štf_P +( +d¡ +, +size +, + `PSTR +("[%s]: " +PGMS_FMT +""), +tmpbuf +, +h–p_¡r +); + +403 + `¢´štf_P +( +d¡ +, +size +, + `PSTR +("[%s]: NØh–p"), +tmpbuf +); + +406 + `¢´štf_P +( +d¡ +, +size +, + `PSTR +("[RETURN]")); + +412  +i +=0 ; i< +n + ; i++) { + +413 ià( +tok’_hdr +. +Ýs +-> + `com¶‘e_g‘_–t +( +tok’_p +, +i +, +tmpbuf +, (tmpbuf)) < 0) + +415 + `¡rÿt_P +( +tmpbuf +, + `PSTR +(" ")); + +416 + `debug_´štf +(" choiû <%s>\n", +tmpbuf +); + +418 ià(! + `¡ºcmp +( +šcom¶‘e_tok’ +, +tmpbuf +, +šcom¶‘e_tok’_Ën +)) { + +419 ià( +loÿl_¡©e + < * +¡©e +) { + +420 +loÿl_¡©e +++; + +423 (* +¡©e +)++; + +424 +l += + `¢´štf +( +d¡ +, +size +, "%s", +tmpbuf +); + +425 ià( +l +>=0 && +tok’_hdr +. +Ýs +-> +g‘_h–p +) { + +426 +tok’_hdr +. +Ýs +-> + `g‘_h–p +( +tok’_p +, +tmpbuf +, (tmpbuf)); + +427 +h–p_¡r + = ( +´og_ch¬ + *è + `pgm_»ad_pgm±r +(& +š¡ +->help_str); + +428 ià( +h–p_¡r +) + +429 + `¢´štf_P +( +d¡ ++ +l +, +size +-l, + `PSTR +("[%s]: " +PGMS_FMT +), +tmpbuf +, +h–p_¡r +); + +431 + `¢´štf_P +( +d¡ ++ +l +, +size +-l, + `PSTR +("[%s]: NØh–p"), +tmpbuf +); + +437 +Ãxt2 +: + +438 +š¡_num + ++; + +439 +š¡ + = ( +·r£_pgm_š¡_t + *) + `pgm_»ad_pgm±r +( +ùx ++ +š¡_num +); + +442 + } +} + + @parse.h + +24 #iâdeà +_PARSE_H_ + + +25  + #_PARSE_H_ + + + ) + +27  + ~ + +28  + ~ + +30 #iâdeà +off£tof + + +31  + #off£tof +( +ty³ +, +f›ld +è(( +size_t +è&Ð(Ñy³ *)0)->f›ldè) + + ) + +34  + #PARSE_SUCCESS + 0 + + ) + +35  + #PARSE_AMBIGUOUS + -1 + + ) + +36  + #PARSE_NOMATCH + -2 + + ) + +37  + #PARSE_BAD_ARGS + -3 + + ) + +43  + stok’_hdr + { + +44  +tok’_Ýs + * + mÝs +; + +45 +ušt8_t + + moff£t +; + +47  +tok’_hdr + + t·r£_tok’_hdr_t +; + +49  + stok’_hdr_pgm + { + +50  +tok’_Ýs + * + mÝs +; + +51 +ušt8_t + + moff£t +; + +52 } + gPROGMEM +; + +53  +tok’_hdr_pgm + + t·r£_pgm_tok’_hdr_t +; + +74  + stok’_Ýs + { + +76 +št8_t + (* +·r£ +)( + m·r£_pgm_tok’_hdr_t + *, const *, *); + +78 +št8_t + (* +com¶‘e_g‘_nb +)( + m·r£_pgm_tok’_hdr_t + *); + +80 +št8_t + (* +com¶‘e_g‘_–t +)( + m·r£_pgm_tok’_hdr_t + *, + mšt8_t +, *, + mušt8_t +); + +82 +št8_t + (* +g‘_h–p +)( + m·r£_pgm_tok’_hdr_t + *, *, + mušt8_t +); + +90  + sš¡ + { + +92 (* + mf +)(*, *); + +93 * + md©a +; + +94 * + mh–p_¡r +; + +95 +´og_void + * + mtok’s +[]; + +97  +š¡ + + t·r£_š¡_t +; + +98  + sš¡_pgm + { + +100 (* + mf +)(*, *); + +101 * + md©a +; + +102 * + mh–p_¡r +; + +103 +´og_void + * + mtok’s +[]; + +104 } + gPROGMEM +; + +105  +š¡_pgm + + t·r£_pgm_š¡_t +; + +112  +·r£_pgm_š¡_t + * + t·r£_ùx_t +; + +113  +PROGMEM + + t·r£_ùx_t + + t·r£_pgm_ùx_t +; + +122 +št8_t + +·r£ +( +·r£_pgm_ùx_t + +ùx +[], cÚ¡ * +buf +); + +139 +št8_t + +com¶‘e +( +·r£_pgm_ùx_t + +ùx +[], cÚ¡ * +buf +, +št16_t + * +¡©e +, + +140 * +d¡ +, +ušt8_t + +size +); + +144  +i£ndoáok’ +( +c +); + + @parse_atcmd.c + +28  + ~ + +30  + ~<¡dio.h +> + +31  + ~<š‰y³s.h +> + +32  + ~<ùy³.h +> + +33  + ~<¡ršg.h +> + +35  + ~<·r£.h +> + +37  + ~"xb“_©cmd.h +" + +38  + ~"·r£_©cmd.h +" + +40  +št8_t + + +41 + $·r£_©cmd +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +buf +, * +»s +) + +43  +xb“_©cmd + +cÝy +; + +44  +tok’_©cmd_d©a + +ad +; + +45  +xb“_©cmd_pgm + * +cmd +; + +46  +bufcÝy +[32]; + +47 +ušt8_t + +tok’_Ën + = 0; + +49 + `memýy_P +(& +ad +, &(( +tok’_©cmd + *) +tk +)-> +©cmd_d©a +, (ad)); + +51 ! + `i£ndoáok’ +( +buf +[ +tok’_Ën +]) && + +52 +tok’_Ën + < (( +bufcÝy +)-1)) { + +53 +bufcÝy +[ +tok’_Ën +] = +buf +[token_len]; + +54 +tok’_Ën +++; + +56 +bufcÝy +[ +tok’_Ën +] = 0; + +59 +cmd + = + `xb“_©cmd_lookup_desc +( +bufcÝy +); + +61 ià( +cmd + =ð +NULL +) + +65 + `memýy_P +(& +cÝy +, +cmd +, (copy)); + +66 ià(( +cÝy +. +æags + & +ad +. +©cmd_mask +è!ðad. +©cmd_æags +) + +69 ià( +»s +) + +70 *( +xb“_©cmd_pgm + **) +»s + = +cmd +; + +72  +tok’_Ën +; + +73 + } +} + +75  +št8_t + + $com¶‘e_g‘_nb_©cmd +( +·r£_pgm_tok’_hdr_t + * +tk +) + +77  +tok’_©cmd_d©a + +ad +; + +78  +xb“_©cmd_pgm + * +cmd +; + +79  +xb“_©cmd + +cÝy +; + +80 +št8_t + +út + = 0; + +82 + `memýy_P +(& +ad +, &(( +tok’_©cmd + *) +tk +)-> +©cmd_d©a +, (ad)); + +84  +cmd + = & +xb“_©cmd_li¡ +[0], + `memýy_P +(& +cÝy +, cmd, (copy)); + +85 +cÝy +. +Çme + !ð +NULL +; + +86 +cmd +++, + `memýy_P +(& +cÝy +, cmd, (copy))) { + +88 ià(( +cÝy +. +æags + & +ad +. +©cmd_mask +è=ðad. +©cmd_æags +) + +89 +út +++; + +91  +út +; + +92 + } +} + +94  +št8_t + + $com¶‘e_g‘_–t_©cmd +( +·r£_pgm_tok’_hdr_t + * +tk +, +št8_t + +idx +, + +95 * +d¡buf +, +ušt8_t + +size +) + +97  +tok’_©cmd_d©a + +ad +; + +98  +xb“_©cmd_pgm + * +cmd +; + +99  +xb“_©cmd + +cÝy +; + +100 +št8_t + +út + = 0; + +102 + `memýy_P +(& +ad +, &(( +tok’_©cmd + *) +tk +)-> +©cmd_d©a +, (ad)); + +104  +cmd + = & +xb“_©cmd_li¡ +[0], + `memýy_P +(& +cÝy +, cmd, (copy)); + +105 +cÝy +. +Çme + !ð +NULL +; + +106 +cmd +++, + `memýy_P +(& +cÝy +, cmd, (copy))) { + +108 ià(( +cÝy +. +æags + & +ad +. +©cmd_mask +è=ðad. +©cmd_æags +) { + +109 ià( +út + =ð +idx +) { + +110 + `memýy_P +( +d¡buf +, +cÝy +. +desc +, +size +); + +111 +d¡buf +[ +size +-1] = '\0'; + +115 +út +++; + +119 + } +} + +121  +št8_t + + +122 + $h–p_©cmd +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, + +123 +ušt8_t + +size +) + +125 + `¢´štf +( +d¡buf +, +size +, "ATCMD"); + +127 + } +} + +129  +tok’_Ýs + + gtok’_©cmd_Ýs + = { + +130 . +·r£ + = +·r£_©cmd +, + +131 . + gcom¶‘e_g‘_nb + = +com¶‘e_g‘_nb_©cmd +, + +132 . + gcom¶‘e_g‘_–t + = +com¶‘e_g‘_–t_©cmd +, + +133 . + gg‘_h–p + = +h–p_©cmd +, + + @parse_atcmd.h + +28 #iâdeà +_PARSE_ATCMD_H_ + + +29  + #_PARSE_ATCMD_H_ + + + ) + +31  + stok’_©cmd_d©a + { + +32  +xb“_dev + ** + mxb“_dev +; + +33  + m©cmd_æags +; + +34  + m©cmd_mask +; + +37  + stok’_©cmd + { + +38  +tok’_hdr + + mhdr +; + +39  +tok’_©cmd_d©a + + m©cmd_d©a +; + +41  +tok’_©cmd + + t·r£_tok’_©cmd_t +; + +43  + stok’_©cmd_pgm + { + +44  +tok’_hdr + + mhdr +; + +45  +tok’_©cmd_d©a + + m©cmd_d©a +; + +46 } + gPROGMEM +; + +47  +tok’_©cmd_pgm + + t·r£_pgm_tok’_©cmd_t +; + +49  +tok’_Ýs + +tok’_©cmd_Ýs +; + +51  + #TOKEN_ATCMD_INITIALIZER +( +¡ruùu» +, +f›ld +, +dev +, +æags +, +mask +) \ + +53 . +hdr + = { \ + +54 . +Ýs + = & +tok’_©cmd_Ýs +, \ + +55 . +off£t + = + `off£tof +( +¡ruùu» +, +f›ld +), \ + +57 . +©cmd_d©a + = { \ + +58 . +xb“_dev + = +dev +, \ + +59 . +©cmd_æags + = +æags +, \ + +60 . +©cmd_mask + = +mask +, \ + +62 } + + ) + + @parse_monitor.c + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~<¡dio.h +> + +33  + ~<š‰y³s.h +> + +34  + ~<ùy³.h +> + +35  + ~<¡ršg.h +> + +37  + ~<·r£.h +> + +39  + ~"·r£_mڙÜ.h +" + +41  +mڙÜ_»g_li¡ + + gxb“_mڙÜ_li¡ + = +LIST_HEAD_INITIALIZER +(); + +43  +št8_t + + +44 + $·r£_mÚ™Ü +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +buf +, * +»s +) + +46  +mڙÜ_»g + * +m +; + +47 +ušt8_t + +tok’_Ën + = 0; + +48  +bufcÝy +[32]; + +50 ! + `i£ndoáok’ +( +buf +[ +tok’_Ën +]) && + +51 +tok’_Ën + < (( +bufcÝy +)-1)) { + +52 +bufcÝy +[ +tok’_Ën +] = +buf +[token_len]; + +53 +tok’_Ën +++; + +55 +bufcÝy +[ +tok’_Ën +] = 0; + +57 + `LIST_FOREACH +( +m +, & +xb“_mڙÜ_li¡ +, +Ãxt +) { + +58 ià(! + `¡rcmp_P +( +bufcÝy +, +m +-> +desc +)) + +61 ià( +m + =ð +NULL +) + +65 ià( +»s +) + +66 *( +mڙÜ_»g + **) +»s + = +m +; + +68  +tok’_Ën +; + +69 + } +} + +71  +št8_t + + +72 + $com¶‘e_g‘_nb_mÚ™Ü +( +·r£_pgm_tok’_hdr_t + * +tk +) + +74  +mڙÜ_»g + * +m +; + +75 +št8_t + +i + = 0; + +77 + `LIST_FOREACH +( +m +, & +xb“_mڙÜ_li¡ +, +Ãxt +) { + +78 +i +++; + +80  +i +; + +81 + } +} + +83  +št8_t + + +84 + $com¶‘e_g‘_–t_mÚ™Ü +( +·r£_pgm_tok’_hdr_t + * +tk +, +št8_t + +idx +, + +85 * +d¡buf +, +ušt8_t + +size +) + +87  +mڙÜ_»g + * +m +; + +88 +št8_t + +i + = 0, +Ën +; + +90 + `LIST_FOREACH +( +m +, & +xb“_mڙÜ_li¡ +, +Ãxt +) { + +91 ià( +i + =ð +idx +) + +93 +i +++; + +95 ià( +m + =ð +NULL +) + +98 +Ën + = + `¢´štf +( +d¡buf +, +size +, "%S", +m +-> +desc +); + +99 ià( +Ën + < 0 ||†’ >ð +size +) + +103 + } +} + +106  +št8_t + + +107 + $h–p_mÚ™Ü +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, + +108 +ušt8_t + +size +) + +110 + `¢´štf +( +d¡buf +, +size +, "Monitor-register"); + +112 + } +} + +114  +tok’_Ýs + + gtok’_mڙÜ_Ýs + = { + +115 . +·r£ + = +·r£_mÚ™Ü +, + +116 . + gcom¶‘e_g‘_nb + = +com¶‘e_g‘_nb_mÚ™Ü +, + +117 . + gcom¶‘e_g‘_–t + = +com¶‘e_g‘_–t_mÚ™Ü +, + +118 . + gg‘_h–p + = +h–p_mÚ™Ü +, + + @parse_monitor.h + +28 #iâdeà +_PARSE_MONITOR_H_ + + +29  + #_PARSE_MONITOR_H_ + + + ) + +31  + ~<·r£.h +> + +33  + smڙÜ_»g + { + +34 +LIST_ENTRY +( +mڙÜ_»g +è + mÃxt +; + +35 cÚ¡ +´og_ch¬ + * + mdesc +; + +36  + m©cmd +[3]; + +39 +LIST_HEAD +( +mڙÜ_»g_li¡ +, +mڙÜ_»g +); + +40  +mڙÜ_»g_li¡ + +xb“_mڙÜ_li¡ +; + +43  + stok’_mڙÜ_d©a + { + +46  + stok’_mÚ™Ü + { + +47  +tok’_hdr + + mhdr +; + +48  +tok’_mڙÜ_d©a + + mmڙÜ_d©a +; + +50  +tok’_mÚ™Ü + + t·r£_tok’_mڙÜ_t +; + +52  + stok’_mڙÜ_pgm + { + +53  +tok’_hdr + + mhdr +; + +54  +tok’_mڙÜ_d©a + + mmڙÜ_d©a +; + +55 } + gPROGMEM +; + +56  +tok’_mڙÜ_pgm + + t·r£_pgm_tok’_mڙÜ_t +; + +58  +tok’_Ýs + +tok’_mڙÜ_Ýs +; + +60  + #TOKEN_MONITOR_INITIALIZER +( +¡ruùu» +, +f›ld +){ \ + +61 . +hdr + = { \ + +62 . +Ýs + = & +tok’_mڙÜ_Ýs +, \ + +63 . +off£t + = + `off£tof +( +¡ruùu» +, +f›ld +), \ + +65 . +mڙÜ_d©a + = { \ + +67 } + + ) + + @parse_neighbor.c + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~<¡dio.h +> + +33  + ~<š‰y³s.h +> + +34  + ~<ùy³.h +> + +35  + ~<¡ršg.h +> + +37  + ~<·r£.h +> + +39  + ~"xb“_ÃighbÜ.h +" + +40  + ~"xb“_©cmd.h +" + +41  + ~"xb“_¡©s.h +" + +42  + ~"xb“_buf.h +" + +43  + ~"xb“_´Ùo.h +" + +44  + ~"xb“.h +" + +46  + ~"·r£_ÃighbÜ.h +" + +48  +št8_t + + +49 + $·r£_ÃighbÜ +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +buf +, * +»s +) + +51  +tok’_ÃighbÜ_d©a + +tkd +; + +52  +xb“_dev + * +dev +; + +53  +xb“_Ãigh + * +Ãigh +; + +54 +ušt8_t + +tok’_Ën + = 0; + +55  +bufcÝy +[32]; + +57 + `memýy_P +(& +tkd +, &(( +tok’_ÃighbÜ + *) +tk +)-> +ÃighbÜ_d©a +, + +58 ( +tkd +)); + +59 +dev + = * +tkd +. +xb“_dev +; + +61 ! + `i£ndoáok’ +( +buf +[ +tok’_Ën +]) && + +62 +tok’_Ën + < (( +bufcÝy +)-1)) { + +63 +bufcÝy +[ +tok’_Ën +] = +buf +[token_len]; + +64 +tok’_Ën +++; + +66 +bufcÝy +[ +tok’_Ën +] = 0; + +67 +Ãigh + = + `xb“_Ãigh_lookup +( +dev +, +bufcÝy +); + +68 ià( +Ãigh + =ð +NULL +) + +72 ià( +»s +) + +73 *( +xb“_Ãigh + **) +»s + = +Ãigh +; + +75  +tok’_Ën +; + +76 + } +} + +78  +št8_t + + +79 + $com¶‘e_g‘_nb_ÃighbÜ +( +·r£_pgm_tok’_hdr_t + * +tk +) + +81  +tok’_ÃighbÜ_d©a + +tkd +; + +82  +xb“_dev + * +dev +; + +83  +xb“_Ãigh + * +Ãigh +; + +84 +št8_t + +i + = 0; + +86 + `memýy_P +(& +tkd +, &(( +tok’_ÃighbÜ + *) +tk +)-> +ÃighbÜ_d©a +, + +87 ( +tkd +)); + +88 +dev + = * +tkd +. +xb“_dev +; + +90 + `LIST_FOREACH +( +Ãigh +, & +dev +-> +Ãigh_li¡ +, +Ãxt +) { + +91 +i +++; + +93  +i +; + +94 + } +} + +96  +št8_t + + +97 + $com¶‘e_g‘_–t_ÃighbÜ +( +·r£_pgm_tok’_hdr_t + * +tk +, +št8_t + +idx +, + +98 * +d¡buf +, +ušt8_t + +size +) + +100  +tok’_ÃighbÜ_d©a + +tkd +; + +101  +xb“_dev + * +dev +; + +102  +xb“_Ãigh + * +Ãigh +; + +103 +št8_t + +i + = 0, +Ën +; + +105 + `memýy_P +(& +tkd +, &(( +tok’_ÃighbÜ + *) +tk +)-> +ÃighbÜ_d©a +, + +106 ( +tkd +)); + +107 +dev + = * +tkd +. +xb“_dev +; + +109 + `LIST_FOREACH +( +Ãigh +, & +dev +-> +Ãigh_li¡ +, +Ãxt +) { + +110 ià( +i +++ =ð +idx +) + +114 ià( +Ãigh + =ð +NULL +) + +117 +Ën + = + `¢´štf +( +d¡buf +, +size +, "%s", +Ãigh +-> +Çme +); + +118 ià( +Ën + < 0 ||†’ >ð +size +) + +122 + } +} + +125  +št8_t + + +126 + $h–p_ÃighbÜ +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, + +127 +ušt8_t + +size +) + +129 + `¢´štf +( +d¡buf +, +size +, "Neighbor"); + +131 + } +} + +133  +tok’_Ýs + + gtok’_ÃighbÜ_Ýs + = { + +134 . +·r£ + = +·r£_ÃighbÜ +, + +135 . + gcom¶‘e_g‘_nb + = +com¶‘e_g‘_nb_ÃighbÜ +, + +136 . + gcom¶‘e_g‘_–t + = +com¶‘e_g‘_–t_ÃighbÜ +, + +137 . + gg‘_h–p + = +h–p_ÃighbÜ +, + + @parse_neighbor.h + +28 #iâdeà +_PARSE_NEIGHBOR_H_ + + +29  + #_PARSE_NEIGHBOR_H_ + + + ) + +31  + stok’_ÃighbÜ_d©a + { + +32  +xb“_dev + ** + mxb“_dev +; + +35  + stok’_ÃighbÜ + { + +36  +tok’_hdr + + mhdr +; + +37  +tok’_ÃighbÜ_d©a + + mÃighbÜ_d©a +; + +39  +tok’_ÃighbÜ + + t·r£_tok’_ÃighbÜ_t +; + +41  + stok’_ÃighbÜ_pgm + { + +42  +tok’_hdr + + mhdr +; + +43  +tok’_ÃighbÜ_d©a + + mÃighbÜ_d©a +; + +44 } + gPROGMEM +; + +45  +tok’_ÃighbÜ_pgm + + t·r£_pgm_tok’_ÃighbÜ_t +; + +47  +tok’_Ýs + +tok’_ÃighbÜ_Ýs +; + +49  + #TOKEN_NEIGHBOR_INITIALIZER +( +¡ruùu» +, +f›ld +, +dev +) \ + +51 . +hdr + = { \ + +52 . +Ýs + = & +tok’_ÃighbÜ_Ýs +, \ + +53 . +off£t + = + `off£tof +( +¡ruùu» +, +f›ld +), \ + +55 . +ÃighbÜ_d©a + = { \ + +56 . +xb“_dev + = +dev +, \ + +58 } + + ) + + @parse_num.c + +1  + ~<¡dio.h +> + +2  + ~<š‰y³s.h +> + +3  + ~<ùy³.h +> + +4  + ~<¡ršg.h +> + +6  + ~"·r£.h +" + +7  + ~"·r£_num.h +" + +10  + #debug_´štf +( +¬gs +...èdØ{} 0) + + ) + +13  + #U08_MIN + 0x00 + + ) + +14  + #U08_MAX + 0xFF + + ) + +15  + #U16_MIN + 0x0000 + + ) + +16  + #U16_MAX + 0xFFFF + + ) + +17  + #U32_MIN + 0x00000000 + + ) + +18  + #U32_MAX + 0xFFFFFFFF + + ) + +19  + #U64_MIN + 0x0000000000000000 + + ) + +20  + #U64_MAX + 0xFFFFFFFFFFFFFFFF + + ) + +21  + #S08_MIN + 0x80 + + ) + +22  + #S08_MAX + 0x7F + + ) + +23  + #S16_MIN + 0x8000 + + ) + +24  + #S16_MAX + 0x7FFF + + ) + +25  + #S32_MIN + 0x80000000 + + ) + +26  + #S32_MAX + 0x7FFFFFFF + + ) + +27  + #S64_MIN + 0x8000000000000000 + + ) + +28  + #S64_MAX + 0x7FFFFFFFFFFFFFFF + + ) + +31  +tok’_Ýs + + gtok’_num_Ýs + = { + +32 . +·r£ + = +·r£_num +, + +33 . + gcom¶‘e_g‘_nb + = +NULL +, + +34 . + gcom¶‘e_g‘_–t + = +NULL +, + +35 . + gg‘_h–p + = +g‘_h–p_num +, + +39 + enum_·r£_¡©e_t + { + +40 + mSTART +, + +41 + mDEC_NEG +, + +42 + mBIN +, + +43 + mHEX +, + +44 + mFLOAT_POS +, + +45 + mFLOAT_NEG +, + +46 + mERROR +, + +48 + mFIRST_OK +, + +49 + mZERO_OK +, + +50 + mHEX_OK +, + +51 + mOCTAL_OK +, + +52 + mBIN_OK +, + +53 + mDEC_NEG_OK +, + +54 + mDEC_POS_OK +, + +55 + mFLOAT_POS_OK +, + +56 + mFLOAT_NEG_OK +, + +60 cÚ¡ +´og_ch¬ + + gh–p1 +[] = "UINT8"; + +61 cÚ¡ +´og_ch¬ + + gh–p2 +[] = "UINT16"; + +62 cÚ¡ +´og_ch¬ + + gh–p3 +[] = "UINT32"; + +63 cÚ¡ +´og_ch¬ + + gh–p4 +[] = "UINT64"; + +64 cÚ¡ +´og_ch¬ + + gh–p5 +[] = "INT8"; + +65 cÚ¡ +´og_ch¬ + + gh–p6 +[] = "INT16"; + +66 cÚ¡ +´og_ch¬ + + gh–p7 +[] = "INT32"; + +67 cÚ¡ +´og_ch¬ + + gh–p8 +[] = "INT64"; + +68 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +69 cÚ¡ +´og_ch¬ + + gh–p9 +[] = "FLOAT"; + +71 cÚ¡ +´og_ch¬ + * + gnum_h–p +[] = { + +72 +h–p1 +, +h–p2 +, +h–p3 +, +h–p4 +, + +73 +h–p5 +, +h–p6 +, +h–p7 +, +h–p8 +, + +74 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +75 +h–p9 +, + +79  +šlše + +št8_t + + +80 + $add_to_»s +( +ušt8_t + +c +, +ušt64_t + * +»s +, ušt8_ˆ +ba£ +) + +83 iàÐ( +U64_MAX + - +c +è/ +ba£ + < * +»s + ) { + +87 * +»s + = *» * +ba£ + + +c + ; + +89 + } +} + +93 +št8_t + + +94 + $·r£_num +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +¤cbuf +, * +»s +) + +96  +tok’_num_d©a + +nd +; + +97 +num_·r£_¡©e_t + +¡ + = +START +; + +98 cÚ¡ * +buf + = +¤cbuf +; + +99  +c + = * +buf +; + +100 +ušt64_t + +»s1 +=0, +»s2 +=0, +»s3 +=1; + +102 + `memýy_P +(& +nd +, &(( +tok’_num + *) +tk +)-> +num_d©a +, (nd)); + +104  +¡ + !ð +ERROR + && +c + && ! + `i£ndoáok’ +(c) ) { + +105 + `debug_´štf +("%ø%x -> ", +c +, c); + +106  +¡ +) { + +107  +START +: + +108 ià( +c + == '-') { + +109 +¡ + = +DEC_NEG +; + +111 ià( +c + == '0') { + +112 +¡ + = +ZERO_OK +; + +114 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +115 ià( +c + == '.') { + +116 +¡ + = +FLOAT_POS +; + +117 +»s1 + = 0; + +120 ià( +c + >= '1' && c <= '9') { + +121 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 10) < 0) + +122 +¡ + = +ERROR +; + +124 +¡ + = +DEC_POS_OK +; + +127 +¡ + = +ERROR +; + +131  +ZERO_OK +: + +132 ià( +c + == 'x') { + +133 +¡ + = +HEX +; + +135 ià( +c + == 'b') { + +136 +¡ + = +BIN +; + +138 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +139 ià( +c + == '.') { + +140 +¡ + = +FLOAT_POS +; + +141 +»s1 + = 0; + +144 ià( +c + >= '0' && c <= '7') { + +145 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 10) < 0) + +146 +¡ + = +ERROR +; + +148 +¡ + = +OCTAL_OK +; + +151 +¡ + = +ERROR +; + +155  +DEC_NEG +: + +156 ià( +c + >= '0' && c <= '9') { + +157 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 10) < 0) + +158 +¡ + = +ERROR +; + +160 +¡ + = +DEC_NEG_OK +; + +162 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +163 ià( +c + == '.') { + +164 +»s1 + = 0; + +165 +¡ + = +FLOAT_NEG +; + +169 +¡ + = +ERROR +; + +173  +DEC_NEG_OK +: + +174 ià( +c + >= '0' && c <= '9') { + +175 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 10) < 0) + +176 +¡ + = +ERROR +; + +178 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +179 ià( +c + == '.') { + +180 +¡ + = +FLOAT_NEG +; + +184 +¡ + = +ERROR +; + +188  +DEC_POS_OK +: + +189 ià( +c + >= '0' && c <= '9') { + +190 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 10) < 0) + +191 +¡ + = +ERROR +; + +193 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +194 ià( +c + == '.') { + +195 +¡ + = +FLOAT_POS +; + +199 +¡ + = +ERROR +; + +203  +HEX +: + +204 +¡ + = +HEX_OK +; + +206  +HEX_OK +: + +207 ià( +c + >= '0' && c <= '9') { + +208 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 16) < 0) + +209 +¡ + = +ERROR +; + +211 ià( +c + >= 'a' && c <= 'f') { + +212 ià( + `add_to_»s +( +c + - 'a' + 10, & +»s1 +, 16) < 0) + +213 +¡ + = +ERROR +; + +215 ià( +c + >= 'A' && c <= 'F') { + +216 ià( + `add_to_»s +( +c + - 'A' + 10, & +»s1 +, 16) < 0) + +217 +¡ + = +ERROR +; + +220 +¡ + = +ERROR +; + +225  +OCTAL_OK +: + +226 ià( +c + >= '0' && c <= '7') { + +227 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 8) < 0) + +228 +¡ + = +ERROR +; + +231 +¡ + = +ERROR +; + +235  +BIN +: + +236 +¡ + = +BIN_OK +; + +238  +BIN_OK +: + +239 ià( +c + >= '0' && c <= '1') { + +240 ià( + `add_to_»s +( +c + - '0', & +»s1 +, 2) < 0) + +241 +¡ + = +ERROR +; + +244 +¡ + = +ERROR +; + +248 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +249  +FLOAT_POS +: + +250 ià( +c + >= '0' && c <= '9') { + +251 ià( + `add_to_»s +( +c + - '0', & +»s2 +, 10) < 0) + +252 +¡ + = +ERROR +; + +254 +¡ + = +FLOAT_POS_OK +; + +255 +»s3 + = 10; + +258 +¡ + = +ERROR +; + +262  +FLOAT_NEG +: + +263 ià( +c + >= '0' && c <= '9') { + +264 ià( + `add_to_»s +( +c + - '0', & +»s2 +, 10) < 0) + +265 +¡ + = +ERROR +; + +267 +¡ + = +FLOAT_NEG_OK +; + +268 +»s3 + = 10; + +271 +¡ + = +ERROR +; + +275  +FLOAT_POS_OK +: + +276 ià( +c + >= '0' && c <= '9') { + +277 ià( + `add_to_»s +( +c + - '0', & +»s2 +, 10) < 0) + +278 +¡ + = +ERROR +; + +279 ià( + `add_to_»s +(0, & +»s3 +, 10) < 0) + +280 +¡ + = +ERROR +; + +283 +¡ + = +ERROR +; + +287  +FLOAT_NEG_OK +: + +288 ià( +c + >= '0' && c <= '9') { + +289 ià( + `add_to_»s +( +c + - '0', & +»s2 +, 10) < 0) + +290 +¡ + = +ERROR +; + +291 ià( + `add_to_»s +(0, & +»s3 +, 10) < 0) + +292 +¡ + = +ERROR +; + +295 +¡ + = +ERROR +; + +301 + `debug_´štf +("not impl "); + +305 + `debug_´štf +("(%d) (%d) (%d)\n", + +306 () +»s1 +, () +»s2 +, () +»s3 +); + +308 +buf + ++; + +309 +c + = * +buf +; + +312 ià( +buf +- +¤cbuf + > 127) + +316  +¡ +) { + +317  +ZERO_OK +: + +318  +DEC_POS_OK +: + +319  +HEX_OK +: + +320  +OCTAL_OK +: + +321  +BIN_OK +: + +322 iàÐ +nd +. +ty³ + =ð +INT8 + && +»s1 + <ð +S08_MAX + ) { + +323 ià( +»s +) + +324 *( +št8_t + *) +»s + = (št8_tè +»s1 +; + +325  ( +buf +- +¤cbuf +); + +327 iàÐ +nd +. +ty³ + =ð +INT16 + && +»s1 + <ð +S16_MAX + ) { + +328 ià( +»s +) + +329 *( +št16_t + *) +»s + = (št16_tè +»s1 +; + +330  ( +buf +- +¤cbuf +); + +332 iàÐ +nd +. +ty³ + =ð +INT32 + && +»s1 + <ð +S32_MAX + ) { + +333 ià( +»s +) + +334 *( +št32_t + *) +»s + = (št32_tè +»s1 +; + +335  ( +buf +- +¤cbuf +); + +337 iàÐ +nd +. +ty³ + =ð +INT64 + && +»s1 + <ð +S64_MAX + ) { + +338 ià( +»s +) + +339 *( +št64_t + *) +»s + = (št64_tè +»s1 +; + +340  ( +buf +- +¤cbuf +); + +342 iàÐ +nd +. +ty³ + =ð +UINT8 + && +»s1 + <ð +U08_MAX + ) { + +343 ià( +»s +) + +344 *( +ušt8_t + *) +»s + = (ušt8_tè +»s1 +; + +345  ( +buf +- +¤cbuf +); + +347 ià( +nd +. +ty³ + =ð +UINT16 + && +»s1 + <ð +U16_MAX + ) { + +348 ià( +»s +) + +349 *( +ušt16_t + *) +»s + = (ušt16_tè +»s1 +; + +350  ( +buf +- +¤cbuf +); + +352 iàÐ +nd +. +ty³ + =ð +UINT32 + ) { + +353 ià( +»s +) + +354 *( +ušt32_t + *) +»s + = (ušt32_tè +»s1 +; + +355  ( +buf +- +¤cbuf +); + +357 iàÐ +nd +. +ty³ + =ð +UINT64 + ) { + +358 ià( +»s +) + +359 *( +ušt64_t + *) +»s + = (ušt64_tè +»s1 +; + +360  ( +buf +- +¤cbuf +); + +362 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +363 iàÐ +nd +. +ty³ + =ð +FLOAT + ) { + +364 ià( +»s +) + +365 *(*) +»s + = () +»s1 +; + +366  ( +buf +- +¤cbuf +); + +374  +DEC_NEG_OK +: + +375 iàÐ +nd +. +ty³ + =ð +INT8 + && +»s1 + <ð +S08_MAX + + 1 ) { + +376 ià( +»s +) + +377 *( +št8_t + *) +»s + = - (št8_tè +»s1 +; + +378  ( +buf +- +¤cbuf +); + +380 iàÐ +nd +. +ty³ + =ð +INT16 + && +»s1 + <ð( +ušt16_t +) +S16_MAX + + 1 ) { + +381 ià( +»s +) + +382 *( +št16_t + *) +»s + = - (št16_tè +»s1 +; + +383  ( +buf +- +¤cbuf +); + +385 iàÐ +nd +. +ty³ + =ð +INT32 + && +»s1 + <ð( +ušt32_t +) +S32_MAX + + 1 ) { + +386 ià( +»s +) + +387 *( +št32_t + *) +»s + = - (št32_tè +»s1 +; + +388  ( +buf +- +¤cbuf +); + +390 iàÐ +nd +. +ty³ + =ð +INT64 + && +»s1 + <ð( +ušt64_t +) +S64_MAX + + 1 ) { + +391 ià( +»s +) + +392 *( +št64_t + *) +»s + = - (št64_tè +»s1 +; + +393  ( +buf +- +¤cbuf +); + +395 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +396 iàÐ +nd +. +ty³ + =ð +FLOAT + ) { + +397 ià( +»s +) + +398 *(*) +»s + = - () +»s1 +; + +399  ( +buf +- +¤cbuf +); + +407 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +408  +FLOAT_POS +: + +409  +FLOAT_POS_OK +: + +410 iàÐ +nd +. +ty³ + =ð +FLOAT + ) { + +411 ià( +»s +) + +412 *(*) +»s + = () +»s1 + + (() +»s2 + / () +»s3 +); + +413  ( +buf +- +¤cbuf +); + +421  +FLOAT_NEG +: + +422  +FLOAT_NEG_OK +: + +423 iàÐ +nd +. +ty³ + =ð +FLOAT + ) { + +424 ià( +»s +) + +425 *(*) +»s + = - (() +»s1 + + (() +»s2 + / () +»s3 +)); + +426  ( +buf +- +¤cbuf +); + +435 + `debug_´štf +("error\n"); + +439 + } +} + +443 +št8_t + + +444 + $g‘_h–p_num +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, +ušt8_t + +size +) + +446  +tok’_num_d©a + +nd +; + +448 + `memýy_P +(& +nd +, &(( +tok’_num + *) +tk +)-> +num_d©a +, (nd)); + +454 + `¡ºýy_P +( +d¡buf +, +num_h–p +[ +nd +. +ty³ +], +size +); + +455 +d¡buf +[ +size +-1] = '\0'; + +457 + } +} + + @parse_num.h + +1 #iâdeà +_PARSE_NUM_H_ + + +2  + #_PARSE_NUM_H_ + + + ) + +4  + ~"·r£.h +" + +6 + enumty³ + { + +7 + mUINT8 + = 0, + +8 + mUINT16 +, + +9 + mUINT32 +, + +10 + mUINT64 +, + +11 + mINT8 +, + +12 + mINT16 +, + +13 + mINT32 +, + +14 + mINT64 +, + +15 #iâdeà +CONFIG_MODULE_PARSE_NO_FLOAT + + +16 + mFLOAT +, + +20  + stok’_num_d©a + { + +21 +numty³ + + mty³ +; + +24  + stok’_num + { + +25  +tok’_hdr + + mhdr +; + +26  +tok’_num_d©a + + mnum_d©a +; + +28  +tok’_num + + t·r£_tok’_num_t +; + +29  + stok’_num_pgm + { + +30  +tok’_hdr + + mhdr +; + +31  +tok’_num_d©a + + mnum_d©a +; + +32 } + gPROGMEM +; + +33  +tok’_num_pgm + + t·r£_pgm_tok’_num_t +; + +35  +tok’_Ýs + +tok’_num_Ýs +; + +37 +št8_t + +·r£_num +( +·r£_pgm_tok’_hdr_t + * +tk +, + +38 cÚ¡ * +¤cbuf +, * +»s +); + +39 +št8_t + +g‘_h–p_num +( +·r£_pgm_tok’_hdr_t + * +tk +, + +40 * +d¡buf +, +ušt8_t + +size +); + +42  + #TOKEN_NUM_INITIALIZER +( +¡ruùu» +, +f›ld +, +numty³ +) \ + +44 . +hdr + = { \ + +45 . +Ýs + = & +tok’_num_Ýs +, \ + +46 . +off£t + = + `off£tof +( +¡ruùu» +, +f›ld +), \ + +48 . +num_d©a + = { \ + +49 . +ty³ + = +numty³ +, \ + +51 } + + ) + + @parse_string.c + +1  + ~<¡dio.h +> + +2  + ~<š‰y³s.h +> + +3  + ~<ùy³.h +> + +4  + ~<¡ršg.h +> + +6  + ~"·r£.h +" + +7  + ~"·r£_¡ršg.h +" + +9  +tok’_Ýs + + gtok’_¡ršg_Ýs + = { + +10 . +·r£ + = +·r£_¡ršg +, + +11 . + gcom¶‘e_g‘_nb + = +com¶‘e_g‘_nb_¡ršg +, + +12 . + gcom¶‘e_g‘_–t + = +com¶‘e_g‘_–t_¡ršg +, + +13 . + gg‘_h–p + = +g‘_h–p_¡ršg +, + +16  + #MULTISTRING_HELP + + `PSTR +("Mul-choiû STRING") + + ) + +17  + #ANYSTRING_HELP + + `PSTR +("Any STRING") + + ) + +18  + #FIXEDSTRING_HELP + + `PSTR +("Fixed STRING") + + ) + +20  +ušt8_t + + +21 + $g‘_tok’_Ën +(cÚ¡ +´og_ch¬ + * +s +) + +23 +´og_ch¬ + +c +; + +24 +ušt8_t + +i +=0; + +26 +c + = + `pgm_»ad_by‹ +( +s ++ +i +); + +27  +c +!='#' && c!='\0') { + +28 +i +++; + +29 +c + = + `pgm_»ad_by‹ +( +s ++ +i +); + +31  +i +; + +32 + } +} + +34 cÚ¡ +´og_ch¬ + * + +35 + $g‘_Ãxt_tok’ +(cÚ¡ +´og_ch¬ + * +s +) + +37 +ušt8_t + +i +; + +38 +i + = + `g‘_tok’_Ën +( +s +); + +39 ià( + `pgm_»ad_by‹ +( +s ++ +i +) == '#') + +40  +s ++ +i ++1; + +41  +NULL +; + +42 + } +} + +44 +št8_t + + +45 + $·r£_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +buf +, * +»s +) + +47  +tok’_¡ršg_d©a + +sd +; + +48 +ušt8_t + +tok’_Ën +; + +49 cÚ¡ +´og_ch¬ + * +¡r +; + +51 ià(! * +buf +) + +54 + `memýy_P +(& +sd +, &(( +tok’_¡ršg + *) +tk +)-> +¡ršg_d©a +, (sd)); + +57 ià( +sd +. +¡r +) { + +58 +¡r + = +sd +.str; + +60 +tok’_Ën + = + `g‘_tok’_Ën +( +¡r +); + +63 ià( +tok’_Ën + >ð +STR_TOKEN_SIZE + - 1) { + +67 iàÐ + `¡ºcmp_P +( +buf +, +¡r +, +tok’_Ën +) ) { + +71 iàÐ! + `i£ndoáok’ +(*( +buf ++ +tok’_Ën +)) ) { + +76 }  ( +¡r + = + `g‘_Ãxt_tok’ +(¡r)è!ð +NULL + ); + +78 ià(! +¡r +) + +83 +tok’_Ën +=0; + +84 ! + `i£ndoáok’ +( +buf +[ +tok’_Ën +]) && + +85 +tok’_Ën + < ( +STR_TOKEN_SIZE +-1)) + +86 +tok’_Ën +++; + +89 ià( +tok’_Ën + >ð +STR_TOKEN_SIZE + - 1) { + +94 ià( +»s +) { + +96 + `¡ºýy +( +»s +, +buf +, +tok’_Ën +); + +97 *((*) +»s + + +tok’_Ën +) = 0; + +100  +tok’_Ën +; + +101 + } +} + +103 +št8_t + + $com¶‘e_g‘_nb_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +) + +105  +tok’_¡ršg_d©a + +sd +; + +106 +št8_t + +»t +=1; + +108 + `memýy_P +(& +sd +, &(( +tok’_¡ršg + *) +tk +)-> +¡ršg_d©a +, (sd)); + +110 ià(! +sd +. +¡r +) + +113  ( +sd +. +¡r + = + `g‘_Ãxt_tok’ +(sd.¡r)è!ð +NULL + ) { + +114 +»t +++; + +116  +»t +; + +117 + } +} + +119 +št8_t + + $com¶‘e_g‘_–t_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, +št8_t + +idx +, + +120 * +d¡buf +, +ušt8_t + +size +) + +122  +tok’_¡ršg_d©a + +sd +; + +123 cÚ¡ +´og_ch¬ + * +s +; + +124 +ušt8_t + +Ën +; + +126 + `memýy_P +(& +sd +, &(( +tok’_¡ršg + *) +tk +)-> +¡ršg_d©a +, (sd)); + +127 +s + = +sd +. +¡r +; + +129  +idx +-- && +s +) + +130 +s + = + `g‘_Ãxt_tok’ +(s); + +132 ià(! +s +) + +135 +Ën + = + `g‘_tok’_Ën +( +s +); + +136 ià( +Ën + > +size + - 1) + +139 + `memýy_P +( +d¡buf +, +s +, +Ën +); + +140 +d¡buf +[ +Ën +] = '\0'; + +143 + } +} + +146 +št8_t + + $g‘_h–p_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, +ušt8_t + +size +) + +148  +tok’_¡ršg_d©a + +sd +; + +149 cÚ¡ +´og_ch¬ + * +s +; + +151 + `memýy_P +(& +sd +, &(( +tok’_¡ršg + *) +tk +)-> +¡ršg_d©a +, (sd)); + +152 +s + = +sd +. +¡r +; + +154 ià( +s +) { + +155 ià( + `g‘_Ãxt_tok’ +( +s +)) { + +156 + `¡ºýy_P +( +d¡buf +, +MULTISTRING_HELP +, +size +); + +159 + `¡ºýy_P +( +d¡buf +, +FIXEDSTRING_HELP +, +size +); + +163 + `¡ºýy_P +( +d¡buf +, +ANYSTRING_HELP +, +size +); + +166 +d¡buf +[ +size +-1] = '\0'; + +169 + } +} + + @parse_string.h + +1 #iâdeà +_PARSE_STRING_H_ + + +2  + #_PARSE_STRING_H_ + + + ) + +4  + ~"·r£.h +" + +7  + #STR_TOKEN_SIZE + 32 + + ) + +9  + tfixed_¡ršg_t +[ +STR_TOKEN_SIZE +]; + +11  + stok’_¡ršg_d©a + { + +12 cÚ¡ +´og_ch¬ + * + m¡r +; + +15  + stok’_¡ršg + { + +16  +tok’_hdr + + mhdr +; + +17  +tok’_¡ršg_d©a + + m¡ršg_d©a +; + +19  +tok’_¡ršg + + t·r£_tok’_¡ršg_t +; + +20  + stok’_¡ršg_pgm + { + +21  +tok’_hdr + + mhdr +; + +22  +tok’_¡ršg_d©a + + m¡ršg_d©a +; + +23 } + gPROGMEM +; + +24  +tok’_¡ršg_pgm + + t·r£_pgm_tok’_¡ršg_t +; + +26  +tok’_Ýs + +tok’_¡ršg_Ýs +; + +28 +št8_t + +·r£_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, cÚ¡ * +¤cbuf +, * +»s +); + +29 +št8_t + +com¶‘e_g‘_nb_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +); + +30 +št8_t + +com¶‘e_g‘_–t_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, iÁ8_ˆ +idx +, + +31 * +d¡buf +, +ušt8_t + +size +); + +32 +št8_t + +g‘_h–p_¡ršg +( +·r£_pgm_tok’_hdr_t + * +tk +, * +d¡buf +, +ušt8_t + +size +); + +34  + #TOKEN_STRING_INITIALIZER +( +¡ruùu» +, +f›ld +, +¡ršg +) \ + +36 . +hdr + = { \ + +37 . +Ýs + = & +tok’_¡ršg_Ýs +, \ + +38 . +off£t + = + `off£tof +( +¡ruùu» +, +f›ld +), \ + +40 . +¡ršg_d©a + = { \ + +41 . +¡r + = +¡ršg +, \ + +43 } + + ) + + @pid_config.h + +22 #iâdeà +PID_CONFIG_H + + +23  + #PID_CONFIG_H + + + ) + +28  + #PID_DERIVATE_FILTER_MAX_SIZE + 6 + + ) + + @rdline.c + +24  + ~<¡dlib.h +> + +25  + ~<¡dio.h +> + +26  + ~<¡ršg.h +> + +27  + ~<¡d¬g.h +> + +28  + ~<ùy³.h +> + +30  + ~ + +32  + ~ + +33  + ~"rdlše.h +" + +35  +rdlše_puts_P +( +rdlše + * +rdl +, cÚ¡ +´og_ch¬ + * +buf +); + +36  +rdlše_mšrštf_P +( +rdlše + * +rdl +, + +37 cÚ¡ +´og_ch¬ + * +buf +, +ušt8_t + +v® +); + +39 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +40  +rdlše_»move_Þd_hi¡Üy_™em +( +rdlše + * +rdl +); + +41  +rdlše_»move_fœ¡_hi¡Üy_™em +( +rdlše + * +rdl +); + +42  +ušt8_t + +rdlše_g‘_hi¡Üy_size +( +rdlše + * +rdl +); + +46  + $rdlše_š™ +( +rdlše + * +rdl +, + +47 +rdlše_wr™e_ch¬_t + * +wr™e_ch¬ +, + +48 +rdlše_v®id©e_t + * +v®id©e +, + +49 +rdlše_com¶‘e_t + * +com¶‘e +) + +51 + `mem£t +( +rdl +, 0, (*rdl)); + +52 +rdl +-> +v®id©e + = validate; + +53 +rdl +-> +com¶‘e + = complete; + +54 +rdl +-> +wr™e_ch¬ + = write_char; + +55 +rdl +-> +¡©us + = +RDLINE_INIT +; + +56 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +57 + `cœbuf_š™ +(& +rdl +-> +hi¡Üy +,„dl-> +hi¡Üy_buf +, 0, +RDLINE_HISTORY_BUF_SIZE +); + +59 + } +} + +62 + $rdlše_Ãwlše +( +rdlše + * +rdl +, cÚ¡ * +´om± +) + +64 +ušt8_t + +i +; + +66 + `vt100_š™ +(& +rdl +-> +vt100 +); + +67 + `cœbuf_š™ +(& +rdl +-> +Ëá +,„dl-> +Ëá_buf +, 0, +RDLINE_BUF_SIZE +); + +68 + `cœbuf_š™ +(& +rdl +-> +right +,„dl-> +right_buf +, 0, +RDLINE_BUF_SIZE +); + +70 ià( +´om± + !ð +rdl +->prompt) + +71 + `memýy +( +rdl +-> +´om± +,…rompt, (rdl->prompt)-1); + +72 +rdl +-> +´om±_size + = + `¡¾’ +( +´om± +); + +74  +i +=0 ; i< +rdl +-> +´om±_size + ; i++) + +75 +rdl +-> + `wr™e_ch¬ +Ôdl-> +´om± +[ +i +]); + +76 +rdl +-> +¡©us + = +RDLINE_RUNNING +; + +78 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +79 +rdl +-> +hi¡Üy_cur_lše + = -1; + +81 + } +} + +84 + $rdlše_¡Ý +( +rdlše + * +rdl +) + +86 +rdl +-> +¡©us + = +RDLINE_INIT +; + +87 + } +} + +90 + $rdlše_»¡¬t +( +rdlše + * +rdl +) + +92 +rdl +-> +¡©us + = +RDLINE_RUNNING +; + +93 + } +} + +96 + $rdlše_g‘_bufãr +( +rdlše + * +rdl +) + +98 +ušt8_t + +Ën_l +, +Ën_r +; + +99 + `cœbuf_®ign_Ëá +(& +rdl +-> +Ëá +); + +100 + `cœbuf_®ign_Ëá +(& +rdl +-> +right +); + +102 +Ën_l + = + `CIRBUF_GET_LEN +(& +rdl +-> +Ëá +); + +103 +Ën_r + = + `CIRBUF_GET_LEN +(& +rdl +-> +right +); + +104 + `memýy +( +rdl +-> +Ëá_buf ++ +Ën_l +,„dl-> +right_buf +, +Ën_r +); + +106 +rdl +-> +Ëá_buf +[ +Ën_l + + +Ën_r +] = '\n'; + +107 +rdl +-> +Ëá_buf +[ +Ën_l + + +Ën_r + + 1] = '\0'; + +108  +rdl +-> +Ëá_buf +; + +109 + } +} + +112 + $di¥Ïy_right_bufãr +( +rdlše + * +rdl +) + +114 +ušt8_t + +i +; + +115  +tmp +; + +117 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_þ—r_right +)); + +118 ià(! + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +)) { + +119 + `CIRBUF_FOREACH +(& +rdl +-> +right +, +i +, +tmp +) { + +120 +rdl +-> + `wr™e_ch¬ +( +tmp +); + +122 + `rdlše_mšrštf_P +( +rdl +, + `PSTR +( +vt100_muÉi_Ëá +), + +123 + `CIRBUF_GET_LEN +(& +rdl +-> +right +)); + +125 + } +} + +127  + $rdlše_»di¥Ïy +( +rdlše + * +rdl +) + +129 +ušt8_t + +i +; + +130  +tmp +; + +132 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_home +)); + +133  +i +=0 ; i< +rdl +-> +´om±_size + ; i++) + +134 +rdl +-> + `wr™e_ch¬ +Ôdl-> +´om± +[ +i +]); + +135 + `CIRBUF_FOREACH +(& +rdl +-> +Ëá +, +i +, +tmp +) { + +136 +rdl +-> + `wr™e_ch¬ +( +tmp +); + +138 + `di¥Ïy_right_bufãr +( +rdl +); + +139 + } +} + +141 +št8_t + + +142 + $rdlše_ch¬_š +( +rdlše + * +rdl +,  +c +) + +144 +ušt8_t + +i +; + +145 +št8_t + +cmd +; + +146  +tmp +; + +147 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +148 * +buf +; + +151 ià( +rdl +-> +¡©us + !ð +RDLINE_RUNNING +) + +154 +cmd + = + `vt100_·r£r +(& +rdl +-> +vt100 +, +c +); + +155 ià( +cmd + == -2) + +158 ià( +cmd + >= 0) { + +159  +cmd +) { + +160  +KEY_CTRL_B +: + +161  +KEY_LEFT_ARR +: + +162 ià( + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +)) + +164 +tmp + = + `cœbuf_g‘_ž +(& +rdl +-> +Ëá +); + +165 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +166 + `cœbuf_add_h—d +(& +rdl +-> +right +, +tmp +); + +167 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_Ëá_¬r +)); + +170  +KEY_CTRL_F +: + +171  +KEY_RIGHT_ARR +: + +172 ià( + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +)) + +174 +tmp + = + `cœbuf_g‘_h—d +(& +rdl +-> +right +); + +175 + `cœbuf_d–_h—d +(& +rdl +-> +right +); + +176 + `cœbuf_add_ž +(& +rdl +-> +Ëá +, +tmp +); + +177 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_right_¬r +)); + +180  +KEY_WLEFT +: + +181 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +) && + +182 ( +tmp + = + `cœbuf_g‘_ž +(& +rdl +-> +Ëá +)) && + +183 + `isbÏnk +( +tmp +)) { + +184 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_Ëá_¬r +)); + +185 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +186 + `cœbuf_add_h—d +(& +rdl +-> +right +, +tmp +); + +188 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +) && + +189 ( +tmp + = + `cœbuf_g‘_ž +(& +rdl +-> +Ëá +)) && + +190 ! + `isbÏnk +( +tmp +)) { + +191 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_Ëá_¬r +)); + +192 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +193 + `cœbuf_add_h—d +(& +rdl +-> +right +, +tmp +); + +197  +KEY_WRIGHT +: + +198 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +) && + +199 ( +tmp + = + `cœbuf_g‘_h—d +(& +rdl +-> +right +)) && + +200 + `isbÏnk +( +tmp +)) { + +201 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_right_¬r +)); + +202 + `cœbuf_d–_h—d +(& +rdl +-> +right +); + +203 + `cœbuf_add_ž +(& +rdl +-> +Ëá +, +tmp +); + +205 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +) && + +206 ( +tmp + = + `cœbuf_g‘_h—d +(& +rdl +-> +right +)) && + +207 ! + `isbÏnk +( +tmp +)) { + +208 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_right_¬r +)); + +209 + `cœbuf_d–_h—d +(& +rdl +-> +right +); + +210 + `cœbuf_add_ž +(& +rdl +-> +Ëá +, +tmp +); + +214  +KEY_BKSPACE +: + +215 if(! + `cœbuf_d–_ž_§ã +(& +rdl +-> +Ëá +)) { + +216 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_bs +)); + +217 + `di¥Ïy_right_bufãr +( +rdl +); + +221  +KEY_META_BKSPACE +: + +222 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +è&& + `isbÏnk +( + `cœbuf_g‘_ž +(&rdl->left))) { + +223 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_bs +)); + +224 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +226 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +è&& ! + `isbÏnk +( + `cœbuf_g‘_ž +(&rdl->left))) { + +227 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_bs +)); + +228 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +230 + `di¥Ïy_right_bufãr +( +rdl +); + +233  +KEY_SUPPR +: + +234  +KEY_CTRL_D +: + +235 if(! + `cœbuf_d–_h—d_§ã +(& +rdl +-> +right +)) { + +236 + `di¥Ïy_right_bufãr +( +rdl +); + +238 ià( +cmd + =ð +KEY_CTRL_D + && + +239 + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +) && + +240 + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +)) { + +245  +KEY_CTRL_A +: + +246 ià( + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +)) + +248 + `rdlše_mšrštf_P +( +rdl +, + `PSTR +( +vt100_muÉi_Ëá +), + +249 + `CIRBUF_GET_LEN +(& +rdl +-> +Ëá +)); + +250 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +Ëá +)) { + +251 +tmp + = + `cœbuf_g‘_ž +(& +rdl +-> +Ëá +); + +252 + `cœbuf_d–_ž +(& +rdl +-> +Ëá +); + +253 + `cœbuf_add_h—d +(& +rdl +-> +right +, +tmp +); + +257  +KEY_CTRL_E +: + +258 ià( + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +)) + +260 + `rdlše_mšrštf_P +( +rdl +, + `PSTR +( +vt100_muÉi_right +), + +261 + `CIRBUF_GET_LEN +(& +rdl +-> +right +)); + +262 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +right +)) { + +263 +tmp + = + `cœbuf_g‘_h—d +(& +rdl +-> +right +); + +264 + `cœbuf_d–_h—d +(& +rdl +-> +right +); + +265 + `cœbuf_add_ž +(& +rdl +-> +Ëá +, +tmp +); + +269 #ifdeà +CONFIG_MODULE_RDLINE_KILL_BUF + + +270  +KEY_CTRL_K +: + +271 + `cœbuf_g‘_buf_h—d +(& +rdl +-> +right +,„dl-> +kžl_buf +, +RDLINE_BUF_SIZE +); + +272 +rdl +-> +kžl_size + = + `CIRBUF_GET_LEN +(&rdl-> +right +); + +273 + `cœbuf_d–_buf_h—d +(& +rdl +-> +right +,„dl-> +kžl_size +); + +274 + `rdlše_puts_P +( +rdl +, + `PSTR +( +vt100_þ—r_right +)); + +277  +KEY_CTRL_Y +: + +278 +i +=0; + +279  + `CIRBUF_GET_LEN +(& +rdl +-> +right +è+ CIRBUF_GET_LEN(&rdl-> +Ëá +) < + +280 +RDLINE_BUF_SIZE + && + +281 +i + < +rdl +-> +kžl_size +) { + +282 + `cœbuf_add_ž +(& +rdl +-> +Ëá +,„dl-> +kžl_buf +[ +i +]); + +283 +rdl +-> + `wr™e_ch¬ +Ôdl-> +kžl_buf +[ +i +]); + +284 +i +++; + +286 + `di¥Ïy_right_bufãr +( +rdl +); + +290  +KEY_CTRL_C +: + +291 + `rdlše_puts_P +( +rdl +, + `PSTR +("\r\n")); + +292 + `rdlše_Ãwlše +( +rdl +,„dl-> +´om± +); + +295  +KEY_CTRL_L +: + +296 + `rdlše_»di¥Ïy +( +rdl +); + +299  +KEY_TAB +: + +300  +KEY_HELP +: + +301 + `cœbuf_®ign_Ëá +(& +rdl +-> +Ëá +); + +302 +rdl +-> +Ëá_buf +[ + `CIRBUF_GET_LEN +(&rdl-> +Ëá +)] = '\0'; + +303 ià( +rdl +-> +com¶‘e +) { + +304  +tmp_buf +[127]; + +305 +št16_t + +com¶‘e_¡©e +; + +306 +št8_t + +»t +; + +307  +tmp_size +; + +309 ià( +cmd + =ð +KEY_TAB +) + +310 +com¶‘e_¡©e + = 0; + +312 +com¶‘e_¡©e + = -1; + +314 +»t + = +rdl +-> + `com¶‘e +Ôdl-> +Ëá_buf +, +tmp_buf +, (tmp_buf), + +315 & +com¶‘e_¡©e +); + +317 ià( +»t + <= 0) { + +321 +tmp_size + = + `¡¾’ +( +tmp_buf +); + +323 ià( +»t + == 2) { + +324 +i +=0; + +325  + `CIRBUF_GET_LEN +(& +rdl +-> +right +è+ CIRBUF_GET_LEN(&rdl-> +Ëá +) < + +326 +RDLINE_BUF_SIZE + && + +327 +i + < +tmp_size +) { + +328 + `cœbuf_add_ž +(& +rdl +-> +Ëá +, +tmp_buf +[ +i +]); + +329 +rdl +-> + `wr™e_ch¬ +( +tmp_buf +[ +i +]); + +330 +i +++; + +332 + `di¥Ïy_right_bufãr +( +rdl +); + +337 + `rdlše_puts_P +( +rdl +, + `PSTR +("\r\n")); + +338  +»t +) { + +339 +rdl +-> + `wr™e_ch¬ +(' '); + +340  +i +=0 ; +tmp_buf +[i] ; i++) + +341 +rdl +-> + `wr™e_ch¬ +( +tmp_buf +[ +i +]); + +342 + `rdlše_puts_P +( +rdl +, + `PSTR +("\r\n")); + +343 +»t + = +rdl +-> + `com¶‘e +Ôdl-> +Ëá_buf +, +tmp_buf +, + +344 ( +tmp_buf +), & +com¶‘e_¡©e +); + +347 + `rdlše_»di¥Ïy +( +rdl +); + +351  +KEY_RETURN +: + +352  +KEY_RETURN2 +: + +353 + `rdlše_g‘_bufãr +( +rdl +); + +354 +rdl +-> +¡©us + = +RDLINE_INIT +; + +355 + `rdlše_puts_P +( +rdl +, + `PSTR +("\r\n")); + +356 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +357 ià( +rdl +-> +hi¡Üy_cur_lše + != -1) + +358 + `rdlše_»move_fœ¡_hi¡Üy_™em +( +rdl +); + +361 ià( +rdl +-> +v®id©e +) + +362 +rdl +-> + `v®id©e +Ôdl-> +Ëá_buf +, + `CIRBUF_GET_LEN +(&rdl-> +Ëá +)+2); + +365 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +366  +KEY_UP_ARR +: + +367 ià( +rdl +-> +hi¡Üy_cur_lše + == 0) { + +368 + `rdlše_»move_fœ¡_hi¡Üy_™em +( +rdl +); + +370 ià( +rdl +-> +hi¡Üy_cur_lše + <= 0) { + +371 + `rdlše_add_hi¡Üy +( +rdl +, + `rdlše_g‘_bufãr +(rdl)); + +372 +rdl +-> +hi¡Üy_cur_lše + = 0; + +375 +buf + = + `rdlše_g‘_hi¡Üy_™em +( +rdl +,„dl-> +hi¡Üy_cur_lše + + 1); + +376 ià(! +buf +) + +379 +rdl +-> +hi¡Üy_cur_lše + ++; + +380 + `vt100_š™ +(& +rdl +-> +vt100 +); + +381 + `cœbuf_š™ +(& +rdl +-> +Ëá +,„dl-> +Ëá_buf +, 0, +RDLINE_BUF_SIZE +); + +382 + `cœbuf_š™ +(& +rdl +-> +right +,„dl-> +right_buf +, 0, +RDLINE_BUF_SIZE +); + +383 + `cœbuf_add_buf_ž +(& +rdl +-> +Ëá +, +buf +, + `¡¾’ +(buf)); + +384 + `rdlše_»di¥Ïy +( +rdl +); + +387  +KEY_DOWN_ARR +: + +388 ià( +rdl +-> +hi¡Üy_cur_lše + - 1 < 0) + +391 +rdl +-> +hi¡Üy_cur_lše + --; + +392 +buf + = + `rdlše_g‘_hi¡Üy_™em +( +rdl +,„dl-> +hi¡Üy_cur_lše +); + +393 ià(! +buf +) + +395 + `vt100_š™ +(& +rdl +-> +vt100 +); + +396 + `cœbuf_š™ +(& +rdl +-> +Ëá +,„dl-> +Ëá_buf +, 0, +RDLINE_BUF_SIZE +); + +397 + `cœbuf_š™ +(& +rdl +-> +right +,„dl-> +right_buf +, 0, +RDLINE_BUF_SIZE +); + +398 + `cœbuf_add_buf_ž +(& +rdl +-> +Ëá +, +buf +, + `¡¾’ +(buf)); + +399 + `rdlše_»di¥Ïy +( +rdl +); + +412 ià(! + `i¥ršt +( +c +)) + +416 ià( + `CIRBUF_GET_LEN +(& +rdl +-> +Ëá +è+ CIRBUF_GET_LEN(&rdl-> +right +è>ð +RDLINE_BUF_SIZE +) + +419 ià( + `cœbuf_add_ž_§ã +(& +rdl +-> +Ëá +, +c +)) + +422 +rdl +-> + `wr™e_ch¬ +( +c +); + +423 + `di¥Ïy_right_bufãr +( +rdl +); + +426 + } +} + +431 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +433 + $rdlše_»move_Þd_hi¡Üy_™em +( +rdlše + * +rdl +) + +435  +tmp +; + +437 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +hi¡Üy +) ) { + +438 +tmp + = + `cœbuf_g‘_h—d +(& +rdl +-> +hi¡Üy +); + +439 + `cœbuf_d–_h—d +(& +rdl +-> +hi¡Üy +); + +440 ià(! +tmp +) + +443 + } +} + +446 + $rdlše_»move_fœ¡_hi¡Üy_™em +( +rdlše + * +rdl +) + +448  +tmp +; + +450 iàÐ + `CIRBUF_IS_EMPTY +(& +rdl +-> +hi¡Üy +) ) { + +454 + `cœbuf_d–_ž +(& +rdl +-> +hi¡Üy +); + +457 ! + `CIRBUF_IS_EMPTY +(& +rdl +-> +hi¡Üy +) ) { + +458 +tmp + = + `cœbuf_g‘_ž +(& +rdl +-> +hi¡Üy +); + +459 ià(! +tmp +) + +461 + `cœbuf_d–_ž +(& +rdl +-> +hi¡Üy +); + +463 + } +} + +465  +ušt8_t + + +466 + $rdlše_g‘_hi¡Üy_size +( +rdlše + * +rdl +) + +468 +ušt8_t + +i +, +tmp +, +»t +=0; + +470 + `CIRBUF_FOREACH +(& +rdl +-> +hi¡Üy +, +i +, +tmp +) { + +471 ià( +tmp + == 0) + +472 +»t + ++; + +475  +»t +; + +476 + } +} + +479 + $rdlše_g‘_hi¡Üy_™em +( +rdlše + * +rdl +, +ušt8_t + +idx +) + +481 +ušt8_t + +Ën +, +i +, +tmp +; + +483 +Ën + = + `rdlše_g‘_hi¡Üy_size +( +rdl +); + +484 iàÐ +idx + >ð +Ën + ) { + +485  +NULL +; + +488 + `cœbuf_®ign_Ëá +(& +rdl +-> +hi¡Üy +); + +490 + `CIRBUF_FOREACH +(& +rdl +-> +hi¡Üy +, +i +, +tmp +) { + +491 iàÐ +idx + =ð +Ën + - 1) { + +492  +rdl +-> +hi¡Üy_buf + + +i +; + +494 ià( +tmp + == 0) + +495 +Ën + --; + +498  +NULL +; + +499 + } +} + +501 +št8_t + + +502 + $rdlše_add_hi¡Üy +( +rdlše + * +rdl +, cÚ¡ * +buf +) + +504 +cœbuf_ušt + +Ën +, +i +; + +506 +Ën + = + `¡¾’ +( +buf +); + +507  +i +=0; i< +Ën + ; i++) { + +508 ià( +buf +[ +i +] == '\n') { + +509 +Ën + = +i +; + +514 iàÐ +Ën + >ð +RDLINE_HISTORY_BUF_SIZE + ) + +517  +Ën + >ð + `CIRBUF_GET_FREELEN +(& +rdl +-> +hi¡Üy +) ) { + +518 + `rdlše_»move_Þd_hi¡Üy_™em +( +rdl +); + +521 + `cœbuf_add_buf_ž +(& +rdl +-> +hi¡Üy +, +buf +, +Ën +); + +522 + `cœbuf_add_ž +(& +rdl +-> +hi¡Üy +, 0); + +525 + } +} + +528 + $rdlše_þ—r_hi¡Üy +( +rdlše + * +rdl +) + +530 + `cœbuf_š™ +(& +rdl +-> +hi¡Üy +,„dl-> +hi¡Üy_buf +, 0, +RDLINE_HISTORY_BUF_SIZE +); + +531 + } +} + +535 +št8_t + + $rdlše_add_hi¡Üy +( +rdlše + * +rdl +, cÚ¡ * +buf +è{ -1; + } +} + +536  + $rdlše_þ—r_hi¡Üy +( +rdlše + * +rdl +è{ + } +} + +537 * + $rdlše_g‘_hi¡Üy_™em +( +rdlše + * +rdl +, +ušt8_t + +i +è{ +NULL +; + } +} + +546 + $rdlše_puts_P +( +rdlše + * +rdl +, cÚ¡ +´og_ch¬ + * +buf +) + +548  +c +; + +549  ( +c += + `pgm_»ad_by‹ +( +buf +++)) != '\0' ) { + +550 +rdl +-> + `wr™e_ch¬ +( +c +); + +552 + } +} + +556 + $rdlše_mšrštf_P +( +rdlše + * +rdl +, cÚ¡ +´og_ch¬ + * +buf +, +ušt8_t + +v® +) + +558  +c +, +¡¬‹d +=0, +div +=100; + +560  ( +c += + `pgm_»ad_by‹ +( +buf +++)) ) { + +561 ià( +c +=='%') { + +562 +c + = + `pgm_»ad_by‹ +( +buf +++); + +564 ià( +c +=='u') { + +565  +div +) { + +566 +c + = +v® + / +div +; + +567 ià( +c + || +¡¬‹d +) { + +568 +rdl +-> + `wr™e_ch¬ +( +c ++'0'); + +569 +¡¬‹d + = 1; + +571 +v® + %ð +div +; + +572 +div + /= 10; + +576 +rdl +-> + `wr™e_ch¬ +('%'); + +577 +rdl +-> + `wr™e_ch¬ +( +c +); + +581 +rdl +-> + `wr™e_ch¬ +( +c +); + +584 + } +} + + @rdline.h + +24 #iâdeà +_RDLINE_H_ + + +25  + #_RDLINE_H_ + + + ) + +34  + ~ + +35  + ~ + +37  + #vt100_b–l + "\007" + + ) + +38  + #vt100_bs + "\010" + + ) + +39  + #vt100_bs_þ—r + "\010 \010" + + ) + +40  + #vt100_b + "\011" + + ) + +41  + #vt100_üÆ + "\012\015" + + ) + +42  + #vt100_þ—r_right + "\033[0K" + + ) + +43  + #vt100_þ—r_Ëá + "\033[1K" + + ) + +44  + #vt100_þ—r_down + "\033[0J" + + ) + +45  + #vt100_þ—r_up + "\033[1J" + + ) + +46  + #vt100_þ—r_lše + "\033[2K" + + ) + +47  + #vt100_þ—r_sü“n + "\033[2J" + + ) + +48  + #vt100_up_¬r + "\033\133\101" + + ) + +49  + #vt100_down_¬r + "\033\133\102" + + ) + +50  + #vt100_right_¬r + "\033\133\103" + + ) + +51  + #vt100_Ëá_¬r + "\033\133\104" + + ) + +52  + #vt100_muÉi_right + "\033\133%uC" + + ) + +53  + #vt100_muÉi_Ëá + "\033\133%uD" + + ) + +54  + #vt100_suµr + "\033\133\063\176" + + ) + +55  + #vt100_home + "\033M\033E" + + ) + +56  + #vt100_wÜd_Ëá + "\033\142" + + ) + +57  + #vt100_wÜd_right + "\033\146" + + ) + +60  + #RDLINE_BUF_SIZE + 64 + + ) + +61  + #RDLINE_PROMPT_SIZE + 16 + + ) + +62  + #RDLINE_VT100_BUF_SIZE + 8 + + ) + +63  + #RDLINE_HISTORY_BUF_SIZE + 128 + + ) + +64  + #RDLINE_HISTORY_MAX_LINE + 64 + + ) + +66 + erdlše_¡©us + { + +67 + mRDLINE_INIT +, + +68 + mRDLINE_RUNNING +, + +71  + grdlše +; + +73 ( + trdlše_wr™e_ch¬_t +)(); + +74 ( + trdlše_v®id©e_t +)(cÚ¡ * + tbuf +, + tušt8_t + + tsize +); + +75  + $št8_t + ( + trdlše_com¶‘e_t +)(cÚ¡ * + tbuf +, * + td¡buf +, + +76 + tušt8_t + + td¡size +, + tšt16_t + * + t¡©e +); + +78  + srdlše + { + +79 +rdlše_¡©us + +¡©us +; + +81  +cœbuf + +Ëá +; + +82  +cœbuf + +right +; + +83  +Ëá_buf +[ +RDLINE_BUF_SIZE ++2]; + +84  +right_buf +[ +RDLINE_BUF_SIZE +]; + +86  +´om± +[ +RDLINE_PROMPT_SIZE +]; + +87 +ušt8_t + +´om±_size +; + +89 #ifdeà +CONFIG_MODULE_RDLINE_KILL_BUF + + +90  +kžl_buf +[ +RDLINE_BUF_SIZE +]; + +91 +ušt8_t + +kžl_size +; + +94 #ifdeà +CONFIG_MODULE_RDLINE_HISTORY + + +96  +cœbuf + +hi¡Üy +; + +97  +hi¡Üy_buf +[ +RDLINE_HISTORY_BUF_SIZE +]; + +98 +št8_t + +hi¡Üy_cur_lše +; + +102 +rdlše_wr™e_ch¬_t + * +wr™e_ch¬ +; + +103 +rdlše_v®id©e_t + * +v®id©e +; + +104 +rdlše_com¶‘e_t + * +com¶‘e +; + +107  +vt100 + vt100; + +120  + `rdlše_š™ +( +rdlše + * +rdl +, + +121 +rdlše_wr™e_ch¬_t + * +wr™e_ch¬ +, + +122 +rdlše_v®id©e_t + * +v®id©e +, + +123 +rdlše_com¶‘e_t + * +com¶‘e +); + +131  + `rdlše_Ãwlše +( +rdlše + * +rdl +, cÚ¡ * +´om± +); + +137  + `rdlše_¡Ý +( +rdlše + * +rdl +); + +143  + `rdlše_»¡¬t +( +rdlše + * +rdl +); + +149  + `rdlše_»di¥Ïy +( +rdlše + * +rdl +); + +164 +št8_t + + `rdlše_ch¬_š +( +rdlše + * +rdl +,  +c +); + +170 cÚ¡ * + `rdlše_g‘_bufãr +( +rdlše + * +rdl +); + +179 +št8_t + + `rdlše_add_hi¡Üy +( +rdlše + * +rdl +, cÚ¡ * +buf +); + +185  + `rdlše_þ—r_hi¡Üy +( +rdlše + * +rdl +); + +190 * + `rdlše_g‘_hi¡Üy_™em +( +rdlše + * +rdl +, +ušt8_t + +i +); + + @rdline_config.h + + @scheduler.c + +22  + ~<¡ršg.h +> + +23  + ~<¡dio.h +> + +24  + ~<š‰y³s.h +> + +26  + ~ + +27  + ~ + +28  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +33  + ~ + +39  +ev’t_t + + gg_b_ev’t +[ +SCHEDULER_NB_MAX_EVENT +]; + +41 #ifdeà +CONFIG_MODULE_SCHEDULER_STATS + + +42  +scheduËr_¡©s + + gsched_¡©s +; + +45  + $scheduËr_š™ +() + +47 + `mem£t +( +g_b_ev’t +, 0, (g_tab_event)); + +49 #ifdeà +CONFIG_MODULE_SCHEDULER_USE_TIMERS + + +50 + `SCHEDULER_TIMER_REGISTER +(); + +53 #ifdeà +CONFIG_MODULE_SCHEDULER_TIMER0 + + +55 +TOIE0_REG + |ð(1<< +TOIE0 +); + +57 +TCNT0 + = 0; + +58 +CS00_REG + = +SCHEDULER_CK +; + +60 + } +} + +63 #ifdeà +CONFIG_MODULE_SCHEDULER_TIMER0 + + +64 + $SIGNAL +( +SIG_OVERFLOW0 +) + +66 + `scheduËr_š‹¼u± +(); + +67 + } +} + + @scheduler.h + +41 #iâdeà +_SCHEDULER_H_ + + +42  + #_SCHEDULER_H_ + + + ) + +44  + ~ + +46 #ifdeà +CONFIG_MODULE_SCHEDULER_USE_TIMERS + + +47  + ~ + +50  + ~ + +52 #ifdeà +CONFIG_MODULE_SCHEDULER_USE_TIMERS + + +53 #ià +SCHEDULER_TIMER_NUM + == 0 + +54  + #SCHEDULER_TIMER_REGISTER +(è + `tim”0_»gi¡”_OV_šŒ +( +scheduËr_š‹¼u± +) + + ) + +55  + #SCHEDULER_CLOCK_PRESCALER + + `tim”0_g‘_´esÿËr_div +() + + ) + +56 #ifdeà +TCNT0H + + +57  + #SCHEDULER_TIMER_BITS + 16 + + ) + +59  + #SCHEDULER_TIMER_BITS + 8 + + ) + +62 #–ià +SCHEDULER_TIMER_NUM + == 1 + +63  + #SCHEDULER_TIMER_REGISTER +(è + `tim”1_»gi¡”_OV_šŒ +( +scheduËr_š‹¼u± +) + + ) + +64  + #SCHEDULER_CLOCK_PRESCALER + + `tim”1_g‘_´esÿËr_div +() + + ) + +65 #ifdeà +TCNT1H + + +66  + #SCHEDULER_TIMER_BITS + 16 + + ) + +68  + #SCHEDULER_TIMER_BITS + 8 + + ) + +71 #–ià +SCHEDULER_TIMER_NUM + == 2 + +72  + #SCHEDULER_TIMER_REGISTER +(è + `tim”2_»gi¡”_OV_šŒ +( +scheduËr_š‹¼u± +) + + ) + +73  + #SCHEDULER_CLOCK_PRESCALER + + `tim”2_g‘_´esÿËr_div +() + + ) + +74 #ifdeà +TCNT2H + + +75  + #SCHEDULER_TIMER_BITS + 16 + + ) + +77  + #SCHEDULER_TIMER_BITS + 8 + + ) + +80 #–ià +SCHEDULER_TIMER_NUM + == 3 + +81  + #SCHEDULER_TIMER_REGISTER +(è + `tim”3_»gi¡”_OV_šŒ +( +scheduËr_š‹¼u± +) + + ) + +82  + #SCHEDULER_CLOCK_PRESCALER + + `tim”3_g‘_´esÿËr_div +() + + ) + +83 #ifdeà +TCNT3H + + +84  + #SCHEDULER_TIMER_BITS + 16 + + ) + +86  + #SCHEDULER_TIMER_BITS + 8 + + ) + +95 #ifdeà +CONFIG_MODULE_SCHEDULER_TIMER0 + + +96  + #SCHEDULER_TIMER_BITS + 8 + + ) + +99 #iâdeà +CONFIG_MODULE_SCHEDULER_MANUAL + + +103 #ià +SCHEDULER_TIMER_BITS + == 8 + +104  + #TIMER_UNIT_FLOAT + ( 256000000.0 / ()( +CONFIG_QUARTZ +è) + + ) + +106  + #TIMER_UNIT_FLOAT + ( 65536000000.0 / ()( +CONFIG_QUARTZ +è) + + ) + +114  + #SCHEDULER_UNIT_FLOAT + ( +TIMER_UNIT_FLOAT + * () +SCHEDULER_CLOCK_PRESCALER + ) + + ) + +115  + #SCHEDULER_UNIT + ( (è +SCHEDULER_UNIT_FLOAT + ) + + ) + +121  + #SCHEDULER_PERIODICAL + 0 + + ) + +122  + #SCHEDULER_SINGLE + 1 + + ) + +124  + #SCHEDULER_DEFAULT_PRIORITY + 128 + + ) + +128  +scheduËr_š™ +(); + +131  +scheduËr_dump_ev’ts +(); + +138 +št8_t + +scheduËr_add_ev’t +( +ušt8_t + +unic™y +, (* +f +)(*), * +d©a +, +ušt16_t + +³riod +, ušt8_ˆ +´iܙy +); + +144  +šlše + +št8_t + + `scheduËr_add_sšgË_ev’t_´iܙy +((* +f +)(*), * +d©a +, +ušt16_t + +³riod +, +ušt8_t + +´iܙy +) + +146  + `scheduËr_add_ev’t +( +SCHEDULER_SINGLE +, +f +, +d©a +, +³riod +, +´iܙy +); + +147 + } +} + +152  +šlše + +št8_t + +scheduËr_add_³riodiÿl_ev’t_´iܙy +((* +f +)(*), * +d©a +, +ušt16_t + +³riod +, +ušt8_t + +´iܙy +) + +154  + `scheduËr_add_ev’t +( +SCHEDULER_PERIODICAL +, +f +, +d©a +, +³riod +, +´iܙy +); + +155 + } +} + +160  +šlše + +št8_t + +scheduËr_add_sšgË_ev’t +((* +f +)(*), * +d©a +, +ušt16_t + +³riod +) + +162  + `scheduËr_add_ev’t +( +SCHEDULER_SINGLE +, +f +, +d©a +, +³riod +, +SCHEDULER_DEFAULT_PRIORITY +); + +163 + } +} + +168  +šlše + +št8_t + +scheduËr_add_³riodiÿl_ev’t +((* +f +)(*), * +d©a +, +ušt16_t + +³riod +) + +170  + `scheduËr_add_ev’t +( +SCHEDULER_PERIODICAL +, +f +, +d©a +, +³riod +, +SCHEDULER_DEFAULT_PRIORITY +); + +171 + } +} + +177 +št8_t + +scheduËr_d–_ev’t +(št8_ˆ +num +); + +185  +scheduËr_š‹¼u± +(); + +191 +ušt8_t + +scheduËr_di§bË_§ve +(); + +196  +scheduËr_’abË_»¡Üe +( +ušt8_t + +Þd_´io +); + + @scheduler_add.c + +22  + ~ + +23  + ~ + +24  + ~ + +25  + ~ + +29  +šlše + +št8_t + + +30 + $scheduËr_®loc_ev’t +() + +32 +ušt8_t + +i +; + +33 +ušt8_t + +æags +; + +35  +i +=0 ; i< +SCHEDULER_NB_MAX_EVENT + ; i++) { + +36 + `IRQ_LOCK +( +æags +); + +37 ifÐ +g_b_ev’t +[ +i +]. +¡©e + =ð +SCHEDULER_EVENT_FREE + ) { + +38 +g_b_ev’t +[ +i +]. +¡©e + = +SCHEDULER_EVENT_ALLOCATED +; + +39 + `IRQ_UNLOCK +( +æags +); + +40  +i +; + +42 + `IRQ_UNLOCK +( +æags +); + +44 + `SCHED_INC_STAT +( +®loc_çžs +); + +46 + } +} + +51 +št8_t + + +52 +scheduËr_add_ev’t +( +ušt8_t + +unic™y +, (* +f +)(*), + +53 * +d©a +, +ušt16_t + +³riod +, + +54 +ušt8_t + +´iܙy +) { + +55 +št8_t + +i +; + +56 +ušt8_t + +æags +; + +58 ià( +³riod + == 0) + +61 +i + = + `scheduËr_®loc_ev’t +(); + +62 iàÐ +i + == -1 ) + +65 + `SCHED_INC_STAT +( +add_ev’t +); + +67 ià(! +unic™y +) + +68 +g_b_ev’t +[ +i +]. +³riod + =…eriod ; + +70 +g_b_ev’t +[ +i +]. +³riod + = 0 ; + +71 +g_b_ev’t +[ +i +]. +cu¼’t_time + = +³riod + ; + +72 +g_b_ev’t +[ +i +]. +´iܙy + =…riority ; + +73 +g_b_ev’t +[ +i +]. +f + = f; + +74 +g_b_ev’t +[ +i +]. +d©a + = data; + +76 + `IRQ_LOCK +( +æags +); + +77 +g_b_ev’t +[ +i +]. +¡©e + = +SCHEDULER_EVENT_ACTIVE +; + +78 + `IRQ_UNLOCK +( +æags +); + +80  +i +; + +81 + } +} + + @scheduler_config.h + +22 #iâdeà +_SCHEDULER_CONFIG_H_ + + +23  + #_SCHEDULER_CONFIG_H_ + + + ) + +25  + #_SCHEDULER_CONFIG_VERSION_ + 4 + + ) + +28  + #SCHEDULER_NB_MAX_EVENT + 10 + + ) + +30 #ifdeà +HOST_VERSION + + +31  + #SCHEDULER_UNIT_FLOAT + 1000.0 + + ) + +32  + #SCHEDULER_UNIT + 1000UL + + ) + +34  + #SCHEDULER_UNIT_FLOAT + 512.0 + + ) + +35  + #SCHEDULER_UNIT + 512L + + ) + +43  + #SCHEDULER_NB_STACKING_MAX + +SCHEDULER_NB_MAX_EVENT + + + ) + + @scheduler_del.c + +22  + ~ + +23  + ~ + +24  + ~ + +25  + ~ + +27  + $scheduËr_d–_ev’t +( +št8_t + +i +) + +29 +ušt8_t + +æags +; + +34 + `IRQ_LOCK +( +æags +); + +35 ià( +g_b_ev’t +[ +i +]. +¡©e + =ð +SCHEDULER_EVENT_SCHEDULED +) { + +36 +g_b_ev’t +[ +i +]. +¡©e + = +SCHEDULER_EVENT_DELETING +; + +38 ià( +g_b_ev’t +[ +i +]. +¡©e + =ð +SCHEDULER_EVENT_ACTIVE +) { + +39 +g_b_ev’t +[ +i +]. +¡©e + = +SCHEDULER_EVENT_FREE +; + +41 + `IRQ_UNLOCK +( +æags +); + +42 + `SCHED_INC_STAT +( +d–_ev’t +); + +43 + } +} + + @scheduler_dump.c + +22  + ~<¡dio.h +> + +24  + ~ + +25  + ~ + +27  + ~ + +28  + ~ + +31  + $scheduËr_dump_ev’ts +() + +33  +i +; + +35 + `´štf_P +( + `PSTR +("== Dumpƒvents ==\r\n")); + +36  +i +=0 ; i< +SCHEDULER_NB_MAX_EVENT + ; i++) { + +37 + `´štf_P +( + `PSTR +(" [%d]@%°: "), +i +, & +g_b_ev’t +[i]); + +38 + `´štf_P +( + `PSTR +(" s‹=%d"), +g_b_ev’t +[ +i +]. +¡©e +); + +39 ià( +g_b_ev’t +[ +i +]. +¡©e + >ð +SCHEDULER_EVENT_ACTIVE + ) { + +40 + `´štf_P +( + `PSTR +(", f=%p, "), +g_b_ev’t +[ +i +]. +f +); + +41 + `´štf_P +( + `PSTR +("d©a=%p, "), +g_b_ev’t +[ +i +]. +d©a +); + +42 + `´štf_P +( + `PSTR +("³riod=%d, "), +g_b_ev’t +[ +i +]. +³riod +); + +43 + `´štf_P +( + `PSTR +("cu¼’t_time=%d, "), +g_b_ev’t +[ +i +]. +cu¼’t_time +); + +44 + `´štf_P +( + `PSTR +("´iܙy=%d, "), +g_b_ev’t +[ +i +]. +´iܙy +); + +45 + `´štf_P +( + `PSTR +("li¡_Ãxt=%p\r\n"), + `SLIST_NEXT +(& +g_b_ev’t +[ +i +], +Ãxt +)); + +48 + `´štf_P +( + `PSTR +("\r\n")); + +51 + } +} + + @scheduler_host.c + +22  + ~ + +23  + ~<¡dio.h +> + +24  + ~<¡ršg.h +> + +26  + ~ + +27  + ~ + +28  + ~ + +33  +ev’t_t + + gg_b_ev’t +[ +SCHEDULER_NB_MAX_EVENT +]; + +35 #ifdeà +CONFIG_MODULE_SCHEDULER_STATS + + +36  +scheduËr_¡©s + + gsched_¡©s +; + +40  + $scheduËr_š™ +() + +42 + `mem£t +( +g_b_ev’t +, 0, (g_tab_event)); + +43 + `´štf +("Scheduler init (host). Warning, you haveo call\n" + +45 + `DUMP_EVENTS +(); + +46 + } +} + + @scheduler_interrupt.c + +22  + ~<¡dlib.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +30 vÞ©ž +ušt8_t + + g´iܙy_rušg +=0; + +33 vÞ©ž +ušt8_t + + gnb_¡ackšg +=0; + +35 +ušt8_t + + $scheduËr_di§bË_§ve +() + +37 +ušt8_t + +»t +; + +38 +»t + = +´iܙy_rušg +; + +39 +´iܙy_rušg + = 255; + +40  +»t +; + +41 + } +} + +43  + $scheduËr_’abË_»¡Üe +( +ušt8_t + +Þd_´io +) + +45 +´iܙy_rušg + = +Þd_´io +; + +46 + } +} + +60 + $scheduËr_š‹¼u± +() + +62 +ušt8_t + +i +; + +63 +ušt8_t + +´iܙy_tmp +; + +64 + `SLIST_HEAD +( +ev’t_li¡_t +, +ev’t_t +è +ev’t_li¡ +; + +65  +ev’t_t + * +e +, * +Ãxt_e +, * +´ev_e += +NULL +; + +68 ià( +nb_¡ackšg + >ð +SCHEDULER_NB_STACKING_MAX +) { + +69 + `SCHED_INC_STAT +( +max_¡ackšg +); + +73 +nb_¡ackšg + ++; + +74 + `£i +(); + +76 + `SLIST_INIT +(& +ev’t_li¡ +); + +80  +i +=0 ; i< +SCHEDULER_NB_MAX_EVENT + ; i++) { + +81 + `þi +(); + +85 ià( +g_b_ev’t +[ +i +]. +¡©e + =ð +SCHEDULER_EVENT_SCHEDULED +) { + +86 ià( +g_b_ev’t +[ +i +]. +cu¼’t_time + > 1) { + +87 +g_b_ev’t +[ +i +]. +cu¼’t_time + --; + +88 + `£i +(); + +92 + `SCHED_INC_STAT2 +( +sk_d–ayed +, +i +); + +93 + `£i +(); + +99 ià( +g_b_ev’t +[ +i +]. +¡©e + !ð +SCHEDULER_EVENT_ACTIVE +) { + +100 + `£i +(); + +106 +g_b_ev’t +[ +i +]. +cu¼’t_time + --; + +109 iàÐ +g_b_ev’t +[ +i +]. +cu¼’t_time + != 0 ) { + +110 + `£i +(); + +116 ià( +g_b_ev’t +[ +i +]. +´iܙy + <ð +´iܙy_rušg +) { + +117 +g_b_ev’t +[ +i +]. +cu¼’t_time + = 1; + +118 + `SCHED_INC_STAT2 +( +sk_d–ayed +, +i +); + +119 + `£i +(); + +124 +g_b_ev’t +[ +i +]. +cu¼’t_time + = g_b_ev’t[i]. +³riod +; + +127 +g_b_ev’t +[ +i +]. +¡©e + = +SCHEDULER_EVENT_SCHEDULED +; + +128 + `SCHED_INC_STAT2 +( +sk_scheduËd +, +i +); + +129 + `£i +(); + +135 +e + = + `SLIST_FIRST +(& +ev’t_li¡ +); + +137 ià( +e + =ð +NULL +) { + +138 + `SLIST_INSERT_HEAD +(& +ev’t_li¡ +, & +g_b_ev’t +[ +i +], +Ãxt +); + +143 ià( +g_b_ev’t +[ +i +]. +´iܙy + >ð +e +->priority) { + +144 + `SLIST_INSERT_HEAD +(& +ev’t_li¡ +, & +g_b_ev’t +[ +i +], +Ãxt +); + +149 + `SLIST_FOREACH +( +e +, & +ev’t_li¡ +, +Ãxt +) { + +150 +Ãxt_e + = + `SLIST_NEXT +( +e +, +Ãxt +); + +151 ià( +Ãxt_e + =ð +NULL + || + +152 +g_b_ev’t +[ +i +]. +´iܙy + >ð +Ãxt_e +->priority) { + +153 + `SLIST_INSERT_AFTER +( +e +, & +g_b_ev’t +[ +i +], +Ãxt +); + +160 + `DUMP_EVENTS +(); + +162 + `þi +(); + +163 +´iܙy_tmp + = +´iܙy_rušg +; + +165 + `SLIST_FOREACH +( +e +, & +ev’t_li¡ +, +Ãxt +) { + +167 ià( +´ev_e +) + +168 + `SLIST_NEXT +( +´ev_e +, +Ãxt +èð +NULL +; + +171 +´iܙy_rušg + = +e +-> +´iܙy +; + +172 + `£i +(); + +176 +e +-> + `f +Ó-> +d©a +); + +178 + `þi +(); + +180 ià(! +e +-> +³riod +) { + +181 +e +-> +¡©e + = +SCHEDULER_EVENT_FREE +; + +186 ià( +e +-> +¡©e + =ð +SCHEDULER_EVENT_DELETING +) { + +187 +e +-> +¡©e + = +SCHEDULER_EVENT_FREE +; + +191 ià( +e +-> +¡©e + =ð +SCHEDULER_EVENT_SCHEDULED +) { + +192 +e +-> +¡©e + = +SCHEDULER_EVENT_ACTIVE +; + +195 +´ev_e + = +e +; + +198 ià( +´ev_e +) + +199 + `SLIST_NEXT +( +´ev_e +, +Ãxt +èð +NULL +; + +201 +´iܙy_rušg + = +´iܙy_tmp +; + +202 +nb_¡ackšg +--; + +203 + } +} + + @scheduler_private.h + +22 #iâdeà +_SCHEDULER_PRIVATE_H_ + + +23  + #_SCHEDULER_PRIVATE_H_ + + + ) + +26 #ià +_SCHEDULER_CONFIG_VERSION_ + != 4 + +33  + ~<¡dšt.h +> + +35  + ~ + +38 + eev’t_¡©e_t + { + +39 + mSCHEDULER_EVENT_FREE +, + +40 + mSCHEDULER_EVENT_ALLOCATED +, + +41 + mSCHEDULER_EVENT_ACTIVE +, + +42 + mSCHEDULER_EVENT_SCHEDULED +, + +43 + mSCHEDULER_EVENT_DELETING +, + +47  + sev’t_t + + +49 (* + mf +)(*); + +50 * + md©a +; + +51 +ušt16_t + + m³riod +; + +52 +ušt16_t + + mcu¼’t_time +; + +53 +ušt8_t + + m´iܙy +; + +57 +ev’t_¡©e_t + + m¡©e +; + +59 +SLIST_ENTRY +( +ev’t_t +è + mÃxt +; + +62  +ev’t_t + +g_b_ev’t +[ +SCHEDULER_NB_MAX_EVENT +]; + +66 #ifdeà +SCHEDULER_DEBUG + + +67  + #DUMP_EVENTS +(è + `scheduËr_dump_ev’ts +() + + ) + +70  + #DUMP_EVENTS +(èdØ{} 0) + + ) + + @scheduler_stats.c + +22  + ~<¡ršg.h +> + +23  + ~<¡dio.h +> + +24  + ~<š‰y³s.h +> + +26  + ~ + +27  + ~ + +28  + ~ + +30  + ~ + +31  + ~ + +33  + $scheduËr_¡©s_dump +() + +35 #ifdeà +CONFIG_MODULE_SCHEDULER_STATS + + +36 +ušt8_t + +i +; + +38 + `´štf_P +( + `PSTR +("®loc_çžs: %" +PRIu32 +"\r\n"), +sched_¡©s +. +®loc_çžs +); + +39 + `´štf_P +( + `PSTR +("add_ev’t: %" +PRIu32 +"\r\n"), +sched_¡©s +. +add_ev’t +); + +40 + `´štf_P +( + `PSTR +("d–_ev’t: %" +PRIu32 +"\r\n"), +sched_¡©s +. +d–_ev’t +); + +41 + `´štf_P +( + `PSTR +("max_¡ackšg: %" +PRIu32 +"\r\n"), +sched_¡©s +. +max_¡ackšg +); + +42  +i +=0; i< +SCHEDULER_NB_MAX_EVENT +; i++) { + +43 + `´štf_P +( + `PSTR +("[%d]ask_d–ayed: %" +PRIu32 +", " + +44 "sk_scheduËd: %" +PRIu32 +"\r\n"), + +45 +i +, +sched_¡©s +. +sk_d–ayed +[i],sched_¡©s. +sk_scheduËd +[i]); + +48 + } +} + + @scheduler_stats.h + +23 #iâdeà +_SCHEDULER_STATS_H_ + + +24  + #_SCHEDULER_STATS_H_ + + + ) + +26 #ifdeà +CONFIG_MODULE_SCHEDULER_STATS + + +27  + sscheduËr_¡©s + { + +28 +ušt32_t + + m®loc_çžs +; + +29 +ušt32_t + + madd_ev’t +; + +30 +ušt32_t + + md–_ev’t +; + +31 +ušt32_t + + mmax_¡ackšg +; + +32 +ušt32_t + + msk_d–ayed +[ +SCHEDULER_NB_MAX_EVENT +]; + +33 +ušt32_t + + msk_scheduËd +[ +SCHEDULER_NB_MAX_EVENT +]; + +36  +scheduËr_¡©s + +sched_¡©s +; + +38  + #SCHED_INC_STAT +( +x +) do { \ + +39 +ušt8_t + +æags +; \ + +40 + `IRQ_LOCK +( +æags +); \ + +41 +sched_¡©s +. +x +++; \ + +42 + `IRQ_UNLOCK +( +æags +); \ + +43 } 0) + + ) + +45  + #SCHED_INC_STAT2 +( +x +, +i +) do { \ + +46 +ušt8_t + +æags +; \ + +47 + `IRQ_LOCK +( +æags +); \ + +48 +sched_¡©s +. +x +[ +i +]++; \ + +49 + `IRQ_UNLOCK +( +æags +); \ + +50 } 0) + + ) + +55  + #SCHED_INC_STAT +( +x +èdØ{ } 0) + + ) + +56  + #SCHED_INC_STAT2 +( +x +, +i +èdØ{ } 0) + + ) + +60  +scheduËr_¡©s_dump +(); + + @spi_config.h + +35  + #SPI_MAX_SLAVES + 1 + + ) + + @stack_space.c + +22  + ~ + +23  + ~ + +26  + ~ + +37  + $fžl_mem_w™h_m¬k +(è + `__©Œibu‹__ + (( +Çked +)) \ + +38 + `__©Œibu‹__ + (( + `£ùiÚ + (".init1"))); + +43  + $fžl_mem_w™h_m¬k +() + +66 + } +} + +69 +ušt16_t + + $mš_¡ack_¥aû_avažabË +() + +100 + } +} + + @stackdump.c + +22  + ~<¡dšt.h +> + +23  + ~<¡dio.h +> + +25  + $¡ackdump +() + +27 +ušt8_t + +dummy + = 0x55; + +28 +ušt16_t + +i +; + +30  +i +=0; i<256; i++) { + +31 + `´štf +("%.2x%s", *(& +dummy + + +i +), + +32 (( +i + % 16) == 15) ? "\n" : " "); + +34 + } +} + + @stackdump.h + +22  +¡ackdump +(); + + @time.c + +38  + ~<¡dlib.h +> + +39  + ~ + +41  + ~<þock_time.h +> + +42  + ~ + +46  + #NB_SCHEDULER_UNIT + ( (()( +TIME_PRECISION +)è/ +SCHEDULER_UNIT_FLOAT + ) + + ) + +47  + #NB_SCHEDULER_UNIT_NOT_NULL + ( +NB_SCHEDULER_UNIT + =ð0 ? 1.0 : NB_SCHEDULER_UNIT) + + ) + +49 vÞ©ž +time_h + + gt +; + +51 vÞ©ž +miüo£cÚds + + gus2 +; + +54  +time_šüem’t +(* +dummy +); + +58  + $time_š™ +( +ušt8_t + +´iܙy +) + +60 + `time_»£t +(); + +61 + `scheduËr_add_³riodiÿl_ev’t_´iܙy +( +time_šüem’t +, +NULL +, + +62 () +NB_SCHEDULER_UNIT_NOT_NULL +, +´iܙy +); + +63 + } +} + +67 +£cÚds + + $time_g‘_s +() + +69 +ušt16_t + +tmp +; + +70 +ušt8_t + +æags +; + +71 + `IRQ_LOCK +( +æags +); + +72 +tmp + = +t +. +s +; + +73 + `IRQ_UNLOCK +( +æags +); + +74  +tmp +; + +75 + } +} + +79 +miüo£cÚds + + $time_g‘_us +() + +81 +miüo£cÚds + +tmp +; + +82 +ušt8_t + +æags +; + +83 + `IRQ_LOCK +( +æags +); + +84 +tmp + = +t +. +us +; + +85 + `IRQ_UNLOCK +( +æags +); + +86  +tmp +; + +87 + } +} + +91 +miüo£cÚds + + $time_g‘_us2 +() + +93 +miüo£cÚds + +tmp +; + +94 +ušt8_t + +æags +; + +95 + `IRQ_LOCK +( +æags +); + +96 +tmp + = +us2 +; + +97 + `IRQ_UNLOCK +( +æags +); + +98  +tmp +; + +99 + } +} + +103 +time_h + + $time_g‘_time +() + +105 +time_h + +tmp +; + +106 +ušt8_t + +æags +; + +107 + `IRQ_LOCK +( +æags +); + +108 +tmp + = +t +; + +109 + `IRQ_UNLOCK +( +æags +); + +110  +tmp +; + +111 + } +} + +115  + $time_»£t +() + +117 +ušt8_t + +æags +; + +118 + `IRQ_LOCK +( +æags +); + +119 +t +. +us + = 0; + +120 +t +. +s + = 0; + +121 + `IRQ_UNLOCK +( +æags +); + +122 + } +} + +126  + $time_£t +( +£cÚds + +s +, +miüo£cÚds + +us +) + +128 +ušt8_t + +æags +; + +129 + `IRQ_LOCK +( +æags +); + +130 +t +. +us + = us; + +131 +t +. +s + = s; + +132 + `IRQ_UNLOCK +( +æags +); + +133 + } +} + +137  + $time_wa™_ms +( +ušt16_t + +ms +) + +139 +miüo£cÚds + +Þd + = + `time_g‘_us2 +(); + +140  + `time_g‘_us2 +(è- +Þd + < +ms +*1000L); + +141 + } +} + +147  +time_šüem’t +( +__©Œibu‹__ +(( +unu£d +)è* +dummy +) + +149 +ušt8_t + + gæags +; + +151 +IRQ_LOCK +( +æags +); + +153 + gus2 + +ð(() +NB_SCHEDULER_UNIT_NOT_NULL + * +SCHEDULER_UNIT +); + +154 + gt +. + gus + +ð(() +NB_SCHEDULER_UNIT_NOT_NULL + * +SCHEDULER_UNIT +); + +155  + gt +. + gus + > 1000000) { + +156 + gt +. + gs + ++; + +157 + gt +. + gus + -= 1000000; + +160 +IRQ_UNLOCK +( +æags +); + + @time_config.h + +23  + #TIME_PRECISION + 25000l + + ) + + @timer.h + +31 #iâdeà +_TIMER_H_ + + +32  + #_TIMER_H_ + + + ) + +34  + ~ + +36  + ~ + +37  + ~ + +38  + ~ + +39  + ~ + +41  + ~ + +45  +tim”_š™ +(); + +49 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +50 + $DECLARE_TIMER_FUNCS +(0) + +53 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +54 + $DECLARE_TIMER_FUNCS +(1) + +57 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +58 + $DECLARE_TIMER_FUNCS +(2) + +61 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +62 + $DECLARE_TIMER_FUNCS +(3) + +67 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +68 + $DEFINE_TIMER_US_CONVERSIONS +(0) + +71 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +72 + $DEFINE_TIMER_US_CONVERSIONS +(1) + +75 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +76 + $DEFINE_TIMER_US_CONVERSIONS +(2) + +79 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +80 + $DEFINE_TIMER_US_CONVERSIONS +(3) + + @timer0_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +33 + $DEFINE_TIMER_GET_SET +(0) + + @timer0_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(0) + +43 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(0) + + @timer0_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OUTPUT_COMPARE0 + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(0) + +39 #ià +defšed + +TIMER0A_ENABLED + && defšed +SIG_OUTPUT_COMPARE0A + + +40 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(0A) + +43 #ià +defšed + +TIMER0B_ENABLED + && defšed +SIG_OUTPUT_COMPARE0B + + +44 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(0B) + + @timer0_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OUTPUT_COMPARE0 + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(0,0) + +39 #ià +defšed + +TIMER0A_ENABLED + && defšed +SIG_OUTPUT_COMPARE0A + + +40 + $DEFINE_REGISTER_OC_INTR_IN_US +(0,0A) + +43 #ià +defšed + +TIMER0B_ENABLED + && defšed +SIG_OUTPUT_COMPARE0B + + +44 + $DEFINE_REGISTER_OC_INTR_IN_US +(0,0B) + + @timer0_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +34 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OVERFLOW0 + + +35 + $DEFINE_REGISTER_OV_INTR +(0) + + @timer0_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +33 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +34 + $DEFINE_TIMER_START_STOP +(0) + + @timer1_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +33 + $DEFINE_TIMER_GET_SET +(1) + + @timer1_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(1) + +43 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(1) + + @timer1_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER1A_ENABLED + && defšed +SIG_OUTPUT_COMPARE1A + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(1A) + +39 #ià +defšed + +TIMER1B_ENABLED + && defšed +SIG_OUTPUT_COMPARE1B + + +40 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(1B) + +43 #ià +defšed + +TIMER1C_ENABLED + && defšed +SIG_OUTPUT_COMPARE1C + + +44 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(1C) + + @timer1_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER1A_ENABLED + && defšed +SIG_OUTPUT_COMPARE1A + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(1,1A) + +39 #ià +defšed + +TIMER1B_ENABLED + && defšed +SIG_OUTPUT_COMPARE1B + + +40 + $DEFINE_REGISTER_OC_INTR_IN_US +(1,1B) + +43 #ià +defšed + +TIMER1C_ENABLED + && defšed +SIG_OUTPUT_COMPARE1C + + +44 + $DEFINE_REGISTER_OC_INTR_IN_US +(1,1C) + + @timer1_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER1_ENABLED + && defšed +SIG_OVERFLOW1 + + +36 + $DEFINE_REGISTER_OV_INTR +(1) + + @timer1_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +33 + $DEFINE_TIMER_START_STOP +(1) + + @timer2_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +31 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +32 + $DEFINE_TIMER_GET_SET +(2) + + @timer2_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(2) + +43 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(2) + + @timer2_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OUTPUT_COMPARE2 + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(2) + + @timer2_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OUTPUT_COMPARE2 + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(2,2) + + @timer2_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OVERFLOW2 + + +36 + $DEFINE_REGISTER_OV_INTR +(2) + + @timer2_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +33 + $DEFINE_TIMER_START_STOP +(2) + + @timer3_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +31 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +32 + $DEFINE_TIMER_GET_SET +(3) + + @timer3_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(3) + +43 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(3) + + @timer3_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER3A_ENABLED + && defšed +SIG_OUTPUT_COMPARE3A + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(3A) + +39 #ià +defšed + +TIMER3B_ENABLED + && defšed +SIG_OUTPUT_COMPARE3B + + +40 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(3B) + +43 #ià +defšed + +TIMER3C_ENABLED + && defšed +SIG_OUTPUT_COMPARE3C + + +44 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(3C) + + @timer3_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER3A_ENABLED + && defšed +SIG_OUTPUT_COMPARE3A + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(3,3A) + +39 #ià +defšed + +TIMER3B_ENABLED + && defšed +SIG_OUTPUT_COMPARE3B + + +40 + $DEFINE_REGISTER_OC_INTR_IN_US +(3,3B) + +43 #ià +defšed + +TIMER3C_ENABLED + && defšed +SIG_OUTPUT_COMPARE3C + + +44 + $DEFINE_REGISTER_OC_INTR_IN_US +(3,3C) + + @timer3_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER3_ENABLED + && defšed +SIG_OVERFLOW3 + + +36 + $DEFINE_REGISTER_OV_INTR +(3) + + @timer3_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +33 + $DEFINE_TIMER_START_STOP +(3) + + @timer4_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +31 #ià +defšed + +TIMER4_ENABLED + && defšed +TIMER4_AVAILABLE + + +32 + $DEFINE_TIMER_GET_SET +(4) + + @timer4_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER4_ENABLED + && defšed +TIMER4_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(4) + +43 #ià +defšed + +TIMER4_ENABLED + && defšed +TIMER4_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(4) + + @timer4_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER4A_ENABLED + && defšed +SIG_OUTPUT_COMPARE4A + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(4A) + +39 #ià +defšed + +TIMER4B_ENABLED + && defšed +SIG_OUTPUT_COMPARE4B + + +40 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(4B) + +43 #ià +defšed + +TIMER4C_ENABLED + && defšed +SIG_OUTPUT_COMPARE4C + + +44 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(4C) + + @timer4_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER4A_ENABLED + && defšed +SIG_OUTPUT_COMPARE4A + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(4,4A) + +39 #ià +defšed + +TIMER4B_ENABLED + && defšed +SIG_OUTPUT_COMPARE4B + + +40 + $DEFINE_REGISTER_OC_INTR_IN_US +(4,4B) + +43 #ià +defšed + +TIMER4C_ENABLED + && defšed +SIG_OUTPUT_COMPARE4C + + +44 + $DEFINE_REGISTER_OC_INTR_IN_US +(4,4C) + + @timer4_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER4_ENABLED + && defšed +SIG_OVERFLOW4 + + +36 + $DEFINE_REGISTER_OV_INTR +(4) + + @timer4_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER4_ENABLED + && defšed +TIMER4_AVAILABLE + + +33 + $DEFINE_TIMER_START_STOP +(4) + + @timer5_getset.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +31 #ià +defšed + +TIMER5_ENABLED + && defšed +TIMER5_AVAILABLE + + +32 + $DEFINE_TIMER_GET_SET +(5) + + @timer5_prescaler.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +35 #ifdeà +CONFIG_MODULE_TIMER_DYNAMIC + + +37 #ià +defšed + +TIMER5_ENABLED + && defšed +TIMER5_AVAILABLE + + +38 + $DEFINE_DYNAMIC_PRESCALER_FUNCS +(5) + +43 #ià +defšed + +TIMER5_ENABLED + && defšed +TIMER5_AVAILABLE + + +44 + $DEFINE_STATIC_PRESCALER_FUNCS +(5) + + @timer5_register_OC_at_tics.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER5A_ENABLED + && defšed +SIG_OUTPUT_COMPARE5A + + +36 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(5A) + +39 #ià +defšed + +TIMER5B_ENABLED + && defšed +SIG_OUTPUT_COMPARE5B + + +40 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(5B) + +43 #ià +defšed + +TIMER5C_ENABLED + && defšed +SIG_OUTPUT_COMPARE5C + + +44 + $DEFINE_REGISTER_OC_INTR_AT_TICS +(5C) + + @timer5_register_OC_in_us.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER5A_ENABLED + && defšed +SIG_OUTPUT_COMPARE5A + + +36 + $DEFINE_REGISTER_OC_INTR_IN_US +(5,5A) + +39 #ià +defšed + +TIMER5B_ENABLED + && defšed +SIG_OUTPUT_COMPARE5B + + +40 + $DEFINE_REGISTER_OC_INTR_IN_US +(5,5B) + +43 #ià +defšed + +TIMER5C_ENABLED + && defšed +SIG_OUTPUT_COMPARE5C + + +44 + $DEFINE_REGISTER_OC_INTR_IN_US +(5,5C) + + @timer5_register_OV.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +35 #ià +defšed + +TIMER5_ENABLED + && defšed +SIG_OVERFLOW5 + + +36 + $DEFINE_REGISTER_OV_INTR +(5) + + @timer5_startstop.c + +22  + ~<¡dšt.h +> + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +32 #ià +defšed + +TIMER5_ENABLED + && defšed +TIMER5_AVAILABLE + + +33 + $DEFINE_TIMER_START_STOP +(5) + + @timer_conf_check.c + +22  + ~ + +23  + ~ + +24  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +30  + ~ + +33 #ià +defšed + +TIMER0_ENABLED + && ! defšed +TIMER0_AVAILABLE + + +34 #”rÜ +This + +¬ch + +has + +no + +TIMER0 + + +37 #ià +defšed + +TIMER1_ENABLED + && ! defšed +TIMER1_AVAILABLE + + +38 #”rÜ +This + +¬ch + +has + +no + +TIMER1 + + +41 #ià +defšed + +TIMER2_ENABLED + && ! defšed +TIMER2_AVAILABLE + + +42 #”rÜ +This + +¬ch + +has + +no + +TIMER2 + + +45 #ià +defšed + +TIMER3_ENABLED + && ! defšed +TIMER3_AVAILABLE + + +46 #”rÜ +This + +¬ch + +has + +no + +TIMER3 + + +49 #ià +defšed + +TIMER4_ENABLED + && ! defšed +TIMER4_AVAILABLE + + +50 #”rÜ +This + +¬ch + +has + +no + +TIMER4 + + +53 #ià +defšed + +TIMER5_ENABLED + && ! defšed +TIMER5_AVAILABLE + + +54 #”rÜ +This + +¬ch + +has + +no + +TIMER5 + + +58 #ià +defšed + +TIMER0_ENABLED + + +60 #ià +defšed + +TIMER0_PRESCALER_REG_0 + && TIMER0_PRESCALER_REG_0 =ð +TIMER0_PRESCALER_DIV + + +61  + #TIMER0_CONF_OK + + + ) + +64 #ià +defšed + +TIMER0_PRESCALER_REG_1 + && TIMER0_PRESCALER_REG_1 =ð +TIMER0_PRESCALER_DIV + + +65  + #TIMER0_CONF_OK + + + ) + +68 #ià +defšed + +TIMER0_PRESCALER_REG_2 + && TIMER0_PRESCALER_REG_2 =ð +TIMER0_PRESCALER_DIV + + +69  + #TIMER0_CONF_OK + + + ) + +72 #ià +defšed + +TIMER0_PRESCALER_REG_3 + && TIMER0_PRESCALER_REG_3 =ð +TIMER0_PRESCALER_DIV + + +73  + #TIMER0_CONF_OK + + + ) + +76 #ià +defšed + +TIMER0_PRESCALER_REG_4 + && TIMER0_PRESCALER_REG_4 =ð +TIMER0_PRESCALER_DIV + + +77  + #TIMER0_CONF_OK + + + ) + +80 #ià +defšed + +TIMER0_PRESCALER_REG_5 + && TIMER0_PRESCALER_REG_5 =ð +TIMER0_PRESCALER_DIV + + +81  + #TIMER0_CONF_OK + + + ) + +84 #ià +defšed + +TIMER0_PRESCALER_REG_6 + && TIMER0_PRESCALER_REG_6 =ð +TIMER0_PRESCALER_DIV + + +85  + #TIMER0_CONF_OK + + + ) + +88 #ià +defšed + +TIMER0_PRESCALER_REG_7 + && TIMER0_PRESCALER_REG_7 =ð +TIMER0_PRESCALER_DIV + + +89  + #TIMER0_CONF_OK + + + ) + +92 #ià +defšed + +TIMER0_PRESCALER_REG_8 + && TIMER0_PRESCALER_REG_8 =ð +TIMER0_PRESCALER_DIV + + +93  + #TIMER0_CONF_OK + + + ) + +96 #ià +defšed + +TIMER0_PRESCALER_REG_9 + && TIMER0_PRESCALER_REG_9 =ð +TIMER0_PRESCALER_DIV + + +97  + #TIMER0_CONF_OK + + + ) + +100 #ià +defšed + +TIMER0_PRESCALER_REG_10 + && TIMER0_PRESCALER_REG_10 =ð +TIMER0_PRESCALER_DIV + + +101  + #TIMER0_CONF_OK + + + ) + +104 #ià +defšed + +TIMER0_PRESCALER_REG_11 + && TIMER0_PRESCALER_REG_11 =ð +TIMER0_PRESCALER_DIV + + +105  + #TIMER0_CONF_OK + + + ) + +108 #ià +defšed + +TIMER0_PRESCALER_REG_12 + && TIMER0_PRESCALER_REG_12 =ð +TIMER0_PRESCALER_DIV + + +109  + #TIMER0_CONF_OK + + + ) + +112 #ià +defšed + +TIMER0_PRESCALER_REG_13 + && TIMER0_PRESCALER_REG_13 =ð +TIMER0_PRESCALER_DIV + + +113  + #TIMER0_CONF_OK + + + ) + +116 #ià +defšed + +TIMER0_PRESCALER_REG_14 + && TIMER0_PRESCALER_REG_14 =ð +TIMER0_PRESCALER_DIV + + +117  + #TIMER0_CONF_OK + + + ) + +120 #ià +defšed + +TIMER0_PRESCALER_REG_15 + && TIMER0_PRESCALER_REG_15 =ð +TIMER0_PRESCALER_DIV + + +121  + #TIMER0_CONF_OK + + + ) + +124 #iâdeà +TIMER0_CONF_OK + + +125 #”rÜ +TIMER0 + +has + +a + +bad + +´esÿËr + +v®ue + + +132 #ià +defšed + +TIMER1_ENABLED + + +134 #ià +defšed + +TIMER1_PRESCALER_REG_0 + && TIMER1_PRESCALER_REG_0 =ð +TIMER1_PRESCALER_DIV + + +135  + #TIMER1_CONF_OK + + + ) + +138 #ià +defšed + +TIMER1_PRESCALER_REG_1 + && TIMER1_PRESCALER_REG_1 =ð +TIMER1_PRESCALER_DIV + + +139  + #TIMER1_CONF_OK + + + ) + +142 #ià +defšed + +TIMER1_PRESCALER_REG_2 + && TIMER1_PRESCALER_REG_2 =ð +TIMER1_PRESCALER_DIV + + +143  + #TIMER1_CONF_OK + + + ) + +146 #ià +defšed + +TIMER1_PRESCALER_REG_3 + && TIMER1_PRESCALER_REG_3 =ð +TIMER1_PRESCALER_DIV + + +147  + #TIMER1_CONF_OK + + + ) + +150 #ià +defšed + +TIMER1_PRESCALER_REG_4 + && TIMER1_PRESCALER_REG_4 =ð +TIMER1_PRESCALER_DIV + + +151  + #TIMER1_CONF_OK + + + ) + +154 #ià +defšed + +TIMER1_PRESCALER_REG_5 + && TIMER1_PRESCALER_REG_5 =ð +TIMER1_PRESCALER_DIV + + +155  + #TIMER1_CONF_OK + + + ) + +158 #ià +defšed + +TIMER1_PRESCALER_REG_6 + && TIMER1_PRESCALER_REG_6 =ð +TIMER1_PRESCALER_DIV + + +159  + #TIMER1_CONF_OK + + + ) + +162 #ià +defšed + +TIMER1_PRESCALER_REG_7 + && TIMER1_PRESCALER_REG_7 =ð +TIMER1_PRESCALER_DIV + + +163  + #TIMER1_CONF_OK + + + ) + +166 #ià +defšed + +TIMER1_PRESCALER_REG_8 + && TIMER1_PRESCALER_REG_8 =ð +TIMER1_PRESCALER_DIV + + +167  + #TIMER1_CONF_OK + + + ) + +170 #ià +defšed + +TIMER1_PRESCALER_REG_9 + && TIMER1_PRESCALER_REG_9 =ð +TIMER1_PRESCALER_DIV + + +171  + #TIMER1_CONF_OK + + + ) + +174 #ià +defšed + +TIMER1_PRESCALER_REG_10 + && TIMER1_PRESCALER_REG_10 =ð +TIMER1_PRESCALER_DIV + + +175  + #TIMER1_CONF_OK + + + ) + +178 #ià +defšed + +TIMER1_PRESCALER_REG_11 + && TIMER1_PRESCALER_REG_11 =ð +TIMER1_PRESCALER_DIV + + +179  + #TIMER1_CONF_OK + + + ) + +182 #ià +defšed + +TIMER1_PRESCALER_REG_12 + && TIMER1_PRESCALER_REG_12 =ð +TIMER1_PRESCALER_DIV + + +183  + #TIMER1_CONF_OK + + + ) + +186 #ià +defšed + +TIMER1_PRESCALER_REG_13 + && TIMER1_PRESCALER_REG_13 =ð +TIMER1_PRESCALER_DIV + + +187  + #TIMER1_CONF_OK + + + ) + +190 #ià +defšed + +TIMER1_PRESCALER_REG_14 + && TIMER1_PRESCALER_REG_14 =ð +TIMER1_PRESCALER_DIV + + +191  + #TIMER1_CONF_OK + + + ) + +194 #ià +defšed + +TIMER1_PRESCALER_REG_15 + && TIMER1_PRESCALER_REG_15 =ð +TIMER1_PRESCALER_DIV + + +195  + #TIMER1_CONF_OK + + + ) + +198 #iâdeà +TIMER1_CONF_OK + + +199 #”rÜ +TIMER1 + +has + +a + +bad + +´esÿËr + +v®ue + + +205 #ià +defšed + +TIMER2_ENABLED + + +207 #ià +defšed + +TIMER2_PRESCALER_REG_0 + && TIMER2_PRESCALER_REG_0 =ð +TIMER2_PRESCALER_DIV + + +208  + #TIMER2_CONF_OK + + + ) + +211 #ià +defšed + +TIMER2_PRESCALER_REG_1 + && TIMER2_PRESCALER_REG_1 =ð +TIMER2_PRESCALER_DIV + + +212  + #TIMER2_CONF_OK + + + ) + +215 #ià +defšed + +TIMER2_PRESCALER_REG_2 + && TIMER2_PRESCALER_REG_2 =ð +TIMER2_PRESCALER_DIV + + +216  + #TIMER2_CONF_OK + + + ) + +219 #ià +defšed + +TIMER2_PRESCALER_REG_3 + && TIMER2_PRESCALER_REG_3 =ð +TIMER2_PRESCALER_DIV + + +220  + #TIMER2_CONF_OK + + + ) + +223 #ià +defšed + +TIMER2_PRESCALER_REG_4 + && TIMER2_PRESCALER_REG_4 =ð +TIMER2_PRESCALER_DIV + + +224  + #TIMER2_CONF_OK + + + ) + +227 #ià +defšed + +TIMER2_PRESCALER_REG_5 + && TIMER2_PRESCALER_REG_5 =ð +TIMER2_PRESCALER_DIV + + +228  + #TIMER2_CONF_OK + + + ) + +231 #ià +defšed + +TIMER2_PRESCALER_REG_6 + && TIMER2_PRESCALER_REG_6 =ð +TIMER2_PRESCALER_DIV + + +232  + #TIMER2_CONF_OK + + + ) + +235 #ià +defšed + +TIMER2_PRESCALER_REG_7 + && TIMER2_PRESCALER_REG_7 =ð +TIMER2_PRESCALER_DIV + + +236  + #TIMER2_CONF_OK + + + ) + +239 #ià +defšed + +TIMER2_PRESCALER_REG_8 + && TIMER2_PRESCALER_REG_8 =ð +TIMER2_PRESCALER_DIV + + +240  + #TIMER2_CONF_OK + + + ) + +243 #ià +defšed + +TIMER2_PRESCALER_REG_9 + && TIMER2_PRESCALER_REG_9 =ð +TIMER2_PRESCALER_DIV + + +244  + #TIMER2_CONF_OK + + + ) + +247 #ià +defšed + +TIMER2_PRESCALER_REG_10 + && TIMER2_PRESCALER_REG_10 =ð +TIMER2_PRESCALER_DIV + + +248  + #TIMER2_CONF_OK + + + ) + +251 #ià +defšed + +TIMER2_PRESCALER_REG_11 + && TIMER2_PRESCALER_REG_11 =ð +TIMER2_PRESCALER_DIV + + +252  + #TIMER2_CONF_OK + + + ) + +255 #ià +defšed + +TIMER2_PRESCALER_REG_12 + && TIMER2_PRESCALER_REG_12 =ð +TIMER2_PRESCALER_DIV + + +256  + #TIMER2_CONF_OK + + + ) + +259 #ià +defšed + +TIMER2_PRESCALER_REG_13 + && TIMER2_PRESCALER_REG_13 =ð +TIMER2_PRESCALER_DIV + + +260  + #TIMER2_CONF_OK + + + ) + +263 #ià +defšed + +TIMER2_PRESCALER_REG_14 + && TIMER2_PRESCALER_REG_14 =ð +TIMER2_PRESCALER_DIV + + +264  + #TIMER2_CONF_OK + + + ) + +267 #ià +defšed + +TIMER2_PRESCALER_REG_15 + && TIMER2_PRESCALER_REG_15 =ð +TIMER2_PRESCALER_DIV + + +268  + #TIMER2_CONF_OK + + + ) + +271 #iâdeà +TIMER2_CONF_OK + + +272 #”rÜ +TIMER2 + +has + +a + +bad + +´esÿËr + +v®ue + + +278 #ià +defšed + +TIMER3_ENABLED + + +280 #ià +defšed + +TIMER3_PRESCALER_REG_0 + && TIMER3_PRESCALER_REG_0 =ð +TIMER3_PRESCALER_DIV + + +281  + #TIMER3_CONF_OK + + + ) + +284 #ià +defšed + +TIMER3_PRESCALER_REG_1 + && TIMER3_PRESCALER_REG_1 =ð +TIMER3_PRESCALER_DIV + + +285  + #TIMER3_CONF_OK + + + ) + +288 #ià +defšed + +TIMER3_PRESCALER_REG_2 + && TIMER3_PRESCALER_REG_2 =ð +TIMER3_PRESCALER_DIV + + +289  + #TIMER3_CONF_OK + + + ) + +292 #ià +defšed + +TIMER3_PRESCALER_REG_3 + && TIMER3_PRESCALER_REG_3 =ð +TIMER3_PRESCALER_DIV + + +293  + #TIMER3_CONF_OK + + + ) + +296 #ià +defšed + +TIMER3_PRESCALER_REG_4 + && TIMER3_PRESCALER_REG_4 =ð +TIMER3_PRESCALER_DIV + + +297  + #TIMER3_CONF_OK + + + ) + +300 #ià +defšed + +TIMER3_PRESCALER_REG_5 + && TIMER3_PRESCALER_REG_5 =ð +TIMER3_PRESCALER_DIV + + +301  + #TIMER3_CONF_OK + + + ) + +304 #ià +defšed + +TIMER3_PRESCALER_REG_6 + && TIMER3_PRESCALER_REG_6 =ð +TIMER3_PRESCALER_DIV + + +305  + #TIMER3_CONF_OK + + + ) + +308 #ià +defšed + +TIMER3_PRESCALER_REG_7 + && TIMER3_PRESCALER_REG_7 =ð +TIMER3_PRESCALER_DIV + + +309  + #TIMER3_CONF_OK + + + ) + +312 #ià +defšed + +TIMER3_PRESCALER_REG_8 + && TIMER3_PRESCALER_REG_8 =ð +TIMER3_PRESCALER_DIV + + +313  + #TIMER3_CONF_OK + + + ) + +316 #ià +defšed + +TIMER3_PRESCALER_REG_9 + && TIMER3_PRESCALER_REG_9 =ð +TIMER3_PRESCALER_DIV + + +317  + #TIMER3_CONF_OK + + + ) + +320 #ià +defšed + +TIMER3_PRESCALER_REG_10 + && TIMER3_PRESCALER_REG_10 =ð +TIMER3_PRESCALER_DIV + + +321  + #TIMER3_CONF_OK + + + ) + +324 #ià +defšed + +TIMER3_PRESCALER_REG_11 + && TIMER3_PRESCALER_REG_11 =ð +TIMER3_PRESCALER_DIV + + +325  + #TIMER3_CONF_OK + + + ) + +328 #ià +defšed + +TIMER3_PRESCALER_REG_12 + && TIMER3_PRESCALER_REG_12 =ð +TIMER3_PRESCALER_DIV + + +329  + #TIMER3_CONF_OK + + + ) + +332 #ià +defšed + +TIMER3_PRESCALER_REG_13 + && TIMER3_PRESCALER_REG_13 =ð +TIMER3_PRESCALER_DIV + + +333  + #TIMER3_CONF_OK + + + ) + +336 #ià +defšed + +TIMER3_PRESCALER_REG_14 + && TIMER3_PRESCALER_REG_14 =ð +TIMER3_PRESCALER_DIV + + +337  + #TIMER3_CONF_OK + + + ) + +340 #ià +defšed + +TIMER3_PRESCALER_REG_15 + && TIMER3_PRESCALER_REG_15 =ð +TIMER3_PRESCALER_DIV + + +341  + #TIMER3_CONF_OK + + + ) + +344 #iâdeà +TIMER3_CONF_OK + + +345 #”rÜ +TIMER3 + +has + +a + +bad + +´esÿËr + +v®ue + + +350 #ià +defšed + +TIMER4_ENABLED + + +352 #ià +defšed + +TIMER4_PRESCALER_REG_0 + && TIMER4_PRESCALER_REG_0 =ð +TIMER4_PRESCALER_DIV + + +353  + #TIMER4_CONF_OK + + + ) + +356 #ià +defšed + +TIMER4_PRESCALER_REG_1 + && TIMER4_PRESCALER_REG_1 =ð +TIMER4_PRESCALER_DIV + + +357  + #TIMER4_CONF_OK + + + ) + +360 #ià +defšed + +TIMER4_PRESCALER_REG_2 + && TIMER4_PRESCALER_REG_2 =ð +TIMER4_PRESCALER_DIV + + +361  + #TIMER4_CONF_OK + + + ) + +364 #ià +defšed + +TIMER4_PRESCALER_REG_3 + && TIMER4_PRESCALER_REG_3 =ð +TIMER4_PRESCALER_DIV + + +365  + #TIMER4_CONF_OK + + + ) + +368 #ià +defšed + +TIMER4_PRESCALER_REG_4 + && TIMER4_PRESCALER_REG_4 =ð +TIMER4_PRESCALER_DIV + + +369  + #TIMER4_CONF_OK + + + ) + +372 #ià +defšed + +TIMER4_PRESCALER_REG_5 + && TIMER4_PRESCALER_REG_5 =ð +TIMER4_PRESCALER_DIV + + +373  + #TIMER4_CONF_OK + + + ) + +376 #ià +defšed + +TIMER4_PRESCALER_REG_6 + && TIMER4_PRESCALER_REG_6 =ð +TIMER4_PRESCALER_DIV + + +377  + #TIMER4_CONF_OK + + + ) + +380 #ià +defšed + +TIMER4_PRESCALER_REG_7 + && TIMER4_PRESCALER_REG_7 =ð +TIMER4_PRESCALER_DIV + + +381  + #TIMER4_CONF_OK + + + ) + +384 #ià +defšed + +TIMER4_PRESCALER_REG_8 + && TIMER4_PRESCALER_REG_8 =ð +TIMER4_PRESCALER_DIV + + +385  + #TIMER4_CONF_OK + + + ) + +388 #ià +defšed + +TIMER4_PRESCALER_REG_9 + && TIMER4_PRESCALER_REG_9 =ð +TIMER4_PRESCALER_DIV + + +389  + #TIMER4_CONF_OK + + + ) + +392 #ià +defšed + +TIMER4_PRESCALER_REG_10 + && TIMER4_PRESCALER_REG_10 =ð +TIMER4_PRESCALER_DIV + + +393  + #TIMER4_CONF_OK + + + ) + +396 #ià +defšed + +TIMER4_PRESCALER_REG_11 + && TIMER4_PRESCALER_REG_11 =ð +TIMER4_PRESCALER_DIV + + +397  + #TIMER4_CONF_OK + + + ) + +400 #ià +defšed + +TIMER4_PRESCALER_REG_12 + && TIMER4_PRESCALER_REG_12 =ð +TIMER4_PRESCALER_DIV + + +401  + #TIMER4_CONF_OK + + + ) + +404 #ià +defšed + +TIMER4_PRESCALER_REG_13 + && TIMER4_PRESCALER_REG_13 =ð +TIMER4_PRESCALER_DIV + + +405  + #TIMER4_CONF_OK + + + ) + +408 #ià +defšed + +TIMER4_PRESCALER_REG_14 + && TIMER4_PRESCALER_REG_14 =ð +TIMER4_PRESCALER_DIV + + +409  + #TIMER4_CONF_OK + + + ) + +412 #ià +defšed + +TIMER4_PRESCALER_REG_15 + && TIMER4_PRESCALER_REG_15 =ð +TIMER4_PRESCALER_DIV + + +413  + #TIMER4_CONF_OK + + + ) + +416 #iâdeà +TIMER4_CONF_OK + + +417 #”rÜ +TIMER4 + +has + +a + +bad + +´esÿËr + +v®ue + + +422 #ià +defšed + +TIMER5_ENABLED + + +424 #ià +defšed + +TIMER5_PRESCALER_REG_0 + && TIMER5_PRESCALER_REG_0 =ð +TIMER5_PRESCALER_DIV + + +425  + #TIMER5_CONF_OK + + + ) + +428 #ià +defšed + +TIMER5_PRESCALER_REG_1 + && TIMER5_PRESCALER_REG_1 =ð +TIMER5_PRESCALER_DIV + + +429  + #TIMER5_CONF_OK + + + ) + +432 #ià +defšed + +TIMER5_PRESCALER_REG_2 + && TIMER5_PRESCALER_REG_2 =ð +TIMER5_PRESCALER_DIV + + +433  + #TIMER5_CONF_OK + + + ) + +436 #ià +defšed + +TIMER5_PRESCALER_REG_3 + && TIMER5_PRESCALER_REG_3 =ð +TIMER5_PRESCALER_DIV + + +437  + #TIMER5_CONF_OK + + + ) + +440 #ià +defšed + +TIMER5_PRESCALER_REG_4 + && TIMER5_PRESCALER_REG_4 =ð +TIMER5_PRESCALER_DIV + + +441  + #TIMER5_CONF_OK + + + ) + +444 #ià +defšed + +TIMER5_PRESCALER_REG_5 + && TIMER5_PRESCALER_REG_5 =ð +TIMER5_PRESCALER_DIV + + +445  + #TIMER5_CONF_OK + + + ) + +448 #ià +defšed + +TIMER5_PRESCALER_REG_6 + && TIMER5_PRESCALER_REG_6 =ð +TIMER5_PRESCALER_DIV + + +449  + #TIMER5_CONF_OK + + + ) + +452 #ià +defšed + +TIMER5_PRESCALER_REG_7 + && TIMER5_PRESCALER_REG_7 =ð +TIMER5_PRESCALER_DIV + + +453  + #TIMER5_CONF_OK + + + ) + +456 #ià +defšed + +TIMER5_PRESCALER_REG_8 + && TIMER5_PRESCALER_REG_8 =ð +TIMER5_PRESCALER_DIV + + +457  + #TIMER5_CONF_OK + + + ) + +460 #ià +defšed + +TIMER5_PRESCALER_REG_9 + && TIMER5_PRESCALER_REG_9 =ð +TIMER5_PRESCALER_DIV + + +461  + #TIMER5_CONF_OK + + + ) + +464 #ià +defšed + +TIMER5_PRESCALER_REG_10 + && TIMER5_PRESCALER_REG_10 =ð +TIMER5_PRESCALER_DIV + + +465  + #TIMER5_CONF_OK + + + ) + +468 #ià +defšed + +TIMER5_PRESCALER_REG_11 + && TIMER5_PRESCALER_REG_11 =ð +TIMER5_PRESCALER_DIV + + +469  + #TIMER5_CONF_OK + + + ) + +472 #ià +defšed + +TIMER5_PRESCALER_REG_12 + && TIMER5_PRESCALER_REG_12 =ð +TIMER5_PRESCALER_DIV + + +473  + #TIMER5_CONF_OK + + + ) + +476 #ià +defšed + +TIMER5_PRESCALER_REG_13 + && TIMER5_PRESCALER_REG_13 =ð +TIMER5_PRESCALER_DIV + + +477  + #TIMER5_CONF_OK + + + ) + +480 #ià +defšed + +TIMER5_PRESCALER_REG_14 + && TIMER5_PRESCALER_REG_14 =ð +TIMER5_PRESCALER_DIV + + +481  + #TIMER5_CONF_OK + + + ) + +484 #ià +defšed + +TIMER5_PRESCALER_REG_15 + && TIMER5_PRESCALER_REG_15 =ð +TIMER5_PRESCALER_DIV + + +485  + #TIMER5_CONF_OK + + + ) + +488 #iâdeà +TIMER5_CONF_OK + + +489 #”rÜ +TIMER5 + +has + +a + +bad + +´esÿËr + +v®ue + + + @timer_config.h + +22  + #TIMER0_ENABLED + + + ) + +36  + #TIMER0_PRESCALER_DIV + 8 + + ) + + @timer_declarations.h + +22 #iâdeà +_TIMER_DECLARATIONS_H + + +23  + #_TIMER_DECLARATIONS_H_ + + + ) + +25  + #DECLARE_TIMER_FUNCS +( +x +) \ + +28  +tim” +## +x +## + `_¡¬t +(); \ + +31  +tim” +## +x +## + `_¡Ý +(); \ + +34  +tim” +## +x +## + `_£t +( +ušt16_t + +t +); \ + +37 +ušt16_t + +tim” +## +x +## + `_g‘ +(); \ + +42  +tim” +## +x +## + `_»gi¡”_OV_šŒ +((* +func +)()); \ + +48  +tim” +## +x +## + `A_»gi¡”_OC_šŒ_©_tics +((* +func +)(), +ušt16_t + +t +); \ + +49  +tim” +## +x +## + `B_»gi¡”_OC_šŒ_©_tics +((* +func +)(), +ušt16_t + +t +); \ + +50  +tim” +## +x +## + `C_»gi¡”_OC_šŒ_©_tics +((* +func +)(), +ušt16_t + +t +); \ + +65 +št8_t + +tim” +## +x +## + `A_»gi¡”_OC_šŒ_š_us +((* +func +)(), +ušt16_t + +t +); \ + +66 +št8_t + +tim” +## +x +## + `B_»gi¡”_OC_šŒ_š_us +((* +func +)(), +ušt16_t + +t +); \ + +67 +št8_t + +tim” +## +x +## + `C_»gi¡”_OC_šŒ_š_us +((* +func +)(), +ušt16_t + +t +); \ + +74 +ušt16_t + +tim” +## +x +## + `_g‘_´esÿËr_div +(); \ + +78  +tim” +## +x +## + `_£t_´esÿËr_div +( +ušt16_t +); \ + +85  +šlše +  +tim” +## +x +## + `_us_to_tics +( +us +); \ + +92  +šlše +  +tim” +## +x +## + `_tics_to_us +( +t +); + + ) + + @timer_definitions.h + +22 #iâdeà +_TIMER_DEFINITIONS_H_ + + +23  + #_TIMER_DEFINITIONS_H_ + + + ) + +26  + ~ + +28  + #DEFINE_TIMER_START_STOP +( +x +) \ + +31  +tim” +## +x +## + `_¡¬t +() \ + +33 +TCNT +## +x + = 0; \ + +34 +CS +## +x +##0 +_REG + = +__tim” +##x## + `_div_to_»g +( +TIMER +##x## +_PRESCALER_DIV +) << CS##x##0 ; \ + +38  +tim” +## +x +## + `_¡Ý +() \ + +40 +CS +## +x +##0 +_REG + = 0; \ + +41 +TCNT +## +x + = 0; \ + +42 } + + ) + +46  + #DEFINE_TIMER_GET_SET +( +x +) \ + +48 +ušt16_t + +tim” +## +x +## + `_g‘ +() \ + +50  +TCNT +## +x + ; \ + +53  +tim” +## +x +## + `_£t +( +ušt16_t + +t +) \ + +55 +TCNT +## +x + = +t +; \ + +56 } + + ) + +59  + #DEFINE_OV_INTR +( +x +) \ + +60 + `SIGNAL +( +x +) \ + +62 if( +tim”_OV_ÿÎback_bË +[ +x +## +_NUM +]) \ + +63 +tim”_OV_ÿÎback_bË +[ +x +## +_NUM +](); \ + +64 } + + ) + +67  + #DEFINE_OC_INTR +( +x +) \ + +68 + `SIGNAL +( +x +) \ + +70 if( +tim”_OC_ÿÎback_bË +[ +x +## +_NUM +]) \ + +71 +tim”_OC_ÿÎback_bË +[ +x +## +_NUM +](); \ + +72 } + + ) + +75  + #DEFINE_REGISTER_OV_INTR +( +x +) \ + +77  +tim” +## +x +## + `_»gi¡”_OV_šŒ +((* +func +)()) \ + +79 +ušt8_t + +æags +; \ + +81 + `IRQ_LOCK +( +æags +); \ + +82 +tim”_OV_ÿÎback_bË +[ +SIG_OVERFLOW +## +x +## +_NUM +] = +func +; \ + +83 ià( +func +) { \ + +84 +TOIE +## +x +## +_REG + |= (1< 0xFFFF ) { \ + +129 + `IRQ_UNLOCK +( +æags +); \ + +133 +OCR +## +y + = +TCNT +## +x + + +tics +; \ + +134 +tim”_OC_ÿÎback_bË +[ +SIG_OUTPUT_COMPARE +## +y +## +_NUM +] = +func +; \ + +135 +OCIE +## +y +## +_REG + |= (1<> CS##x##0); \ + +158  +tim” +## +x +## + `_£t_´esÿËr_div +( +ušt16_t + +div +) \ + +160 +CS +## +x +##0 +_REG + = +__tim” +##x## + `_div_to_»g +( +div +) << CS##x##0 ; \ + +161 } + + ) + +164  + #DEFINE_STATIC_PRESCALER_FUNCS +( +x +) \ + +166 +št16_t + +tim” +## +x +## + `_div_to_»g +( + `__©Œibu‹__ +(( +unu£d +)è +ušt16_t + +div +) \ + +168  +__tim” +## +x +## + `_div_to_»g +( +TIMER +##x## +_PRESCALER_DIV +); \ + +171 +ušt16_t + +tim” +## +x +## + `_g‘_´esÿËr_div +() \ + +173  +TIMER +## +x +## +_PRESCALER_DIV +; \ + +174 } + + ) + +176  + #DEFINE_TIMER_US_CONVERSIONS +( +x +) \ + +178  +šlše +  +tim” +## +x +## + `_us_to_tics +( +us +) \ + +180  (() +CONFIG_QUARTZ + / \ + +181 (() +MHz + * +tim” +## +x +## + `_g‘_´esÿËr_div +()èè* +us +; \ + +184  +šlše +  +tim” +## +x +## + `_tics_to_us +( +t +) \ + +186  +t + / (() +CONFIG_QUARTZ + / \ + +187 (() +MHz + * +tim” +## +x +## + `_g‘_´esÿËr_div +()) ); \ + +188 } + + ) + + @timer_host.c + +22  + $tim”_š™ +() + +24 + } +} + + @timer_init.c + +22  + ~ + +23  + ~ + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +32  + $tim”_š™ +() + +34 +ušt8_t + +æags +; + +36 + `IRQ_LOCK +( +æags +); + +37 + `tim”_šŒ_š™ +(); + +39 #ià +defšed + +TIMER0_ENABLED + && defšed +TIMER0_AVAILABLE + + +40 +CS00_REG + = + `__tim”0_div_to_»g +( +TIMER0_PRESCALER_DIV +è<< +CS00 + ; + +41 +TCNT0 + = 0; + +43 #ià +defšed + +TIMER1_ENABLED + && defšed +TIMER1_AVAILABLE + + +44 +CS10_REG + = + `__tim”1_div_to_»g +( +TIMER1_PRESCALER_DIV +è<< +CS10 + ; + +45 +TCNT1 + = 0; + +47 #ià +defšed + +TIMER2_ENABLED + && defšed +TIMER2_AVAILABLE + + +48 +CS20_REG + = + `__tim”2_div_to_»g +( +TIMER2_PRESCALER_DIV +è<< +CS20 + ; + +49 +TCNT2 + = 0; + +51 #ià +defšed + +TIMER3_ENABLED + && defšed +TIMER3_AVAILABLE + + +52 +CS30_REG + = + `__tim”3_div_to_»g +( +TIMER3_PRESCALER_DIV +è<< +CS30 + ; + +53 +TCNT3 + = 0; + +55 #ià +defšed + +TIMER4_ENABLED + && defšed +TIMER4_AVAILABLE + + +56 +CS40_REG + = + `__tim”4_div_to_»g +( +TIMER4_PRESCALER_DIV +è<< +CS40 + ; + +57 +TCNT4 + = 0; + +59 #ià +defšed + +TIMER5_ENABLED + && defšed +TIMER5_AVAILABLE + + +60 +CS50_REG + = + `__tim”5_div_to_»g +( +TIMER5_PRESCALER_DIV +è<< +CS50 + ; + +61 +TCNT5 + = 0; + +63 + `IRQ_UNLOCK +( +æags +); + +64 + } +} + + @timer_intr.c + +22  + ~<¡dšt.h +> + +23  + ~<¡ršg.h +> + +25  + ~ + +26  + ~ + +27  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +33  + ~ + +35 vÞ©ž +tim”_ÿÎback_t + + gtim”_OV_ÿÎback_bË +[ +SIG_OVERFLOW_TOTAL_NUM +]; + +36 vÞ©ž +tim”_ÿÎback_t + + gtim”_OC_ÿÎback_bË +[ +SIG_OUTPUT_COMPARE_TOTAL_NUM +]; + +40 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OVERFLOW0 + + +41 + $DEFINE_OV_INTR +( +SIG_OVERFLOW0 +) + +44 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OUTPUT_COMPARE0 + + +45 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE0 +) + +48 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OUTPUT_COMPARE0A + + +49 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE0A +) + +52 #ià +defšed + +TIMER0_ENABLED + && defšed +SIG_OUTPUT_COMPARE0B + + +53 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE0B +) + +58 #ià +defšed + +TIMER1_ENABLED + && defšed +SIG_OVERFLOW1 + + +59 + $DEFINE_OV_INTR +( +SIG_OVERFLOW1 +) + +62 #ià +defšed + +TIMER1A_ENABLED + && defšed +SIG_OUTPUT_COMPARE1A + + +63 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE1A +) + +66 #ià +defšed + +TIMER1B_ENABLED + && defšed +SIG_OUTPUT_COMPARE1B + + +67 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE1B +) + +70 #ià +defšed + +TIMER1C_ENABLED + && defšed +SIG_OUTPUT_COMPARE1C + + +71 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE1C +) + +76 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OVERFLOW2 + + +77 + $DEFINE_OV_INTR +( +SIG_OVERFLOW2 +) + +80 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OUTPUT_COMPARE2 + + +81 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE2 +) + +84 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OUTPUT_COMPARE2A + + +85 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE2A +) + +88 #ià +defšed + +TIMER2_ENABLED + && defšed +SIG_OUTPUT_COMPARE2B + + +89 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE2B +) + +94 #ià +defšed + +TIMER3_ENABLED + && defšed +SIG_OVERFLOW3 + + +95 + $DEFINE_OV_INTR +( +SIG_OVERFLOW3 +) + +98 #ià +defšed + +TIMER3A_ENABLED + && defšed +SIG_OUTPUT_COMPARE3A + + +99 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE3A +) + +102 #ià +defšed + +TIMER3B_ENABLED + && defšed +SIG_OUTPUT_COMPARE3B + + +103 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE3B +) + +106 #ià +defšed + +TIMER3C_ENABLED + && defšed +SIG_OUTPUT_COMPARE3C + + +107 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE3C +) + +112 #ià +defšed + +TIMER4_ENABLED + && defšed +SIG_OVERFLOW4 + + +113 + $DEFINE_OV_INTR +( +SIG_OVERFLOW4 +) + +116 #ià +defšed + +TIMER4A_ENABLED + && defšed +SIG_OUTPUT_COMPARE4A + + +117 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE4A +) + +120 #ià +defšed + +TIMER4B_ENABLED + && defšed +SIG_OUTPUT_COMPARE4B + + +121 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE4B +) + +124 #ià +defšed + +TIMER4C_ENABLED + && defšed +SIG_OUTPUT_COMPARE4C + + +125 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE4C +) + +130 #ià +defšed + +TIMER5_ENABLED + && defšed +SIG_OVERFLOW5 + + +131 + $DEFINE_OV_INTR +( +SIG_OVERFLOW5 +) + +134 #ià +defšed + +TIMER5A_ENABLED + && defšed +SIG_OUTPUT_COMPARE5A + + +135 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE5A +) + +138 #ià +defšed + +TIMER5B_ENABLED + && defšed +SIG_OUTPUT_COMPARE5B + + +139 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE5B +) + +142 #ià +defšed + +TIMER5C_ENABLED + && defšed +SIG_OUTPUT_COMPARE5C + + +143 + $DEFINE_OC_INTR +( +SIG_OUTPUT_COMPARE5C +) + +148  + $tim”_šŒ_š™ +() + +150 + `mem£t +((*) +tim”_OV_ÿÎback_bË +, 0, (timer_OV_callback_table)); + +151 + `mem£t +((*) +tim”_OC_ÿÎback_bË +, 0, (timer_OC_callback_table)); + +152 + } +} + + @timer_intr.h + +22  + ~ + +24 (* + ttim”_ÿÎback_t +)(); + +26 vÞ©ž +tim”_ÿÎback_t + +tim”_OV_ÿÎback_bË +[ +SIG_OVERFLOW_TOTAL_NUM +]; + +27 vÞ©ž +tim”_ÿÎback_t + +tim”_OC_ÿÎback_bË +[ +SIG_OUTPUT_COMPARE_TOTAL_NUM +]; + +30  + `tim”_šŒ_š™ +(); + + @timer_prescaler.h + +22 #iâdeà +_TIMER_PRESCALER_H_ + + +23  + #_TIMER_PRESCALER_H_ + + + ) + +28  +šlše + +št16_t + + $__tim”0_div_to_»g +( +ušt16_t + +div +) + +30  +div +) { + +31 #ià +defšed + +TIMER0_PRESCALER_REG_0 + && TIMER0_PRESCALER_REG_0 >= 0 + +32  +TIMER0_PRESCALER_REG_0 +: + +36 #ià +defšed + +TIMER0_PRESCALER_REG_1 + && TIMER0_PRESCALER_REG_1 >= 0 + +37  +TIMER0_PRESCALER_REG_1 +: + +41 #ià +defšed + +TIMER0_PRESCALER_REG_2 + && TIMER0_PRESCALER_REG_2 >= 0 + +42  +TIMER0_PRESCALER_REG_2 +: + +46 #ià +defšed + +TIMER0_PRESCALER_REG_3 + && TIMER0_PRESCALER_REG_3 >= 0 + +47  +TIMER0_PRESCALER_REG_3 +: + +51 #ià +defšed + +TIMER0_PRESCALER_REG_4 + && TIMER0_PRESCALER_REG_4 >= 0 + +52  +TIMER0_PRESCALER_REG_4 +: + +56 #ià +defšed + +TIMER0_PRESCALER_REG_5 + && TIMER0_PRESCALER_REG_5 >= 0 + +57  +TIMER0_PRESCALER_REG_5 +: + +61 #ià +defšed + +TIMER0_PRESCALER_REG_6 + && TIMER0_PRESCALER_REG_6 >= 0 + +62  +TIMER0_PRESCALER_REG_6 +: + +66 #ià +defšed + +TIMER0_PRESCALER_REG_7 + && TIMER0_PRESCALER_REG_7 >= 0 + +67  +TIMER0_PRESCALER_REG_7 +: + +71 #ià +defšed + +TIMER0_PRESCALER_REG_8 + && TIMER0_PRESCALER_REG_8 >= 0 + +72  +TIMER0_PRESCALER_REG_8 +: + +76 #ià +defšed + +TIMER0_PRESCALER_REG_9 + && TIMER0_PRESCALER_REG_9 >= 0 + +77  +TIMER0_PRESCALER_REG_9 +: + +81 #ià +defšed + +TIMER0_PRESCALER_REG_10 + && TIMER0_PRESCALER_REG_10 >= 0 + +82  +TIMER0_PRESCALER_REG_10 +: + +86 #ià +defšed + +TIMER0_PRESCALER_REG_11 + && TIMER0_PRESCALER_REG_11 >= 0 + +87  +TIMER0_PRESCALER_REG_11 +: + +91 #ià +defšed + +TIMER0_PRESCALER_REG_12 + && TIMER0_PRESCALER_REG_12 >= 0 + +92  +TIMER0_PRESCALER_REG_12 +: + +96 #ià +defšed + +TIMER0_PRESCALER_REG_13 + && TIMER0_PRESCALER_REG_13 >= 0 + +97  +TIMER0_PRESCALER_REG_13 +: + +101 #ià +defšed + +TIMER0_PRESCALER_REG_14 + && TIMER0_PRESCALER_REG_14 >= 0 + +102  +TIMER0_PRESCALER_REG_14 +: + +106 #ià +defšed + +TIMER0_PRESCALER_REG_15 + && TIMER0_PRESCALER_REG_15 >= 0 + +107  +TIMER0_PRESCALER_REG_15 +: + +113 + } +} + +118  +šlše + +št16_t + + $__tim”0_»g_to_div +( +ušt8_t + +»g +) + +120  +»g +) { + +121 #ià +defšed + +TIMER0_PRESCALER_DIV_0 + + +122  +TIMER0_PRESCALER_DIV_0 +: + +126 #ià +defšed + +TIMER0_PRESCALER_DIV_1 + + +127  +TIMER0_PRESCALER_DIV_1 +: + +131 #ià +defšed + +TIMER0_PRESCALER_DIV_2 + + +132  +TIMER0_PRESCALER_DIV_2 +: + +136 #ià +defšed + +TIMER0_PRESCALER_DIV_4 + + +137  +TIMER0_PRESCALER_DIV_4 +: + +141 #ià +defšed + +TIMER0_PRESCALER_DIV_8 + + +142  +TIMER0_PRESCALER_DIV_8 +: + +146 #ià +defšed + +TIMER0_PRESCALER_DIV_16 + + +147  +TIMER0_PRESCALER_DIV_16 +: + +151 #ià +defšed + +TIMER0_PRESCALER_DIV_32 + + +152  +TIMER0_PRESCALER_DIV_32 +: + +156 #ià +defšed + +TIMER0_PRESCALER_DIV_64 + + +157  +TIMER0_PRESCALER_DIV_64 +: + +161 #ià +defšed + +TIMER0_PRESCALER_DIV_128 + + +162  +TIMER0_PRESCALER_DIV_128 +: + +166 #ià +defšed + +TIMER0_PRESCALER_DIV_256 + + +167  +TIMER0_PRESCALER_DIV_256 +: + +171 #ià +defšed + +TIMER0_PRESCALER_DIV_512 + + +172  +TIMER0_PRESCALER_DIV_512 +: + +176 #ià +defšed + +TIMER0_PRESCALER_DIV_1024 + + +177  +TIMER0_PRESCALER_DIV_1024 +: + +181 #ià +defšed + +TIMER0_PRESCALER_DIV_2048 + + +182  +TIMER0_PRESCALER_DIV_2048 +: + +186 #ià +defšed + +TIMER0_PRESCALER_DIV_4096 + + +187  +TIMER0_PRESCALER_DIV_4096 +: + +191 #ià +defšed + +TIMER0_PRESCALER_DIV_8192 + + +192  +TIMER0_PRESCALER_DIV_8192 +: + +196 #ià +defšed + +TIMER0_PRESCALER_DIV_16384 + + +197  +TIMER0_PRESCALER_DIV_16384 +: + +204 + } +} + +210  +šlše + +št16_t + + $__tim”1_div_to_»g +( +ušt16_t + +div +) + +212  +div +) { + +213 #ià +defšed + +TIMER1_PRESCALER_REG_0 + && TIMER1_PRESCALER_REG_0 >= 0 + +214  +TIMER1_PRESCALER_REG_0 +: + +218 #ià +defšed + +TIMER1_PRESCALER_REG_1 + && TIMER1_PRESCALER_REG_1 >= 0 + +219  +TIMER1_PRESCALER_REG_1 +: + +223 #ià +defšed + +TIMER1_PRESCALER_REG_2 + && TIMER1_PRESCALER_REG_2 >= 0 + +224  +TIMER1_PRESCALER_REG_2 +: + +228 #ià +defšed + +TIMER1_PRESCALER_REG_3 + && TIMER1_PRESCALER_REG_3 >= 0 + +229  +TIMER1_PRESCALER_REG_3 +: + +233 #ià +defšed + +TIMER1_PRESCALER_REG_4 + && TIMER1_PRESCALER_REG_4 >= 0 + +234  +TIMER1_PRESCALER_REG_4 +: + +238 #ià +defšed + +TIMER1_PRESCALER_REG_5 + && TIMER1_PRESCALER_REG_5 >= 0 + +239  +TIMER1_PRESCALER_REG_5 +: + +243 #ià +defšed + +TIMER1_PRESCALER_REG_6 + && TIMER1_PRESCALER_REG_6 >= 0 + +244  +TIMER1_PRESCALER_REG_6 +: + +248 #ià +defšed + +TIMER1_PRESCALER_REG_7 + && TIMER1_PRESCALER_REG_7 >= 0 + +249  +TIMER1_PRESCALER_REG_7 +: + +253 #ià +defšed + +TIMER1_PRESCALER_REG_8 + && TIMER1_PRESCALER_REG_8 >= 0 + +254  +TIMER1_PRESCALER_REG_8 +: + +258 #ià +defšed + +TIMER1_PRESCALER_REG_9 + && TIMER1_PRESCALER_REG_9 >= 0 + +259  +TIMER1_PRESCALER_REG_9 +: + +263 #ià +defšed + +TIMER1_PRESCALER_REG_10 + && TIMER1_PRESCALER_REG_10 >= 0 + +264  +TIMER1_PRESCALER_REG_10 +: + +268 #ià +defšed + +TIMER1_PRESCALER_REG_11 + && TIMER1_PRESCALER_REG_11 >= 0 + +269  +TIMER1_PRESCALER_REG_11 +: + +273 #ià +defšed + +TIMER1_PRESCALER_REG_12 + && TIMER1_PRESCALER_REG_12 >= 0 + +274  +TIMER1_PRESCALER_REG_12 +: + +278 #ià +defšed + +TIMER1_PRESCALER_REG_13 + && TIMER1_PRESCALER_REG_13 >= 0 + +279  +TIMER1_PRESCALER_REG_13 +: + +283 #ià +defšed + +TIMER1_PRESCALER_REG_14 + && TIMER1_PRESCALER_REG_14 >= 0 + +284  +TIMER1_PRESCALER_REG_14 +: + +288 #ià +defšed + +TIMER1_PRESCALER_REG_15 + && TIMER1_PRESCALER_REG_15 >= 0 + +289  +TIMER1_PRESCALER_REG_15 +: + +295 + } +} + +300  +šlše + +št16_t + + $__tim”1_»g_to_div +( +ušt8_t + +»g +) + +302  +»g +) { + +303 #ià +defšed + +TIMER1_PRESCALER_DIV_0 + + +304  +TIMER1_PRESCALER_DIV_0 +: + +308 #ià +defšed + +TIMER1_PRESCALER_DIV_1 + + +309  +TIMER1_PRESCALER_DIV_1 +: + +313 #ià +defšed + +TIMER1_PRESCALER_DIV_2 + + +314  +TIMER1_PRESCALER_DIV_2 +: + +318 #ià +defšed + +TIMER1_PRESCALER_DIV_4 + + +319  +TIMER1_PRESCALER_DIV_4 +: + +323 #ià +defšed + +TIMER1_PRESCALER_DIV_8 + + +324  +TIMER1_PRESCALER_DIV_8 +: + +328 #ià +defšed + +TIMER1_PRESCALER_DIV_16 + + +329  +TIMER1_PRESCALER_DIV_16 +: + +333 #ià +defšed + +TIMER1_PRESCALER_DIV_32 + + +334  +TIMER1_PRESCALER_DIV_32 +: + +338 #ià +defšed + +TIMER1_PRESCALER_DIV_64 + + +339  +TIMER1_PRESCALER_DIV_64 +: + +343 #ià +defšed + +TIMER1_PRESCALER_DIV_128 + + +344  +TIMER1_PRESCALER_DIV_128 +: + +348 #ià +defšed + +TIMER1_PRESCALER_DIV_256 + + +349  +TIMER1_PRESCALER_DIV_256 +: + +353 #ià +defšed + +TIMER1_PRESCALER_DIV_512 + + +354  +TIMER1_PRESCALER_DIV_512 +: + +358 #ià +defšed + +TIMER1_PRESCALER_DIV_1024 + + +359  +TIMER1_PRESCALER_DIV_1024 +: + +363 #ià +defšed + +TIMER1_PRESCALER_DIV_2048 + + +364  +TIMER1_PRESCALER_DIV_2048 +: + +368 #ià +defšed + +TIMER1_PRESCALER_DIV_4096 + + +369  +TIMER1_PRESCALER_DIV_4096 +: + +373 #ià +defšed + +TIMER1_PRESCALER_DIV_8192 + + +374  +TIMER1_PRESCALER_DIV_8192 +: + +378 #ià +defšed + +TIMER1_PRESCALER_DIV_16384 + + +379  +TIMER1_PRESCALER_DIV_16384 +: + +386 + } +} + +393  +šlše + +št16_t + + $__tim”2_div_to_»g +( +ušt16_t + +div +) + +395  +div +) { + +396 #ià +defšed + +TIMER2_PRESCALER_REG_0 + && TIMER2_PRESCALER_REG_0 >= 0 + +397  +TIMER2_PRESCALER_REG_0 +: + +401 #ià +defšed + +TIMER2_PRESCALER_REG_1 + && TIMER2_PRESCALER_REG_1 >= 0 + +402  +TIMER2_PRESCALER_REG_1 +: + +406 #ià +defšed + +TIMER2_PRESCALER_REG_2 + && TIMER2_PRESCALER_REG_2 >= 0 + +407  +TIMER2_PRESCALER_REG_2 +: + +411 #ià +defšed + +TIMER2_PRESCALER_REG_3 + && TIMER2_PRESCALER_REG_3 >= 0 + +412  +TIMER2_PRESCALER_REG_3 +: + +416 #ià +defšed + +TIMER2_PRESCALER_REG_4 + && TIMER2_PRESCALER_REG_4 >= 0 + +417  +TIMER2_PRESCALER_REG_4 +: + +421 #ià +defšed + +TIMER2_PRESCALER_REG_5 + && TIMER2_PRESCALER_REG_5 >= 0 + +422  +TIMER2_PRESCALER_REG_5 +: + +426 #ià +defšed + +TIMER2_PRESCALER_REG_6 + && TIMER2_PRESCALER_REG_6 >= 0 + +427  +TIMER2_PRESCALER_REG_6 +: + +431 #ià +defšed + +TIMER2_PRESCALER_REG_7 + && TIMER2_PRESCALER_REG_7 >= 0 + +432  +TIMER2_PRESCALER_REG_7 +: + +436 #ià +defšed + +TIMER2_PRESCALER_REG_8 + && TIMER2_PRESCALER_REG_8 >= 0 + +437  +TIMER2_PRESCALER_REG_8 +: + +441 #ià +defšed + +TIMER2_PRESCALER_REG_9 + && TIMER2_PRESCALER_REG_9 >= 0 + +442  +TIMER2_PRESCALER_REG_9 +: + +446 #ià +defšed + +TIMER2_PRESCALER_REG_10 + && TIMER2_PRESCALER_REG_10 >= 0 + +447  +TIMER2_PRESCALER_REG_10 +: + +451 #ià +defšed + +TIMER2_PRESCALER_REG_11 + && TIMER2_PRESCALER_REG_11 >= 0 + +452  +TIMER2_PRESCALER_REG_11 +: + +456 #ià +defšed + +TIMER2_PRESCALER_REG_12 + && TIMER2_PRESCALER_REG_12 >= 0 + +457  +TIMER2_PRESCALER_REG_12 +: + +461 #ià +defšed + +TIMER2_PRESCALER_REG_13 + && TIMER2_PRESCALER_REG_13 >= 0 + +462  +TIMER2_PRESCALER_REG_13 +: + +466 #ià +defšed + +TIMER2_PRESCALER_REG_14 + && TIMER2_PRESCALER_REG_14 >= 0 + +467  +TIMER2_PRESCALER_REG_14 +: + +471 #ià +defšed + +TIMER2_PRESCALER_REG_15 + && TIMER2_PRESCALER_REG_15 >= 0 + +472  +TIMER2_PRESCALER_REG_15 +: + +478 + } +} + +483  +šlše + +št16_t + + $__tim”2_»g_to_div +( +ušt8_t + +»g +) + +485  +»g +) { + +486 #ià +defšed + +TIMER2_PRESCALER_DIV_0 + + +487  +TIMER2_PRESCALER_DIV_0 +: + +491 #ià +defšed + +TIMER2_PRESCALER_DIV_1 + + +492  +TIMER2_PRESCALER_DIV_1 +: + +496 #ià +defšed + +TIMER2_PRESCALER_DIV_2 + + +497  +TIMER2_PRESCALER_DIV_2 +: + +501 #ià +defšed + +TIMER2_PRESCALER_DIV_4 + + +502  +TIMER2_PRESCALER_DIV_4 +: + +506 #ià +defšed + +TIMER2_PRESCALER_DIV_8 + + +507  +TIMER2_PRESCALER_DIV_8 +: + +511 #ià +defšed + +TIMER2_PRESCALER_DIV_16 + + +512  +TIMER2_PRESCALER_DIV_16 +: + +516 #ià +defšed + +TIMER2_PRESCALER_DIV_32 + + +517  +TIMER2_PRESCALER_DIV_32 +: + +521 #ià +defšed + +TIMER2_PRESCALER_DIV_64 + + +522  +TIMER2_PRESCALER_DIV_64 +: + +526 #ià +defšed + +TIMER2_PRESCALER_DIV_128 + + +527  +TIMER2_PRESCALER_DIV_128 +: + +531 #ià +defšed + +TIMER2_PRESCALER_DIV_256 + + +532  +TIMER2_PRESCALER_DIV_256 +: + +536 #ià +defšed + +TIMER2_PRESCALER_DIV_512 + + +537  +TIMER2_PRESCALER_DIV_512 +: + +541 #ià +defšed + +TIMER2_PRESCALER_DIV_1024 + + +542  +TIMER2_PRESCALER_DIV_1024 +: + +546 #ià +defšed + +TIMER2_PRESCALER_DIV_2048 + + +547  +TIMER2_PRESCALER_DIV_2048 +: + +551 #ià +defšed + +TIMER2_PRESCALER_DIV_4096 + + +552  +TIMER2_PRESCALER_DIV_4096 +: + +556 #ià +defšed + +TIMER2_PRESCALER_DIV_8192 + + +557  +TIMER2_PRESCALER_DIV_8192 +: + +561 #ià +defšed + +TIMER2_PRESCALER_DIV_16384 + + +562  +TIMER2_PRESCALER_DIV_16384 +: + +569 + } +} + +576  +šlše + +št16_t + + $__tim”3_div_to_»g +( +ušt16_t + +div +) + +578  +div +) { + +579 #ià +defšed + +TIMER3_PRESCALER_REG_0 + && TIMER3_PRESCALER_REG_0 >= 0 + +580  +TIMER3_PRESCALER_REG_0 +: + +584 #ià +defšed + +TIMER3_PRESCALER_REG_1 + && TIMER3_PRESCALER_REG_1 >= 0 + +585  +TIMER3_PRESCALER_REG_1 +: + +589 #ià +defšed + +TIMER3_PRESCALER_REG_2 + && TIMER3_PRESCALER_REG_2 >= 0 + +590  +TIMER3_PRESCALER_REG_2 +: + +594 #ià +defšed + +TIMER3_PRESCALER_REG_3 + && TIMER3_PRESCALER_REG_3 >= 0 + +595  +TIMER3_PRESCALER_REG_3 +: + +599 #ià +defšed + +TIMER3_PRESCALER_REG_4 + && TIMER3_PRESCALER_REG_4 >= 0 + +600  +TIMER3_PRESCALER_REG_4 +: + +604 #ià +defšed + +TIMER3_PRESCALER_REG_5 + && TIMER3_PRESCALER_REG_5 >= 0 + +605  +TIMER3_PRESCALER_REG_5 +: + +609 #ià +defšed + +TIMER3_PRESCALER_REG_6 + && TIMER3_PRESCALER_REG_6 >= 0 + +610  +TIMER3_PRESCALER_REG_6 +: + +614 #ià +defšed + +TIMER3_PRESCALER_REG_7 + && TIMER3_PRESCALER_REG_7 >= 0 + +615  +TIMER3_PRESCALER_REG_7 +: + +619 #ià +defšed + +TIMER3_PRESCALER_REG_8 + && TIMER3_PRESCALER_REG_8 >= 0 + +620  +TIMER3_PRESCALER_REG_8 +: + +624 #ià +defšed + +TIMER3_PRESCALER_REG_9 + && TIMER3_PRESCALER_REG_9 >= 0 + +625  +TIMER3_PRESCALER_REG_9 +: + +629 #ià +defšed + +TIMER3_PRESCALER_REG_10 + && TIMER3_PRESCALER_REG_10 >= 0 + +630  +TIMER3_PRESCALER_REG_10 +: + +634 #ià +defšed + +TIMER3_PRESCALER_REG_11 + && TIMER3_PRESCALER_REG_11 >= 0 + +635  +TIMER3_PRESCALER_REG_11 +: + +639 #ià +defšed + +TIMER3_PRESCALER_REG_12 + && TIMER3_PRESCALER_REG_12 >= 0 + +640  +TIMER3_PRESCALER_REG_12 +: + +644 #ià +defšed + +TIMER3_PRESCALER_REG_13 + && TIMER3_PRESCALER_REG_13 >= 0 + +645  +TIMER3_PRESCALER_REG_13 +: + +648 #ià +defšed + +TIMER3_PRESCALER_REG_14 + && TIMER3_PRESCALER_REG_14 >= 0 + +649  +TIMER3_PRESCALER_REG_14 +: + +653 #ià +defšed + +TIMER3_PRESCALER_REG_15 + && TIMER3_PRESCALER_REG_15 >= 0 + +654  +TIMER3_PRESCALER_REG_15 +: + +660 + } +} + +665  +šlše + +št16_t + + $__tim”3_»g_to_div +( +ušt8_t + +»g +) + +667  +»g +) { + +668 #ià +defšed + +TIMER3_PRESCALER_DIV_0 + + +669  +TIMER3_PRESCALER_DIV_0 +: + +673 #ià +defšed + +TIMER3_PRESCALER_DIV_1 + + +674  +TIMER3_PRESCALER_DIV_1 +: + +678 #ià +defšed + +TIMER3_PRESCALER_DIV_2 + + +679  +TIMER3_PRESCALER_DIV_2 +: + +683 #ià +defšed + +TIMER3_PRESCALER_DIV_4 + + +684  +TIMER3_PRESCALER_DIV_4 +: + +688 #ià +defšed + +TIMER3_PRESCALER_DIV_8 + + +689  +TIMER3_PRESCALER_DIV_8 +: + +693 #ià +defšed + +TIMER3_PRESCALER_DIV_16 + + +694  +TIMER3_PRESCALER_DIV_16 +: + +698 #ià +defšed + +TIMER3_PRESCALER_DIV_32 + + +699  +TIMER3_PRESCALER_DIV_32 +: + +703 #ià +defšed + +TIMER3_PRESCALER_DIV_64 + + +704  +TIMER3_PRESCALER_DIV_64 +: + +708 #ià +defšed + +TIMER3_PRESCALER_DIV_128 + + +709  +TIMER3_PRESCALER_DIV_128 +: + +713 #ià +defšed + +TIMER3_PRESCALER_DIV_256 + + +714  +TIMER3_PRESCALER_DIV_256 +: + +718 #ià +defšed + +TIMER3_PRESCALER_DIV_512 + + +719  +TIMER3_PRESCALER_DIV_512 +: + +723 #ià +defšed + +TIMER3_PRESCALER_DIV_1024 + + +724  +TIMER3_PRESCALER_DIV_1024 +: + +728 #ià +defšed + +TIMER3_PRESCALER_DIV_2048 + + +729  +TIMER3_PRESCALER_DIV_2048 +: + +733 #ià +defšed + +TIMER3_PRESCALER_DIV_4096 + + +734  +TIMER3_PRESCALER_DIV_4096 +: + +738 #ià +defšed + +TIMER3_PRESCALER_DIV_8192 + + +739  +TIMER3_PRESCALER_DIV_8192 +: + +743 #ià +defšed + +TIMER3_PRESCALER_DIV_16384 + + +744  +TIMER3_PRESCALER_DIV_16384 +: + +751 + } +} + +756  +šlše + +št16_t + + $__tim”4_div_to_»g +( +ušt16_t + +div +) + +758  +div +) { + +759 #ià +defšed + +TIMER4_PRESCALER_REG_0 + && TIMER4_PRESCALER_REG_0 >= 0 + +760  +TIMER4_PRESCALER_REG_0 +: + +764 #ià +defšed + +TIMER4_PRESCALER_REG_1 + && TIMER4_PRESCALER_REG_1 >= 0 + +765  +TIMER4_PRESCALER_REG_1 +: + +769 #ià +defšed + +TIMER4_PRESCALER_REG_2 + && TIMER4_PRESCALER_REG_2 >= 0 + +770  +TIMER4_PRESCALER_REG_2 +: + +774 #ià +defšed + +TIMER4_PRESCALER_REG_3 + && TIMER4_PRESCALER_REG_3 >= 0 + +775  +TIMER4_PRESCALER_REG_3 +: + +779 #ià +defšed + +TIMER4_PRESCALER_REG_4 + && TIMER4_PRESCALER_REG_4 >= 0 + +780  +TIMER4_PRESCALER_REG_4 +: + +784 #ià +defšed + +TIMER4_PRESCALER_REG_5 + && TIMER4_PRESCALER_REG_5 >= 0 + +785  +TIMER4_PRESCALER_REG_5 +: + +789 #ià +defšed + +TIMER4_PRESCALER_REG_6 + && TIMER4_PRESCALER_REG_6 >= 0 + +790  +TIMER4_PRESCALER_REG_6 +: + +794 #ià +defšed + +TIMER4_PRESCALER_REG_7 + && TIMER4_PRESCALER_REG_7 >= 0 + +795  +TIMER4_PRESCALER_REG_7 +: + +799 #ià +defšed + +TIMER4_PRESCALER_REG_8 + && TIMER4_PRESCALER_REG_8 >= 0 + +800  +TIMER4_PRESCALER_REG_8 +: + +804 #ià +defšed + +TIMER4_PRESCALER_REG_9 + && TIMER4_PRESCALER_REG_9 >= 0 + +805  +TIMER4_PRESCALER_REG_9 +: + +809 #ià +defšed + +TIMER4_PRESCALER_REG_10 + && TIMER4_PRESCALER_REG_10 >= 0 + +810  +TIMER4_PRESCALER_REG_10 +: + +814 #ià +defšed + +TIMER4_PRESCALER_REG_11 + && TIMER4_PRESCALER_REG_11 >= 0 + +815  +TIMER4_PRESCALER_REG_11 +: + +819 #ià +defšed + +TIMER4_PRESCALER_REG_12 + && TIMER4_PRESCALER_REG_12 >= 0 + +820  +TIMER4_PRESCALER_REG_12 +: + +824 #ià +defšed + +TIMER4_PRESCALER_REG_13 + && TIMER4_PRESCALER_REG_13 >= 0 + +825  +TIMER4_PRESCALER_REG_13 +: + +828 #ià +defšed + +TIMER4_PRESCALER_REG_14 + && TIMER4_PRESCALER_REG_14 >= 0 + +829  +TIMER4_PRESCALER_REG_14 +: + +833 #ià +defšed + +TIMER4_PRESCALER_REG_15 + && TIMER4_PRESCALER_REG_15 >= 0 + +834  +TIMER4_PRESCALER_REG_15 +: + +840 + } +} + +845  +šlše + +št16_t + + $__tim”4_»g_to_div +( +ušt8_t + +»g +) + +847  +»g +) { + +848 #ià +defšed + +TIMER4_PRESCALER_DIV_0 + + +849  +TIMER4_PRESCALER_DIV_0 +: + +853 #ià +defšed + +TIMER4_PRESCALER_DIV_1 + + +854  +TIMER4_PRESCALER_DIV_1 +: + +858 #ià +defšed + +TIMER4_PRESCALER_DIV_2 + + +859  +TIMER4_PRESCALER_DIV_2 +: + +863 #ià +defšed + +TIMER4_PRESCALER_DIV_4 + + +864  +TIMER4_PRESCALER_DIV_4 +: + +868 #ià +defšed + +TIMER4_PRESCALER_DIV_8 + + +869  +TIMER4_PRESCALER_DIV_8 +: + +873 #ià +defšed + +TIMER4_PRESCALER_DIV_16 + + +874  +TIMER4_PRESCALER_DIV_16 +: + +878 #ià +defšed + +TIMER4_PRESCALER_DIV_32 + + +879  +TIMER4_PRESCALER_DIV_32 +: + +883 #ià +defšed + +TIMER4_PRESCALER_DIV_64 + + +884  +TIMER4_PRESCALER_DIV_64 +: + +888 #ià +defšed + +TIMER4_PRESCALER_DIV_128 + + +889  +TIMER4_PRESCALER_DIV_128 +: + +893 #ià +defšed + +TIMER4_PRESCALER_DIV_256 + + +894  +TIMER4_PRESCALER_DIV_256 +: + +898 #ià +defšed + +TIMER4_PRESCALER_DIV_512 + + +899  +TIMER4_PRESCALER_DIV_512 +: + +903 #ià +defšed + +TIMER4_PRESCALER_DIV_1024 + + +904  +TIMER4_PRESCALER_DIV_1024 +: + +908 #ià +defšed + +TIMER4_PRESCALER_DIV_2048 + + +909  +TIMER4_PRESCALER_DIV_2048 +: + +913 #ià +defšed + +TIMER4_PRESCALER_DIV_4096 + + +914  +TIMER4_PRESCALER_DIV_4096 +: + +918 #ià +defšed + +TIMER4_PRESCALER_DIV_8192 + + +919  +TIMER4_PRESCALER_DIV_8192 +: + +923 #ià +defšed + +TIMER4_PRESCALER_DIV_16384 + + +924  +TIMER4_PRESCALER_DIV_16384 +: + +931 + } +} + +936  +šlše + +št16_t + + $__tim”5_div_to_»g +( +ušt16_t + +div +) + +938  +div +) { + +939 #ià +defšed + +TIMER5_PRESCALER_REG_0 + && TIMER5_PRESCALER_REG_0 >= 0 + +940  +TIMER5_PRESCALER_REG_0 +: + +944 #ià +defšed + +TIMER5_PRESCALER_REG_1 + && TIMER5_PRESCALER_REG_1 >= 0 + +945  +TIMER5_PRESCALER_REG_1 +: + +949 #ià +defšed + +TIMER5_PRESCALER_REG_2 + && TIMER5_PRESCALER_REG_2 >= 0 + +950  +TIMER5_PRESCALER_REG_2 +: + +954 #ià +defšed + +TIMER5_PRESCALER_REG_3 + && TIMER5_PRESCALER_REG_3 >= 0 + +955  +TIMER5_PRESCALER_REG_3 +: + +959 #ià +defšed + +TIMER5_PRESCALER_REG_4 + && TIMER5_PRESCALER_REG_4 >= 0 + +960  +TIMER5_PRESCALER_REG_4 +: + +964 #ià +defšed + +TIMER5_PRESCALER_REG_5 + && TIMER5_PRESCALER_REG_5 >= 0 + +965  +TIMER5_PRESCALER_REG_5 +: + +969 #ià +defšed + +TIMER5_PRESCALER_REG_6 + && TIMER5_PRESCALER_REG_6 >= 0 + +970  +TIMER5_PRESCALER_REG_6 +: + +974 #ià +defšed + +TIMER5_PRESCALER_REG_7 + && TIMER5_PRESCALER_REG_7 >= 0 + +975  +TIMER5_PRESCALER_REG_7 +: + +979 #ià +defšed + +TIMER5_PRESCALER_REG_8 + && TIMER5_PRESCALER_REG_8 >= 0 + +980  +TIMER5_PRESCALER_REG_8 +: + +984 #ià +defšed + +TIMER5_PRESCALER_REG_9 + && TIMER5_PRESCALER_REG_9 >= 0 + +985  +TIMER5_PRESCALER_REG_9 +: + +989 #ià +defšed + +TIMER5_PRESCALER_REG_10 + && TIMER5_PRESCALER_REG_10 >= 0 + +990  +TIMER5_PRESCALER_REG_10 +: + +994 #ià +defšed + +TIMER5_PRESCALER_REG_11 + && TIMER5_PRESCALER_REG_11 >= 0 + +995  +TIMER5_PRESCALER_REG_11 +: + +999 #ià +defšed + +TIMER5_PRESCALER_REG_12 + && TIMER5_PRESCALER_REG_12 >= 0 + +1000  +TIMER5_PRESCALER_REG_12 +: + +1004 #ià +defšed + +TIMER5_PRESCALER_REG_13 + && TIMER5_PRESCALER_REG_13 >= 0 + +1005  +TIMER5_PRESCALER_REG_13 +: + +1008 #ià +defšed + +TIMER5_PRESCALER_REG_14 + && TIMER5_PRESCALER_REG_14 >= 0 + +1009  +TIMER5_PRESCALER_REG_14 +: + +1013 #ià +defšed + +TIMER5_PRESCALER_REG_15 + && TIMER5_PRESCALER_REG_15 >= 0 + +1014  +TIMER5_PRESCALER_REG_15 +: + +1020 + } +} + +1025  +šlše + +št16_t + + $__tim”5_»g_to_div +( +ušt8_t + +»g +) + +1027  +»g +) { + +1028 #ià +defšed + +TIMER5_PRESCALER_DIV_0 + + +1029  +TIMER5_PRESCALER_DIV_0 +: + +1033 #ià +defšed + +TIMER5_PRESCALER_DIV_1 + + +1034  +TIMER5_PRESCALER_DIV_1 +: + +1038 #ià +defšed + +TIMER5_PRESCALER_DIV_2 + + +1039  +TIMER5_PRESCALER_DIV_2 +: + +1043 #ià +defšed + +TIMER5_PRESCALER_DIV_4 + + +1044  +TIMER5_PRESCALER_DIV_4 +: + +1048 #ià +defšed + +TIMER5_PRESCALER_DIV_8 + + +1049  +TIMER5_PRESCALER_DIV_8 +: + +1053 #ià +defšed + +TIMER5_PRESCALER_DIV_16 + + +1054  +TIMER5_PRESCALER_DIV_16 +: + +1058 #ià +defšed + +TIMER5_PRESCALER_DIV_32 + + +1059  +TIMER5_PRESCALER_DIV_32 +: + +1063 #ià +defšed + +TIMER5_PRESCALER_DIV_64 + + +1064  +TIMER5_PRESCALER_DIV_64 +: + +1068 #ià +defšed + +TIMER5_PRESCALER_DIV_128 + + +1069  +TIMER5_PRESCALER_DIV_128 +: + +1073 #ià +defšed + +TIMER5_PRESCALER_DIV_256 + + +1074  +TIMER5_PRESCALER_DIV_256 +: + +1078 #ià +defšed + +TIMER5_PRESCALER_DIV_512 + + +1079  +TIMER5_PRESCALER_DIV_512 +: + +1083 #ià +defšed + +TIMER5_PRESCALER_DIV_1024 + + +1084  +TIMER5_PRESCALER_DIV_1024 +: + +1088 #ià +defšed + +TIMER5_PRESCALER_DIV_2048 + + +1089  +TIMER5_PRESCALER_DIV_2048 +: + +1093 #ià +defšed + +TIMER5_PRESCALER_DIV_4096 + + +1094  +TIMER5_PRESCALER_DIV_4096 +: + +1098 #ià +defšed + +TIMER5_PRESCALER_DIV_8192 + + +1099  +TIMER5_PRESCALER_DIV_8192 +: + +1103 #ià +defšed + +TIMER5_PRESCALER_DIV_16384 + + +1104  +TIMER5_PRESCALER_DIV_16384 +: + +1111 + } +} + + @uart.c + +24  + ~ + +25  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +31  +cœbuf + + gg_tx_fifo +[ +UART_HW_NUM +]; + +32  +cœbuf + + gg_rx_fifo +[ +UART_HW_NUM +]; + +35 +ev’t + * + grx_ev’t +[ +UART_HW_NUM +]; + +36 +ev’t + * + gtx_ev’t +[ +UART_HW_NUM +]; + +38 cÚ¡  +»gs + + gu¬t_»gs +[ +UART_HW_NUM +] = { + +39 #ifdeà +UDR0 + + +41 . +udr + = & +UDR0 +, + +42 . + guc¤a + = & +UCSR0A +, + +43 . + guc¤b + = & +UCSR0B +, + +44 . + guc¤c + = & +UCSR0C +, + +45 . + gub¼l + = & +UBRR0L +, + +46 . + gub¼h + = & +UBRR0H +, + +49 #ifdeà +UDR1 + + +51 . + gudr + = & +UDR1 +, + +52 . + guc¤a + = & +UCSR1A +, + +53 . + guc¤b + = & +UCSR1B +, + +54 . + guc¤c + = & +UCSR1C +, + +55 . + gub¼l + = & +UBRR1L +, + +56 . + gub¼h + = & +UBRR1H +, + +59 #ifdeà +UDR2 + + +61 . + gudr + = & +UDR2 +, + +62 . + guc¤a + = & +UCSR2A +, + +63 . + guc¤b + = & +UCSR2B +, + +64 . + guc¤c + = & +UCSR2C +, + +65 . + gub¼l + = & +UBRR2L +, + +66 . + gub¼h + = & +UBRR2H +, + +69 #ifdeà +UDR3 + + +71 . + gudr + = & +UDR3 +, + +72 . + guc¤a + = & +UCSR3A +, + +73 . + guc¤b + = & +UCSR3B +, + +74 . + guc¤c + = & +UCSR3C +, + +75 . + gub¼l + = & +UBRR3L +, + +76 . + gub¼h + = & +UBRR3H +, + +86 #ifdeà +UART0_COMPILE + + +87 #iâdeà +SIG_UART0_DATA + + +88  + #SIG_UART0_DATA + +USART0_UDRE_veù + + + ) + +90 #iâdeà +SIG_UART0_DATA + + +91  + #SIG_UART0_DATA + +SIG_USART0_DATA + + + ) + +93 + $SIGNAL +( +SIG_UART0_DATA +) + +95 + `u¬t_£nd_Ãxt_ch¬ +(0); + +96 + } +} + +98 #ifdeà +UART1_COMPILE + + +99 #iâdeà +SIG_UART1_DATA + + +100  + #SIG_UART1_DATA + +USART1_UDRE_veù + + + ) + +102 #iâdeà +SIG_UART1_DATA + + +103  + #SIG_UART1_DATA + +SIG_USART1_DATA + + + ) + +105 + $SIGNAL +( +SIG_UART1_DATA +) + +107 + `u¬t_£nd_Ãxt_ch¬ +(1); + +108 + } +} + +110 #ifdeà +UART2_COMPILE + + +111 #iâdeà +SIG_UART2_DATA + + +112  + #SIG_UART2_DATA + +USART2_UDRE_veù + + + ) + +114 #iâdeà +SIG_UART2_DATA + + +115  + #SIG_UART2_DATA + +SIG_USART2_DATA + + + ) + +117 + $SIGNAL +( +SIG_UART2_DATA +) + +119 + `u¬t_£nd_Ãxt_ch¬ +(2); + +120 + } +} + +122 #ifdeà +UART3_COMPILE + + +123 #iâdeà +SIG_UART3_DATA + + +124  + #SIG_UART3_DATA + +USART3_UDRE_veù + + + ) + +126 #iâdeà +SIG_UART3_DATA + + +127  + #SIG_UART3_DATA + +SIG_USART3_DATA + + + ) + +129 + $SIGNAL +( +SIG_UART3_DATA +) + +131 + `u¬t_£nd_Ãxt_ch¬ +(3); + +132 + } +} + +135  +u¬t_»cv_Ãxt_ch¬ +( +ušt8_t + +num +); + +141 #ifdeà +UART0_COMPILE + + +142 #iâdeà +SIG_UART0_RECV + + +143  + #SIG_UART0_RECV + +USART0_RX_veù + + + ) + +145 #iâdeà +SIG_UART0_RECV + + +146  + #SIG_UART0_RECV + +SIG_USART0_RECV + + + ) + +148 + $SIGNAL +( +SIG_UART0_RECV +) + +150 + `u¬t_»cv_Ãxt_ch¬ +(0); + +151 + } +} + +153 #ifdeà +UART1_COMPILE + + +154 #iâdeà +SIG_UART1_RECV + + +155  + #SIG_UART1_RECV + +USART1_RX_veù + + + ) + +157 #iâdeà +SIG_UART1_RECV + + +158  + #SIG_UART1_RECV + +SIG_USART1_RECV + + + ) + +160 + $SIGNAL +( +SIG_UART1_RECV +) + +162 + `u¬t_»cv_Ãxt_ch¬ +(1); + +163 + } +} + +165 #ifdeà +UART2_COMPILE + + +166 #iâdeà +SIG_UART2_RECV + + +167  + #SIG_UART2_RECV + +USART2_RX_veù + + + ) + +169 #iâdeà +SIG_UART2_RECV + + +170  + #SIG_UART2_RECV + +SIG_USART2_RECV + + + ) + +172 + $SIGNAL +( +SIG_UART2_RECV +) + +174 + `u¬t_»cv_Ãxt_ch¬ +(2); + +175 + } +} + +177 #ifdeà +UART3_COMPILE + + +178 #iâdeà +SIG_UART3_RECV + + +179  + #SIG_UART3_RECV + +USART3_RX_veù + + + ) + +181 #iâdeà +SIG_UART3_RECV + + +182  + #SIG_UART3_RECV + +SIG_USART3_RECV + + + ) + +184 + $SIGNAL +( +SIG_UART3_RECV +) + +186 + `u¬t_»cv_Ãxt_ch¬ +(3); + +187 + } +} + +195  + $u¬t_£nd_Ãxt_ch¬ +( +ušt8_t + +num +) + +197 #ifdeà +CONFIG_MODULE_UART_9BITS + + +198 ià( + `u¬t_g‘cÚf_nb™s +( +num +) == 9) { + +199  +–t + = 0; + +202 ià( + `CIRBUF_GET_LEN +(& +g_tx_fifo +[ +num +]) < 2) { + +203 + `cbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +207 + `cœbuf_g‘_buf_ž +(& +g_tx_fifo +[ +num +], (*)& +–t +, 2); + +208 + `cœbuf_d–_buf_ž +(& +g_tx_fifo +[ +num +], 2); + +210 + `u¬t_£t_udr_9b™s +( +num +, +–t +); + +211 + `sbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +216  +–t + = 0; + +218 ià( + `CIRBUF_IS_EMPTY +(& +g_tx_fifo +[ +num +])) { + +219 + `cbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +223 +–t + = + `cœbuf_g‘_ž +(& +g_tx_fifo +[ +num +]); + +224 + `cœbuf_d–_ž +(& +g_tx_fifo +[ +num +]); + +225 + `u¬t_£t_udr +( +num +, +–t +); + +226 + `sbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +228 + } +} + +233  + $u¬t_»cv_Ãxt_ch¬ +( +ušt8_t + +num +) + +235 #ifdeà +CONFIG_MODULE_UART_9BITS + + +236 ià( + `u¬t_g‘cÚf_nb™s +() == 9) { + +237  +–t + = 0; + +239 +–t + = + `u¬t_g‘_udr_9b™s +( +num +); + +240 ià( + `CIRBUF_GET_FREELEN +(& +g_rx_fifo +[ +num +]) >= 2) { + +241 + `cœbuf_add_buf_h—d +(& +g_rx_fifo +[ +num +], (*)& +–t +, 2); + +244 ià( +rx_ev’t +[ +num +]) + +245 (( +ev’t_9b™s + *) +rx_ev’t +[ +num +])( +–t +); + +250  +–t + = 0; + +252 +–t + = + `u¬t_g‘_udr +( +num +); + +253 ià(! + `CIRBUF_IS_FULL +(& +g_rx_fifo +[ +num +])) { + +254 + `cœbuf_add_h—d +(& +g_rx_fifo +[ +num +], +–t +); + +257 ià( +rx_ev’t +[ +num +]) + +258 +rx_ev’t +[ +num +]( +–t +); + +260 + } +} + +263  + $u¬t_š™ +() + +265 #ià( +defšed + +UDR0 +è&& (defšed +UART0_COMPILE +) + +266 + `u¬t_£tcÚf +(0, +NULL +); + +269 #ià( +defšed + +UDR1 +è&& (defšed +UART1_COMPILE +) + +270 + `u¬t_£tcÚf +(1, +NULL +); + +273 #ià( +defšed + +UDR2 +è&& (defšed +UART2_COMPILE +) + +274 + `u¬t_£tcÚf +(2, +NULL +); + +277 #ià( +defšed + +UDR3 +è&& (defšed +UART3_COMPILE +) + +278 + `u¬t_£tcÚf +(3, +NULL +); + +280 + } +} + + @uart.h + +46 #iâdeà +_UART_H_ + + +47  + #_UART_H_ + + + ) + +49  + ~<¡dio.h +> + +50  + ~ + +51  + ~ + +52  + ~ + +54  + ~ + +57  + su¬t_cÚfig + { + +58 +ušt8_t + + m’abËd + : 1, + +59 + mšŒ_’abËd + : 1, + +60 + mu£_doubË_¥“d + : 1, + +61 + m·r™y + : 2, + +62 + m¡Ý_b™s + : 1, + +63 + m»£rved + : 1; + +64 +ušt8_t + + mnb™s +; + +65 +ušt32_t + + mbaud¿‹ +; + +69  +cœbuf + +g_tx_fifo +[ +UART_HW_NUM +]; + +72  +cœbuf + +g_rx_fifo +[ +UART_HW_NUM +]; + +80  +u¬t_š™ +(); + +86 +št8_t + +u¬t_£tcÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +); + +89  +u¬t_g‘cÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +); + +96  +u¬t_»cv +( +ušt8_t + +num +); + +102  +u¬t_»cv_nowa™ +( +ušt8_t + +num +); + +107  +u¬t_9b™s_»cv +( +ušt8_t + +num +); + +112  +u¬t_9b™s_»cv_nowa™ +( +ušt8_t + +num +); + +120  +u¬t_£nd_nowa™ +( +ušt8_t + +num +,  +c +); + +127  +u¬t_£nd +( +ušt8_t + +num +,  +c +); + +133  +u¬t_£nd_9b™s_nowa™ +( +ušt8_t + +num +,  +c +); + +138  +u¬t_£nd_9b™s +( +ušt8_t + +num +,  +c +); + +146  +u¬t_»gi¡”_tx_ev’t +( +ušt8_t + +num +, (* +f +)()); + +152  + `u¬t_»gi¡”_rx_ev’t +( +ušt8_t + +num +, (* +f +)()); + +161  + `u¬t_»gi¡”_tx_9b™s_ev’t +( +ušt8_t + +num +, (* +f +)()); + +169  + `u¬t_»gi¡”_rx_9b™s_ev’t +( +ušt8_t + +num +, (* +f +)()); + +172  + `u¬t0_dev_£nd_nowa™ +( +c +, +FILE +* +f +); + +173  + `u¬t0_dev_£nd +( +c +, +FILE +* +f +); + +174  + `u¬t0_dev_»cv_nowa™ +( +FILE +* +f +); + +175  + `u¬t0_dev_»cv +( +FILE +* +f +); + +177  + `u¬t1_dev_£nd_nowa™ +( +c +, +FILE +* +f +); + +178  + `u¬t1_dev_£nd +( +c +, +FILE +* +f +); + +179  + `u¬t1_dev_»cv_nowa™ +( +FILE +* +f +); + +180  + `u¬t1_dev_»cv +( +FILE +* +f +); + +182  + `u¬t2_dev_£nd_nowa™ +( +c +, +FILE +* +f +); + +183  + `u¬t2_dev_£nd +( +c +, +FILE +* +f +); + +184  + `u¬t2_dev_»cv_nowa™ +( +FILE +* +f +); + +185  + `u¬t2_dev_»cv +( +FILE +* +f +); + +187  + `u¬t3_dev_£nd_nowa™ +( +c +, +FILE +* +f +); + +188  + `u¬t3_dev_£nd +( +c +, +FILE +* +f +); + +189  + `u¬t3_dev_»cv_nowa™ +( +FILE +* +f +); + +190  + `u¬t3_dev_»cv +( +FILE +* +f +); + + @uart_config.h + +26 #iâdeà +UART_CONFIG_H + + +27  + #UART_CONFIG_H + + + ) + +34  + #UART1_COMPILE + + + ) + +37  + #UART1_ENABLED + 1 + + ) + +40  + #UART1_INTERRUPT_ENABLED + 1 + + ) + +42  + #UART1_BAUDRATE + 57600 + + ) + +48  + #UART1_USE_DOUBLE_SPEED + 1 + + ) + +50  + #UART1_RX_FIFO_SIZE + 64 + + ) + +51  + #UART1_TX_FIFO_SIZE + 127 + + ) + +52  + #UART1_NBITS + 8 + + ) + +54  + #UART1_PARITY + +UART_PARTITY_NONE + + + ) + +56  + #UART1_STOP_BIT + +UART_STOP_BITS_1 + + + ) + + @uart_defs.h + +26 #iâdeà +_UART_DEFS_H_ + + +27  + #_UART_DEFS_H_ + + + ) + +29  + #UART_PARTITY_NONE + 0 + + ) + +30  + #UART_PARTITY_ODD + 1 + + ) + +31  + #UART_PARTITY_EVEN + 2 + + ) + +33  + #UART_STOP_BITS_1 + 0 + + ) + +34  + #UART_STOP_BITS_2 + 1 + + ) + +36 #ià( +defšed + +UDR3 +) + +37  + #UART_HW_NUM + 4 + + ) + +38 #–ià( +defšed + +UDR2 +) + +39  + #UART_HW_NUM + 3 + + ) + +40 #–ià( +defšed + +UDR1 +) + +41  + #UART_HW_NUM + 2 + + ) + +43  + #UART_HW_NUM + 1 + + ) + +48 #ià! +defšed +( +SIG_UART0_DATA +è&& !defšed( +SIG_USART0_DATA +) + +49 #ià +defšed + +SIG_UART_DATA + + +50  + #SIG_UART0_DATA + +SIG_UART_DATA + + + ) + +51 #–ià +defšed + +SIG_USART_DATA + + +52  + #SIG_UART0_DATA + +SIG_USART_DATA + + + ) + +56 #ià! +defšed +( +SIG_UART0_RECV +è&& !defšed( +SIG_USART0_RECV +) + +57 #ià +defšed + +SIG_UART_RECV + + +58  + #SIG_UART0_RECV + +SIG_UART_RECV + + + ) + +59 #–ià +defšed + +SIG_USART_RECV + + +60  + #SIG_UART0_RECV + +SIG_USART_RECV + + + ) + +64 #ià! +defšed +( +UDR0 +è&& defšed( +UDR +) + +65  + #UDR0 + +UDR + + + ) + +67 #iâdeà +UCSR0A + + +68  + #UCSR0A + +UCSRA + + + ) + +70 #iâdeà +UCSR0B + + +71  + #UCSR0B + +UCSRB + + + ) + +73 #iâdeà +UCSR0C + + +74  + #UCSR0C + +UCSRC + + + ) + +76 #iâdeà +UBRR0L + + +77  + #UBRR0L + +UBRRL + + + ) + +79 #iâdeà +UBRR0H + + +80  + #UBRR0H + +UBRRH + + + ) + +82 #ià! +defšed +( +U2X +è&& defšed( +U2X0 +) + +83  + #U2X + +U2X0 + + + ) + +85 #ià! +defšed +( +UCSZ0 +è&& defšed( +UCSZ00 +) + +86  + #UCSZ0 + +UCSZ00 + + + ) + +88 #ià! +defšed +( +UCSZ1 +è&& defšed( +UCSZ01 +) + +89  + #UCSZ1 + +UCSZ01 + + + ) + +91 #ià! +defšed +( +UCSZ2 +è&& defšed( +UCSZ02 +) + +92  + #UCSZ2 + +UCSZ02 + + + ) + +94 #ià! +defšed +( +UPM0 +è&& defšed( +UPM00 +) + +95  + #UPM0 + +UPM00 + + + ) + +97 #ià! +defšed +( +UPM1 +è&& defšed( +UPM01 +) + +98  + #UPM1 + +UPM01 + + + ) + +100 #ià! +defšed +( +USBS +è&& defšed( +USBS0 +) + +101  + #USBS + +USBS0 + + + ) + +103 #ià! +defšed +( +TXEN +è&& defšed( +TXEN0 +) + +104  + #TXEN + +TXEN0 + + + ) + +106 #ià! +defšed +( +TXCIE +è&& defšed( +TXCIE0 +) + +107  + #TXCIE + +TXCIE0 + + + ) + +109 #ià! +defšed +( +RXEN +è&& defšed( +RXEN0 +) + +110  + #RXEN + +RXEN0 + + + ) + +112 #ià! +defšed +( +RXCIE +è&& defšed( +RXCIE0 +) + +113  + #RXCIE + +RXCIE0 + + + ) + +115 #ià! +defšed +( +TXC +è&& defšed( +TXC0 +) + +116  + #TXC + +TXC0 + + + ) + +118 #ià! +defšed +( +RXC +è&& defšed( +RXC0 +) + +119  + #RXC + +RXC0 + + + ) + +121 #ià! +defšed +( +RXB8 +è&& defšed( +RXB80 +) + +122  + #RXB8 + +RXB80 + + + ) + +124 #ià! +defšed +( +UDRIE +è&& defšed( +UDRIE0 +) + +125  + #UDRIE + +UDRIE0 + + + ) + +127 #ià! +defšed +( +UDRE +è&& defšed( +UDRE0 +) + +128  + #UDRE + +UDRE0 + + + ) + +130 #ià! +defšed +( +U2X +è&& defšed( +U2X1 +) + +131  + #U2X + +U2X1 + + + ) + +133 #ià! +defšed +( +UCSZ1 +è&& defšed( +UCSZ10 +) + +134  + #UCSZ0 + +UCSZ10 + + + ) + +136 #ià! +defšed +( +UCSZ1 +è&& defšed( +UCSZ11 +) + +137  + #UCSZ1 + +UCSZ11 + + + ) + +139 #ià! +defšed +( +UCSZ2 +è&& defšed( +UCSZ12 +) + +140  + #UCSZ2 + +UCSZ12 + + + ) + +142 #ià! +defšed +( +UPM1 +è&& defšed( +UPM10 +) + +143  + #UPM0 + +UPM10 + + + ) + +145 #ià! +defšed +( +UPM1 +è&& defšed( +UPM11 +) + +146  + #UPM1 + +UPM11 + + + ) + +148 #ià! +defšed +( +USBS +è&& defšed( +USBS1 +) + +149  + #USBS + +USBS1 + + + ) + +151 #ià! +defšed +( +TXEN +è&& defšed( +TXEN1 +) + +152  + #TXEN + +TXEN1 + + + ) + +154 #ià! +defšed +( +TXCIE +è&& defšed( +TXCIE1 +) + +155  + #TXCIE + +TXCIE1 + + + ) + +157 #ià! +defšed +( +RXEN +è&& defšed( +RXEN1 +) + +158  + #RXEN + +RXEN1 + + + ) + +160 #ià! +defšed +( +RXCIE +è&& defšed( +RXCIE1 +) + +161  + #RXCIE + +RXCIE1 + + + ) + +163 #ià! +defšed +( +TXC +è&& defšed( +TXC1 +) + +164  + #TXC + +TXC1 + + + ) + +166 #ià! +defšed +( +RXC +è&& defšed( +RXC1 +) + +167  + #RXC + +RXC1 + + + ) + +169 #ià! +defšed +( +RXB8 +è&& defšed( +RXB81 +) + +170  + #RXB8 + +RXB81 + + + ) + +172 #ià! +defšed +( +UDRIE +è&& defšed( +UDRIE1 +) + +173  + #UDRIE + +UDRIE1 + + + ) + +175 #ià! +defšed +( +UDRIE +è&& defšed( +UDRIE1 +) + +176  + #UDRIE + +UDRIE1 + + + ) + +178 #ià! +defšed +( +UDRE +è&& defšed( +UDRE1 +) + +179  + #UDRE + +UDRE1 + + + ) + +184 #iàÐ! +defšed + +UCSRA + ) && ( defšed +USR + ) + +185  + #UCSRA + +USR + + + ) + +188 #iàÐ! +defšed + +UCSRB + ) && ( defšed +UCR + ) + +189  + #UCSRB + +UCR + + + ) + +193 #iâdeà +UBRRL + + +194  + #UBRRL + +UBRR + + + ) + +202 #ià +defšed + ( +__AVR_AT90CAN128__ +è|| defšed ( +__AVR_AT90CAN64__ +è|| defšed ( +__AVR_AT90CAN32__ +) + +204 #iâdeà +SIG_USART0_RECV + + +205  + #SIG_USART0_RECV + +SIG_UART0_RECV + + + ) + +206  + #SIG_USART1_RECV + +SIG_UART1_RECV + + + ) + +207  + #SIG_USART0_DATA + +SIG_UART0_DATA + + + ) + +208  + #SIG_USART1_DATA + +SIG_UART1_DATA + + + ) + +209  + #SIG_USART0_TRANS + +SIG_UART0_TRANS + + + ) + +210  + #SIG_USART1_TRANS + +SIG_UART1_TRANS + + + ) + +217 #iàÐ +defšed + +SIG_USART0_RECV + ) || ( defšed +SIG_USART_RECV + ) + +218  + #UART_IS_USART + 1 + + ) + +219 #–ià( +defšed + +USART_UDRE_veù +è|| (defšed +USART_TXC_veù +è|| (defšed +USART_RXC_veù +) + +220  + #UART_IS_USART + 1 + + ) + +221 #–ià( +defšed + +USART1_UDRE_veù +è|| (defšed +USART1_TXC_veù +è|| (defšed +USART1_RXC_veù +) + +222  + #UART_IS_USART + 1 + + ) + +224  + #UART_IS_USART + 0 + + ) + +228 #ifdeà +U2X + + +229  + #UART_HAS_U2X + 1 + + ) + +231  + #UART_HAS_U2X + 0 + + ) + + @uart_dev_io.c + +24  + ~ + +25  + ~ + +26  + ~ + +28 #ifdeà +UART0_COMPILE + + +29  +u¬t0_dev_£nd_nowa™ +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +31  +u¬t_£nd_nowa™ +(0, +c +); + +34  +u¬t0_dev_£nd +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +36  +u¬t_£nd +(0, +c +); + +39  +u¬t0_dev_»cv_nowa™ +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +41  +u¬t_»cv_nowa™ +(0); + +44  +u¬t0_dev_»cv +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +46  +u¬t_»cv +(0); + +50 #ifdeà +UART1_COMPILE + + +51  +u¬t1_dev_£nd_nowa™ +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +53  +u¬t_£nd_nowa™ +(1, +c +); + +56  +u¬t1_dev_£nd +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +58  +u¬t_£nd +(1, +c +); + +61  +u¬t1_dev_»cv_nowa™ +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +63  +u¬t_»cv_nowa™ +(1); + +66  +u¬t1_dev_»cv +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +68  +u¬t_»cv +(1); + +72 #ifdeà +UART2_COMPILE + + +73  +u¬t2_dev_£nd_nowa™ +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +75  +u¬t_£nd_nowa™ +(2, +c +); + +78  +u¬t2_dev_£nd +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +80  +u¬t_£nd +(2, +c +); + +83  +u¬t2_dev_»cv_nowa™ +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +85  +u¬t_»cv_nowa™ +(2); + +88  +u¬t2_dev_»cv +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +90  +u¬t_»cv +(2); + +94 #ifdeà +UART3_COMPILE + + +95  +u¬t3_dev_£nd_nowa™ +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +97  +u¬t_£nd_nowa™ +(3, +c +); + +100  +u¬t3_dev_£nd +( +c +, +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +102  +u¬t_£nd +(3, +c +); + +105  +u¬t3_dev_»cv_nowa™ +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +107  +u¬t_»cv_nowa™ +(3); + +110  +u¬t3_dev_»cv +( +__©Œibu‹__ +(( +unu£d +)è +FILE + * +f +) + +112  +u¬t_»cv +(3); + + @uart_errors.h + +36 #iâdeà +UART_IS_USART + + +37 #ià( +UART0_PARITY + =ð +UART_PARTITY_ODD +è|| (UART0_PARITY =ð +UART_PARTITY_EVEN +) + +38 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + +·r™y +  +your + +uC + +has + +no + +USART + + +41 #ià( +UART0_STOP_BIT + == 2) + +42 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + +ªÙh” + +¡Ý + +b™ +  +your + +uC + +has + +no + +USART + + +45 #ià( +UART0_NBITS + < 8) + +46 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + 5/6/7 +b™s + +äames +  +your + +uC + +has + +no + +USART + + +52 #ià! +defšed +( +UART_USART +è&& defšed( +UART_DOUBLE +) + +53 #ià( +UART1_PARITY + =ð +UART_PARTITY_ODD +è|| (UART1_PARITY =ð +UART_PARTITY_EVEN +) + +54 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + +·r™y +  +your + +uC + +has + +no + +USART + + +57 #ià( +UART1_STOP_BIT + == 2) + +58 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + +ªÙh” + +¡Ý + +b™ +  +your + +uC + +has + +no + +USART + + +61 #ià( +UART1_NBITS + < 8) + +62 #”rÜ +Cu¼’Žy + +this + +moduË + +dÛs + +nÙ + +suµÜt + 5/6/7 +b™s + +äames +  +your + +uC + +has + +no + +USART + + + @uart_events.c + +24  + ~ + +25  + ~ + +26  + ~ + +30  +u¬t_»gi¡”_tx_ev’t +( +ušt8_t + +num +, (* +f +)()) + +32 +ušt8_t + +æags +; + +33 ià( +num + >ð +UART_HW_NUM +) + +35 + `IRQ_LOCK +( +æags +); + +36 +tx_ev’t +[ +num +] = +f +; + +37 + `IRQ_UNLOCK +( +æags +); + +38 + } +} + +42  +u¬t_»gi¡”_rx_ev’t +( +ušt8_t + +num +, (* +f +)()) + +44 +ušt8_t + +æags +; + +45 ià( +num + >ð +UART_HW_NUM +) + +47 + `IRQ_LOCK +( +æags +); + +48 +rx_ev’t +[ +num +] = +f +; + +49 + `IRQ_UNLOCK +( +æags +); + +50 + } +} + + @uart_getconf.c + +24  + ~ + +25  + ~ + +26  + ~ + +28 #ià +UART_IS_USART + + +30  +šlše + +ušt8_t + + $g‘_uc¤c +( +ušt8_t + +num +) + +32 #ifdeà +URSEL + + +33 +ušt8_t + +tmp +; + +35  +num +) { + +36 #ifdeà +UART0_COMPILE + + +38 +tmp + = +UBRR0H +; + +39 +tmp + = +UCSR0C +; + +42 #ifdeà +UART1_COMPILE + + +44 +tmp + = +UBRR1H +; + +45 +tmp + = +UCSR1C +; + +48 #ifdeà +UART2_COMPILE + + +50 +tmp + = +UBRR2H +; + +51 +tmp + = +UCSR2C +; + +54 #ifdeà +UART3_COMPILE + + +56 +tmp + = +UBRR3H +; + +57 +tmp + = +UCSR3C +; + +61 +tmp + = 0; + +64  +tmp +; + +66  * +u¬t_»gs +[ +num +]. +uc¤c +; + +68 + } +} + +71 +ušt8_t + + $u¬t_g‘cÚf_nb™s +( +ušt8_t + +num +) + +73 +ušt8_t + +nb™s +; + +75 +nb™s + = ( + `g‘_uc¤c +( +num +è>> +UCSZ0 +) & 0x03; + +76 #ifdeà +CONFIG_MODULE_UART_9BITS + + +77 ià(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +UCSZ2 +)) + +78 +nb™s + += 4; + +80 +nb™s + += 5; + +81  +nb™s +; + +82 + } +} + +87 +ušt8_t + + $u¬t_g‘cÚf_nb™s +( +ušt8_t + +num +) + +89 #ifdeà +CONFIG_MODULE_UART_9BITS + + +90 ià(* +u¬t_»gs +[ +num +]. +uc¤b + & ( +ušt8_t +)(1 << +CHR9 +)) + +97 + } +} + +102 #ià +UART_IS_USART + + +105  +šlše + +ušt16_t + + $u¬t_g‘_baud»g +( +ušt8_t + +num +) + +107  (( +ušt16_t +)* +u¬t_»gs +[ +num +]. +ub¼h + << 8) | + +108 ( +ušt16_t +)* +u¬t_»gs +[ +num +]. +ub¼l +; + +109 + } +} + +114  +šlše + +ušt16_t + + $u¬t_g‘_baud»g +( +ušt8_t + +num +) + +116  ( +ušt16_t +)* +u¬t_»gs +[ +num +]. +ub¼l +; + +117 + } +} + +123  + $u¬t_g‘cÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +) + +125 +ušt8_t + +tmp +; + +126 +ušt8_t + +æags +; + +128 + `IRQ_LOCK +( +æags +); + +132 ià(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXEN +)) + +133 +u +-> +’abËd + = 1; + +135 +u +-> +’abËd + = 0; + +138 ià(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE +)) + +139 +u +-> +šŒ_’abËd + = 1; + +141 +u +-> +šŒ_’abËd + = 0; + +144 ià( +UART_HAS_U2X + && (* +u¬t_»gs +[ +num +]. +uc¤a + & (1 << +U2X +))) + +145 +u +-> +u£_doubË_¥“d + = 1; + +147 +u +-> +u£_doubË_¥“d + = 0; + +151 ià( +UART_IS_USART +) { + +152 +tmp + = + `g‘_uc¤c +( +num +è& ((1 << +UPM1 +è| (1 << +UPM0 +)); + +153 ià( +tmp + =ð((1 << +UPM1 +è| (1 << +UPM0 +))) + +154 +u +-> +·r™y + = +UART_PARTITY_ODD +; + +155 ià( +tmp + =ð(1 << +UPM1 +)) + +156 +u +-> +·r™y + = +UART_PARTITY_EVEN +; + +158 +u +-> +·r™y + = +UART_PARTITY_NONE +; + +161 +u +-> +·r™y + = +UART_PARTITY_NONE +; + +165 ià( +UART_IS_USART + && ( + `g‘_uc¤c +( +num +è& (1 << +USBS +))) { + +166 +u +-> +¡Ý_b™s + = +UART_STOP_BITS_2 +; + +169 +u +-> +¡Ý_b™s + = +UART_STOP_BITS_1 +; + +173 +u +-> +nb™s + = + `u¬t_g‘cÚf_nb™s +( +num +); + +174 +u +-> +baud¿‹ + = ( +F_CPU + / (( + `u¬t_g‘_baud»g +( +num +)+1) * 16)) ; + +176 + `IRQ_UNLOCK +( +æags +); + +177 + } +} + + @uart_host.c + +24  + ~ + +25  + ~ + +27  + ~ + +31  + $u¬t_š™ +() + +33 + } +} + +36 +ev’t + * + grx_ev’t +[ +UART_HW_NUM +]; + +37 +ev’t + * + gtx_ev’t +[ +UART_HW_NUM +]; + +39  + $u¬t_ho¡_rx_ev’t +( +c +) + +42 ià( +rx_ev’t +[0]) + +43 +rx_ev’t +[0]( +c +); + +44 + } +} + +46  + $u¬t_ho¡_tx_ev’t +( +c +) + +49 ià( +tx_ev’t +[0]) + +50 +tx_ev’t +[0]( +c +); + +51 + } +} + +53 +št8_t + + $u¬t_£tcÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +) + +57 + } +} + +59  + $u¬t_g‘cÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +) + +62 + } +} + +64  + $u¬t_»cv +( +ušt8_t + +num +) + +66 + `fúŽ +(0, +F_SETFL +, 0); + +67  + `g‘ch¬ +(); + +68 + } +} + +70  + $u¬t_»cv_nowa™ +( +ušt8_t + +num +) + +72 + `fúŽ +(0, +F_SETFL +, +O_NONBLOCK +); + +73  + `g‘ch¬ +(); + +74 + } +} + +76  + $u¬t_£nd_nowa™ +( +ušt8_t + +num +,  +c +) + +78  + `putch¬ +( +c +); + +79 + } +} + +81  + $u¬t_£nd +( +ušt8_t + +num +,  +c +) + +83  + `putch¬ +( +c +); + +84 + } +} + + @uart_host.h + +24  +u¬t_ho¡_rx_ev’t +( +c +); + +25  +u¬t_ho¡_tx_ev’t +( +c +); + + @uart_private.h + +24 #iâdeà +_UART_PRIVATE_H_ + + +25  + #_UART_PRIVATE_H_ + + + ) + +27  + ~ + +28  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +34 vÞ©ž + tušt8_t + * + tu¬t_»g_t +; + +36  + s»gs + { + +37 +u¬t_»g_t + + mudr +; + +38 +u¬t_»g_t + + muc¤a +; + +39 +u¬t_»g_t + + muc¤b +; + +40 +u¬t_»g_t + + muc¤c +; + +41 +u¬t_»g_t + + mub¼l +; + +42 +u¬t_»g_t + + mub¼h +; + +45 cÚ¡  +»gs + + gu¬t_»gs +[ +UART_HW_NUM +]; + +47 ( + tev’t +)(); + +48 ( + tev’t_9b™s +)(); + +50 +ev’t + * +rx_ev’t +[ +UART_HW_NUM +]; + +51 +ev’t + * +tx_ev’t +[ +UART_HW_NUM +]; + +53  + `u¬t_£nd_Ãxt_ch¬ +( +ušt8_t + +num +); + +54 +št8_t + + `u¬t_£tcÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +); + +56  +šlše +  + $u¬t_g‘_udr +( +ušt8_t + +num +) + +58  * +u¬t_»gs +[ +num +]. +udr +; + +59 + } +} + +61  +šlše +  + $u¬t_£t_udr +( +ušt8_t + +num +,  +c +) + +63 * +u¬t_»gs +[ +num +]. +udr + = +c +; + +66 ià( +tx_ev’t +[ +num +]) + +67 +tx_ev’t +[ +num +]( +c +); + +68 + } +} + +70 #ifdeà +CONFIG_MODULE_UART_9BITS + + +71  +šlše +  + $u¬t_g‘_udr_9b™s +( +ušt8_t + +num +) + +73  +v® + = * +u¬t_»gs +[ +num +]. +udr +; + +74 +v® + |ð(* +u¬t_»gs +[ +num +]. +uc¤b + & ((1 << +RXB8 +) ? 0x100 : 0)); + +75  +v® +; + +76 + } +} + +78  +šlše +  + $u¬t_£t_udr_9b™s +( +ušt8_t + +num +,  +c +) + +80 ià( +c + & 0x100 ) + +81 * +u¬t_»gs +[ +num +]. +uc¤b + |ð(1 << +RXB8 +); + +83 * +u¬t_»gs +[ +num +]. +uc¤b + &ð~(1 << +RXB8 +); + +84 * +u¬t_»gs +[ +num +]. +udr + = +c +; + +88 ià( +tx_ev’t +[ +num +]) + +89 (( +ev’t_9b™s + *) +tx_ev’t +[ +num +])( +c +); + +90 + } +} + + @uart_recv.c + +24  + ~ + +25  + ~ + +26  + ~ + +29  + $u¬t_»cv +( +ušt8_t + +num +) + +31  +–t + = 0; + +32  ( +–t + = + `u¬t_»cv_nowa™ +( +num +)) == -1 ); + +33  +–t +; + +34 + } +} + + @uart_recv9.c + +24  + ~ + +25  + ~ + +26  + ~ + +29  + $u¬t_9b™s_»cv +( +ušt8_t + +num +) + +31  +–t + = 0; + +32  ( +–t + = + `u¬t_9b™s_»cv_nowa™ +( +num +)) == -1 ); + +33  +–t +; + +34 + } +} + + @uart_recv9_nowait.c + +24  + ~ + +25  + ~ + +26  + ~ + +29  + $u¬t_9b™s_»cv_nowa™ +( +ušt8_t + +num +) + +31  +–t + = 0; + +32 +ušt8_t + +æags +; + +36 ià(!(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE +))) { + +37 iàÐ!(* +u¬t_»gs +[ +num +]. +uc¤a + & (1 << +RXC +)) ) + +39  + `u¬t_g‘_udr_9b™s +( +num +); + +43 + `IRQ_LOCK +( +æags +); + +44 ifÐ + `CIRBUF_GET_LEN +(& +g_rx_fifo +[ +num +]) >= 2) { + +45 + `cœbuf_g‘_buf_ž +(& +g_rx_fifo +[ +num +], (*)& +–t +, 2); + +46 + `cœbuf_d–_buf_ž +(& +g_rx_fifo +[ +num +], 2); + +47 + `IRQ_UNLOCK +( +æags +); + +48  () +–t +; + +50 + `IRQ_UNLOCK +( +æags +); + +53 + } +} + + @uart_recv_nowait.c + +24  + ~ + +25  + ~ + +26  + ~ + +29  + $u¬t_»cv_nowa™ +( +ušt8_t + +num +) + +31  +–t + = 0; + +32 +ušt8_t + +æags +; + +36 ià(!(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE +))) { + +37 iàÐ!(* +u¬t_»gs +[ +num +]. +uc¤a + & (1 << +RXC +)) ) + +39  + `u¬t_g‘_udr +( +num +); + +43 + `IRQ_LOCK +( +æags +); + +44 ifÐ! + `CIRBUF_IS_EMPTY +(& +g_rx_fifo +[ +num +]) ) { + +45 +–t + = + `cœbuf_g‘_ž +(& +g_rx_fifo +[ +num +]); + +46 + `cœbuf_d–_ž +(& +g_rx_fifo +[ +num +]); + +47 + `IRQ_UNLOCK +( +æags +); + +48  () +–t +; + +50 + `IRQ_UNLOCK +( +æags +); + +53 + } +} + + @uart_send.c + +24  + ~ + +25  + ~ + +26  + ~ + +28  + $u¬t_£nd +( +ušt8_t + +num +,  +c +) + +31 ià( + `u¬t_£nd_nowa™ +( +num +, +c +) == -1) { + +35 ià( + `GLOBAL_IRQ_ARE_MASKED +(è&& (* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE +)) ) { + +36  !(* +u¬t_»gs +[ +num +]. +uc¤a + & (1 << +UDRE +)) ); + +39 + `u¬t_£nd_Ãxt_ch¬ +( +num +); + +40 + `cœbuf_add_h—d +(& +g_tx_fifo +[ +num +], +c +); + +44  + `u¬t_£nd_nowa™ +( +num +, +c +) == -1); + +47  +c +; + +48 + } +} + + @uart_send9.c + +24  + ~ + +25  + ~ + +26  + ~ + +28  + $u¬t_£nd_9b™s +( +ušt8_t + +num +,  +c +) + +31 ià( + `u¬t_£nd_9b™s_nowa™ +( +num +, +c +) == -1) { + +35 ià( + `GLOBAL_IRQ_ARE_MASKED +(è&& (* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE +)) ) { + +36  !(* +u¬t_»gs +[ +num +]. +uc¤a + & (1 << +UDRE +)) ); + +39 + `u¬t_£nd_Ãxt_ch¬ +( +num +); + +40 + `cœbuf_add_buf_h—d +(& +g_tx_fifo +[ +num +], (*)& +c +, 2); + +44  + `u¬t_£nd_9b™s_nowa™ +( +num +, +c +) == -1); + +47  +c +; + +48 + } +} + + @uart_send9_nowait.c + +24  + ~ + +25  + ~ + +26  + ~ + +28  + $u¬t_£nd_9b™s_nowa™ +( +ušt8_t + +num +,  +c +) + +30 +ušt8_t + +æags +; + +31 + `IRQ_LOCK +( +æags +); + +34 iàÐ!(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE + )) ) { + +36 ià(* +u¬t_»gs +[ +num +]. +uc¤a + & (1<< +UDRE +)) { + +37 + `u¬t_£t_udr_9b™s +( +c +); + +38 + `IRQ_UNLOCK +( +æags +); + +39  +c +; + +42 + `IRQ_UNLOCK +( +æags +); + +48 ifÐ + `CIRBUF_GET_FREELEN +(& +g_tx_fifo +) < 2) { + +49 + `IRQ_UNLOCK +( +æags +); + +54 ià( + `CIRBUF_IS_EMPTY +(& +g_tx_fifo +[ +num +]) && + +55 * +u¬t_»gs +[ +num +]. +uc¤a + & (1<< +UDRE +)) { + +56 + `u¬t_£t_udr_9b™s +( +c +); + +57 + `sbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +60 + `cœbuf_add_buf_h—d +(& +g_tx_fifo +, (*)& +c +, 2); + +63 + `IRQ_UNLOCK +( +æags +); + +64  () +c +; + +65 + } +} + + @uart_send_nowait.c + +24  + ~ + +25  + ~ + +26  + ~ + +31  + $u¬t_£nd_nowa™ +( +ušt8_t + +num +,  +c +) + +33 +ušt8_t + +æags +; + +35 + `IRQ_LOCK +( +æags +); + +39 iàÐ!(* +u¬t_»gs +[ +num +]. +uc¤b + & (1 << +RXCIE + )) ) { + +41 ià(* +u¬t_»gs +[ +num +]. +uc¤a + & (1<< +UDRE +)) { + +42 + `u¬t_£t_udr +( +num +, +c +); + +43 + `IRQ_UNLOCK +( +æags +); + +44  () +c +; + +47 + `IRQ_UNLOCK +( +æags +); + +52 ià( + `CIRBUF_IS_FULL +(& +g_tx_fifo +[ +num +])) { + +53 + `IRQ_UNLOCK +( +æags +); + +58 ià( + `CIRBUF_IS_EMPTY +(& +g_tx_fifo +[ +num +]) && + +59 * +u¬t_»gs +[ +num +]. +uc¤a + & (1<< +UDRE +)) { + +60 + `u¬t_£t_udr +( +num +, +c +); + +61 + `sbi +(* +u¬t_»gs +[ +num +]. +uc¤b +, +UDRIE +); + +64 + `cœbuf_add_h—d +(& +g_tx_fifo +[ +num +], +c +); + +67 + `IRQ_UNLOCK +( +æags +); + +68  () +c +; + +69 + } +} + + @uart_setconf.c + +24  + ~ + +25  + ~ + +26  + ~ + +29 #ifdeà +UART0_COMPILE + + +30  + gg_tx0_buf +[ +UART0_TX_FIFO_SIZE +]; + +31  + gg_rx0_buf +[ +UART0_RX_FIFO_SIZE +]; + +33 #ifdeà +UART1_COMPILE + + +34  + gg_tx1_buf +[ +UART1_TX_FIFO_SIZE +]; + +35  + gg_rx1_buf +[ +UART1_RX_FIFO_SIZE +]; + +37 #ifdeà +UART2_COMPILE + + +38  + gg_tx2_buf +[ +UART2_TX_FIFO_SIZE +]; + +39  + gg_rx2_buf +[ +UART2_RX_FIFO_SIZE +]; + +41 #ifdeà +UART3_COMPILE + + +42  + gg_tx3_buf +[ +UART3_TX_FIFO_SIZE +]; + +43  + gg_rx3_buf +[ +UART3_RX_FIFO_SIZE +]; + +46 #ià +UART_IS_USART + + +48  +št8_t + + $u¬t_£t_nb™s_·r™y +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +) + +50 +ušt8_t + +uc¤c + = 0; + +53 #ifdeà +CONFIG_MODULE_UART_9BITS + + +54 ià( +u +-> +nb™s + < 5 || u->nbits > 9) { + +55  +ENOTSUP +; + +58 ià( +u +-> +nb™s + < 5 || u->nbits > 8) { + +59  +ENOTSUP +; + +63 +uc¤c + |ðÐ(( +u +-> +nb™s + - 5è& 0x03è<< +UCSZ0 + ); + +64 #ifdeà +CONFIG_MODULE_UART_9BITS + + +65 ià( +u +-> +nb™s + == 9) + +66 * +u¬t_»gs +[ +num +]. +uc¤b + |ð(1 << +UCSZ2 +); + +69 * +u¬t_»gs +[ +num +]. +uc¤b + &ð~(1 << +UCSZ2 +); + +72 ià( +u +-> +·r™y + =ð +UART_PARTITY_ODD +) + +73 +uc¤c + |ð((1 << +UPM0 +è| (1 << +UPM1 +)); + +74 ià( +u +-> +·r™y + =ð +UART_PARTITY_EVEN +) + +75 +uc¤c + |ð(1 << +UPM1 +); + +76 ià( +u +-> +·r™y + !ð +UART_PARTITY_NONE +) { + +77  +EINVAL +; + +81 ià( +u +-> +¡Ý_b™s + =ð +UART_STOP_BITS_2 +) + +82 +uc¤c + |ð(1 << +USBS +); + +83 ià( +u +-> +¡Ý_b™s + !ð +UART_STOP_BITS_1 +) + +84  +EINVAL +; + +86 #ifdeà +URSEL + + +88 +uc¤c + |ð(1<< +URSEL +); + +90 * +u¬t_»gs +[ +num +]. +uc¤c + = ucsrc; + +92  +ESUCCESS +; + +93 + } +} + +97  +št8_t + + $u¬t_£t_nb™s_·r™y +( +št8_t + +num +,  +u¬t_cÚfig + * +u +) + +100 ià( +u +-> +nb™s + == 8) + +101 * +u¬t_»gs +[ +num +]. +uc¤b + &ð~(1 << +CHR9 +); + +102 #ifdeà +CONFIG_MODULE_UART_9BITS + + +103 ià( +u +-> +nb™s + == 9) + +104 * +u¬t_»gs +[ +num +]. +uc¤b + |ð(1 << +CHR9 +); + +107  +ENOTSUP +; + +110 ià( +u +-> +·r™y + !ð +UART_PARTITY_NONE + || + +111 +u +-> +¡Ý_b™s + !ð +UART_STOP_BITS_1 +) { + +112  +ENOTSUP +; + +115  +ESUCCESS +; + +116 + } +} + +120 #ià +UART_IS_USART + + +122  +št8_t + + $u¬t_£t_baud»g +( +ušt8_t + +num +, +ušt16_t + +baud»g +) + +124 +ušt8_t + +lo +, +hi +; + +129 +lo + = ( +ušt8_t +) +baud»g +; + +130 +hi + = ( +ušt8_t +)( +baud»g +>>8) & 0x7F; + +132 * +u¬t_»gs +[ +num +]. +ub¼l + = +lo +; + +133 * +u¬t_»gs +[ +num +]. +ub¼h + = +hi +; + +135  +ESUCCESS +; + +136 + } +} + +140  +št8_t + + $u¬t_£t_baud»g +( +ušt8_t + +num +, +ušt16_t + +baud»g +) + +142 +ušt8_t + +lo +, +hi +; + +144 +lo +=( +ušt8_t +) +baud»g +; + +145 +hi +=( +ušt8_t +)( +baud»g +>>8); + +147 ià( +hi + != 0) + +148  +EINVAL +; + +149 * +u¬t_»gs +[ +num +]. +ub¼l + = +lo +; + +151  +ESUCCESS +; + +152 + } +} + +156  + #UART_SET_STATICCONF +( +x +) \ + +157 +u +-> +’abËd + = +UART +## +x +## +_ENABLED +; \ + +158 +u +-> +šŒ_’abËd + = +UART +## +x +## +_INTERRUPT_ENABLED +; \ + +159 +u +-> +u£_doubË_¥“d + = +UART +## +x +## +_USE_DOUBLE_SPEED +; \ + +160 +u +-> +·r™y + = +UART +## +x +## +_PARITY +; \ + +161 +u +-> +¡Ý_b™s + = +UART +## +x +## +_STOP_BIT +; \ + +162 +u +-> +nb™s + = +UART +## +x +## +_NBITS +; \ + +163 +u +-> +baud¿‹ + = +UART +## +x +## +_BAUDRATE +; \ + +164  + + ) + +166 +št8_t + + $u¬t_£tcÚf +( +ušt8_t + +num +,  +u¬t_cÚfig + * +u +) + +168 +ušt8_t + +»t + = +ESUCCESS +; + +169 +ušt16_t + +baud¿‹_»g +; + +170  +u¬t_cÚfig + +¡©ic_cÚf +; + +171 +ušt8_t + +æags +; + +173 + `IRQ_LOCK +( +æags +); + +176 ià(! +u +) { + +177 +u + = & +¡©ic_cÚf +; + +178  +num +) { + +179 #ifdeà +UART0_COMPILE + + +181 + `UART_SET_STATICCONF +(0); + +183 #ifdeà +UART1_COMPILE + + +185 + `UART_SET_STATICCONF +(1); + +187 #ifdeà +UART2_COMPILE + + +189 + `UART_SET_STATICCONF +(2); + +191 #ifdeà +UART3_COMPILE + + +193 + `UART_SET_STATICCONF +(3); + +196 +»t + = +EINVAL +; + +197  +out +; + +202  !(* +u¬t_»gs +[ +num +]. +uc¤a + & (1<< +UDRE +)) ); + +204  +num +) { + +205 #ifdeà +UART0_COMPILE + + +207 + `cœbuf_š™ +(& +g_tx_fifo +[0], +g_tx0_buf +, 0, +UART0_TX_FIFO_SIZE +); + +208 + `cœbuf_š™ +(& +g_rx_fifo +[0], +g_rx0_buf +, 0, +UART0_RX_FIFO_SIZE +); + +211 #ifdeà +UART1_COMPILE + + +213 + `cœbuf_š™ +(& +g_tx_fifo +[1], +g_tx1_buf +, 0, +UART1_TX_FIFO_SIZE +); + +214 + `cœbuf_š™ +(& +g_rx_fifo +[1], +g_rx1_buf +, 0, +UART1_RX_FIFO_SIZE +); + +217 #ifdeà +UART2_COMPILE + + +219 + `cœbuf_š™ +(& +g_tx_fifo +[2], +g_tx2_buf +, 0, +UART2_TX_FIFO_SIZE +); + +220 + `cœbuf_š™ +(& +g_rx_fifo +[2], +g_rx2_buf +, 0, +UART2_RX_FIFO_SIZE +); + +223 #ifdeà +UART3_COMPILE + + +225 + `cœbuf_š™ +(& +g_tx_fifo +[3], +g_tx3_buf +, 0, +UART3_TX_FIFO_SIZE +); + +226 + `cœbuf_š™ +(& +g_rx_fifo +[3], +g_rx3_buf +, 0, +UART3_RX_FIFO_SIZE +); + +230 +»t + = +EINVAL +; + +231  +out +; + +233 * +u¬t_»gs +[ +num +]. +uc¤a + = 0; + +235 ià( +u +-> +’abËd +) + +236 * +u¬t_»gs +[ +num +]. +uc¤b + = ((1 << +TXEN +è| (1 << +RXEN +)); + +238 * +u¬t_»gs +[ +num +]. +uc¤b + = 0; + +239  +out +; + +244 ià( +u +-> +šŒ_’abËd +) + +245 * +u¬t_»gs +[ +num +]. +uc¤b + |ð(1 << +RXCIE +); + +247 ià( +UART_HAS_U2X +) { + +248 ià( +u +-> +u£_doubË_¥“d +) + +249 * +u¬t_»gs +[ +num +]. +uc¤a + |ð(1 << +U2X +); + +251 * +u¬t_»gs +[ +num +]. +uc¤a + &ð~(1 << +U2X +); + +253 ià( +u +-> +u£_doubË_¥“d +) { + +254 +»t + = +ENOTSUP +; + +255  +out +; + +258 + `u¬t_£t_nb™s_·r™y +( +num +, +u +); + +261 if( +u +-> +u£_doubË_¥“d +) + +262 +baud¿‹_»g + = ( +F_CPU + / ( +u +-> +baud¿‹ +*8l)) - 1; + +264 +baud¿‹_»g + = ( +F_CPU + / ( +u +-> +baud¿‹ +*16l)) - 1; + +266 + `u¬t_£t_baud»g +( +num +, +baud¿‹_»g +); + +269 +out +: + +270 + `IRQ_UNLOCK +( +æags +); + +271  +»t +; + +272 + } +} + + @vt100.c + +24  + ~<¡dlib.h +> + +25  + ~<¡dio.h +> + +26  + ~<¡ršg.h +> + +27  + ~<¡d¬g.h +> + +28  + ~<ùy³.h +> + +30  + ~ + +32  + ~"vt100.h +" + +34 cÚ¡ +´og_ch¬ + + gcmd0 +[] = +vt100_up_¬r +; + +35 cÚ¡ +´og_ch¬ + + gcmd1 +[] = +vt100_down_¬r +; + +36 cÚ¡ +´og_ch¬ + + gcmd2 +[] = +vt100_right_¬r +; + +37 cÚ¡ +´og_ch¬ + + gcmd3 +[] = +vt100_Ëá_¬r +; + +38 cÚ¡ +´og_ch¬ + + gcmd4 +[] = "\177"; + +39 cÚ¡ +´og_ch¬ + + gcmd5 +[] = "\n"; + +40 cÚ¡ +´og_ch¬ + + gcmd6 +[] = "\001"; + +41 cÚ¡ +´og_ch¬ + + gcmd7 +[] = "\005"; + +42 cÚ¡ +´og_ch¬ + + gcmd8 +[] = "\013"; + +43 cÚ¡ +´og_ch¬ + + gcmd9 +[] = "\031"; + +44 cÚ¡ +´og_ch¬ + + gcmd10 +[] = "\003"; + +45 cÚ¡ +´og_ch¬ + + gcmd11 +[] = "\006"; + +46 cÚ¡ +´og_ch¬ + + gcmd12 +[] = "\002"; + +47 cÚ¡ +´og_ch¬ + + gcmd13 +[] = +vt100_suµr +; + +48 cÚ¡ +´og_ch¬ + + gcmd14 +[] = +vt100_b +; + +49 cÚ¡ +´og_ch¬ + + gcmd15 +[] = "\004"; + +50 cÚ¡ +´og_ch¬ + + gcmd16 +[] = "\014"; + +51 cÚ¡ +´og_ch¬ + + gcmd17 +[] = "\r"; + +52 cÚ¡ +´og_ch¬ + + gcmd18 +[] = "\033\177"; + +53 cÚ¡ +´og_ch¬ + + gcmd19 +[] = +vt100_wÜd_Ëá +; + +54 cÚ¡ +´og_ch¬ + + gcmd20 +[] = +vt100_wÜd_right +; + +55 cÚ¡ +´og_ch¬ + + gcmd21 +[] = "?"; + +57 cÚ¡ +´og_ch¬ + * + gvt100_commªds +[] + gPROGMEM + = { + +58 +cmd0 +, +cmd1 +, +cmd2 +, +cmd3 +, +cmd4 +, +cmd5 +, +cmd6 +, +cmd7 +, + +59 +cmd8 +, +cmd9 +, +cmd10 +, +cmd11 +, +cmd12 +, +cmd13 +, +cmd14 +, + +60 +cmd15 +, +cmd16 +, +cmd17 +, +cmd18 +, +cmd19 +, +cmd20 +, + +61 +cmd21 +, + +65 + $vt100_š™ +( +vt100 + * +vt +) + +67 +vt +-> +¡©e + = +VT100_INIT +; + +68 + } +} + +71  +št8_t + + +72 + $m©ch_commªd +(* +buf +, +ušt8_t + +size +) + +74 cÚ¡ +´og_ch¬ + * +cmd +; + +75 +ušt8_t + +i + = 0; + +77  +i +=0 ; i<( +vt100_commªds +)/(cÚ¡ +´og_ch¬ + *) ; i++) { + +78 #ifdeà +HOST_VERSION + + +79 +cmd + = *( +vt100_commªds + + +i +); + +81 +cmd + = (cÚ¡ +´og_ch¬ + *è + `pgm_»ad_wÜd + ( +vt100_commªds + + +i +); + +84 ià( +size + =ð + `¡¾’_P +( +cmd +) && + +85 ! + `¡ºcmp_P +( +buf +, +cmd +, + `¡¾’_P +(cmd))) { + +86  +i +; + +91 + } +} + +93 +št8_t + + +94 + $vt100_·r£r +( +vt100 + * +vt +,  +ch +) + +96 +ušt8_t + +size +; + +97 +ušt8_t + +c + = (ušt8_tè +ch +; + +99 ià( +vt +-> +buåos + > +VT100_BUF_SIZE +) { + +100 +vt +-> +¡©e + = +VT100_INIT +; + +101 +vt +-> +buåos + = 0; + +104 +vt +-> +buf +[vt-> +buåos +++] = +c +; + +105 +size + = +vt +-> +buåos +; + +107  +vt +-> +¡©e +) { + +108  +VT100_INIT +: + +109 ià( +c + == 033) { + +110 +vt +-> +¡©e + = +VT100_ESCAPE +; + +113 +vt +-> +buåos + = 0; + +114  +m©ch_commªd +; + +118  +VT100_ESCAPE +: + +119 ià( +c + == 0133) { + +120 +vt +-> +¡©e + = +VT100_ESCAPE_CSI +; + +122 ià( +c + >= 060 && c <= 0177) { + +123 +vt +-> +buåos + = 0; + +124 +vt +-> +¡©e + = +VT100_INIT +; + +125  +m©ch_commªd +; + +129  +VT100_ESCAPE_CSI +: + +130 ià( +c + >= 0100 && c <= 0176) { + +131 +vt +-> +buåos + = 0; + +132 +vt +-> +¡©e + = +VT100_INIT +; + +133  +m©ch_commªd +; + +138 +vt +-> +buåos + = 0; + +144 +m©ch_commªd +: + +145  + `m©ch_commªd +( +vt +-> +buf +, +size +); + +146 + } +} + + @vt100.h + +24 #iâdeà +_VT100_H_ + + +25  + #_VT100_H_ + + + ) + +27  + #vt100_b–l + "\007" + + ) + +28  + #vt100_bs + "\010" + + ) + +29  + #vt100_bs_þ—r + "\010 \010" + + ) + +30  + #vt100_b + "\011" + + ) + +31  + #vt100_üÆ + "\012\015" + + ) + +32  + #vt100_þ—r_right + "\033[0K" + + ) + +33  + #vt100_þ—r_Ëá + "\033[1K" + + ) + +34  + #vt100_þ—r_down + "\033[0J" + + ) + +35  + #vt100_þ—r_up + "\033[1J" + + ) + +36  + #vt100_þ—r_lše + "\033[2K" + + ) + +37  + #vt100_þ—r_sü“n + "\033[2J" + + ) + +38  + #vt100_up_¬r + "\033\133\101" + + ) + +39  + #vt100_down_¬r + "\033\133\102" + + ) + +40  + #vt100_right_¬r + "\033\133\103" + + ) + +41  + #vt100_Ëá_¬r + "\033\133\104" + + ) + +42  + #vt100_muÉi_right + "\033\133%uC" + + ) + +43  + #vt100_muÉi_Ëá + "\033\133%uD" + + ) + +44  + #vt100_suµr + "\033\133\063\176" + + ) + +45  + #vt100_home + "\033M\033E" + + ) + +46  + #vt100_wÜd_Ëá + "\033\142" + + ) + +47  + #vt100_wÜd_right + "\033\146" + + ) + +52  + #KEY_UP_ARR + 0 + + ) + +53  + #KEY_DOWN_ARR + 1 + + ) + +54  + #KEY_RIGHT_ARR + 2 + + ) + +55  + #KEY_LEFT_ARR + 3 + + ) + +56  + #KEY_BKSPACE + 4 + + ) + +57  + #KEY_RETURN + 5 + + ) + +58  + #KEY_CTRL_A + 6 + + ) + +59  + #KEY_CTRL_E + 7 + + ) + +60  + #KEY_CTRL_K + 8 + + ) + +61  + #KEY_CTRL_Y + 9 + + ) + +62  + #KEY_CTRL_C + 10 + + ) + +63  + #KEY_CTRL_F + 11 + + ) + +64  + #KEY_CTRL_B + 12 + + ) + +65  + #KEY_SUPPR + 13 + + ) + +66  + #KEY_TAB + 14 + + ) + +67  + #KEY_CTRL_D + 15 + + ) + +68  + #KEY_CTRL_L + 16 + + ) + +69  + #KEY_RETURN2 + 17 + + ) + +70  + #KEY_META_BKSPACE + 18 + + ) + +71  + #KEY_WLEFT + 19 + + ) + +72  + #KEY_WRIGHT + 20 + + ) + +73  + #KEY_HELP + 21 + + ) + +75 cÚ¡ +´og_ch¬ + * +vt100_commªds +[] +PROGMEM +; + +77 + evt100_·r£r_¡©e + { + +78 + mVT100_INIT +, + +79 + mVT100_ESCAPE +, + +80 + mVT100_ESCAPE_CSI +, + +83  + #VT100_BUF_SIZE + 8 + + ) + +84  + svt100 + { + +85 +ušt8_t + + mbuåos +; + +86  + mbuf +[ +VT100_BUF_SIZE +]; + +87 +vt100_·r£r_¡©e + + m¡©e +; + +93  +vt100_š™ +( +vt100 + * +vt +); + +101 +št8_t + +vt100_·r£r +( +vt100 + * +vt +,  +c +); + + @xbee.c + +28  + ~ + +29  + ~ + +32  + ~<¡dio.h +> + +33  + ~<¡dšt.h +> + +34  + ~<¡dlib.h +> + +35  + ~<¡ršg.h +> + +36  + ~<”ºo.h +> + +38  + ~"xb“_ÃighbÜ.h +" + +39  + ~"xb“_¡©s.h +" + +40  + ~"xb“_buf.h +" + +41  + ~"xb“_´Ùo.h +" + +42  + ~"xb“.h +" + +44  + $xb“_š™ +() + +47 + } +} + +49  + $xb“_»gi¡”_chªÃl +( +xb“_dev + * +dev +,  +chªÃl +, + +50 +xb“_rx_cb_t + * +rx_cb +, * +Ýaque +) + +53 ià( +chªÃl + =ð +XBEE_CHANNEL_ANY +) { + +54  +ch +; + +57  +ch + = 1; ch < +XBEE_MAX_CHANNEL +; ch++) { + +58 ià( +dev +-> +chªÃl +[ +ch +]. +»gi¡”ed + == 0) { + +59 +chªÃl + = +ch +; + +64 ià( +chªÃl + =ð +XBEE_CHANNEL_ANY +) + +68 ià( +chªÃl + < 0 || chªÃÈ>ð +XBEE_MAX_CHANNEL + || + +69 +dev +-> +chªÃl +[chªÃl]. +»gi¡”ed + == 1) + +72 +dev +-> +chªÃl +[chªÃl]. +»gi¡”ed + = 1; + +73 +dev +-> +chªÃl +[chªÃl]. +rx_cb + =„x_cb; + +74 +dev +-> +chªÃl +[chªÃl]. +¬g + = +Ýaque +; + +75  +chªÃl +; + +76 + } +} + +78  + $xb“_uÄegi¡”_chªÃl +( +xb“_dev + * +dev +,  +chªÃl +) + +80 ià( +chªÃl + < 0 || chªÃÈ>ð +XBEE_MAX_CHANNEL + || + +81 +dev +-> +chªÃl +[chªÃl]. +»gi¡”ed + == 0) + +83 +dev +-> +chªÃl +[chªÃl]. +»gi¡”ed + = 0; + +84 +dev +-> +chªÃl +[chªÃl]. +rx_cb + = +NULL +; + +85 +dev +-> +chªÃl +[chªÃl]. +¬g + = +NULL +; + +87 + } +} + +89  + $xb“_ݒ +( +xb“_dev + * +dev +, +FILE + * +xb“_fže +) + +91 + `mem£t +( +dev +, 0, (*dev)); + +92 +dev +-> +fže + = +xb“_fže +; + +93 + `xb“_Ãigh_š™ +( +dev +); + +95 + } +} + + @xbee.h + +32 ( + txb“_rx_cb_t +)( + txb“_dev + *, , , *, + +36  + sxb“_chªÃl + { + +37  +»gi¡”ed +; + +38 +xb“_rx_cb_t + * +rx_cb +; + +39 * +¬g +; + +42  + #XBEE_DEFAULT_CHANNEL + 0 + + ) + +43  + #XBEE_MAX_CHANNEL + 16 + + ) + +44  + #XBEE_CHANNEL_ANY + +XBEE_MAX_CHANNEL + + + ) + +47  + sxb“_dev + { + +48 +FILE + * +fže +; + +49  +xb“_chªÃl + +chªÃl +[ +XBEE_MAX_CHANNEL +]; + +50 +ušt8_t + +äame_Ën +; + +51  +äame +[ +XBEE_MAX_FRAME_LEN +]; + +52  +xb“_¡©s + +¡©s +; + +53  +xb“_Ãigh_li¡ + +Ãigh_li¡ +; + +57  + `xb“_š™ +(); + +60  + `xb“_ݒ +( +xb“_dev + * +dev +, +FILE + * +xb“_fže +); + +63  + `xb“_þo£ +( +xb“_dev + * +dev +); + +71  + `xb“_»gi¡”_chªÃl +( +xb“_dev + * +dev +,  +chªÃl +, + +72 +xb“_rx_cb_t + * +rx_cb +, * +Ýaque +); + +75  + `xb“_uÄegi¡”_chªÃl +( +xb“_dev + * +dev +,  +chªÃl_id +); + +78  + `xb“_»ad +( +xb“_dev + * +dev +); + +81  + `xb“_´oûss_queue +( +xb“_dev + * +dev +); + + @xbee_atcmd.c + +28  + ~ + +30  + ~<¡ršg.h +> + +31  + ~<¡dlib.h +> + +32  + ~<¡dio.h +> + +34  + ~"xb“_©cmd.h +" + +36 +´og_ch¬ + + g©cmd0_Çme +[] = "WR"; + +37 +´og_ch¬ + + g©cmd0_desc +[] = "write-param"; + +38 +´og_ch¬ + + g©cmd0_h–p +[] = + +41 +´og_ch¬ + + g©cmd1_Çme +[] = "RE"; + +42 +´og_ch¬ + + g©cmd1_desc +[] = "restore-defaults"; + +43 +´og_ch¬ + + g©cmd1_h–p +[] = + +46 +´og_ch¬ + + g©cmd2_Çme +[] = "FR"; + +47 +´og_ch¬ + + g©cmd2_desc +[] = "soft-reset"; + +48 +´og_ch¬ + + g©cmd2_h–p +[] = + +52 +´og_ch¬ + + g©cmd3_Çme +[] = "AC"; + +53 +´og_ch¬ + + g©cmd3_desc +[] = "apply-changes"; + +54 +´og_ch¬ + + g©cmd3_h–p +[] = + +57 +´og_ch¬ + + g©cmd4_Çme +[] = "R1"; + +58 +´og_ch¬ + + g©cmd4_desc +[] = "restore-compiled"; + +59 +´og_ch¬ + + g©cmd4_h–p +[] = + +62 +´og_ch¬ + + g©cmd5_Çme +[] = "VL"; + +63 +´og_ch¬ + + g©cmd5_desc +[] = "version-long"; + +64 +´og_ch¬ + + g©cmd5_h–p +[] = + +68 +´og_ch¬ + + g©cmd6_Çme +[] = "DH"; + +69 +´og_ch¬ + + g©cmd6_desc +[] = "dst-addr-high"; + +70 +´og_ch¬ + + g©cmd6_h–p +[] = + +74 +´og_ch¬ + + g©cmd7_Çme +[] = "DL"; + +75 +´og_ch¬ + + g©cmd7_desc +[] = "dst-addr-low"; + +76 +´og_ch¬ + + g©cmd7_h–p +[] = + +80 +´og_ch¬ + + g©cmd8_Çme +[] = "DD"; + +81 +´og_ch¬ + + g©cmd8_desc +[] = "device-type-id"; + +82 +´og_ch¬ + + g©cmd8_h–p +[] = + +87 +´og_ch¬ + + g©cmd9_Çme +[] = "SH"; + +88 +´og_ch¬ + + g©cmd9_desc +[] = "src-addr-high"; + +89 +´og_ch¬ + + g©cmd9_h–p +[] = + +92 +´og_ch¬ + + g©cmd10_Çme +[] = "SL"; + +93 +´og_ch¬ + + g©cmd10_desc +[] = "src-addr-low"; + +94 +´og_ch¬ + + g©cmd10_h–p +[] = + +97 +´og_ch¬ + + g©cmd11_Çme +[] = "SE"; + +98 +´og_ch¬ + + g©cmd11_desc +[] = "src-endpoint"; + +99 +´og_ch¬ + + g©cmd11_h–p +[] = + +103 +´og_ch¬ + + g©cmd12_Çme +[] = "DE"; + +104 +´og_ch¬ + + g©cmd12_desc +[] = "dst-endpoint"; + +105 +´og_ch¬ + + g©cmd12_h–p +[] = + +109 +´og_ch¬ + + g©cmd13_Çme +[] = "CI"; + +110 +´og_ch¬ + + g©cmd13_desc +[] = "cluster-id"; + +111 +´og_ch¬ + + g©cmd13_h–p +[] = + +115 +´og_ch¬ + + g©cmd14_Çme +[] = "NP"; + +116 +´og_ch¬ + + g©cmd14_desc +[] = "max-rf-payload"; + +117 +´og_ch¬ + + g©cmd14_h–p +[] = + +122 +´og_ch¬ + + g©cmd15_Çme +[] = "CE"; + +123 +´og_ch¬ + + g©cmd15_desc +[] = "coord-end-device"; + +124 +´og_ch¬ + + g©cmd15_h–p +[] = + +129 +´og_ch¬ + + g©cmd16_Çme +[] = "AP"; + +130 +´og_ch¬ + + g©cmd16_desc +[] = "api-mode"; + +131 +´og_ch¬ + + g©cmd16_h–p +[] = + +134 +´og_ch¬ + + g©cmd17_Çme +[] = "AO"; + +135 +´og_ch¬ + + g©cmd17_desc +[] = "api-output-format"; + +136 +´og_ch¬ + + g©cmd17_h–p +[] = + +140 +´og_ch¬ + + g©cmd18_Çme +[] = "BD"; + +141 +´og_ch¬ + + g©cmd18_desc +[] = "baud-rate"; + +142 +´og_ch¬ + + g©cmd18_h–p +[] = + +146 +´og_ch¬ + + g©cmd19_Çme +[] = "RO"; + +147 +´og_ch¬ + + g©cmd19_desc +[] = "packetization-timeout"; + +148 +´og_ch¬ + + g©cmd19_h–p +[] = + +153 +´og_ch¬ + + g©cmd20_Çme +[] = "FT"; + +154 +´og_ch¬ + + g©cmd20_desc +[] = "flow-control-thres"; + +155 +´og_ch¬ + + g©cmd20_h–p +[] = + +161 +´og_ch¬ + + g©cmd21_Çme +[] = "NB"; + +162 +´og_ch¬ + + g©cmd21_desc +[] = "parity"; + +163 +´og_ch¬ + + g©cmd21_h–p +[] = + +167 +´og_ch¬ + + g©cmd22_Çme +[] = "D7"; + +168 +´og_ch¬ + + g©cmd22_desc +[] = "dio7"; + +169 +´og_ch¬ + + g©cmd22_h–p +[] = + +175 +´og_ch¬ + + g©cmd23_Çme +[] = "D6"; + +176 +´og_ch¬ + + g©cmd23_desc +[] = "dio6"; + +177 +´og_ch¬ + + g©cmd23_h–p +[] = + +182 +´og_ch¬ + + g©cmd24_Çme +[] = "P0"; + +183 +´og_ch¬ + + g©cmd24_desc +[] = "dio10-pwm0"; + +184 +´og_ch¬ + + g©cmd24_h–p +[] = + +189 +´og_ch¬ + + g©cmd25_Çme +[] = "P1"; + +190 +´og_ch¬ + + g©cmd25_desc +[] = "dio11-pwm1"; + +191 +´og_ch¬ + + g©cmd25_h–p +[] = + +196 +´og_ch¬ + + g©cmd26_Çme +[] = "P2"; + +197 +´og_ch¬ + + g©cmd26_desc +[] = "dio12"; + +198 +´og_ch¬ + + g©cmd26_h–p +[] = + +203 +´og_ch¬ + + g©cmd27_Çme +[] = "RP"; + +204 +´og_ch¬ + + g©cmd27_desc +[] = "rssi-pwm"; + +205 +´og_ch¬ + + g©cmd27_h–p +[] = + +210 +´og_ch¬ + + g©cmd28_Çme +[] = "1S"; + +211 +´og_ch¬ + + g©cmd28_desc +[] = "sensor-sample"; + +212 +´og_ch¬ + + g©cmd28_h–p +[] = + +215 +´og_ch¬ + + g©cmd29_Çme +[] = "D0"; + +216 +´og_ch¬ + + g©cmd29_desc +[] = "dio0-ad0"; + +217 +´og_ch¬ + + g©cmd29_h–p +[] = + +223 +´og_ch¬ + + g©cmd30_Çme +[] = "D1"; + +224 +´og_ch¬ + + g©cmd30_desc +[] = "dio1-ad1"; + +225 +´og_ch¬ + + g©cmd30_h–p +[] = + +230 +´og_ch¬ + + g©cmd31_Çme +[] = "D2"; + +231 +´og_ch¬ + + g©cmd31_desc +[] = "dio2-ad2"; + +232 +´og_ch¬ + + g©cmd31_h–p +[] = + +237 +´og_ch¬ + + g©cmd32_Çme +[] = "D3"; + +238 +´og_ch¬ + + g©cmd32_desc +[] = "dio3-ad3"; + +239 +´og_ch¬ + + g©cmd32_h–p +[] = + +244 +´og_ch¬ + + g©cmd33_Çme +[] = "D4"; + +245 +´og_ch¬ + + g©cmd33_desc +[] = "dio4-ad4"; + +246 +´og_ch¬ + + g©cmd33_h–p +[] = + +251 +´og_ch¬ + + g©cmd34_Çme +[] = "D5"; + +252 +´og_ch¬ + + g©cmd34_desc +[] = "dio5-ad5"; + +253 +´og_ch¬ + + g©cmd34_h–p +[] = + +258 +´og_ch¬ + + g©cmd35_Çme +[] = "D8"; + +259 +´og_ch¬ + + g©cmd35_desc +[] = "dio8-sleep-rq"; + +260 +´og_ch¬ + + g©cmd35_h–p +[] = + +267 +´og_ch¬ + + g©cmd36_Çme +[] = "D9"; + +268 +´og_ch¬ + + g©cmd36_desc +[] = "dio9-on-sleep"; + +269 +´og_ch¬ + + g©cmd36_h–p +[] = + +274 +´og_ch¬ + + g©cmd37_Çme +[] = "PR"; + +275 +´og_ch¬ + + g©cmd37_desc +[] = "pull-up-resistor"; + +276 +´og_ch¬ + + g©cmd37_h–p +[] = + +281 +´og_ch¬ + + g©cmd38_Çme +[] = "M0"; + +282 +´og_ch¬ + + g©cmd38_desc +[] = "pwm0-out-level"; + +283 +´og_ch¬ + + g©cmd38_h–p +[] = + +287 +´og_ch¬ + + g©cmd39_Çme +[] = "M1"; + +288 +´og_ch¬ + + g©cmd39_desc +[] = "pwm1-out-level"; + +289 +´og_ch¬ + + g©cmd39_h–p +[] = + +293 +´og_ch¬ + + g©cmd40_Çme +[] = "LT"; + +294 +´og_ch¬ + + g©cmd40_desc +[] = "led-blink-time"; + +295 +´og_ch¬ + + g©cmd40_h–p +[] = + +298 +´og_ch¬ + + g©cmd41_Çme +[] = "IS"; + +299 +´og_ch¬ + + g©cmd41_desc +[] = "force-sample"; + +300 +´og_ch¬ + + g©cmd41_h–p +[] = + +304 +´og_ch¬ + + g©cmd42_Çme +[] = "IC"; + +305 +´og_ch¬ + + g©cmd42_desc +[] = "digital-change-detect"; + +306 +´og_ch¬ + + g©cmd42_h–p +[] = + +313 +´og_ch¬ + + g©cmd43_Çme +[] = "IR"; + +314 +´og_ch¬ + + g©cmd43_desc +[] = "io-sample-rate"; + +315 +´og_ch¬ + + g©cmd43_h–p +[] = + +320 +´og_ch¬ + + g©cmd44_Çme +[] = "CB"; + +321 +´og_ch¬ + + g©cmd44_desc +[] = "comissioning-button"; + +322 +´og_ch¬ + + g©cmd44_h–p +[] = + +327 +´og_ch¬ + + g©cmd45_Çme +[] = "VR"; + +328 +´og_ch¬ + + g©cmd45_desc +[] = "firmware-version"; + +329 +´og_ch¬ + + g©cmd45_h–p +[] = + +332 +´og_ch¬ + + g©cmd46_Çme +[] = "HV"; + +333 +´og_ch¬ + + g©cmd46_desc +[] = "hardware-version"; + +334 +´og_ch¬ + + g©cmd46_h–p +[] = + +337 +´og_ch¬ + + g©cmd47_Çme +[] = "CK"; + +338 +´og_ch¬ + + g©cmd47_desc +[] = "config-code"; + +339 +´og_ch¬ + + g©cmd47_h–p +[] = + +344 +´og_ch¬ + + g©cmd48_Çme +[] = "ER"; + +345 +´og_ch¬ + + g©cmd48_desc +[] = "rf-errors"; + +346 +´og_ch¬ + + g©cmd48_h–p +[] = + +350 +´og_ch¬ + + g©cmd49_Çme +[] = "GD"; + +351 +´og_ch¬ + + g©cmd49_desc +[] = "good-packets"; + +352 +´og_ch¬ + + g©cmd49_h–p +[] = + +356 +´og_ch¬ + + g©cmd50_Çme +[] = "RP"; + +357 +´og_ch¬ + + g©cmd50_desc +[] = "rssi-pwm-timer"; + +358 +´og_ch¬ + + g©cmd50_h–p +[] = + +363 +´og_ch¬ + + g©cmd51_Çme +[] = "TR"; + +364 +´og_ch¬ + + g©cmd51_desc +[] = "tx-errors"; + +365 +´og_ch¬ + + g©cmd51_h–p +[] = + +370 +´og_ch¬ + + g©cmd52_Çme +[] = "TP"; + +371 +´og_ch¬ + + g©cmd52_desc +[] = "temperature"; + +372 +´og_ch¬ + + g©cmd52_h–p +[] = + +377 +´og_ch¬ + + g©cmd53_Çme +[] = "DB"; + +378 +´og_ch¬ + + g©cmd53_desc +[] = "rx-signal-strength"; + +379 +´og_ch¬ + + g©cmd53_h–p +[] = + +385 +´og_ch¬ + + g©cmd54_Çme +[] = "DC"; + +386 +´og_ch¬ + + g©cmd54_desc +[] = "duty-cycle"; + +387 +´og_ch¬ + + g©cmd54_h–p +[] = + +392 +´og_ch¬ + + g©cmd55_Çme +[] = "RC"; + +393 +´og_ch¬ + + g©cmd55_desc +[] = "rssi-for-channel"; + +394 +´og_ch¬ + + g©cmd55_h–p +[] = + +398 +´og_ch¬ + + g©cmd56_Çme +[] = "R#"; + +399 +´og_ch¬ + + g©cmd56_desc +[] = "reset-number"; + +400 +´og_ch¬ + + g©cmd56_h–p +[] = + +405 +´og_ch¬ + + g©cmd57_Çme +[] = "TA"; + +406 +´og_ch¬ + + g©cmd57_desc +[] = "tx-ack-errors"; + +407 +´og_ch¬ + + g©cmd57_h–p +[] = + +411 +´og_ch¬ + + g©cmd58_Çme +[] = "%V"; + +412 +´og_ch¬ + + g©cmd58_desc +[] = "supply-voltage"; + +413 +´og_ch¬ + + g©cmd58_h–p +[] = + +416 +´og_ch¬ + + g©cmd59_Çme +[] = "CT"; + +417 +´og_ch¬ + + g©cmd59_desc +[] = "cmd-mode-timeout"; + +418 +´og_ch¬ + + g©cmd59_h–p +[] = + +424 +´og_ch¬ + + g©cmd60_Çme +[] = "CN"; + +425 +´og_ch¬ + + g©cmd60_desc +[] = "exit-cmd-mode"; + +426 +´og_ch¬ + + g©cmd60_h–p +[] = + +429 +´og_ch¬ + + g©cmd61_Çme +[] = "GT"; + +430 +´og_ch¬ + + g©cmd61_desc +[] = "guard-times"; + +431 +´og_ch¬ + + g©cmd61_h–p +[] = + +437 +´og_ch¬ + + g©cmd62_Çme +[] = "CC"; + +438 +´og_ch¬ + + g©cmd62_desc +[] = "command-chars"; + +439 +´og_ch¬ + + g©cmd62_h–p +[] = + +443 +´og_ch¬ + + g©cmd63_Çme +[] = "ID"; + +444 +´og_ch¬ + + g©cmd63_desc +[] = "network-id"; + +445 +´og_ch¬ + + g©cmd63_h–p +[] = + +449 +´og_ch¬ + + g©cmd64_Çme +[] = "NT"; + +450 +´og_ch¬ + + g©cmd64_desc +[] = "ndisc-timeout"; + +451 +´og_ch¬ + + g©cmd64_h–p +[] = + +456 +´og_ch¬ + + g©cmd65_Çme +[] = "NI"; + +457 +´og_ch¬ + + g©cmd65_desc +[] = "node-id"; + +458 +´og_ch¬ + + g©cmd65_h–p +[] = + +465 +´og_ch¬ + + g©cmd66_Çme +[] = "DN"; + +466 +´og_ch¬ + + g©cmd66_desc +[] = "disc-node"; + +467 +´og_ch¬ + + g©cmd66_h–p +[] = + +472 +´og_ch¬ + + g©cmd67_Çme +[] = "ND"; + +473 +´og_ch¬ + + g©cmd67_desc +[] = "network-discover"; + +474 +´og_ch¬ + + g©cmd67_h–p +[] = "Network Discovery, see doc"; + +476 +´og_ch¬ + + g©cmd68_Çme +[] = "NO"; + +477 +´og_ch¬ + + g©cmd68_desc +[] = "ndisc-options"; + +478 +´og_ch¬ + + g©cmd68_h–p +[] = + +484 +´og_ch¬ + + g©cmd69_Çme +[] = "EE"; + +485 +´og_ch¬ + + g©cmd69_desc +[] = "securityƒnable"; + +486 +´og_ch¬ + + g©cmd69_h–p +[] = + +490 +´og_ch¬ + + g©cmd70_Çme +[] = "KY"; ; + +491 +´og_ch¬ + + g©cmd70_desc +[] = "security-key"; + +492 +´og_ch¬ + + g©cmd70_h–p +[] = + +495 +´og_ch¬ + + g©cmd71_Çme +[] = "MT"; + +496 +´og_ch¬ + + g©cmd71_desc +[] = "bcast-multi-xmit"; + +497 +´og_ch¬ + + g©cmd71_h–p +[] = + +502 +´og_ch¬ + + g©cmd72_Çme +[] = "RR"; + +503 +´og_ch¬ + + g©cmd72_desc +[] = "unicast-retries"; + +504 +´og_ch¬ + + g©cmd72_h–p +[] = + +511 +´og_ch¬ + + g©cmd73_Çme +[] = "PL"; + +512 +´og_ch¬ + + g©cmd73_desc +[] = "power-level"; + +513 +´og_ch¬ + + g©cmd73_h–p +[] = + +517 +´og_ch¬ + + g©cmd74_Çme +[] = "SM"; + +518 +´og_ch¬ + + g©cmd74_desc +[] = "sleep-mode"; + +519 +´og_ch¬ + + g©cmd74_h–p +[] = + +524 +´og_ch¬ + + g©cmd75_Çme +[] = "SO"; + +525 +´og_ch¬ + + g©cmd75_desc +[] = "sleep-options"; + +526 +´og_ch¬ + + g©cmd75_h–p +[] = + +530 +´og_ch¬ + + g©cmd76_Çme +[] = "ST"; + +531 +´og_ch¬ + + g©cmd76_desc +[] = "wake-time"; + +532 +´og_ch¬ + + g©cmd76_h–p +[] = + +537 +´og_ch¬ + + g©cmd77_Çme +[] = "SP"; + +538 +´og_ch¬ + + g©cmd77_desc +[] = "sleep-period"; + +539 +´og_ch¬ + + g©cmd77_h–p +[] = + +547 +´og_ch¬ + + g©cmd78_Çme +[] = "SN"; + +548 +´og_ch¬ + + g©cmd78_desc +[] = "num-sleep-periods"; + +549 +´og_ch¬ + + g©cmd78_h–p +[] = + +554 +´og_ch¬ + + g©cmd79_Çme +[] = "WH"; + +555 +´og_ch¬ + + g©cmd79_desc +[] = "wake-host"; + +556 +´og_ch¬ + + g©cmd79_h–p +[] = "Wake Hostime. If it is seto‡‚on-zero value, it " + +563  +xb“_©cmd_pgm + + gxb“_©cmd_li¡ +[] = { + +566 +©cmd0_Çme +, + +567 +©cmd0_desc +, + +568 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +569 +©cmd0_h–p +, + +573 +©cmd1_Çme +, + +574 +©cmd1_desc +, + +575 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +576 +©cmd1_h–p +, + +580 +©cmd2_Çme +, + +581 +©cmd2_desc +, + +582 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +583 +©cmd2_h–p +, + +587 +©cmd3_Çme +, + +588 +©cmd3_desc +, + +589 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +590 +©cmd3_h–p +, + +594 +©cmd4_Çme +, + +595 +©cmd4_desc +, + +596 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +597 +©cmd4_h–p +, + +601 +©cmd5_Çme +, + +602 +©cmd5_desc +, + +603 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +604 +©cmd5_h–p +, + +608 +©cmd6_Çme +, + +609 +©cmd6_desc +, + +610 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +611 +©cmd6_h–p +, + +615 +©cmd7_Çme +, + +616 +©cmd7_desc +, + +617 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +618 +©cmd7_h–p +, + +622 +©cmd8_Çme +, + +623 +©cmd8_desc +, + +624 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ +, + +625 +©cmd8_h–p +, + +629 +©cmd9_Çme +, + +630 +©cmd9_desc +, + +631 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ +, + +632 +©cmd9_h–p +, + +636 +©cmd10_Çme +, + +637 +©cmd10_desc +, + +638 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ +, + +639 +©cmd10_h–p +, + +643 +©cmd11_Çme +, + +644 +©cmd11_desc +, + +645 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +646 +©cmd11_h–p +, + +650 +©cmd12_Çme +, + +651 +©cmd12_desc +, + +652 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +653 +©cmd12_h–p +, + +657 +©cmd13_Çme +, + +658 +©cmd13_desc +, + +659 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +660 +©cmd13_h–p +, + +664 +©cmd14_Çme +, + +665 +©cmd14_desc +, + +666 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +667 +©cmd14_h–p +, + +671 +©cmd15_Çme +, + +672 +©cmd15_desc +, + +673 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +674 +©cmd15_h–p +, + +678 +©cmd16_Çme +, + +679 +©cmd16_desc +, + +680 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +681 +©cmd16_h–p +, + +685 +©cmd17_Çme +, + +686 +©cmd17_desc +, + +687 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +688 +©cmd17_h–p +, + +692 +©cmd18_Çme +, + +693 +©cmd18_desc +, + +694 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +695 +©cmd18_h–p +, + +699 +©cmd19_Çme +, + +700 +©cmd19_desc +, + +701 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +702 +©cmd19_h–p +, + +706 +©cmd20_Çme +, + +707 +©cmd20_desc +, + +708 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +709 +©cmd20_h–p +, + +713 +©cmd21_Çme +, + +714 +©cmd21_desc +, + +715 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +716 +©cmd21_h–p +, + +720 +©cmd22_Çme +, + +721 +©cmd22_desc +, + +722 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +723 +©cmd22_h–p +, + +727 +©cmd23_Çme +, + +728 +©cmd23_desc +, + +729 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +730 +©cmd23_h–p +, + +734 +©cmd24_Çme +, + +735 +©cmd24_desc +, + +736 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +737 +©cmd24_h–p +, + +741 +©cmd25_Çme +, + +742 +©cmd25_desc +, + +743 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +744 +©cmd25_h–p +, + +748 +©cmd26_Çme +, + +749 +©cmd26_desc +, + +750 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +751 +©cmd26_h–p +, + +755 +©cmd27_Çme +, + +756 +©cmd27_desc +, + +757 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +758 +©cmd27_h–p +, + +762 +©cmd28_Çme +, + +763 +©cmd28_desc +, + +764 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +765 +©cmd28_h–p +, + +769 +©cmd29_Çme +, + +770 +©cmd29_desc +, + +771 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +772 +©cmd29_h–p +, + +776 +©cmd30_Çme +, + +777 +©cmd30_desc +, + +778 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +779 +©cmd30_h–p +, + +783 +©cmd31_Çme +, + +784 +©cmd31_desc +, + +785 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +786 +©cmd31_h–p +, + +790 +©cmd32_Çme +, + +791 +©cmd32_desc +, + +792 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +793 +©cmd32_h–p +, + +797 +©cmd33_Çme +, + +798 +©cmd33_desc +, + +799 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +800 +©cmd33_h–p +, + +804 +©cmd34_Çme +, + +805 +©cmd34_desc +, + +806 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +807 +©cmd34_h–p +, + +811 +©cmd35_Çme +, + +812 +©cmd35_desc +, + +813 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +814 +©cmd35_h–p +, + +818 +©cmd36_Çme +, + +819 +©cmd36_desc +, + +820 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +821 +©cmd36_h–p +, + +825 +©cmd37_Çme +, + +826 +©cmd37_desc +, + +827 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +828 +©cmd37_h–p +, + +832 +©cmd38_Çme +, + +833 +©cmd38_desc +, + +834 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +835 +©cmd38_h–p +, + +839 +©cmd39_Çme +, + +840 +©cmd39_desc +, + +841 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +842 +©cmd39_h–p +, + +846 +©cmd40_Çme +, + +847 +©cmd40_desc +, + +848 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +849 +©cmd40_h–p +, + +853 +©cmd41_Çme +, + +854 +©cmd41_desc +, + +855 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +856 +©cmd41_h–p +, + +860 +©cmd42_Çme +, + +861 +©cmd42_desc +, + +862 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +863 +©cmd42_h–p +, + +867 +©cmd43_Çme +, + +868 +©cmd43_desc +, + +869 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +870 +©cmd43_h–p +, + +874 +©cmd44_Çme +, + +875 +©cmd44_desc +, + +876 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +877 +©cmd44_h–p +, + +881 +©cmd45_Çme +, + +882 +©cmd45_desc +, + +883 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ +, + +884 +©cmd45_h–p +, + +888 +©cmd46_Çme +, + +889 +©cmd46_desc +, + +890 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +891 +©cmd46_h–p +, + +895 +©cmd47_Çme +, + +896 +©cmd47_desc +, + +897 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ +, + +898 +©cmd47_h–p +, + +902 +©cmd48_Çme +, + +903 +©cmd48_desc +, + +904 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +905 +©cmd48_h–p +, + +909 +©cmd49_Çme +, + +910 +©cmd49_desc +, + +911 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +912 +©cmd49_h–p +, + +916 +©cmd50_Çme +, + +917 +©cmd50_desc +, + +918 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +919 +©cmd50_h–p +, + +923 +©cmd51_Çme +, + +924 +©cmd51_desc +, + +925 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +926 +©cmd51_h–p +, + +930 +©cmd52_Çme +, + +931 +©cmd52_desc +, + +932 +XBEE_ATCMD_F_PARAM_S16 + | +XBEE_ATCMD_F_READ +, + +933 +©cmd52_h–p +, + +937 +©cmd53_Çme +, + +938 +©cmd53_desc +, + +939 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ +, + +940 +©cmd53_h–p +, + +944 +©cmd54_Çme +, + +945 +©cmd54_desc +, + +946 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ +, + +947 +©cmd54_h–p +, + +951 +©cmd55_Çme +, + +952 +©cmd55_desc +, + +953 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ +, + +954 +©cmd55_h–p +, + +958 +©cmd56_Çme +, + +959 +©cmd56_desc +, + +960 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ +, + +961 +©cmd56_h–p +, + +965 +©cmd57_Çme +, + +966 +©cmd57_desc +, + +967 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ +, + +968 +©cmd57_h–p +, + +972 +©cmd58_Çme +, + +973 +©cmd58_desc +, + +974 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ +, + +975 +©cmd58_h–p +, + +979 +©cmd59_Çme +, + +980 +©cmd59_desc +, + +981 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +982 +©cmd59_h–p +, + +986 +©cmd60_Çme +, + +987 +©cmd60_desc +, + +988 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +989 +©cmd60_h–p +, + +993 +©cmd61_Çme +, + +994 +©cmd61_desc +, + +995 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +996 +©cmd61_h–p +, + +1000 +©cmd62_Çme +, + +1001 +©cmd62_desc +, + +1002 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1003 +©cmd62_h–p +, + +1007 +©cmd63_Çme +, + +1008 +©cmd63_desc +, + +1009 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1010 +©cmd63_h–p +, + +1014 +©cmd64_Çme +, + +1015 +©cmd64_desc +, + +1016 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1017 +©cmd64_h–p +, + +1021 +©cmd65_Çme +, + +1022 +©cmd65_desc +, + +1023 +XBEE_ATCMD_F_PARAM_STRING_20B + | +XBEE_ATCMD_F_READ + | + +1024 +XBEE_ATCMD_F_WRITE +, + +1025 +©cmd65_h–p +, + +1029 +©cmd66_Çme +, + +1030 +©cmd66_desc +, + +1031 +XBEE_ATCMD_F_PARAM_STRING_20B + | +XBEE_ATCMD_F_READ + | + +1032 +XBEE_ATCMD_F_WRITE +, + +1033 +©cmd66_h–p +, + +1037 +©cmd67_Çme +, + +1038 +©cmd67_desc +, + +1039 +XBEE_ATCMD_F_PARAM_NONE + | +XBEE_ATCMD_F_WRITE +, + +1040 +©cmd67_h–p +, + +1044 +©cmd68_Çme +, + +1045 +©cmd68_desc +, + +1046 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1047 +©cmd68_h–p +, + +1051 +©cmd69_Çme +, + +1052 +©cmd69_desc +, + +1053 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1054 +©cmd69_h–p +, + +1058 +©cmd70_Çme +, + +1059 +©cmd70_desc +, + +1060 +XBEE_ATCMD_F_PARAM_HEXBUF_16B + | +XBEE_ATCMD_F_WRITE +, + +1061 +©cmd70_h–p +, + +1065 +©cmd71_Çme +, + +1066 +©cmd71_desc +, + +1067 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1068 +©cmd71_h–p +, + +1072 +©cmd72_Çme +, + +1073 +©cmd72_desc +, + +1074 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1075 +©cmd72_h–p +, + +1079 +©cmd73_Çme +, + +1080 +©cmd73_desc +, + +1081 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1082 +©cmd73_h–p +, + +1086 +©cmd74_Çme +, + +1087 +©cmd74_desc +, + +1088 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1089 +©cmd74_h–p +, + +1093 +©cmd75_Çme +, + +1094 +©cmd75_desc +, + +1095 +XBEE_ATCMD_F_PARAM_U8 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1096 +©cmd75_h–p +, + +1100 +©cmd76_Çme +, + +1101 +©cmd76_desc +, + +1102 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1103 +©cmd76_h–p +, + +1107 +©cmd77_Çme +, + +1108 +©cmd77_desc +, + +1109 +XBEE_ATCMD_F_PARAM_U32 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1110 +©cmd77_h–p +, + +1114 +©cmd78_Çme +, + +1115 +©cmd78_desc +, + +1116 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1117 +©cmd78_h–p +, + +1121 +©cmd79_Çme +, + +1122 +©cmd79_desc +, + +1123 +XBEE_ATCMD_F_PARAM_U16 + | +XBEE_ATCMD_F_READ + | +XBEE_ATCMD_F_WRITE +, + +1124 +©cmd79_h–p +, + +1127 +NULL +, + +1128 +NULL +, + +1130 +NULL +, + +1134  +xb“_©cmd_pgm + * + $xb“_©cmd_lookup_Çme +(cÚ¡ * +©cmd_¡r +) + +1136  +xb“_©cmd_pgm + * +cmd +; + +1137  +xb“_©cmd + +cÝy +; + +1139  +cmd + = & +xb“_©cmd_li¡ +[0], + `memýy_P +(& +cÝy +, cmd, (copy)); + +1140 +cÝy +. +Çme + !ð +NULL +; + +1141 +cmd +++, + `memýy_P +(& +cÝy +, cmd, (copy))) { + +1143 ià(! + `¡rcmp_P +( +©cmd_¡r +, +cÝy +. +Çme +)) + +1147 ià( +cÝy +. +Çme + =ð +NULL +) + +1148  +NULL +; + +1150  +cmd +; + +1151 + } +} + +1153  +xb“_©cmd_pgm + * + $xb“_©cmd_lookup_desc +(cÚ¡ * +desc +) + +1155  +xb“_©cmd_pgm + * +cmd +; + +1156  +xb“_©cmd + +cÝy +; + +1158  +cmd + = & +xb“_©cmd_li¡ +[0], + `memýy_P +(& +cÝy +, cmd, (copy)); + +1159 +cÝy +. +Çme + !ð +NULL +; + +1160 +cmd +++, + `memýy_P +(& +cÝy +, cmd, (copy))) { + +1161 ià(! + `¡rcmp_P +( +desc +, +cÝy +.desc)) + +1164 ià( +cÝy +. +Çme + =ð +NULL +) + +1165  +NULL +; + +1167  +cmd +; + +1168 + } +} + + @xbee_atcmd.h + +28 #iâdeà +_XBEE_ATCMD_H_ + + +29  + #_XBEE_ATCMD_H_ + + + ) + +31  + #XBEE_ATCMD_F_READ + 0x001 + + ) + +32  + #XBEE_ATCMD_F_WRITE + 0x002 + + ) + +33  + #XBEE_ATCMD_F_PARAM_NONE + 0x004 + + ) + +34  + #XBEE_ATCMD_F_PARAM_U8 + 0x008 + + ) + +35  + #XBEE_ATCMD_F_PARAM_U16 + 0x010 + + ) + +36  + #XBEE_ATCMD_F_PARAM_S16 + 0x020 + + ) + +37  + #XBEE_ATCMD_F_PARAM_U32 + 0x040 + + ) + +38  + #XBEE_ATCMD_F_PARAM_STRING_20B + 0x080 + + ) + +39  + #XBEE_ATCMD_F_PARAM_HEXBUF_16B + 0x100 + + ) + +42  + sxb“_©cmd + { + +43 +´og_ch¬ + * + mÇme +; + +44 +´og_ch¬ + * + mdesc +; + +45  + mæags +; + +46 +´og_ch¬ + * + mh–p +; + +49  + sxb“_©cmd_pgm + { + +50 +´og_ch¬ + * + mÇme +; + +51 +´og_ch¬ + * + mdesc +; + +52  + mæags +; + +53 +´og_ch¬ + * + mh–p +; + +54 } + gPROGMEM +; + +56  +xb“_©cmd_pgm + +xb“_©cmd_li¡ +[]; + +58  +xb“_©cmd_pgm + * +xb“_©cmd_lookup_Çme +(cÚ¡ * +©cmd_¡r +); + +59  +xb“_©cmd_pgm + * +xb“_©cmd_lookup_desc +(cÚ¡ * +desc +); + + @xbee_buf.c + +28  + ~<¡ršg.h +> + +29  + ~<¡dlib.h +> + +30  + ~<¡dšt.h +> + +31  + ~ + +33  + ~"xb“_ÃighbÜ.h +" + +34  + ~"xb“_¡©s.h +" + +35  + ~"xb“_buf.h +" + +36  + ~"xb“.h +" + +38  +xb“_buf + * + $xb“_buf_®loc +() + +40  +xb“_buf + * +xbuf +; + +42 +xbuf + = + `m®loc +((*xbuf)); + +43 ià( +xbuf + =ð +NULL +) + +44  +NULL +; + +45 + `mem£t +( +xbuf +, 0, (*xbuf)); + +46 +xbuf +-> +off£t + = 0; + +47 +xbuf +-> +Ën + = 0; + +48  +xbuf +; + +49 + } +} + +51  + $xb“_buf_žroom +( +xb“_buf + * +xbuf +) + +53  +XBEE_BUF_SIZE + - +xbuf +-> +Ën + - xbuf-> +off£t +; + +54 + } +} + +56 * + $xb“_buf_d©a +( +xb“_buf + * +xbuf +,  +off +) + +58 ià( +off + >ð +xbuf +-> +Ën +) + +59  +NULL +; + +60  +xbuf +-> +buf + + xbuf-> +off£t + + +off +; + +61 + } +} + +63 * + $xb“_buf_h—d +( +xb“_buf + * +xbuf +) + +65  +xbuf +-> +buf + + xbuf-> +off£t +; + +66 + } +} + +68 * + $xb“_buf_ž +( +xb“_buf + * +xbuf +) + +70  +xbuf +-> +buf + + xbuf-> +off£t + + xbuf-> +Ën +; + +71 + } +} + +73  + $xb“_buf_’queue +( +xb“_bufq + * +q +,  +xb“_buf + * +xbuf +) + +75 + `CIRCLEQ_INSERT_TAIL +(& +q +-> +xbq +, +xbuf +, +Ãxt +); + +76 +q +-> +Ën + +ð +xbuf +->len; + +77 +q +-> +n£g +++; + +78 + } +} + +80  +xb“_buf + * + $xb“_bufq_Ï¡ +( +xb“_bufq + * +q +) + +82 ià( + `CIRCLEQ_EMPTY +(& +q +-> +xbq +)) + +83  +NULL +; + +84  + `CIRCLEQ_LAST +(& +q +-> +xbq +); + +85 + } +} + +87  + $xb“_bufq_š™ +( +xb“_bufq + * +q +) + +89 + `CIRCLEQ_INIT +(& +q +-> +xbq +); + +90 +q +-> +Ën + = 0; + +91 +q +-> +n£g + = 0; + +92 + } +} + +94  + $xb“_bufq_­³nd +( +xb“_bufq + * +q +,  +Ën +) + +96  +xb“_buf + * +xbuf +; + +98 +q +-> +Ën + +=†en; + +99 +xbuf + = + `CIRCLEQ_LAST +(& +q +-> +xbq +); + +100 +xbuf +-> +Ën + +=†en; + +101 + } +} + +103  + $xb“_bufq_æush +( +xb“_bufq + * +q +) + +105  +xb“_buf + * +xbuf +; + +107 ! + `CIRCLEQ_EMPTY +(& +q +-> +xbq +)) { + +108 +xbuf + = + `CIRCLEQ_FIRST +(& +q +-> +xbq +); + +109 + `CIRCLEQ_REMOVE +(& +q +-> +xbq +, +xbuf +, +Ãxt +); + +110 +q +-> +n£g + --; + +111 +q +-> +Ën + -ð +xbuf +->len; + +112 + `ä“ +( +xbuf +); + +114 + } +} + +116 * + $xb“_bufq_d©a +( +xb“_bufq + * +q +,  +off +) + +118  +xb“_buf + * +xbuf +; + +119 * +d©a + = +NULL +; + +121 ià( +off + >ð +q +-> +Ën +) + +122  +NULL +; + +124 + `CIRCLEQ_FOREACH +( +xbuf +, & +q +-> +xbq +, +Ãxt +) { + +125 +d©a + = + `xb“_buf_d©a +( +xbuf +, +off +); + +126 ià( +d©a + !ð +NULL +) + +127  +d©a +; + +128 +off + -ð +xbuf +-> +Ën +; + +131  +d©a +; + +132 + } +} + +135  + $xb“_bufq_drÝ +( +xb“_bufq + * +q +,  +Ën +) + +137  +xb“_buf + * +xbuf +; + +139 ià( +Ën + > +q +->len) + +142 ! + `CIRCLEQ_EMPTY +(& +q +-> +xbq +)) { + +143 +xbuf + = + `CIRCLEQ_FIRST +(& +q +-> +xbq +); + +144 ià( +xbuf +-> +Ën + >†en) + +146 + `CIRCLEQ_REMOVE +(& +q +-> +xbq +, +xbuf +, +Ãxt +); + +147 +Ën + -ð +xbuf +->len; + +148 +q +-> +n£g + --; + +149 +q +-> +Ën + -ð +xbuf +->len; + +150 + `ä“ +( +xbuf +); + +151 +xbuf + = +NULL +; + +154 ià( +xbuf + !ð +NULL +) { + +155 +xbuf +-> +Ën + -=†en; + +156 +xbuf +-> +off£t + +ð +Ën +; + +157 +q +-> +Ën + -=†en; + +161 + } +} + +163  + $xb“_bufq_cÝy +( +xb“_bufq + * +q +, * +buf +,  +Ën +) + +165  +xb“_buf + * +xbuf +; + +166  +d¡off + = 0, +cÝyËn +; + +168 ià( +Ën + > +q +->len) + +171 + `CIRCLEQ_FOREACH +( +xbuf +, & +q +-> +xbq +, +Ãxt +) { + +172 +cÝyËn + = +Ën +; + +173 ià( +xbuf +-> +Ën + <†en) + +174 +cÝyËn + = +xbuf +-> +Ën +; + +175 + `memýy +( +buf + + +d¡off +, +xbuf +->buà+ xbuf-> +off£t +, +cÝyËn +); + +176 +Ën + -ð +cÝyËn +; + +177 ià( +Ën + == 0) + +179 +d¡off + +ð +cÝyËn +; + +183 + } +} + + @xbee_buf.h + +28  + #XBEE_BUF_SIZE + 0x200 + + ) + +31  + sxb“_buf + { + +32 +CIRCLEQ_ENTRY +( +xb“_buf +è + mÃxt +; + +33  + moff£t +; + +34  + mËn +; + +35  + mbuf +[ +XBEE_BUF_SIZE +]; + +39 +CIRCLEQ_HEAD +( +xbufq +, +xb“_buf +); + +41  + sxb“_bufq + { + +42  +xbufq + + mxbq +; + +43  + mËn +; + +44  + mn£g +; + +48  +xb“_buf + * +xb“_buf_®loc +(); + +51  +xb“_buf_žroom +( +xb“_buf + * +xbuf +); + +54 * +xb“_buf_d©a +( +xb“_buf + * +xbuf +,  +off +); + +57 * +xb“_buf_h—d +( +xb“_buf + * +xbuf +); + +60 * +xb“_buf_ž +( +xb“_buf + * +xbuf +); + +63  +xb“_buf_’queue +( +xb“_bufq + * +q +,  +xb“_buf + * +xbuf +); + +68  +xb“_buf + * +xb“_bufq_Ï¡ +( +xb“_bufq + * +q +); + +71  +xb“_bufq_š™ +( +xb“_bufq + * +q +); + +74  +xb“_bufq_æush +( +xb“_bufq + * +q +); + +77  +xb“_bufq_­³nd +( +xb“_bufq + * +q +,  +Ën +); + +80 * +xb“_bufq_d©a +( +xb“_bufq + * +q +,  +off +); + +83  +xb“_bufq_drÝ +( +xb“_bufq + * +q +,  +Ën +); + +86  +xb“_bufq_cÝy +( +xb“_bufq + * +q +, * +buf +,  +Ën +); + + @xbee_neighbor.c + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~<¡ršg.h +> + +33  + ~<¡dšt.h +> + +34  + ~<¡dlib.h +> + +35  + ~<¡dio.h +> + +37  + ~"xb“_ÃighbÜ.h +" + +38  + ~"xb“_©cmd.h +" + +39  + ~"xb“_¡©s.h +" + +40  + ~"xb“_buf.h +" + +41  + ~"xb“_´Ùo.h +" + +42  + ~"xb“.h +" + +44  + $xb“_Ãigh_š™ +( +xb“_dev + * +dev +) + +46 + `LIST_INIT +(& +dev +-> +Ãigh_li¡ +); + +47 + } +} + +49  +xb“_Ãigh + * + $xb“_Ãigh_lookup +( +xb“_dev + * +dev +, cÚ¡ * +Çme +) + +51  +xb“_Ãigh + * +Ãigh +; + +53 + `LIST_FOREACH +( +Ãigh +, & +dev +-> +Ãigh_li¡ +, +Ãxt +) { + +54 ià(! + `¡rcmp +( +Çme +, +Ãigh +->name)) + +58  +Ãigh +; + +59 + } +} + +61  +xb“_Ãigh + * + $xb“_Ãigh_¾ookup +( +xb“_dev + * +dev +, +ušt64_t + +addr +) + +63  +xb“_Ãigh + * +Ãigh +; + +65 + `LIST_FOREACH +( +Ãigh +, & +dev +-> +Ãigh_li¡ +, +Ãxt +) { + +66 ià( +addr + =ð +Ãigh +->addr) + +70  +Ãigh +; + +71 + } +} + +73  +xb“_Ãigh + * + $xb“_Ãigh_add +( +xb“_dev + * +dev +, cÚ¡ * +Çme +, + +74 +ušt64_t + +addr +) + +76  +xb“_Ãigh + * +Ãigh +; + +78 ià( + `xb“_Ãigh_¾ookup +( +dev +, +addr +è!ð +NULL +) + +79  +NULL +; + +81 ià( + `xb“_Ãigh_lookup +( +dev +, +Çme +è!ð +NULL +) + +82  +NULL +; + +84 +Ãigh + = + `m®loc +((*neigh)); + +85 ià( +Ãigh + =ð +NULL +) + +86  +NULL +; + +88 +Ãigh +-> +addr + =‡ddr; + +89 + `¢´štf +( +Ãigh +-> +Çme +, (neigh->name), "%s",‚ame); + +90 + `LIST_INSERT_HEAD +(& +dev +-> +Ãigh_li¡ +, +Ãigh +, +Ãxt +); + +92  +Ãigh +; + +93 + } +} + +95  + $xb“_Ãigh_d– +( +xb“_dev + * +dev +,  +xb“_Ãigh + * +Ãigh +) + +97 +dev + = dev; + +98 + `LIST_REMOVE +( +Ãigh +, +Ãxt +); + +99 + `ä“ +( +Ãigh +); + +100 + } +} + + @xbee_neighbor.h + +28 #iâdeà +_XBEE_NEIGHBOR_H_ + + +29  + #_XBEE_NEIGHBOR_H_ + + + ) + +31  + sxb“_Ãigh + { + +32 +LIST_ENTRY +( +xb“_Ãigh +è + mÃxt +; + +33  + mÇme +[21]; + +34 +ušt64_t + + maddr +; + +37  + gxb“_dev +; + +40 +LIST_HEAD +( +xb“_Ãigh_li¡ +, +xb“_Ãigh +); + +43  +xb“_Ãigh_š™ +( +xb“_dev + * +dev +); + +46  +xb“_Ãigh + * +xb“_Ãigh_lookup +( +xb“_dev + * +dev +, cÚ¡ * +Çme +); + +49  +xb“_Ãigh + * +xb“_Ãigh_¾ookup +( +xb“_dev + * +dev +, +ušt64_t + +addr +); + +52  +xb“_Ãigh + * +xb“_Ãigh_add +( +xb“_dev + * +dev +, cÚ¡ * +Çme +, + +53 +ušt64_t + +addr +); + +56  +xb“_Ãigh_d– +( +xb“_dev + * +dev +,  +xb“_Ãigh + * +Ãigh +); + + @xbee_proto.c + +28  + ~ + +29  + ~ + +30  + ~ + +32  + ~ + +34  + ~<¡dio.h +> + +35  + ~<¡dlib.h +> + +36  + ~<¡dšt.h +> + +37  + ~<¡ršg.h +> + +38  + ~<ùy³.h +> + +40  + ~"xb“_ÃighbÜ.h +" + +41  + ~"xb“_¡©s.h +" + +42  + ~"xb“_buf.h +" + +43  + ~"xb“_´Ùo.h +" + +44  + ~"xb“.h +" + +47  + $xb“_´Ùo_·r£_©»¥ +( +xb“_dev + * +dev +, * +buf +, + +48  +Ën +) + +50  +xb“_©»¥_hdr + * +©»¥_hdr +; + +52 +dev +-> +¡©s +. +rx_©»¥ +++; + +54 ià( +Ën + < ( +xb“_hdr +è+ ( +xb“_©»¥_hdr +)) { + +55 +dev +-> +¡©s +. +rx_äame_too_sm®l +++; + +59 +©»¥_hdr + = +buf + + ( +xb“_hdr +); + +62 ià( +©»¥_hdr +-> +¡©us + != 0) + +63 +dev +-> +¡©s +. +rx_©»¥_”rÜ +++; + +66 + } +} + +69  + $xb“_´Ùo_·r£_rmt_©»¥ +( +xb“_dev + * +dev +, * +buf +, + +70  +Ën +) + +72  +xb“_rmt_©»¥_hdr + * +rmt_©»¥_hdr +; + +74 +dev +-> +¡©s +. +rx_rmt_©»¥ +++; + +76 ià( +Ën + < ( +xb“_hdr +è+ ( +xb“_rmt_©»¥_hdr +)) { + +77 +dev +-> +¡©s +. +rx_äame_too_sm®l +++; + +81 +rmt_©»¥_hdr + = +buf + + ( +xb“_hdr +); + +84 ià( +rmt_©»¥_hdr +-> +¡©us + != 0) + +85 +dev +-> +¡©s +. +rx_rmt_©»¥_”rÜ +++; + +88 + } +} + +91  + $xb“_´Ùo_·r£_xm™_¡©us +( +xb“_dev + * +dev +, * +buf +, + +92  +Ën +) + +94  +xb“_xm™_¡©us_hdr + * +xm™_¡©us_hdr +; + +96 +dev +-> +¡©s +. +rx_xm™_¡©us +++; + +98 ià( +Ën + < ( +xb“_hdr +è+ ( +xb“_xm™_¡©us_hdr +)) { + +99 +dev +-> +¡©s +. +rx_äame_too_sm®l +++; + +103 +xm™_¡©us_hdr + = +buf + + ( +xb“_hdr +); + +104 +dev +-> +¡©s +. +tx_xm™_»Œ›s + +ð +xm™_¡©us_hdr +-> +xm™_»Œy_út +; + +107 ià( +xm™_¡©us_hdr +-> +d–iv”y_¡©us + != 0) + +108 +dev +-> +¡©s +. +rx_xm™_¡©us_”rÜ +++; + +111 + } +} + +115  + $xb“_´Ùo_·r£_äame +( +xb“_dev + * +dev +) + +117 * +buf + = +dev +-> +äame +; + +118 +ušt8_t + +Ën + = +dev +-> +äame_Ën +; + +119  +xb“_hdr + * +hdr + = +buf +; + +120  +i +; + +121 +ušt8_t + +cksum + = 0; + +122  +chªÃl + = +XBEE_DEFAULT_CHANNEL +; + +124 +dev +-> +¡©s +. +rx_äame +++; + +127 ià( +Ën + < ((* +hdr +) + 1)) { + +128 +dev +-> +¡©s +. +rx_äame_too_sm®l +++; + +129 + `årštf +( +¡d”r +, "Frameoo small\n"); + +134  +i + = 3; i < ( +Ën + - 1); i++) + +135 +cksum + +ð(( +ušt8_t + *) +buf +)[ +i +]; + +136 +cksum + = 0xff - cksum; + +137 ià( +cksum + !ð(( +ušt8_t + *) +buf +)[ +Ën +-1]) { + +138 + `årštf +( +¡d”r +, "Invalid cksum\n"); + +139 +dev +-> +¡©s +. +rx_šv®id_cksum +++; + +144  +hdr +-> +ty³ +) { + +145  +XBEE_TYPE_MODEM_STATUS +: + +146 +dev +-> +¡©s +. +rx_modem_¡©us +++; + +147 +chªÃl + = +XBEE_DEFAULT_CHANNEL +; + +149  +XBEE_TYPE_ATRESP +: + +150 ià( + `xb“_´Ùo_·r£_©»¥ +( +dev +, +buf +, +Ën +) < 0) + +152 +chªÃl + = +hdr +-> +id +; + +154  +XBEE_TYPE_RMT_ATRESP +: + +155 ià( + `xb“_´Ùo_·r£_rmt_©»¥ +( +dev +, +buf +, +Ën +) < 0) + +157 +chªÃl + = +hdr +-> +id +; + +159  +XBEE_TYPE_XMIT_STATUS +: + +160 ià( + `xb“_´Ùo_·r£_xm™_¡©us +( +dev +, +buf +, +Ën +) < 0) + +162 +chªÃl + = +hdr +-> +id +; + +164  +XBEE_TYPE_RECV +: + +165 +dev +-> +¡©s +. +rx_d©a +++; + +166 +chªÃl + = +XBEE_DEFAULT_CHANNEL +; + +168  +XBEE_TYPE_EXPL_RECV +: + +169 +dev +-> +¡©s +. +rx_ex¶_d©a +++; + +170 +chªÃl + = +XBEE_DEFAULT_CHANNEL +; + +172  +XBEE_TYPE_NODE_ID +: + +173 +dev +-> +¡©s +. +rx_node_id +++; + +174 +chªÃl + = +hdr +-> +id +; + +177  +XBEE_TYPE_ATCMD +: + +178  +XBEE_TYPE_ATCMD_Q +: + +179  +XBEE_TYPE_XMIT +: + +180  +XBEE_TYPE_EXPL_XMIT +: + +181  +XBEE_TYPE_RMT_ATCMD +: + +183 +dev +-> +¡©s +. +rx_šv®id_ty³ +++; + +188 ià( +chªÃl + < 0 || chªÃÈ>ð +XBEE_MAX_CHANNEL + || + +189 +dev +-> +chªÃl +[chªÃl]. +»gi¡”ed + == 0) + +190 +chªÃl + = +XBEE_DEFAULT_CHANNEL +; + +193 ià( +dev +-> +chªÃl +[chªÃl]. +rx_cb + !ð +NULL +) + +194 +dev +-> +chªÃl +[chªÃl]. + `rx_cb +(dev, chªÃl, +hdr +-> +ty³ +, + +195 +buf + + ( +xb“_hdr +), + +196 +Ën + - ( +xb“_hdr +) - 1, + +197 +dev +-> +chªÃl +[chªÃl]. +¬g +); + +200 + } +} + +202  + $xb“_´Ùo_xm™ +( +xb“_dev + * +dev +, +ušt8_t + +chªÃl_id +, ušt8_ˆ +ty³ +, + +203 * +buf +,  +Ën +) + +205  +xb“_hdr + +hdr +; + +206  +i +; + +207 +ušt8_t + +cksum + = 0; + +210 ià( +Ën + == 0) + +215 +hdr +. +d–im™” + = +XBEE_DELIMITER +; + +216 +hdr +. +Ën + = + `htÚs +(len + 2); + +217 +hdr +. +ty³ + =ype; + +218 +hdr +. +id + = +chªÃl_id +; + +220 ià( +chªÃl_id + < 0 || chªÃl_id >ð +XBEE_MAX_CHANNEL + || + +221 +dev +-> +chªÃl +[ +chªÃl_id +]. +»gi¡”ed + == 0) { + +222 +dev +-> +¡©s +. +tx_šv®id_chªÃl + ++; + +227 +cksum + = +hdr +. +ty³ +; + +228 +cksum + +ð +hdr +. +id +; + +229  +i + = 0; i < +Ën +; i++) + +230 +cksum + +ð(( +ušt8_t + *) +buf +)[ +i +]; + +231 +cksum + = 0xff - cksum; + +232 +dev +-> +¡©s +. +tx_äame + ++; + +235  +hdr +. +ty³ +) { + +237  +XBEE_TYPE_ATCMD +: + +239 +dev +-> +¡©s +. +tx_©cmd + ++; + +241  +XBEE_TYPE_ATCMD_Q +: + +242 +dev +-> +¡©s +. +tx_©cmd_q + ++; + +244  +XBEE_TYPE_XMIT +: + +245 +dev +-> +¡©s +. +tx_d©a + ++; + +247  +XBEE_TYPE_EXPL_XMIT +: + +248 +dev +-> +¡©s +. +tx_ex¶_d©a + ++; + +250  +XBEE_TYPE_RMT_ATCMD +: + +251 +dev +-> +¡©s +. +tx_rmt_©cmd + ++; + +255  +XBEE_TYPE_XMIT_STATUS +: + +256  +XBEE_TYPE_MODEM_STATUS +: + +257  +XBEE_TYPE_ATRESP +: + +258  +XBEE_TYPE_RECV +: + +259  +XBEE_TYPE_EXPL_RECV +: + +260  +XBEE_TYPE_NODE_ID +: + +261  +XBEE_TYPE_RMT_ATRESP +: + +263 +dev +-> +¡©s +. +tx_šv®id_ty³ + ++; + +264 + `årštf +( +¡d”r +, "unhªdËd xm™y³=%x\n", +hdr +. +ty³ +); + +269 + `fwr™e +(( +ušt8_t + *)& +hdr + + +i +, 1, (hdr), +dev +-> +fže +); + +270 + `fwr™e +(( +ušt8_t + *) +buf + + +i +, 1, +Ën +, +dev +-> +fže +); + +271 + `fwr™e +(& +cksum +, 1, 1, +dev +-> +fže +); + +274 + } +} + +276  + $xb“_´Ùo_rx +( +xb“_dev + * +dev +) + +278 +ušt8_t + +äam–’ +; + +279  +xb“_hdr + * +hdr + = (xb“_hd¸*) +dev +-> +äame +; + +280  +c +; + +285 +c + = + `fg‘c +( +dev +-> +fže +); + +286 ià( +c + =ð +EOF +) + +288 + `´štf +("»ûived ch¬ %X\r\n", +c +); + +291 ià( +dev +-> +äame_Ën + >ð +XBEE_MAX_FRAME_LEN +) { + +292 +dev +-> +äame_Ën + = 0; + +296 +dev +-> +äame +[dev-> +äame_Ën +++] = +c +; + +299 ià( +dev +-> +äame_Ën + < (* +hdr +)) + +302 +äam–’ + = + `Áohs +( +hdr +-> +Ën +); + +303 +äam–’ + += 4; + +306 ià( +dev +-> +äame_Ën + < +äam–’ +) + +308 + `´štf +("frame ok!\r\n"); + +309 ià( + `xb“_´Ùo_·r£_äame +( +dev +) < 0) + +311 +dev +-> +äame_Ën + = 0; + +313 + } +} + + @xbee_proto.h + +30  + #XBEE_DELIMITER + 0x7E + + ) + +31  + #XBEE_MAX_FRAME_LEN + 0x200 + + ) + +33  + sxb“_hdr + { + +34 +ušt8_t + + md–im™” +; + +35 +ušt16_t + + mËn +; + +36 +ušt8_t + + mty³ +; + +37 +ušt8_t + + mid +; + +38 } +__©Œibu‹__ +(( +·cked +)); + +40  + #XBEE_TYPE_ATCMD + 0x08 + + ) + +41  + sxb“_©cmd_hdr + { + +42 +ušt16_t + + mcmd +; + +43 +ušt8_t + + m·¿ms +[]; + +44 } +__©Œibu‹__ +(( +·cked +)); + +46  + #XBEE_TYPE_ATCMD_Q + 0x09 + + ) + +47  + sxb“_©cmd_q_hdr + { + +48 +ušt16_t + + mcmd +; + +49 +ušt8_t + + m·¿ms +[]; + +50 } +__©Œibu‹__ +(( +·cked +)); + +52  + #XBEE_TYPE_XMIT + 0x10 + + ) + +53  + sxb“_xm™_hdr + { + +54 +ušt64_t + + md¡addr +; + +55 +ušt16_t + + m»£rved +; + +56 +ušt8_t + + mbÿ¡_¿dius +; + +57 +ušt8_t + + mÝts +; + +58 +ušt8_t + + md©a +[]; + +59 } +__©Œibu‹__ +(( +·cked +)); + +61  + #XBEE_TYPE_EXPL_XMIT + 0x11 + + ) + +62  + sxb“_ex¶_xm™_hdr + { + +63 +ušt64_t + + md¡addr +; + +64 +ušt16_t + + m»£rved +; + +65 +ušt8_t + + m¤c_’dpošt +; + +66 +ušt8_t + + md¡_’dpošt +; + +67 +ušt16_t + + mþu¡”_id +; + +68 +ušt16_t + + m´ofže_id +; + +69 +ušt8_t + + mbÿ¡_¿dius +; + +70 +ušt8_t + + mÝts +; + +71 +ušt8_t + + md©a +[]; + +72 } +__©Œibu‹__ +(( +·cked +)); + +74  + #XBEE_TYPE_RMT_ATCMD + 0x17 + + ) + +75  + sxb“_rmt_©cmd_hdr + { + +76 +ušt64_t + + md¡addr +; + +77 +ušt16_t + + m»£rved +; + +78 +ušt8_t + + mÝts +; + +79 +ušt16_t + + mcmd +; + +80 +ušt8_t + + m·¿ms +[]; + +81 } +__©Œibu‹__ +(( +·cked +)); + +83  + #XBEE_TYPE_ATRESP + 0x88 + + ) + +84  + sxb“_©»¥_hdr + { + +85 +ušt16_t + + mcmd +; + +86 +ušt8_t + + m¡©us +; + +87 +ušt8_t + + md©a +[]; + +88 } +__©Œibu‹__ +(( +·cked +)); + +90  + #XBEE_TYPE_MODEM_STATUS + 0x8A + + ) + +91  + sxb“_modem_¡©us_hdr + { + +93 } +__©Œibu‹__ +(( +·cked +)); + +95  + #XBEE_TYPE_XMIT_STATUS + 0x8B + + ) + +96  + sxb“_xm™_¡©us_hdr + { + +97 +ušt16_t + + m»£rved +; + +98 +ušt8_t + + mxm™_»Œy_út +; + +99 +ušt8_t + + md–iv”y_¡©us +; + +100 +ušt8_t + + mdiscov”y_¡©us +; + +101 } +__©Œibu‹__ +(( +·cked +)); + +103  + #XBEE_TYPE_RECV + 0x90 + + ) + +104  + sxb“_»cv_hdr + { + +105 +ušt64_t + + m¤ÿddr +; + +106 +ušt16_t + + m»£rved +; + +107 +ušt8_t + + mÝts +; + +108 +ušt8_t + + md©a +[]; + +109 } +__©Œibu‹__ +(( +·cked +)); + +111  + #XBEE_TYPE_EXPL_RECV + 0x91 + + ) + +112  + sxb“_ex¶_»cv_hdr + { + +113 +ušt64_t + + m¤ÿddr +; + +114 +ušt16_t + + m»£rved +; + +115 +ušt8_t + + m¤c_’dpošt +; + +116 +ušt8_t + + md¡_’dpošt +; + +117 +ušt16_t + + mþu¡”_id +; + +118 +ušt16_t + + m´ofže_id +; + +119 +ušt8_t + + mÝts +; + +120 +ušt8_t + + md©a +[]; + +121 } +__©Œibu‹__ +(( +·cked +)); + +123  + #XBEE_TYPE_NODE_ID + 0x95 + + ) + +124  + sxb“_node_id_hdr + { + +125 +ušt64_t + + m¤ÿddr +; + +126 +ušt16_t + + m¤ú‘wÜk +; + +127 +ušt8_t + + mÝts +; + +128 +ušt16_t + + md¡ÃtwÜk +; + +129 +ušt64_t + + md¡addr +; + +130 +ušt8_t + + mni_¡ršg +[]; + +132 } +__©Œibu‹__ +(( +·cked +)); + +134  + #XBEE_TYPE_RMT_ATRESP + 0x97 + + ) + +135  + sxb“_rmt_©»¥_hdr + { + +136 +ušt64_t + + m¤ÿddr +; + +137 +ušt16_t + + m»£rved +; + +138 +ušt16_t + + mcmd +; + +139 +ušt8_t + + m¡©us +; + +140 +ušt8_t + + md©a +[]; + +141 } +__©Œibu‹__ +(( +·cked +)); + +143  + gxb“_dev +; + +146  +xb“_´Ùo_g‘_äame +( +xb“_dev + * +dev +, * +buf +,  +Ën +); + +149  +xb“_´Ùo_xm™ +( +xb“_dev + * +dev +, +ušt8_t + +id +, ušt8_ˆ +ty³ +, + +150 * +buf +,  +Ën +); + +152  +xb“_´Ùo_rx +( +xb“_dev + * +dev +); + + @xbee_stats.c + +28  + ~ + +29  + ~ + +31  + ~<¡ršg.h +> + +32  + ~<¡dio.h +> + +33  + ~<¡dlib.h +> + +34  + ~<¡dšt.h +> + +36  + ~"xb“_ÃighbÜ.h +" + +37  + ~"xb“_¡©s.h +" + +38  + ~"xb“_´Ùo.h +" + +39  + ~"xb“_buf.h +" + +40  + ~"xb“.h +" + +42  +xb“_¡©s + * + $xb“_g‘_¡©s +( +xb“_dev + * +dev +) + +44  & +dev +-> +¡©s +; + +45 + } +} + +47  + $xb“_»£t_¡©s +( +xb“_dev + * +dev +) + +49 + `mem£t +(& +dev +-> +¡©s +, 0, (dev->stats)); + +50 + } +} + +53  + $xb“_dump_¡©s +( +xb“_dev + * +dev +) + +55 + `´štf +("¡©i¡ic Ú xb“_dev %p:\n", +dev +); + +56 + `´štf +("„x_äame: %d\n", +dev +-> +¡©s +. +rx_äame +); + +57 + `´štf +("„x_©»¥: %d\n", +dev +-> +¡©s +. +rx_©»¥ +); + +58 + `´štf +("„x_©»¥_”rÜ: %d\n", +dev +-> +¡©s +. +rx_©»¥_”rÜ +); + +59 + `´štf +("„x_modem_¡©us: %d\n", +dev +-> +¡©s +. +rx_modem_¡©us +); + +60 + `´štf +("„x_xm™_¡©us: %d\n", +dev +-> +¡©s +. +rx_xm™_¡©us +); + +61 + `´štf +("„x_xm™_¡©us_”rÜ: %d\n", +dev +-> +¡©s +. +rx_xm™_¡©us_”rÜ +); + +62 + `´štf +("„x_d©a: %d\n", +dev +-> +¡©s +. +rx_d©a +); + +63 + `´štf +("„x_ex¶_d©a: %d\n", +dev +-> +¡©s +. +rx_ex¶_d©a +); + +64 + `´štf +("„x_node_id: %d\n", +dev +-> +¡©s +. +rx_node_id +); + +65 + `´štf +("„x_rmt_©»¥: %d\n", +dev +-> +¡©s +. +rx_rmt_©»¥ +); + +66 + `´štf +("„x_rmt_©»¥_”rÜ: %d\n", +dev +-> +¡©s +. +rx_rmt_©»¥_”rÜ +); + +67 + `´štf +("„x_äame_too_sm®l: %d\n", +dev +-> +¡©s +. +rx_äame_too_sm®l +); + +68 + `´štf +("„x_äame_too_Ïrge: %d\n", +dev +-> +¡©s +. +rx_äame_too_Ïrge +); + +69 + `´štf +("„x_šv®id_cksum: %d\n", +dev +-> +¡©s +. +rx_šv®id_cksum +); + +70 + `´štf +("„x_šv®id_ty³: %d\n", +dev +-> +¡©s +. +rx_šv®id_ty³ +); + +71 + `´štf +("„x_no_d–im: %d\n", +dev +-> +¡©s +. +rx_no_d–im +); + +72 + `´štf +("x_äame: %d\n", +dev +-> +¡©s +. +tx_äame +); + +73 + `´štf +("x_©cmd: %d\n", +dev +-> +¡©s +. +tx_©cmd +); + +74 + `´štf +("x_©cmd_q: %d\n", +dev +-> +¡©s +. +tx_©cmd_q +); + +75 + `´štf +("x_d©a: %d\n", +dev +-> +¡©s +. +tx_d©a +); + +76 + `´štf +("x_ex¶_d©a: %d\n", +dev +-> +¡©s +. +tx_ex¶_d©a +); + +77 + `´štf +("x_xm™_»Œ›s: %d\n", +dev +-> +¡©s +. +tx_xm™_»Œ›s +); + +78 + `´štf +("x_rmt_©cmd: %d\n", +dev +-> +¡©s +. +tx_rmt_©cmd +); + +79 + `´štf +("x_šv®id_ty³: %d\n", +dev +-> +¡©s +. +tx_šv®id_ty³ +); + +80 + `´štf +("x_šv®id_chªÃl: %d\n", +dev +-> +¡©s +. +tx_šv®id_chªÃl +); + +81 + } +} + + @xbee_stats.h + +29  + sxb“_¡©s + { + +30  + mrx_äame +; + +31  + mrx_©»¥ +; + +32  + mrx_©»¥_”rÜ +; + +33  + mrx_modem_¡©us +; + +34  + mrx_xm™_¡©us +; + +35  + mrx_xm™_¡©us_”rÜ +; + +36  + mrx_d©a +; + +37  + mrx_ex¶_d©a +; + +38  + mrx_node_id +; + +39  + mrx_rmt_©»¥ +; + +40  + mrx_rmt_©»¥_”rÜ +; + +41  + mrx_äame_too_sm®l +; + +42  + mrx_äame_too_Ïrge +; + +43  + mrx_šv®id_cksum +; + +44  + mrx_šv®id_ty³ +; + +45  + mrx_no_d–im +; + +47  + mtx_äame +; + +48  + mtx_©cmd +; + +49  + mtx_©cmd_q +; + +50  + mtx_d©a +; + +51  + mtx_ex¶_d©a +; + +52  + mtx_xm™_»Œ›s +; + +53  + mtx_rmt_©cmd +; + +54  + mtx_šv®id_ty³ +; + +55  + mtx_šv®id_chªÃl +; + +58  + gxb“_dev +; + +61  +xb“_¡©s + * +xb“_g‘_¡©s +( +xb“_dev + * +dev +); + +64  +xb“_»£t_¡©s +( +xb“_dev + * +dev +); + +67  +xb“_dump_¡©s +( +xb“_dev + * +dev +); + + @/usr/include/arpa/inet.h + +19 #iâdeà +_ARPA_INET_H + + +20  + #_ARPA_INET_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +23  + ~<Ãtš‘/š.h +> + +26 #iâdeà +__sockËn_t_defšed + + +27  +__sockËn_t + + tsockËn_t +; + +28  + #__sockËn_t_defšed + + + ) + +31 +__BEGIN_DECLS + + +35 +š_addr_t + + $š‘_addr + ( +__cÚ¡ + * +__ý +è +__THROW +; + +38 +š_addr_t + + $š‘_Êaof + ( +š_addr + +__š +è +__THROW +; + +42  +š_addr + + $š‘_mak—ddr + ( +š_addr_t + +__Ãt +, in_addr_ˆ +__ho¡ +) + +43 +__THROW +; + +46 +š_addr_t + + $š‘_Ãtof + ( +š_addr + +__š +è +__THROW +; + +50 +š_addr_t + + $š‘_ÃtwÜk + ( +__cÚ¡ + * +__ý +è +__THROW +; + +54 * + $š‘_Áß + ( +š_addr + +__š +è +__THROW +; + +59  + $š‘_±Ú + ( +__af +, +__cÚ¡ + * +__»¡riù + +__ý +, + +60 * +__»¡riù + +__buf +è +__THROW +; + +65 +__cÚ¡ + * + $š‘_ÁÝ + ( +__af +, +__cÚ¡ + * +__»¡riù + +__ý +, + +66 * +__»¡riù + +__buf +, +sockËn_t + +__Ën +) + +67 +__THROW +; + +71 #ifdeà +__USE_MISC + + +74  + $š‘_©Ú + ( +__cÚ¡ + * +__ý +,  +š_addr + * +__šp +è +__THROW +; + +78 * + $š‘_Ï + ( +š_addr_t + +__Ãt +, * +__buf +, +size_t + +__Ën +è +__THROW +; + +83 * + $š‘_Ãt_ÁÝ + ( +__af +, +__cÚ¡ + * +__ý +,  +__b™s +, + +84 * +__buf +, +size_t + +__Ën +è +__THROW +; + +89  + $š‘_Ãt_±Ú + ( +__af +, +__cÚ¡ + * +__ý +, + +90 * +__buf +, +size_t + +__Ën +è +__THROW +; + +95  + $š‘_n§p_addr + ( +__cÚ¡ + * +__ý +, + +96 * +__buf +,  +__Ën +è +__THROW +; + +100 * + $š‘_n§p_Áß + ( +__Ën +, +__cÚ¡ + * +__ý +, + +101 * +__buf +è +__THROW +; + +104 +__END_DECLS + + + @/usr/include/ctype.h + +24 #iâdef +_CTYPE_H + + +25  + #_CTYPE_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +28  + ~ + +30 + g__BEGIN_DECLS + + +32 #iâdeà +_ISb™ + + +41  + ~<’dŸn.h +> + +42 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +43  + #_ISb™ +( +b™ +è(1 << (b™)) + + ) + +45  + #_ISb™ +( +b™ +è((b™è< 8 ? ((1 << (b™)è<< 8è: ((1 << (b™)è>> 8)) + + ) + +50 + m_ISuµ” + = +_ISb™ + (0), + +51 + m_ISlow” + = +_ISb™ + (1), + +52 + m_IS®pha + = +_ISb™ + (2), + +53 + m_ISdig™ + = +_ISb™ + (3), + +54 + m_ISxdig™ + = +_ISb™ + (4), + +55 + m_IS¥aû + = +_ISb™ + (5), + +56 + m_IS´št + = +_ISb™ + (6), + +57 + m_ISg¿ph + = +_ISb™ + (7), + +58 + m_ISbÏnk + = +_ISb™ + (8), + +59 + m_ISúŒl + = +_ISb™ + (9), + +60 + m_ISpunù + = +_ISb™ + (10), + +61 + m_IS®num + = +_ISb™ + (11) + +81 +__cÚ¡ + ** + $__ùy³_b_loc + () + +82 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +83 +__cÚ¡ + +__št32_t + ** + $__ùy³_tÞow”_loc + () + +84 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +85 +__cÚ¡ + +__št32_t + ** + $__ùy³_touµ”_loc + () + +86 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +88  + #__isùy³ +( +c +, +ty³ +) \ + +89 ((* + `__ùy³_b_loc + ())[(è( +c +)] & (è +ty³ +) + + ) + +91  + #__i§scii +( +c +è(((cè& ~0x7fè=ð0è + + ) + +92  + #__tßscii +( +c +è((cè& 0x7fè + + ) + +94  + #__exùy³ +( +Çme +è  + `Çme + (è +__THROW + + + ) + +96 +__BEGIN_NAMESPACE_STD + + +102 + `__exùy³ + ( +i§Êum +); + +103 + `__exùy³ + ( +i§Íha +); + +104 + `__exùy³ + ( +isúŒl +); + +105 + `__exùy³ + ( +isdig™ +); + +106 + `__exùy³ + ( +i¦ow” +); + +107 + `__exùy³ + ( +isg¿ph +); + +108 + `__exùy³ + ( +i¥ršt +); + +109 + `__exùy³ + ( +i¥unù +); + +110 + `__exùy³ + ( +is¥aû +); + +111 + `__exùy³ + ( +isuµ” +); + +112 + `__exùy³ + ( +isxdig™ +); + +116  + $tÞow” + ( +__c +è +__THROW +; + +119  + $touµ” + ( +__c +è +__THROW +; + +121 +__END_NAMESPACE_STD + + +125 #ifdef +__USE_ISOC99 + + +126 +__BEGIN_NAMESPACE_C99 + + +128 + `__exùy³ + ( +isbÏnk +); + +130 +__END_NAMESPACE_C99 + + +133 #ifdeà +__USE_GNU + + +135  + $isùy³ + ( +__c +,  +__mask +è +__THROW +; + +138 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +142  + $i§scii + ( +__c +è +__THROW +; + +146  + $tßscii + ( +__c +è +__THROW +; + +150 + `__exùy³ + ( +_touµ” +); + +151 + `__exùy³ + ( +_tÞow” +); + +155  + #__tobody +( +c +, +f +, +a +, +¬gs +) \ + +156 ( +__ex‹nsiÚ__ + \ + +157 ({  +__»s +; \ + +158 ià( ( +c +) > 1) \ + +160 ià( + `__bužtš_cÚ¡ªt_p + ( +c +)) \ + +162  +__c + = ( +c +); \ + +163 +__»s + = +__c + < -128 || __ø> 255 ? __ø: ( +a +)[__c]; \ + +166 +__»s + = +f + +¬gs +; \ + +169 +__»s + = ( +a +)[(è( +c +)]; \ + +170 +__»s +; + } +})) + + ) + +172 #ià! +defšed + +__NO_CTYPE + && !defšed +__ýlu¥lus + + +173  + #i§Êum +( +c +è + `__isùy³ +((c), +_IS®num +) + + ) + +174  + #i§Íha +( +c +è + `__isùy³ +((c), +_IS®pha +) + + ) + +175  + #isúŒl +( +c +è + `__isùy³ +((c), +_ISúŒl +) + + ) + +176  + #isdig™ +( +c +è + `__isùy³ +((c), +_ISdig™ +) + + ) + +177  + #i¦ow” +( +c +è + `__isùy³ +((c), +_ISlow” +) + + ) + +178  + #isg¿ph +( +c +è + `__isùy³ +((c), +_ISg¿ph +) + + ) + +179  + #i¥ršt +( +c +è + `__isùy³ +((c), +_IS´št +) + + ) + +180  + #i¥unù +( +c +è + `__isùy³ +((c), +_ISpunù +) + + ) + +181  + #is¥aû +( +c +è + `__isùy³ +((c), +_IS¥aû +) + + ) + +182  + #isuµ” +( +c +è + `__isùy³ +((c), +_ISuµ” +) + + ) + +183  + #isxdig™ +( +c +è + `__isùy³ +((c), +_ISxdig™ +) + + ) + +185 #ifdeà +__USE_ISOC99 + + +186  + #isbÏnk +( +c +è + `__isùy³ +((c), +_ISbÏnk +) + + ) + +189 #ifdeà +__USE_EXTERN_INLINES + + +190 +__ex‹º_šlše +  + +191 +__NTH + ( + $tÞow” + ( +__c +)) + +193  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_tÞow”_loc + ())[__c] : __c; + +194 + } +} + +196 +__ex‹º_šlše +  + +197 +__NTH + ( + $touµ” + ( +__c +)) + +199  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_touµ”_loc + ())[__c] : __c; + +200 + } +} + +203 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +204  + #tÞow” +( +c +è + `__tobody + (c, +tÞow” +, * + `__ùy³_tÞow”_loc + (), (c)) + + ) + +205  + #touµ” +( +c +è + `__tobody + (c, +touµ” +, * + `__ùy³_touµ”_loc + (), (c)) + + ) + +208 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +209  + #i§scii +( +c +è + `__i§scii + (c) + + ) + +210  + #tßscii +( +c +è + `__tßscii + (c) + + ) + +212  + #_tÞow” +( +c +è((è(* + `__ùy³_tÞow”_loc + ())[(è(c)]) + + ) + +213  + #_touµ” +( +c +è((è(* + `__ùy³_touµ”_loc + ())[(è(c)]) + + ) + +219 #ifdeà +__USE_XOPEN2K8 + + +233  + ~ + +237  + #__isùy³_l +( +c +, +ty³ +, +loÿË +) \ + +238 (( +loÿË +)-> +__ùy³_b +[(è( +c +)] & (è +ty³ +) + + ) + +240  + #__exùy³_l +( +Çme +) \ + +241  + `Çme + (, +__loÿË_t +è +__THROW + + + ) + +247 +__exùy³_l + ( +i§Êum_l +); + +248 +__exùy³_l + ( +i§Íha_l +); + +249 +__exùy³_l + ( +isúŒl_l +); + +250 +__exùy³_l + ( +isdig™_l +); + +251 +__exùy³_l + ( +i¦ow”_l +); + +252 +__exùy³_l + ( +isg¿ph_l +); + +253 +__exùy³_l + ( +i¥ršt_l +); + +254 +__exùy³_l + ( +i¥unù_l +); + +255 +__exùy³_l + ( +is¥aû_l +); + +256 +__exùy³_l + ( +isuµ”_l +); + +257 +__exùy³_l + ( +isxdig™_l +); + +259 +__exùy³_l + ( +isbÏnk_l +); + +263  + $__tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +264  + $tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +267  + $__touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +268  + $touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +270 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +271  + #__tÞow”_l +( +c +, +loÿË +) \ + +272 + `__tobody + ( +c +, +__tÞow”_l +, ( +loÿË +)-> +__ùy³_tÞow” +, (c,†oÿË)) + + ) + +273  + #__touµ”_l +( +c +, +loÿË +) \ + +274 + `__tobody + ( +c +, +__touµ”_l +, ( +loÿË +)-> +__ùy³_touµ” +, (c,†oÿË)) + + ) + +275  + #tÞow”_l +( +c +, +loÿË +è + `__tÞow”_l + ((c), (loÿË)) + + ) + +276  + #touµ”_l +( +c +, +loÿË +è + `__touµ”_l + ((c), (loÿË)) + + ) + +280 #iâdeà +__NO_CTYPE + + +281  + #__i§Êum_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®num +, (l)) + + ) + +282  + #__i§Íha_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®pha +, (l)) + + ) + +283  + #__isúŒl_l +( +c +, +l +è + `__isùy³_l +((c), +_ISúŒl +, (l)) + + ) + +284  + #__isdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISdig™ +, (l)) + + ) + +285  + #__i¦ow”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISlow” +, (l)) + + ) + +286  + #__isg¿ph_l +( +c +, +l +è + `__isùy³_l +((c), +_ISg¿ph +, (l)) + + ) + +287  + #__i¥ršt_l +( +c +, +l +è + `__isùy³_l +((c), +_IS´št +, (l)) + + ) + +288  + #__i¥unù_l +( +c +, +l +è + `__isùy³_l +((c), +_ISpunù +, (l)) + + ) + +289  + #__is¥aû_l +( +c +, +l +è + `__isùy³_l +((c), +_IS¥aû +, (l)) + + ) + +290  + #__isuµ”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISuµ” +, (l)) + + ) + +291  + #__isxdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISxdig™ +, (l)) + + ) + +293  + #__isbÏnk_l +( +c +, +l +è + `__isùy³_l +((c), +_ISbÏnk +, (l)) + + ) + +295 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +296  + #__i§scii_l +( +c +, +l +è(Ö), + `__i§scii + (c)) + + ) + +297  + #__tßscii_l +( +c +, +l +è(Ö), + `__tßscii + (c)) + + ) + +300  + #i§Êum_l +( +c +, +l +è + `__i§Êum_l + ((c), (l)) + + ) + +301  + #i§Íha_l +( +c +, +l +è + `__i§Íha_l + ((c), (l)) + + ) + +302  + #isúŒl_l +( +c +, +l +è + `__isúŒl_l + ((c), (l)) + + ) + +303  + #isdig™_l +( +c +, +l +è + `__isdig™_l + ((c), (l)) + + ) + +304  + #i¦ow”_l +( +c +, +l +è + `__i¦ow”_l + ((c), (l)) + + ) + +305  + #isg¿ph_l +( +c +, +l +è + `__isg¿ph_l + ((c), (l)) + + ) + +306  + #i¥ršt_l +( +c +, +l +è + `__i¥ršt_l + ((c), (l)) + + ) + +307  + #i¥unù_l +( +c +, +l +è + `__i¥unù_l + ((c), (l)) + + ) + +308  + #is¥aû_l +( +c +, +l +è + `__is¥aû_l + ((c), (l)) + + ) + +309  + #isuµ”_l +( +c +, +l +è + `__isuµ”_l + ((c), (l)) + + ) + +310  + #isxdig™_l +( +c +, +l +è + `__isxdig™_l + ((c), (l)) + + ) + +312  + #isbÏnk_l +( +c +, +l +è + `__isbÏnk_l + ((c), (l)) + + ) + +314 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +315  + #i§scii_l +( +c +, +l +è + `__i§scii_l + ((c), (l)) + + ) + +316  + #tßscii_l +( +c +, +l +è + `__tßscii_l + ((c), (l)) + + ) + +323 +__END_DECLS + + + @/usr/include/errno.h + +23 #iâdef +_ERRNO_H + + +27 #iâdef +__Ãed_Em©h + + +28  + #_ERRNO_H + 1 + + ) + +29  + ~<ã©u»s.h +> + +32 + g__BEGIN_DECLS + + +36  + ~ + +37 #undeà +__Ãed_Em©h + + +39 #ifdef +_ERRNO_H + + +46 #iâdef +”ºo + + +47  +”ºo +; + +50 #ifdeà +__USE_GNU + + +55 * +´og¿m_švoÿtiÚ_Çme +, * +´og¿m_švoÿtiÚ_shÜt_Çme +; + +59 + g__END_DECLS + + +67 #ià +defšed + +__USE_GNU + || defšed +__Ãed_”rÜ_t + + +68 #iâdeà +__”rÜ_t_defšed + + +69  + t”rÜ_t +; + +70  + #__”rÜ_t_defšed + 1 + + ) + +72 #undeà +__Ãed_”rÜ_t + + + @/usr/include/event.h + +27 #iâdeà +_EVENT_H_ + + +28  + #_EVENT_H_ + + + ) + +40 #ifdeà +__ýlu¥lus + + +44  + ~ + +45 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +46  + ~ + +48 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +49  + ~ + +51 #ifdeà +_EVENT_HAVE_STDINT_H + + +52  + ~<¡dšt.h +> + +54  + ~<¡d¬g.h +> + +57  + ~ + +59 #ifdeà +WIN32 + + +60 #iâdeà +WIN32_LEAN_AND_MEAN + + +61  + #WIN32_LEAN_AND_MEAN + + + ) + +63  + ~ + +64  + ~ + +65 #undeà +WIN32_LEAN_AND_MEAN + + +66  + tu_ch¬ +; + +67  + tu_shÜt +; + +70  + ~ + +71  + ~ + +72  + ~ + +73  + ~ + +74  + ~ + +75  + ~ + +76  + ~ + +77  + ~ + +78  + ~ + +79  + ~ + +81 #ifdeà +__ýlu¥lus + + + @/usr/include/fcntl.h + +24 #iâdef +_FCNTL_H + + +25  + #_FCNTL_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +34  + ~ + +37 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K8 + + +38  + ~ + +39  + #__Ãed_time¥ec + + + ) + +40  + ~ + +41  + ~ + +43  + #S_IFMT + +__S_IFMT + + + ) + +44  + #S_IFDIR + +__S_IFDIR + + + ) + +45  + #S_IFCHR + +__S_IFCHR + + + ) + +46  + #S_IFBLK + +__S_IFBLK + + + ) + +47  + #S_IFREG + +__S_IFREG + + + ) + +48 #ifdeà +__S_IFIFO + + +49  + #S_IFIFO + +__S_IFIFO + + + ) + +51 #ifdeà +__S_IFLNK + + +52  + #S_IFLNK + +__S_IFLNK + + + ) + +54 #ià( +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K8 +è&& defšed +__S_IFSOCK + + +55  + #S_IFSOCK + +__S_IFSOCK + + + ) + +60  + #S_ISUID + +__S_ISUID + + + ) + +61  + #S_ISGID + +__S_ISGID + + + ) + +63 #ià +defšed + +__USE_BSD + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +65  + #S_ISVTX + +__S_ISVTX + + + ) + +68  + #S_IRUSR + +__S_IREAD + + + ) + +69  + #S_IWUSR + +__S_IWRITE + + + ) + +70  + #S_IXUSR + +__S_IEXEC + + + ) + +72  + #S_IRWXU + ( +__S_IREAD +| +__S_IWRITE +| +__S_IEXEC +) + + ) + +74  + #S_IRGRP + ( +S_IRUSR + >> 3è + + ) + +75  + #S_IWGRP + ( +S_IWUSR + >> 3è + + ) + +76  + #S_IXGRP + ( +S_IXUSR + >> 3è + + ) + +78  + #S_IRWXG + ( +S_IRWXU + >> 3) + + ) + +80  + #S_IROTH + ( +S_IRGRP + >> 3è + + ) + +81  + #S_IWOTH + ( +S_IWGRP + >> 3è + + ) + +82  + #S_IXOTH + ( +S_IXGRP + >> 3è + + ) + +84  + #S_IRWXO + ( +S_IRWXG + >> 3) + + ) + +87 #ifdef +__USE_MISC + + +88 #iâdeà +R_OK + + +91  + #R_OK + 4 + + ) + +92  + #W_OK + 2 + + ) + +93  + #X_OK + 1 + + ) + +94  + #F_OK + 0 + + ) + +99 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K8 + + +100  + #SEEK_SET + 0 + + ) + +101  + #SEEK_CUR + 1 + + ) + +102  + #SEEK_END + 2 + + ) + +110  +fúŽ + ( +__fd +,  +__cmd +, ...); + +118 #iâdeà +__USE_FILE_OFFSET64 + + +119  + $ݒ + ( +__cÚ¡ + * +__fže +,  +__oæag +, ...è + `__nÚnuÎ + ((1)); + +121 #ifdeà +__REDIRECT + + +122  + `__REDIRECT + ( +ݒ +, ( +__cÚ¡ + * +__fže +,  +__oæag +, ...), +ݒ64 +) + +123 + `__nÚnuÎ + ((1)); + +125  + #ݒ + +ݒ64 + + + ) + +128 #ifdeà +__USE_LARGEFILE64 + + +129  + $ݒ64 + ( +__cÚ¡ + * +__fže +,  +__oæag +, ...è + `__nÚnuÎ + ((1)); + +132 #ifdeà +__USE_ATFILE + + +142 #iâdeà +__USE_FILE_OFFSET64 + + +143  + $ݒ© + ( +__fd +, +__cÚ¡ + * +__fže +,  +__oæag +, ...) + +144 + `__nÚnuÎ + ((2)); + +146 #ifdeà +__REDIRECT + + +147  + `__REDIRECT + ( +ݒ© +, ( +__fd +, +__cÚ¡ + * +__fže +,  +__oæag +, + +148 ...), +ݒ©64 +è + `__nÚnuÎ + ((2)); + +150  + #ݒ© + +ݒ©64 + + + ) + +153 #ifdeà +__USE_LARGEFILE64 + + +154  + $ݒ©64 + ( +__fd +, +__cÚ¡ + * +__fže +,  +__oæag +, ...) + +155 + `__nÚnuÎ + ((2)); + +164 #iâdeà +__USE_FILE_OFFSET64 + + +165  + $ü—t + ( +__cÚ¡ + * +__fže +, +__mode_t + +__mode +è + `__nÚnuÎ + ((1)); + +167 #ifdeà +__REDIRECT + + +168  + `__REDIRECT + ( +ü—t +, ( +__cÚ¡ + * +__fže +, +__mode_t + +__mode +), + +169 +ü—t64 +è + `__nÚnuÎ + ((1)); + +171  + #ü—t + +ü—t64 + + + ) + +174 #ifdeà +__USE_LARGEFILE64 + + +175  + $ü—t64 + ( +__cÚ¡ + * +__fže +, +__mode_t + +__mode +è + `__nÚnuÎ + ((1)); + +178 #ià! +defšed + +F_LOCK + && (defšed +__USE_MISC + || (defšed +__USE_XOPEN_EXTENDED + \ + +179 && ! +defšed + +__USE_POSIX +)) + +188  + #F_ULOCK + 0 + + ) + +189  + #F_LOCK + 1 + + ) + +190  + #F_TLOCK + 2 + + ) + +191  + #F_TEST + 3 + + ) + +193 #iâdeà +__USE_FILE_OFFSET64 + + +194  + `lockf + ( +__fd +,  +__cmd +, +__off_t + +__Ën +); + +196 #ifdeà +__REDIRECT + + +197  + `__REDIRECT + ( +lockf +, ( +__fd +,  +__cmd +, +__off64_t + +__Ën +), +lockf64 +); + +199  + #lockf + +lockf64 + + + ) + +202 #ifdeà +__USE_LARGEFILE64 + + +203  + `lockf64 + ( +__fd +,  +__cmd +, +__off64_t + +__Ën +); + +207 #ifdeà +__USE_XOPEN2K + + +210 #iâdeà +__USE_FILE_OFFSET64 + + +211  + $posix_çdvi£ + ( +__fd +, +__off_t + +__off£t +, __off_ˆ +__Ën +, + +212  +__advi£ +è +__THROW +; + +214 #ifdeà +__REDIRECT_NTH + + +215  + `__REDIRECT_NTH + ( +posix_çdvi£ +, ( +__fd +, +__off64_t + +__off£t +, + +216 +__off64_t + +__Ën +,  +__advi£ +), + +217 +posix_çdvi£64 +); + +219  + #posix_çdvi£ + +posix_çdvi£64 + + + ) + +222 #ifdeà +__USE_LARGEFILE64 + + +223  + $posix_çdvi£64 + ( +__fd +, +__off64_t + +__off£t +, __off64_ˆ +__Ën +, + +224  +__advi£ +è +__THROW +; + +232 #iâdeà +__USE_FILE_OFFSET64 + + +233  + `posix_çÎoÿ‹ + ( +__fd +, +__off_t + +__off£t +, __off_ˆ +__Ën +); + +235 #ifdeà +__REDIRECT + + +236  + `__REDIRECT + ( +posix_çÎoÿ‹ +, ( +__fd +, +__off64_t + +__off£t +, + +237 +__off64_t + +__Ën +), + +238 +posix_çÎoÿ‹64 +); + +240  + #posix_çÎoÿ‹ + +posix_çÎoÿ‹64 + + + ) + +243 #ifdeà +__USE_LARGEFILE64 + + +244  + `posix_çÎoÿ‹64 + ( +__fd +, +__off64_t + +__off£t +, __off64_ˆ +__Ën +); + +250 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + \ + +251 && +defšed + +__va_¬g_·ck_Ën + + +252  + ~ + +255 +__END_DECLS + + + @/usr/include/inttypes.h + +23 #iâdeà +_INTTYPES_H + + +24  + #_INTTYPES_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +28  + ~<¡dšt.h +> + +31 #iâdeà +____gwch¬_t_defšed + + +32 #ifdeà +__ýlu¥lus + + +33  + #__gwch¬_t + +wch¬_t + + + ) + +34 #–ià +defšed + +__WCHAR_TYPE__ + + +35  +__WCHAR_TYPE__ + + t__gwch¬_t +; + +37  + #__Ãed_wch¬_t + + + ) + +38  + ~<¡ddef.h +> + +39  +wch¬_t + + t__gwch¬_t +; + +41  + #____gwch¬_t_defšed + 1 + + ) + +47 #ià! +defšed + +__ýlu¥lus + || defšed +__STDC_FORMAT_MACROS + + +49 #ià +__WORDSIZE + == 64 + +50  + #__PRI64_PREFIX + "l" + + ) + +51  + #__PRIPTR_PREFIX + "l" + + ) + +53  + #__PRI64_PREFIX + "Î" + + ) + +54  + #__PRIPTR_PREFIX + + + ) + +60  + #PRId8 + "d" + + ) + +61  + #PRId16 + "d" + + ) + +62  + #PRId32 + "d" + + ) + +63  + #PRId64 + +__PRI64_PREFIX + "d" + + ) + +65  + #PRIdLEAST8 + "d" + + ) + +66  + #PRIdLEAST16 + "d" + + ) + +67  + #PRIdLEAST32 + "d" + + ) + +68  + #PRIdLEAST64 + +__PRI64_PREFIX + "d" + + ) + +70  + #PRIdFAST8 + "d" + + ) + +71  + #PRIdFAST16 + +__PRIPTR_PREFIX + "d" + + ) + +72  + #PRIdFAST32 + +__PRIPTR_PREFIX + "d" + + ) + +73  + #PRIdFAST64 + +__PRI64_PREFIX + "d" + + ) + +76  + #PRIi8 + "i" + + ) + +77  + #PRIi16 + "i" + + ) + +78  + #PRIi32 + "i" + + ) + +79  + #PRIi64 + +__PRI64_PREFIX + "i" + + ) + +81  + #PRIiLEAST8 + "i" + + ) + +82  + #PRIiLEAST16 + "i" + + ) + +83  + #PRIiLEAST32 + "i" + + ) + +84  + #PRIiLEAST64 + +__PRI64_PREFIX + "i" + + ) + +86  + #PRIiFAST8 + "i" + + ) + +87  + #PRIiFAST16 + +__PRIPTR_PREFIX + "i" + + ) + +88  + #PRIiFAST32 + +__PRIPTR_PREFIX + "i" + + ) + +89  + #PRIiFAST64 + +__PRI64_PREFIX + "i" + + ) + +92  + #PRIo8 + "o" + + ) + +93  + #PRIo16 + "o" + + ) + +94  + #PRIo32 + "o" + + ) + +95  + #PRIo64 + +__PRI64_PREFIX + "o" + + ) + +97  + #PRIoLEAST8 + "o" + + ) + +98  + #PRIoLEAST16 + "o" + + ) + +99  + #PRIoLEAST32 + "o" + + ) + +100  + #PRIoLEAST64 + +__PRI64_PREFIX + "o" + + ) + +102  + #PRIoFAST8 + "o" + + ) + +103  + #PRIoFAST16 + +__PRIPTR_PREFIX + "o" + + ) + +104  + #PRIoFAST32 + +__PRIPTR_PREFIX + "o" + + ) + +105  + #PRIoFAST64 + +__PRI64_PREFIX + "o" + + ) + +108  + #PRIu8 + "u" + + ) + +109  + #PRIu16 + "u" + + ) + +110  + #PRIu32 + "u" + + ) + +111  + #PRIu64 + +__PRI64_PREFIX + "u" + + ) + +113  + #PRIuLEAST8 + "u" + + ) + +114  + #PRIuLEAST16 + "u" + + ) + +115  + #PRIuLEAST32 + "u" + + ) + +116  + #PRIuLEAST64 + +__PRI64_PREFIX + "u" + + ) + +118  + #PRIuFAST8 + "u" + + ) + +119  + #PRIuFAST16 + +__PRIPTR_PREFIX + "u" + + ) + +120  + #PRIuFAST32 + +__PRIPTR_PREFIX + "u" + + ) + +121  + #PRIuFAST64 + +__PRI64_PREFIX + "u" + + ) + +124  + #PRIx8 + "x" + + ) + +125  + #PRIx16 + "x" + + ) + +126  + #PRIx32 + "x" + + ) + +127  + #PRIx64 + +__PRI64_PREFIX + "x" + + ) + +129  + #PRIxLEAST8 + "x" + + ) + +130  + #PRIxLEAST16 + "x" + + ) + +131  + #PRIxLEAST32 + "x" + + ) + +132  + #PRIxLEAST64 + +__PRI64_PREFIX + "x" + + ) + +134  + #PRIxFAST8 + "x" + + ) + +135  + #PRIxFAST16 + +__PRIPTR_PREFIX + "x" + + ) + +136  + #PRIxFAST32 + +__PRIPTR_PREFIX + "x" + + ) + +137  + #PRIxFAST64 + +__PRI64_PREFIX + "x" + + ) + +140  + #PRIX8 + "X" + + ) + +141  + #PRIX16 + "X" + + ) + +142  + #PRIX32 + "X" + + ) + +143  + #PRIX64 + +__PRI64_PREFIX + "X" + + ) + +145  + #PRIXLEAST8 + "X" + + ) + +146  + #PRIXLEAST16 + "X" + + ) + +147  + #PRIXLEAST32 + "X" + + ) + +148  + #PRIXLEAST64 + +__PRI64_PREFIX + "X" + + ) + +150  + #PRIXFAST8 + "X" + + ) + +151  + #PRIXFAST16 + +__PRIPTR_PREFIX + "X" + + ) + +152  + #PRIXFAST32 + +__PRIPTR_PREFIX + "X" + + ) + +153  + #PRIXFAST64 + +__PRI64_PREFIX + "X" + + ) + +157  + #PRIdMAX + +__PRI64_PREFIX + "d" + + ) + +158  + #PRIiMAX + +__PRI64_PREFIX + "i" + + ) + +159  + #PRIoMAX + +__PRI64_PREFIX + "o" + + ) + +160  + #PRIuMAX + +__PRI64_PREFIX + "u" + + ) + +161  + #PRIxMAX + +__PRI64_PREFIX + "x" + + ) + +162  + #PRIXMAX + +__PRI64_PREFIX + "X" + + ) + +166  + #PRIdPTR + +__PRIPTR_PREFIX + "d" + + ) + +167  + #PRIiPTR + +__PRIPTR_PREFIX + "i" + + ) + +168  + #PRIoPTR + +__PRIPTR_PREFIX + "o" + + ) + +169  + #PRIuPTR + +__PRIPTR_PREFIX + "u" + + ) + +170  + #PRIxPTR + +__PRIPTR_PREFIX + "x" + + ) + +171  + #PRIXPTR + +__PRIPTR_PREFIX + "X" + + ) + +177  + #SCNd8 + "hhd" + + ) + +178  + #SCNd16 + "hd" + + ) + +179  + #SCNd32 + "d" + + ) + +180  + #SCNd64 + +__PRI64_PREFIX + "d" + + ) + +182  + #SCNdLEAST8 + "hhd" + + ) + +183  + #SCNdLEAST16 + "hd" + + ) + +184  + #SCNdLEAST32 + "d" + + ) + +185  + #SCNdLEAST64 + +__PRI64_PREFIX + "d" + + ) + +187  + #SCNdFAST8 + "hhd" + + ) + +188  + #SCNdFAST16 + +__PRIPTR_PREFIX + "d" + + ) + +189  + #SCNdFAST32 + +__PRIPTR_PREFIX + "d" + + ) + +190  + #SCNdFAST64 + +__PRI64_PREFIX + "d" + + ) + +193  + #SCNi8 + "hhi" + + ) + +194  + #SCNi16 + "hi" + + ) + +195  + #SCNi32 + "i" + + ) + +196  + #SCNi64 + +__PRI64_PREFIX + "i" + + ) + +198  + #SCNiLEAST8 + "hhi" + + ) + +199  + #SCNiLEAST16 + "hi" + + ) + +200  + #SCNiLEAST32 + "i" + + ) + +201  + #SCNiLEAST64 + +__PRI64_PREFIX + "i" + + ) + +203  + #SCNiFAST8 + "hhi" + + ) + +204  + #SCNiFAST16 + +__PRIPTR_PREFIX + "i" + + ) + +205  + #SCNiFAST32 + +__PRIPTR_PREFIX + "i" + + ) + +206  + #SCNiFAST64 + +__PRI64_PREFIX + "i" + + ) + +209  + #SCNu8 + "hhu" + + ) + +210  + #SCNu16 + "hu" + + ) + +211  + #SCNu32 + "u" + + ) + +212  + #SCNu64 + +__PRI64_PREFIX + "u" + + ) + +214  + #SCNuLEAST8 + "hhu" + + ) + +215  + #SCNuLEAST16 + "hu" + + ) + +216  + #SCNuLEAST32 + "u" + + ) + +217  + #SCNuLEAST64 + +__PRI64_PREFIX + "u" + + ) + +219  + #SCNuFAST8 + "hhu" + + ) + +220  + #SCNuFAST16 + +__PRIPTR_PREFIX + "u" + + ) + +221  + #SCNuFAST32 + +__PRIPTR_PREFIX + "u" + + ) + +222  + #SCNuFAST64 + +__PRI64_PREFIX + "u" + + ) + +225  + #SCNo8 + "hho" + + ) + +226  + #SCNo16 + "ho" + + ) + +227  + #SCNo32 + "o" + + ) + +228  + #SCNo64 + +__PRI64_PREFIX + "o" + + ) + +230  + #SCNoLEAST8 + "hho" + + ) + +231  + #SCNoLEAST16 + "ho" + + ) + +232  + #SCNoLEAST32 + "o" + + ) + +233  + #SCNoLEAST64 + +__PRI64_PREFIX + "o" + + ) + +235  + #SCNoFAST8 + "hho" + + ) + +236  + #SCNoFAST16 + +__PRIPTR_PREFIX + "o" + + ) + +237  + #SCNoFAST32 + +__PRIPTR_PREFIX + "o" + + ) + +238  + #SCNoFAST64 + +__PRI64_PREFIX + "o" + + ) + +241  + #SCNx8 + "hhx" + + ) + +242  + #SCNx16 + "hx" + + ) + +243  + #SCNx32 + "x" + + ) + +244  + #SCNx64 + +__PRI64_PREFIX + "x" + + ) + +246  + #SCNxLEAST8 + "hhx" + + ) + +247  + #SCNxLEAST16 + "hx" + + ) + +248  + #SCNxLEAST32 + "x" + + ) + +249  + #SCNxLEAST64 + +__PRI64_PREFIX + "x" + + ) + +251  + #SCNxFAST8 + "hhx" + + ) + +252  + #SCNxFAST16 + +__PRIPTR_PREFIX + "x" + + ) + +253  + #SCNxFAST32 + +__PRIPTR_PREFIX + "x" + + ) + +254  + #SCNxFAST64 + +__PRI64_PREFIX + "x" + + ) + +258  + #SCNdMAX + +__PRI64_PREFIX + "d" + + ) + +259  + #SCNiMAX + +__PRI64_PREFIX + "i" + + ) + +260  + #SCNoMAX + +__PRI64_PREFIX + "o" + + ) + +261  + #SCNuMAX + +__PRI64_PREFIX + "u" + + ) + +262  + #SCNxMAX + +__PRI64_PREFIX + "x" + + ) + +265  + #SCNdPTR + +__PRIPTR_PREFIX + "d" + + ) + +266  + #SCNiPTR + +__PRIPTR_PREFIX + "i" + + ) + +267  + #SCNoPTR + +__PRIPTR_PREFIX + "o" + + ) + +268  + #SCNuPTR + +__PRIPTR_PREFIX + "u" + + ) + +269  + #SCNxPTR + +__PRIPTR_PREFIX + "x" + + ) + +274 + g__BEGIN_DECLS + + +276 #ià +__WORDSIZE + == 64 + +281  + mquÙ +; + +282  + m»m +; + +283 } + timaxdiv_t +; + +290  + mquÙ +; + +291  + m»m +; + +292 } + timaxdiv_t +; + +298 +štmax_t + + $imaxabs + ( +štmax_t + +__n +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +301 +imaxdiv_t + + $imaxdiv + ( +štmax_t + +__num” +, iÁmax_ˆ +__d’om +) + +302 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +305 +štmax_t + + $¡¹oimax + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +306 ** +__»¡riù + +__’d±r +,  +__ba£ +è +__THROW +; + +309 +uštmax_t + + $¡¹oumax + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +310 ** +__»¡riù + +__’d±r +,  +__ba£ +è +__THROW +; + +313 +štmax_t + + $wc¡oimax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +__Ō +, + +314 +__gwch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +315 +__THROW +; + +318 +uštmax_t + + $wc¡oumax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +__Ō +, + +319 +__gwch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +320 +__THROW +; + +322 #ifdeà +__USE_EXTERN_INLINES + + +324 #ià +__WORDSIZE + == 64 + +326  + $__¡¹Þ_š‹º® + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +327 ** +__»¡riù + +__’d±r +, + +328  +__ba£ +,  +__group +) + +329 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +331 +__ex‹º_šlše + +štmax_t + + +332 + `__NTH + ( + $¡¹oimax + ( +__cÚ¡ + * +__»¡riù + +Ō +, **__»¡riù +’d±r +, + +333  +ba£ +)) + +335  + `__¡¹Þ_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +336 + } +} + +338  + $__¡¹oul_š‹º® + ( +__cÚ¡ + * + +339 +__»¡riù + +__Ō +, + +340 ** +__»¡riù + +__’d±r +, + +341  +__ba£ +,  +__group +) + +342 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +344 +__ex‹º_šlše + +uštmax_t + + +345 + `__NTH + ( + $¡¹oumax + ( +__cÚ¡ + * +__»¡riù + +Ō +, **__»¡riù +’d±r +, + +346  +ba£ +)) + +348  + `__¡¹oul_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +349 + } +} + +351  + $__wc¡Þ_š‹º® + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +__Ō +, + +352 +__gwch¬_t + ** +__»¡riù + +__’d±r +, + +353  +__ba£ +,  +__group +) + +354 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +356 +__ex‹º_šlše + +štmax_t + + +357 + `__NTH + ( + $wc¡oimax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +Ō +, + +358 +__gwch¬_t + ** +__»¡riù + +’d±r +,  +ba£ +)) + +360  + `__wc¡Þ_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +361 + } +} + +363  + $__wc¡oul_š‹º® + ( +__cÚ¡ + +__gwch¬_t + * + +364 +__»¡riù + +__Ō +, + +365 +__gwch¬_t + ** + +366 +__»¡riù + +__’d±r +, + +367  +__ba£ +,  +__group +) + +368 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +370 +__ex‹º_šlše + +uštmax_t + + +371 + `__NTH + ( + $wc¡oumax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +Ō +, + +372 +__gwch¬_t + ** +__»¡riù + +’d±r +,  +ba£ +)) + +374  + `__wc¡oul_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +375 + } +} + +379 +__ex‹nsiÚ__ + + +380  + $__¡¹Þl_š‹º® + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +381 ** +__»¡riù + +__’d±r +, + +382  +__ba£ +,  +__group +) + +383 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +385 +__ex‹º_šlše + +štmax_t + + +386 + `__NTH + ( + $¡¹oimax + ( +__cÚ¡ + * +__»¡riù + +Ō +, **__»¡riù +’d±r +, + +387  +ba£ +)) + +389  + `__¡¹Þl_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +390 + } +} + +392 +__ex‹nsiÚ__ + + +393  + $__¡¹ouÎ_š‹º® + ( +__cÚ¡ + * + +394 +__»¡riù + +__Ō +, + +396 +__»¡riù + +__’d±r +, + +397  +__ba£ +, + +398  +__group +) + +399 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +401 +__ex‹º_šlše + +uštmax_t + + +402 + `__NTH + ( + $¡¹oumax + ( +__cÚ¡ + * +__»¡riù + +Ō +, **__»¡riù +’d±r +, + +403  +ba£ +)) + +405  + `__¡¹ouÎ_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +406 + } +} + +408 +__ex‹nsiÚ__ + + +409  + $__wc¡Þl_š‹º® + ( +__cÚ¡ + +__gwch¬_t + * + +410 +__»¡riù + +__Ō +, + +411 +__gwch¬_t + ** +__»¡riù + +__’d±r +, + +412  +__ba£ +,  +__group +) + +413 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +415 +__ex‹º_šlše + +štmax_t + + +416 + `__NTH + ( + $wc¡oimax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +Ō +, + +417 +__gwch¬_t + ** +__»¡riù + +’d±r +,  +ba£ +)) + +419  + `__wc¡Þl_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +420 + } +} + +423 +__ex‹nsiÚ__ + + +424  + $__wc¡ouÎ_š‹º® + ( +__cÚ¡ + +__gwch¬_t + * + +425 +__»¡riù + +__Ō +, + +426 +__gwch¬_t + ** + +427 +__»¡riù + +__’d±r +, + +428  +__ba£ +, + +429  +__group +) + +430 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +432 +__ex‹º_šlše + +uštmax_t + + +433 + `__NTH + ( + $wc¡oumax + ( +__cÚ¡ + +__gwch¬_t + * +__»¡riù + +Ō +, + +434 +__gwch¬_t + ** +__»¡riù + +’d±r +,  +ba£ +)) + +436  + `__wc¡ouÎ_š‹º® + ( +Ō +, +’d±r +, +ba£ +, 0); + +437 + } +} + +442 + g__END_DECLS + + + @/usr/include/stdint.h + +23 #iâdeà +_STDINT_H + + +24  + #_STDINT_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +27  + ~ + +28  + ~ + +35 #iâdeà +__št8_t_defšed + + +36  + #__št8_t_defšed + + + ) + +37 sigÃd  + tšt8_t +; + +38  + tšt16_t +; + +39  + tšt32_t +; + +40 #ià +__WORDSIZE + == 64 + +41  + tšt64_t +; + +43 +__ex‹nsiÚ__ + + +44  + tšt64_t +; + +49  + tušt8_t +; + +50  + tušt16_t +; + +51 #iâdeà +__ušt32_t_defšed + + +52  + tušt32_t +; + +53  + #__ušt32_t_defšed + + + ) + +55 #ià +__WORDSIZE + == 64 + +56  + tušt64_t +; + +58 +__ex‹nsiÚ__ + + +59  + tušt64_t +; + +66 sigÃd  + tšt_Ëa¡8_t +; + +67  + tšt_Ëa¡16_t +; + +68  + tšt_Ëa¡32_t +; + +69 #ià +__WORDSIZE + == 64 + +70  + tšt_Ëa¡64_t +; + +72 +__ex‹nsiÚ__ + + +73  + tšt_Ëa¡64_t +; + +77  + tušt_Ëa¡8_t +; + +78  + tušt_Ëa¡16_t +; + +79  + tušt_Ëa¡32_t +; + +80 #ià +__WORDSIZE + == 64 + +81  + tušt_Ëa¡64_t +; + +83 +__ex‹nsiÚ__ + + +84  + tušt_Ëa¡64_t +; + +91 sigÃd  + tšt_ç¡8_t +; + +92 #ià +__WORDSIZE + == 64 + +93  + tšt_ç¡16_t +; + +94  + tšt_ç¡32_t +; + +95  + tšt_ç¡64_t +; + +97  + tšt_ç¡16_t +; + +98  + tšt_ç¡32_t +; + +99 +__ex‹nsiÚ__ + + +100  + tšt_ç¡64_t +; + +104  + tušt_ç¡8_t +; + +105 #ià +__WORDSIZE + == 64 + +106  + tušt_ç¡16_t +; + +107  + tušt_ç¡32_t +; + +108  + tušt_ç¡64_t +; + +110  + tušt_ç¡16_t +; + +111  + tušt_ç¡32_t +; + +112 +__ex‹nsiÚ__ + + +113  + tušt_ç¡64_t +; + +118 #ià +__WORDSIZE + == 64 + +119 #iâdeà +__šŒ_t_defšed + + +120  + tšŒ_t +; + +121  + #__šŒ_t_defšed + + + ) + +123  + tušŒ_t +; + +125 #iâdeà +__šŒ_t_defšed + + +126  + tšŒ_t +; + +127  + #__šŒ_t_defšed + + + ) + +129  + tušŒ_t +; + +134 #ià +__WORDSIZE + == 64 + +135  + tštmax_t +; + +136  + tuštmax_t +; + +138 +__ex‹nsiÚ__ + + +139  + tštmax_t +; + +140 +__ex‹nsiÚ__ + + +141  + tuštmax_t +; + +147 #ià! +defšed + +__ýlu¥lus + || defšed +__STDC_LIMIT_MACROS + + +149 #ià +__WORDSIZE + == 64 + +150  + #__INT64_C +( +c +èø## +L + + + ) + +151  + #__UINT64_C +( +c +èø## +UL + + + ) + +153  + #__INT64_C +( +c +èø## +LL + + + ) + +154  + #__UINT64_C +( +c +èø## +ULL + + + ) + +160  + #INT8_MIN + (-128) + + ) + +161  + #INT16_MIN + (-32767-1) + + ) + +162  + #INT32_MIN + (-2147483647-1) + + ) + +163  + #INT64_MIN + (- + `__INT64_C +(9223372036854775807)-1) + + ) + +165  + #INT8_MAX + (127) + + ) + +166  + #INT16_MAX + (32767) + + ) + +167  + #INT32_MAX + (2147483647) + + ) + +168  + #INT64_MAX + ( + `__INT64_C +(9223372036854775807)) + + ) + +171  + #UINT8_MAX + (255) + + ) + +172  + #UINT16_MAX + (65535) + + ) + +173  + #UINT32_MAX + (4294967295U) + + ) + +174  + #UINT64_MAX + ( + `__UINT64_C +(18446744073709551615)) + + ) + +178  + #INT_LEAST8_MIN + (-128) + + ) + +179  + #INT_LEAST16_MIN + (-32767-1) + + ) + +180  + #INT_LEAST32_MIN + (-2147483647-1) + + ) + +181  + #INT_LEAST64_MIN + (- + `__INT64_C +(9223372036854775807)-1) + + ) + +183  + #INT_LEAST8_MAX + (127) + + ) + +184  + #INT_LEAST16_MAX + (32767) + + ) + +185  + #INT_LEAST32_MAX + (2147483647) + + ) + +186  + #INT_LEAST64_MAX + ( + `__INT64_C +(9223372036854775807)) + + ) + +189  + #UINT_LEAST8_MAX + (255) + + ) + +190  + #UINT_LEAST16_MAX + (65535) + + ) + +191  + #UINT_LEAST32_MAX + (4294967295U) + + ) + +192  + #UINT_LEAST64_MAX + ( + `__UINT64_C +(18446744073709551615)) + + ) + +196  + #INT_FAST8_MIN + (-128) + + ) + +197 #ià +__WORDSIZE + == 64 + +198  + #INT_FAST16_MIN + (-9223372036854775807L-1) + + ) + +199  + #INT_FAST32_MIN + (-9223372036854775807L-1) + + ) + +201  + #INT_FAST16_MIN + (-2147483647-1) + + ) + +202  + #INT_FAST32_MIN + (-2147483647-1) + + ) + +204  + #INT_FAST64_MIN + (- + `__INT64_C +(9223372036854775807)-1) + + ) + +206  + #INT_FAST8_MAX + (127) + + ) + +207 #ià +__WORDSIZE + == 64 + +208  + #INT_FAST16_MAX + (9223372036854775807L) + + ) + +209  + #INT_FAST32_MAX + (9223372036854775807L) + + ) + +211  + #INT_FAST16_MAX + (2147483647) + + ) + +212  + #INT_FAST32_MAX + (2147483647) + + ) + +214  + #INT_FAST64_MAX + ( + `__INT64_C +(9223372036854775807)) + + ) + +217  + #UINT_FAST8_MAX + (255) + + ) + +218 #ià +__WORDSIZE + == 64 + +219  + #UINT_FAST16_MAX + (18446744073709551615UL) + + ) + +220  + #UINT_FAST32_MAX + (18446744073709551615UL) + + ) + +222  + #UINT_FAST16_MAX + (4294967295U) + + ) + +223  + #UINT_FAST32_MAX + (4294967295U) + + ) + +225  + #UINT_FAST64_MAX + ( + `__UINT64_C +(18446744073709551615)) + + ) + +229 #ià +__WORDSIZE + == 64 + +230  + #INTPTR_MIN + (-9223372036854775807L-1) + + ) + +231  + #INTPTR_MAX + (9223372036854775807L) + + ) + +232  + #UINTPTR_MAX + (18446744073709551615UL) + + ) + +234  + #INTPTR_MIN + (-2147483647-1) + + ) + +235  + #INTPTR_MAX + (2147483647) + + ) + +236  + #UINTPTR_MAX + (4294967295U) + + ) + +241  + #INTMAX_MIN + (- + `__INT64_C +(9223372036854775807)-1) + + ) + +243  + #INTMAX_MAX + ( + `__INT64_C +(9223372036854775807)) + + ) + +246  + #UINTMAX_MAX + ( + `__UINT64_C +(18446744073709551615)) + + ) + +252 #ià +__WORDSIZE + == 64 + +253  + #PTRDIFF_MIN + (-9223372036854775807L-1) + + ) + +254  + #PTRDIFF_MAX + (9223372036854775807L) + + ) + +256  + #PTRDIFF_MIN + (-2147483647-1) + + ) + +257  + #PTRDIFF_MAX + (2147483647) + + ) + +261  + #SIG_ATOMIC_MIN + (-2147483647-1) + + ) + +262  + #SIG_ATOMIC_MAX + (2147483647) + + ) + +265 #ià +__WORDSIZE + == 64 + +266  + #SIZE_MAX + (18446744073709551615UL) + + ) + +268  + #SIZE_MAX + (4294967295U) + + ) + +272 #iâdeà +WCHAR_MIN + + +274  + #WCHAR_MIN + +__WCHAR_MIN + + + ) + +275  + #WCHAR_MAX + +__WCHAR_MAX + + + ) + +279  + #WINT_MIN + (0u) + + ) + +280  + #WINT_MAX + (4294967295u) + + ) + +287 #ià! +defšed + +__ýlu¥lus + || defšed +__STDC_CONSTANT_MACROS + + +290  + #INT8_C +( +c +è + ) +c + +291  + #INT16_C +( +c +è + ) +c + +292  + #INT32_C +( +c +è + ) +c + +293 #ià +__WORDSIZE + == 64 + +294  + #INT64_C +( +c +èø## +L + + + ) + +296  + #INT64_C +( +c +èø## +LL + + + ) + +300  + #UINT8_C +( +c +è + ) +c + +301  + #UINT16_C +( +c +è + ) +c + +302  + #UINT32_C +( +c +èø## +U + + + ) + +303 #ià +__WORDSIZE + == 64 + +304  + #UINT64_C +( +c +èø## +UL + + + ) + +306  + #UINT64_C +( +c +èø## +ULL + + + ) + +310 #ià +__WORDSIZE + == 64 + +311  + #INTMAX_C +( +c +èø## +L + + + ) + +312  + #UINTMAX_C +( +c +èø## +UL + + + ) + +314  + #INTMAX_C +( +c +èø## +LL + + + ) + +315  + #UINTMAX_C +( +c +èø## +ULL + + + ) + + @/usr/include/stdio.h + +24 #iâdeà +_STDIO_H + + +26 #ià! +defšed + +__Ãed_FILE + && !defšed +__Ãed___FILE + + +27  + #_STDIO_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +32  + #__Ãed_size_t + + + ) + +33  + #__Ãed_NULL + + + ) + +34  + ~<¡ddef.h +> + +36  + ~ + +37  + #__Ãed_FILE + + + ) + +38  + #__Ãed___FILE + + + ) + +42 #ià! +defšed + +__FILE_defšed + && defšed +__Ãed_FILE + + +45  + g_IO_FILE +; + +47 +__BEGIN_NAMESPACE_STD + + +49  +_IO_FILE + + tFILE +; + +50 + g__END_NAMESPACE_STD + + +51 #ià +defšed + +__USE_LARGEFILE64 + || defšed +__USE_SVID + || defšed +__USE_POSIX + \ + +52 || +defšed + + g__USE_BSD + || defšed + g__USE_ISOC99 + || defšed + g__USE_XOPEN + \ + +53 || +defšed + +__USE_POSIX2 + + +54 + $__USING_NAMESPACE_STD +( +FILE +) + +57  + #__FILE_defšed + 1 + + ) + +59 #undeà +__Ãed_FILE + + +62 #ià! +defšed + +____FILE_defšed + && defšed +__Ãed___FILE + + +65  +_IO_FILE + + t__FILE +; + +67  + #____FILE_defšed + 1 + + ) + +69 #undeà +__Ãed___FILE + + +72 #ifdef +_STDIO_H + + +73  + #_STDIO_USES_IOSTREAM + + + ) + +75  + ~ + +77 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K8 + + +78 #ifdeà +__GNUC__ + + +79 #iâdeà +_VA_LIST_DEFINED + + +80  +_G_va_li¡ + + tva_li¡ +; + +81  + #_VA_LIST_DEFINED + + + ) + +84  + ~<¡d¬g.h +> + +88 #ifdeà +__USE_XOPEN2K8 + + +89 #iâdeà +__off_t_defšed + + +90 #iâdeà +__USE_FILE_OFFSET64 + + +91  +__off_t + + toff_t +; + +93  +__off64_t + + toff_t +; + +95  + #__off_t_defšed + + + ) + +97 #ià +defšed + +__USE_LARGEFILE64 + && !defšed +__off64_t_defšed + + +98  +__off64_t + + toff64_t +; + +99  + #__off64_t_defšed + + + ) + +102 #iâdeà +__ssize_t_defšed + + +103  +__ssize_t + + tssize_t +; + +104  + #__ssize_t_defšed + + + ) + +109 +__BEGIN_NAMESPACE_STD + + +110 #iâdeà +__USE_FILE_OFFSET64 + + +111  +_G_åos_t + + tåos_t +; + +113  +_G_åos64_t + + tåos_t +; + +115 +__END_NAMESPACE_STD + + +116 #ifdeà +__USE_LARGEFILE64 + + +117  +_G_åos64_t + + tåos64_t +; + +121  + #_IOFBF + 0 + + ) + +122  + #_IOLBF + 1 + + ) + +123  + #_IONBF + 2 + + ) + +127 #iâdeà +BUFSIZ + + +128  + #BUFSIZ + +_IO_BUFSIZ + + + ) + +134 #iâdeà +EOF + + +135  + #EOF + (-1) + + ) + +141  + #SEEK_SET + 0 + + ) + +142  + #SEEK_CUR + 1 + + ) + +143  + #SEEK_END + 2 + + ) + +146 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +148  + #P_tmpdœ + "/tmp" + + ) + +161  + ~ + +165  +_IO_FILE + * +¡dš +; + +166  +_IO_FILE + * +¡dout +; + +167  +_IO_FILE + * +¡d”r +; + +169  + #¡dš + +¡dš + + + ) + +170  + #¡dout + +¡dout + + + ) + +171  + #¡d”r + +¡d”r + + + ) + +173 +__BEGIN_NAMESPACE_STD + + +175  + $»move + ( +__cÚ¡ + * +__fž’ame +è +__THROW +; + +177  + $»Çme + ( +__cÚ¡ + * +__Þd +, __cÚ¡ * +__Ãw +è +__THROW +; + +178 +__END_NAMESPACE_STD + + +180 #ifdeà +__USE_ATFILE + + +182  + $»Çm—t + ( +__Þdfd +, +__cÚ¡ + * +__Þd +,  +__Ãwfd +, + +183 +__cÚ¡ + * +__Ãw +è +__THROW +; + +186 +__BEGIN_NAMESPACE_STD + + +191 #iâdeà +__USE_FILE_OFFSET64 + + +192 +FILE + * + $tmpfže + (è +__wur +; + +194 #ifdeà +__REDIRECT + + +195 +FILE + * + `__REDIRECT + ( +tmpfže +, (), +tmpfže64 +è +__wur +; + +197  + #tmpfže + +tmpfže64 + + + ) + +201 #ifdeà +__USE_LARGEFILE64 + + +202 +FILE + * + $tmpfže64 + (è +__wur +; + +206 * + $tm²am + (* +__s +è +__THROW + +__wur +; + +207 +__END_NAMESPACE_STD + + +209 #ifdeà +__USE_MISC + + +212 * + $tm²am_r + (* +__s +è +__THROW + +__wur +; + +216 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +224 * + $‹m²am + ( +__cÚ¡ + * +__dœ +, __cÚ¡ * +__pfx +) + +225 +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +229 +__BEGIN_NAMESPACE_STD + + +234  + `fþo£ + ( +FILE + * +__¡»am +); + +239  + `fæush + ( +FILE + * +__¡»am +); + +240 +__END_NAMESPACE_STD + + +242 #ifdeà +__USE_MISC + + +249  + `fæush_uÆocked + ( +FILE + * +__¡»am +); + +252 #ifdeà +__USE_GNU + + +259  + `fþo£®l + (); + +263 +__BEGIN_NAMESPACE_STD + + +264 #iâdeà +__USE_FILE_OFFSET64 + + +269 +FILE + * + $fݒ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +270 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +275 +FILE + * + $äeݒ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +276 +__cÚ¡ + * +__»¡riù + +__modes +, + +277 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +279 #ifdeà +__REDIRECT + + +280 +FILE + * + `__REDIRECT + ( +fݒ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +281 +__cÚ¡ + * +__»¡riù + +__modes +), +fݒ64 +) + +282 +__wur +; + +283 +FILE + * + `__REDIRECT + ( +äeݒ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +284 +__cÚ¡ + * +__»¡riù + +__modes +, + +285 +FILE + * +__»¡riù + +__¡»am +), +äeݒ64 +) + +286 +__wur +; + +288  + #fݒ + +fݒ64 + + + ) + +289  + #äeݒ + +äeݒ64 + + + ) + +292 +__END_NAMESPACE_STD + + +293 #ifdeà +__USE_LARGEFILE64 + + +294 +FILE + * + $fݒ64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +295 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +296 +FILE + * + $äeݒ64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +297 +__cÚ¡ + * +__»¡riù + +__modes +, + +298 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +301 #ifdef +__USE_POSIX + + +303 +FILE + * + $fdݒ + ( +__fd +, +__cÚ¡ + * +__modes +è +__THROW + +__wur +; + +306 #ifdef +__USE_GNU + + +309 +FILE + * + $fݒcook› + (* +__»¡riù + +__magic_cook› +, + +310 +__cÚ¡ + * +__»¡riù + +__modes +, + +311 +_IO_cook›_io_funùiÚs_t + +__io_funcs +è +__THROW + +__wur +; + +314 #ifdeà +__USE_XOPEN2K8 + + +316 +FILE + * + $fmemݒ + (* +__s +, +size_t + +__Ën +, +__cÚ¡ + * +__modes +) + +317 +__THROW + +__wur +; + +322 +FILE + * + $ݒ_mem¡»am + (** +__buæoc +, +size_t + * +__siz–oc +è +__THROW + +__wur +; + +326 +__BEGIN_NAMESPACE_STD + + +329  + $£tbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +è +__THROW +; + +333  + $£tvbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +334  +__modes +, +size_t + +__n +è +__THROW +; + +335 +__END_NAMESPACE_STD + + +337 #ifdef +__USE_BSD + + +340  + $£tbufãr + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +341 +size_t + +__size +è +__THROW +; + +344  + $£Žšebuf + ( +FILE + * +__¡»am +è +__THROW +; + +348 +__BEGIN_NAMESPACE_STD + + +353  + `årštf + ( +FILE + * +__»¡riù + +__¡»am +, + +354 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +359  + `´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +361  + $¥rštf + (* +__»¡riù + +__s +, + +362 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +368  + `vårštf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +369 +_G_va_li¡ + +__¬g +); + +374  + `v´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +); + +376  + $v¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +377 +_G_va_li¡ + +__¬g +è +__THROW +; + +378 +__END_NAMESPACE_STD + + +380 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +381 +__BEGIN_NAMESPACE_C99 + + +383  + $¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +384 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +385 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +387  + $v¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +388 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +389 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +390 +__END_NAMESPACE_C99 + + +393 #ifdeà +__USE_GNU + + +396  + $va¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__f +, + +397 +_G_va_li¡ + +__¬g +) + +398 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 0))è +__wur +; + +399  + $__a¥rštf + (** +__»¡riù + +__±r +, + +400 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +401 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +402  + $a¥rštf + (** +__»¡riù + +__±r +, + +403 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +404 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +407 #ifdeà +__USE_XOPEN2K8 + + +414  + $vd´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, + +415 +_G_va_li¡ + +__¬g +) + +416 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +417  + $d´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +418 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +422 +__BEGIN_NAMESPACE_STD + + +427  + $fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +428 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +433  + $sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +435  + $ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +436 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +438 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +439 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +440 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +441 #ifdeà +__REDIRECT + + +445  + `__REDIRECT + ( +fsÿnf +, ( +FILE + * +__»¡riù + +__¡»am +, + +446 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +447 +__isoc99_fsÿnf +è +__wur +; + +448  + `__REDIRECT + ( +sÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +449 +__isoc99_sÿnf +è +__wur +; + +450  + `__REDIRECT_NTH + ( +ssÿnf +, ( +__cÚ¡ + * +__»¡riù + +__s +, + +451 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +452 +__isoc99_ssÿnf +); + +454  + $__isoc99_fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +455 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +456  + $__isoc99_sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +457  + $__isoc99_ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +458 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +459  + #fsÿnf + +__isoc99_fsÿnf + + + ) + +460  + #sÿnf + +__isoc99_sÿnf + + + ) + +461  + #ssÿnf + +__isoc99_ssÿnf + + + ) + +465 +__END_NAMESPACE_STD + + +467 #ifdef +__USE_ISOC99 + + +468 +__BEGIN_NAMESPACE_C99 + + +473  + $vfsÿnf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +474 +_G_va_li¡ + +__¬g +) + +475 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +481  + $vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +482 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +485  + $vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +486 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +487 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +489 #ià! +defšed + +__USE_GNU + \ + +490 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +491 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +492 #ifdeà +__REDIRECT + + +496  + `__REDIRECT + ( +vfsÿnf +, + +497 ( +FILE + * +__»¡riù + +__s +, + +498 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +), + +499 +__isoc99_vfsÿnf +) + +500 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +501  + `__REDIRECT + ( +vsÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +502 +_G_va_li¡ + +__¬g +), +__isoc99_vsÿnf +) + +503 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +504  + `__REDIRECT_NTH + ( +vssÿnf +, + +505 ( +__cÚ¡ + * +__»¡riù + +__s +, + +506 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +507 +_G_va_li¡ + +__¬g +), +__isoc99_vssÿnf +) + +508 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +510  + $__isoc99_vfsÿnf + ( +FILE + * +__»¡riù + +__s +, + +511 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +512 +_G_va_li¡ + +__¬g +è +__wur +; + +513  + $__isoc99_vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +514 +_G_va_li¡ + +__¬g +è +__wur +; + +515  + $__isoc99_vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +516 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +517 +_G_va_li¡ + +__¬g +è +__THROW +; + +518  + #vfsÿnf + +__isoc99_vfsÿnf + + + ) + +519  + #vsÿnf + +__isoc99_vsÿnf + + + ) + +520  + #vssÿnf + +__isoc99_vssÿnf + + + ) + +524 +__END_NAMESPACE_C99 + + +528 +__BEGIN_NAMESPACE_STD + + +533  + `fg‘c + ( +FILE + * +__¡»am +); + +534  + `g‘c + ( +FILE + * +__¡»am +); + +540  + `g‘ch¬ + (); + +541 +__END_NAMESPACE_STD + + +545  + #g‘c +( +_å +è + `_IO_g‘c + (_å) + + ) + +547 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +552  + `g‘c_uÆocked + ( +FILE + * +__¡»am +); + +553  + `g‘ch¬_uÆocked + (); + +556 #ifdeà +__USE_MISC + + +563  + `fg‘c_uÆocked + ( +FILE + * +__¡»am +); + +567 +__BEGIN_NAMESPACE_STD + + +575  + `åutc + ( +__c +, +FILE + * +__¡»am +); + +576  + `putc + ( +__c +, +FILE + * +__¡»am +); + +582  + `putch¬ + ( +__c +); + +583 +__END_NAMESPACE_STD + + +587  + #putc +( +_ch +, +_å +è + `_IO_putc + (_ch, _å) + + ) + +589 #ifdeà +__USE_MISC + + +596  + `åutc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +599 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +604  + `putc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +605  + `putch¬_uÆocked + ( +__c +); + +609 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + \ + +610 || ( +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K +) + +612  + `g‘w + ( +FILE + * +__¡»am +); + +615  + `putw + ( +__w +, +FILE + * +__¡»am +); + +619 +__BEGIN_NAMESPACE_STD + + +624 * + $fg‘s + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +625 +__wur +; + +632 * + $g‘s + (* +__s +è +__wur +; + +633 +__END_NAMESPACE_STD + + +635 #ifdeà +__USE_GNU + + +642 * + $fg‘s_uÆocked + (* +__»¡riù + +__s +,  +__n +, + +643 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +647 #ifdef +__USE_XOPEN2K8 + + +658 +_IO_ssize_t + + $__g‘d–im + (** +__»¡riù + +__lš•Œ +, + +659 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +660 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +661 +_IO_ssize_t + + $g‘d–im + (** +__»¡riù + +__lš•Œ +, + +662 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +663 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +671 +_IO_ssize_t + + $g‘lše + (** +__»¡riù + +__lš•Œ +, + +672 +size_t + * +__»¡riù + +__n +, + +673 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +677 +__BEGIN_NAMESPACE_STD + + +682  + `åuts + ( +__cÚ¡ + * +__»¡riù + +__s +, +FILE + *__»¡riù +__¡»am +); + +688  + `puts + ( +__cÚ¡ + * +__s +); + +695  + `ung‘c + ( +__c +, +FILE + * +__¡»am +); + +702 +size_t + + $ä—d + (* +__»¡riù + +__±r +, +size_t + +__size +, + +703 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +708 +size_t + + `fwr™e + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +709 +size_t + +__n +, +FILE + * +__»¡riù + +__s +); + +710 +__END_NAMESPACE_STD + + +712 #ifdeà +__USE_GNU + + +719  + `åuts_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__s +, + +720 +FILE + * +__»¡riù + +__¡»am +); + +723 #ifdeà +__USE_MISC + + +730 +size_t + + $ä—d_uÆocked + (* +__»¡riù + +__±r +, +size_t + +__size +, + +731 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +732 +size_t + + `fwr™e_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +733 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +); + +737 +__BEGIN_NAMESPACE_STD + + +742  + `f£ek + ( +FILE + * +__¡»am +,  +__off +,  +__wh’û +); + +747  + $á–l + ( +FILE + * +__¡»am +è +__wur +; + +752  + `»wšd + ( +FILE + * +__¡»am +); + +753 +__END_NAMESPACE_STD + + +760 #ià +defšed + +__USE_LARGEFILE + || defšed +__USE_XOPEN2K + + +761 #iâdeà +__USE_FILE_OFFSET64 + + +766  + `f£eko + ( +FILE + * +__¡»am +, +__off_t + +__off +,  +__wh’û +); + +771 +__off_t + + $á–lo + ( +FILE + * +__¡»am +è +__wur +; + +773 #ifdeà +__REDIRECT + + +774  + `__REDIRECT + ( +f£eko +, + +775 ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +), + +776 +f£eko64 +); + +777 +__off64_t + + `__REDIRECT + ( +á–lo +, ( +FILE + * +__¡»am +), +á–lo64 +); + +779  + #f£eko + +f£eko64 + + + ) + +780  + #á–lo + +á–lo64 + + + ) + +785 +__BEGIN_NAMESPACE_STD + + +786 #iâdeà +__USE_FILE_OFFSET64 + + +791  + `fg‘pos + ( +FILE + * +__»¡riù + +__¡»am +, +åos_t + *__»¡riù +__pos +); + +796  + `f£os + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +); + +798 #ifdeà +__REDIRECT + + +799  + `__REDIRECT + ( +fg‘pos +, ( +FILE + * +__»¡riù + +__¡»am +, + +800 +åos_t + * +__»¡riù + +__pos +), +fg‘pos64 +); + +801  + `__REDIRECT + ( +f£os +, + +802 ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +), +f£os64 +); + +804  + #fg‘pos + +fg‘pos64 + + + ) + +805  + #f£os + +f£os64 + + + ) + +808 +__END_NAMESPACE_STD + + +810 #ifdeà +__USE_LARGEFILE64 + + +811  + `f£eko64 + ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +); + +812 +__off64_t + + $á–lo64 + ( +FILE + * +__¡»am +è +__wur +; + +813  + `fg‘pos64 + ( +FILE + * +__»¡riù + +__¡»am +, +åos64_t + *__»¡riù +__pos +); + +814  + `f£os64 + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos64_t + * +__pos +); + +817 +__BEGIN_NAMESPACE_STD + + +819  + $þ—»¼ + ( +FILE + * +__¡»am +è +__THROW +; + +821  + $ãof + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +823  + $ã¼Ü + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +824 +__END_NAMESPACE_STD + + +826 #ifdeà +__USE_MISC + + +828  + $þ—»¼_uÆocked + ( +FILE + * +__¡»am +è +__THROW +; + +829  + $ãof_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +830  + $ã¼Ü_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +834 +__BEGIN_NAMESPACE_STD + + +839  + `³¼Ü + ( +__cÚ¡ + * +__s +); + +840 +__END_NAMESPACE_STD + + +846  + ~ + +849 #ifdef +__USE_POSIX + + +851  + $fž’o + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +854 #ifdeà +__USE_MISC + + +856  + $fž’o_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +860 #ià( +defšed + +__USE_POSIX2 + || defšed +__USE_SVID + || defšed +__USE_BSD + || \ + +861 +defšed + +__USE_MISC +) + +866 +FILE + * + $pݒ + ( +__cÚ¡ + * +__commªd +, __cÚ¡ * +__modes +è +__wur +; + +872  + `pþo£ + ( +FILE + * +__¡»am +); + +876 #ifdef +__USE_POSIX + + +878 * + $ù”mid + (* +__s +è +__THROW +; + +882 #ifdeà +__USE_XOPEN + + +884 * + `cu£rid + (* +__s +); + +888 #ifdef +__USE_GNU + + +889  +ob¡ack +; + +892  + $ob¡ack_´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +893 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +894 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +895  + $ob¡ack_v´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +896 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +897 +_G_va_li¡ + +__¬gs +) + +898 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +902 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +906  + $æockfže + ( +FILE + * +__¡»am +è +__THROW +; + +910  + $árylockfže + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +913  + $fuÆockfže + ( +FILE + * +__¡»am +è +__THROW +; + +916 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K + && !defšed +__USE_GNU + + +920  + #__Ãed_g‘Ýt + + + ) + +921  + ~ + +926 #ifdeà +__USE_EXTERN_INLINES + + +927  + ~ + +929 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +930  + ~ + +932 #ifdeà +__LDBL_COMPAT + + +933  + ~ + +936 +__END_DECLS + + + @/usr/include/stdlib.h + +23 #iâdef +_STDLIB_H + + +25  + ~<ã©u»s.h +> + +28  + #__Ãed_size_t + + + ) + +29 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +30  + #__Ãed_wch¬_t + + + ) + +31  + #__Ãed_NULL + + + ) + +33  + ~<¡ddef.h +> + +35 + g__BEGIN_DECLS + + +37 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +38  + #_STDLIB_H + 1 + + ) + +40 #ià( +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K8 +è&& !defšed +_SYS_WAIT_H + + +42  + ~ + +43  + ~ + +45 #ifdeà +__USE_BSD + + +50 #ià +defšed + +__GNUC__ + && !defšed +__ýlu¥lus + + +51  + #__WAIT_INT +( +¡©us +) \ + +52 ( + `__ex‹nsiÚ__ + (((uniÚ { + `__ty³of +( +¡©us +è +__š +;  +__i +; }) \ + +53 { . +__š + = ( +¡©us +è}). +__i +)) + + ) + +55  + #__WAIT_INT +( +¡©us +è(*(*è&(¡©us)) + + ) + +63 #ià! +defšed + +__GNUC__ + || __GNUC__ < 2 || defšed +__ýlu¥lus + + +64  + #__WAIT_STATUS + * + + ) + +65  + #__WAIT_STATUS_DEFN + * + + ) + +70  +wa™ + * + m__u±r +; + +71 * + m__Œ +; + +72 } + t__WAIT_STATUS + + t__©Œibu‹__ + (( + t__Œª¥¬’t_uniÚ__ +)); + +73  + #__WAIT_STATUS_DEFN + * + + ) + +78  + #__WAIT_INT +( +¡©us +è(¡©us) + + ) + +79  + #__WAIT_STATUS + * + + ) + +80  + #__WAIT_STATUS_DEFN + * + + ) + +85  + #WEXITSTATUS +( +¡©us +è + `__WEXITSTATUS + ( + `__WAIT_INT + (¡©us)) + + ) + +86  + #WTERMSIG +( +¡©us +è + `__WTERMSIG + ( + `__WAIT_INT + (¡©us)) + + ) + +87  + #WSTOPSIG +( +¡©us +è + `__WSTOPSIG + ( + `__WAIT_INT + (¡©us)) + + ) + +88  + #WIFEXITED +( +¡©us +è + `__WIFEXITED + ( + `__WAIT_INT + (¡©us)) + + ) + +89  + #WIFSIGNALED +( +¡©us +è + `__WIFSIGNALED + ( + `__WAIT_INT + (¡©us)) + + ) + +90  + #WIFSTOPPED +( +¡©us +è + `__WIFSTOPPED + ( + `__WAIT_INT + (¡©us)) + + ) + +91 #ifdeà +__WIFCONTINUED + + +92  + #WIFCONTINUED +( +¡©us +è + `__WIFCONTINUED + ( + `__WAIT_INT + (¡©us)) + + ) + +96 +__BEGIN_NAMESPACE_STD + + +100  + mquÙ +; + +101  + m»m +; + +102 } + tdiv_t +; + +105 #iâdeà +__ldiv_t_defšed + + +108  + mquÙ +; + +109  + m»m +; + +110 } + tldiv_t +; + +111  + #__ldiv_t_defšed + 1 + + ) + +113 + g__END_NAMESPACE_STD + + +115 #ià +defšed + +__USE_ISOC99 + && !defšed +__Îdiv_t_defšed + + +116 +__BEGIN_NAMESPACE_C99 + + +118 +__ex‹nsiÚ__ + struct + +120  + mquÙ +; + +121  + m»m +; + +122 } + tÎdiv_t +; + +123  + #__Îdiv_t_defšed + 1 + + ) + +124 + g__END_NAMESPACE_C99 + + +129  + #RAND_MAX + 2147483647 + + ) + +134  + #EXIT_FAILURE + 1 + + ) + +135  + #EXIT_SUCCESS + 0 + + ) + +139  + #MB_CUR_MAX + ( + `__ùy³_g‘_mb_cur_max + ()) + + ) + +140 +size_t + + $__ùy³_g‘_mb_cur_max + (è +__THROW + +__wur +; + +143 +__BEGIN_NAMESPACE_STD + + +145  + $©of + ( +__cÚ¡ + * +__Ō +) + +146 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +148  + $©oi + ( +__cÚ¡ + * +__Ō +) + +149 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +151  + $©Þ + ( +__cÚ¡ + * +__Ō +) + +152 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +153 +__END_NAMESPACE_STD + + +155 #ià +defšed + +__USE_ISOC99 + || (defšed +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_MISC +) + +156 +__BEGIN_NAMESPACE_C99 + + +158 +__ex‹nsiÚ__ +  + $©Þl + ( +__cÚ¡ + * +__Ō +) + +159 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +160 +__END_NAMESPACE_C99 + + +163 +__BEGIN_NAMESPACE_STD + + +165  + $¡¹od + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +166 ** +__»¡riù + +__’d±r +) + +167 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +168 +__END_NAMESPACE_STD + + +170 #ifdef +__USE_ISOC99 + + +171 +__BEGIN_NAMESPACE_C99 + + +173  + $¡¹of + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +174 ** +__»¡riù + +__’d±r +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +176  + $¡¹Þd + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +177 ** +__»¡riù + +__’d±r +) + +178 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +179 +__END_NAMESPACE_C99 + + +182 +__BEGIN_NAMESPACE_STD + + +184  + $¡¹Þ + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +185 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +186 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +188  + $¡¹oul + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +189 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +190 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +191 +__END_NAMESPACE_STD + + +193 #ià +defšed + +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_BSD + + +195 +__ex‹nsiÚ__ + + +196  + $¡¹oq + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +197 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +198 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +200 +__ex‹nsiÚ__ + + +201  + $¡¹ouq + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +202 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +203 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +206 #ià +defšed + +__USE_ISOC99 + || (defšed +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_MISC +) + +207 +__BEGIN_NAMESPACE_C99 + + +209 +__ex‹nsiÚ__ + + +210  + $¡¹Þl + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +211 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +212 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +214 +__ex‹nsiÚ__ + + +215  + $¡¹ouÎ + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +216 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +217 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +218 +__END_NAMESPACE_C99 + + +222 #ifdeà +__USE_GNU + + +236  + ~ + +240  + $¡¹Þ_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +241 ** +__»¡riù + +__’d±r +,  +__ba£ +, + +242 +__loÿË_t + +__loc +è +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +244  + $¡¹oul_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +245 ** +__»¡riù + +__’d±r +, + +246  +__ba£ +, +__loÿË_t + +__loc +) + +247 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +249 +__ex‹nsiÚ__ + + +250  + $¡¹Þl_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +251 ** +__»¡riù + +__’d±r +,  +__ba£ +, + +252 +__loÿË_t + +__loc +) + +253 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +255 +__ex‹nsiÚ__ + + +256  + $¡¹ouÎ_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +257 ** +__»¡riù + +__’d±r +, + +258  +__ba£ +, +__loÿË_t + +__loc +) + +259 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +261  + $¡¹od_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +262 ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +263 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +265  + $¡¹of_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +266 ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +267 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +269  + $¡¹Þd_l + ( +__cÚ¡ + * +__»¡riù + +__Ō +, + +270 ** +__»¡riù + +__’d±r +, + +271 +__loÿË_t + +__loc +) + +272 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +276 #ifdeà +__USE_EXTERN_INLINES + + +277 +__BEGIN_NAMESPACE_STD + + +278 +__ex‹º_šlše +  + +279 + `__NTH + ( + $©of + ( +__cÚ¡ + * +__Ō +)) + +281  + `¡¹od + ( +__Ō +, (**è +NULL +); + +282 + } +} + +283 +__ex‹º_šlše +  + +284 +__NTH + ( + $©oi + ( +__cÚ¡ + * +__Ō +)) + +286  (è + `¡¹Þ + ( +__Ō +, (**è +NULL +, 10); + +287 + } +} + +288 +__ex‹º_šlše +  + +289 +__NTH + ( + $©Þ + ( +__cÚ¡ + * +__Ō +)) + +291  + `¡¹Þ + ( +__Ō +, (**è +NULL +, 10); + +292 + } +} + +293 + g__END_NAMESPACE_STD + + +295 #ià +defšed + +__USE_MISC + || defšed +__USE_ISOC99 + + +296 +__BEGIN_NAMESPACE_C99 + + +297 +__ex‹nsiÚ__ + +__ex‹º_šlše +  + +298 +__NTH + ( + $©Þl + ( +__cÚ¡ + * +__Ō +)) + +300  + `¡¹Þl + ( +__Ō +, (**è +NULL +, 10); + +301 + } +} + +302 + g__END_NAMESPACE_C99 + + +307 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + + +311 * + $l64a + ( +__n +è +__THROW + +__wur +; + +314  + $a64l + ( +__cÚ¡ + * +__s +) + +315 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +319 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_BSD + + +320  + ~ + +327  + $¿ndom + (è +__THROW +; + +330  + $¤ªdom + ( +__£ed +è +__THROW +; + +336 * + $š™¡©e + ( +__£ed +, * +__¡©ebuf +, + +337 +size_t + +__¡©–’ +è +__THROW + + `__nÚnuÎ + ((2)); + +341 * + $£t¡©e + (* +__¡©ebuf +è +__THROW + + `__nÚnuÎ + ((1)); + +344 #ifdeà +__USE_MISC + + +349  + s¿ndom_d©a + + +351 +št32_t + * +åŒ +; + +352 +št32_t + * +½Œ +; + +353 +št32_t + * +¡©e +; + +354  +¿nd_ty³ +; + +355  +¿nd_deg +; + +356  +¿nd_£p +; + +357 +št32_t + * +’d_±r +; + +360  + $¿ndom_r + ( +¿ndom_d©a + * +__»¡riù + +__buf +, + +361 +št32_t + * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +363  + $¤ªdom_r + ( +__£ed +,  +¿ndom_d©a + * +__buf +) + +364 +__THROW + + `__nÚnuÎ + ((2)); + +366  + $š™¡©e_r + ( +__£ed +, * +__»¡riù + +__¡©ebuf +, + +367 +size_t + +__¡©–’ +, + +368  +¿ndom_d©a + * +__»¡riù + +__buf +) + +369 +__THROW + + `__nÚnuÎ + ((2, 4)); + +371  + $£t¡©e_r + (* +__»¡riù + +__¡©ebuf +, + +372  +¿ndom_d©a + * +__»¡riù + +__buf +) + +373 +__THROW + + `__nÚnuÎ + ((1, 2)); + +378 +__BEGIN_NAMESPACE_STD + + +380  + $¿nd + (è +__THROW +; + +382  + $¤ªd + ( +__£ed +è +__THROW +; + +383 +__END_NAMESPACE_STD + + +385 #ifdeà +__USE_POSIX + + +387  + $¿nd_r + (* +__£ed +è +__THROW +; + +391 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +395  + $d¿nd48 + (è +__THROW +; + +396  + $”ªd48 + ( +__xsubi +[3]è +__THROW + + `__nÚnuÎ + ((1)); + +399  + $̪d48 + (è +__THROW +; + +400  + $Īd48 + ( +__xsubi +[3]) + +401 +__THROW + + `__nÚnuÎ + ((1)); + +404  + $m¿nd48 + (è +__THROW +; + +405  + $j¿nd48 + ( +__xsubi +[3]) + +406 +__THROW + + `__nÚnuÎ + ((1)); + +409  + $¤ªd48 + ( +__£edv® +è +__THROW +; + +410 * + $£ed48 + ( +__£ed16v +[3]) + +411 +__THROW + + `__nÚnuÎ + ((1)); + +412  + $lcÚg48 + ( +__·¿m +[7]è +__THROW + + `__nÚnuÎ + ((1)); + +414 #ifdeà +__USE_MISC + + +418  + sd¿nd48_d©a + + +420  +__x +[3]; + +421  +__Þd_x +[3]; + +422  +__c +; + +423  +__š™ +; + +424  +__a +; + +428  + $d¿nd48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +429 * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +430  + $”ªd48_r + ( +__xsubi +[3], + +431  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +432 * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +435  + $̪d48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +436 * +__»¡riù + +__»suÉ +) + +437 +__THROW + + `__nÚnuÎ + ((1, 2)); + +438  + $Īd48_r + ( +__xsubi +[3], + +439  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +440 * +__»¡riù + +__»suÉ +) + +441 +__THROW + + `__nÚnuÎ + ((1, 2)); + +444  + $m¿nd48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +445 * +__»¡riù + +__»suÉ +) + +446 +__THROW + + `__nÚnuÎ + ((1, 2)); + +447  + $j¿nd48_r + ( +__xsubi +[3], + +448  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +449 * +__»¡riù + +__»suÉ +) + +450 +__THROW + + `__nÚnuÎ + ((1, 2)); + +453  + $¤ªd48_r + ( +__£edv® +,  +d¿nd48_d©a + * +__bufãr +) + +454 +__THROW + + `__nÚnuÎ + ((2)); + +456  + $£ed48_r + ( +__£ed16v +[3], + +457  +d¿nd48_d©a + * +__bufãr +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +459  + $lcÚg48_r + ( +__·¿m +[7], + +460  +d¿nd48_d©a + * +__bufãr +) + +461 +__THROW + + `__nÚnuÎ + ((1, 2)); + +467 #iâdeà +__m®loc_ªd_ÿÎoc_defšed + + +468  + #__m®loc_ªd_ÿÎoc_defšed + + + ) + +469 +__BEGIN_NAMESPACE_STD + + +471 * + $m®loc + ( +size_t + +__size +è +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +473 * + $ÿÎoc + ( +size_t + +__nmemb +, size_ˆ +__size +) + +474 +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +475 +__END_NAMESPACE_STD + + +478 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +479 +__BEGIN_NAMESPACE_STD + + +485 * + $»®loc + (* +__±r +, +size_t + +__size +) + +486 +__THROW + +__©Œibu‹_w¬n_unu£d_»suÉ__ +; + +488  + $ä“ + (* +__±r +è +__THROW +; + +489 +__END_NAMESPACE_STD + + +491 #ifdef +__USE_MISC + + +493  + $cä“ + (* +__±r +è +__THROW +; + +496 #ià +defšed + +__USE_GNU + || defšed +__USE_BSD + || defšed +__USE_MISC + + +497  + ~<®loÿ.h +> + +500 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K +) \ + +501 || +defšed + +__USE_BSD + + +503 * + $v®loc + ( +size_t + +__size +è +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +506 #ifdeà +__USE_XOPEN2K + + +508  + $posix_mem®ign + (** +__mem±r +, +size_t + +__®ignm’t +, size_ˆ +__size +) + +509 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +512 +__BEGIN_NAMESPACE_STD + + +514  + $abÜt + (è +__THROW + + `__©Œibu‹__ + (( +__nܑuº__ +)); + +518  + `©ex™ + ((* +__func +è()è +__THROW + + `__nÚnuÎ + ((1)); + +520 #ifdeà +__USE_GNU + + +524 #ifdeà +__ýlu¥lus + + +525 "C++"  + `©_quick_ex™ + ((* +__func +) ()) + +526 +__THROW + + `__asm + ("©_quick_ex™"è + `__nÚnuÎ + ((1)); + +528  + `©_quick_ex™ + ((* +__func +è()è +__THROW + + `__nÚnuÎ + ((1)); + +531 +__END_NAMESPACE_STD + + +533 #ifdef +__USE_MISC + + +536  + `Ú_ex™ + ((* +__func +è( +__¡©us +, * +__¬g +), *__arg) + +537 +__THROW + + `__nÚnuÎ + ((1)); + +540 +__BEGIN_NAMESPACE_STD + + +544  + $ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nܑuº__ +)); + +546 #ifdeà +__USE_GNU + + +552  + $quick_ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nܑuº__ +)); + +554 +__END_NAMESPACE_STD + + +556 #ifdeà +__USE_ISOC99 + + +557 +__BEGIN_NAMESPACE_C99 + + +560  + $_Ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nܑuº__ +)); + +561 +__END_NAMESPACE_C99 + + +565 +__BEGIN_NAMESPACE_STD + + +567 * + $g‘’v + ( +__cÚ¡ + * +__Çme +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +568 +__END_NAMESPACE_STD + + +572 * + $__£cu»_g‘’v + ( +__cÚ¡ + * +__Çme +) + +573 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +575 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +579  + $pu‹nv + (* +__¡ršg +è +__THROW + + `__nÚnuÎ + ((1)); + +582 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K + + +585  + $£‹nv + ( +__cÚ¡ + * +__Çme +, __cÚ¡ * +__v®ue +,  +__»¶aû +) + +586 +__THROW + + `__nÚnuÎ + ((2)); + +589  + $un£‹nv + ( +__cÚ¡ + * +__Çme +è +__THROW + + `__nÚnuÎ + ((1)); + +592 #ifdef +__USE_MISC + + +596  + $þ—»nv + (è +__THROW +; + +600 #ià +defšed + +__USE_MISC + \ + +601 || ( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K +) + +606 * + $mk‹mp + (* +__‹m¶©e +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +609 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + \ + +610 || +defšed + +__USE_XOPEN2K8 + + +619 #iâdeà +__USE_FILE_OFFSET64 + + +620  + $mk¡emp + (* +__‹m¶©e +è + `__nÚnuÎ + ((1)è +__wur +; + +622 #ifdeà +__REDIRECT + + +623  + `__REDIRECT + ( +mk¡emp +, (* +__‹m¶©e +), +mk¡emp64 +) + +624 + `__nÚnuÎ + ((1)è +__wur +; + +626  + #mk¡emp + +mk¡emp64 + + + ) + +629 #ifdeà +__USE_LARGEFILE64 + + +630  + $mk¡emp64 + (* +__‹m¶©e +è + `__nÚnuÎ + ((1)è +__wur +; + +634 #ifdeà +__USE_MISC + + +641 #iâdeà +__USE_FILE_OFFSET64 + + +642  + $mk¡emps + (* +__‹m¶©e +,  +__suffixËn +è + `__nÚnuÎ + ((1)è +__wur +; + +644 #ifdeà +__REDIRECT + + +645  + `__REDIRECT + ( +mk¡emps +, (* +__‹m¶©e +,  +__suffixËn +), + +646 +mk¡emps64 +è + `__nÚnuÎ + ((1)è +__wur +; + +648  + #mk¡emps + +mk¡emps64 + + + ) + +651 #ifdeà +__USE_LARGEFILE64 + + +652  + $mk¡emps64 + (* +__‹m¶©e +,  +__suffixËn +) + +653 + `__nÚnuÎ + ((1)è +__wur +; + +657 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K8 + + +663 * + $mkd‹mp + (* +__‹m¶©e +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +666 #ifdeà +__USE_GNU + + +673 #iâdeà +__USE_FILE_OFFSET64 + + +674  + $mko¡emp + (* +__‹m¶©e +,  +__æags +è + `__nÚnuÎ + ((1)è +__wur +; + +676 #ifdeà +__REDIRECT + + +677  + `__REDIRECT + ( +mko¡emp +, (* +__‹m¶©e +,  +__æags +), +mko¡emp64 +) + +678 + `__nÚnuÎ + ((1)è +__wur +; + +680  + #mko¡emp + +mko¡emp64 + + + ) + +683 #ifdeà +__USE_LARGEFILE64 + + +684  + $mko¡emp64 + (* +__‹m¶©e +,  +__æags +è + `__nÚnuÎ + ((1)è +__wur +; + +693 #iâdeà +__USE_FILE_OFFSET64 + + +694  + $mko¡emps + (* +__‹m¶©e +,  +__suffixËn +,  +__æags +) + +695 + `__nÚnuÎ + ((1)è +__wur +; + +697 #ifdeà +__REDIRECT + + +698  + `__REDIRECT + ( +mko¡emps +, (* +__‹m¶©e +,  +__suffixËn +, + +699  +__æags +), +mko¡emps64 +) + +700 + `__nÚnuÎ + ((1)è +__wur +; + +702  + #mko¡emps + +mko¡emps64 + + + ) + +705 #ifdeà +__USE_LARGEFILE64 + + +706  + $mko¡emps64 + (* +__‹m¶©e +,  +__suffixËn +,  +__æags +) + +707 + `__nÚnuÎ + ((1)è +__wur +; + +712 +__BEGIN_NAMESPACE_STD + + +717  + $sy¡em + ( +__cÚ¡ + * +__commªd +è +__wur +; + +718 +__END_NAMESPACE_STD + + +721 #ifdef +__USE_GNU + + +724 * + $ÿnÚiÿlize_fže_Çme + ( +__cÚ¡ + * +__Çme +) + +725 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +728 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +734 * + $»®·th + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +735 * +__»¡riù + +__»sÞved +è +__THROW + +__wur +; + +740 #iâdeà +__COMPAR_FN_T + + +741  + #__COMPAR_FN_T + + + ) + +742 (* + t__com·r_â_t +è( + t__cÚ¡ + *, __const *); + +744 #ifdef +__USE_GNU + + +745  +__com·r_â_t + + tcom·risÚ_â_t +; + +748 #ifdeà +__USE_GNU + + +749 (* + t__com·r_d_â_t +è( + t__cÚ¡ + *, __const *, *); + +752 +__BEGIN_NAMESPACE_STD + + +755 * + $b£¬ch + ( +__cÚ¡ + * +__key +, __cÚ¡ * +__ba£ +, + +756 +size_t + +__nmemb +, size_ˆ +__size +, +__com·r_â_t + +__com·r +) + +757 + `__nÚnuÎ + ((1, 2, 5)è +__wur +; + +761  + $qsÜt + (* +__ba£ +, +size_t + +__nmemb +, size_ˆ +__size +, + +762 +__com·r_â_t + +__com·r +è + `__nÚnuÎ + ((1, 4)); + +763 #ifdeà +__USE_GNU + + +764  + $qsÜt_r + (* +__ba£ +, +size_t + +__nmemb +, size_ˆ +__size +, + +765 +__com·r_d_â_t + +__com·r +, * +__¬g +) + +766 + `__nÚnuÎ + ((1, 4)); + +771  + $abs + ( +__x +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +772  + $Ïbs + ( +__x +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +773 +__END_NAMESPACE_STD + + +775 #ifdeà +__USE_ISOC99 + + +776 +__ex‹nsiÚ__ +  + $Îabs + ( +__x +) + +777 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +781 +__BEGIN_NAMESPACE_STD + + +785 +div_t + + $div + ( +__num” +,  +__d’om +) + +786 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +787 +ldiv_t + + $ldiv + ( +__num” +,  +__d’om +) + +788 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +789 +__END_NAMESPACE_STD + + +791 #ifdeà +__USE_ISOC99 + + +792 +__BEGIN_NAMESPACE_C99 + + +793 +__ex‹nsiÚ__ + +Îdiv_t + + $Îdiv + ( +__num” +, + +794  +__d’om +) + +795 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +796 +__END_NAMESPACE_C99 + + +800 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K +) \ + +801 || +defšed + +__USE_SVID + + +808 * + $ecvt + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +809 * +__»¡riù + +__sign +è +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +814 * + $fcvt + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +815 * +__»¡riù + +__sign +è +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +820 * + $gcvt + ( +__v®ue +,  +__ndig™ +, * +__buf +) + +821 +__THROW + + `__nÚnuÎ + ((3)è +__wur +; + +824 #ifdeà +__USE_MISC + + +826 * + $qecvt + ( +__v®ue +,  +__ndig™ +, + +827 * +__»¡riù + +__deýt +, *__»¡riù +__sign +) + +828 +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +829 * + $qfcvt + ( +__v®ue +,  +__ndig™ +, + +830 * +__»¡riù + +__deýt +, *__»¡riù +__sign +) + +831 +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +832 * + $qgcvt + ( +__v®ue +,  +__ndig™ +, * +__buf +) + +833 +__THROW + + `__nÚnuÎ + ((3)è +__wur +; + +838  + $ecvt_r + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +839 * +__»¡riù + +__sign +, *__»¡riù +__buf +, + +840 +size_t + +__Ën +è +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +841  + $fcvt_r + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +842 * +__»¡riù + +__sign +, *__»¡riù +__buf +, + +843 +size_t + +__Ën +è +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +845  + $qecvt_r + ( +__v®ue +,  +__ndig™ +, + +846 * +__»¡riù + +__deýt +, *__»¡riù +__sign +, + +847 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +848 +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +849  + $qfcvt_r + ( +__v®ue +,  +__ndig™ +, + +850 * +__»¡riù + +__deýt +, *__»¡riù +__sign +, + +851 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +852 +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +857 +__BEGIN_NAMESPACE_STD + + +860  + $mbËn + ( +__cÚ¡ + * +__s +, +size_t + +__n +è +__THROW + +__wur +; + +863  + $mbtowc + ( +wch¬_t + * +__»¡riù + +__pwc +, + +864 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +è +__THROW + +__wur +; + +867  + $wùomb + (* +__s +, +wch¬_t + +__wch¬ +è +__THROW + +__wur +; + +871 +size_t + + $mb¡owcs + ( +wch¬_t + * +__»¡riù + +__pwcs +, + +872 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +è +__THROW +; + +874 +size_t + + $wc¡ombs + (* +__»¡riù + +__s +, + +875 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__pwcs +, +size_t + +__n +) + +876 +__THROW +; + +877 +__END_NAMESPACE_STD + + +880 #ifdeà +__USE_SVID + + +885  + $½m©ch + ( +__cÚ¡ + * +__»¥Ú£ +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +889 #ià +defšed + +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +896  + $g‘subÝt + (** +__»¡riù + +__ÝtiÚp +, + +897 * +__cÚ¡ + * +__»¡riù + +__tok’s +, + +898 ** +__»¡riù + +__v®u• +) + +899 +__THROW + + `__nÚnuÎ + ((1, 2, 3)è +__wur +; + +903 #ifdeà +__USE_XOPEN + + +905  + $£tkey + ( +__cÚ¡ + * +__key +è +__THROW + + `__nÚnuÎ + ((1)); + +911 #ifdeà +__USE_XOPEN2KXSI + + +913  + $posix_ݒ± + ( +__oæag +è +__wur +; + +916 #ifdeà +__USE_XOPEN + + +921  + $g¿Á± + ( +__fd +è +__THROW +; + +925  + $uÆock± + ( +__fd +è +__THROW +; + +930 * + $±¢ame + ( +__fd +è +__THROW + +__wur +; + +933 #ifdeà +__USE_GNU + + +937  + $±¢ame_r + ( +__fd +, * +__buf +, +size_t + +__buæ’ +) + +938 +__THROW + + `__nÚnuÎ + ((2)); + +941  + `g‘± + (); + +944 #ifdeà +__USE_BSD + + +948  + $g‘lßdavg + ( +__lßdavg +[],  +__ÃËm +) + +949 +__THROW + + `__nÚnuÎ + ((1)); + +954 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +955  + ~ + +957 #ifdeà +__LDBL_COMPAT + + +958  + ~ + +962 #undeà +__Ãed_m®loc_ªd_ÿÎoc + + +964 +__END_DECLS + + + @/usr/include/string.h + +24 #iâdef +_STRING_H + + +25  + #_STRING_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +29 + g__BEGIN_DECLS + + +32  + #__Ãed_size_t + + + ) + +33  + #__Ãed_NULL + + + ) + +34  + ~<¡ddef.h +> + +37 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (4, 4) + +38  + #__CORRECT_ISO_CPP_STRING_H_PROTO + + + ) + +42 +__BEGIN_NAMESPACE_STD + + +44 * + $memýy + (* +__»¡riù + +__de¡ +, + +45 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +46 +__THROW + + `__nÚnuÎ + ((1, 2)); + +49 * + $memmove + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +) + +50 +__THROW + + `__nÚnuÎ + ((1, 2)); + +51 +__END_NAMESPACE_STD + + +56 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN + + +57 * + $memcýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +58  +__c +, +size_t + +__n +) + +59 +__THROW + + `__nÚnuÎ + ((1, 2)); + +63 +__BEGIN_NAMESPACE_STD + + +65 * + $mem£t + (* +__s +,  +__c +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +68  + $memcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +69 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +72 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +75 * + `memchr + (* +__s +,  +__c +, +size_t + +__n +) + +76 +__THROW + + `__asm + ("memchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +77 +__cÚ¡ + * + `memchr + (__cÚ¡ * +__s +,  +__c +, +size_t + +__n +) + +78 +__THROW + + `__asm + ("memchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +80 #ifdeà +__OPTIMIZE__ + + +81 +__ex‹º_®ways_šlše + * + +82 + `memchr + (* +__s +,  +__c +, +size_t + +__n +è +__THROW + + +84  + `__bužtš_memchr + ( +__s +, +__c +, +__n +); + +87 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +88 + `memchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +è +__THROW + + +90  + `__bužtš_memchr + ( +__s +, +__c +, +__n +); + +93 + } +} + +95 * + $memchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +96 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +98 +__END_NAMESPACE_STD + + +100 #ifdeà +__USE_GNU + + +103 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +104 "C++" * + $¿wmemchr + (* +__s +,  +__c +) + +105 +__THROW + + `__asm + ("¿wmemchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +106 "C++" +__cÚ¡ + * + $¿wmemchr + ( +__cÚ¡ + * +__s +,  +__c +) + +107 +__THROW + + `__asm + ("¿wmemchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +109 * + $¿wmemchr + ( +__cÚ¡ + * +__s +,  +__c +) + +110 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +114 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +115 "C++" * + $memrchr + (* +__s +,  +__c +, +size_t + +__n +) + +116 +__THROW + + `__asm + ("memrchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +117 "C++" +__cÚ¡ + * + $memrchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +118 +__THROW + + `__asm + ("memrchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +120 * + $memrchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +121 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +126 +__BEGIN_NAMESPACE_STD + + +128 * + $¡rýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +129 +__THROW + + `__nÚnuÎ + ((1, 2)); + +131 * + $¡ºýy + (* +__»¡riù + +__de¡ +, + +132 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +133 +__THROW + + `__nÚnuÎ + ((1, 2)); + +136 * + $¡rÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +137 +__THROW + + `__nÚnuÎ + ((1, 2)); + +139 * + $¡ºÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +140 +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +143  + $¡rcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +144 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +146  + $¡ºcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +147 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +150  + $¡rcÞl + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +151 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +153 +size_t + + $¡rxäm + (* +__»¡riù + +__de¡ +, + +154 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +155 +__THROW + + `__nÚnuÎ + ((2)); + +156 +__END_NAMESPACE_STD + + +158 #ifdeà +__USE_XOPEN2K8 + + +162  + ~ + +165  + $¡rcÞl_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +__loÿË_t + +__l +) + +166 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 3)); + +168 +size_t + + $¡rxäm_l + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +, + +169 +__loÿË_t + +__l +è +__THROW + + `__nÚnuÎ + ((2, 4)); + +172 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + \ + +173 || +defšed + +__USE_XOPEN2K8 + + +175 * + $¡rdup + ( +__cÚ¡ + * +__s +) + +176 +__THROW + +__©Œibu‹_m®loc__ + + `__nÚnuÎ + ((1)); + +182 #ià +defšed + +__USE_XOPEN2K8 + + +183 * + $¡ºdup + ( +__cÚ¡ + * +__¡ršg +, +size_t + +__n +) + +184 +__THROW + +__©Œibu‹_m®loc__ + + `__nÚnuÎ + ((1)); + +187 #ià +defšed + +__USE_GNU + && defšed +__GNUC__ + + +189  + #¡rdu· +( +s +) \ + +190 ( +__ex‹nsiÚ__ + \ + +192 +__cÚ¡ + * +__Þd + = ( +s +); \ + +193 +size_t + +__Ën + = + `¡¾’ + ( +__Þd +) + 1; \ + +194 * +__Ãw + = (*è + `__bužtš_®loÿ + ( +__Ën +); \ + +195 (*è + `memýy + ( +__Ãw +, +__Þd +, +__Ën +); \ + +196 + } +})) + + ) + +199  + #¡ºdu· +( +s +, +n +) \ + +200 ( +__ex‹nsiÚ__ + \ + +202 +__cÚ¡ + * +__Þd + = ( +s +); \ + +203 +size_t + +__Ën + = + `¡ºËn + ( +__Þd +, ( +n +)); \ + +204 * +__Ãw + = (*è + `__bužtš_®loÿ + ( +__Ën + + 1); \ + +205 +__Ãw +[ +__Ën +] = '\0'; \ + +206 (*è + `memýy + ( +__Ãw +, +__Þd +, +__Ën +); \ + +207 })) + + ) + +210 + g__BEGIN_NAMESPACE_STD + + +212 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +215 * +¡rchr + (* +__s +,  +__c +) + +216 +__THROW + +__asm + ("¡rchr"è +__©Œibu‹_pu»__ + +__nÚnuÎ + ((1)); + +217 +__cÚ¡ + * +¡rchr + (__cÚ¡ * +__s +,  +__c +) + +218 +__THROW + +__asm + ("¡rchr"è +__©Œibu‹_pu»__ + +__nÚnuÎ + ((1)); + +220 #ifdeà +__OPTIMIZE__ + + +221 +__ex‹º_®ways_šlše + * + +222 +¡rchr + (* +__s +,  +__c +è + g__THROW + + +224  +__bužtš_¡rchr + ( +__s +, +__c +); + +227 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +228 +¡rchr + ( +__cÚ¡ + * +__s +,  +__c +è + g__THROW + + +230  +__bužtš_¡rchr + ( +__s +, +__c +); + +235 * + $¡rchr + ( +__cÚ¡ + * +__s +,  +__c +) + +236 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +239 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +242 * + `¡¼chr + (* +__s +,  +__c +) + +243 +__THROW + + `__asm + ("¡¼chr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +244 +__cÚ¡ + * + `¡¼chr + (__cÚ¡ * +__s +,  +__c +) + +245 +__THROW + + `__asm + ("¡¼chr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +247 #ifdeà +__OPTIMIZE__ + + +248 +__ex‹º_®ways_šlše + * + +249 + `¡¼chr + (* +__s +,  +__c +è +__THROW + + +251  + `__bužtš_¡¼chr + ( +__s +, +__c +); + +254 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +255 + `¡¼chr + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +257  + `__bužtš_¡¼chr + ( +__s +, +__c +); + +260 + } +} + +262 * + $¡¼chr + ( +__cÚ¡ + * +__s +,  +__c +) + +263 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +265 +__END_NAMESPACE_STD + + +267 #ifdeà +__USE_GNU + + +270 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +271 "C++" * + $¡rchºul + (* +__s +,  +__c +) + +272 +__THROW + + `__asm + ("¡rchºul"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +273 "C++" +__cÚ¡ + * + $¡rchºul + ( +__cÚ¡ + * +__s +,  +__c +) + +274 +__THROW + + `__asm + ("¡rchºul"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +276 * + $¡rchºul + ( +__cÚ¡ + * +__s +,  +__c +) + +277 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +281 +__BEGIN_NAMESPACE_STD + + +284 +size_t + + $¡rc¥n + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__»jeù +) + +285 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +288 +size_t + + $¡r¥n + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +) + +289 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +291 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +294 * + `¡½brk + (* +__s +, +__cÚ¡ + * +__acû± +) + +295 +__THROW + + `__asm + ("¡½brk"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +296 +__cÚ¡ + * + `¡½brk + (__cÚ¡ * +__s +, __cÚ¡ * +__acû± +) + +297 +__THROW + + `__asm + ("¡½brk"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +299 #ifdeà +__OPTIMIZE__ + + +300 +__ex‹º_®ways_šlše + * + +301 + `¡½brk + (* +__s +, +__cÚ¡ + * +__acû± +è +__THROW + + +303  + `__bužtš_¡½brk + ( +__s +, +__acû± +); + +306 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +307 + `¡½brk + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +è +__THROW + + +309  + `__bužtš_¡½brk + ( +__s +, +__acû± +); + +312 + } +} + +314 * + $¡½brk + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +) + +315 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +318 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +321 * + `¡r¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +) + +322 +__THROW + + `__asm + ("¡r¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +323 +__cÚ¡ + * + `¡r¡r + (__cÚ¡ * +__hay¡ack +, + +324 +__cÚ¡ + * +__ÃedË +) + +325 +__THROW + + `__asm + ("¡r¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +327 #ifdeà +__OPTIMIZE__ + + +328 +__ex‹º_®ways_šlše + * + +329 + `¡r¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +è +__THROW + + +331  + `__bužtš_¡r¡r + ( +__hay¡ack +, +__ÃedË +); + +334 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +335 + `¡r¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +è +__THROW + + +337  + `__bužtš_¡r¡r + ( +__hay¡ack +, +__ÃedË +); + +340 + } +} + +342 * + $¡r¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +) + +343 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +348 * + $¡¹ok + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__d–im +) + +349 +__THROW + + `__nÚnuÎ + ((2)); + +350 +__END_NAMESPACE_STD + + +354 * + $__¡¹ok_r + (* +__»¡riù + +__s +, + +355 +__cÚ¡ + * +__»¡riù + +__d–im +, + +356 ** +__»¡riù + +__§ve_±r +) + +357 +__THROW + + `__nÚnuÎ + ((2, 3)); + +358 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +359 * + $¡¹ok_r + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__d–im +, + +360 ** +__»¡riù + +__§ve_±r +) + +361 +__THROW + + `__nÚnuÎ + ((2, 3)); + +364 #ifdeà +__USE_GNU + + +366 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +367 "C++" * + $¡rÿ£¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +) + +368 +__THROW + + `__asm + ("¡rÿ£¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +369 "C++" +__cÚ¡ + * + $¡rÿ£¡r + ( +__cÚ¡ + * +__hay¡ack +, + +370 +__cÚ¡ + * +__ÃedË +) + +371 +__THROW + + `__asm + ("¡rÿ£¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +373 * + $¡rÿ£¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +) + +374 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +378 #ifdeà +__USE_GNU + + +382 * + $memmem + ( +__cÚ¡ + * +__hay¡ack +, +size_t + +__hay¡ackËn +, + +383 +__cÚ¡ + * +__ÃedË +, +size_t + +__ÃedËËn +) + +384 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 3)); + +388 * + $__mempýy + (* +__»¡riù + +__de¡ +, + +389 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +390 +__THROW + + `__nÚnuÎ + ((1, 2)); + +391 * + $mempýy + (* +__»¡riù + +__de¡ +, + +392 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +393 +__THROW + + `__nÚnuÎ + ((1, 2)); + +397 +__BEGIN_NAMESPACE_STD + + +399 +size_t + + $¡¾’ + ( +__cÚ¡ + * +__s +) + +400 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +401 +__END_NAMESPACE_STD + + +403 #ifdef +__USE_XOPEN2K8 + + +406 +size_t + + $¡ºËn + ( +__cÚ¡ + * +__¡ršg +, +size_t + +__maxËn +) + +407 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +411 +__BEGIN_NAMESPACE_STD + + +413 * + $¡»¼Ü + ( +__”ºum +è +__THROW +; + +414 +__END_NAMESPACE_STD + + +415 #ià +defšed + +__USE_XOPEN2K + || defšed +__USE_MISC + + +423 #ià +defšed + +__USE_XOPEN2K + && !defšed +__USE_GNU + + +426 #ifdeà +__REDIRECT_NTH + + +427  + `__REDIRECT_NTH + ( +¡»¼Ü_r +, + +428 ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +), + +429 +__xpg_¡»¼Ü_r +è + `__nÚnuÎ + ((2)); + +431  + $__xpg_¡»¼Ü_r + ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +) + +432 +__THROW + + `__nÚnuÎ + ((2)); + +433  + #¡»¼Ü_r + +__xpg_¡»¼Ü_r + + + ) + +438 * + $¡»¼Ü_r + ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +) + +439 +__THROW + + `__nÚnuÎ + ((2)); + +443 #ifdeà +__USE_XOPEN2K8 + + +445 * + $¡»¼Ü_l + ( +__”ºum +, +__loÿË_t + +__l +è +__THROW +; + +451  + $__bz”o + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +453 #ifdeà +__USE_BSD + + +455  + $bcÝy + ( +__cÚ¡ + * +__¤c +, * +__de¡ +, +size_t + +__n +) + +456 +__THROW + + `__nÚnuÎ + ((1, 2)); + +459  + $bz”o + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +462  + $bcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +463 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +466 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +469 * + `šdex + (* +__s +,  +__c +) + +470 +__THROW + + `__asm + ("šdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +471 +__cÚ¡ + * + `šdex + (__cÚ¡ * +__s +,  +__c +) + +472 +__THROW + + `__asm + ("šdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +474 #ià +defšed + +__OPTIMIZE__ + && !defšed +__CORRECT_ISO_CPP_STRINGS_H_PROTO + + +475 +__ex‹º_®ways_šlše + * + +476 + `šdex + (* +__s +,  +__c +è +__THROW + + +478  + `__bužtš_šdex + ( +__s +, +__c +); + +481 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +482 + `šdex + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +484  + `__bužtš_šdex + ( +__s +, +__c +); + +487 + } +} + +489 * + $šdex + ( +__cÚ¡ + * +__s +,  +__c +) + +490 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +494 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +497 * + `ršdex + (* +__s +,  +__c +) + +498 +__THROW + + `__asm + ("ršdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +499 +__cÚ¡ + * + `ršdex + (__cÚ¡ * +__s +,  +__c +) + +500 +__THROW + + `__asm + ("ršdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +502 #ià +defšed + +__OPTIMIZE__ + && !defšed +__CORRECT_ISO_CPP_STRINGS_H_PROTO + + +503 +__ex‹º_®ways_šlše + * + +504 + `ršdex + (* +__s +,  +__c +è +__THROW + + +506  + `__bužtš_ršdex + ( +__s +, +__c +); + +509 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +510 + `ršdex + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +512  + `__bužtš_ršdex + ( +__s +, +__c +); + +515 + } +} + +517 * + $ršdex + ( +__cÚ¡ + * +__s +,  +__c +) + +518 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +523  + $ffs + ( +__i +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +527 #ifdef +__USE_GNU + + +528  + $ff¦ + ( +__l +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +529 #ifdeà +__GNUC__ + + +530 +__ex‹nsiÚ__ +  + $ff¦l + ( +__Î +) + +531 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +536  + $¡rÿ£cmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +537 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +540  + $¡ºÿ£cmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +541 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +544 #ifdef +__USE_GNU + + +547  + $¡rÿ£cmp_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, + +548 +__loÿË_t + +__loc +) + +549 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 3)); + +551  + $¡ºÿ£cmp_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, + +552 +size_t + +__n +, +__loÿË_t + +__loc +) + +553 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 4)); + +556 #ifdef +__USE_BSD + + +559 * + $¡r£p + (** +__»¡riù + +__¡ršgp +, + +560 +__cÚ¡ + * +__»¡riù + +__d–im +) + +561 +__THROW + + `__nÚnuÎ + ((1, 2)); + +564 #ifdef +__USE_XOPEN2K8 + + +566 * + $¡rsigÇl + ( +__sig +è +__THROW +; + +569 * + $__¡pýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +570 +__THROW + + `__nÚnuÎ + ((1, 2)); + +571 * + $¡pýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +572 +__THROW + + `__nÚnuÎ + ((1, 2)); + +576 * + $__¡²ýy + (* +__»¡riù + +__de¡ +, + +577 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +578 +__THROW + + `__nÚnuÎ + ((1, 2)); + +579 * + $¡²ýy + (* +__»¡riù + +__de¡ +, + +580 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +581 +__THROW + + `__nÚnuÎ + ((1, 2)); + +584 #ifdef +__USE_GNU + + +586  + $¡rv”scmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +587 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +590 * + $¡räy + (* +__¡ršg +è +__THROW + + `__nÚnuÎ + ((1)); + +593 * + $memäob + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +595 #iâdeà +ba£Çme + + +600 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +601 "C++" * + $ba£Çme + (* +__fž’ame +) + +602 +__THROW + + `__asm + ("ba£Çme"è + `__nÚnuÎ + ((1)); + +603 "C++" +__cÚ¡ + * + $ba£Çme + ( +__cÚ¡ + * +__fž’ame +) + +604 +__THROW + + `__asm + ("ba£Çme"è + `__nÚnuÎ + ((1)); + +606 * + $ba£Çme + ( +__cÚ¡ + * +__fž’ame +è +__THROW + + `__nÚnuÎ + ((1)); + +612 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +613 #ià +defšed + +__OPTIMIZE__ + && !defšed +__OPTIMIZE_SIZE__ + \ + +614 && ! +defšed + +__NO_INLINE__ + && !defšed +__ýlu¥lus + + +634  + ~ + +637  + ~ + +640 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +642  + ~ + +646 +__END_DECLS + + + @/usr/include/unistd.h + +23 #iâdef +_UNISTD_H + + +24  + #_UNISTD_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +28 + g__BEGIN_DECLS + + +33 #ifdeà +__USE_XOPEN2K8 + + +35  + #_POSIX_VERSION + 200809L + + ) + +36 #–ià +defšed + +__USE_XOPEN2K + + +38  + #_POSIX_VERSION + 200112L + + ) + +39 #–ià +defšed + +__USE_POSIX199506 + + +41  + #_POSIX_VERSION + 199506L + + ) + +42 #–ià +defšed + +__USE_POSIX199309 + + +44  + #_POSIX_VERSION + 199309L + + ) + +47  + #_POSIX_VERSION + 199009L + + ) + +53 #ifdeà +__USE_XOPEN2K8 + + +54  + #__POSIX2_THIS_VERSION + 200809L + + ) + +56 #–ià +defšed + +__USE_XOPEN2K + + +58  + #__POSIX2_THIS_VERSION + 200112L + + ) + +59 #–ià +defšed + +__USE_POSIX199506 + + +61  + #__POSIX2_THIS_VERSION + 199506L + + ) + +64  + #__POSIX2_THIS_VERSION + 199209L + + ) + +68  + #_POSIX2_VERSION + +__POSIX2_THIS_VERSION + + + ) + +72  + #_POSIX2_C_BIND + +__POSIX2_THIS_VERSION + + + ) + +76  + #_POSIX2_C_DEV + +__POSIX2_THIS_VERSION + + + ) + +80  + #_POSIX2_SW_DEV + +__POSIX2_THIS_VERSION + + + ) + +84  + #_POSIX2_LOCALEDEF + +__POSIX2_THIS_VERSION + + + ) + +87 #ifdeà +__USE_XOPEN2K8 + + +88  + #_XOPEN_VERSION + 700 + + ) + +89 #–ià +defšed + +__USE_XOPEN2K + + +90  + #_XOPEN_VERSION + 600 + + ) + +91 #–ià +defšed + +__USE_UNIX98 + + +92  + #_XOPEN_VERSION + 500 + + ) + +94  + #_XOPEN_VERSION + 4 + + ) + +98  + #_XOPEN_XCU_VERSION + 4 + + ) + +101  + #_XOPEN_XPG2 + 1 + + ) + +102  + #_XOPEN_XPG3 + 1 + + ) + +103  + #_XOPEN_XPG4 + 1 + + ) + +106  + #_XOPEN_UNIX + 1 + + ) + +109  + #_XOPEN_CRYPT + 1 + + ) + +113  + #_XOPEN_ENH_I18N + 1 + + ) + +116  + #_XOPEN_LEGACY + 1 + + ) + +203  + ~ + +206 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +207  + ~ + +211  + #STDIN_FILENO + 0 + + ) + +212  + #STDOUT_FILENO + 1 + + ) + +213  + #STDERR_FILENO + 2 + + ) + +218  + ~ + +220 #iâdef +__ssize_t_defšed + + +221  +__ssize_t + + tssize_t +; + +222  + #__ssize_t_defšed + + + ) + +225  + #__Ãed_size_t + + + ) + +226  + #__Ãed_NULL + + + ) + +227  + ~<¡ddef.h +> + +229 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K + + +232 #iâdeà +__gid_t_defšed + + +233  +__gid_t + + tgid_t +; + +234  + #__gid_t_defšed + + + ) + +237 #iâdeà +__uid_t_defšed + + +238  +__uid_t + + tuid_t +; + +239  + #__uid_t_defšed + + + ) + +242 #iâdeà +__off_t_defšed + + +243 #iâdeà +__USE_FILE_OFFSET64 + + +244  +__off_t + + toff_t +; + +246  +__off64_t + + toff_t +; + +248  + #__off_t_defšed + + + ) + +250 #ià +defšed + +__USE_LARGEFILE64 + && !defšed +__off64_t_defšed + + +251  +__off64_t + + toff64_t +; + +252  + #__off64_t_defšed + + + ) + +255 #iâdeà +__u£cÚds_t_defšed + + +256  +__u£cÚds_t + + tu£cÚds_t +; + +257  + #__u£cÚds_t_defšed + + + ) + +260 #iâdeà +__pid_t_defšed + + +261  +__pid_t + + tpid_t +; + +262  + #__pid_t_defšed + + + ) + +266 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K + + +267 #iâdeà +__šŒ_t_defšed + + +268  +__šŒ_t + + tšŒ_t +; + +269  + #__šŒ_t_defšed + + + ) + +273 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN + + +274 #iâdeà +__sockËn_t_defšed + + +275  +__sockËn_t + + tsockËn_t +; + +276  + #__sockËn_t_defšed + + + ) + +282  + #R_OK + 4 + + ) + +283  + #W_OK + 2 + + ) + +284  + #X_OK + 1 + + ) + +285  + #F_OK + 0 + + ) + +288  + $acûss + ( +__cÚ¡ + * +__Çme +,  +__ty³ +è +__THROW + + `__nÚnuÎ + ((1)); + +290 #ifdeà +__USE_GNU + + +293  + $euidacûss + ( +__cÚ¡ + * +__Çme +,  +__ty³ +) + +294 +__THROW + + `__nÚnuÎ + ((1)); + +297  + $—cûss + ( +__cÚ¡ + * +__Çme +,  +__ty³ +) + +298 +__THROW + + `__nÚnuÎ + ((1)); + +301 #ifdeà +__USE_ATFILE + + +305  + $çcûs§t + ( +__fd +, +__cÚ¡ + * +__fže +,  +__ty³ +,  +__æag +) + +306 +__THROW + + `__nÚnuÎ + ((2)è +__wur +; + +311 #iâdef +_STDIO_H + + +312  + #SEEK_SET + 0 + + ) + +313  + #SEEK_CUR + 1 + + ) + +314  + #SEEK_END + 2 + + ) + +317 #ià +defšed + +__USE_BSD + && !defšed +L_SET + + +319  + #L_SET + +SEEK_SET + + + ) + +320  + #L_INCR + +SEEK_CUR + + + ) + +321  + #L_XTND + +SEEK_END + + + ) + +330 #iâdeà +__USE_FILE_OFFSET64 + + +331 +__off_t + + $l£ek + ( +__fd +, +__off_t + +__off£t +,  +__wh’û +è +__THROW +; + +333 #ifdeà +__REDIRECT_NTH + + +334 +__off64_t + + `__REDIRECT_NTH + ( +l£ek +, + +335 ( +__fd +, +__off64_t + +__off£t +,  +__wh’û +), + +336 +l£ek64 +); + +338  + #l£ek + +l£ek64 + + + ) + +341 #ifdeà +__USE_LARGEFILE64 + + +342 +__off64_t + + $l£ek64 + ( +__fd +, +__off64_t + +__off£t +,  +__wh’û +) + +343 +__THROW +; + +350  + `þo£ + ( +__fd +); + +357 +ssize_t + + $»ad + ( +__fd +, * +__buf +, +size_t + +__nby‹s +è +__wur +; + +363 +ssize_t + + $wr™e + ( +__fd +, +__cÚ¡ + * +__buf +, +size_t + +__n +è +__wur +; + +365 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K8 + + +366 #iâdeà +__USE_FILE_OFFSET64 + + +373 +ssize_t + + $´—d + ( +__fd +, * +__buf +, +size_t + +__nby‹s +, + +374 +__off_t + +__off£t +è +__wur +; + +381 +ssize_t + + $pwr™e + ( +__fd +, +__cÚ¡ + * +__buf +, +size_t + +__n +, + +382 +__off_t + +__off£t +è +__wur +; + +384 #ifdeà +__REDIRECT + + +385 +ssize_t + + `__REDIRECT + ( +´—d +, ( +__fd +, * +__buf +, +size_t + +__nby‹s +, + +386 +__off64_t + +__off£t +), + +387 +´—d64 +è +__wur +; + +388 +ssize_t + + `__REDIRECT + ( +pwr™e +, ( +__fd +, +__cÚ¡ + * +__buf +, + +389 +size_t + +__nby‹s +, +__off64_t + +__off£t +), + +390 +pwr™e64 +è +__wur +; + +392  + #´—d + +´—d64 + + + ) + +393  + #pwr™e + +pwr™e64 + + + ) + +397 #ifdeà +__USE_LARGEFILE64 + + +401 +ssize_t + + $´—d64 + ( +__fd +, * +__buf +, +size_t + +__nby‹s +, + +402 +__off64_t + +__off£t +è +__wur +; + +405 +ssize_t + + $pwr™e64 + ( +__fd +, +__cÚ¡ + * +__buf +, +size_t + +__n +, + +406 +__off64_t + +__off£t +è +__wur +; + +414  + $pe + ( +__pedes +[2]è +__THROW + +__wur +; + +416 #ifdeà +__USE_GNU + + +419  + $pe2 + ( +__pedes +[2],  +__æags +è +__THROW + +__wur +; + +429  + $®¬m + ( +__£cÚds +è +__THROW +; + +441  + `¦“p + ( +__£cÚds +); + +443 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K8 +) \ + +444 || +defšed + +__USE_BSD + + +449 +__u£cÚds_t + + $u®¬m + ( +__u£cÚds_t + +__v®ue +, __u£cÚds_ˆ +__š‹rv® +) + +450 +__THROW +; + +457  + `u¦“p + ( +__u£cÚds_t + +__u£cÚds +); + +466  + `·u£ + (); + +470  + $chown + ( +__cÚ¡ + * +__fže +, +__uid_t + +__owÃr +, +__gid_t + +__group +) + +471 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +473 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +475  + $fchown + ( +__fd +, +__uid_t + +__owÃr +, +__gid_t + +__group +è +__THROW + +__wur +; + +480  + $lchown + ( +__cÚ¡ + * +__fže +, +__uid_t + +__owÃr +, +__gid_t + +__group +) + +481 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +485 #ifdeà +__USE_ATFILE + + +488  + $fchowÇt + ( +__fd +, +__cÚ¡ + * +__fže +, +__uid_t + +__owÃr +, + +489 +__gid_t + +__group +,  +__æag +) + +490 +__THROW + + `__nÚnuÎ + ((2)è +__wur +; + +494  + $chdœ + ( +__cÚ¡ + * +__·th +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +496 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +498  + $fchdœ + ( +__fd +è +__THROW + +__wur +; + +508 * + $g‘cwd + (* +__buf +, +size_t + +__size +è +__THROW + +__wur +; + +510 #ifdef +__USE_GNU + + +514 * + $g‘_cu¼’t_dœ_Çme + (è +__THROW +; + +517 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K8 +) \ + +518 || +defšed + +__USE_BSD + + +522 * + $g‘wd + (* +__buf +) + +523 +__THROW + + `__nÚnuÎ + ((1)è +__©Œibu‹_d•»ÿ‹d__ + +__wur +; + +528  + $dup + ( +__fd +è +__THROW + +__wur +; + +531  + $dup2 + ( +__fd +,  +__fd2 +è +__THROW +; + +533 #ifdeà +__USE_GNU + + +536  + $dup3 + ( +__fd +,  +__fd2 +,  +__æags +è +__THROW +; + +540 ** +__’vœÚ +; + +541 #ifdeà +__USE_GNU + + +542 ** +’vœÚ +; + +548  + $execve + ( +__cÚ¡ + * +__·th +, *__cÚ¡ +__¬gv +[], + +549 * +__cÚ¡ + +__’vp +[]è +__THROW + + `__nÚnuÎ + ((1, 2)); + +551 #ifdeà +__USE_XOPEN2K8 + + +554  + $ãxecve + ( +__fd +, * +__cÚ¡ + +__¬gv +[], *__cÚ¡ +__’vp +[]) + +555 +__THROW + + `__nÚnuÎ + ((2)); + +560  + $execv + ( +__cÚ¡ + * +__·th +, *__cÚ¡ +__¬gv +[]) + +561 +__THROW + + `__nÚnuÎ + ((1, 2)); + +565  + $exeþe + ( +__cÚ¡ + * +__·th +, __cÚ¡ * +__¬g +, ...) + +566 +__THROW + + `__nÚnuÎ + ((1, 2)); + +570  + $exeþ + ( +__cÚ¡ + * +__·th +, __cÚ¡ * +__¬g +, ...) + +571 +__THROW + + `__nÚnuÎ + ((1, 2)); + +575  + $execvp + ( +__cÚ¡ + * +__fže +, *__cÚ¡ +__¬gv +[]) + +576 +__THROW + + `__nÚnuÎ + ((1, 2)); + +581  + $exeþp + ( +__cÚ¡ + * +__fže +, __cÚ¡ * +__¬g +, ...) + +582 +__THROW + + `__nÚnuÎ + ((1, 2)); + +584 #ifdeà +__USE_GNU + + +587  + $execv³ + ( +__cÚ¡ + * +__fže +, *__cÚ¡ +__¬gv +[], + +588 * +__cÚ¡ + +__’vp +[]) + +589 +__THROW + + `__nÚnuÎ + ((1, 2)); + +593 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + + +595  + $niû + ( +__šc +è +__THROW + +__wur +; + +600  + $_ex™ + ( +__¡©us +è + `__©Œibu‹__ + (( +__nܑuº__ +)); + +606  + ~ + +609  + $·thcÚf + ( +__cÚ¡ + * +__·th +,  +__Çme +) + +610 +__THROW + + `__nÚnuÎ + ((1)); + +613  + $å©hcÚf + ( +__fd +,  +__Çme +è +__THROW +; + +616  + $syscÚf + ( +__Çme +è +__THROW +; + +618 #ifdef +__USE_POSIX2 + + +620 +size_t + + $cÚf¡r + ( +__Çme +, * +__buf +, +size_t + +__Ën +è +__THROW +; + +625 +__pid_t + + $g‘pid + (è +__THROW +; + +628 +__pid_t + + $g‘µid + (è +__THROW +; + +632 #iâdeà +__FAVOR_BSD + + +633 +__pid_t + + $g‘pg½ + (è +__THROW +; + +635 #ifdeà +__REDIRECT_NTH + + +636 +__pid_t + + `__REDIRECT_NTH + ( +g‘pg½ +, (__pid_ˆ +__pid +), +__g‘pgid +); + +638  + #g‘pg½ + +__g‘pgid + + + ) + +643 +__pid_t + + $__g‘pgid + ( +__pid_t + +__pid +è +__THROW +; + +644 #ià +defšed + +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +645 +__pid_t + + $g‘pgid + ( +__pid_t + +__pid +è +__THROW +; + +652  + $£gid + ( +__pid_t + +__pid +, __pid_ˆ +__pgid +è +__THROW +; + +654 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +665 #iâdeà +__FAVOR_BSD + + +669  + $£g½ + (è +__THROW +; + +674 #ifdeà +__REDIRECT_NTH + + +675  + `__REDIRECT_NTH + ( +£g½ +, ( +__pid_t + +__pid +, __pid_ˆ +__pg½ +), +£gid +); + +677  + #£g½ + +£gid + + + ) + +686 +__pid_t + + $£tsid + (è +__THROW +; + +688 #ià +defšed + +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +690 +__pid_t + + $g‘sid + ( +__pid_t + +__pid +è +__THROW +; + +694 +__uid_t + + $g‘uid + (è +__THROW +; + +697 +__uid_t + + $g‘euid + (è +__THROW +; + +700 +__gid_t + + $g‘gid + (è +__THROW +; + +703 +__gid_t + + $g‘egid + (è +__THROW +; + +708  + $g‘groups + ( +__size +, +__gid_t + +__li¡ +[]è +__THROW + +__wur +; + +710 #ifdef +__USE_GNU + + +712  + $group_memb” + ( +__gid_t + +__gid +è +__THROW +; + +719  + $£tuid + ( +__uid_t + +__uid +è +__THROW +; + +721 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +724  + $£Œeuid + ( +__uid_t + +__ruid +, __uid_ˆ +__euid +è +__THROW +; + +727 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K + + +729  + $£‹uid + ( +__uid_t + +__uid +è +__THROW +; + +736  + $£tgid + ( +__gid_t + +__gid +è +__THROW +; + +738 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +741  + $£Œegid + ( +__gid_t + +__rgid +, __gid_ˆ +__egid +è +__THROW +; + +744 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K + + +746  + $£‹gid + ( +__gid_t + +__gid +è +__THROW +; + +749 #ifdeà +__USE_GNU + + +752  + $g‘»suid + ( +__uid_t + * +__ruid +, __uid_ˆ* +__euid +, __uid_ˆ* +__suid +) + +753 +__THROW +; + +757  + $g‘»sgid + ( +__gid_t + * +__rgid +, __gid_ˆ* +__egid +, __gid_ˆ* +__sgid +) + +758 +__THROW +; + +762  + $£Œesuid + ( +__uid_t + +__ruid +, __uid_ˆ +__euid +, __uid_ˆ +__suid +) + +763 +__THROW +; + +767  + $£Œesgid + ( +__gid_t + +__rgid +, __gid_ˆ +__egid +, __gid_ˆ +__sgid +) + +768 +__THROW +; + +775 +__pid_t + + $fÜk + (è +__THROW +; + +777 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K8 +) \ + +778 || +defšed + +__USE_BSD + + +783 +__pid_t + + $vfÜk + (è +__THROW +; + +789 * + $‰yÇme + ( +__fd +è +__THROW +; + +793  + $‰yÇme_r + ( +__fd +, * +__buf +, +size_t + +__buæ’ +) + +794 +__THROW + + `__nÚnuÎ + ((2)è +__wur +; + +798  + $i§‰y + ( +__fd +è +__THROW +; + +800 #ià +defšed + +__USE_BSD + \ + +801 || ( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_UNIX98 +) + +804  + $‰y¦Ù + (è +__THROW +; + +809  + $lšk + ( +__cÚ¡ + * +__äom +, __cÚ¡ * +__to +) + +810 +__THROW + + `__nÚnuÎ + ((1, 2)è +__wur +; + +812 #ifdeà +__USE_ATFILE + + +815  + $lšk© + ( +__äomfd +, +__cÚ¡ + * +__äom +,  +__tofd +, + +816 +__cÚ¡ + * +__to +,  +__æags +) + +817 +__THROW + + `__nÚnuÎ + ((2, 4)è +__wur +; + +820 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K + + +822  + $symlšk + ( +__cÚ¡ + * +__äom +, __cÚ¡ * +__to +) + +823 +__THROW + + `__nÚnuÎ + ((1, 2)è +__wur +; + +828 +ssize_t + + $»adlšk + ( +__cÚ¡ + * +__»¡riù + +__·th +, + +829 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +830 +__THROW + + `__nÚnuÎ + ((1, 2)è +__wur +; + +833 #ifdeà +__USE_ATFILE + + +835  + $symlšk© + ( +__cÚ¡ + * +__äom +,  +__tofd +, + +836 +__cÚ¡ + * +__to +è +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +839 +ssize_t + + $»adlšk© + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__·th +, + +840 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +841 +__THROW + + `__nÚnuÎ + ((2, 3)è +__wur +; + +845  + $uƚk + ( +__cÚ¡ + * +__Çme +è +__THROW + + `__nÚnuÎ + ((1)); + +847 #ifdeà +__USE_ATFILE + + +849  + $uƚk© + ( +__fd +, +__cÚ¡ + * +__Çme +,  +__æag +) + +850 +__THROW + + `__nÚnuÎ + ((2)); + +854  + $rmdœ + ( +__cÚ¡ + * +__·th +è +__THROW + + `__nÚnuÎ + ((1)); + +858 +__pid_t + + $tcg‘pg½ + ( +__fd +è +__THROW +; + +861  + $tc£g½ + ( +__fd +, +__pid_t + +__pg½_id +è +__THROW +; + +868 * + `g‘logš + (); + +869 #ià +defšed + +__USE_REENTRANT + || defšed +__USE_POSIX199506 + + +876  + $g‘logš_r + (* +__Çme +, +size_t + +__Çme_Ën +è + `__nÚnuÎ + ((1)); + +879 #ifdef +__USE_BSD + + +881  + $£Žogš + ( +__cÚ¡ + * +__Çme +è +__THROW + + `__nÚnuÎ + ((1)); + +885 #ifdef +__USE_POSIX2 + + +889  + #__Ãed_g‘Ýt + + + ) + +890  + ~ + +894 #ià +defšed + +__USE_BSD + || defšed +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +898  + $g‘ho¡Çme + (* +__Çme +, +size_t + +__Ën +è +__THROW + + `__nÚnuÎ + ((1)); + +902 #ià +defšed + +__USE_BSD + || (defšed +__USE_XOPEN + && !defšed +__USE_UNIX98 +) + +905  + $£tho¡Çme + ( +__cÚ¡ + * +__Çme +, +size_t + +__Ën +) + +906 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +910  + $£tho¡id + ( +__id +è +__THROW + +__wur +; + +916  + $g‘domašÇme + (* +__Çme +, +size_t + +__Ën +) + +917 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +918  + $£tdomašÇme + ( +__cÚ¡ + * +__Çme +, +size_t + +__Ën +) + +919 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +925  + $vhªgup + (è +__THROW +; + +928  + $»voke + ( +__cÚ¡ + * +__fže +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +936  + $´ofž + (* +__§m¶e_bufãr +, +size_t + +__size +, + +937 +size_t + +__off£t +,  +__sÿË +) + +938 +__THROW + + `__nÚnuÎ + ((1)); + +944  + $acù + ( +__cÚ¡ + * +__Çme +è +__THROW +; + +948 * + $g‘u£rsh–l + (è +__THROW +; + +949  + $’du£rsh–l + (è +__THROW +; + +950  + $£tu£rsh–l + (è +__THROW +; + +956  + $d«mÚ + ( +__nochdœ +,  +__noþo£ +è +__THROW + +__wur +; + +960 #ià +defšed + +__USE_BSD + || (defšed +__USE_XOPEN + && !defšed +__USE_XOPEN2K +) + +963  + $chroÙ + ( +__cÚ¡ + * +__·th +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +967 * + $g‘·ss + ( +__cÚ¡ + * +__´om± +è + `__nÚnuÎ + ((1)); + +971 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN + || defšed +__USE_XOPEN2K + + +976  + `fsync + ( +__fd +); + +980 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +983  + `g‘ho¡id + (); + +986  + $sync + (è +__THROW +; + +989 #ià +defšed + +__USE_BSD + || !defšed +__USE_XOPEN2K + + +992  + $g‘·gesize + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +997  + $g‘dbËsize + (è +__THROW +; + +1003 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K8 + + +1006 #iâdeà +__USE_FILE_OFFSET64 + + +1007  + $Œunÿ‹ + ( +__cÚ¡ + * +__fže +, +__off_t + +__Ëngth +) + +1008 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +1010 #ifdeà +__REDIRECT_NTH + + +1011  + `__REDIRECT_NTH + ( +Œunÿ‹ +, + +1012 ( +__cÚ¡ + * +__fže +, +__off64_t + +__Ëngth +), + +1013 +Œunÿ‹64 +è + `__nÚnuÎ + ((1)è +__wur +; + +1015  + #Œunÿ‹ + +Œunÿ‹64 + + + ) + +1018 #ifdeà +__USE_LARGEFILE64 + + +1019  + $Œunÿ‹64 + ( +__cÚ¡ + * +__fže +, +__off64_t + +__Ëngth +) + +1020 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +1025 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_XOPEN2K + + +1028 #iâdeà +__USE_FILE_OFFSET64 + + +1029  + $árunÿ‹ + ( +__fd +, +__off_t + +__Ëngth +è +__THROW + +__wur +; + +1031 #ifdeà +__REDIRECT_NTH + + +1032  + `__REDIRECT_NTH + ( +árunÿ‹ +, ( +__fd +, +__off64_t + +__Ëngth +), + +1033 +árunÿ‹64 +è +__wur +; + +1035  + #árunÿ‹ + +árunÿ‹64 + + + ) + +1038 #ifdeà +__USE_LARGEFILE64 + + +1039  + $árunÿ‹64 + ( +__fd +, +__off64_t + +__Ëngth +è +__THROW + +__wur +; + +1045 #ià( +defšed + +__USE_XOPEN_EXTENDED + && !defšed +__USE_XOPEN2K +) \ + +1046 || +defšed + +__USE_MISC + + +1050  + $brk + (* +__addr +è +__THROW + +__wur +; + +1056 * + $sbrk + ( +šŒ_t + +__d– +è +__THROW +; + +1060 #ifdeà +__USE_MISC + + +1071  + $sysÿÎ + ( +__sy¢o +, ...è +__THROW +; + +1076 #ià( +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED +è&& !defšed +F_LOCK + + +1088  + #F_ULOCK + 0 + + ) + +1089  + #F_LOCK + 1 + + ) + +1090  + #F_TLOCK + 2 + + ) + +1091  + #F_TEST + 3 + + ) + +1093 #iâdeà +__USE_FILE_OFFSET64 + + +1094  + $lockf + ( +__fd +,  +__cmd +, +__off_t + +__Ën +è +__wur +; + +1096 #ifdeà +__REDIRECT + + +1097  + `__REDIRECT + ( +lockf +, ( +__fd +,  +__cmd +, +__off64_t + +__Ën +), + +1098 +lockf64 +è +__wur +; + +1100  + #lockf + +lockf64 + + + ) + +1103 #ifdeà +__USE_LARGEFILE64 + + +1104  + $lockf64 + ( +__fd +,  +__cmd +, +__off64_t + +__Ën +è +__wur +; + +1109 #ifdeà +__USE_GNU + + +1114  + #TEMP_FAILURE_RETRY +( +ex´essiÚ +) \ + +1115 ( +__ex‹nsiÚ__ + \ + +1116 ({  +__»suÉ +; \ + +1117 dØ +__»suÉ + = (è( +ex´essiÚ +); \ + +1118  +__»suÉ + =ð-1L && +”ºo + =ð +EINTR +); \ + +1119 +__»suÉ +; + } +})) + + ) + +1122 #ià +defšed + +__USE_POSIX199309 + || defšed +__USE_UNIX98 + + +1125  +fd©async + ( +__fždes +); + +1131 #ifdef +__USE_XOPEN + + +1133 * + $üy± + ( +__cÚ¡ + * +__key +, __cÚ¡ * +__§É +) + +1134 +__THROW + + `__nÚnuÎ + ((1, 2)); + +1138  + $’üy± + (* +__libc_block +,  +__edæag +è +__THROW + + `__nÚnuÎ + ((1)); + +1145  + $swab + ( +__cÚ¡ + * +__»¡riù + +__äom +, *__»¡riù +__to +, + +1146 +ssize_t + +__n +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +1152 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K8 + + +1154 * + $ù”mid + (* +__s +è +__THROW +; + +1159 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +1160  + ~ + +1163 +__END_DECLS + + + @/usr/include/alloca.h + +19 #iâdef +_ALLOCA_H + + +20  + #_ALLOCA_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +24  + #__Ãed_size_t + + + ) + +25  + ~<¡ddef.h +> + +27 + g__BEGIN_DECLS + + +30 #undeà +®loÿ + + +33 * + $®loÿ + ( +size_t + +__size +è +__THROW +; + +35 #ifdef +__GNUC__ + + +36  + #®loÿ +( +size +è + `__bužtš_®loÿ + (size) + + ) + +39 +__END_DECLS + + + @/usr/include/endian.h + +19 #iâdef +_ENDIAN_H + + +20  + #_ENDIAN_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +32  + #__LITTLE_ENDIAN + 1234 + + ) + +33  + #__BIG_ENDIAN + 4321 + + ) + +34  + #__PDP_ENDIAN + 3412 + + ) + +37  + ~ + +41 #iâdeà +__FLOAT_WORD_ORDER + + +42  + #__FLOAT_WORD_ORDER + +__BYTE_ORDER + + + ) + +45 #ifdef +__USE_BSD + + +46  + #LITTLE_ENDIAN + +__LITTLE_ENDIAN + + + ) + +47  + #BIG_ENDIAN + +__BIG_ENDIAN + + + ) + +48  + #PDP_ENDIAN + +__PDP_ENDIAN + + + ) + +49  + #BYTE_ORDER + +__BYTE_ORDER + + + ) + +52 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +53  + #__LONG_LONG_PAIR +( +HI +, +LO +èLO, + ) +HI + +54 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +55  + #__LONG_LONG_PAIR +( +HI +, +LO +èHI, + ) +LO + +59 #ifdeà +__USE_BSD + + +61  + ~ + +63 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +64  + #htobe16 +( +x +è + `__bsw­_16 + (x) + + ) + +65  + #htÞe16 +( +x +è(x) + + ) + +66  + #be16toh +( +x +è + `__bsw­_16 + (x) + + ) + +67  + #Ë16toh +( +x +è(x) + + ) + +69  + #htobe32 +( +x +è + `__bsw­_32 + (x) + + ) + +70  + #htÞe32 +( +x +è(x) + + ) + +71  + #be32toh +( +x +è + `__bsw­_32 + (x) + + ) + +72  + #Ë32toh +( +x +è(x) + + ) + +74  + #htobe64 +( +x +è + `__bsw­_64 + (x) + + ) + +75  + #htÞe64 +( +x +è(x) + + ) + +76  + #be64toh +( +x +è + `__bsw­_64 + (x) + + ) + +77  + #Ë64toh +( +x +è(x) + + ) + +79  + #htobe16 +( +x +è(x) + + ) + +80  + #htÞe16 +( +x +è + `__bsw­_16 + (x) + + ) + +81  + #be16toh +( +x +è(x) + + ) + +82  + #Ë16toh +( +x +è + `__bsw­_16 + (x) + + ) + +84  + #htobe32 +( +x +è(x) + + ) + +85  + #htÞe32 +( +x +è + `__bsw­_32 + (x) + + ) + +86  + #be32toh +( +x +è(x) + + ) + +87  + #Ë32toh +( +x +è + `__bsw­_32 + (x) + + ) + +89  + #htobe64 +( +x +è(x) + + ) + +90  + #htÞe64 +( +x +è + `__bsw­_64 + (x) + + ) + +91  + #be64toh +( +x +è(x) + + ) + +92  + #Ë64toh +( +x +è + `__bsw­_64 + (x) + + ) + + @/usr/include/event2/buffer.h + +26 #iâdeà +_EVENT2_BUFFER_H_ + + +27  + #_EVENT2_BUFFER_H_ + + + ) + +75 #ifdeà +__ýlu¥lus + + +79  + ~ + +80  + ~<¡d¬g.h +> + +81 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +82  + ~ + +84 #ifdeà +_EVENT_HAVE_SYS_UIO_H + + +85  + ~ + +87  + ~ + +95  +evbufãr + + +96 #ifdeà +_EVENT_IN_DOXYGEN + + +109  + sevbufãr_±r + { + +110 +ev_ssize_t + +pos +; + +114 * +chaš +; + +115 +size_t + +pos_š_chaš +; + +116 } +_š‹º® +; + +124 #ifdeà +_EVENT_HAVE_SYS_UIO_H + + +125  + #evbufãr_iovec + +iovec + + + ) + +127  + #_EVBUFFER_IOVEC_IS_NATIVE + + + ) + +129  + sevbufãr_iovec + { + +131 * +iov_ba£ +; + +133 +size_t + +iov_Ën +; + +143  +evbufãr + * +evbufãr_Ãw +(); + +149  +evbufãr_ä“ +( +evbufãr + * +buf +); + +163  +evbufãr_’abË_lockšg +( +evbufãr + * +buf +, * +lock +); + +169  +evbufãr_lock +( +evbufãr + * +buf +); + +175  +evbufãr_uÆock +( +evbufãr + * +buf +); + +193  + #EVBUFFER_FLAG_DRAINS_TO_FD + 1 + + ) + +202  +evbufãr_£t_æags +( +evbufãr + * +buf +, +ev_ušt64_t + +æags +); + +210  +evbufãr_þ—r_æags +( +evbufãr + * +buf +, +ev_ušt64_t + +æags +); + +218 +size_t + +evbufãr_g‘_Ëngth +(cÚ¡  +evbufãr + * +buf +); + +232 +size_t + +evbufãr_g‘_cÚtiguous_¥aû +(cÚ¡  +evbufãr + * +buf +); + +244  +evbufãr_ex·nd +( +evbufãr + * +buf +, +size_t + +d©Ën +); + +280 +evbufãr_»£rve_¥aû +( +evbufãr + * +buf +, +ev_ssize_t + +size +, + +281  +evbufãr_iovec + * +vec +,  +n_vec +); + +304  +evbufãr_comm™_¥aû +( +evbufãr + * +buf +, + +305  +evbufãr_iovec + * +vec +,  +n_vecs +); + +315  +evbufãr_add +( +evbufãr + * +buf +, cÚ¡ * +d©a +, +size_t + +d©Ën +); + +329  +evbufãr_»move +( +evbufãr + * +buf +, * +d©a +, +size_t + +d©Ën +); + +342 +ev_ssize_t + +evbufãr_cÝyout +( +evbufãr + * +buf +, * +d©a_out +, +size_t + +d©Ën +); + +357  +evbufãr_»move_bufãr +( +evbufãr + * +¤c +, evbufã¸* +d¡ +, + +358 +size_t + +d©Ën +); + +362 + eevbufãr_eÞ_¡yË + { + +372 +EVBUFFER_EOL_ANY +, + +375 +EVBUFFER_EOL_CRLF +, + +377 +EVBUFFER_EOL_CRLF_STRICT +, + +379 +EVBUFFER_EOL_LF + + +396 * +evbufãr_»adÊ +( +evbufãr + * +bufãr +, +size_t + * +n_»ad_out +, + +397 +evbufãr_eÞ_¡yË + +eÞ_¡yË +); + +411  +evbufãr_add_bufãr +( +evbufãr + * +outbuf +, evbufã¸* +šbuf +); + +419 (* +evbufãr_»f_þ—nup_cb +)(cÚ¡ * + td©a +, + +420 + tsize_t + + td©®’ +, * + texŒa +); + +437  +evbufãr_add_»ã»nû +( +evbufãr + * +outbuf +, + +438 cÚ¡ * +d©a +, +size_t + +d©Ën +, + +439 +evbufãr_»f_þ—nup_cb + +þ—nupâ +, * +þ—nupâ_¬g +); + +462  +evbufãr_add_fže +( +evbufãr + * +outbuf +,  +fd +, +ev_off_t + +off£t +, + +463 +ev_off_t + +Ëngth +); + +477  +evbufãr_add_´štf +( +evbufãr + * +buf +, cÚ¡ * +fmt +, ...) + +478 #ifdeà +__GNUC__ + + +479 +__©Œibu‹__ +(( +fÜm© +( +´štf +, 2, 3))) + +491  +evbufãr_add_v´štf +( +evbufãr + * +buf +, cÚ¡ * +fmt +, +va_li¡ + +­ +); + +501  +evbufãr_d¿š +( +evbufãr + * +buf +, +size_t + +Ën +); + +514  +evbufãr_wr™e +( +evbufãr + * +bufãr +, +evutž_sock‘_t + +fd +); + +528  +evbufãr_wr™e_©mo¡ +( +evbufãr + * +bufãr +, +evutž_sock‘_t + +fd +, + +529 +ev_ssize_t + +howmuch +); + +540  +evbufãr_»ad +( +evbufãr + * +bufãr +, +evutž_sock‘_t + +fd +,  +howmuch +); + +553  +evbufãr_±r + +evbufãr_£¬ch +( +evbufãr + * +bufãr +, cÚ¡ * +wh© +, +size_t + +Ën +, cÚ¡ evbufãr_±¸* +¡¬t +); + +569  +evbufãr_±r + +evbufãr_£¬ch_¿nge +( +evbufãr + * +bufãr +, cÚ¡ * +wh© +, +size_t + +Ën +, cÚ¡ evbufãr_±¸* +¡¬t +, cÚ¡ evbufãr_±¸* +’d +); + +575 + eevbufãr_±r_how + { + +578 +EVBUFFER_PTR_SET +, + +580 +EVBUFFER_PTR_ADD + + +596 +evbufãr_±r_£t +( +evbufãr + * +bufãr +,  +evbufãr_±r + * +±r +, + +597 +size_t + +pos™iÚ +, +evbufãr_±r_how + +how +); + +613  +evbufãr_±r + +evbufãr_£¬ch_eÞ +( +evbufãr + * +bufãr +, + +614  +evbufãr_±r + * +¡¬t +, +size_t + * +eÞ_Ën_out +, + +615 +evbufãr_eÞ_¡yË + +eÞ_¡yË +); + +643  +evbufãr_³ek +( +evbufãr + * +bufãr +, +ev_ssize_t + +Ën +, + +644  +evbufãr_±r + * +¡¬t_© +, + +645  +evbufãr_iovec + * +vec_out +,  +n_vec +); + +652  + sevbufãr_cb_šfo + { + +655 +size_t + +Üig_size +; + +657 +size_t + +n_added +; + +659 +size_t + +n_d–‘ed +; + +681 (* +evbufãr_cb_func +)( + tevbufãr + * + tbufãr +, cÚ¡  + tevbufãr_cb_šfo + * + tšfo +, * + t¬g +); + +683  +evbufãr_cb_’Œy +; + +695  +evbufãr_cb_’Œy + * +evbufãr_add_cb +( +evbufãr + * +bufãr +, +evbufãr_cb_func + +cb +, * +cb¬g +); + +705  +evbufãr_»move_cb_’Œy +( +evbufãr + * +bufãr +, + +706  +evbufãr_cb_’Œy + * +’t +); + +714  +evbufãr_»move_cb +( +evbufãr + * +bufãr +, +evbufãr_cb_func + +cb +, * +cb¬g +); + +721  + #EVBUFFER_CB_ENABLED + 1 + + ) + +730  +evbufãr_cb_£t_æags +( +evbufãr + * +bufãr +, + +731  +evbufãr_cb_’Œy + * +cb +, +ev_ušt32_t + +æags +); + +740  +evbufãr_cb_þ—r_æags +( +evbufãr + * +bufãr +, + +741  +evbufãr_cb_’Œy + * +cb +, +ev_ušt32_t + +æags +); + +753  +evbufãr_cb_su¥’d +( +evbufãr + * +bufãr +,  +evbufãr_cb_’Œy + * +cb +); + +762  +evbufãr_cb_unsu¥’d +( +evbufãr + * +bufãr +,  +evbufãr_cb_’Œy + * +cb +); + +774 * +evbufãr_puÎup +( +evbufãr + * +buf +, +ev_ssize_t + +size +); + +785  +evbufãr_´•’d +( +evbufãr + * +buf +, cÚ¡ * +d©a +, +size_t + +size +); + +795  +evbufãr_´•’d_bufãr +( +evbufãr + * +d¡ +, evbufãr* +¤c +); + +811  +evbufãr_ä“ze +( +evbufãr + * +buf +,  +©_äÚt +); + +820  +evbufãr_unä“ze +( +evbufãr + * +buf +,  +©_äÚt +); + +822  +ev’t_ba£ +; + +830  +evbufãr_deãr_ÿÎbacks +( +evbufãr + * +bufãr +,  +ev’t_ba£ + * +ba£ +); + +832 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/buffer_compat.h + +27 #iâdeà +_EVENT2_BUFFER_COMPAT_H_ + + +28  + #_EVENT2_BUFFER_COMPAT_H_ + + + ) + +48 * +evbufãr_»adlše +( +evbufãr + * +bufãr +); + +70 (* + tevbufãr_cb +)( + tevbufãr + * + tbufãr +, + tsize_t + + tÞd_Ën +, size_ˆ + tÃw_Ën +, * + t¬g +); + +91  + `evbufãr_£tcb +( +evbufãr + * +bufãr +, +evbufãr_cb + +cb +, * +cb¬g +); + +102 * + `evbufãr_fšd +( +evbufãr + * +bufãr +, cÚ¡ * +wh© +, +size_t + +Ën +); + +105  + #EVBUFFER_LENGTH +( +x +è + `evbufãr_g‘_Ëngth +(x) + + ) + +107  + #EVBUFFER_DATA +( +x +è + `evbufãr_puÎup +((x), -1) + + ) + + @/usr/include/event2/bufferevent.h + +27 #iâdeà +_EVENT2_BUFFEREVENT_H_ + + +28  + #_EVENT2_BUFFEREVENT_H_ + + + ) + +77 #ifdeà +__ýlu¥lus + + +81  + ~ + +82 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +83  + ~ + +85 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +86  + ~ + +90  + ~ + +98  + #BEV_EVENT_READING + 0x01 + + ) + +99  + #BEV_EVENT_WRITING + 0x02 + + ) + +100  + #BEV_EVENT_EOF + 0x10 + + ) + +101  + #BEV_EVENT_ERROR + 0x20 + + ) + +102  + #BEV_EVENT_TIMEOUT + 0x40 + + ) + +103  + #BEV_EVENT_CONNECTED + 0x80 + + ) + +111  +bufã»v’t + + +112 #ifdeà +_EVENT_IN_DOXYGEN + + +116  +ev’t_ba£ +; + +117  +evbufãr +; + +118  +sockaddr +; + +133 (* +bufã»v’t_d©a_cb +)( + tbufã»v’t + * + tbev +, * + tùx +); + +149 (* +bufã»v’t_ev’t_cb +)( + tbufã»v’t + * + tbev +,  + twh© +, * + tùx +); + +152 + ebufã»v’t_ÝtiÚs + { + +155 +BEV_OPT_CLOSE_ON_FREE + = (1<<0), + +159 +BEV_OPT_THREADSAFE + = (1<<1), + +162 +BEV_OPT_DEFER_CALLBACKS + = (1<<2), + +168 +BEV_OPT_UNLOCK_CALLBACKS + = (1<<3) + +184  +bufã»v’t + * +bufã»v’t_sock‘_Ãw +( +ev’t_ba£ + * +ba£ +, +evutž_sock‘_t + +fd +,  +ÝtiÚs +); + +205  +bufã»v’t_sock‘_cÚÃù +( +bufã»v’t + *,  +sockaddr + *, ); + +207  +evdns_ba£ +; + +234  +bufã»v’t_sock‘_cÚÃù_ho¡Çme +( +bufã»v’t + *, + +235  +evdns_ba£ + *, , const *, ); + +245  +bufã»v’t_sock‘_g‘_dns_”rÜ +( +bufã»v’t + * +bev +); + +258  +bufã»v’t_ba£_£t +( +ev’t_ba£ + * +ba£ +,  +bufã»v’t + * +buãv +); + +263  +ev’t_ba£ + * +bufã»v’t_g‘_ba£ +( +bufã»v’t + * +bev +); + +274  +bufã»v’t_´iܙy_£t +( +bufã»v’t + * +buãv +,  +´i +); + +282  +bufã»v’t_ä“ +( +bufã»v’t + * +buãv +); + +299  +bufã»v’t_£tcb +( +bufã»v’t + * +buãv +, + +300 +bufã»v’t_d©a_cb + +»adcb +, bufã»v’t_d©a_cb +wr™ecb +, + +301 +bufã»v’t_ev’t_cb + +ev’tcb +, * +cb¬g +); + +310  +bufã»v’t_£tfd +( +bufã»v’t + * +buãv +, +evutž_sock‘_t + +fd +); + +316 +evutž_sock‘_t + +bufã»v’t_g‘fd +( +bufã»v’t + * +buãv +); + +322  +bufã»v’t + * +bufã»v’t_g‘_und”lyšg +(bufã»v’ˆ* +buãv +); + +337  +bufã»v’t_wr™e +( +bufã»v’t + * +buãv +, + +338 cÚ¡ * +d©a +, +size_t + +size +); + +350  +bufã»v’t_wr™e_bufãr +( +bufã»v’t + * +buãv +,  +evbufãr + * +buf +); + +363 +size_t + +bufã»v’t_»ad +( +bufã»v’t + * +buãv +, * +d©a +, size_ˆ +size +); + +373  +bufã»v’t_»ad_bufãr +( +bufã»v’t + * +buãv +,  +evbufãr + * +buf +); + +384  +evbufãr + * +bufã»v’t_g‘_šput +( +bufã»v’t + * +buãv +); + +398  +evbufãr + * +bufã»v’t_g‘_ouut +( +bufã»v’t + * +buãv +); + +408  +bufã»v’t_’abË +( +bufã»v’t + * +buãv +,  +ev’t +); + +418  +bufã»v’t_di§bË +( +bufã»v’t + * +buãv +,  +ev’t +); + +426  +bufã»v’t_g‘_’abËd +( +bufã»v’t + * +buãv +); + +454  +bufã»v’t_£t_timeouts +( +bufã»v’t + * +buãv +, + +455 cÚ¡  +timev® + * +timeout_»ad +, cÚ¡ timev® * +timeout_wr™e +); + +475  +bufã»v’t_£tw©”m¬k +( +bufã»v’t + * +buãv +,  +ev’ts +, + +476 +size_t + +lowm¬k +, size_ˆ +highm¬k +); + +482  +bufã»v’t_lock +( +bufã»v’t + * +buãv +); + +488  +bufã»v’t_uÆock +( +bufã»v’t + * +buãv +); + +494 + ebufã»v’t_æush_mode + { + +496 +BEV_NORMAL + = 0, + +499 +BEV_FLUSH + = 1, + +502 +BEV_FINISHED + = 2 + +513  +bufã»v’t_æush +( +bufã»v’t + * +buãv +, + +514  +iÙy³ +, + +515 +bufã»v’t_æush_mode + +mode +); + +525 + ebufã»v’t_fž‹r_»suÉ + { + +527 +BEV_OK + = 0, + +530 +BEV_NEED_MORE + = 1, + +534 +BEV_ERROR + = 2 + +555  +bufã»v’t_fž‹r_»suÉ + (* + tbufã»v’t_fž‹r_cb +)( + +556  + tevbufãr + * + t¤c +, evbufã¸* + td¡ +, + tev_ssize_t + + td¡_lim™ +, + +557 + tbufã»v’t_æush_mode + + tmode +, * + tùx +); + +572  +bufã»v’t + * + +573 +bufã»v’t_fž‹r_Ãw +( +bufã»v’t + * +und”lyšg +, + +574 +bufã»v’t_fž‹r_cb + +šput_fž‹r +, + +575 +bufã»v’t_fž‹r_cb + +ouut_fž‹r +, + +576  +ÝtiÚs +, + +577 (* +ä“_cڋxt +)(*), + +578 * +ùx +); + +591  +bufã»v’t_·œ_Ãw +( +ev’t_ba£ + * +ba£ +,  +ÝtiÚs +, + +592  +bufã»v’t + * +·œ +[2]); + +598  +bufã»v’t + * +bufã»v’t_·œ_g‘_·¹Ãr +(bufã»v’ˆ* +bev +); + +604  +ev_tok’_buck‘_cfg +; + +610  +bufã»v’t_¿‹_lim™_group +; + +613  + #EV_RATE_LIMIT_MAX + +EV_SSIZE_MAX + + + ) + +631  +ev_tok’_buck‘_cfg + * +ev_tok’_buck‘_cfg_Ãw +( + +632 +size_t + +»ad_¿‹ +, size_ˆ +»ad_bur¡ +, + +633 +size_t + +wr™e_¿‹ +, size_ˆ +wr™e_bur¡ +, + +634 cÚ¡  +timev® + * +tick_Ën +); + +641  +ev_tok’_buck‘_cfg_ä“ +( +ev_tok’_buck‘_cfg + * +cfg +); + +654  +bufã»v’t_£t_¿‹_lim™ +( +bufã»v’t + * +bev +, + +655  +ev_tok’_buck‘_cfg + * +cfg +); + +674  +bufã»v’t_¿‹_lim™_group + * +bufã»v’t_¿‹_lim™_group_Ãw +( + +675  +ev’t_ba£ + * +ba£ +, + +676 cÚ¡  +ev_tok’_buck‘_cfg + * +cfg +); + +682  +bufã»v’t_¿‹_lim™_group_£t_cfg +( + +683  +bufã»v’t_¿‹_lim™_group + *, + +684 cÚ¡  +ev_tok’_buck‘_cfg + *); + +702  +bufã»v’t_¿‹_lim™_group_£t_mš_sh¬e +( + +703  +bufã»v’t_¿‹_lim™_group + *, +size_t +); + +709  +bufã»v’t_¿‹_lim™_group_ä“ +( +bufã»v’t_¿‹_lim™_group + *); + +721  +bufã»v’t_add_to_¿‹_lim™_group +( +bufã»v’t + * +bev +, + +722  +bufã»v’t_¿‹_lim™_group + * +g +); + +725  +bufã»v’t_»move_äom_¿‹_lim™_group +( +bufã»v’t + * +bev +); + +738 +ev_ssize_t + +bufã»v’t_g‘_»ad_lim™ +( +bufã»v’t + * +bev +); + +739 +ev_ssize_t + +bufã»v’t_g‘_wr™e_lim™ +( +bufã»v’t + * +bev +); + +742 +ev_ssize_t + +bufã»v’t_g‘_max_to_»ad +( +bufã»v’t + * +bev +); + +743 +ev_ssize_t + +bufã»v’t_g‘_max_to_wr™e +( +bufã»v’t + * +bev +); + +754 +ev_ssize_t + +bufã»v’t_¿‹_lim™_group_g‘_»ad_lim™ +( + +755  +bufã»v’t_¿‹_lim™_group + *); + +756 +ev_ssize_t + +bufã»v’t_¿‹_lim™_group_g‘_wr™e_lim™ +( + +757  +bufã»v’t_¿‹_lim™_group + *); + +774  +bufã»v’t_deüem’t_»ad_lim™ +( +bufã»v’t + * +bev +, +ev_ssize_t + +deü +); + +775  +bufã»v’t_deüem’t_wr™e_lim™ +( +bufã»v’t + * +bev +, +ev_ssize_t + +deü +); + +791  +bufã»v’t_¿‹_lim™_group_deüem’t_»ad +( + +792  +bufã»v’t_¿‹_lim™_group + *, +ev_ssize_t +); + +793  +bufã»v’t_¿‹_lim™_group_deüem’t_wr™e +( + +794  +bufã»v’t_¿‹_lim™_group + *, +ev_ssize_t +); + +804  +bufã»v’t_¿‹_lim™_group_g‘_tÙ®s +( + +805  +bufã»v’t_¿‹_lim™_group + * +g½ +, + +806 +ev_ušt64_t + * +tÙ®_»ad_out +,ƒv_ušt64_ˆ* +tÙ®_wr™‹n_out +); + +814 +bufã»v’t_¿‹_lim™_group_»£t_tÙ®s +( + +815  +bufã»v’t_¿‹_lim™_group + * +g½ +); + +817 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/bufferevent_compat.h + +28 #iâdeà +_EVENT2_BUFFEREVENT_COMPAT_H_ + + +29  + #_EVENT2_BUFFEREVENT_COMPAT_H_ + + + ) + +31  + #evbufãrcb + +bufã»v’t_d©a_cb + + + ) + +32  + #ev”rÜcb + +bufã»v’t_ev’t_cb + + + ) + +75  +bufã»v’t + * +bufã»v’t_Ãw +( +evutž_sock‘_t + +fd +, + +76 +evbufãrcb + +»adcb +,ƒvbufãrcb +wr™ecb +, +ev”rÜcb + +”rÜcb +, * +cb¬g +); + +86  +bufã»v’t_£‰imeout +( +bufã»v’t + * +buãv +, + +87  +timeout_»ad +,  +timeout_wr™e +); + +89  + #EVBUFFER_READ + +BEV_EVENT_READING + + + ) + +90  + #EVBUFFER_WRITE + +BEV_EVENT_WRITING + + + ) + +91  + #EVBUFFER_EOF + +BEV_EVENT_EOF + + + ) + +92  + #EVBUFFER_ERROR + +BEV_EVENT_ERROR + + + ) + +93  + #EVBUFFER_TIMEOUT + +BEV_EVENT_TIMEOUT + + + ) + +96  + #EVBUFFER_INPUT +( +x +è + `bufã»v’t_g‘_šput +(x) + + ) + +98  + #EVBUFFER_OUTPUT +( +x +è + `bufã»v’t_g‘_ouut +(x) + + ) + + @/usr/include/event2/bufferevent_struct.h + +27 #iâdeà +_EVENT2_BUFFEREVENT_STRUCT_H_ + + +28  + #_EVENT2_BUFFEREVENT_STRUCT_H_ + + + ) + +40 #ifdeà +__ýlu¥lus + + +44  + ~ + +45 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +46  + ~ + +48 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +49  + ~ + +53  + ~ + +55  + ~ + +57  + sev’t_w©”m¬k + { + +58 +size_t + +low +; + +59 +size_t + +high +; + +70  + sbufã»v’t + { + +72  +ev’t_ba£ + * +ev_ba£ +; + +75 cÚ¡  +bufã»v’t_Ýs + * +be_Ýs +; + +80  +ev’t + +ev_»ad +; + +84  +ev’t + +ev_wr™e +; + +88  +evbufãr + * +šput +; + +92  +evbufãr + * +ouut +; + +94  +ev’t_w©”m¬k + +wm_»ad +; + +95  +ev’t_w©”m¬k + +wm_wr™e +; + +97 +bufã»v’t_d©a_cb + +»adcb +; + +98 +bufã»v’t_d©a_cb + +wr™ecb +; + +101 +bufã»v’t_ev’t_cb + +”rÜcb +; + +102 * +cb¬g +; + +104  +timev® + +timeout_»ad +; + +105  +timev® + +timeout_wr™e +; + +109  +’abËd +; + +112 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/event-config.h + +10 #iâdeà +_EVENT2_EVENT_CONFIG_H_ + + +11  + #_EVENT2_EVENT_CONFIG_H_ + + + ) + +31  + #_EVENT_HAVE_ARPA_INET_H + 1 + + ) + +34  + #_EVENT_HAVE_CLOCK_GETTIME + 1 + + ) + +38  + #_EVENT_HAVE_DECL_CTL_KERN + 1 + + ) + +42  + #_EVENT_HAVE_DECL_KERN_ARND + 0 + + ) + +46  + #_EVENT_HAVE_DECL_KERN_RANDOM + 1 + + ) + +50  + #_EVENT_HAVE_DECL_RANDOM_UUID + 1 + + ) + +56  + #_EVENT_HAVE_DLFCN_H + 1 + + ) + +59  + #_EVENT_HAVE_EPOLL + 1 + + ) + +62  + #_EVENT_HAVE_EPOLL_CTL + 1 + + ) + +65  + #_EVENT_HAVE_EVENTFD + 1 + + ) + +71  + #_EVENT_HAVE_FCNTL + 1 + + ) + +74  + #_EVENT_HAVE_FCNTL_H + 1 + + ) + +77  + #_EVENT_HAVE_FD_MASK + 1 + + ) + +80  + #_EVENT_HAVE_GETADDRINFO + 1 + + ) + +83  + #_EVENT_HAVE_GETEGID + 1 + + ) + +86  + #_EVENT_HAVE_GETEUID + 1 + + ) + +101  + #_EVENT_HAVE_GETNAMEINFO + 1 + + ) + +104  + #_EVENT_HAVE_GETPROTOBYNUMBER + 1 + + ) + +110  + #_EVENT_HAVE_GETTIMEOFDAY + 1 + + ) + +113  + #_EVENT_HAVE_INET_ATON + 1 + + ) + +116  + #_EVENT_HAVE_INET_NTOP + 1 + + ) + +119  + #_EVENT_HAVE_INET_PTON + 1 + + ) + +122  + #_EVENT_HAVE_INTTYPES_H + 1 + + ) + +131  + #_EVENT_HAVE_LIBZ + 1 + + ) + +134  + #_EVENT_HAVE_MEMORY_H + 1 + + ) + +137  + #_EVENT_HAVE_MMAP + 1 + + ) + +140  + #_EVENT_HAVE_NETDB_H + 1 + + ) + +146  + #_EVENT_HAVE_NETINET_IN_H + 1 + + ) + +149  + #_EVENT_HAVE_OPENSSL + 1 + + ) + +152  + #_EVENT_HAVE_OPENSSL_BIO_H + 1 + + ) + +155  + #_EVENT_HAVE_PIPE + 1 + + ) + +158  + #_EVENT_HAVE_POLL + 1 + + ) + +161  + #_EVENT_HAVE_POLL_H + 1 + + ) + +173  + #_EVENT_HAVE_PTHREADS + 1 + + ) + +176  + #_EVENT_HAVE_PUTENV + 1 + + ) + +179  + #_EVENT_HAVE_SA_FAMILY_T + 1 + + ) + +182  + #_EVENT_HAVE_SELECT + 1 + + ) + +185  + #_EVENT_HAVE_SENDFILE + 1 + + ) + +188  + #_EVENT_HAVE_SETENV + 1 + + ) + +191  + #_EVENT_HAVE_SETFD + 1 + + ) + +194  + #_EVENT_HAVE_SIGACTION + 1 + + ) + +197  + #_EVENT_HAVE_SIGNAL + 1 + + ) + +200  + #_EVENT_HAVE_SPLICE + 1 + + ) + +203  + #_EVENT_HAVE_STDARG_H + 1 + + ) + +206  + #_EVENT_HAVE_STDDEF_H + 1 + + ) + +209  + #_EVENT_HAVE_STDINT_H + 1 + + ) + +212  + #_EVENT_HAVE_STDLIB_H + 1 + + ) + +215  + #_EVENT_HAVE_STRINGS_H + 1 + + ) + +218  + #_EVENT_HAVE_STRING_H + 1 + + ) + +224  + #_EVENT_HAVE_STRSEP + 1 + + ) + +227  + #_EVENT_HAVE_STRTOK_R + 1 + + ) + +230  + #_EVENT_HAVE_STRTOLL + 1 + + ) + +233  + #_EVENT_HAVE_STRUCT_ADDRINFO + 1 + + ) + +236  + #_EVENT_HAVE_STRUCT_IN6_ADDR + 1 + + ) + +239  + #_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16 + 1 + + ) + +242  + #_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32 + 1 + + ) + +245  + #_EVENT_HAVE_STRUCT_SOCKADDR_IN6 + 1 + + ) + +254  + #_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE + 1 + + ) + +257  + #_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY + 1 + + ) + +266  + #_EVENT_HAVE_SYS_EPOLL_H + 1 + + ) + +269  + #_EVENT_HAVE_SYS_EVENTFD_H + 1 + + ) + +275  + #_EVENT_HAVE_SYS_IOCTL_H + 1 + + ) + +278  + #_EVENT_HAVE_SYS_MMAN_H + 1 + + ) + +281  + #_EVENT_HAVE_SYS_PARAM_H + 1 + + ) + +284  + #_EVENT_HAVE_SYS_QUEUE_H + 1 + + ) + +287  + #_EVENT_HAVE_SYS_SELECT_H + 1 + + ) + +290  + #_EVENT_HAVE_SYS_SENDFILE_H + 1 + + ) + +293  + #_EVENT_HAVE_SYS_SOCKET_H + 1 + + ) + +296  + #_EVENT_HAVE_SYS_STAT_H + 1 + + ) + +299  + #_EVENT_HAVE_SYS_SYSCTL_H + 1 + + ) + +302  + #_EVENT_HAVE_SYS_TIME_H + 1 + + ) + +305  + #_EVENT_HAVE_SYS_TYPES_H + 1 + + ) + +308  + #_EVENT_HAVE_SYS_UIO_H + 1 + + ) + +311  + #_EVENT_HAVE_SYS_WAIT_H + 1 + + ) + +314  + #_EVENT_HAVE_TAILQFOREACH + 1 + + ) + +317  + #_EVENT_HAVE_TIMERADD + 1 + + ) + +320  + #_EVENT_HAVE_TIMERCLEAR + 1 + + ) + +323  + #_EVENT_HAVE_TIMERCMP + 1 + + ) + +326  + #_EVENT_HAVE_TIMERISSET + 1 + + ) + +329  + #_EVENT_HAVE_UINT16_T + 1 + + ) + +332  + #_EVENT_HAVE_UINT32_T + 1 + + ) + +335  + #_EVENT_HAVE_UINT64_T + 1 + + ) + +338  + #_EVENT_HAVE_UINT8_T + 1 + + ) + +341  + #_EVENT_HAVE_UINTPTR_T + 1 + + ) + +344  + #_EVENT_HAVE_UNISTD_H + 1 + + ) + +347  + #_EVENT_HAVE_UNSETENV + 1 + + ) + +350  + #_EVENT_HAVE_VASPRINTF + 1 + + ) + +356  + #_EVENT_HAVE_ZLIB_H + 1 + + ) + +360  + #_EVENT_LT_OBJDIR + ".libs/" + + ) + +366  + #_EVENT_NUMERIC_VERSION + 0x02001000 + + ) + +369  + #_EVENT_PACKAGE + "libev’t" + + ) + +372  + #_EVENT_PACKAGE_BUGREPORT + "" + + ) + +375  + #_EVENT_PACKAGE_NAME + "" + + ) + +378  + #_EVENT_PACKAGE_STRING + "" + + ) + +381  + #_EVENT_PACKAGE_TARNAME + "" + + ) + +384  + #_EVENT_PACKAGE_URL + "" + + ) + +387  + #_EVENT_PACKAGE_VERSION + "" + + ) + +394  + #_EVENT_SIZEOF_INT + 4 + + ) + +397  + #_EVENT_SIZEOF_LONG + 8 + + ) + +400  + #_EVENT_SIZEOF_LONG_LONG + 8 + + ) + +403  + #_EVENT_SIZEOF_PTHREAD_T + 8 + + ) + +406  + #_EVENT_SIZEOF_SHORT + 2 + + ) + +409  + #_EVENT_SIZEOF_SIZE_T + 8 + + ) + +412  + #_EVENT_SIZEOF_VOID_P + 8 + + ) + +415  + #_EVENT_STDC_HEADERS + 1 + + ) + +418  + #_EVENT_TIME_WITH_SYS_TIME + 1 + + ) + +421  + #_EVENT_VERSION + "2.0.16-¡abË" + + ) + +431 #iâdeà +_EVENT___ýlu¥lus + + + @/usr/include/event2/event.h + +27 #iâdeà +_EVENT2_EVENT_H_ + + +28  + #_EVENT2_EVENT_H_ + + + ) + +183 #ifdeà +__ýlu¥lus + + +187  + ~ + +188 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +189  + ~ + +191 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +192  + ~ + +195  + ~<¡dio.h +> + +198  + ~ + +213  +ev’t_ba£ + + +214 #ifdeà +_EVENT_IN_DOXYGEN + + +272  +ev’t + + +273 #ifdeà +_EVENT_IN_DOXYGEN + + +291  +ev’t_cÚfig + + +292 #ifdeà +_EVENT_IN_DOXYGEN + + +317  +ev’t_’abË_debug_mode +(); + +328  +ev’t_debug_uÇssign +( +ev’t + *); + +337  +ev’t_ba£ + * +ev’t_ba£_Ãw +(); + +349  +ev’t_»š™ +( +ev’t_ba£ + * +ba£ +); + +364  +ev’t_ba£_di¥©ch +( +ev’t_ba£ + *); + +372 cÚ¡ * +ev’t_ba£_g‘_m‘hod +(cÚ¡  +ev’t_ba£ + *); + +386 cÚ¡ ** +ev’t_g‘_suµÜ‹d_m‘hods +(); + +398  +ev’t_cÚfig + * +ev’t_cÚfig_Ãw +(); + +405  +ev’t_cÚfig_ä“ +( +ev’t_cÚfig + * +cfg +); + +419  +ev’t_cÚfig_avoid_m‘hod +( +ev’t_cÚfig + * +cfg +, cÚ¡ * +m‘hod +); + +430 + eev’t_m‘hod_ã©u» + { + +432 +EV_FEATURE_ET + = 0x01, + +437 +EV_FEATURE_O1 + = 0x02, + +440 +EV_FEATURE_FDS + = 0x04 + +451 + eev’t_ba£_cÚfig_æag + { + +454 +EVENT_BASE_FLAG_NOLOCK + = 0x01, + +457 +EVENT_BASE_FLAG_IGNORE_ENV + = 0x02, + +464 +EVENT_BASE_FLAG_STARTUP_IOCP + = 0x04, + +468 +EVENT_BASE_FLAG_NO_CACHE_TIME + = 0x08, + +484 +EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST + = 0x10 + +494  +ev’t_ba£_g‘_ã©u»s +(cÚ¡  +ev’t_ba£ + * +ba£ +); + +518  +ev’t_cÚfig_»quœe_ã©u»s +( +ev’t_cÚfig + * +cfg +,  +ã©u» +); + +526  +ev’t_cÚfig_£t_æag +( +ev’t_cÚfig + * +cfg +,  +æag +); + +537  +ev’t_cÚfig_£t_num_ýus_hšt +( +ev’t_cÚfig + * +cfg +,  +ýus +); + +551  +ev’t_ba£ + * +ev’t_ba£_Ãw_w™h_cÚfig +(cÚ¡  +ev’t_cÚfig + *); + +561  +ev’t_ba£_ä“ +( +ev’t_ba£ + *); + +566  + #_EVENT_LOG_DEBUG + 0 + + ) + +567  + #_EVENT_LOG_MSG + 1 + + ) + +568  + #_EVENT_LOG_WARN + 2 + + ) + +569  + #_EVENT_LOG_ERR + 3 + + ) + +577 (* +ev’t_log_cb +)( + t£v”™y +, cÚ¡ * + tmsg +); + +588  +ev’t_£t_log_ÿÎback +( +ev’t_log_cb + +cb +); + +595 (* +ev’t_çl_cb +)( + t”r +); + +609  +ev’t_£t_çl_ÿÎback +( +ev’t_çl_cb + +cb +); + +620  +ev’t_ba£_£t +( +ev’t_ba£ + *,  +ev’t + *); + +629  + #EVLOOP_ONCE + 0x01 + + ) + +632  + #EVLOOP_NONBLOCK + 0x02 + + ) + +653  +ev’t_ba£_loÝ +( +ev’t_ba£ + *, ); + +670  +ev’t_ba£_loÝex™ +( +ev’t_ba£ + *, cÚ¡  +timev® + *); + +685  +ev’t_ba£_loÝb»ak +( +ev’t_ba£ + *); + +699  +ev’t_ba£_gÙ_ex™ +( +ev’t_ba£ + *); + +713  +ev’t_ba£_gÙ_b»ak +( +ev’t_ba£ + *); + +724  + #EV_TIMEOUT + 0x01 + + ) + +726  + #EV_READ + 0x02 + + ) + +728  + #EV_WRITE + 0x04 + + ) + +730  + #EV_SIGNAL + 0x08 + + ) + +737  + #EV_PERSIST + 0x10 + + ) + +739  + #EV_ET + 0x20 + + ) + +747  + #evtim”_assign +( +ev +, +b +, +cb +, +¬g +) \ + +748 + `ev’t_assign +(( +ev +), ( +b +), -1, 0, ( +cb +), ( +¬g +)) + + ) + +749  + #evtim”_Ãw +( +b +, +cb +, +¬g +è + `ev’t_Ãw +((b), -1, 0, (cb), (¬g)) + + ) + +750  + #evtim”_add +( +ev +, +tv +è + `ev’t_add +(Óv), (tv)) + + ) + +751  + #evtim”_d– +( +ev +è + `ev’t_d– +Óv) + + ) + +752  + #evtim”_³ndšg +( +ev +, +tv +è + `ev’t_³ndšg +(Óv), +EV_TIMEOUT +, (tv)) + + ) + +753  + #evtim”_š™Ÿlized +( +ev +è + `ev’t_š™Ÿlized +Óv) + + ) + +762  + #evsigÇl_add +( +ev +, +tv +è + `ev’t_add +(Óv), (tv)) + + ) + +763  + #evsigÇl_assign +( +ev +, +b +, +x +, +cb +, +¬g +) \ + +764 + `ev’t_assign +(( +ev +), ( +b +), ( +x +), +EV_SIGNAL +| +EV_PERSIST +, +cb +, ( +¬g +)) + + ) + +765  + #evsigÇl_Ãw +( +b +, +x +, +cb +, +¬g +) \ + +766 + `ev’t_Ãw +(( +b +), ( +x +), +EV_SIGNAL +| +EV_PERSIST +, ( +cb +), ( +¬g +)) + + ) + +767  + #evsigÇl_d– +( +ev +è + `ev’t_d– +Óv) + + ) + +768  + #evsigÇl_³ndšg +( +ev +, +tv +è + `ev’t_³ndšg +(Óv), +EV_SIGNAL +, (tv)) + + ) + +769  + #evsigÇl_š™Ÿlized +( +ev +è + `ev’t_š™Ÿlized +Óv) + + ) + +783 (* +ev’t_ÿÎback_â +)( + tevutž_sock‘_t +, , *); + +833  +ev’t + * +ev’t_Ãw +( +ev’t_ba£ + *, +evutž_sock‘_t +, , +ev’t_ÿÎback_â +, *); + +874  +ev’t_assign +( +ev’t + *,  +ev’t_ba£ + *, +evutž_sock‘_t +, , +ev’t_ÿÎback_â +, *); + +882  +ev’t_ä“ +( +ev’t + *); + +906  +ev’t_ba£_Úû +( +ev’t_ba£ + *, +evutž_sock‘_t +, , +ev’t_ÿÎback_â +, *, cÚ¡  +timev® + *); + +930  +ev’t_add +( +ev’t + * +ev +, cÚ¡  +timev® + * +timeout +); + +943  +ev’t_d– +( +ev’t + *); + +960  +ev’t_aùive +( +ev’t + * +ev +,  +»s +,  +nÿÎs +); + +975  +ev’t_³ndšg +(cÚ¡  +ev’t + * +ev +,  +ev’ts +,  +timev® + * +tv +); + +993  +ev’t_š™Ÿlized +(cÚ¡  +ev’t + * +ev +); + +998  + #ev’t_g‘_sigÇl +( +ev +è(() + `ev’t_g‘_fd +Óv)) + + ) + +1004 +evutž_sock‘_t + +ev’t_g‘_fd +(cÚ¡  +ev’t + * +ev +); + +1009  +ev’t_ba£ + * +ev’t_g‘_ba£ +(cÚ¡  +ev’t + * +ev +); + +1014  +ev’t_g‘_ev’ts +(cÚ¡  +ev’t + * +ev +); + +1019 +ev’t_ÿÎback_â + +ev’t_g‘_ÿÎback +(cÚ¡  +ev’t + * +ev +); + +1024 * +ev’t_g‘_ÿÎback_¬g +(cÚ¡  +ev’t + * +ev +); + +1033  +ev’t_g‘_assignm’t +(cÚ¡  +ev’t + *event, + +1034  +ev’t_ba£ + ** +ba£_out +, +evutž_sock‘_t + * +fd_out +, * +ev’ts_out +, + +1035 +ev’t_ÿÎback_â + * +ÿÎback_out +, ** +¬g_out +); + +1050 +size_t + +ev’t_g‘_¡ruù_ev’t_size +(); + +1061 cÚ¡ * +ev’t_g‘_v”siÚ +(); + +1074 +ev_ušt32_t + +ev’t_g‘_v”siÚ_numb” +(); + +1077  + #LIBEVENT_VERSION + +_EVENT_VERSION + + + ) + +1080  + #LIBEVENT_VERSION_NUMBER + +_EVENT_NUMERIC_VERSION + + + ) + +1083  + #EVENT_MAX_PRIORITIES + 256 + + ) + +1111  +ev’t_ba£_´iܙy_š™ +( +ev’t_ba£ + *, ); + +1121  +ev’t_´iܙy_£t +( +ev’t + *, ); + +1142 cÚ¡  +timev® + * +ev’t_ba£_š™_commÚ_timeout +( +ev’t_ba£ + * +ba£ +, + +1143 cÚ¡  +timev® + * +du¿tiÚ +); + +1145 #ià! +defšed +( +_EVENT_DISABLE_MM_REPLACEMENT +è|| defšed( +_EVENT_IN_DOXYGEN +) + +1168  +ev’t_£t_mem_funùiÚs +( + +1169 *(* +m®loc_â +)( +size_t + +sz +), + +1170 *(* +»®loc_â +)(* +±r +, +size_t + +sz +), + +1171 (* +ä“_â +)(* +±r +)); + +1174  + #EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED + + + ) + +1177  +ev’t_ba£_dump_ev’ts +( +ev’t_ba£ + *, +FILE + *); + +1190  +ev’t_ba£_g‘timeofday_ÿched +( +ev’t_ba£ + * +ba£ +, + +1191  +timev® + * +tv +); + +1193 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/event_compat.h + +27 #iâdeà +_EVENT2_EVENT_COMPAT_H_ + + +28  + #_EVENT2_EVENT_COMPAT_H_ + + + ) + +45 #ifdeà +__ýlu¥lus + + +49  + ~ + +50 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +51  + ~ + +53 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +54  + ~ + +58  + ~ + +73  +ev’t_ba£ + * +ev’t_š™ +(); + +86  +ev’t_di¥©ch +(); + +99  +ev’t_loÝ +(); + +114  +ev’t_loÝex™ +(cÚ¡  +timev® + *); + +129  +ev’t_loÝb»ak +(); + +140  +ev’t_Úû +( +evutž_sock‘_t + , , + +141 (*)( +evutž_sock‘_t +, , *), *, cÚ¡  +timev® + *); + +153 cÚ¡ * +ev’t_g‘_m‘hod +(); + +165  +ev’t_´iܙy_š™ +(); + +174  +ev’t_£t +( +ev’t + *, +evutž_sock‘_t +, , (*)(evutil_socket_t, , *), *); + +176  + #evtim”_£t +( +ev +, +cb +, +¬g +è + `ev’t_£t +(Óv), -1, 0, (cb), (¬g)) + + ) + +177  + #evsigÇl_£t +( +ev +, +x +, +cb +, +¬g +) \ + +178 + `ev’t_£t +(( +ev +), ( +x +), +EV_SIGNAL +| +EV_PERSIST +, ( +cb +), ( +¬g +)) + + ) + +188  + #timeout_add +( +ev +, +tv +è + `ev’t_add +(Óv), (tv)) + + ) + +189  + #timeout_£t +( +ev +, +cb +, +¬g +è + `ev’t_£t +(Óv), -1, 0, (cb), (¬g)) + + ) + +190  + #timeout_d– +( +ev +è + `ev’t_d– +Óv) + + ) + +191  + #timeout_³ndšg +( +ev +, +tv +è + `ev’t_³ndšg +(Óv), +EV_TIMEOUT +, (tv)) + + ) + +192  + #timeout_š™Ÿlized +( +ev +è + `ev’t_š™Ÿlized +Óv) + + ) + +202  + #sigÇl_add +( +ev +, +tv +è + `ev’t_add +(Óv), (tv)) + + ) + +203  + #sigÇl_£t +( +ev +, +x +, +cb +, +¬g +) \ + +204 + `ev’t_£t +(( +ev +), ( +x +), +EV_SIGNAL +| +EV_PERSIST +, ( +cb +), ( +¬g +)) + + ) + +205  + #sigÇl_d– +( +ev +è + `ev’t_d– +Óv) + + ) + +206  + #sigÇl_³ndšg +( +ev +, +tv +è + `ev’t_³ndšg +(Óv), +EV_SIGNAL +, (tv)) + + ) + +207  + #sigÇl_š™Ÿlized +( +ev +è + `ev’t_š™Ÿlized +Óv) + + ) + +210 #iâdeà +EVENT_FD + + +212  + #EVENT_FD +( +ev +è(() + `ev’t_g‘_fd +Óv)) + + ) + +213  + #EVENT_SIGNAL +( +ev +è + `ev’t_g‘_sigÇl +Óv) + + ) + +216 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/event_struct.h + +27 #iâdeà +_EVENT2_EVENT_STRUCT_H_ + + +28  + #_EVENT2_EVENT_STRUCT_H_ + + + ) + +39 #ifdeà +__ýlu¥lus + + +43  + ~ + +44 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +45  + ~ + +47 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +48  + ~ + +52  + ~ + +55  + ~ + +57  + #EVLIST_TIMEOUT + 0x01 + + ) + +58  + #EVLIST_INSERTED + 0x02 + + ) + +59  + #EVLIST_SIGNAL + 0x04 + + ) + +60  + #EVLIST_ACTIVE + 0x08 + + ) + +61  + #EVLIST_INTERNAL + 0x10 + + ) + +62  + #EVLIST_INIT + 0x80 + + ) + +65  + #EVLIST_ALL + (0xf000 | 0x9f) + + ) + +68 #iâdeà +TAILQ_ENTRY + + +69  + #_EVENT_DEFINED_TQENTRY + + + ) + +70  + #TAILQ_ENTRY +( +ty³ +) \ + +72  +ty³ + * +tqe_Ãxt +; \ + +73  +ty³ + ** +tqe_´ev +; \ + +74 } + + ) + +77 #iâdeà +TAILQ_HEAD + + +78  + #_EVENT_DEFINED_TQHEAD + + + ) + +79  + #TAILQ_HEAD +( +Çme +, +ty³ +) \ + +80  + sÇme + { \ + +81  +ty³ + * +tqh_fœ¡ +; \ + +82  +ty³ + ** +tqh_Ï¡ +; \ + +83 } + + ) + +86  +ev’t_ba£ +; + +87  + sev’t + { + +88 +TAILQ_ENTRY +( +ev’t +è +ev_aùive_Ãxt +; + +89 +TAILQ_ENTRY +( +ev’t +è +ev_Ãxt +; + +92 +TAILQ_ENTRY +( +ev’t +è +ev_Ãxt_w™h_commÚ_timeout +; + +93  +mš_h—p_idx +; + +94 } +ev_timeout_pos +; + +95 +evutž_sock‘_t + +ev_fd +; + +97  +ev’t_ba£ + * +ev_ba£ +; + +102 +TAILQ_ENTRY +( +ev’t +è +ev_io_Ãxt +; + +103  +timev® + +ev_timeout +; + +104 } +ev_io +; + +108 +TAILQ_ENTRY +( +ev’t +è +ev_sigÇl_Ãxt +; + +109  +ev_nÿÎs +; + +111 * +ev_²ÿÎs +; + +112 } +ev_sigÇl +; + +113 } +_ev +; + +115  +ev_ev’ts +; + +116  +ev_»s +; + +117  +ev_æags +; + +118 +ev_ušt8_t + +ev_´i +; + +119 +ev_ušt8_t + +ev_þosu» +; + +120  +timev® + +ev_timeout +; + +123 (* +ev_ÿÎback +)( +evutž_sock‘_t +, , * +¬g +); + +124 * +ev_¬g +; + +127 +TAILQ_HEAD + ( +ev’t_li¡ +, +ev’t +); + +129 #ifdeà +_EVENT_DEFINED_TQENTRY + + +130 #undeà +TAILQ_ENTRY + + +133 #ifdeà +_EVENT_DEFINED_TQHEAD + + +134 #undeà +TAILQ_HEAD + + +137 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/tag.h + +27 #iâdeà +_EVENT2_TAG_H_ + + +28  + #_EVENT2_TAG_H_ + + + ) + +36 #ifdeà +__ýlu¥lus + + +40  + ~ + +41 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +42  + ~ + +44 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +45  + ~ + +49  + ~ + +51  +evbufãr +; + +59  +evg_š™ +(); + +68  +evg_unm¬sh®_h—d” +( +evbufãr + * +evbuf +, +ev_ušt32_t + * +±ag +); + +70  +evg_m¬sh® +( +evbufãr + * +evbuf +, +ev_ušt32_t + +g +, cÚ¡ * +d©a +, + +71 +ev_ušt32_t + +Ën +); + +72  +evg_m¬sh®_bufãr +( +evbufãr + * +evbuf +, +ev_ušt32_t + +g +, + +73  +evbufãr + * +d©a +); + +85  +evg_’code_št +( +evbufãr + * +evbuf +, +ev_ušt32_t + +numb” +); + +86  +evg_’code_št64 +( +evbufãr + * +evbuf +, +ev_ušt64_t + +numb” +); + +88  +evg_m¬sh®_št +( +evbufãr + * +evbuf +, +ev_ušt32_t + +g +, + +89 +ev_ušt32_t + +š‹g” +); + +90  +evg_m¬sh®_št64 +( +evbufãr + * +evbuf +, +ev_ušt32_t + +g +, + +91 +ev_ušt64_t + +š‹g” +); + +93  +evg_m¬sh®_¡ršg +( +evbufãr + * +buf +, +ev_ušt32_t + +g +, + +94 cÚ¡ * +¡ršg +); + +96  +evg_m¬sh®_timev® +( +evbufãr + * +evbuf +, +ev_ušt32_t + +g +, + +97  +timev® + * +tv +); + +99  +evg_unm¬sh® +( +evbufãr + * +¤c +, +ev_ušt32_t + * +±ag +, + +100  +evbufãr + * +d¡ +); + +101  +evg_³ek +( +evbufãr + * +evbuf +, +ev_ušt32_t + * +±ag +); + +102  +evg_³ek_Ëngth +( +evbufãr + * +evbuf +, +ev_ušt32_t + * +¶’gth +); + +103  +evg_·ylßd_Ëngth +( +evbufãr + * +evbuf +, +ev_ušt32_t + * +¶’gth +); + +104  +evg_cÚsume +( +evbufãr + * +evbuf +); + +106  +evg_unm¬sh®_št +( +evbufãr + * +evbuf +, +ev_ušt32_t + +Ãed_g +, + +107 +ev_ušt32_t + * +pš‹g” +); + +108  +evg_unm¬sh®_št64 +( +evbufãr + * +evbuf +, +ev_ušt32_t + +Ãed_g +, + +109 +ev_ušt64_t + * +pš‹g” +); + +111  +evg_unm¬sh®_fixed +( +evbufãr + * +¤c +, +ev_ušt32_t + +Ãed_g +, + +112 * +d©a +, +size_t + +Ën +); + +114  +evg_unm¬sh®_¡ršg +( +evbufãr + * +evbuf +, +ev_ušt32_t + +Ãed_g +, + +115 ** +p¡ršg +); + +117  +evg_unm¬sh®_timev® +( +evbufãr + * +evbuf +, +ev_ušt32_t + +Ãed_g +, + +118  +timev® + * +±v +); + +120 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/tag_compat.h + +27 #iâdeà +_EVENT2_TAG_COMPAT_H_ + + +28  + #_EVENT2_TAG_COMPAT_H_ + + + ) + +45  + #’code_št +( +evbuf +, +numb” +è + `evg_’code_št +(Óvbuf), (numb”)) + + ) + +46  + #’code_št64 +( +evbuf +, +numb” +è + `evg_’code_št64 +(Óvbuf), (numb”)) + + ) + + @/usr/include/evutil.h + +26 #iâdeà +_EVUTIL_H_ + + +27  + #_EVUTIL_H_ + + + ) + +37  + ~ + + @/usr/include/features.h + +20 #iâdef +_FEATURES_H + + +21  + #_FEATURES_H + 1 + + ) + +97 #undeà +__USE_ISOC99 + + +98 #undeà +__USE_ISOC95 + + +99 #undeà +__USE_POSIX + + +100 #undeà +__USE_POSIX2 + + +101 #undeà +__USE_POSIX199309 + + +102 #undeà +__USE_POSIX199506 + + +103 #undeà +__USE_XOPEN + + +104 #undeà +__USE_XOPEN_EXTENDED + + +105 #undeà +__USE_UNIX98 + + +106 #undeà +__USE_XOPEN2K + + +107 #undeà +__USE_XOPEN2KXSI + + +108 #undeà +__USE_XOPEN2K8 + + +109 #undeà +__USE_XOPEN2K8XSI + + +110 #undeà +__USE_LARGEFILE + + +111 #undeà +__USE_LARGEFILE64 + + +112 #undeà +__USE_FILE_OFFSET64 + + +113 #undeà +__USE_BSD + + +114 #undeà +__USE_SVID + + +115 #undeà +__USE_MISC + + +116 #undeà +__USE_ATFILE + + +117 #undeà +__USE_GNU + + +118 #undeà +__USE_REENTRANT + + +119 #undeà +__USE_FORTIFY_LEVEL + + +120 #undeà +__FAVOR_BSD + + +121 #undeà +__KERNEL_STRICT_NAMES + + +125 #iâdeà +_LOOSE_KERNEL_NAMES + + +126  + #__KERNEL_STRICT_NAMES + + + ) + +130  + #__USE_ANSI + 1 + + ) + +139 #ià +defšed + +__GNUC__ + && defšed +__GNUC_MINOR__ + + +140  + #__GNUC_PREREQ +( +maj +, +mš +) \ + +141 (( +__GNUC__ + << 16è+ +__GNUC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +143  + #__GNUC_PREREQ +( +maj +, +mš +è0 + + ) + +148 #ià +defšed + +_BSD_SOURCE + && \ + +149 !( +defšed + + g_POSIX_SOURCE + || defšed + g_POSIX_C_SOURCE + || \ + +150 +defšed + + g_XOPEN_SOURCE + || defšed + g_GNU_SOURCE + || defšed + g_SVID_SOURCE +) + +151  + #__FAVOR_BSD + 1 + + ) + +155 #ifdeà +_GNU_SOURCE + + +156 #undeà +_ISOC95_SOURCE + + +157  + #_ISOC95_SOURCE + 1 + + ) + +158 #undeà +_ISOC99_SOURCE + + +159  + #_ISOC99_SOURCE + 1 + + ) + +160 #undeà +_POSIX_SOURCE + + +161  + #_POSIX_SOURCE + 1 + + ) + +162 #undeà +_POSIX_C_SOURCE + + +163  + #_POSIX_C_SOURCE + 200809L + + ) + +164 #undeà +_XOPEN_SOURCE + + +165  + #_XOPEN_SOURCE + 700 + + ) + +166 #undeà +_XOPEN_SOURCE_EXTENDED + + +167  + #_XOPEN_SOURCE_EXTENDED + 1 + + ) + +168 #undeà +_LARGEFILE64_SOURCE + + +169  + #_LARGEFILE64_SOURCE + 1 + + ) + +170 #undeà +_BSD_SOURCE + + +171  + #_BSD_SOURCE + 1 + + ) + +172 #undeà +_SVID_SOURCE + + +173  + #_SVID_SOURCE + 1 + + ) + +174 #undeà +_ATFILE_SOURCE + + +175  + #_ATFILE_SOURCE + 1 + + ) + +180 #ià(! +defšed + +__STRICT_ANSI__ + && !defšed +_ISOC99_SOURCE + && \ + +181 ! +defšed + + g_POSIX_SOURCE + && !defšed + g_POSIX_C_SOURCE + && \ + +182 ! +defšed + + g_XOPEN_SOURCE + && !defšed + g_BSD_SOURCE + && !defšed + g_SVID_SOURCE +) + +183  + #_BSD_SOURCE + 1 + + ) + +184  + #_SVID_SOURCE + 1 + + ) + +191 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +192 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L)) + +193  + #__USE_ISOC99 + 1 + + ) + +197 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +198 || ( +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199409L)) + +199  + #__USE_ISOC95 + 1 + + ) + +204 #ià((! +defšed + +__STRICT_ANSI__ + || ( +_XOPEN_SOURCE + - 0) >= 500) && \ + +205 ! +defšed + +_POSIX_SOURCE + && !defšed +_POSIX_C_SOURCE +) + +206  + #_POSIX_SOURCE + 1 + + ) + +207 #ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 500 + +208  + #_POSIX_C_SOURCE + 2 + + ) + +209 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 600 + +210  + #_POSIX_C_SOURCE + 199506L + + ) + +211 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 700 + +212  + #_POSIX_C_SOURCE + 200112L + + ) + +214  + #_POSIX_C_SOURCE + 200809L + + ) + +216  + #__USE_POSIX_IMPLICITLY + 1 + + ) + +219 #ià +defšed + +_POSIX_SOURCE + || +_POSIX_C_SOURCE + >ð1 || defšed +_XOPEN_SOURCE + + +220  + #__USE_POSIX + 1 + + ) + +223 #ià +defšed + +_POSIX_C_SOURCE + && _POSIX_C_SOURCE >ð2 || defšed +_XOPEN_SOURCE + + +224  + #__USE_POSIX2 + 1 + + ) + +227 #ià( +_POSIX_C_SOURCE + - 0) >= 199309L + +228  + #__USE_POSIX199309 + 1 + + ) + +231 #ià( +_POSIX_C_SOURCE + - 0) >= 199506L + +232  + #__USE_POSIX199506 + 1 + + ) + +235 #ià( +_POSIX_C_SOURCE + - 0) >= 200112L + +236  + #__USE_XOPEN2K + 1 + + ) + +237 #undeà +__USE_ISOC95 + + +238  + #__USE_ISOC95 + 1 + + ) + +239 #undeà +__USE_ISOC99 + + +240  + #__USE_ISOC99 + 1 + + ) + +243 #ià( +_POSIX_C_SOURCE + - 0) >= 200809L + +244  + #__USE_XOPEN2K8 + 1 + + ) + +245 #undeà +_ATFILE_SOURCE + + +246  + #_ATFILE_SOURCE + 1 + + ) + +249 #ifdef +_XOPEN_SOURCE + + +250  + #__USE_XOPEN + 1 + + ) + +251 #ià( +_XOPEN_SOURCE + - 0) >= 500 + +252  + #__USE_XOPEN_EXTENDED + 1 + + ) + +253  + #__USE_UNIX98 + 1 + + ) + +254 #undeà +_LARGEFILE_SOURCE + + +255  + #_LARGEFILE_SOURCE + 1 + + ) + +256 #ià( +_XOPEN_SOURCE + - 0) >= 600 + +257 #ià( +_XOPEN_SOURCE + - 0) >= 700 + +258  + #__USE_XOPEN2K8 + 1 + + ) + +259  + #__USE_XOPEN2K8XSI + 1 + + ) + +261  + #__USE_XOPEN2K + 1 + + ) + +262  + #__USE_XOPEN2KXSI + 1 + + ) + +263 #undeà +__USE_ISOC95 + + +264  + #__USE_ISOC95 + 1 + + ) + +265 #undeà +__USE_ISOC99 + + +266  + #__USE_ISOC99 + 1 + + ) + +269 #ifdeà +_XOPEN_SOURCE_EXTENDED + + +270  + #__USE_XOPEN_EXTENDED + 1 + + ) + +275 #ifdeà +_LARGEFILE_SOURCE + + +276  + #__USE_LARGEFILE + 1 + + ) + +279 #ifdeà +_LARGEFILE64_SOURCE + + +280  + #__USE_LARGEFILE64 + 1 + + ) + +283 #ià +defšed + +_FILE_OFFSET_BITS + && _FILE_OFFSET_BITS == 64 + +284  + #__USE_FILE_OFFSET64 + 1 + + ) + +287 #ià +defšed + +_BSD_SOURCE + || defšed +_SVID_SOURCE + + +288  + #__USE_MISC + 1 + + ) + +291 #ifdef +_BSD_SOURCE + + +292  + #__USE_BSD + 1 + + ) + +295 #ifdef +_SVID_SOURCE + + +296  + #__USE_SVID + 1 + + ) + +299 #ifdef +_ATFILE_SOURCE + + +300  + #__USE_ATFILE + 1 + + ) + +303 #ifdef +_GNU_SOURCE + + +304  + #__USE_GNU + 1 + + ) + +307 #ià +defšed + +_REENTRANT + || defšed +_THREAD_SAFE + + +308  + #__USE_REENTRANT + 1 + + ) + +311 #ià +defšed + +_FORTIFY_SOURCE + && _FORTIFY_SOURCE > 0 \ + +312 && +__GNUC_PREREQ + (4, 1è&& +defšed + + g__OPTIMIZE__ + && __OPTIMIZE__ > 0 + +313 #ià +_FORTIFY_SOURCE + > 1 + +314  + #__USE_FORTIFY_LEVEL + 2 + + ) + +316  + #__USE_FORTIFY_LEVEL + 1 + + ) + +319  + #__USE_FORTIFY_LEVEL + 0 + + ) + +323  + ~ + +326  + #__STDC_ISO_10646__ + 200009L + + ) + +334 #undeà +__GNU_LIBRARY__ + + +335  + #__GNU_LIBRARY__ + 6 + + ) + +339  + #__GLIBC__ + 2 + + ) + +340  + #__GLIBC_MINOR__ + 13 + + ) + +342  + #__GLIBC_PREREQ +( +maj +, +mš +) \ + +343 (( +__GLIBC__ + << 16è+ +__GLIBC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +346 #ià +defšed + +__GNUC__ + \ + +347 || ( +defšed + + g__PGI + && defšed + g__i386__ + ) \ + +348 || ( +defšed + + g__INTEL_COMPILER + && (defšed + g__i386__ + || defšed + g__Ÿ64__ +)) \ + +349 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L) + +350  + #__GLIBC_HAVE_LONG_LONG + 1 + + ) + +354 #iâdeà +__ASSEMBLER__ + + +355 #iâdeà +_SYS_CDEFS_H + + +356  + ~ + +361 #ià +defšed + +__USE_FILE_OFFSET64 + && !defšed +__REDIRECT + + +362  + #__USE_LARGEFILE + 1 + + ) + +363  + #__USE_LARGEFILE64 + 1 + + ) + +369 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +370 && ! +defšed + + g__OPTIMIZE_SIZE__ + && !defšed + g__NO_INLINE__ + \ + +371 && +defšed + + g__ex‹º_šlše + + +372  + #__USE_EXTERN_INLINES + 1 + + ) + +377 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +378 && ( +defšed + + g_LIBC + || !defšed + g__OPTIMIZE_SIZE__ +è&& !defšed + g__NO_INLINE__ + \ + +379 && +defšed + + g__ex‹º_šlše + + +380  + #__USE_EXTERN_INLINES_IN_LIBC + 1 + + ) + +388  + ~ + + @/usr/include/getopt.h + +21 #iâdeà +_GETOPT_H + + +23 #iâdeà +__Ãed_g‘Ýt + + +24  + #_GETOPT_H + 1 + + ) + +34 #ià! +defšed + +__GNU_LIBRARY__ + + +35  + ~<ùy³.h +> + +38 #iâdeà +__THROW + + +39 #iâdeà +__GNUC_PREREQ + + +40  + #__GNUC_PREREQ +( +maj +, +mš +è(0) + + ) + +42 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (2,8) + +43  + #__THROW + + `throw + () + + ) + +45  + #__THROW + + + ) + +49 #ifdef +__ýlu¥lus + + +59 * +ݏrg +; + +73  +Ýtšd +; + +78  +݋¼ +; + +82  +ÝtÝt +; + +84 #iâdeà +__Ãed_g‘Ýt + + +106  + sÝtiÚ + + +108 cÚ¡ * + gÇme +; + +111  + ghas_¬g +; + +112 * + gæag +; + +113  + gv® +; + +118  + #no_¬gum’t + 0 + + ) + +119  + #»quœed_¬gum’t + 1 + + ) + +120  + #ÝtiÚ®_¬gum’t + 2 + + ) + +148 #ifdeà +__GNU_LIBRARY__ + + +152  +g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, cÚ¡ * +__shÜtÝts +) + +153 +__THROW +; + +155 #ià +defšed + +__Ãed_g‘Ýt + && defšed +__USE_POSIX2 + \ + +156 && ! +defšed + + g__USE_POSIX_IMPLICITLY + && !defšed + g__USE_GNU + + +160 #ifdeà +__REDIRECT + + +161  +__REDIRECT_NTH + ( +g‘Ýt +, ( +___¬gc +, *cÚ¡ * +___¬gv +, + +162 cÚ¡ * +__shÜtÝts +), + +163 +__posix_g‘Ýt +); + +165  +__posix_g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +166 cÚ¡ * +__shÜtÝts +è +__THROW +; + +167  + #g‘Ýt + +__posix_g‘Ýt + + + ) + +171  +g‘Ýt + (); + +174 #iâdeà +__Ãed_g‘Ýt + + +175  +g‘Ýt_lÚg + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +176 cÚ¡ * +__shÜtÝts +, + +177 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +178 +__THROW +; + +179  +g‘Ýt_lÚg_Úly + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +180 cÚ¡ * +__shÜtÝts +, + +181 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +182 +__THROW +; + +186 #ifdef +__ýlu¥lus + + +191 #undeà +__Ãed_g‘Ýt + + + @/usr/include/libio.h + +29 #iâdeà +_IO_STDIO_H + + +30  + #_IO_STDIO_H + + + ) + +32  + ~<_G_cÚfig.h +> + +34  + #_IO_pos_t + +_G_åos_t + + + ) + +35  + #_IO_åos_t + +_G_åos_t + + + ) + +36  + #_IO_åos64_t + +_G_åos64_t + + + ) + +37  + #_IO_size_t + +_G_size_t + + + ) + +38  + #_IO_ssize_t + +_G_ssize_t + + + ) + +39  + #_IO_off_t + +_G_off_t + + + ) + +40  + #_IO_off64_t + +_G_off64_t + + + ) + +41  + #_IO_pid_t + +_G_pid_t + + + ) + +42  + #_IO_uid_t + +_G_uid_t + + + ) + +43  + #_IO_icÚv_t + +_G_icÚv_t + + + ) + +44  + #_IO_HAVE_SYS_WAIT + +_G_HAVE_SYS_WAIT + + + ) + +45  + #_IO_HAVE_ST_BLKSIZE + +_G_HAVE_ST_BLKSIZE + + + ) + +46  + #_IO_BUFSIZ + +_G_BUFSIZ + + + ) + +47  + #_IO_va_li¡ + +_G_va_li¡ + + + ) + +48  + #_IO_wšt_t + +_G_wšt_t + + + ) + +50 #ifdeà +_G_NEED_STDARG_H + + +52  + #__Ãed___va_li¡ + + + ) + +53  + ~<¡d¬g.h +> + +54 #ifdeà +__GNUC_VA_LIST + + +55 #undeà +_IO_va_li¡ + + +56  + #_IO_va_li¡ + +__gnuc_va_li¡ + + + ) + +60 #iâdeà +__P + + +61 #ià +_G_HAVE_SYS_CDEFS + + +62  + ~ + +64 #ifdeà +__STDC__ + + +65  + #__P +( +p +è + ) +p + +66  + #__PMT +( +p +è + ) +p + +68  + #__P +( +p +è() + + ) + +69  + #__PMT +( +p +è() + + ) + +75 #iâdeà +_PARAMS + + +76  + #_PARAMS +( +´Ùos +è + `__P +ÕrÙos) + + ) + +79 #iâdeà +__STDC__ + + +81 cÚ¡ + + ) + +84  + #_IO_UNIFIED_JUMPTABLES + 1 + + ) + +85 #iâdeà +_G_HAVE_PRINTF_FP + + +86  + #_IO_USE_DTOA + 1 + + ) + +89 #iâdeà +EOF + + +90  + #EOF + (-1) + + ) + +92 #iâdeà +NULL + + +93 #ià +defšed + +__GNUG__ + && \ + +94 ( + g__GNUC__ + > 2 || (__GNUC__ =ð2 && +__GNUC_MINOR__ + >= 8)) + +95  + #NULL + ( +__nuÎ +) + + ) + +97 #ià! +defšed +( +__ýlu¥lus +) + +98  + #NULL + ((*)0) + + ) + +100  + #NULL + (0) + + ) + +105  + #_IOS_INPUT + 1 + + ) + +106  + #_IOS_OUTPUT + 2 + + ) + +107  + #_IOS_ATEND + 4 + + ) + +108  + #_IOS_APPEND + 8 + + ) + +109  + #_IOS_TRUNC + 16 + + ) + +110  + #_IOS_NOCREATE + 32 + + ) + +111  + #_IOS_NOREPLACE + 64 + + ) + +112  + #_IOS_BIN + 128 + + ) + +120  + #_IO_MAGIC + 0xFBAD0000 + + ) + +121  + #_OLD_STDIO_MAGIC + 0xFABC0000 + + ) + +122  + #_IO_MAGIC_MASK + 0xFFFF0000 + + ) + +123  + #_IO_USER_BUF + 1 + + ) + +124  + #_IO_UNBUFFERED + 2 + + ) + +125  + #_IO_NO_READS + 4 + + ) + +126  + #_IO_NO_WRITES + 8 + + ) + +127  + #_IO_EOF_SEEN + 0x10 + + ) + +128  + #_IO_ERR_SEEN + 0x20 + + ) + +129  + #_IO_DELETE_DONT_CLOSE + 0x40 + + ) + +130  + #_IO_LINKED + 0x80 + + ) + +131  + #_IO_IN_BACKUP + 0x100 + + ) + +132  + #_IO_LINE_BUF + 0x200 + + ) + +133  + #_IO_TIED_PUT_GET + 0x400 + + ) + +134  + #_IO_CURRENTLY_PUTTING + 0x800 + + ) + +135  + #_IO_IS_APPENDING + 0x1000 + + ) + +136  + #_IO_IS_FILEBUF + 0x2000 + + ) + +137  + #_IO_BAD_SEEN + 0x4000 + + ) + +138  + #_IO_USER_LOCK + 0x8000 + + ) + +140  + #_IO_FLAGS2_MMAP + 1 + + ) + +141  + #_IO_FLAGS2_NOTCANCEL + 2 + + ) + +142 #ifdeà +_LIBC + + +143  + #_IO_FLAGS2_FORTIFY + 4 + + ) + +145  + #_IO_FLAGS2_USER_WBUF + 8 + + ) + +146 #ifdeà +_LIBC + + +147  + #_IO_FLAGS2_SCANF_STD + 16 + + ) + +151  + #_IO_SKIPWS + 01 + + ) + +152  + #_IO_LEFT + 02 + + ) + +153  + #_IO_RIGHT + 04 + + ) + +154  + #_IO_INTERNAL + 010 + + ) + +155  + #_IO_DEC + 020 + + ) + +156  + #_IO_OCT + 040 + + ) + +157  + #_IO_HEX + 0100 + + ) + +158  + #_IO_SHOWBASE + 0200 + + ) + +159  + #_IO_SHOWPOINT + 0400 + + ) + +160  + #_IO_UPPERCASE + 01000 + + ) + +161  + #_IO_SHOWPOS + 02000 + + ) + +162  + #_IO_SCIENTIFIC + 04000 + + ) + +163  + #_IO_FIXED + 010000 + + ) + +164  + #_IO_UNITBUF + 020000 + + ) + +165  + #_IO_STDIO + 040000 + + ) + +166  + #_IO_DONT_CLOSE + 0100000 + + ) + +167  + #_IO_BOOLALPHA + 0200000 + + ) + +170  +_IO_jump_t +;  + g_IO_FILE +; + +173 #ifdeà +_IO_MTSAFE_IO + + +174 #ià +defšed + +__GLIBC__ + && __GLIBC__ >= 2 + +175  + ~ + +180  + t_IO_lock_t +; + +186  + s_IO_m¬k” + { + +187  +_IO_m¬k” + * + m_Ãxt +; + +188  +_IO_FILE + * + m_sbuf +; + +192  + m_pos +; + +194  +£t_¡»ampos +( +¡»ampos + +¥ +è{ + m_¥os + = sp; } + +195  +£t_off£t +( +off£t +è{ + m_pos + = off£t; + m_¥os + = ( +¡»ampos +)(-2); } + +196 + mpublic +: + +197 +¡»amm¬k” +( +¡»ambuf + * +sb +); + +198 ~ +¡»amm¬k” +(); + +199  +§všg +(è{  + m_¥os + == -2; } + +200  +d– +( +¡»amm¬k” +&); + +201  +d– +(); + +206 + e__codecvt_»suÉ + + +208 + m__codecvt_ok +, + +209 + m__codecvt_·¹Ÿl +, + +210 + m__codecvt_”rÜ +, + +211 + m__codecvt_nocÚv + + +214 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +217  + s_IO_codecvt + + +219 (* + m__codecvt_de¡r +è( + m_IO_codecvt + *); + +220 +__codecvt_»suÉ + (* +__codecvt_do_out +è( + m_IO_codecvt + *, + +221 + m__mb¡©e_t + *, + +222 cÚ¡ + mwch¬_t + *, + +223 cÚ¡ + mwch¬_t + *, + +224 cÚ¡ + mwch¬_t + **, *, + +226 +__codecvt_»suÉ + (* +__codecvt_do_unshiá +è( + m_IO_codecvt + *, + +227 + m__mb¡©e_t + *, *, + +229 +__codecvt_»suÉ + (* +__codecvt_do_š +è( + m_IO_codecvt + *, + +230 + m__mb¡©e_t + *, + +232 cÚ¡ **, + mwch¬_t + *, + +233 + mwch¬_t + *, wchar_t **); + +234 (* + m__codecvt_do_’codšg +è( + m_IO_codecvt + *); + +235 (* + m__codecvt_do_®ways_nocÚv +è( + m_IO_codecvt + *); + +236 (* + m__codecvt_do_Ëngth +è( + m_IO_codecvt + *, + m__mb¡©e_t + *, + +237 cÚ¡ *, cÚ¡ *, + m_IO_size_t +); + +238 (* + m__codecvt_do_max_Ëngth +è( + m_IO_codecvt + *); + +240 +_IO_icÚv_t + + m__cd_š +; + +241 +_IO_icÚv_t + + m__cd_out +; + +245  + s_IO_wide_d©a + + +247 +wch¬_t + * + m_IO_»ad_±r +; + +248 +wch¬_t + * + m_IO_»ad_’d +; + +249 +wch¬_t + * + m_IO_»ad_ba£ +; + +250 +wch¬_t + * + m_IO_wr™e_ba£ +; + +251 +wch¬_t + * + m_IO_wr™e_±r +; + +252 +wch¬_t + * + m_IO_wr™e_’d +; + +253 +wch¬_t + * + m_IO_buf_ba£ +; + +254 +wch¬_t + * + m_IO_buf_’d +; + +256 +wch¬_t + * + m_IO_§ve_ba£ +; + +257 +wch¬_t + * + m_IO_backup_ba£ +; + +259 +wch¬_t + * + m_IO_§ve_’d +; + +261 +__mb¡©e_t + + m_IO_¡©e +; + +262 +__mb¡©e_t + + m_IO_Ï¡_¡©e +; + +263  +_IO_codecvt + + m_codecvt +; + +265 +wch¬_t + + m_shÜtbuf +[1]; + +267 cÚ¡  +_IO_jump_t + * + m_wide_vbË +; + +271  + s_IO_FILE + { + +272  + m_æags +; + +273  + #_IO_fže_æags + +_æags + + + ) + +277 * + m_IO_»ad_±r +; + +278 * + m_IO_»ad_’d +; + +279 * + m_IO_»ad_ba£ +; + +280 * + m_IO_wr™e_ba£ +; + +281 * + m_IO_wr™e_±r +; + +282 * + m_IO_wr™e_’d +; + +283 * + m_IO_buf_ba£ +; + +284 * + m_IO_buf_’d +; + +286 * + m_IO_§ve_ba£ +; + +287 * + m_IO_backup_ba£ +; + +288 * + m_IO_§ve_’d +; + +290  +_IO_m¬k” + * + m_m¬k”s +; + +292  +_IO_FILE + * + m_chaš +; + +294  + m_fž’o +; + +296  + m_blksize +; + +298  + m_æags2 +; + +300 +_IO_off_t + + m_Þd_off£t +; + +302  + #__HAVE_COLUMN + + + ) + +304  + m_cur_cÞumn +; + +305 sigÃd  + m_vbË_off£t +; + +306  + m_shÜtbuf +[1]; + +310 +_IO_lock_t + * + m_lock +; + +311 #ifdeà +_IO_USE_OLD_IO_FILE + + +314  + s_IO_FILE_com¶‘e + + +316  +_IO_FILE + + m_fže +; + +318 #ià +defšed + +_G_IO_IO_FILE_VERSION + && _G_IO_IO_FILE_VERSION == 0x20001 + +319 +_IO_off64_t + + m_off£t +; + +320 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +322  +_IO_codecvt + * + m_codecvt +; + +323  +_IO_wide_d©a + * + m_wide_d©a +; + +324  +_IO_FILE + * + m_䓻s_li¡ +; + +325 * + m_䓻s_buf +; + +326 +size_t + + m_䓻s_size +; + +328 * + m__·d1 +; + +329 * + m__·d2 +; + +330 * + m__·d3 +; + +331 * + m__·d4 +; + +332 +size_t + + m__·d5 +; + +334  + m_mode +; + +336  + m_unu£d2 +[15 *  (è- 4 *  (*è-  ( +size_t +)]; + +340 #iâdeà +__ýlu¥lus + + +341  +_IO_FILE + + t_IO_FILE +; + +344  + g_IO_FILE_¶us +; + +346  +_IO_FILE_¶us + +_IO_2_1_¡dš_ +; + +347  +_IO_FILE_¶us + +_IO_2_1_¡dout_ +; + +348  +_IO_FILE_¶us + +_IO_2_1_¡d”r_ +; + +349 #iâdeà +_LIBC + + +350  + #_IO_¡dš + (( +_IO_FILE +*)(& +_IO_2_1_¡dš_ +)) + + ) + +351  + #_IO_¡dout + (( +_IO_FILE +*)(& +_IO_2_1_¡dout_ +)) + + ) + +352  + #_IO_¡d”r + (( +_IO_FILE +*)(& +_IO_2_1_¡d”r_ +)) + + ) + +354 +_IO_FILE + * +_IO_¡dš + +©Œibu‹_hidd’ +; + +355 +_IO_FILE + * +_IO_¡dout + +©Œibu‹_hidd’ +; + +356 +_IO_FILE + * +_IO_¡d”r + +©Œibu‹_hidd’ +; + +364  +__ssize_t + + t__io_»ad_â + (* + t__cook› +, * + t__buf +, + tsize_t + + t__nby‹s +); + +372  +__ssize_t + + t__io_wr™e_â + (* + t__cook› +, + t__cÚ¡ + * + t__buf +, + +373 + tsize_t + + t__n +); + +381  + t__io_£ek_â + (* + t__cook› +, + t_IO_off64_t + * + t__pos +,  + t__w +); + +384  + t__io_þo£_â + (* + t__cook› +); + +387 #ifdeà +_GNU_SOURCE + + +389  +__io_»ad_â + + tcook›_»ad_funùiÚ_t +; + +390  +__io_wr™e_â + + tcook›_wr™e_funùiÚ_t +; + +391  +__io_£ek_â + + tcook›_£ek_funùiÚ_t +; + +392  +__io_þo£_â + + tcook›_þo£_funùiÚ_t +; + +397 +__io_»ad_â + * + m»ad +; + +398 +__io_wr™e_â + * + mwr™e +; + +399 +__io_£ek_â + * + m£ek +; + +400 +__io_þo£_â + * + mþo£ +; + +401 } + t_IO_cook›_io_funùiÚs_t +; + +402  +_IO_cook›_io_funùiÚs_t + + tcook›_io_funùiÚs_t +; + +404  + g_IO_cook›_fže +; + +407  +_IO_cook›_š™ + ( +_IO_cook›_fže + * +__cfže +,  +__»ad_wr™e +, + +408 * +__cook› +, +_IO_cook›_io_funùiÚs_t + +__âs +); + +412 #ifdeà +__ýlu¥lus + + +416  +__und”æow + ( +_IO_FILE + *); + +417  +__uæow + ( +_IO_FILE + *); + +418  +__ov”æow + ( +_IO_FILE + *, ); + +419 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +420 +_IO_wšt_t + +__wund”æow + ( +_IO_FILE + *); + +421 +_IO_wšt_t + +__wuæow + ( +_IO_FILE + *); + +422 +_IO_wšt_t + +__wov”æow + ( +_IO_FILE + *, _IO_wint_t); + +425 #ià +__GNUC__ + >= 3 + +426  + #_IO_BE +( +ex´ +, +»s +è + `__bužtš_ex³ù + (Óx´),„es) + + ) + +428  + #_IO_BE +( +ex´ +, +»s +èÓx´) + + ) + +431  + #_IO_g‘c_uÆocked +( +_å +) \ + +432 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +433 ? + `__uæow + ( +_å +è: *(*è(_å)-> +_IO_»ad_±r +++) + + ) + +434  + #_IO_³ekc_uÆocked +( +_å +) \ + +435 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +436 && + `__und”æow + ( +_å +è=ð +EOF + ? EOF \ + +437 : *(*è( +_å +)-> +_IO_»ad_±r +) + + ) + +438  + #_IO_putc_uÆocked +( +_ch +, +_å +) \ + +439 ( + `_IO_BE + (( +_å +)-> +_IO_wr™e_±r + >ð(_å)-> +_IO_wr™e_’d +, 0) \ + +440 ? + `__ov”æow + ( +_å +, (è( +_ch +)) \ + +441 : (è(*( +_å +)-> +_IO_wr™e_±r +++ = ( +_ch +))) + + ) + +443 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +444  + #_IO_g‘wc_uÆocked +( +_å +) \ + +445 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +446 || (( +_å +)-> +_wide_d©a +-> +_IO_»ad_±r + \ + +447 >ð( +_å +)-> +_wide_d©a +-> +_IO_»ad_’d +), 0) \ + +448 ? + `__wuæow + ( +_å +è: ( +_IO_wšt_t +è*(_å)-> +_wide_d©a +-> +_IO_»ad_±r +++) + + ) + +449  + #_IO_putwc_uÆocked +( +_wch +, +_å +) \ + +450 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +451 || (( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r + \ + +452 >ð( +_å +)-> +_wide_d©a +-> +_IO_wr™e_’d +), 0) \ + +453 ? + `__wov”æow + ( +_å +, +_wch +) \ + +454 : ( +_IO_wšt_t +è(*( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r +++ = ( +_wch +))) + + ) + +457  + #_IO_ãof_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_EOF_SEEN +è!ð0) + + ) + +458  + #_IO_ã¼Ü_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_ERR_SEEN +è!ð0) + + ) + +460  +_IO_g‘c + ( +_IO_FILE + * +__å +); + +461  +_IO_putc + ( +__c +, +_IO_FILE + * +__å +); + +462  +_IO_ãof + ( +_IO_FILE + * +__å +è +__THROW +; + +463  +_IO_ã¼Ü + ( +_IO_FILE + * +__å +è +__THROW +; + +465  +_IO_³ekc_locked + ( +_IO_FILE + * +__å +); + +468  + #_IO_PENDING_OUTPUT_COUNT +( +_å +) \ + +469 (( +_å +)-> +_IO_wr™e_±r + - (_å)-> +_IO_wr™e_ba£ +) + + ) + +471  +_IO_æockfže + ( +_IO_FILE + *è +__THROW +; + +472  +_IO_fuÆockfže + ( +_IO_FILE + *è +__THROW +; + +473  +_IO_árylockfže + ( +_IO_FILE + *è +__THROW +; + +475 #ifdeà +_IO_MTSAFE_IO + + +476  + #_IO_³ekc +( +_å +è + `_IO_³ekc_locked + (_å) + + ) + +477  + #_IO_æockfže +( +_å +) \ + +478 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_æockfže + (_å) + + ) + +479  + #_IO_fuÆockfže +( +_å +) \ + +480 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_fuÆockfže + (_å) + + ) + +482  + #_IO_³ekc +( +_å +è + `_IO_³ekc_uÆocked + (_å) + + ) + +483  + #_IO_æockfže +( +_å +è + + ) + +484  + #_IO_fuÆockfže +( +_å +è + + ) + +485  + #_IO_árylockfže +( +_å +è + + ) + +486  + #_IO_þ—nup_»giÚ_¡¬t +( +_fù +, +_å +è + + ) + +487  + #_IO_þ—nup_»giÚ_’d +( +_Do™ +è + + ) + +490  +_IO_vfsÿnf + ( +_IO_FILE + * +__»¡riù +, const * __restrict, + +491 +_IO_va_li¡ +, * +__»¡riù +); + +492  +_IO_vårštf + ( +_IO_FILE + * +__»¡riù +, const *__restrict, + +493 +_IO_va_li¡ +); + +494 +_IO_ssize_t + +_IO_·dn + ( +_IO_FILE + *, , _IO_ssize_t); + +495 +_IO_size_t + +_IO_sg‘n + ( +_IO_FILE + *, *, _IO_size_t); + +497 +_IO_off64_t + +_IO_£ekoff + ( +_IO_FILE + *, _IO_off64_t, , ); + +498 +_IO_off64_t + +_IO_£ekpos + ( +_IO_FILE + *, _IO_off64_t, ); + +500  +_IO_ä“_backup_¬— + ( +_IO_FILE + *è +__THROW +; + +502 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +503 +_IO_wšt_t + +_IO_g‘wc + ( +_IO_FILE + * +__å +); + +504 +_IO_wšt_t + +_IO_putwc + ( +wch¬_t + +__wc +, +_IO_FILE + * +__å +); + +505  +_IO_fwide + ( +_IO_FILE + * +__å +,  +__mode +è +__THROW +; + +506 #ià +__GNUC__ + >= 2 + +509 #ià +defšed + +_LIBC + && defšed +SHARED + + +510  + ~ + +511 #ià +SHLIB_COMPAT + ( +libc +, +GLIBC_2_0 +, +GLIBC_2_1 +) + +512  + #_IO_fwide_maybe_šcom·tibË + \ + +513 ( + `__bužtš_ex³ù + (& +_IO_¡dš_u£d + =ð +NULL +, 0)) + + ) + +514 cÚ¡  +_IO_¡dš_u£d +; + +515 +w—k_ex‹º + ( +_IO_¡dš_u£d +); + +518 #iâdeà +_IO_fwide_maybe_šcom·tibË + + +519  + #_IO_fwide_maybe_šcom·tibË + (0) + + ) + +523  + #_IO_fwide +( +__å +, +__mode +) \ + +524 ({  +__»suÉ + = ( +__mode +); \ + +525 ià( +__»suÉ + < 0 && ! +_IO_fwide_maybe_šcom·tibË +) \ + +527 ià(( +__å +)-> +_mode + == 0) \ + +529 ( +__å +)-> +_mode + = -1; \ + +530 +__»suÉ + = ( +__å +)-> +_mode +; \ + +532 ià( + `__bužtš_cÚ¡ªt_p + ( +__mode +) && (__mode) == 0) \ + +533 +__»suÉ + = +_IO_fwide_maybe_šcom·tibË + ? -1 : ( +__å +)-> +_mode +; \ + +535 +__»suÉ + = + `_IO_fwide + ( +__å +, __result); \ + +536 +__»suÉ +; }) + + ) + +539  +_IO_vfwsÿnf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + * __restrict, + +540 +_IO_va_li¡ +, * +__»¡riù +); + +541  +_IO_vfw´štf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + *__restrict, + +542 +_IO_va_li¡ +); + +543 +_IO_ssize_t + +_IO_w·dn + ( +_IO_FILE + *, +wšt_t +, _IO_ssize_t); + +544  +_IO_ä“_wbackup_¬— + ( +_IO_FILE + *è +__THROW +; + +547 #ifdeà +__LDBL_COMPAT + + +548  + ~ + +551 #ifdeà +__ýlu¥lus + + + @/usr/include/netinet/in.h + +20 #iâdef +_NETINET_IN_H + + +21  + #_NETINET_IN_H + 1 + + ) + +23  + ~<ã©u»s.h +> + +24  + ~<¡dšt.h +> + +25  + ~ + +26  + ~ + +29 +__BEGIN_DECLS + + +34 + mIPPROTO_IP + = 0, + +35  + #IPPROTO_IP + +IPPROTO_IP + + + ) + +36 + mIPPROTO_HOPOPTS + = 0, + +37  + #IPPROTO_HOPOPTS + +IPPROTO_HOPOPTS + + + ) + +38 + mIPPROTO_ICMP + = 1, + +39  + #IPPROTO_ICMP + +IPPROTO_ICMP + + + ) + +40 + mIPPROTO_IGMP + = 2, + +41  + #IPPROTO_IGMP + +IPPROTO_IGMP + + + ) + +42 + mIPPROTO_IPIP + = 4, + +43  + #IPPROTO_IPIP + +IPPROTO_IPIP + + + ) + +44 + mIPPROTO_TCP + = 6, + +45  + #IPPROTO_TCP + +IPPROTO_TCP + + + ) + +46 + mIPPROTO_EGP + = 8, + +47  + #IPPROTO_EGP + +IPPROTO_EGP + + + ) + +48 + mIPPROTO_PUP + = 12, + +49  + #IPPROTO_PUP + +IPPROTO_PUP + + + ) + +50 + mIPPROTO_UDP + = 17, + +51  + #IPPROTO_UDP + +IPPROTO_UDP + + + ) + +52 + mIPPROTO_IDP + = 22, + +53  + #IPPROTO_IDP + +IPPROTO_IDP + + + ) + +54 + mIPPROTO_TP + = 29, + +55  + #IPPROTO_TP + +IPPROTO_TP + + + ) + +56 + mIPPROTO_DCCP + = 33, + +57  + #IPPROTO_DCCP + +IPPROTO_DCCP + + + ) + +58 + mIPPROTO_IPV6 + = 41, + +59  + #IPPROTO_IPV6 + +IPPROTO_IPV6 + + + ) + +60 + mIPPROTO_ROUTING + = 43, + +61  + #IPPROTO_ROUTING + +IPPROTO_ROUTING + + + ) + +62 + mIPPROTO_FRAGMENT + = 44, + +63  + #IPPROTO_FRAGMENT + +IPPROTO_FRAGMENT + + + ) + +64 + mIPPROTO_RSVP + = 46, + +65  + #IPPROTO_RSVP + +IPPROTO_RSVP + + + ) + +66 + mIPPROTO_GRE + = 47, + +67  + #IPPROTO_GRE + +IPPROTO_GRE + + + ) + +68 + mIPPROTO_ESP + = 50, + +69  + #IPPROTO_ESP + +IPPROTO_ESP + + + ) + +70 + mIPPROTO_AH + = 51, + +71  + #IPPROTO_AH + +IPPROTO_AH + + + ) + +72 + mIPPROTO_ICMPV6 + = 58, + +73  + #IPPROTO_ICMPV6 + +IPPROTO_ICMPV6 + + + ) + +74 + mIPPROTO_NONE + = 59, + +75  + #IPPROTO_NONE + +IPPROTO_NONE + + + ) + +76 + mIPPROTO_DSTOPTS + = 60, + +77  + #IPPROTO_DSTOPTS + +IPPROTO_DSTOPTS + + + ) + +78 + mIPPROTO_MTP + = 92, + +79  + #IPPROTO_MTP + +IPPROTO_MTP + + + ) + +80 + mIPPROTO_ENCAP + = 98, + +81  + #IPPROTO_ENCAP + +IPPROTO_ENCAP + + + ) + +82 + mIPPROTO_PIM + = 103, + +83  + #IPPROTO_PIM + +IPPROTO_PIM + + + ) + +84 + mIPPROTO_COMP + = 108, + +85  + #IPPROTO_COMP + +IPPROTO_COMP + + + ) + +86 + mIPPROTO_SCTP + = 132, + +87  + #IPPROTO_SCTP + +IPPROTO_SCTP + + + ) + +88 + mIPPROTO_UDPLITE + = 136, + +89  + #IPPROTO_UDPLITE + +IPPROTO_UDPLITE + + + ) + +90 + mIPPROTO_RAW + = 255, + +91  + #IPPROTO_RAW + +IPPROTO_RAW + + + ) + +92 + mIPPROTO_MAX + + +97  +ušt16_t + + tš_pÜt_t +; + +102 + mIPPORT_ECHO + = 7, + +103 + mIPPORT_DISCARD + = 9, + +104 + mIPPORT_SYSTAT + = 11, + +105 + mIPPORT_DAYTIME + = 13, + +106 + mIPPORT_NETSTAT + = 15, + +107 + mIPPORT_FTP + = 21, + +108 + mIPPORT_TELNET + = 23, + +109 + mIPPORT_SMTP + = 25, + +110 + mIPPORT_TIMESERVER + = 37, + +111 + mIPPORT_NAMESERVER + = 42, + +112 + mIPPORT_WHOIS + = 43, + +113 + mIPPORT_MTP + = 57, + +115 + mIPPORT_TFTP + = 69, + +116 + mIPPORT_RJE + = 77, + +117 + mIPPORT_FINGER + = 79, + +118 + mIPPORT_TTYLINK + = 87, + +119 + mIPPORT_SUPDUP + = 95, + +122 + mIPPORT_EXECSERVER + = 512, + +123 + mIPPORT_LOGINSERVER + = 513, + +124 + mIPPORT_CMDSERVER + = 514, + +125 + mIPPORT_EFSSERVER + = 520, + +128 + mIPPORT_BIFFUDP + = 512, + +129 + mIPPORT_WHOSERVER + = 513, + +130 + mIPPORT_ROUTESERVER + = 520, + +133 + mIPPORT_RESERVED + = 1024, + +136 + mIPPORT_USERRESERVED + = 5000 + +141  +ušt32_t + + tš_addr_t +; + +142  + sš_addr + + +144 +š_addr_t + + ms_addr +; + +153  + #IN_CLASSA +( +a +è(((( +š_addr_t +)×)è& 0x80000000è=ð0) + + ) + +154  + #IN_CLASSA_NET + 0xff000000 + + ) + +155  + #IN_CLASSA_NSHIFT + 24 + + ) + +156  + #IN_CLASSA_HOST + (0xfffffffà& ~ +IN_CLASSA_NET +) + + ) + +157  + #IN_CLASSA_MAX + 128 + + ) + +159  + #IN_CLASSB +( +a +è(((( +š_addr_t +)×)è& 0xc0000000è=ð0x80000000) + + ) + +160  + #IN_CLASSB_NET + 0xffff0000 + + ) + +161  + #IN_CLASSB_NSHIFT + 16 + + ) + +162  + #IN_CLASSB_HOST + (0xfffffffà& ~ +IN_CLASSB_NET +) + + ) + +163  + #IN_CLASSB_MAX + 65536 + + ) + +165  + #IN_CLASSC +( +a +è(((( +š_addr_t +)×)è& 0xe0000000è=ð0xc0000000) + + ) + +166  + #IN_CLASSC_NET + 0xffffff00 + + ) + +167  + #IN_CLASSC_NSHIFT + 8 + + ) + +168  + #IN_CLASSC_HOST + (0xfffffffà& ~ +IN_CLASSC_NET +) + + ) + +170  + #IN_CLASSD +( +a +è(((( +š_addr_t +)×)è& 0xf0000000è=ð0xe0000000) + + ) + +171  + #IN_MULTICAST +( +a +è + `IN_CLASSD +×) + + ) + +173  + #IN_EXPERIMENTAL +( +a +è(((( +š_addr_t +)×)è& 0xe0000000è=ð0xe0000000) + + ) + +174  + #IN_BADCLASS +( +a +è(((( +š_addr_t +)×)è& 0xf0000000è=ð0xf0000000) + + ) + +177  + #INADDR_ANY + (( +š_addr_t +è0x00000000) + + ) + +179  + #INADDR_BROADCAST + (( +š_addr_t +è0xffffffff) + + ) + +181  + #INADDR_NONE + (( +š_addr_t +è0xffffffff) + + ) + +184  + #IN_LOOPBACKNET + 127 + + ) + +186 #iâdeà +INADDR_LOOPBACK + + +187  + #INADDR_LOOPBACK + (( +š_addr_t +è0x7f000001è + + ) + +191  + #INADDR_UNSPEC_GROUP + (( +š_addr_t +è0xe0000000è + + ) + +192  + #INADDR_ALLHOSTS_GROUP + (( +š_addr_t +è0xe0000001è + + ) + +193  + #INADDR_ALLRTRS_GROUP + (( +š_addr_t +è0xe0000002è + + ) + +194  + #INADDR_MAX_LOCAL_GROUP + (( +š_addr_t +è0xe00000ffè + + ) + +198  + sš6_addr + + +202 +ušt8_t + + m__u6_addr8 +[16]; + +203 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +204 +ušt16_t + + m__u6_addr16 +[8]; + +205 +ušt32_t + + m__u6_addr32 +[4]; + +207 } + m__š6_u +; + +208  + #s6_addr + +__š6_u +. +__u6_addr8 + + + ) + +209 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +210  + #s6_addr16 + +__š6_u +. +__u6_addr16 + + + ) + +211  + #s6_addr32 + +__š6_u +. +__u6_addr32 + + + ) + +215 cÚ¡  +š6_addr + +š6addr_ªy +; + +216 cÚ¡  +š6_addr + +š6addr_loÝback +; + +217  + #IN6ADDR_ANY_INIT + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } + + ) + +218  + #IN6ADDR_LOOPBACK_INIT + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } + + ) + +220  + #INET_ADDRSTRLEN + 16 + + ) + +221  + #INET6_ADDRSTRLEN + 46 + + ) + +225  + ssockaddr_š + + +227 +__SOCKADDR_COMMON + ( +sš_ +); + +228 +š_pÜt_t + + msš_pÜt +; + +229  +š_addr + + msš_addr +; + +232  + msš_z”o +[ ( +sockaddr +) - + +233 +__SOCKADDR_COMMON_SIZE + - + +234  ( +š_pÜt_t +) - + +235  ( +š_addr +)]; + +239  + ssockaddr_š6 + + +241 +__SOCKADDR_COMMON + ( +sš6_ +); + +242 +š_pÜt_t + + msš6_pÜt +; + +243 +ušt32_t + + msš6_æowšfo +; + +244  +š6_addr + + msš6_addr +; + +245 +ušt32_t + + msš6_scÝe_id +; + +249 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +251  + s_m»q + + +254  +š_addr + + mimr_muɟddr +; + +257  +š_addr + + mimr_š‹rçû +; + +260  + s_m»q_sourû + + +263  +š_addr + + mimr_muɟddr +; + +266  +š_addr + + mimr_š‹rçû +; + +269  +š_addr + + mimr_sourûaddr +; + +275  + sv6_m»q + + +278  +š6_addr + + mv6mr_muɟddr +; + +281  + mv6mr_š‹rçû +; + +285 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +287  + sgroup_»q + + +290 +ušt32_t + + mgr_š‹rçû +; + +293  +sockaddr_¡Üage + + mgr_group +; + +296  + sgroup_sourû_»q + + +299 +ušt32_t + + mg¤_š‹rçû +; + +302  +sockaddr_¡Üage + + mg¤_group +; + +305  +sockaddr_¡Üage + + mg¤_sourû +; + +310  + s_msfž‹r + + +313  +š_addr + + mimsf_muɟddr +; + +316  +š_addr + + mimsf_š‹rçû +; + +319 +ušt32_t + + mimsf_fmode +; + +322 +ušt32_t + + mimsf_num¤c +; + +324  +š_addr + + mimsf_¦i¡ +[1]; + +327  + #IP_MSFILTER_SIZE +( +num¤c +è( ( +_msfž‹r +) \ + +328 -  ( +š_addr +) \ + +329 + ( +num¤c +è*  ( +š_addr +)) + + ) + +331  + sgroup_fž‹r + + +334 +ušt32_t + + mgf_š‹rçû +; + +337  +sockaddr_¡Üage + + mgf_group +; + +340 +ušt32_t + + mgf_fmode +; + +343 +ušt32_t + + mgf_num¤c +; + +345  +sockaddr_¡Üage + + mgf_¦i¡ +[1]; + +348  + #GROUP_FILTER_SIZE +( +num¤c +è( ( +group_fž‹r +) \ + +349 -  ( +sockaddr_¡Üage +) \ + +350 + (( +num¤c +) \ + +351 *  ( +sockaddr_¡Üage +))) + + ) + +356  + ~ + +365 +ušt32_t + + $Áohl + ( +ušt32_t + +__ÎÚg +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +366 +ušt16_t + + $Áohs + ( +ušt16_t + +__ÃtshÜt +) + +367 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +368 +ušt32_t + + $htÚl + ( +ušt32_t + +__ho¡lÚg +) + +369 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +370 +ušt16_t + + $htÚs + ( +ušt16_t + +__ho¡shÜt +) + +371 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +373  + ~<’dŸn.h +> + +376  + ~ + +378 #ifdeà +__OPTIMIZE__ + + +382 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +385  + #Áohl +( +x +è(x) + + ) + +386  + #Áohs +( +x +è(x) + + ) + +387  + #htÚl +( +x +è(x) + + ) + +388  + #htÚs +( +x +è(x) + + ) + +390 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +391  + #Áohl +( +x +è + `__bsw­_32 + (x) + + ) + +392  + #Áohs +( +x +è + `__bsw­_16 + (x) + + ) + +393  + #htÚl +( +x +è + `__bsw­_32 + (x) + + ) + +394  + #htÚs +( +x +è + `__bsw­_16 + (x) + + ) + +399  + #IN6_IS_ADDR_UNSPECIFIED +( +a +) \ + +400 ((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] == 0 \ + +401 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[1] == 0 \ + +402 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[2] == 0 \ + +403 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[3] =ð0) + + ) + +405  + #IN6_IS_ADDR_LOOPBACK +( +a +) \ + +406 ((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] == 0 \ + +407 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[1] == 0 \ + +408 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[2] == 0 \ + +409 && (( +__cÚ¡ + +ušt32_t + *è( +a +))[3] =ð + `htÚl + (1)) + + ) + +411  + #IN6_IS_ADDR_MULTICAST +( +a +è((( +__cÚ¡ + +ušt8_t + *è×))[0] =ð0xff) + + ) + +413  + #IN6_IS_ADDR_LINKLOCAL +( +a +) \ + +414 (((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] & + `htÚl + (0xffc00000)) \ + +415 =ð + `htÚl + (0xã800000)) + + ) + +417  + #IN6_IS_ADDR_SITELOCAL +( +a +) \ + +418 (((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] & + `htÚl + (0xffc00000)) \ + +419 =ð + `htÚl + (0xãc00000)) + + ) + +421  + #IN6_IS_ADDR_V4MAPPED +( +a +) \ + +422 (((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] == 0) \ + +423 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[1] == 0) \ + +424 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[2] =ð + `htÚl + (0xffff))) + + ) + +426  + #IN6_IS_ADDR_V4COMPAT +( +a +) \ + +427 (((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] == 0) \ + +428 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[1] == 0) \ + +429 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[2] == 0) \ + +430 && ( + `Áohl + ((( +__cÚ¡ + +ušt32_t + *è( +a +))[3]è> 1)) + + ) + +432  + #IN6_ARE_ADDR_EQUAL +( +a +, +b +) \ + +433 (((( +__cÚ¡ + +ušt32_t + *è( +a +))[0] =ð((__cÚ¡ ušt32_ˆ*è( +b +))[0]) \ + +434 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[1] =ð((__cÚ¡ ušt32_ˆ*è( +b +))[1]) \ + +435 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[2] =ð((__cÚ¡ ušt32_ˆ*è( +b +))[2]) \ + +436 && ((( +__cÚ¡ + +ušt32_t + *è( +a +))[3] =ð((__cÚ¡ ušt32_ˆ*è( +b +))[3])) + + ) + +438 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +440  + $bšd»svpÜt + ( +__sockfd +,  +sockaddr_š + * +__sock_š +è +__THROW +; + +443  + $bšd»svpÜt6 + ( +__sockfd +,  +sockaddr_š6 + * +__sock_š +) + +444 +__THROW +; + +448  + #IN6_IS_ADDR_MC_NODELOCAL +( +a +) \ + +449 ( + `IN6_IS_ADDR_MULTICAST +( +a +) \ + +450 && (((( +__cÚ¡ + +ušt8_t + *è( +a +))[1] & 0xfè=ð0x1)) + + ) + +452  + #IN6_IS_ADDR_MC_LINKLOCAL +( +a +) \ + +453 ( + `IN6_IS_ADDR_MULTICAST +( +a +) \ + +454 && (((( +__cÚ¡ + +ušt8_t + *è( +a +))[1] & 0xfè=ð0x2)) + + ) + +456  + #IN6_IS_ADDR_MC_SITELOCAL +( +a +) \ + +457 ( + `IN6_IS_ADDR_MULTICAST +( +a +) \ + +458 && (((( +__cÚ¡ + +ušt8_t + *è( +a +))[1] & 0xfè=ð0x5)) + + ) + +460  + #IN6_IS_ADDR_MC_ORGLOCAL +( +a +) \ + +461 ( + `IN6_IS_ADDR_MULTICAST +( +a +) \ + +462 && (((( +__cÚ¡ + +ušt8_t + *è( +a +))[1] & 0xfè=ð0x8)) + + ) + +464  + #IN6_IS_ADDR_MC_GLOBAL +( +a +) \ + +465 ( + `IN6_IS_ADDR_MULTICAST +( +a +) \ + +466 && (((( +__cÚ¡ + +ušt8_t + *è( +a +))[1] & 0xfè=ð0xe)) + + ) + +469 #ifdeà +__USE_GNU + + +471  + sš6_pktšfo + + +473  +š6_addr + +i6_addr +; + +474  +i6_ifšdex +; + +478  + s6_mtušfo + + +480  +sockaddr_š6 + +6m_addr +; + +481 +ušt32_t + +6m_mtu +; + +486  + $š‘6_ÝtiÚ_¥aû + ( +__nby‹s +) + +487 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +488  + $š‘6_ÝtiÚ_š™ + (* +__bp +,  +cmsghdr + ** +__cmsgp +, + +489  +__ty³ +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +490  + $š‘6_ÝtiÚ_­³nd + ( +cmsghdr + * +__cmsg +, + +491 +__cÚ¡ + +ušt8_t + * +__ty³p +,  +__muÉx +, + +492  +__¶usy +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +493 +ušt8_t + * + $š‘6_ÝtiÚ_®loc + ( +cmsghdr + * +__cmsg +,  +__d©®’ +, + +494  +__muÉx +,  +__¶usy +) + +495 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +496  + $š‘6_ÝtiÚ_Ãxt + ( +__cÚ¡ +  +cmsghdr + * +__cmsg +, + +497 +ušt8_t + ** +__Œp +) + +498 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +499  + $š‘6_ÝtiÚ_fšd + ( +__cÚ¡ +  +cmsghdr + * +__cmsg +, + +500 +ušt8_t + ** +__Œp +,  +__ty³ +) + +501 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +505  + $š‘6_Ýt_š™ + (* +__extbuf +, +sockËn_t + +__exŽ’ +è +__THROW +; + +506  + $š‘6_Ýt_­³nd + (* +__extbuf +, +sockËn_t + +__exŽ’ +,  +__off£t +, + +507 +ušt8_t + +__ty³ +, +sockËn_t + +__Ën +, ušt8_ˆ +__®ign +, + +508 ** +__d©abuå +è +__THROW +; + +509  + $š‘6_Ýt_fšish + (* +__extbuf +, +sockËn_t + +__exŽ’ +,  +__off£t +) + +510 +__THROW +; + +511  + $š‘6_Ýt_£t_v® + (* +__d©abuf +,  +__off£t +, * +__v® +, + +512 +sockËn_t + +__v®Ën +è +__THROW +; + +513  + $š‘6_Ýt_Ãxt + (* +__extbuf +, +sockËn_t + +__exŽ’ +,  +__off£t +, + +514 +ušt8_t + * +__ty³p +, +sockËn_t + * +__ËÅ +, + +515 ** +__d©abuå +è +__THROW +; + +516  + $š‘6_Ýt_fšd + (* +__extbuf +, +sockËn_t + +__exŽ’ +,  +__off£t +, + +517 +ušt8_t + +__ty³ +, +sockËn_t + * +__ËÅ +, + +518 ** +__d©abuå +è +__THROW +; + +519  + $š‘6_Ýt_g‘_v® + (* +__d©abuf +,  +__off£t +, * +__v® +, + +520 +sockËn_t + +__v®Ën +è +__THROW +; + +524 +sockËn_t + + $š‘6_¹h_¥aû + ( +__ty³ +,  +__£gm’ts +è +__THROW +; + +525 * + $š‘6_¹h_š™ + (* +__bp +, +sockËn_t + +__bp_Ën +,  +__ty³ +, + +526  +__£gm’ts +è +__THROW +; + +527  + $š‘6_¹h_add + (* +__bp +, +__cÚ¡ +  +š6_addr + * +__addr +è +__THROW +; + +528  + $š‘6_¹h_»v”£ + ( +__cÚ¡ + * +__š +, * +__out +è +__THROW +; + +529  + $š‘6_¹h_£gm’ts + ( +__cÚ¡ + * +__bp +è +__THROW +; + +530  +š6_addr + * + $š‘6_¹h_g‘addr + ( +__cÚ¡ + * +__bp +,  +__šdex +) + +531 +__THROW +; + +537  + $g‘v4sourûfž‹r + ( +__s +,  +š_addr + +__š‹rçû_addr +, + +538  +š_addr + +__group +, +ušt32_t + * +__fmode +, + +539 +ušt32_t + * +__num¤c +,  +š_addr + * +__¦i¡ +) + +540 +__THROW +; + +543  + $£tv4sourûfž‹r + ( +__s +,  +š_addr + +__š‹rçû_addr +, + +544  +š_addr + +__group +, +ušt32_t + +__fmode +, + +545 +ušt32_t + +__num¤c +, + +546 +__cÚ¡ +  +š_addr + * +__¦i¡ +) + +547 +__THROW +; + +551  + $g‘sourûfž‹r + ( +__s +, +ušt32_t + +__š‹rçû_addr +, + +552 +__cÚ¡ +  +sockaddr + * +__group +, + +553 +sockËn_t + +__grou¶’ +, +ušt32_t + * +__fmode +, + +554 +ušt32_t + * +__num¤c +, + +555  +sockaddr_¡Üage + * +__¦i¡ +è +__THROW +; + +558  + $£tsourûfž‹r + ( +__s +, +ušt32_t + +__š‹rçû_addr +, + +559 +__cÚ¡ +  +sockaddr + * +__group +, + +560 +sockËn_t + +__grou¶’ +, +ušt32_t + +__fmode +, + +561 +ušt32_t + +__num¤c +, + +562 +__cÚ¡ +  +sockaddr_¡Üage + * +__¦i¡ +è +__THROW +; + +565 +__END_DECLS + + + @/usr/include/time.h + +23 #iâdef +_TIME_H + + +25 #ià(! +defšed + +__Ãed_time_t + && !defšed +__Ãed_þock_t + && \ + +26 ! +defšed + + g__Ãed_time¥ec +) + +27  + #_TIME_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +34 #ifdef +_TIME_H + + +36  + #__Ãed_size_t + + + ) + +37  + #__Ãed_NULL + + + ) + +38  + ~<¡ddef.h +> + +42  + ~ + +45 #ià! +defšed + +__STRICT_ANSI__ + && !defšed +__USE_XOPEN2K + + +46 #iâdeà +CLK_TCK + + +47  + #CLK_TCK + +CLOCKS_PER_SEC + + + ) + +53 #ià! +defšed + +__þock_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_þock_t +) + +54  + #__þock_t_defšed + 1 + + ) + +56  + ~ + +58 +__BEGIN_NAMESPACE_STD + + +60  +__þock_t + + tþock_t +; + +61 + g__END_NAMESPACE_STD + + +62 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +63 + $__USING_NAMESPACE_STD +( +þock_t +) + +67 #undeà +__Ãed_þock_t + + +69 #ià! +defšed + +__time_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_time_t +) + +70  + #__time_t_defšed + 1 + + ) + +72  + ~ + +74 +__BEGIN_NAMESPACE_STD + + +76  +__time_t + + ttime_t +; + +77 +__END_NAMESPACE_STD + + +78 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + || defšed +__USE_SVID + + +79 + $__USING_NAMESPACE_STD +( +time_t +) + +83 #undeà +__Ãed_time_t + + +85 #ià! +defšed + +__þockid_t_defšed + && \ + +86 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_þockid_t +) + +87  + #__þockid_t_defšed + 1 + + ) + +89  + ~ + +92  +__þockid_t + + tþockid_t +; + +95 #undeà +__þockid_time_t + + +97 #ià! +defšed + +__tim”_t_defšed + && \ + +98 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_tim”_t +) + +99  + #__tim”_t_defšed + 1 + + ) + +101  + ~ + +104  +__tim”_t + + ttim”_t +; + +107 #undeà +__Ãed_tim”_t + + +110 #ià! +defšed + +__time¥ec_defšed + && \ + +111 (( +defšed + +_TIME_H + && \ + +112 ( +defšed + +__USE_POSIX199309 + || defšed +__USE_MISC +)) || \ + +113 +defšed + +__Ãed_time¥ec +) + +114  + #__time¥ec_defšed + 1 + + ) + +116  + ~ + +120  + stime¥ec + + +122 +__time_t + +tv_£c +; + +123  +tv_n£c +; + +127 #undeà +__Ãed_time¥ec + + +130 #ifdef +_TIME_H + + +131 +__BEGIN_NAMESPACE_STD + + +133  + stm + + +135  +tm_£c +; + +136  +tm_mš +; + +137  +tm_hour +; + +138  +tm_mday +; + +139  +tm_mÚ +; + +140  +tm_y—r +; + +141  +tm_wday +; + +142  +tm_yday +; + +143  +tm_isd¡ +; + +145 #ifdef +__USE_BSD + + +146  +tm_gmtoff +; + +147 +__cÚ¡ + * +tm_zÚe +; + +149  +__tm_gmtoff +; + +150 +__cÚ¡ + * +__tm_zÚe +; + +153 +__END_NAMESPACE_STD + + +154 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +155 + $__USING_NAMESPACE_STD +( +tm +) + +159 #ifdeà +__USE_POSIX199309 + + +161  + s™im”¥ec + + +163  +time¥ec + +™_š‹rv® +; + +164  +time¥ec + +™_v®ue +; + +168  +sigev’t +; + +172 #ifdeà +__USE_XOPEN2K + + +173 #iâdeà +__pid_t_defšed + + +174  +__pid_t + + tpid_t +; + +175  + #__pid_t_defšed + + + ) + +180 +__BEGIN_NAMESPACE_STD + + +183 +þock_t + + $þock + (è +__THROW +; + +186 +time_t + + $time + ( +time_t + * +__tim” +è +__THROW +; + +189  + $difáime + ( +time_t + +__time1 +,ime_ˆ +__time0 +) + +190 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +193 +time_t + + $mktime + ( +tm + * +__ +è +__THROW +; + +199 +size_t + + $¡ráime + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +200 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +201 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +202 +__END_NAMESPACE_STD + + +204 #ifdeà +__USE_XOPEN + + +207 * + $¡½time + ( +__cÚ¡ + * +__»¡riù + +__s +, + +208 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +) + +209 +__THROW +; + +212 #ifdeà +__USE_XOPEN2K8 + + +215  + ~ + +217 +size_t + + $¡ráime_l + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +218 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +219 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +220 +__loÿË_t + +__loc +è +__THROW +; + +223 #ifdeà +__USE_GNU + + +224 * + $¡½time_l + ( +__cÚ¡ + * +__»¡riù + +__s +, + +225 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +, + +226 +__loÿË_t + +__loc +è +__THROW +; + +230 +__BEGIN_NAMESPACE_STD + + +233  +tm + * + $gmtime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +237  +tm + * + $loÿÉime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +238 +__END_NAMESPACE_STD + + +240 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +243  +tm + * + $gmtime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +244  +tm + * +__»¡riù + +__ +è +__THROW +; + +248  +tm + * + $loÿÉime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +249  +tm + * +__»¡riù + +__ +è +__THROW +; + +252 +__BEGIN_NAMESPACE_STD + + +255 * + $asùime + ( +__cÚ¡ +  +tm + * +__ +è +__THROW +; + +258 * + $ùime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +259 +__END_NAMESPACE_STD + + +261 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +266 * + $asùime_r + ( +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +267 * +__»¡riù + +__buf +è +__THROW +; + +270 * + $ùime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +271 * +__»¡riù + +__buf +è +__THROW +; + +276 * +__tzÇme +[2]; + +277  +__daylight +; + +278  +__timezÚe +; + +281 #ifdef +__USE_POSIX + + +283 * +tzÇme +[2]; + +287  + $tz£t + (è +__THROW +; + +290 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +291  +daylight +; + +292  +timezÚe +; + +295 #ifdeà +__USE_SVID + + +298  + $¡ime + ( +__cÚ¡ + +time_t + * +__wh’ +è +__THROW +; + +304  + #__i¦—p +( +y—r +) \ + +305 (( +y—r +è% 4 =ð0 && ((y—rè% 100 !ð0 || (y—rè% 400 =ð0)) + + ) + +308 #ifdeà +__USE_MISC + + +313 +time_t + + $timegm + ( +tm + * +__ +è +__THROW +; + +316 +time_t + + $tim–oÿl + ( +tm + * +__ +è +__THROW +; + +319  + $dysize + ( +__y—r +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +323 #ifdeà +__USE_POSIX199309 + + +328  + `Çno¦“p + ( +__cÚ¡ +  +time¥ec + * +__»que¡ed_time +, + +329  +time¥ec + * +__»maššg +); + +333  + $þock_g‘»s + ( +þockid_t + +__þock_id +,  +time¥ec + * +__»s +è +__THROW +; + +336  + $þock_g‘time + ( +þockid_t + +__þock_id +,  +time¥ec + * +__ +è +__THROW +; + +339  + $þock_£‰ime + ( +þockid_t + +__þock_id +, +__cÚ¡ +  +time¥ec + * +__ +) + +340 +__THROW +; + +342 #ifdeà +__USE_XOPEN2K + + +347  + `þock_Çno¦“p + ( +þockid_t + +__þock_id +,  +__æags +, + +348 +__cÚ¡ +  +time¥ec + * +__»q +, + +349  +time¥ec + * +__»m +); + +352  + $þock_g‘ýuþockid + ( +pid_t + +__pid +, +þockid_t + * +__þock_id +è +__THROW +; + +357  + $tim”_ü—‹ + ( +þockid_t + +__þock_id +, + +358  +sigev’t + * +__»¡riù + +__evp +, + +359 +tim”_t + * +__»¡riù + +__tim”id +è +__THROW +; + +362  + $tim”_d–‘e + ( +tim”_t + +__tim”id +è +__THROW +; + +365  + $tim”_£‰ime + ( +tim”_t + +__tim”id +,  +__æags +, + +366 +__cÚ¡ +  +™im”¥ec + * +__»¡riù + +__v®ue +, + +367  +™im”¥ec + * +__»¡riù + +__ov®ue +è +__THROW +; + +370  + $tim”_g‘time + ( +tim”_t + +__tim”id +,  +™im”¥ec + * +__v®ue +) + +371 +__THROW +; + +374  + $tim”_g‘ov”run + ( +tim”_t + +__tim”id +è +__THROW +; + +378 #ifdeà +__USE_XOPEN_EXTENDED + + +390  +g‘d©e_”r +; + +399  +tm + * + `g‘d©e + ( +__cÚ¡ + * +__¡ršg +); + +402 #ifdeà +__USE_GNU + + +413  + `g‘d©e_r + ( +__cÚ¡ + * +__»¡riù + +__¡ršg +, + +414  +tm + * +__»¡riù + +__»sbuå +); + +417 +__END_DECLS + + + @/usr/include/xlocale.h + +21 #iâdeà +_XLOCALE_H + + +22  + #_XLOCALE_H + 1 + + ) + +28  + s__loÿË_¡ruù + + +31  +__loÿË_d©a + * + m__loÿËs +[13]; + +34 cÚ¡ * + m__ùy³_b +; + +35 cÚ¡ * + m__ùy³_tÞow” +; + +36 cÚ¡ * + m__ùy³_touµ” +; + +39 cÚ¡ * + m__Çmes +[13]; + +40 } * + t__loÿË_t +; + +43  +__loÿË_t + + tloÿË_t +; + + @/usr/include/_G_config.h + +4 #iâdeà +_G_cÚfig_h + + +5  + #_G_cÚfig_h + 1 + + ) + +9  + ~ + +10  + #__Ãed_size_t + + + ) + +11 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +12  + #__Ãed_wch¬_t + + + ) + +14  + #__Ãed_NULL + + + ) + +15  + ~<¡ddef.h +> + +16  + #__Ãed_mb¡©e_t + + + ) + +17 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +18  + #__Ãed_wšt_t + + + ) + +20  + ~ + +21  + #_G_size_t + +size_t + + + ) + +24 +__off_t + + m__pos +; + +25 +__mb¡©e_t + + m__¡©e +; + +26 } + t_G_åos_t +; + +29 +__off64_t + + m__pos +; + +30 +__mb¡©e_t + + m__¡©e +; + +31 } + t_G_åos64_t +; + +32  + #_G_ssize_t + +__ssize_t + + + ) + +33  + #_G_off_t + +__off_t + + + ) + +34  + #_G_off64_t + +__off64_t + + + ) + +35  + #_G_pid_t + +__pid_t + + + ) + +36  + #_G_uid_t + +__uid_t + + + ) + +37  + #_G_wch¬_t + +wch¬_t + + + ) + +38  + #_G_wšt_t + +wšt_t + + + ) + +39  + #_G_¡©64 + +¡©64 + + + ) + +40 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +41  + ~ + +44  +__gcÚv_šfo + + m__cd +; + +47  +__gcÚv_šfo + + m__cd +; + +48  +__gcÚv_¡•_d©a + + m__d©a +; + +49 } + m__combšed +; + +50 } + t_G_icÚv_t +; + +53  + t_G_št16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +54  + t_G_št32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +55  + t_G_ušt16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +56  + t_G_ušt32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +58  + #_G_HAVE_BOOL + 1 + + ) + +62  + #_G_HAVE_ATEXIT + 1 + + ) + +63  + #_G_HAVE_SYS_CDEFS + 1 + + ) + +64  + #_G_HAVE_SYS_WAIT + 1 + + ) + +65  + #_G_NEED_STDARG_H + 1 + + ) + +66  + #_G_va_li¡ + +__gnuc_va_li¡ + + + ) + +68  + #_G_HAVE_PRINTF_FP + 1 + + ) + +69  + #_G_HAVE_MMAP + 1 + + ) + +70  + #_G_HAVE_MREMAP + 1 + + ) + +71  + #_G_HAVE_LONG_DOUBLE_IO + 1 + + ) + +72  + #_G_HAVE_IO_FILE_OPEN + 1 + + ) + +73  + #_G_HAVE_IO_GETLINE_INFO + 1 + + ) + +75  + #_G_IO_IO_FILE_VERSION + 0x20001 + + ) + +77  + #_G_OPEN64 + +__ݒ64 + + + ) + +78  + #_G_LSEEK64 + +__l£ek64 + + + ) + +79  + #_G_MMAP64 + +__mm­64 + + + ) + +80  + #_G_FSTAT64 +( +fd +, +buf +è + `__fx¡©64 + ( +_STAT_VER +, fd, buf) + + ) + +83  + #_G_HAVE_ST_BLKSIZE + + `defšed + ( +_STATBUF_ST_BLKSIZE +) + + ) + +85  + #_G_BUFSIZ + 8192 + + ) + +88  + #_G_NAMES_HAVE_UNDERSCORE + 0 + + ) + +89  + #_G_VTABLE_LABEL_HAS_LENGTH + 1 + + ) + +90  + #_G_USING_THUNKS + 1 + + ) + +91  + #_G_VTABLE_LABEL_PREFIX + "__vt_" + + ) + +92  + #_G_VTABLE_LABEL_PREFIX_ID + +__vt_ + + + ) + +95 #ià +defšed + +__ýlu¥lus + || defšed +__STDC__ + + +96  + #_G_ARGS +( +ARGLIST +è + ) +ARGLIST + +98  + #_G_ARGS +( +ARGLIST +è() + + ) + + @/usr/include/event2/keyvalq_struct.h + +27 #iâdeà +_EVENT2_EVENT_KEYVALQ_STRUCT_H_ + + +28  + #_EVENT2_EVENT_KEYVALQ_STRUCT_H_ + + + ) + +30 #ifdeà +__ýlu¥lus + + +36 #iâdeà +TAILQ_ENTRY + + +37  + #_EVENT_DEFINED_TQENTRY + + + ) + +38  + #TAILQ_ENTRY +( +ty³ +) \ + +40  +ty³ + * +tqe_Ãxt +; \ + +41  +ty³ + ** +tqe_´ev +; \ + +42 } + + ) + +45 #iâdeà +TAILQ_HEAD + + +46  + #_EVENT_DEFINED_TQHEAD + + + ) + +47  + #TAILQ_HEAD +( +Çme +, +ty³ +) \ + +48  + sÇme + { \ + +49  +ty³ + * +tqh_fœ¡ +; \ + +50  +ty³ + ** +tqh_Ï¡ +; \ + +51 } + + ) + +58  + sevkeyv® + { + +59 +TAILQ_ENTRY +( +evkeyv® +è +Ãxt +; + +61 * +key +; + +62 * +v®ue +; + +65 +TAILQ_HEAD + ( +evkeyv®q +, +evkeyv® +); + +68 #ifdeà +_EVENT_DEFINED_TQENTRY + + +69 #undeà +TAILQ_ENTRY + + +72 #ifdeà +_EVENT_DEFINED_TQHEAD + + +73 #undeà +TAILQ_HEAD + + +76 #ifdeà +__ýlu¥lus + + + @/usr/include/event2/util.h + +26 #iâdeà +_EVENT2_UTIL_H_ + + +27  + #_EVENT2_UTIL_H_ + + + ) + +36 #ifdeà +__ýlu¥lus + + +40  + ~ + +41 #ifdeà +_EVENT_HAVE_SYS_TIME_H + + +42  + ~ + +44 #ifdeà +_EVENT_HAVE_STDINT_H + + +45  + ~<¡dšt.h +> + +46 #–ià +defšed +( +_EVENT_HAVE_INTTYPES_H +) + +47  + ~<š‰y³s.h +> + +49 #ifdeà +_EVENT_HAVE_SYS_TYPES_H + + +50  + ~ + +52 #ifdeà +_EVENT_HAVE_STDDEF_H + + +53  + ~<¡ddef.h +> + +55 #ifdeà +_MSC_VER + + +56  + ~ + +58  + ~<¡d¬g.h +> + +59 #ifdeà +_EVENT_HAVE_NETDB_H + + +60 #ià! +defšed +( +_GNU_SOURCE +) + +61  + #_GNU_SOURCE + + + ) + +63  + ~<Ãtdb.h +> + +66 #ifdeà +WIN32 + + +67  + ~ + +69  + ~ + +73 #ià +defšed +( +_EVENT_SIZEOF_VOID__ +è&& !defšed( +_EVENT_SIZEOF_VOID_P +) + +74  + #_EVENT_SIZEOF_VOID_P + +_EVENT_SIZEOF_VOID__ + + + ) + +106 #ifdeà +_EVENT_HAVE_UINT64_T + + +107  + #ev_ušt64_t + +ušt64_t + + + ) + +108  + #ev_št64_t + +št64_t + + + ) + +109 #–ià +defšed +( +WIN32 +) + +110  + #ev_ušt64_t +  +__št64 + + + ) + +111  + #ev_št64_t + sigÃd +__št64 + + + ) + +112 #–ià +_EVENT_SIZEOF_LONG_LONG + == 8 + +113  + #ev_ušt64_t +  + + ) + +114  + #ev_št64_t +  + + ) + +115 #–ià +_EVENT_SIZEOF_LONG + == 8 + +116  + #ev_ušt64_t +  + + ) + +117  + #ev_št64_t +  + + ) + +118 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +119  + #ev_ušt64_t + ... + + ) + +120  + #ev_št64_t + ... + + ) + +125 #ifdeà +_EVENT_HAVE_UINT32_T + + +126  + #ev_ušt32_t + +ušt32_t + + + ) + +127  + #ev_št32_t + +št32_t + + + ) + +128 #–ià +defšed +( +WIN32 +) + +129  + #ev_ušt32_t +  + + ) + +130  + #ev_št32_t + sigÃd  + + ) + +131 #–ià +_EVENT_SIZEOF_LONG + == 4 + +132  + #ev_ušt32_t +  + + ) + +133  + #ev_št32_t + sigÃd  + + ) + +134 #–ià +_EVENT_SIZEOF_INT + == 4 + +135  + #ev_ušt32_t +  + + ) + +136  + #ev_št32_t + sigÃd  + + ) + +137 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +138  + #ev_ušt32_t + ... + + ) + +139  + #ev_št32_t + ... + + ) + +144 #ifdeà +_EVENT_HAVE_UINT16_T + + +145  + #ev_ušt16_t + +ušt16_t + + + ) + +146  + #ev_št16_t + +št16_t + + + ) + +147 #–ià +defšed +( +WIN32 +) + +148  + #ev_ušt16_t +  + + ) + +149  + #ev_št16_t + sigÃd  + + ) + +150 #–ià +_EVENT_SIZEOF_INT + == 2 + +151  + #ev_ušt16_t +  + + ) + +152  + #ev_št16_t + sigÃd  + + ) + +153 #–ià +_EVENT_SIZEOF_SHORT + == 2 + +154  + #ev_ušt16_t +  + + ) + +155  + #ev_št16_t + sigÃd  + + ) + +156 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +157  + #ev_ušt16_t + ... + + ) + +158  + #ev_št16_t + ... + + ) + +163 #ifdeà +_EVENT_HAVE_UINT8_T + + +164  + #ev_ušt8_t + +ušt8_t + + + ) + +165  + #ev_št8_t + +št8_t + + + ) + +166 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +167  + #ev_ušt8_t + ... + + ) + +168  + #ev_št8_t + ... + + ) + +170  + #ev_ušt8_t +  + + ) + +171  + #ev_št8_t + sigÃd  + + ) + +174 #ifdeà +_EVENT_HAVE_UINTPTR_T + + +175  + #ev_ušŒ_t + +ušŒ_t + + + ) + +176  + #ev_šŒ_t + +šŒ_t + + + ) + +177 #–ià +_EVENT_SIZEOF_VOID_P + <= 4 + +178  + #ev_ušŒ_t + +ev_ušt32_t + + + ) + +179  + #ev_šŒ_t + +ev_št32_t + + + ) + +180 #–ià +_EVENT_SIZEOF_VOID_P + <= 8 + +181  + #ev_ušŒ_t + +ev_ušt64_t + + + ) + +182  + #ev_šŒ_t + +ev_št64_t + + + ) + +183 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +184  + #ev_ušŒ_t + ... + + ) + +185  + #ev_šŒ_t + ... + + ) + +190 #ifdeà +_EVENT_ssize_t + + +191  + #ev_ssize_t + +_EVENT_ssize_t + + + ) + +193  + #ev_ssize_t + +ssize_t + + + ) + +196 #ifdeà +WIN32 + + +197  + #ev_off_t + +ev_št64_t + + + ) + +199  + #ev_off_t + +off_t + + + ) + +218  + #EV_UINT64_MAX + (((( +ev_ušt64_t +)0xffffffffULè<< 32è| 0xffffffffUL) + + ) + +219  + #EV_INT64_MAX + (((( +ev_št64_t +è0x7fffffffLè<< 32è| 0xffffffffL) + + ) + +220  + #EV_INT64_MIN + ((- +EV_INT64_MAX +è- 1) + + ) + +221  + #EV_UINT32_MAX + (( +ev_ušt32_t +)0xffffffffUL) + + ) + +222  + #EV_INT32_MAX + (( +ev_št32_t +è0x7fffffffL) + + ) + +223  + #EV_INT32_MIN + ((- +EV_INT32_MAX +è- 1) + + ) + +224  + #EV_UINT16_MAX + (( +ev_ušt16_t +)0xffffUL) + + ) + +225  + #EV_INT16_MAX + (( +ev_št16_t +è0x7fffL) + + ) + +226  + #EV_INT16_MIN + ((- +EV_INT16_MAX +è- 1) + + ) + +227  + #EV_UINT8_MAX + 255 + + ) + +228  + #EV_INT8_MAX + 127 + + ) + +229  + #EV_INT8_MIN + ((- +EV_INT8_MAX +è- 1) + + ) + +237 #ià +_EVENT_SIZEOF_SIZE_T + == 8 + +238  + #EV_SIZE_MAX + +EV_UINT64_MAX + + + ) + +239  + #EV_SSIZE_MAX + +EV_INT64_MAX + + + ) + +240 #–ià +_EVENT_SIZEOF_SIZE_T + == 4 + +241  + #EV_SIZE_MAX + +EV_UINT32_MAX + + + ) + +242  + #EV_SSIZE_MAX + +EV_INT32_MAX + + + ) + +243 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +244  + #EV_SIZE_MAX + ... + + ) + +245  + #EV_SSIZE_MAX + ... + + ) + +250  + #EV_SSIZE_MIN + ((- +EV_SSIZE_MAX +è- 1) + + ) + +253 #ifdeà +WIN32 + + +254  + #ev_sockËn_t +  + + ) + +255 #–ià +defšed +( +_EVENT_sockËn_t +) + +256  + #ev_sockËn_t + +_EVENT_sockËn_t + + + ) + +258  + #ev_sockËn_t + +sockËn_t + + + ) + +261 #ifdeà +_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY + + +262 #ià! +defšed +( +_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY +) \ + +263 && ! +defšed +( +ss_çmžy +) + +264  + #ss_çmžy + +__ss_çmžy + + + ) + +271 #ifdeà +WIN32 + + +272  + #evutž_sock‘_t + +šŒ_t + + + ) + +274  + #evutž_sock‘_t +  + + ) + +288  +evutž_sock‘·œ +( +d +,  +ty³ +,  +´ÙocÞ +, +evutž_sock‘_t + +sv +[2]); + +294  +evutž_make_sock‘_nÚblockšg +( +evutž_sock‘_t + +sock +); + +307  +evutž_make_li¡’_sock‘_»u£abË +( +evutž_sock‘_t + +sock +); + +315  +evutž_make_sock‘_þo£Úexec +( +evutž_sock‘_t + +sock +); + +323  +evutž_þo£sock‘ +( +evutž_sock‘_t + +sock +); + +324  + #EVUTIL_CLOSESOCKET +( +s +è + `evutž_þo£sock‘ +(s) + + ) + +327 #ifdeà +WIN32 + + +329  + #EVUTIL_SOCKET_ERROR +(è + `WSAG‘La¡E¼Ü +() + + ) + +331  + #EVUTIL_SET_SOCKET_ERROR +( +”rcode +) \ + +332 dØ{ + `WSAS‘La¡E¼Ü +( +”rcode +); } 0) + + ) + +334  +evutž_sock‘_g‘”rÜ +( +evutž_sock‘_t + +sock +); + +336 cÚ¡ * +evutž_sock‘_”rÜ_to_¡ršg +( +”rcode +); + +337 #–ià +defšed +( +_EVENT_IN_DOXYGEN +) + +353  + #EVUTIL_SOCKET_ERROR +(è... + + ) + +355  + #EVUTIL_SET_SOCKET_ERROR +( +”rcode +è... + + ) + +357  + #evutž_sock‘_g‘”rÜ +( +sock +è... + + ) + +359  + #evutž_sock‘_”rÜ_to_¡ršg +( +”rcode +è... + + ) + +362  + #EVUTIL_SOCKET_ERROR +(è( +”ºo +) + + ) + +363  + #EVUTIL_SET_SOCKET_ERROR +( +”rcode +) \ + +364 dØ{ +”ºo + = ( +”rcode +); } 0) + + ) + +365  + #evutž_sock‘_g‘”rÜ +( +sock +è( +”ºo +) + + ) + +366  + #evutž_sock‘_”rÜ_to_¡ršg +( +”rcode +è( + `¡»¼Ü +Ó¼code)) + + ) + +378 #ifdeà +_EVENT_HAVE_TIMERADD + + +379  + #evutž_tim”add +( +tvp +, +uvp +, +vvp +è + `tim”add +(Ñvp), (uvp), (vvp)) + + ) + +380  + #evutž_tim”sub +( +tvp +, +uvp +, +vvp +è + `tim”sub +(Ñvp), (uvp), (vvp)) + + ) + +382  + #evutž_tim”add +( +tvp +, +uvp +, +vvp +) \ + +384 ( +vvp +)-> +tv_£c + = ( +tvp +)->tv_£ø+ ( +uvp +)->tv_sec; \ + +385 ( +vvp +)-> +tv_u£c + = ( +tvp +)->tv_u£ø+ ( +uvp +)->tv_usec; \ + +386 ià(( +vvp +)-> +tv_u£c + >= 1000000) { \ + +387 ( +vvp +)-> +tv_£c +++; \ + +388 ( +vvp +)-> +tv_u£c + -= 1000000; \ + +390 } 0) + + ) + +391  + #evutž_tim”sub +( +tvp +, +uvp +, +vvp +) \ + +393 ( +vvp +)-> +tv_£c + = ( +tvp +)->tv_£ø- ( +uvp +)->tv_sec; \ + +394 ( +vvp +)-> +tv_u£c + = ( +tvp +)->tv_u£ø- ( +uvp +)->tv_usec; \ + +395 ià(( +vvp +)-> +tv_u£c + < 0) { \ + +396 ( +vvp +)-> +tv_£c +--; \ + +397 ( +vvp +)-> +tv_u£c + += 1000000; \ + +399 } 0) + + ) + +402 #ifdeà +_EVENT_HAVE_TIMERCLEAR + + +403  + #evutž_tim”þ—r +( +tvp +è + `tim”þ—r +Ñvp) + + ) + +405  + #evutž_tim”þ—r +( +tvp +èÑvp)-> +tv_£c + = (tvp)-> +tv_u£c + = 0 + + ) + +411  + #evutž_tim”cmp +( +tvp +, +uvp +, +cmp +) \ + +412 ((( +tvp +)-> +tv_£c + =ð( +uvp +)->tv_sec) ? \ + +413 (( +tvp +)-> +tv_u£c + + `cmp + ( +uvp +)->tv_usec) : \ + +414 (( +tvp +)-> +tv_£c + + `cmp + ( +uvp +)->tv_£c)) + + ) + +416 #ifdeà +_EVENT_HAVE_TIMERISSET + + +417  + #evutž_tim”is£t +( +tvp +è + `tim”is£t +Ñvp) + + ) + +419  + #evutž_tim”is£t +( +tvp +è(Ñvp)-> +tv_£c + || (tvp)-> +tv_u£c +) + + ) + +423 #ifdeà +off£tof + + +424  + #evutž_off£tof +( +ty³ +, +f›ld +è + `off£tof +Ñy³, f›ld) + + ) + +426  + #evutž_off£tof +( +ty³ +, +f›ld +è(( +off_t +)(&(Ñy³ *)0)->f›ld)) + + ) + +431 +ev_št64_t + +evutž_¡¹Þl +(cÚ¡ * +s +, ** +’d±r +,  +ba£ +); + +434 #ifdeà +_EVENT_HAVE_GETTIMEOFDAY + + +435  + #evutž_g‘timeofday +( +tv +, +tz +è + `g‘timeofday +(Ñv), (tz)) + + ) + +437  +timezÚe +; + +438  +evutž_g‘timeofday +( +timev® + * +tv +,  +timezÚe + * +tz +); + +444  +evutž_¢´štf +(* +buf +, +size_t + +buæ’ +, cÚ¡ * +fÜm© +, ...) + +445 #ifdeà +__GNUC__ + + +446 +__©Œibu‹__ +(( +fÜm© +( +´štf +, 3, 4))) + +452  +evutž_v¢´štf +(* +buf +, +size_t + +buæ’ +, cÚ¡ * +fÜm© +, +va_li¡ + +­ +); + +455 cÚ¡ * +evutž_š‘_ÁÝ +( +af +, cÚ¡ * +¤c +, * +d¡ +, +size_t + +Ën +); + +457  +evutž_š‘_±Ú +( +af +, cÚ¡ * +¤c +, * +d¡ +); + +458  +sockaddr +; + +480  +evutž_·r£_sockaddr_pÜt +(cÚ¡ * +¡r +,  +sockaddr + * +out +, * +ouŽ’ +); + +487  +evutž_sockaddr_cmp +(cÚ¡  +sockaddr + * +§1 +, cÚ¡ sockadd¸* +§2 +, + +488  +šþude_pÜt +); + +493  +evutž_ascii_¡rÿ£cmp +(cÚ¡ * +¡r1 +, cÚ¡ * +¡r2 +); + +497  +evutž_ascii_¡ºÿ£cmp +(cÚ¡ * +¡r1 +, cÚ¡ * +¡r2 +, +size_t + +n +); + +501 #ifdeà +_EVENT_HAVE_STRUCT_ADDRINFO + + +502  + #evutž_addršfo + +addršfo + + + ) + +509  + sevutž_addršfo + { + +510  +ai_æags +; + +511  +ai_çmžy +; + +512  +ai_sockty³ +; + +513  +ai_´ÙocÞ +; + +514 +size_t + +ai_add¾’ +; + +515 * +ai_ÿnÚÇme +; + +516  +sockaddr + * +ai_addr +; + +517  +evutž_addršfo + * +ai_Ãxt +; + +527 #ifdeà +EAI_ADDRFAMILY + + +528  + #EVUTIL_EAI_ADDRFAMILY + +EAI_ADDRFAMILY + + + ) + +530  + #EVUTIL_EAI_ADDRFAMILY + -901 + + ) + +532 #ifdeà +EAI_AGAIN + + +533  + #EVUTIL_EAI_AGAIN + +EAI_AGAIN + + + ) + +535  + #EVUTIL_EAI_AGAIN + -902 + + ) + +537 #ifdeà +EAI_BADFLAGS + + +538  + #EVUTIL_EAI_BADFLAGS + +EAI_BADFLAGS + + + ) + +540  + #EVUTIL_EAI_BADFLAGS + -903 + + ) + +542 #ifdeà +EAI_FAIL + + +543  + #EVUTIL_EAI_FAIL + +EAI_FAIL + + + ) + +545  + #EVUTIL_EAI_FAIL + -904 + + ) + +547 #ifdeà +EAI_FAMILY + + +548  + #EVUTIL_EAI_FAMILY + +EAI_FAMILY + + + ) + +550  + #EVUTIL_EAI_FAMILY + -905 + + ) + +552 #ifdeà +EAI_MEMORY + + +553  + #EVUTIL_EAI_MEMORY + +EAI_MEMORY + + + ) + +555  + #EVUTIL_EAI_MEMORY + -906 + + ) + +560 #ià +defšed +( +EAI_NODATA +è&& (!defšed( +EAI_NONAME +) || EAI_NODATA != EAI_NONAME) + +561  + #EVUTIL_EAI_NODATA + +EAI_NODATA + + + ) + +563  + #EVUTIL_EAI_NODATA + -907 + + ) + +565 #ifdeà +EAI_NONAME + + +566  + #EVUTIL_EAI_NONAME + +EAI_NONAME + + + ) + +568  + #EVUTIL_EAI_NONAME + -908 + + ) + +570 #ifdeà +EAI_SERVICE + + +571  + #EVUTIL_EAI_SERVICE + +EAI_SERVICE + + + ) + +573  + #EVUTIL_EAI_SERVICE + -909 + + ) + +575 #ifdeà +EAI_SOCKTYPE + + +576  + #EVUTIL_EAI_SOCKTYPE + +EAI_SOCKTYPE + + + ) + +578  + #EVUTIL_EAI_SOCKTYPE + -910 + + ) + +580 #ifdeà +EAI_SYSTEM + + +581  + #EVUTIL_EAI_SYSTEM + +EAI_SYSTEM + + + ) + +583  + #EVUTIL_EAI_SYSTEM + -911 + + ) + +586  + #EVUTIL_EAI_CANCEL + -90001 + + ) + +588 #ifdeà +AI_PASSIVE + + +589  + #EVUTIL_AI_PASSIVE + +AI_PASSIVE + + + ) + +591  + #EVUTIL_AI_PASSIVE + 0x1000 + + ) + +593 #ifdeà +AI_CANONNAME + + +594  + #EVUTIL_AI_CANONNAME + +AI_CANONNAME + + + ) + +596  + #EVUTIL_AI_CANONNAME + 0x2000 + + ) + +598 #ifdeà +AI_NUMERICHOST + + +599  + #EVUTIL_AI_NUMERICHOST + +AI_NUMERICHOST + + + ) + +601  + #EVUTIL_AI_NUMERICHOST + 0x4000 + + ) + +603 #ifdeà +AI_NUMERICSERV + + +604  + #EVUTIL_AI_NUMERICSERV + +AI_NUMERICSERV + + + ) + +606  + #EVUTIL_AI_NUMERICSERV + 0x8000 + + ) + +608 #ifdeà +AI_V4MAPPED + + +609  + #EVUTIL_AI_V4MAPPED + +AI_V4MAPPED + + + ) + +611  + #EVUTIL_AI_V4MAPPED + 0x10000 + + ) + +613 #ifdeà +AI_ALL + + +614  + #EVUTIL_AI_ALL + +AI_ALL + + + ) + +616  + #EVUTIL_AI_ALL + 0x20000 + + ) + +618 #ifdeà +AI_ADDRCONFIG + + +619  + #EVUTIL_AI_ADDRCONFIG + +AI_ADDRCONFIG + + + ) + +621  + #EVUTIL_AI_ADDRCONFIG + 0x40000 + + ) + +625  +evutž_addršfo +; + +637  +evutž_g‘addršfo +(cÚ¡ * +nod’ame +, cÚ¡ * +£rvÇme +, + +638 cÚ¡  +evutž_addršfo + * +hšts_š +, evutž_addršfØ** +»s +); + +641  +evutž_ä“addršfo +( +evutž_addršfo + * +ai +); + +643 cÚ¡ * +evutž_gai_¡»¼Ü +( +”r +); + +651  +evutž_£cu»_ºg_g‘_by‹s +(* +buf +, +size_t + +n +); + +669  +evutž_£cu»_ºg_š™ +(); + +685  +evutž_£cu»_ºg_add_by‹s +(cÚ¡ * +d© +, +size_t + +d©Ën +); + +687 #ifdeà +__ýlu¥lus + + + @/usr/include/gconv.h + +23 #iâdeà +_GCONV_H + + +24  + #_GCONV_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +27  + #__Ãed_mb¡©e_t + + + ) + +28  + #__Ãed_wšt_t + + + ) + +29  + ~ + +30  + #__Ãed_size_t + + + ) + +31  + #__Ãed_wch¬_t + + + ) + +32  + ~<¡ddef.h +> + +35  + #__UNKNOWN_10646_CHAR + (( +wch¬_t +è0xfffd) + + ) + +40 + m__GCONV_OK + = 0, + +41 + m__GCONV_NOCONV +, + +42 + m__GCONV_NODB +, + +43 + m__GCONV_NOMEM +, + +45 + m__GCONV_EMPTY_INPUT +, + +46 + m__GCONV_FULL_OUTPUT +, + +47 + m__GCONV_ILLEGAL_INPUT +, + +48 + m__GCONV_INCOMPLETE_INPUT +, + +50 + m__GCONV_ILLEGAL_DESCRIPTOR +, + +51 + m__GCONV_INTERNAL_ERROR + + +58 + m__GCONV_IS_LAST + = 0x0001, + +59 + m__GCONV_IGNORE_ERRORS + = 0x0002 + +64  + g__gcÚv_¡• +; + +65  + g__gcÚv_¡•_d©a +; + +66  + g__gcÚv_lßded_objeù +; + +67  + g__gcÚv_Œªs_d©a +; + +71 (* + t__gcÚv_fù +è( + t__gcÚv_¡• + *,  + t__gcÚv_¡•_d©a + *, + +72 + t__cÚ¡ + **, __const *, + +73 **, + tsize_t + *, , ); + +76  + $wšt_t + (* + t__gcÚv_btowc_fù +è( + t__gcÚv_¡• + *, ); + +79 (* + t__gcÚv_š™_fù +è( + t__gcÚv_¡• + *); + +80 (* + t__gcÚv_’d_fù +è( + t__gcÚv_¡• + *); + +84 (* + t__gcÚv_Œªs_fù +è( + t__gcÚv_¡• + *, + +85  + t__gcÚv_¡•_d©a + *, *, + +86 + t__cÚ¡ + *, + +87 + t__cÚ¡ + **, + +88 + t__cÚ¡ + *, **, + +89 + tsize_t + *); + +92 (* + t__gcÚv_Œªs_cڋxt_fù +è(*, + t__cÚ¡ + *, + +93 + t__cÚ¡ + *, + +97 (* + t__gcÚv_Œªs_qu”y_fù +è( + t__cÚ¡ + *, __const ***, + +98 + tsize_t + *); + +101 (* + t__gcÚv_Œªs_š™_fù +) (**, const *); + +102 (* + t__gcÚv_Œªs_’d_fù +) (*); + +104  + s__gcÚv_Œªs_d©a + + +107 +__gcÚv_Œªs_fù + +__Œªs_fù +; + +108 +__gcÚv_Œªs_cڋxt_fù + +__Œªs_cڋxt_fù +; + +109 +__gcÚv_Œªs_’d_fù + +__Œªs_’d_fù +; + +110 * +__d©a +; + +111  +__gcÚv_Œªs_d©a + * +__Ãxt +; + +116  + s__gcÚv_¡• + + +118  +__gcÚv_lßded_objeù + * +__shlib_hªdË +; + +119 +__cÚ¡ + * +__modÇme +; + +121  +__couÁ” +; + +123 * +__äom_Çme +; + +124 * +__to_Çme +; + +126 +__gcÚv_fù + +__fù +; + +127 +__gcÚv_btowc_fù + +__btowc_fù +; + +128 +__gcÚv_š™_fù + +__š™_fù +; + +129 +__gcÚv_’d_fù + +__’d_fù +; + +133  +__mš_Ãeded_äom +; + +134  +__max_Ãeded_äom +; + +135  +__mš_Ãeded_to +; + +136  +__max_Ãeded_to +; + +139  +__¡©eful +; + +141 * +__d©a +; + +146  + s__gcÚv_¡•_d©a + + +148 * +__outbuf +; + +149 * +__outbuãnd +; + +153  +__æags +; + +157  +__švoÿtiÚ_couÁ” +; + +161  +__š‹º®_u£ +; + +163 +__mb¡©e_t + * +__¡©• +; + +164 +__mb¡©e_t + +__¡©e +; + +168  +__gcÚv_Œªs_d©a + * +__Œªs +; + +173  + s__gcÚv_šfo + + +175 +size_t + +__n¡•s +; + +176  +__gcÚv_¡• + * +__¡•s +; + +177 +__ex‹nsiÚ__ +  +__gcÚv_¡•_d©a + +__d©a + +__æex¬r +; + +178 } * + t__gcÚv_t +; + + @/usr/include/netdb.h + +23 #iâdef +_NETDB_H + + +24  + #_NETDB_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +28  + ~<Ãtš‘/š.h +> + +29  + ~<¡dšt.h +> + +30 #ifdeà +__USE_MISC + + +33  + ~<½c/Ãtdb.h +> + +36 #ifdeà +__USE_GNU + + +37  + #__Ãed_sigev’t_t + + + ) + +38  + ~ + +39  + #__Ãed_time¥ec + + + ) + +40  + ~ + +43  + ~ + +46  + #_PATH_HEQUIV + "/‘c/ho¡s.equiv" + + ) + +47  + #_PATH_HOSTS + "/‘c/ho¡s" + + ) + +48  + #_PATH_NETWORKS + "/‘c/ÃtwÜks" + + ) + +49  + #_PATH_NSSWITCH_CONF + "/‘c/nssw™ch.cÚf" + + ) + +50  + #_PATH_PROTOCOLS + "/‘c/´ÙocÞs" + + ) + +51  + #_PATH_SERVICES + "/‘c/£rviûs" + + ) + +54 + g__BEGIN_DECLS + + +56 #ià +defšed + +__USE_MISC + || !defšed +__USE_XOPEN2K8 + + +59  + #h_”ºo + (* + `__h_”ºo_loÿtiÚ + ()) + + ) + +62 * + $__h_”ºo_loÿtiÚ + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +66  + #HOST_NOT_FOUND + 1 + + ) + +67  + #TRY_AGAIN + 2 + + ) + +69  + #NO_RECOVERY + 3 + + ) + +71  + #NO_DATA + 4 + + ) + +74 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +75  + #NETDB_INTERNAL + -1 + + ) + +76  + #NETDB_SUCCESS + 0 + + ) + +77  + #NO_ADDRESS + +NO_DATA + + + ) + +80 #ifdeà +__USE_XOPEN2K + + +82  + #IPPORT_RESERVED + 1024 + + ) + +85 #ifdeà +__USE_GNU + + +87  + #SCOPE_DELIMITER + '%' + + ) + +90 #ifdeà +__USE_MISC + + +93  + $h”rÜ + ( +__cÚ¡ + * +__¡r +è +__THROW +; + +96 +__cÚ¡ + * + $h¡»¼Ü + ( +__”r_num +è +__THROW +; + +101  + sho¡’t + + +103 * +h_Çme +; + +104 ** +h_®Ÿ£s +; + +105  +h_add¹y³ +; + +106  +h_Ëngth +; + +107 ** +h_addr_li¡ +; + +108 #ià +defšed + +__USE_MISC + || defšed +__USE_GNU + + +109  + #h_addr + +h_addr_li¡ +[0] + + ) + +118  + `£tho¡’t + ( +__¡ay_ݒ +); + +124  + `’dho¡’t + (); + +131  +ho¡’t + * + `g‘ho¡’t + (); + +138  +ho¡’t + * + `g‘ho¡byaddr + ( +__cÚ¡ + * +__addr +, +__sockËn_t + +__Ën +, + +139  +__ty³ +); + +145  +ho¡’t + * + `g‘ho¡byÇme + ( +__cÚ¡ + * +__Çme +); + +147 #ifdeà +__USE_MISC + + +156  +ho¡’t + * + `g‘ho¡byÇme2 + ( +__cÚ¡ + * +__Çme +,  +__af +); + +168  + `g‘ho¡’t_r + ( +ho¡’t + * +__»¡riù + +__»suÉ_buf +, + +169 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +170  +ho¡’t + ** +__»¡riù + +__»suÉ +, + +171 * +__»¡riù + +__h_”ºÝ +); + +173  + `g‘ho¡byaddr_r + ( +__cÚ¡ + * +__»¡riù + +__addr +, +__sockËn_t + +__Ën +, + +174  +__ty³ +, + +175  +ho¡’t + * +__»¡riù + +__»suÉ_buf +, + +176 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +177  +ho¡’t + ** +__»¡riù + +__»suÉ +, + +178 * +__»¡riù + +__h_”ºÝ +); + +180  + `g‘ho¡byÇme_r + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +181  +ho¡’t + * +__»¡riù + +__»suÉ_buf +, + +182 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +183  +ho¡’t + ** +__»¡riù + +__»suÉ +, + +184 * +__»¡riù + +__h_”ºÝ +); + +186  + `g‘ho¡byÇme2_r + ( +__cÚ¡ + * +__»¡riù + +__Çme +,  +__af +, + +187  +ho¡’t + * +__»¡riù + +__»suÉ_buf +, + +188 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +189  +ho¡’t + ** +__»¡riù + +__»suÉ +, + +190 * +__»¡riù + +__h_”ºÝ +); + +199  + `£Š‘’t + ( +__¡ay_ݒ +); + +205  + `’dËÁ + (); + +212  +ËÁ + * + `g‘ËÁ + (); + +219  +ËÁ + * + `g‘Ãtbyaddr + ( +ušt32_t + +__Ãt +,  +__ty³ +); + +225  +ËÁ + * + `g‘ÃtbyÇme + ( +__cÚ¡ + * +__Çme +); + +227 #ifdef +__USE_MISC + + +238  + `g‘ËÁ_r + ( +ËÁ + * +__»¡riù + +__»suÉ_buf +, + +239 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +240  +ËÁ + ** +__»¡riù + +__»suÉ +, + +241 * +__»¡riù + +__h_”ºÝ +); + +243  + `g‘Ãtbyaddr_r + ( +ušt32_t + +__Ãt +,  +__ty³ +, + +244  +ËÁ + * +__»¡riù + +__»suÉ_buf +, + +245 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +246  +ËÁ + ** +__»¡riù + +__»suÉ +, + +247 * +__»¡riù + +__h_”ºÝ +); + +249  + `g‘ÃtbyÇme_r + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +250  +ËÁ + * +__»¡riù + +__»suÉ_buf +, + +251 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +252  +ËÁ + ** +__»¡riù + +__»suÉ +, + +253 * +__»¡riù + +__h_”ºÝ +); + +258  + s£rv’t + + +260 * +s_Çme +; + +261 ** +s_®Ÿ£s +; + +262  +s_pÜt +; + +263 * +s_´Ùo +; + +271  + `£t£rv’t + ( +__¡ay_ݒ +); + +277  + `’d£rv’t + (); + +284  +£rv’t + * + `g‘£rv’t + (); + +291  +£rv’t + * + `g‘£rvbyÇme + ( +__cÚ¡ + * +__Çme +, + +292 +__cÚ¡ + * +__´Ùo +); + +299  +£rv’t + * + `g‘£rvbypÜt + ( +__pÜt +, +__cÚ¡ + * +__´Ùo +); + +302 #ifdef +__USE_MISC + + +310  + `g‘£rv’t_r + ( +£rv’t + * +__»¡riù + +__»suÉ_buf +, + +311 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +312  +£rv’t + ** +__»¡riù + +__»suÉ +); + +314  + `g‘£rvbyÇme_r + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +315 +__cÚ¡ + * +__»¡riù + +__´Ùo +, + +316  +£rv’t + * +__»¡riù + +__»suÉ_buf +, + +317 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +318  +£rv’t + ** +__»¡riù + +__»suÉ +); + +320  + `g‘£rvbypÜt_r + ( +__pÜt +, +__cÚ¡ + * +__»¡riù + +__´Ùo +, + +321  +£rv’t + * +__»¡riù + +__»suÉ_buf +, + +322 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +323  +£rv’t + ** +__»¡riù + +__»suÉ +); + +328  + s´ÙÛÁ + + +330 * +p_Çme +; + +331 ** +p_®Ÿ£s +; + +332  +p_´Ùo +; + +340  + `£rÙÛÁ + ( +__¡ay_ݒ +); + +346  + `’d´ÙÛÁ + (); + +353  +´ÙÛÁ + * + `g‘´ÙÛÁ + (); + +359  +´ÙÛÁ + * + `g‘´ÙobyÇme + ( +__cÚ¡ + * +__Çme +); + +365  +´ÙÛÁ + * + `g‘´Ùobynumb” + ( +__´Ùo +); + +368 #ifdef +__USE_MISC + + +376  + `g‘´ÙÛÁ_r + ( +´ÙÛÁ + * +__»¡riù + +__»suÉ_buf +, + +377 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +378  +´ÙÛÁ + ** +__»¡riù + +__»suÉ +); + +380  + `g‘´ÙobyÇme_r + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +381  +´ÙÛÁ + * +__»¡riù + +__»suÉ_buf +, + +382 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +383  +´ÙÛÁ + ** +__»¡riù + +__»suÉ +); + +385  + `g‘´Ùobynumb”_r + ( +__´Ùo +, + +386  +´ÙÛÁ + * +__»¡riù + +__»suÉ_buf +, + +387 * +__»¡riù + +__buf +, +size_t + +__buæ’ +, + +388  +´ÙÛÁ + ** +__»¡riù + +__»suÉ +); + +397  + `£Š‘g»Á + ( +__cÚ¡ + * +__Ãtgroup +); + +405  + `’dÃtg»Á + (); + +414  + `g‘Ãtg»Á + (** +__»¡riù + +__ho¡p +, + +415 ** +__»¡riù + +__u£½ +, + +416 ** +__»¡riù + +__domašp +); + +425  + `šÃtgr + ( +__cÚ¡ + * +__Ãtgroup +, __cÚ¡ * +__ho¡ +, + +426 +__cÚ¡ + * +__u£r +, __cÚ¡ * +__domaš +); + +434  + `g‘Ãtg»Á_r + (** +__»¡riù + +__ho¡p +, + +435 ** +__»¡riù + +__u£½ +, + +436 ** +__»¡riù + +__domašp +, + +437 * +__»¡riù + +__bufãr +, +size_t + +__buæ’ +); + +441 #ifdeà +__USE_BSD + + +453  + `rcmd + (** +__»¡riù + +__aho¡ +,  +__½Üt +, + +454 +__cÚ¡ + * +__»¡riù + +__locu£r +, + +455 +__cÚ¡ + * +__»¡riù + +__»mu£r +, + +456 +__cÚ¡ + * +__»¡riù + +__cmd +, *__»¡riù +__fd2p +); + +465  + `rcmd_af + (** +__»¡riù + +__aho¡ +,  +__½Üt +, + +466 +__cÚ¡ + * +__»¡riù + +__locu£r +, + +467 +__cÚ¡ + * +__»¡riù + +__»mu£r +, + +468 +__cÚ¡ + * +__»¡riù + +__cmd +, *__»¡riù +__fd2p +, + +469 +§_çmžy_t + +__af +); + +481  + `»xec + (** +__»¡riù + +__aho¡ +,  +__½Üt +, + +482 +__cÚ¡ + * +__»¡riù + +__Çme +, + +483 +__cÚ¡ + * +__»¡riù + +__·ss +, + +484 +__cÚ¡ + * +__»¡riù + +__cmd +, *__»¡riù +__fd2p +); + +493  + `»xec_af + (** +__»¡riù + +__aho¡ +,  +__½Üt +, + +494 +__cÚ¡ + * +__»¡riù + +__Çme +, + +495 +__cÚ¡ + * +__»¡riù + +__·ss +, + +496 +__cÚ¡ + * +__»¡riù + +__cmd +, *__»¡riù +__fd2p +, + +497 +§_çmžy_t + +__af +); + +507  + `ru£rok + ( +__cÚ¡ + * +__rho¡ +,  +__su£r +, + +508 +__cÚ¡ + * +__»mu£r +, __cÚ¡ * +__locu£r +); + +517  + `ru£rok_af + ( +__cÚ¡ + * +__rho¡ +,  +__su£r +, + +518 +__cÚ¡ + * +__»mu£r +, __cÚ¡ * +__locu£r +, + +519 +§_çmžy_t + +__af +); + +530  + `œu£rok + ( +ušt32_t + +__¿ddr +,  +__su£r +, + +531 +__cÚ¡ + * +__»mu£r +, __cÚ¡ * +__locu£r +); + +541  + `œu£rok_af + ( +__cÚ¡ + * +__¿ddr +,  +__su£r +, + +542 +__cÚ¡ + * +__»mu£r +, __cÚ¡ * +__locu£r +, + +543 +§_çmžy_t + +__af +); + +553  + `¼esvpÜt + (* +__®pÜt +); + +562  + `¼esvpÜt_af + (* +__®pÜt +, +§_çmžy_t + +__af +); + +567 #ifdef +__USE_POSIX + + +569  + saddršfo + + +571  +ai_æags +; + +572  +ai_çmžy +; + +573  +ai_sockty³ +; + +574  +ai_´ÙocÞ +; + +575 +sockËn_t + +ai_add¾’ +; + +576  +sockaddr + * +ai_addr +; + +577 * +ai_ÿnÚÇme +; + +578  +addršfo + * +ai_Ãxt +; + +581 #ifdeà +__USE_GNU + + +583  + sgaicb + + +585 cÚ¡ * +¬_Çme +; + +586 cÚ¡ * +¬_£rviû +; + +587 cÚ¡  +addršfo + * +¬_»que¡ +; + +588  +addršfo + * +¬_»suÉ +; + +590  +__»tuº +; + +591  +__unu£d +[5]; + +595  + #GAI_WAIT + 0 + + ) + +596  + #GAI_NOWAIT + 1 + + ) + +600  + #AI_PASSIVE + 0x0001 + + ) + +601  + #AI_CANONNAME + 0x0002 + + ) + +602  + #AI_NUMERICHOST + 0x0004 + + ) + +603  + #AI_V4MAPPED + 0x0008 + + ) + +604  + #AI_ALL + 0x0010 + + ) + +605  + #AI_ADDRCONFIG + 0x0020 + + ) + +607 #ifdeà +__USE_GNU + + +608  + #AI_IDN + 0x0040 + + ) + +611  + #AI_CANONIDN + 0x0080 + + ) + +612  + #AI_IDN_ALLOW_UNASSIGNED + 0x0100 + + ) + +614  + #AI_IDN_USE_STD3_ASCII_RULES + 0x0200 + + ) + +617  + #AI_NUMERICSERV + 0x0400 + + ) + +620  + #EAI_BADFLAGS + -1 + + ) + +621  + #EAI_NONAME + -2 + + ) + +622  + #EAI_AGAIN + -3 + + ) + +623  + #EAI_FAIL + -4 + + ) + +624  + #EAI_FAMILY + -6 + + ) + +625  + #EAI_SOCKTYPE + -7 + + ) + +626  + #EAI_SERVICE + -8 + + ) + +627  + #EAI_MEMORY + -10 + + ) + +628  + #EAI_SYSTEM + -11 + + ) + +629  + #EAI_OVERFLOW + -12 + + ) + +630 #ifdeà +__USE_GNU + + +631  + #EAI_NODATA + -5 + + ) + +632  + #EAI_ADDRFAMILY + -9 + + ) + +633  + #EAI_INPROGRESS + -100 + + ) + +634  + #EAI_CANCELED + -101 + + ) + +635  + #EAI_NOTCANCELED + -102 + + ) + +636  + #EAI_ALLDONE + -103 + + ) + +637  + #EAI_INTR + -104 + + ) + +638  + #EAI_IDN_ENCODE + -105 + + ) + +641 #ifdeà +__USE_MISC + + +642  + #NI_MAXHOST + 1025 + + ) + +643  + #NI_MAXSERV + 32 + + ) + +646  + #NI_NUMERICHOST + 1 + + ) + +647  + #NI_NUMERICSERV + 2 + + ) + +648  + #NI_NOFQDN + 4 + + ) + +649  + #NI_NAMEREQD + 8 + + ) + +650  + #NI_DGRAM + 16 + + ) + +651 #ifdeà +__USE_GNU + + +652  + #NI_IDN + 32 + + ) + +653  + #NI_IDN_ALLOW_UNASSIGNED + 64 + + ) + +655  + #NI_IDN_USE_STD3_ASCII_RULES + 128 + + ) + +664  + `g‘addršfo + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +665 +__cÚ¡ + * +__»¡riù + +__£rviû +, + +666 +__cÚ¡ +  +addršfo + * +__»¡riù + +__»q +, + +667  +addršfo + ** +__»¡riù + +__·i +); + +670  + $ä“addršfo + ( +addršfo + * +__ai +è +__THROW +; + +673 +__cÚ¡ + * + $gai_¡»¼Ü + ( +__ecode +è +__THROW +; + +679  + `g‘Çmešfo + ( +__cÚ¡ +  +sockaddr + * +__»¡riù + +__§ +, + +680 +sockËn_t + +__§Ën +, * +__»¡riù + +__ho¡ +, + +681 +sockËn_t + +__ho¡Ën +, * +__»¡riù + +__£rv +, + +682 +sockËn_t + +__£rvËn +,  +__æags +); + +685 #ifdeà +__USE_GNU + + +694  + `g‘addršfo_a + ( +__mode +,  +gaicb + * +__li¡ +[ +__»¡riù_¬r +], + +695  +__’t +,  +sigev’t + * +__»¡riù + +__sig +); + +705  + `gai_su¥’d + ( +__cÚ¡ +  +gaicb + *__cÚ¡ +__li¡ +[],  +__’t +, + +706 +__cÚ¡ +  +time¥ec + * +__timeout +); + +709  + $gai_”rÜ + ( +gaicb + * +__»q +è +__THROW +; + +712  + $gai_ÿnûl + ( +gaicb + * +__gaicbp +è +__THROW +; + +715 +__END_DECLS + + + @/usr/include/wchar.h + +24 #iâdeà +_WCHAR_H + + +26 #ià! +defšed + +__Ãed_mb¡©e_t + && !defšed +__Ãed_wšt_t + + +27  + #_WCHAR_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +31 #ifdeà +_WCHAR_H + + +33  + #__Ãed___FILE + + + ) + +34 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +35  + #__Ãed_FILE + + + ) + +37  + ~<¡dio.h +> + +39  + #__Ãed___va_li¡ + + + ) + +40  + ~<¡d¬g.h +> + +42  + ~ + +45  + #__Ãed_size_t + + + ) + +46  + #__Ãed_wch¬_t + + + ) + +47  + #__Ãed_NULL + + + ) + +49 #ià +defšed + +_WCHAR_H + || defšed +__Ãed_wšt_t + || !defšed +__WINT_TYPE__ + + +50 #undeà +__Ãed_wšt_t + + +51  + #__Ãed_wšt_t + + + ) + +52  + ~<¡ddef.h +> + +56 #iâdeà +_WINT_T + + +61  + #_WINT_T + + + ) + +62  + twšt_t +; + +66 #ià +defšed + +__ýlu¥lus + && defšed +_GLIBCPP_USE_NAMESPACES + \ + +67 && +defšed + +__WINT_TYPE__ + + +68 +__BEGIN_NAMESPACE_STD + + +69  +__WINT_TYPE__ + + twšt_t +; + +70 + g__END_NAMESPACE_STD + + +75 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (4, 4) + +76  + #__CORRECT_ISO_CPP_WCHAR_H_PROTO + + + ) + +80 #ià( +defšed + +_WCHAR_H + || defšed +__Ãed_mb¡©e_t +è&& !defšed +__mb¡©e_t_defšed + + +81  + #__mb¡©e_t_defšed + 1 + + ) + +85  + m__couÁ +; + +88 #ifdeà +__WINT_TYPE__ + + +89 +__WINT_TYPE__ + + m__wch +; + +91 +wšt_t + + m__wch +; + +93  + m__wchb +[4]; + +94 } + m__v®ue +; + +95 } + t__mb¡©e_t +; + +97 #undeà +__Ãed_mb¡©e_t + + +102 #ifdeà +_WCHAR_H + + +104 +__BEGIN_NAMESPACE_C99 + + +106  +__mb¡©e_t + + tmb¡©e_t +; + +107 + g__END_NAMESPACE_C99 + + +108 #ifdeà +__USE_GNU + + +109 + $__USING_NAMESPACE_C99 +( +mb¡©e_t +) + +112 #iâdeà +WCHAR_MIN + + +114  + #WCHAR_MIN + +__WCHAR_MIN + + + ) + +115  + #WCHAR_MAX + +__WCHAR_MAX + + + ) + +118 #iâdeà +WEOF + + +119  + #WEOF + (0xffffffffu) + + ) + +124 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_UNIX98 + + +125  + ~ + +129 +__BEGIN_DECLS + + +131 +__BEGIN_NAMESPACE_STD + + +134  +tm +; + +135 +__END_NAMESPACE_STD + + +139 + $__USING_NAMESPACE_STD +( +tm +) + +142 +__BEGIN_NAMESPACE_STD + + +144 +wch¬_t + * + $wcsýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +145 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +147 +wch¬_t + * + $wc¢ýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +148 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +149 +__THROW +; + +152 +wch¬_t + * + $wcsÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +153 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +155 +wch¬_t + * + $wc¢ÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +156 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +157 +__THROW +; + +160  + $wcscmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +) + +161 +__THROW + +__©Œibu‹_pu»__ +; + +163  + $wc¢cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, +size_t + +__n +) + +164 +__THROW + +__©Œibu‹_pu»__ +; + +165 +__END_NAMESPACE_STD + + +167 #ifdeà +__USE_XOPEN2K8 + + +169  + $wcsÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +172  + $wc¢ÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +173 +size_t + +__n +è +__THROW +; + +177  + ~ + +179  + $wcsÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +180 +__loÿË_t + +__loc +è +__THROW +; + +182  + $wc¢ÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +183 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +186 +__BEGIN_NAMESPACE_STD + + +189  + $wcscÞl + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +193 +size_t + + $wcsxäm + ( +wch¬_t + * +__»¡riù + +__s1 +, + +194 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +195 +__END_NAMESPACE_STD + + +197 #ifdeà +__USE_XOPEN2K8 + + +203  + $wcscÞl_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +204 +__loÿË_t + +__loc +è +__THROW +; + +209 +size_t + + $wcsxäm_l + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, + +210 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +213 +wch¬_t + * + $wcsdup + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_m®loc__ +; + +216 +__BEGIN_NAMESPACE_STD + + +218 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +219 "C++" +wch¬_t + * + $wcschr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +220 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +221 "C++" +__cÚ¡ + +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +222 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +224 +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +225 +__THROW + +__©Œibu‹_pu»__ +; + +228 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +229 "C++" +wch¬_t + * + $wc¤chr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +230 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +231 "C++" +__cÚ¡ + +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +232 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +234 +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +235 +__THROW + +__©Œibu‹_pu»__ +; + +237 +__END_NAMESPACE_STD + + +239 #ifdeà +__USE_GNU + + +242 +wch¬_t + * + $wcschºul + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__wc +) + +243 +__THROW + +__©Œibu‹_pu»__ +; + +246 +__BEGIN_NAMESPACE_STD + + +249 +size_t + + $wcsc¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__»jeù +) + +250 +__THROW + +__©Œibu‹_pu»__ +; + +253 +size_t + + $wcs¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +254 +__THROW + +__©Œibu‹_pu»__ +; + +256 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +257 "C++" +wch¬_t + * + $wc¥brk + ( +wch¬_t + * +__wcs +, +__cÚ¡ + wch¬_ˆ* +__acû± +) + +258 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +259 "C++" +__cÚ¡ + +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, + +260 +__cÚ¡ + +wch¬_t + * +__acû± +) + +261 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +263 +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +264 +__THROW + +__©Œibu‹_pu»__ +; + +267 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +268 "C++" +wch¬_t + * + $wcs¡r + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +269 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +270 "C++" +__cÚ¡ + +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +271 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +272 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +274 +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +275 +__THROW + +__©Œibu‹_pu»__ +; + +279 +wch¬_t + * + $wc¡ok + ( +wch¬_t + * +__»¡riù + +__s +, + +280 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__d–im +, + +281 +wch¬_t + ** +__»¡riù + +__±r +è +__THROW +; + +284 +size_t + + $wc¦’ + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_pu»__ +; + +285 +__END_NAMESPACE_STD + + +287 #ifdeà +__USE_XOPEN + + +289 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +290 "C++" +wch¬_t + * + $wcswcs + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +291 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +292 "C++" +__cÚ¡ + +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +293 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +294 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +296 +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +297 +__THROW + +__©Œibu‹_pu»__ +; + +301 #ifdeà +__USE_XOPEN2K8 + + +303 +size_t + + $wc¢Ën + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__maxËn +) + +304 +__THROW + +__©Œibu‹_pu»__ +; + +308 +__BEGIN_NAMESPACE_STD + + +310 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +311 "C++" +wch¬_t + * + $wmemchr + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +312 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +313 "C++" +__cÚ¡ + +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, + +314 +size_t + +__n +) + +315 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +317 +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +318 +__THROW + +__©Œibu‹_pu»__ +; + +322  + $wmemcmp + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s1 +, + +323 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +324 +__THROW + +__©Œibu‹_pu»__ +; + +327 +wch¬_t + * + $wmemýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +328 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +332 +wch¬_t + * + $wmemmove + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, +size_t + +__n +) + +333 +__THROW +; + +336 +wch¬_t + * + $wmem£t + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +è +__THROW +; + +337 +__END_NAMESPACE_STD + + +339 #ifdeà +__USE_GNU + + +342 +wch¬_t + * + $wmempýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +343 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +344 +__THROW +; + +348 +__BEGIN_NAMESPACE_STD + + +351 +wšt_t + + $btowc + ( +__c +è +__THROW +; + +355  + $wùob + ( +wšt_t + +__c +è +__THROW +; + +359  + $mbsš™ + ( +__cÚ¡ + +mb¡©e_t + * +__ps +è +__THROW + +__©Œibu‹_pu»__ +; + +363 +size_t + + $mb¹owc + ( +wch¬_t + * +__»¡riù + +__pwc +, + +364 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +365 +mb¡©e_t + * +__p +è +__THROW +; + +368 +size_t + + $wütomb + (* +__»¡riù + +__s +, +wch¬_t + +__wc +, + +369 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +372 +size_t + + $__mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +373 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +374 +size_t + + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +375 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +376 +__END_NAMESPACE_STD + + +378 #ifdeà +__USE_EXTERN_INLINES + + +384 +wšt_t + + $__btowc_®Ÿs + ( +__c +è + `__asm + ("btowc"); + +385 +__ex‹º_šlše + +wšt_t + + +386 + `__NTH + ( + $btowc + ( +__c +)) + +387 {  ( + `__bužtš_cÚ¡ªt_p + ( +__c +) && __c >= '\0' && __c <= '\x7f' + +388 ? ( +wšt_t +è +__c + : + `__btowc_®Ÿs + (__c)); + } +} + +390  + $__wùob_®Ÿs + ( +wšt_t + +__c +è + `__asm + ("wctob"); + +391 +__ex‹º_šlše +  + +392 + `__NTH + ( + $wùob + ( +wšt_t + +__wc +)) + +393 {  ( + `__bužtš_cÚ¡ªt_p + ( +__wc +è&& __wø>ð +L +'\0' && __wc <= L'\x7f' + +394 ? (è +__wc + : + `__wùob_®Ÿs + (__wc)); + } +} + +396 +__ex‹º_šlše + +size_t + + +397 +__NTH + ( + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +398 +mb¡©e_t + * +__»¡riù + +__ps +)) + +399 {  ( +__ps + !ð +NULL + + +400 ? + `mb¹owc + ( +NULL +, +__s +, +__n +, +__ps +è: + `__mb¾’ + (__s, __n, NULL)); + } +} + +403 +__BEGIN_NAMESPACE_STD + + +406 +size_t + + $mb¤towcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +407 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +408 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +412 +size_t + + $wc¤tombs + (* +__»¡riù + +__d¡ +, + +413 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +414 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +415 +__END_NAMESPACE_STD + + +418 #ifdef +__USE_XOPEN2K8 + + +421 +size_t + + $mb¢¹owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +422 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +423 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +427 +size_t + + $wc¢¹ombs + (* +__»¡riù + +__d¡ +, + +428 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +429 +size_t + +__nwc +, size_ˆ +__Ën +, + +430 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +435 #ifdeà +__USE_XOPEN + + +437  + $wcwidth + ( +wch¬_t + +__c +è +__THROW +; + +441  + $wcswidth + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__n +è +__THROW +; + +445 +__BEGIN_NAMESPACE_STD + + +448  + $wc¡od + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +449 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +450 +__END_NAMESPACE_STD + + +452 #ifdeà +__USE_ISOC99 + + +453 +__BEGIN_NAMESPACE_C99 + + +455  + $wc¡of + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +456 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +457  + $wc¡Þd + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +458 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +459 +__END_NAMESPACE_C99 + + +463 +__BEGIN_NAMESPACE_STD + + +466  + $wc¡Þ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +467 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +è +__THROW +; + +471  + $wc¡oul + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +472 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +473 +__THROW +; + +474 +__END_NAMESPACE_STD + + +476 #ià +defšed + +__USE_ISOC99 + || (defšed +__GNUC__ + && defšed +__USE_GNU +) + +477 +__BEGIN_NAMESPACE_C99 + + +480 +__ex‹nsiÚ__ + + +481  + $wc¡Þl + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +482 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +483 +__THROW +; + +487 +__ex‹nsiÚ__ + + +488  + $wc¡ouÎ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +489 +wch¬_t + ** +__»¡riù + +__’d±r +, + +490  +__ba£ +è +__THROW +; + +491 +__END_NAMESPACE_C99 + + +494 #ià +defšed + +__GNUC__ + && defšed +__USE_GNU + + +497 +__ex‹nsiÚ__ + + +498  + $wc¡oq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +499 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +500 +__THROW +; + +504 +__ex‹nsiÚ__ + + +505  + $wc¡ouq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +506 +wch¬_t + ** +__»¡riù + +__’d±r +, + +507  +__ba£ +è +__THROW +; + +510 #ifdeà +__USE_GNU + + +524  + ~ + +528  + $wc¡Þ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +529 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +, + +530 +__loÿË_t + +__loc +è +__THROW +; + +532  + $wc¡oul_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +533 +wch¬_t + ** +__»¡riù + +__’d±r +, + +534  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +536 +__ex‹nsiÚ__ + + +537  + $wc¡Þl_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +538 +wch¬_t + ** +__»¡riù + +__’d±r +, + +539  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +541 +__ex‹nsiÚ__ + + +542  + $wc¡ouÎ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +543 +wch¬_t + ** +__»¡riù + +__’d±r +, + +544  +__ba£ +, +__loÿË_t + +__loc +) + +545 +__THROW +; + +547  + $wc¡od_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +548 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +549 +__THROW +; + +551  + $wc¡of_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +552 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +553 +__THROW +; + +555  + $wc¡Þd_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__Ō +, + +556 +wch¬_t + ** +__»¡riù + +__’d±r +, + +557 +__loÿË_t + +__loc +è +__THROW +; + +562 +wch¬_t + * + $wýýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +563 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +567 +wch¬_t + * + $wýnýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +568 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +569 +__THROW +; + +575 #ifdef +__USE_XOPEN2K8 + + +578 +__FILE + * + $ݒ_wmem¡»am + ( +wch¬_t + ** +__buæoc +, +size_t + * +__siz–oc +è +__THROW +; + +581 #ià +defšed + +__USE_ISOC95 + || defšed +__USE_UNIX98 + + +582 +__BEGIN_NAMESPACE_STD + + +585  + $fwide + ( +__FILE + * +__å +,  +__mode +è +__THROW +; + +592  + `fw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, + +593 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +599  + `w´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +602  + $sw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +603 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +604 +__THROW + ; + +610  + `vfw´štf + ( +__FILE + * +__»¡riù + +__s +, + +611 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +612 +__gnuc_va_li¡ + +__¬g +) + +618  + `vw´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +619 +__gnuc_va_li¡ + +__¬g +) + +623  + $vsw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +624 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +625 +__gnuc_va_li¡ + +__¬g +) + +626 +__THROW + ; + +633  + `fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +634 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +640  + `wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +643  + $swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +644 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +645 +__THROW + ; + +647 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +648 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +649 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +650 #ifdeà +__REDIRECT + + +654  + `__REDIRECT + ( +fwsÿnf +, ( +__FILE + * +__»¡riù + +__¡»am +, + +655 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +656 +__isoc99_fwsÿnf +) + +658  + `__REDIRECT + ( +wsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +659 +__isoc99_wsÿnf +) + +661  + `__REDIRECT_NTH + ( +swsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +662 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +663 ...), +__isoc99_swsÿnf +) + +666  + `__isoc99_fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +667 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +668  + `__isoc99_wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +669  + $__isoc99_swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +670 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +671 +__THROW +; + +672  + #fwsÿnf + +__isoc99_fwsÿnf + + + ) + +673  + #wsÿnf + +__isoc99_wsÿnf + + + ) + +674  + #swsÿnf + +__isoc99_swsÿnf + + + ) + +678 +__END_NAMESPACE_STD + + +681 #ifdeà +__USE_ISOC99 + + +682 +__BEGIN_NAMESPACE_C99 + + +687  + `vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +688 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +689 +__gnuc_va_li¡ + +__¬g +) + +695  + `vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +696 +__gnuc_va_li¡ + +__¬g +) + +699  + $vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +700 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +701 +__gnuc_va_li¡ + +__¬g +) + +702 +__THROW + ; + +704 #ià! +defšed + +__USE_GNU + \ + +705 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +706 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +707 #ifdeà +__REDIRECT + + +708  + `__REDIRECT + ( +vfwsÿnf +, ( +__FILE + * +__»¡riù + +__s +, + +709 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +710 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vfwsÿnf +) + +712  + `__REDIRECT + ( +vwsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +713 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vwsÿnf +) + +715  + `__REDIRECT_NTH + ( +vswsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +716 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +717 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vswsÿnf +) + +720  + `__isoc99_vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +721 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +722 +__gnuc_va_li¡ + +__¬g +); + +723  + `__isoc99_vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +724 +__gnuc_va_li¡ + +__¬g +); + +725  + $__isoc99_vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +726 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +727 +__gnuc_va_li¡ + +__¬g +è +__THROW +; + +728  + #vfwsÿnf + +__isoc99_vfwsÿnf + + + ) + +729  + #vwsÿnf + +__isoc99_vwsÿnf + + + ) + +730  + #vswsÿnf + +__isoc99_vswsÿnf + + + ) + +734 +__END_NAMESPACE_C99 + + +738 +__BEGIN_NAMESPACE_STD + + +743 +wšt_t + + `fg‘wc + ( +__FILE + * +__¡»am +); + +744 +wšt_t + + `g‘wc + ( +__FILE + * +__¡»am +); + +750 +wšt_t + + `g‘wch¬ + (); + +757 +wšt_t + + `åutwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +758 +wšt_t + + `putwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +764 +wšt_t + + `putwch¬ + ( +wch¬_t + +__wc +); + +772 +wch¬_t + * + `fg‘ws + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +773 +__FILE + * +__»¡riù + +__¡»am +); + +779  + `åutws + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +780 +__FILE + * +__»¡riù + +__¡»am +); + +787 +wšt_t + + `ung‘wc + (wšt_ˆ +__wc +, +__FILE + * +__¡»am +); + +788 +__END_NAMESPACE_STD + + +791 #ifdeà +__USE_GNU + + +799 +wšt_t + + `g‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +800 +wšt_t + + `g‘wch¬_uÆocked + (); + +808 +wšt_t + + `fg‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +816 +wšt_t + + `åutwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +825 +wšt_t + + `putwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +826 +wšt_t + + `putwch¬_uÆocked + ( +wch¬_t + +__wc +); + +835 +wch¬_t + * + `fg‘ws_uÆocked + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +836 +__FILE + * +__»¡riù + +__¡»am +); + +844  + `åutws_uÆocked + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +845 +__FILE + * +__»¡riù + +__¡»am +); + +849 +__BEGIN_NAMESPACE_C99 + + +853 +size_t + + $wcsáime + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +854 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +855 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +856 +__END_NAMESPACE_C99 + + +858 #ifdeà +__USE_GNU + + +859  + ~ + +863 +size_t + + $wcsáime_l + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +864 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +865 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +866 +__loÿË_t + +__loc +è +__THROW +; + +875 #ià +defšed + +__USE_UNIX98 + && !defšed +__USE_GNU + + +876  + #__Ãed_iswxxx + + + ) + +877  + ~ + +881 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +882  + ~ + +885 #ifdeà +__LDBL_COMPAT + + +886  + ~ + +889 +__END_DECLS + + +897 #undeà +__Ãed_mb¡©e_t + + +898 #undeà +__Ãed_wšt_t + + + @/usr/include/rpc/netdb.h + +36 #iâdeà +_RPC_NETDB_H + + +37  + #_RPC_NETDB_H + 1 + + ) + +39  + ~<ã©u»s.h +> + +41  + #__Ãed_size_t + + + ) + +42  + ~<¡ddef.h +> + +44 +__BEGIN_DECLS + + +46  + s½ûÁ + + +48 * + mr_Çme +; + +49 ** + mr_®Ÿ£s +; + +50  + mr_numb” +; + +53  + $£ŒpûÁ + ( +__¡ayݒ +è +__THROW +; + +54  + $’d½ûÁ + (è +__THROW +; + +55  +½ûÁ + * + $g‘½cbyÇme + ( +__cÚ¡ + * +__Çme +è +__THROW +; + +56  +½ûÁ + * + $g‘½cbynumb” + ( +__numb” +è +__THROW +; + +57  +½ûÁ + * + $g‘½ûÁ + (è +__THROW +; + +59 #ifdeà +__USE_MISC + + +60  + $g‘½cbyÇme_r + ( +__cÚ¡ + * +__Çme +,  +½ûÁ + * +__»suÉ_buf +, + +61 * +__bufãr +, +size_t + +__buæ’ +, + +62  +½ûÁ + ** +__»suÉ +è +__THROW +; + +64  + $g‘½cbynumb”_r + ( +__numb” +,  +½ûÁ + * +__»suÉ_buf +, + +65 * +__bufãr +, +size_t + +__buæ’ +, + +66  +½ûÁ + ** +__»suÉ +è +__THROW +; + +68  + $g‘½ûÁ_r + ( +½ûÁ + * +__»suÉ_buf +, * +__bufãr +, + +69 +size_t + +__buæ’ +,  +½ûÁ + ** +__»suÉ +è +__THROW +; + +72 +__END_DECLS + + + @/usr/include/wctype.h + +24 #iâdeà +_WCTYPE_H + + +26  + ~<ã©u»s.h +> + +27  + ~ + +29 #iâdeà +__Ãed_iswxxx + + +30  + #_WCTYPE_H + 1 + + ) + +33  + #__Ãed_wšt_t + + + ) + +34  + ~ + +38 #iâdeà +WEOF + + +39  + #WEOF + (0xffffffffu) + + ) + +42 #undeà +__Ãed_iswxxx + + +47 #iâdeà +__iswxxx_defšed + + +48  + #__iswxxx_defšed + 1 + + ) + +50 +__BEGIN_NAMESPACE_C99 + + +53  + twùy³_t +; + +54 + g__END_NAMESPACE_C99 + + +56 #iâdeà +_ISwb™ + + +61  + ~<’dŸn.h +> + +62 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +63  + #_ISwb™ +( +b™ +è(1 << (b™)) + + ) + +65  + #_ISwb™ +( +b™ +) \ + +66 (( +b™ +) < 8 ? () ((1UL << (bit)) << 24) \ + +67 : (( +b™ +) < 16 ? () ((1UL << (bit)) << 8) \ + +68 : (( +b™ +) < 24 ? () ((1UL << (bit)) >> 8) \ + +69 : (è((1UL << ( +b™ +)è>> 24)))) + + ) + +74 + m__ISwuµ” + = 0, + +75 + m__ISwlow” + = 1, + +76 + m__ISw®pha + = 2, + +77 + m__ISwdig™ + = 3, + +78 + m__ISwxdig™ + = 4, + +79 + m__ISw¥aû + = 5, + +80 + m__ISw´št + = 6, + +81 + m__ISwg¿ph + = 7, + +82 + m__ISwbÏnk + = 8, + +83 + m__ISwúŒl + = 9, + +84 + m__ISwpunù + = 10, + +85 + m__ISw®num + = 11, + +87 + m_ISwuµ” + = +_ISwb™ + ( +__ISwuµ” +), + +88 + m_ISwlow” + = +_ISwb™ + ( +__ISwlow” +), + +89 + m_ISw®pha + = +_ISwb™ + ( +__ISw®pha +), + +90 + m_ISwdig™ + = +_ISwb™ + ( +__ISwdig™ +), + +91 + m_ISwxdig™ + = +_ISwb™ + ( +__ISwxdig™ +), + +92 + m_ISw¥aû + = +_ISwb™ + ( +__ISw¥aû +), + +93 + m_ISw´št + = +_ISwb™ + ( +__ISw´št +), + +94 + m_ISwg¿ph + = +_ISwb™ + ( +__ISwg¿ph +), + +95 + m_ISwbÏnk + = +_ISwb™ + ( +__ISwbÏnk +), + +96 + m_ISwúŒl + = +_ISwb™ + ( +__ISwúŒl +), + +97 + m_ISwpunù + = +_ISwb™ + ( +__ISwpunù +), + +98 + m_ISw®num + = +_ISwb™ + ( +__ISw®num +) + +103 +__BEGIN_DECLS + + +105 +__BEGIN_NAMESPACE_C99 + + +112  + $isw®num + ( +wšt_t + +__wc +è +__THROW +; + +118  + $isw®pha + ( +wšt_t + +__wc +è +__THROW +; + +121  + $iswúŒl + ( +wšt_t + +__wc +è +__THROW +; + +125  + $iswdig™ + ( +wšt_t + +__wc +è +__THROW +; + +129  + $iswg¿ph + ( +wšt_t + +__wc +è +__THROW +; + +134  + $iswlow” + ( +wšt_t + +__wc +è +__THROW +; + +137  + $isw´št + ( +wšt_t + +__wc +è +__THROW +; + +142  + $iswpunù + ( +wšt_t + +__wc +è +__THROW +; + +147  + $isw¥aû + ( +wšt_t + +__wc +è +__THROW +; + +152  + $iswuµ” + ( +wšt_t + +__wc +è +__THROW +; + +157  + $iswxdig™ + ( +wšt_t + +__wc +è +__THROW +; + +162 #ifdeà +__USE_ISOC99 + + +163  + $iswbÏnk + ( +wšt_t + +__wc +è +__THROW +; + +172 +wùy³_t + + $wùy³ + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +176  + $iswùy³ + ( +wšt_t + +__wc +, +wùy³_t + +__desc +è +__THROW +; + +177 +__END_NAMESPACE_C99 + + +184 +__BEGIN_NAMESPACE_C99 + + +187  +__cÚ¡ + + t__št32_t + * + twù¿ns_t +; + +188 +__END_NAMESPACE_C99 + + +189 #ifdeà +__USE_GNU + + +190 + $__USING_NAMESPACE_C99 +( +wù¿ns_t +) + +193 +__BEGIN_NAMESPACE_C99 + + +195 +wšt_t + + $towlow” + ( +wšt_t + +__wc +è +__THROW +; + +198 +wšt_t + + $towuµ” + ( +wšt_t + +__wc +è +__THROW +; + +199 +__END_NAMESPACE_C99 + + +201 +__END_DECLS + + +208 #ifdeà +_WCTYPE_H + + +214 +__BEGIN_DECLS + + +216 +__BEGIN_NAMESPACE_C99 + + +219 +wù¿ns_t + + $wù¿ns + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +222 +wšt_t + + $towù¿ns + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +è +__THROW +; + +223 +__END_NAMESPACE_C99 + + +225 #ifdeà +__USE_XOPEN2K8 + + +227  + ~ + +231  + $isw®num_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +237  + $isw®pha_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +240  + $iswúŒl_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +244  + $iswdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +248  + $iswg¿ph_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +253  + $iswlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +256  + $isw´št_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +261  + $iswpunù_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +266  + $isw¥aû_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +271  + $iswuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +276  + $iswxdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +281  + $iswbÏnk_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +285 +wùy³_t + + $wùy³_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +286 +__THROW +; + +290  + $iswùy³_l + ( +wšt_t + +__wc +, +wùy³_t + +__desc +, +__loÿË_t + +__loÿË +) + +291 +__THROW +; + +299 +wšt_t + + $towlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +302 +wšt_t + + $towuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +306 +wù¿ns_t + + $wù¿ns_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +307 +__THROW +; + +310 +wšt_t + + $towù¿ns_l + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +, + +311 +__loÿË_t + +__loÿË +è +__THROW +; + +315 +__END_DECLS + + + @ +1 +. +1 +/usr/include +192 +3451 +Descriptors.c +Descriptors.h +DualVirtualSerial.c +DualVirtualSerial.h +autoconf.h +aversive.h +callout.c +callout.h +cirbuf.c +cirbuf.h +cirbuf_add_buf_head.c +cirbuf_add_buf_tail.c +cirbuf_add_head.c +cirbuf_add_tail.c +cirbuf_align.c +cirbuf_del_buf_head.c +cirbuf_del_buf_tail.c +cirbuf_del_head.c +cirbuf_del_tail.c +cirbuf_get_buf_head.c +cirbuf_get_buf_tail.c +cirbuf_get_head.c +cirbuf_get_tail.c +clock_time.h +cmdline.c +cmdline.h +commands.c +commands2.c +commands_gen.c +diag_host.c +diagnostic.h +diagnostic_config.h +error.c +error.h +error_config.h +general_errors.h +i2c_config.h +int_show.c +main.c +main.h +parse.c +parse.h +parse_atcmd.c +parse_atcmd.h +parse_monitor.c +parse_monitor.h +parse_neighbor.c +parse_neighbor.h +parse_num.c +parse_num.h +parse_string.c +parse_string.h +pid_config.h +rdline.c +rdline.h +rdline_config.h +scheduler.c +scheduler.h +scheduler_add.c +scheduler_config.h +scheduler_del.c +scheduler_dump.c +scheduler_host.c +scheduler_interrupt.c +scheduler_private.h +scheduler_stats.c +scheduler_stats.h +spi_config.h +stack_space.c +stackdump.c +stackdump.h +time.c +time_config.h +timer.h +timer0_getset.c +timer0_prescaler.c +timer0_register_OC_at_tics.c +timer0_register_OC_in_us.c +timer0_register_OV.c +timer0_startstop.c +timer1_getset.c +timer1_prescaler.c +timer1_register_OC_at_tics.c +timer1_register_OC_in_us.c +timer1_register_OV.c +timer1_startstop.c +timer2_getset.c +timer2_prescaler.c +timer2_register_OC_at_tics.c +timer2_register_OC_in_us.c +timer2_register_OV.c +timer2_startstop.c +timer3_getset.c +timer3_prescaler.c +timer3_register_OC_at_tics.c +timer3_register_OC_in_us.c +timer3_register_OV.c +timer3_startstop.c +timer4_getset.c +timer4_prescaler.c +timer4_register_OC_at_tics.c +timer4_register_OC_in_us.c +timer4_register_OV.c +timer4_startstop.c +timer5_getset.c +timer5_prescaler.c +timer5_register_OC_at_tics.c +timer5_register_OC_in_us.c +timer5_register_OV.c +timer5_startstop.c +timer_conf_check.c +timer_config.h +timer_declarations.h +timer_definitions.h +timer_host.c +timer_init.c +timer_intr.c +timer_intr.h +timer_prescaler.h +uart.c +uart.h +uart_config.h +uart_defs.h +uart_dev_io.c +uart_errors.h +uart_events.c +uart_getconf.c +uart_host.c +uart_host.h +uart_private.h +uart_recv.c +uart_recv9.c +uart_recv9_nowait.c +uart_recv_nowait.c +uart_send.c +uart_send9.c +uart_send9_nowait.c +uart_send_nowait.c +uart_setconf.c +vt100.c +vt100.h +xbee.c +xbee.h +xbee_atcmd.c +xbee_atcmd.h +xbee_buf.c +xbee_buf.h +xbee_neighbor.c +xbee_neighbor.h +xbee_proto.c +xbee_proto.h +xbee_stats.c +xbee_stats.h +/usr/include/arpa/inet.h +/usr/include/ctype.h +/usr/include/errno.h +/usr/include/event.h +/usr/include/fcntl.h +/usr/include/inttypes.h +/usr/include/stdint.h +/usr/include/stdio.h +/usr/include/stdlib.h +/usr/include/string.h +/usr/include/unistd.h +/usr/include/alloca.h +/usr/include/endian.h +/usr/include/event2/buffer.h +/usr/include/event2/buffer_compat.h +/usr/include/event2/bufferevent.h +/usr/include/event2/bufferevent_compat.h +/usr/include/event2/bufferevent_struct.h +/usr/include/event2/event-config.h +/usr/include/event2/event.h +/usr/include/event2/event_compat.h +/usr/include/event2/event_struct.h +/usr/include/event2/tag.h +/usr/include/event2/tag_compat.h +/usr/include/evutil.h +/usr/include/features.h +/usr/include/getopt.h +/usr/include/libio.h +/usr/include/netinet/in.h +/usr/include/time.h +/usr/include/xlocale.h +/usr/include/_G_config.h +/usr/include/event2/keyvalq_struct.h +/usr/include/event2/util.h +/usr/include/gconv.h +/usr/include/netdb.h +/usr/include/wchar.h +/usr/include/rpc/netdb.h +/usr/include/wctype.h diff --git a/diag_host.c b/diag_host.c new file mode 100644 index 0000000..40a8c17 --- /dev/null +++ b/diag_host.c @@ -0,0 +1 @@ +/* empty */ diff --git a/diagnostic.h b/diagnostic.h new file mode 100644 index 0000000..9d40f23 --- /dev/null +++ b/diagnostic.h @@ -0,0 +1,43 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: diagnostic.h,v 1.6.4.2 2008-05-09 08:23:52 zer0 Exp $ + * + */ + +#include + + + +/** shows the interrupt cycles on an oscilloscope or a multimeter you + * can then measure the interrupt busy time of your device. this + * function is an infinite loop which has to be the main program, and + * will be interrupted. a port bit is needed as diagnostic interface + * with scope or multimeter. if you use a scope : freezing of the + * oscillation shows interrupt if you use a multimeter : voltage is + * proportionnal to idle time + * 0V >> 0% idle (always busy) + * Vcc/2 >> 100% idle (not interupted) + * be careful, you perhaps need a low pass filter for your voltmeter */ +extern void show_int_loop(void); + +/** This functuion allows to monitor the maximal stack space that was + * used since the last reset (peak value) you can then monitor the + * available space in your ram returns the minimal value of the free + * space left */ +extern uint16_t min_stack_space_available(void); + diff --git a/diagnostic_config.h b/diagnostic_config.h new file mode 100644 index 0000000..9d9c3a5 --- /dev/null +++ b/diagnostic_config.h @@ -0,0 +1,44 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: diagnostic_config.h,v 1.1 2009-02-27 22:23:37 zer0 Exp $ + * + */ + +#ifndef _DEBUG_CONFIG_ +#define _DEBUG_CONFIG_ 1.0 // version + + +/** port line definition for the show_int_loop() function */ +/* undefine it to disable this functionnality */ +#define INTERRUPT_SHOW_PORT PORTA +#define INTERRUPT_SHOW_BIT 3 + + + +/** memory mark for the min_stack_space_available() function + the ram is filled with this value after a reset ! */ +#define MARK 0x55 + +/** the mark is inserted in whole RAM if this is enabled + (could lead to problems if you need to hold values through a reset...) + so it's better to disable it. + stack counting is not affected */ +//#define DIAG_FILL_ENTIRE_RAM + + +#endif //_DEBUG_CONFIG_ diff --git a/error.c b/error.c new file mode 100644 index 0000000..c2cf970 --- /dev/null +++ b/error.c @@ -0,0 +1,110 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error.c,v 1.10.4.3 2007-12-31 16:25:00 zer0 Exp $ + * + */ + + +#include + +#ifndef HOST_VERSION +#include +#endif + +#include +#include + +struct error_fct g_error_fct; + +/** All fcts pointers to NULL */ +void error_init(void) +{ + uint8_t flags; + IRQ_LOCK(flags); + memset(&g_error_fct, 0, sizeof(g_error_fct)); + IRQ_UNLOCK(flags); +} + + +struct error error_generate(uint8_t num, uint8_t severity, PGM_P t, + PGM_P f, uint16_t l) { + struct error e; + + e.err_num = num; + e.severity = severity; +#ifdef ERROR_DUMP_TEXTLOG + e.text = t; +#else + e.text = PSTR(""); +#endif +#ifdef ERROR_DUMP_FILE_LINE + e.file = f; + e.line = l; +#else + e.file = PSTR(""); + e.line = 0; +#endif + return e; +} + + +/** Register log function for EMERG level */ +void error_register_emerg(void (*f)(struct error *, ...)) +{ + uint8_t flags; + IRQ_LOCK(flags); + g_error_fct.emerg = f; + IRQ_UNLOCK(flags); +} + +/** Register log function for ERROR level */ +void error_register_error(void (*f)(struct error *, ...)) +{ + uint8_t flags; + IRQ_LOCK(flags); + g_error_fct.error = f; + IRQ_UNLOCK(flags); +} + +/** Register log function for WARNING level */ +void error_register_warning(void (*f)(struct error *, ...)) +{ + uint8_t flags; + IRQ_LOCK(flags); + g_error_fct.warning = f; + IRQ_UNLOCK(flags); +} + +/** Register log function for NOTICE level */ +void error_register_notice(void (*f)(struct error *, ...)) +{ + uint8_t flags; + IRQ_LOCK(flags); + g_error_fct.notice = f; + IRQ_UNLOCK(flags); +} + +/** Register log function for DEBUG level */ +void error_register_debug(void (*f)(struct error *, ...)) +{ + uint8_t flags; + IRQ_LOCK(flags); + g_error_fct.debug = f; + IRQ_UNLOCK(flags); +} + diff --git a/error.h b/error.h new file mode 100644 index 0000000..b5e9074 --- /dev/null +++ b/error.h @@ -0,0 +1,140 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error.h,v 1.11.4.3 2007-12-31 16:25:00 zer0 Exp $ + * + */ + +#ifndef _ERROR_H_ +#define _ERROR_H_ + +#ifndef _AVERSIVE_ERROR_H_ +#error "Don't include , include instead" +#endif + +#include +#include +#include + +#include "error_config.h" + +#define ERROR_SEVERITY_EMERG 0 +#define ERROR_SEVERITY_ERROR 1 +#define ERROR_SEVERITY_WARNING 2 +#define ERROR_SEVERITY_NOTICE 3 +#define ERROR_SEVERITY_DEBUG 4 + +/** The error structure, which is given as a parameter in log funcs */ +struct error { + uint8_t err_num; + uint8_t severity; + PGM_P text; + PGM_P file; + uint16_t line; +}; + + +struct error_fct { + void (*emerg)(struct error *, ...); + void (*error)(struct error *, ...); + void (*warning)(struct error *, ...); + void (*notice)(struct error *, ...); + void (*debug)(struct error *, ...); +} ; + +extern struct error_fct g_error_fct; + + +struct error error_generate(uint8_t num, uint8_t severity, PGM_P t, PGM_P f, uint16_t l); + +/** Register log function for EMERG level */ +void error_register_emerg(void (*f)(struct error *, ...)); + +/** Register log function for ERROR level */ +void error_register_error(void (*f)(struct error *, ...)); + +/** Register log function for WARNING level */ +void error_register_warning(void (*f)(struct error *, ...)); + +/** Register log function for NOTICE level */ +void error_register_notice(void (*f)(struct error *, ...)); + +/** Register log function for DEBUG level */ +void error_register_debug(void (*f)(struct error *, ...)); + + + + +/** Call this macro to log EMERG events */ +#define EMERG(num, text, ...) do { \ + if(g_error_fct.emerg) { \ + struct error e = error_generate(num, ERROR_SEVERITY_EMERG, \ + PSTR(text), \ + PSTR(__FILE__),\ + __LINE__); \ + g_error_fct.emerg(&e, ##__VA_ARGS__); \ + } \ +} while(0) + +/** Call this macro to log ERROR events */ +#define ERROR(num, text, ...) do { \ + if(g_error_fct.error) { \ + struct error e = error_generate(num, ERROR_SEVERITY_ERROR, \ + PSTR(text), \ + PSTR(__FILE__),\ + __LINE__); \ + g_error_fct.error(&e, ##__VA_ARGS__); \ + } \ +} while(0) + +/** Call this macro to log WARNING events */ +#define WARNING(num, text, ...) do { \ + if(g_error_fct.warning) { \ + struct error e = error_generate(num, ERROR_SEVERITY_WARNING, \ + PSTR(text), \ + PSTR(__FILE__),\ + __LINE__); \ + g_error_fct.warning(&e, ##__VA_ARGS__); \ + } \ +} while(0) + +/** Call this macro to log NOTICE events */ +#define NOTICE(num, text, ...) do { \ + if(g_error_fct.notice) { \ + struct error e = error_generate(num, ERROR_SEVERITY_NOTICE, \ + PSTR(text), \ + PSTR(__FILE__),\ + __LINE__); \ + g_error_fct.notice(&e, ##__VA_ARGS__); \ + } \ +} while(0) + +/** Call this macro to log DEBUG events */ +#define DEBUG(num, text, ...) do { \ + if(g_error_fct.debug) { \ + struct error e = error_generate(num, ERROR_SEVERITY_DEBUG, \ + PSTR(text), \ + PSTR(__FILE__),\ + __LINE__); \ + g_error_fct.debug(&e, ##__VA_ARGS__); \ + } \ +} while(0) + + + + +#endif /* _ERROR_H_ */ diff --git a/error_config.h b/error_config.h new file mode 100644 index 0000000..7aad86a --- /dev/null +++ b/error_config.h @@ -0,0 +1,31 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error_config.h,v 1.1 2009-02-27 22:23:37 zer0 Exp $ + * + */ + +#ifndef _ERROR_CONFIG_ +#define _ERROR_CONFIG_ + +/** enable the dump of the comment */ +#define ERROR_DUMP_TEXTLOG + +/** enable the dump of filename and line number */ +#define ERROR_DUMP_FILE_LINE + +#endif diff --git a/general_errors.h b/general_errors.h new file mode 100644 index 0000000..96e7173 --- /dev/null +++ b/general_errors.h @@ -0,0 +1,80 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: general_errors.h,v 1.5.4.3 2009-01-23 23:54:15 zer0 Exp $ + * + */ + + +/** + * these are general errors. + */ + +/* Not module specific */ + +/* Operation not permitted */ +#define EPERM_COMMENT "Operation not permitted" + +/* No such file or directory */ +#define ENOENT_COMMENT "No such file or directory" + +/* I/O error */ +#define EIO_COMMENT "I/O error" + +/* No such device or address */ +#define ENXIO_COMMENT "No such device or address" + +/* Argument list too long */ +#define E2BIG_COMMENT "Argument list too long" + +/* Try again */ +#define EAGAIN_COMMENT "Try again" + +/* Out of memory */ +#define ENOMEM_COMMENT "Out of memory" + +/* Bad address */ +#define EFAULT_COMMENT "Bad address" + +/* Device or resource busy */ +#define EBUSY_COMMENT "Device or resource busy" + +/* Invalid argument */ +#define EINVAL_COMMENT "Invalid argument" + +/* Unkwow error */ +#define EUNKNOW_COMMENT "Unkwow error" + + +/* Module specific, from 129 to 192 */ + +#define E_UART 129 +#define E_ROBOT_SYSTEM 130 +#define E_MULTISERVO 131 +#define E_TRAJECTORY 132 +#define E_I2C 133 +#define E_BLOCKING_DETECTION_MANAGER 134 +#define E_OA 135 +#define E_SPI 136 +#define E_CC2420 137 +#define E_TIME_EXT 138 + +/* ... etc TBD */ + +/* User specific, from > 192 */ + +/* defined in user app */ diff --git a/i2c_config.h b/i2c_config.h new file mode 100644 index 0000000..1617810 --- /dev/null +++ b/i2c_config.h @@ -0,0 +1,30 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: i2c_config.h,v 1.2 2009-03-05 23:01:32 zer0 Exp $ + * + */ + + +#define I2C_BITRATE 1 // divider dor i2c baudrate, see TWBR in doc +#define I2C_PRESCALER 3 // prescaler config, rate = 2^(n*2) + +/* Size of transmission buffer */ +#define I2C_SEND_BUFFER_SIZE 32 + +/* Size of reception buffer */ +#define I2C_RECV_BUFFER_SIZE 32 diff --git a/int_show.c b/int_show.c new file mode 100644 index 0000000..2fa617d --- /dev/null +++ b/int_show.c @@ -0,0 +1,56 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: int_show.c,v 1.6.10.3 2008-05-09 08:23:52 zer0 Exp $ + * + */ + +#include +#include +#include + + +#ifdef INTERRUPT_SHOW_PORT + +/** this loop is to be used as main program if you have interrupts + * running and want to see how much time is consumed by the + * interrupts. you must then observe the test pin with an + * oscilloscope, or eventually a multimeter. as long as there are no + * interrupts, the test port will toggle at 50% rate. when an + * interrupt occurs, the port stops to toggle, and remain low. the + * space before the next impulsion is the int time (always one toggle + * between ints!) if you look whith a multimeter, the processor free + * time is proportinnal to the observed voltage. 0V corresponds to + * an always busy processor, while if you read Vcc/2 the processor is + * almost always free. */ +void show_int_loop(void) +{ + sbi(DDR(INTERRUPT_SHOW_PORT), INTERRUPT_SHOW_BIT); + + while(1) { + cbi(INTERRUPT_SHOW_PORT, INTERRUPT_SHOW_BIT); // port to 0 + + sei(); + nop(); // ints can only arrive there (on low level of probe pin) + cli(); + + sbi(INTERRUPT_SHOW_PORT, INTERRUPT_SHOW_BIT); // port to 1 + + nop(); // is there to equalize the duty cycle + } +} +#endif diff --git a/main.c b/main.c new file mode 100644 index 0000000..b6014db --- /dev/null +++ b/main.c @@ -0,0 +1,552 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_atcmd.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" +#include "cmdline.h" +#include "callout.h" +#include "rc_proto.h" +#include "main.h" + +struct xbeeboard xbeeboard; + +#define TIMEOUT_MS 1000 + +/* global xbee device */ +struct xbee_dev *xbee_dev; + +/* events */ +//static struct event stdin_read_event, xbee_read_event; + +/* parameters */ +int xbee_raw = 0; +int xbee_hexdump = 0; +int xbee_debug = 0; + +int xbee_cmdline_input_enabled = 1; + +static struct xbee_ctx xbee_ctx[XBEE_MAX_CHANNEL]; + +static void hexdump(const char *title, const void *buf, unsigned int len) +{ + unsigned int i, out, ofs; + const unsigned char *data = buf; +#define LINE_LEN 80 + char line[LINE_LEN]; /* space needed 8+16*3+3+16 == 75 */ + + printf("%s at [%p], len=%d\n", title, data, len); + ofs = 0; + while (ofs < len) { + /* format 1 line in the buffer, then use printk to print them */ + out = snprintf(line, LINE_LEN, "%08X", ofs); + for (i=0; ofs+i < len && i<16; i++) + out += snprintf(line+out, LINE_LEN - out, " %02X", + data[ofs+i]&0xff); + for (;i<=16;i++) + out += snprintf(line+out, LINE_LEN - out, " "); + for (i=0; ofs < len && i<16; i++, ofs++) { + unsigned char c = data[ofs]; + if (!isascii(c) || !isprint(c)) + c = '.'; + out += snprintf(line+out, LINE_LEN - out, "%c", c); + } + printf("%s\n", line); + } +} + +static int parse_xmit_status(struct xbee_ctx *ctx, + struct xbee_xmit_status_hdr *frame, unsigned len) +{ + if (ctx == NULL) { + printf("no context\n"); + return -1; + } + + /* see if it matches a xmit query (atcmd_query must be NULL) */ + if (ctx->atcmd_query[0] == '\0') { + printf("invalid response 2\n"); + return -1; + } + + /* XXX use defines for these values */ + if (frame->delivery_status == 0x00) + printf("Success\n"); + else if (frame->delivery_status == 0x01) + printf("MAC ACK Failure\n"); + else if (frame->delivery_status == 0x15) + printf("Invalid destination endpoint\n"); + else if (frame->delivery_status == 0x21) + printf("Network ACK Failure\n"); + else if (frame->delivery_status == 0x25) + printf("Route Not Found\n"); + + return 0; +} + +static int dump_atcmd(struct xbee_ctx *ctx, struct xbee_atresp_hdr *frame, + unsigned len) +{ + char atcmd_str[3]; + struct xbee_atcmd_pgm *cmd_pgm; + struct xbee_atcmd cmd; + union { + uint8_t u8; + uint16_t u16; + uint32_t u32; + int16_t s16; + } __attribute__((packed)) *result; + + if (ctx == NULL) { + printf("no context\n"); + return -1; + } + + /* get AT command from frame */ + memcpy(atcmd_str, &frame->cmd, 2); + atcmd_str[2] = '\0'; + + /* see if it matches query */ + if (memcmp(atcmd_str, ctx->atcmd_query, 2)) { + printf("invalid response <%c%c><%s><%s>\n", + frame->cmd & 0xFF, + (frame->cmd >> 8) & 0xFF, + atcmd_str, ctx->atcmd_query); + return -1; + } + + /* see if it exists */ + cmd_pgm = xbee_atcmd_lookup_name(atcmd_str); + if (cmd_pgm == NULL) { + printf("unknown response\n"); + return -1; + } + memcpy_P(&cmd, cmd_pgm, sizeof(cmd)); + + /* bad status */ + if (frame->status == 1) { + printf("Status is error\n"); + return -1; + } + else if (frame->status == 2) { + printf("Invalid command\n"); + return -1; + } + else if (frame->status == 3) { + printf("Invalid parameter\n"); + return -1; + } + else if (frame->status != 0) { + printf("Unknown status error %d\n", frame->status); + return -1; + } + + /* callback */ + if (ctx->func != NULL) + ctx->func(frame, len, ctx->arg); + + /* dump frame */ + result = (void *)frame->data; + len -= offsetof(struct xbee_atresp_hdr, data); + if (cmd.flags & XBEE_ATCMD_F_PARAM_U8 && len == sizeof(uint8_t)) + printf("<%s> is 0x%x\n", atcmd_str, result->u8); + else if (cmd.flags & XBEE_ATCMD_F_PARAM_U16 && len == sizeof(uint16_t)) + printf("<%s> is 0x%x\n", atcmd_str, ntohs(result->u16)); + else if (cmd.flags & XBEE_ATCMD_F_PARAM_U32 && len == sizeof(uint32_t)) + printf("<%s> is 0x%"PRIx32"\n", atcmd_str, ntohl(result->u32)); + else if (cmd.flags & XBEE_ATCMD_F_PARAM_S16 && len == sizeof(int16_t)) + printf("<%s> is %d\n", atcmd_str, ntohs(result->s16)); + else if (len == 0) + printf("no data, status ok\n"); + else + hexdump("atcmd answer", frame->data, len); + + + return 0; +} + + +int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len) +{ + int datalen = len - sizeof(*recvframe); + struct rc_proto_hdr *rch = (struct rc_proto_hdr *) recvframe; + + if (datalen < sizeof(struct rc_proto_hdr)) + return -1; + + switch (rch->type) { + case RC_PROTO_TYPE_CHANNEL: + if (datalen != sizeof(struct rc_proto_channel)) + return -1; + break; + case RC_PROTO_TYPE_RANGE: { + struct rc_proto_range *rcr = + (struct rc_proto_range *) recvframe; + + if (datalen != sizeof(struct rc_proto_range)) + return -1; + + if (rcr->power_level >= MAX_POWER_LEVEL) + return -1; + + rc_proto_rx_range(rcr->power_level); + + break; + } + default: + return -1; + } + + return 0; +} + +/* socat /dev/ttyUSB0,raw,echo=0,b115200 /dev/ttyACM1,raw,echo=0,b115200 */ +void xbee_rx(struct xbee_dev *dev, int channel, int type, + void *frame, unsigned len, void *opaque) +{ + struct xbee_ctx *ctx = opaque; + int do_hexdump = xbee_hexdump; + + if (xbee_debug) + printf("type=0x%x, channel=%d, ctx=%p\n", type, channel, ctx); + + /* if ctx is !NULL, it is an answer to a query */ + if (ctx != NULL) { + /* XXX only delete timeout if answer matched */ + xbee_unload_timeout(ctx); + if (xbee_debug && ctx->atcmd_query) + printf("Received answer to query <%c%c>\n", + ctx->atcmd_query[0], ctx->atcmd_query[1]); + } + + /* some additional checks before sending */ + switch (type) { + case XBEE_TYPE_MODEM_STATUS: { + printf("Received Modem Status frame\n"); + break; + } + + case XBEE_TYPE_RMT_ATRESP: { + union { + uint64_t u64; + struct { +#if BYTE_ORDER == LITTLE_ENDIAN + uint32_t low; + uint32_t high; +#else + uint32_t high; + uint32_t low; +#endif + } u32; + } addr; + memcpy(&addr, frame, sizeof(addr)); + addr.u64 = ntohll(addr.u64); + printf("from remote address %"PRIx32"%"PRIx32"\n", + addr.u32.high, addr.u32.low); + + /* this answer contains an atcmd answer at offset 10 */ + if (dump_atcmd(ctx, frame + 10, len - 10) < 0) + do_hexdump = 1; + break; + } + case XBEE_TYPE_ATRESP: { + if (dump_atcmd(ctx, frame, len) < 0) + do_hexdump = 1; + break; + } + + case XBEE_TYPE_XMIT_STATUS: { + if (parse_xmit_status(ctx, frame, len) < 0) + do_hexdump = 1; + break; + } + + case XBEE_TYPE_RECV: { + if (xbee_recv_data(frame, len) < 0) + do_hexdump = 1; + break; + } + + case XBEE_TYPE_ATCMD: + case XBEE_TYPE_ATCMD_Q: + case XBEE_TYPE_XMIT: + case XBEE_TYPE_EXPL_XMIT: + case XBEE_TYPE_RMT_ATCMD: + case XBEE_TYPE_EXPL_RECV: + case XBEE_TYPE_NODE_ID: + default: + printf("Invalid frame\n"); + do_hexdump = 1; + break; + } + + if (do_hexdump) + hexdump("undecoded rx frame", frame, len); + + /* restart command line if it was a blocking query */ + if (ctx != NULL) { + xbee_unregister_channel(dev, channel); + if (ctx->foreground) { + xbee_stdin_enable(); + rdline_newline(&xbeeboard.rdl, xbeeboard.prompt); + } + } +} + +static int xbeeapp_send(struct xbee_ctx *ctx, int type, void *buf, unsigned len, + int foreground) +{ + int ret; + int channel; + + if (len > XBEE_MAX_FRAME_LEN) { + printf("frame too large\n"); + return -1; + } + + /* register a channel */ + channel = xbee_register_channel(xbee_dev, XBEE_CHANNEL_ANY, + xbee_rx, NULL); + if (channel < 0) { + printf("cannot send: no free channel\n"); + return -1; + } + + /* copy context in the static struct table (avoiding a malloc) */ + memcpy(&xbee_ctx[channel], ctx, sizeof(*ctx)); + ctx = &xbee_ctx[channel]; + xbee_set_opaque(xbee_dev, channel, ctx); + + if (xbee_debug) + printf("send frame channel=%d type=0x%x len=%d\n", + channel, type, len); + if (xbee_hexdump) + hexdump("xmit frame", buf, len); + + /* transmit the frame on this channel */ + ret = xbee_proto_xmit(xbee_dev, channel, type, buf, + len); + if (ret < 0) { + printf("cannot send\n"); + xbee_unregister_channel(xbee_dev, channel); + return -1; + } + + ctx->channel = channel; + xbee_load_timeout(ctx); /* load a timeout event */ + + /* suspend command line until we have answer or timeout */ + if (foreground) { + ctx->foreground = 1; + rdline_stop(&xbeeboard.rdl); /* don't display prompt when return */ + xbee_stdin_disable(); /* unload file descriptor polling */ + } + + return 0; +} + +/* send an AT command with parameters filled by caller. Disable + * command line until we get the answer or until a timeout occurs */ +int xbeeapp_send_atcmd(const char *atcmd_str, + void *param, unsigned param_len, int foreground, + int (*func)(void *frame, unsigned len, void *arg), void *arg) +{ + struct xbee_ctx ctx; + struct { + struct xbee_atcmd_hdr atcmd; + char buf[XBEE_MAX_FRAME_LEN]; + } __attribute__((packed)) frame; + + memset(&ctx, 0, sizeof(ctx)); + ctx.atcmd_query[0] = atcmd_str[0]; + ctx.atcmd_query[1] = atcmd_str[1]; + ctx.func = func; + ctx.arg = arg; + + memcpy(&frame.atcmd.cmd, atcmd_str, 2); + memcpy(&frame.buf, param, param_len); + + if (xbeeapp_send(&ctx, XBEE_TYPE_ATCMD, &frame, + sizeof(struct xbee_atcmd_hdr) + + param_len, foreground) < 0) { + return -1; + } + + return 0; +} + +int xbeeapp_send_msg(uint64_t addr, void *data, + unsigned data_len, int foreground) +{ + struct xbee_ctx ctx; + struct { + struct xbee_xmit_hdr xmit; + char buf[XBEE_MAX_FRAME_LEN]; + } __attribute__((packed)) frame; + + memset(&ctx, 0, sizeof(ctx)); + ctx.atcmd_query[0] = '\0'; + + frame.xmit.dstaddr = htonll(addr); + frame.xmit.reserved = htons(0xFFFE); + frame.xmit.bcast_radius = 0; + frame.xmit.opts = 0; + memcpy(&frame.buf, data, data_len); + + if (xbeeapp_send(&ctx, XBEE_TYPE_XMIT, &frame, + sizeof(struct xbee_xmit_hdr) + + data_len, foreground) < 0) { + return -1; + } + + return 0; +} + +void xbee_stdin_enable(void) +{ + xbee_cmdline_input_enabled = 1; +} + +void xbee_stdin_disable(void) +{ + xbee_cmdline_input_enabled = 0; +} + +static void evt_timeout(struct callout_manager *cm, struct callout *clt, + void *arg) +{ + struct xbee_ctx *ctx = arg; + + printf("Timeout\n"); + + /* restart command line */ + xbee_stdin_enable(); + rdline_newline(&xbeeboard.rdl, xbeeboard.prompt); + + /* free event */ + xbee_unregister_channel(xbee_dev, ctx->channel); +} + +void xbee_load_timeout(struct xbee_ctx *ctx) +{ + callout_reset(&cm, &ctx->timeout, TIMEOUT_MS, SINGLE, evt_timeout, ctx); +} + +void xbee_unload_timeout(struct xbee_ctx *ctx) +{ + callout_stop(&cm, &ctx->timeout); +} + +void bootloader(void) +{ +#define BOOTLOADER_ADDR 0x1e000 + if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) { + printf_P(PSTR("Bootloader is not present\r\n")); + return; + } + cli(); + /* ... very specific :( */ + EIMSK = 0; + SPCR = 0; + TWCR = 0; + ACSR = 0; + ADCSRA = 0; + + __asm__ __volatile__ ("ldi r31,0xf0\n"); + __asm__ __volatile__ ("ldi r30,0x00\n"); + __asm__ __volatile__ ("ijmp\n"); + + /* never returns */ +} + +void xbee_mainloop(void) +{ + while (1) { + callout_manage(&cm); + + if (xbee_raw) { + int16_t c; + + /* from xbee to cmdline */ + c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface); + if (c >= 0) + CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, + (uint8_t)c); + + /* from cmdline to xbee */ + c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + if (c == 4) { /* CTRL-d */ + xbee_raw = 0; + rdline_newline(&xbeeboard.rdl, + xbeeboard.prompt); + } + else if (c >= 0) { + /* send to xbee */ + CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, + (uint8_t)c); + /* echo on cmdline */ + CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, + (uint8_t)c); + } + } + else { + if (xbee_cmdline_input_enabled) + cmdline_poll(); + xbee_proto_rx(xbee_dev); + } + + CDC_Device_USBTask(&VirtualSerial1_CDC_Interface); + CDC_Device_USBTask(&VirtualSerial2_CDC_Interface); + USB_USBTask(); + } +} diff --git a/main.h b/main.h new file mode 100644 index 0000000..4ed5259 --- /dev/null +++ b/main.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define NB_LOGS 4 + +/** ERROR NUMS */ +#define E_USER_DEFAULT 194 + +#define LED1_ON() sbi(PORTE, 2) +#define LED1_OFF() cbi(PORTE, 2) + +#define LED2_ON() sbi(PORTE, 3) +#define LED2_OFF() cbi(PORTE, 3) + +#define LED3_ON() sbi(PORTB, 3) +#define LED3_OFF() cbi(PORTB, 3) + +#define LED4_ON() sbi(PORTB, 4) +#define LED4_OFF() cbi(PORTB, 4) + +#define LED_PRIO 170 +#define TIME_PRIO 160 + +#define MAX_POWER_LEVEL 5 +/* generic to all boards */ +struct xbeeboard { + /* command line interface */ + struct rdline rdl; + char prompt[RDLINE_PROMPT_SIZE]; + + /* log */ + uint8_t logs[NB_LOGS+1]; + uint8_t log_level; + uint8_t debug; +}; +extern struct xbeeboard xbeeboard; + + +/* used for timeouts and xbee rx callback */ +struct xbee_ctx { + int foreground; + int channel; + char atcmd_query[2]; + int (*func)(void *frame, unsigned len, void *arg); + void *arg; + struct callout timeout; +}; + +//extern cmdline_parse_ctx_t main_ctx; +extern struct xbee_dev *xbee_dev; +extern int xbee_raw; +extern int xbee_hexdump; +extern int xbee_debug; + +extern struct callout_manager cm; + + +void bootloader(void); + +void xbee_rx(struct xbee_dev *dev, int channel, int type, + void *frame, unsigned len, void *opaque); +int xbeeapp_send_atcmd(const char *atcmd_str, + void *param, unsigned param_len, int foreground, + int (*func)(void *frame, unsigned len, void *arg), + void *arg); +int xbeeapp_send_msg(uint64_t addr, void *data, + unsigned data_len, int foreground); + +void xbee_stdin_enable(void); +void xbee_stdin_disable(void); + +void xbee_load_timeout(struct xbee_ctx *ctx); +void xbee_unload_timeout(struct xbee_ctx *ctx); + +void xbee_mainloop(void); diff --git a/makefile b/makefile new file mode 100644 index 0000000..5360008 --- /dev/null +++ b/makefile @@ -0,0 +1,823 @@ + +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# >> Modified for use with the LUFA project. << +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# Carlos Lamas +# Dean Camera +# Opendous Inc. +# Denver Gingerich +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make doxygen = Generate DoxyGen documentation for the project (must have +# DoxyGen installed) +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + + +# MCU name +MCU = at90usb1287 + + +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + + +# Target board (see library "Board Types" documentation, NONE for projects not requiring +# LUFA board drivers). If USER is selected, put custom board drivers in a directory called +# "Board" inside the application directory. +BOARD = USBKEY + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 8000000 + + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Target file name (without extension). +TARGET = DualVirtualSerial + + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = . + + +# Path to the LUFA library +LUFA_PATH = ../../../.. + + +# LUFA library compile-time options and predefined tokens +LUFA_OPTS = -D USB_DEVICE_ONLY +LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 +LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 +LUFA_OPTS += -D USE_FLASH_DESCRIPTORS +LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" + + +# Create the LUFA source path variables by including the LUFA root makefile +include $(LUFA_PATH)/LUFA/makefile + + +# List C source files here. (C dependencies are automatically generated.) +SRC = \ + $(TARGET).c \ + Descriptors.c \ + $(LUFA_SRC_USB) \ + $(LUFA_SRC_USBCLASS) \ + cirbuf_add_buf_head.c \ + cirbuf_add_buf_tail.c \ + cirbuf_add_head.c \ + cirbuf_add_tail.c \ + cirbuf_align.c \ + cirbuf.c \ + cirbuf_del_buf_head.c \ + cirbuf_del_buf_tail.c \ + cirbuf_del_head.c \ + cirbuf_del_tail.c \ + cirbuf_get_buf_head.c \ + cirbuf_get_buf_tail.c \ + cirbuf_get_head.c \ + cirbuf_get_tail.c \ + cmdline.c \ + commands.c \ + commands_gen.c \ + Descriptors.c \ + DualVirtualSerial.c \ + main.c \ + rc_proto.c \ + parse.c \ + parse_num.c \ + parse_string.c \ + rdline.c \ + scheduler_add.c \ + scheduler.c \ + scheduler_del.c \ + scheduler_dump.c \ + scheduler_interrupt.c \ + scheduler_stats.c \ + uart.c \ + uart_dev_io.c \ + uart_events.c \ + uart_getconf.c \ + uart_recv.c \ + uart_recv_nowait.c \ + uart_send.c \ + uart_send_nowait.c \ + uart_setconf.c \ + xbee_atcmd.c \ + xbee.c \ + xbee_neighbor.c \ + xbee_proto.c \ + xbee_stats.c \ + vt100.c \ + error.c \ + int_show.c \ + stackdump.c \ + stack_space.c \ + timer0_getset.c \ + timer0_prescaler.c \ + timer0_register_OC_at_tics.c \ + timer0_register_OC_in_us.c \ + timer0_register_OV.c \ + timer0_startstop.c \ + timer1_getset.c \ + timer1_prescaler.c \ + timer1_register_OC_at_tics.c \ + timer1_register_OC_in_us.c \ + timer1_register_OV.c \ + timer1_startstop.c \ + timer2_getset.c \ + timer2_prescaler.c \ + timer2_register_OC_at_tics.c \ + timer2_register_OC_in_us.c \ + timer2_register_OV.c \ + timer2_startstop.c \ + timer3_getset.c \ + timer3_prescaler.c \ + timer3_register_OC_at_tics.c \ + timer3_register_OC_in_us.c \ + timer3_register_OV.c \ + timer3_startstop.c \ + timer4_getset.c \ + timer4_prescaler.c \ + timer4_register_OC_at_tics.c \ + timer4_register_OC_in_us.c \ + timer4_register_OV.c \ + timer4_startstop.c \ + timer5_getset.c \ + timer5_prescaler.c \ + timer5_register_OC_at_tics.c \ + timer5_register_OC_in_us.c \ + timer5_register_OV.c \ + timer5_startstop.c \ + timer_conf_check.c \ + timer_init.c \ + timer_intr.c \ + callout.c \ + parse_neighbor.c \ + parse_atcmd.c \ + parse_monitor.c \ + time.c + +# List C++ source files here. (C dependencies are automatically generated.) +CPPSRC = + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = $(LUFA_PATH)/ + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=c99 + + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL +CDEFS += -DF_USB=$(F_USB)UL +CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) +CDEFS += $(LUFA_OPTS) + + +# Place -D or -U options here for ASM sources +ADEFS = -DF_CPU=$(F_CPU) +ADEFS += -DF_USB=$(F_USB)UL +ADEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) +ADEFS += $(LUFA_OPTS) + +# Place -D or -U options here for C++ sources +CPPDEFS = -DF_CPU=$(F_CPU)UL +CPPDEFS += -DF_USB=$(F_USB)UL +CPPDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH) +CPPDEFS += $(LUFA_OPTS) +#CPPDEFS += -D__STDC_LIMIT_MACROS +#CPPDEFS += -D__STDC_CONSTANT_MACROS + + + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fno-inline-small-functions +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing +CFLAGS += -Wall -Werror +CFLAGS += -Wstrict-prototypes +CFLAGS += -ffreestanding +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -std=gnu99 + + +#---------------- Compiler Options C++ ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CPPFLAGS = -g$(DEBUG) +CPPFLAGS += $(CPPDEFS) +CPPFLAGS += -O$(OPT) +CPPFLAGS += -funsigned-char +CPPFLAGS += -funsigned-bitfields +CPPFLAGS += -fpack-struct +CPPFLAGS += -fshort-enums +CPPFLAGS += -fno-exceptions +CPPFLAGS += -Wall +CPPFLAGS += -Wundef +#CPPFLAGS += -mshort-calls +#CPPFLAGS += -fno-unit-at-a-time +#CPPFLAGS += -Wstrict-prototypes +#CPPFLAGS += -Wunreachable-code +#CPPFLAGS += -Wsign-compare +CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) +CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +#CPPFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# dump that will be displayed for a given single line of source input. +ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + + +#---------------- Programming Options (avrdude) ---------------- + +# Programming hardware +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = jtagmkII + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_COMPILING_CPP = Compiling C++: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + + + + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym +#build: lib + + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf +MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) +FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) + + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + +flip: $(TARGET).hex + batchisp -hardware usb -device $(MCU) -operation erase f + batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + +dfu: $(TARGET).hex + dfu-programmer $(MCU) erase + dfu-programmer $(MCU) flash $(TARGET).hex + dfu-programmer $(MCU) reset + +flip-ee: $(TARGET).hex $(TARGET).eep + $(COPY) $(TARGET).eep $(TARGET)eep.hex + batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase + batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + $(REMOVE) $(TARGET)eep.hex + +dfu-ee: $(TARGET).hex $(TARGET).eep + dfu-programmer $(MCU) eeprom-flash $(TARGET).eep + dfu-programmer $(MCU) reset + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT = $(OBJCOPY) --debugging +COFFCONVERT += --change-section-address .data-0x800000 +COFFCONVERT += --change-section-address .bss-0x800000 +COFFCONVERT += --change-section-address .noinit-0x800000 +COFFCONVERT += --change-section-address .eeprom-0x810000 + + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create object files from C++ source files. +$(OBJDIR)/%.o : %.cpp + @echo + @echo $(MSG_COMPILING_CPP) $< + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C++ source files. +%.s : %.cpp + $(CC) -S $(ALL_CPPFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +$(OBJDIR)/%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRC:.c=.i) + $(REMOVEDIR) .dep + +doxygen: + @echo Generating Project Documentation \($(TARGET)\)... + @doxygen Doxygen.conf + @echo Documentation Generation Complete. + +clean_doxygen: + rm -rf Documentation + +checksource: + @for f in $(SRC) $(CPPSRC) $(ASRC); do \ + if [ -f $$f ]; then \ + echo "Found Source File: $$f" ; \ + else \ + echo "Source File Not Found: $$f" ; \ + fi; done + + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff doxygen clean \ +clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ +debug gdb-config checksource + diff --git a/parse.c b/parse.c new file mode 100644 index 0000000..fc97d64 --- /dev/null +++ b/parse.c @@ -0,0 +1,443 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: parse.c,v 1.1.2.11 2009-04-07 20:00:46 zer0 Exp $ + * + * + */ + +#include +#include +#include +#include + +#include + +#include "parse.h" + +#ifdef HOST_VERSION +#define pgm_read_pgmptr(x) ((void *)(*(x))) +#else +#define pgm_read_pgmptr(x) (void *)pgm_read_word(x) +#endif + +//#define CMDLINE_DEBUG +//#define debug_printf printf +#define debug_printf(args...) do {} while(0) + + +static int +isendofline(char c) +{ + if (c == '\n' || + c == '\r' ) + return 1; + return 0; +} + +static int +iscomment(char c) +{ + if (c == '#') + return 1; + return 0; +} + +int +isendoftoken(char c) +{ + if (!c || iscomment(c) || isblank(c) || isendofline(c)) + return 1; + return 0; +} + +static uint8_t +nb_common_chars(const char * s1, const char * s2) +{ + uint8_t i=0; + + while (*s1==*s2 && *s1 && *s2) { + s1++; + s2++; + i++; + } + return i; +} + +/** + * try to match the buffer with an instruction (only the first + * nb_match_token tokens if != 0). Return 0 if we match all the + * tokens, else the number of matched tokens, else -1. + */ +static int8_t +match_inst(parse_pgm_inst_t *inst, const char * buf, uint8_t nb_match_token, + void * result_buf) +{ + uint8_t token_num=0; + parse_pgm_token_hdr_t * token_p; + uint8_t i=0; + int8_t n = 0; + struct token_hdr token_hdr; + + token_p = (parse_pgm_token_hdr_t *)pgm_read_pgmptr(&inst->tokens[token_num]); + if (token_p) + memcpy_P(&token_hdr, token_p, sizeof(token_hdr)); + + /* check if we match all tokens of inst */ + while (token_p && (!nb_match_token || iparse(token_p, buf, (result_buf ? result_buf+token_hdr.offset : NULL)); + if ( n < 0 ) + break; + debug_printf("TK parsed (len=%d)\n", n); + i++; + buf += n; + + token_num ++; + token_p = (parse_pgm_token_hdr_t *)pgm_read_pgmptr(&inst->tokens[token_num]); + if (token_p) + memcpy_P(&token_hdr, token_p, sizeof(token_hdr)); + } + + /* does not match */ + if (i==0) + return -1; + + /* in case we want to match a specific num of token */ + if (nb_match_token) { + if (i == nb_match_token) { + return 0; + } + return i; + } + + /* we don't match all the tokens */ + if (token_p) { + return i; + } + + /* are there are some tokens more */ + while (isblank(*buf)) { + buf++; + } + + /* end of buf */ + if ( isendofline(*buf) || iscomment(*buf) ) + return 0; + + /* garbage after inst */ + return i; +} + + +int8_t +parse(parse_pgm_ctx_t ctx[], const char * buf) +{ + uint8_t inst_num=0; + parse_pgm_inst_t * inst; + const char * curbuf; + char result_buf[256]; /* XXX align, size zé in broblém */ + void (*f)(void *, void *) = NULL; + void * data = NULL; + int comment = 0; + int linelen = 0; + int parse_it = 0; + int8_t err = PARSE_NOMATCH; + int8_t tok; +#ifdef CMDLINE_DEBUG + char debug_buf[64]; +#endif + + /* + * - look if the buffer contains at least one line + * - look if line contains only spaces or comments + * - count line length + */ + curbuf = buf; + while (! isendofline(*curbuf)) { + if ( *curbuf == '\0' ) { + debug_printf("Incomplete buf (len=%d)\n", linelen); + return 0; + } + if ( iscomment(*curbuf) ) { + comment = 1; + } + if ( ! isblank(*curbuf) && ! comment) { + parse_it = 1; + } + curbuf++; + linelen++; + } + + /* skip all endofline chars */ + while (isendofline(buf[linelen])) { + linelen++; + } + + /* empty line */ + if ( parse_it == 0 ) { + debug_printf("Empty line (len=%d)\n", linelen); + return linelen; + } + +#ifdef CMDLINE_DEBUG + snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf); + debug_printf("Parse line : len=%d, <%s>\n", linelen, debug_buf); +#endif + + /* parse it !! */ + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + while (inst) { + debug_printf("INST\n"); + + /* fully parsed */ + tok = match_inst(inst, buf, 0, result_buf); + + if (tok > 0) /* we matched at least one token */ + err = PARSE_BAD_ARGS; + + else if (!tok) { + debug_printf("INST fully parsed\n"); + /* skip spaces */ + while (isblank(*curbuf)) { + curbuf++; + } + + /* if end of buf -> there is no garbage after inst */ + if (isendofline(*curbuf) || iscomment(*curbuf)) { + if (!f) { + memcpy_P(&f, &inst->f, sizeof(f)); + memcpy_P(&data, &inst->data, sizeof(data)); + } + else { + /* more than 1 inst matches */ + err = PARSE_AMBIGUOUS; + f=NULL; + debug_printf("Ambiguous cmd\n"); + break; + } + } + } + + inst_num ++; + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + } + + /* call func */ + if (f) { + f(result_buf, data); + } + + /* no match */ + else { + debug_printf("No match err=%d\n", err); + return err; + } + + return linelen; +} + +int8_t +complete(parse_pgm_ctx_t ctx[], const char *buf, int16_t *state, + char *dst, uint8_t size) +{ + const char * incomplete_token = buf; + uint8_t inst_num = 0; + parse_pgm_inst_t *inst; + parse_pgm_token_hdr_t *token_p; + struct token_hdr token_hdr; + char tmpbuf[64], completion_buf[64]; + uint8_t incomplete_token_len; + int8_t completion_len = -1; + int8_t nb_token = 0; + uint8_t i, n; + int8_t l; + uint8_t nb_completable; + uint8_t nb_non_completable; + int16_t local_state=0; + prog_char *help_str; + + debug_printf("%s called\n", __FUNCTION__); + /* count the number of complete token to parse */ + for (i=0 ; buf[i] ; i++) { + if (!isblank(buf[i]) && isblank(buf[i+1])) + nb_token++; + if (isblank(buf[i]) && !isblank(buf[i+1])) + incomplete_token = buf+i+1; + } + incomplete_token_len = strlen(incomplete_token); + + /* first call -> do a first pass */ + if (*state <= 0) { + debug_printf("try complete <%s>\n", buf); + debug_printf("there is %d complete tokens, <%s> is incomplete\n", nb_token, incomplete_token); + + nb_completable = 0; + nb_non_completable = 0; + + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + while (inst) { + /* parse the first tokens of the inst */ + if (nb_token && match_inst(inst, buf, nb_token, NULL)) + goto next; + + debug_printf("instruction match \n"); + token_p = (parse_pgm_token_hdr_t *) pgm_read_pgmptr(&inst->tokens[nb_token]); + if (token_p) + memcpy_P(&token_hdr, token_p, sizeof(token_hdr)); + + /* non completable */ + if (!token_p || + !token_hdr.ops->complete_get_nb || + !token_hdr.ops->complete_get_elt || + (n = token_hdr.ops->complete_get_nb(token_p)) == 0) { + nb_non_completable++; + goto next; + } + + debug_printf("%d choices for this token\n", n); + for (i=0 ; icomplete_get_elt(token_p, i, tmpbuf, sizeof(tmpbuf)) < 0) + continue; + strcat_P(tmpbuf, PSTR(" ")); /* we have at least room for one char */ + debug_printf(" choice <%s>\n", tmpbuf); + /* does the completion match the beginning of the word ? */ + if (!strncmp(incomplete_token, tmpbuf, incomplete_token_len)) { + if (completion_len == -1) { + strcpy(completion_buf, tmpbuf+incomplete_token_len); + completion_len = strlen(tmpbuf+incomplete_token_len); + + } + else { + completion_len = nb_common_chars(completion_buf, + tmpbuf+incomplete_token_len); + completion_buf[completion_len] = 0; + } + nb_completable++; + } + } + next: + inst_num ++; + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + } + + debug_printf("total choices %d for this completion\n", nb_completable); + + /* no possible completion */ + if (nb_completable == 0 && nb_non_completable == 0) + return 0; + + /* if multichoice is not required */ + if (*state == 0 && incomplete_token_len > 0) { + /* one or several choices starting with the + same chars */ + if (completion_len > 0) { + if (completion_len + 1 > size) + return 0; + + strcpy(dst, completion_buf); + return 2; + } + } + } + + /* init state correctly */ + if (*state == -1) + *state = 0; + + debug_printf("Multiple choice STATE=%d\n", *state); + + inst_num = 0; + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + while (inst) { + /* we need to redo it */ + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + + if (nb_token && match_inst(inst, buf, nb_token, NULL)) + goto next2; + + token_p = (parse_pgm_token_hdr_t *)pgm_read_pgmptr(&inst->tokens[nb_token]); + if (token_p) + memcpy_P(&token_hdr, token_p, sizeof(token_hdr)); + + /* one choice for this token */ + if (!token_p || + !token_hdr.ops->complete_get_nb || + !token_hdr.ops->complete_get_elt || + (n = token_hdr.ops->complete_get_nb(token_p)) == 0) { + if (local_state < *state) { + local_state++; + goto next2; + } + (*state)++; + if (token_p && token_hdr.ops->get_help) { + token_hdr.ops->get_help(token_p, tmpbuf, sizeof(tmpbuf)); + help_str = (prog_char *) pgm_read_pgmptr(&inst->help_str); + if (help_str) + snprintf_P(dst, size, PSTR("[%s]: "PGMS_FMT""), tmpbuf, help_str); + else + snprintf_P(dst, size, PSTR("[%s]: No help"), tmpbuf); + } + else { + snprintf_P(dst, size, PSTR("[RETURN]")); + } + return 1; + } + + /* several choices */ + for (i=0 ; icomplete_get_elt(token_p, i, tmpbuf, sizeof(tmpbuf)) < 0) + continue; + strcat_P(tmpbuf, PSTR(" ")); /* we have at least room for one char */ + debug_printf(" choice <%s>\n", tmpbuf); + /* does the completion match the beginning of the word ? */ + if (!strncmp(incomplete_token, tmpbuf, incomplete_token_len)) { + if (local_state < *state) { + local_state++; + continue; + } + (*state)++; + l=snprintf(dst, size, "%s", tmpbuf); + if (l>=0 && token_hdr.ops->get_help) { + token_hdr.ops->get_help(token_p, tmpbuf, sizeof(tmpbuf)); + help_str = (prog_char *) pgm_read_pgmptr(&inst->help_str); + if (help_str) + snprintf_P(dst+l, size-l, PSTR("[%s]: "PGMS_FMT), tmpbuf, help_str); + else + snprintf_P(dst+l, size-l, PSTR("[%s]: No help"), tmpbuf); + } + + return 1; + } + } + next2: + inst_num ++; + inst = (parse_pgm_inst_t *)pgm_read_pgmptr(ctx+inst_num); + } + return 0; +} + diff --git a/parse.h b/parse.h new file mode 100644 index 0000000..2760ca6 --- /dev/null +++ b/parse.h @@ -0,0 +1,146 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: parse.h,v 1.1.2.9 2009-01-03 16:25:13 zer0 Exp $ + * + * + */ + +#ifndef _PARSE_H_ +#define _PARSE_H_ + +#include +#include + +#ifndef offsetof +#define offsetof(type, field) ((size_t) &( ((type *)0)->field) ) +#endif + +#define PARSE_SUCCESS 0 +#define PARSE_AMBIGUOUS -1 +#define PARSE_NOMATCH -2 +#define PARSE_BAD_ARGS -3 + +/** + * Stores a pointer to the ops struct, and the offset: the place to + * write the parsed result in the destination structure. + */ +struct token_hdr { + struct token_ops *ops; + uint8_t offset; +}; +typedef struct token_hdr parse_token_hdr_t; + +struct token_hdr_pgm { + struct token_ops *ops; + uint8_t offset; +} PROGMEM; +typedef struct token_hdr_pgm parse_pgm_token_hdr_t; + +/** + * A token is defined by this structure. + * + * parse() takes the token as first argument, then the source buffer + * starting at the token we want to parse. The 3rd arg is a pointer + * where we store the parsed data (as binary). It returns the number of + * parsed chars on success and a negative value on error. + * + * complete_get_nb() returns the number of possible values for this + * token if completion is possible. If it is NULL or if it returns 0, + * no completion is possible. + * + * complete_get_elt() copy in dstbuf (the size is specified in the + * parameter) the i-th possible completion for this token. returns 0 + * on success or and a negative value on error. + * + * get_help() fills the dstbuf with the help for the token. It returns + * -1 on error and 0 on success. + */ +struct token_ops { + /** parse(token ptr, buf, res pts) */ + int8_t (*parse)(parse_pgm_token_hdr_t *, const char *, void *); + /** return the num of possible choices for this token */ + int8_t (*complete_get_nb)(parse_pgm_token_hdr_t *); + /** return the elt x for this token (token, idx, dstbuf, size) */ + int8_t (*complete_get_elt)(parse_pgm_token_hdr_t *, int8_t, char *, uint8_t); + /** get help for this token (token, dstbuf, size) */ + int8_t (*get_help)(parse_pgm_token_hdr_t *, char *, uint8_t); +}; + +/** + * Store a instruction, which is a pointer to a callback function and + * its parameter that is called when the instruction is parsed, a help + * string, and a list of token composing this instruction. + */ +struct inst { + /* f(parsed_struct, data) */ + void (*f)(void *, void *); + void * data; + char * help_str; + prog_void * tokens[]; +}; +typedef struct inst parse_inst_t; +struct inst_pgm { + /* f(parsed_struct, data) */ + void (*f)(void *, void *); + void * data; + char * help_str; + prog_void * tokens[]; +} PROGMEM; +typedef struct inst_pgm parse_pgm_inst_t; + +/** + * A context is identified by its name, and contains a list of + * instruction + * + */ +typedef parse_pgm_inst_t * parse_ctx_t; +typedef PROGMEM parse_ctx_t parse_pgm_ctx_t; + +/** + * Try to parse a buffer according to the specified context. The + * argument buf must ends with "\n\0". The function returns + * PARSE_AMBIGUOUS, PARSE_NOMATCH or PARSE_BAD_ARGS on error. Else it + * calls the associated function (defined in the context) and returns + * 0 (PARSE_SUCCESS). + */ +int8_t parse(parse_pgm_ctx_t ctx[], const char * buf); + +/** + * complete() must be called with *state==0. + * It returns < 0 on error. + * + * Else it returns: + * 2 on completion (one possible choice). In this case, the chars + * are appended in dst buffer. + * 1 if there is several possible choices. In this case, you must + * call the function again, keeping the value of state intact. + * 0 when the iteration is finished. The dst is not valid for this + * last call. + * + * The returned dst buf ends with \0. + * + */ +int8_t complete(parse_pgm_ctx_t ctx[], const char *buf, int16_t *state, + char *dst, uint8_t size); + + +/* true if(!c || iscomment(c) || isblank(c) || isendofline(c)) */ +int isendoftoken(char c); + +#endif /* _PARSE_H_ */ diff --git a/parse_atcmd.c b/parse_atcmd.c new file mode 100644 index 0000000..78e28ba --- /dev/null +++ b/parse_atcmd.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +#include + +#include "xbee_atcmd.h" +#include "parse_atcmd.h" + +static int8_t +parse_atcmd(parse_pgm_token_hdr_t *tk, const char *buf, void *res) +{ + struct xbee_atcmd copy; + struct token_atcmd_data ad; + struct xbee_atcmd_pgm *cmd; + char bufcopy[32]; + uint8_t token_len = 0; + + memcpy_P(&ad, &((struct token_atcmd *)tk)->atcmd_data, sizeof(ad)); + + while (!isendoftoken(buf[token_len]) && + token_len < (sizeof(bufcopy)-1)) { + bufcopy[token_len] = buf[token_len]; + token_len++; + } + bufcopy[token_len] = 0; + + /* XXX should be related to an xbee device */ + cmd = xbee_atcmd_lookup_desc(bufcopy); + + if (cmd == NULL) + return -1; + + /* command must match flags */ + memcpy_P(©, cmd, sizeof(copy)); + if ((copy.flags & ad.atcmd_mask) != ad.atcmd_flags) + return -1; + /* store the address of object in structure */ + if (res) + *(struct xbee_atcmd_pgm **)res = cmd; + + return token_len; +} + +static int8_t complete_get_nb_atcmd(parse_pgm_token_hdr_t *tk) +{ + struct token_atcmd_data ad; + struct xbee_atcmd_pgm *cmd; + struct xbee_atcmd copy; + int8_t cnt = 0; + + memcpy_P(&ad, &((struct token_atcmd *)tk)->atcmd_data, sizeof(ad)); + + for (cmd = &xbee_atcmd_list[0], memcpy_P(©, cmd, sizeof(copy)); + copy.name != NULL; + cmd++, memcpy_P(©, cmd, sizeof(copy))) { + + if ((copy.flags & ad.atcmd_mask) == ad.atcmd_flags) + cnt++; + } + return cnt; +} + +static int8_t complete_get_elt_atcmd(parse_pgm_token_hdr_t *tk, int8_t idx, + char *dstbuf, uint8_t size) +{ + struct token_atcmd_data ad; + struct xbee_atcmd_pgm *cmd; + struct xbee_atcmd copy; + int8_t cnt = 0; + + memcpy_P(&ad, &((struct token_atcmd *)tk)->atcmd_data, sizeof(ad)); + + for (cmd = &xbee_atcmd_list[0], memcpy_P(©, cmd, sizeof(copy)); + copy.name != NULL; + cmd++, memcpy_P(©, cmd, sizeof(copy))) { + + if ((copy.flags & ad.atcmd_mask) == ad.atcmd_flags) { + if (cnt == idx) { + memcpy_P(dstbuf, copy.desc, size); + dstbuf[size-1] = '\0'; + + return 0; + } + cnt++; + } + } + return -1; +} + +static int8_t +help_atcmd(parse_pgm_token_hdr_t *tk, char *dstbuf, + uint8_t size) +{ + snprintf(dstbuf, size, "ATCMD"); + return 0; +} + +struct token_ops token_atcmd_ops = { + .parse = parse_atcmd, + .complete_get_nb = complete_get_nb_atcmd, + .complete_get_elt = complete_get_elt_atcmd, + .get_help = help_atcmd, +}; diff --git a/parse_atcmd.h b/parse_atcmd.h new file mode 100644 index 0000000..8506053 --- /dev/null +++ b/parse_atcmd.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PARSE_ATCMD_H_ +#define _PARSE_ATCMD_H_ + +struct token_atcmd_data { + struct xbee_dev **xbee_dev; + unsigned atcmd_flags; + unsigned atcmd_mask; +}; + +struct token_atcmd { + struct token_hdr hdr; + struct token_atcmd_data atcmd_data; +}; +typedef struct token_atcmd parse_token_atcmd_t; + +struct token_atcmd_pgm { + struct token_hdr hdr; + struct token_atcmd_data atcmd_data; +} PROGMEM; +typedef struct token_atcmd_pgm parse_pgm_token_atcmd_t; + +extern struct token_ops token_atcmd_ops; + +#define TOKEN_ATCMD_INITIALIZER(structure, field, dev, flags, mask) \ +{ \ + .hdr = { \ + .ops = &token_atcmd_ops, \ + .offset = offsetof(structure, field), \ + }, \ + .atcmd_data = { \ + .xbee_dev = dev, \ + .atcmd_flags = flags, \ + .atcmd_mask = mask, \ + }, \ +} + +#endif /* _PARSE_ATCMD_H_ */ diff --git a/parse_monitor.c b/parse_monitor.c new file mode 100644 index 0000000..8f684fb --- /dev/null +++ b/parse_monitor.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "parse_monitor.h" + +struct monitor_reg_list xbee_monitor_list = LIST_HEAD_INITIALIZER(); + +static int8_t +parse_monitor(parse_pgm_token_hdr_t *tk, const char *buf, void *res) +{ + struct monitor_reg *m; + uint8_t token_len = 0; + char bufcopy[32]; + + while (!isendoftoken(buf[token_len]) && + token_len < (sizeof(bufcopy)-1)) { + bufcopy[token_len] = buf[token_len]; + token_len++; + } + bufcopy[token_len] = 0; + + LIST_FOREACH(m, &xbee_monitor_list, next) { + if (!strcmp_P(bufcopy, m->desc)) + break; + } + if (m == NULL) /* not found */ + return -1; + + /* store the address of object in structure */ + if (res) + *(struct monitor_reg **)res = m; + + return token_len; +} + +static int8_t +complete_get_nb_monitor(parse_pgm_token_hdr_t *tk) +{ + struct monitor_reg *m; + int8_t i = 0; + + LIST_FOREACH(m, &xbee_monitor_list, next) { + i++; + } + return i; +} + +static int8_t +complete_get_elt_monitor(parse_pgm_token_hdr_t *tk, int8_t idx, + char *dstbuf, uint8_t size) +{ + struct monitor_reg *m; + int8_t i = 0, len; + + LIST_FOREACH(m, &xbee_monitor_list, next) { + if (i == idx) + break; + i++; + } + if (m == NULL) + return -1; + + len = snprintf(dstbuf, size, "%S", m->desc); + if (len < 0 || len >= size) + return -1; + + return 0; +} + + +static int8_t +help_monitor(parse_pgm_token_hdr_t *tk, char *dstbuf, + uint8_t size) +{ + snprintf(dstbuf, size, "Monitor-register"); + return 0; +} + +struct token_ops token_monitor_ops = { + .parse = parse_monitor, + .complete_get_nb = complete_get_nb_monitor, + .complete_get_elt = complete_get_elt_monitor, + .get_help = help_monitor, +}; diff --git a/parse_monitor.h b/parse_monitor.h new file mode 100644 index 0000000..b3da615 --- /dev/null +++ b/parse_monitor.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PARSE_MONITOR_H_ +#define _PARSE_MONITOR_H_ + +#include + +struct monitor_reg { + LIST_ENTRY(monitor_reg) next; + const prog_char *desc; + char atcmd[3]; +}; + +LIST_HEAD(monitor_reg_list, monitor_reg); +extern struct monitor_reg_list xbee_monitor_list; + +/* data is a pointer to a list */ +struct token_monitor_data { +}; + +struct token_monitor { + struct token_hdr hdr; + struct token_monitor_data monitor_data; +}; +typedef struct token_monitor parse_token_monitor_t; + +struct token_monitor_pgm { + struct token_hdr hdr; + struct token_monitor_data monitor_data; +} PROGMEM; +typedef struct token_monitor_pgm parse_pgm_token_monitor_t; + +extern struct token_ops token_monitor_ops; + +#define TOKEN_MONITOR_INITIALIZER(structure, field){ \ + .hdr = { \ + .ops = &token_monitor_ops, \ + .offset = offsetof(structure, field), \ + }, \ + .monitor_data = { \ + }, \ +} + +#endif /* _PARSE_MONITOR_H_ */ diff --git a/parse_neighbor.c b/parse_neighbor.c new file mode 100644 index 0000000..0285b03 --- /dev/null +++ b/parse_neighbor.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "xbee_neighbor.h" +#include "xbee_atcmd.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" + +#include "parse_neighbor.h" + +static int8_t +parse_neighbor(parse_pgm_token_hdr_t *tk, const char *buf, void *res) +{ + struct token_neighbor_data tkd; + struct xbee_dev *dev; + struct xbee_neigh *neigh; + uint8_t token_len = 0; + char bufcopy[32]; + + memcpy_P(&tkd, &((struct token_neighbor *)tk)->neighbor_data, + sizeof(tkd)); + dev = *tkd.xbee_dev; + + while (!isendoftoken(buf[token_len]) && + token_len < (sizeof(bufcopy)-1)) { + bufcopy[token_len] = buf[token_len]; + token_len++; + } + bufcopy[token_len] = 0; + neigh = xbee_neigh_lookup(dev, bufcopy); + if (neigh == NULL) /* not found */ + return -1; + + /* store the address of xbee_neigh in structure */ + if (res) + *(struct xbee_neigh **)res = neigh; + + return token_len; +} + +static int8_t +complete_get_nb_neighbor(parse_pgm_token_hdr_t *tk) +{ + struct token_neighbor_data tkd; + struct xbee_dev *dev; + struct xbee_neigh *neigh; + int8_t i = 0; + + memcpy_P(&tkd, &((struct token_neighbor *)tk)->neighbor_data, + sizeof(tkd)); + dev = *tkd.xbee_dev; + + LIST_FOREACH(neigh, &dev->neigh_list, next) { + i++; + } + return i; +} + +static int8_t +complete_get_elt_neighbor(parse_pgm_token_hdr_t *tk, int8_t idx, + char *dstbuf, uint8_t size) +{ + struct token_neighbor_data tkd; + struct xbee_dev *dev; + struct xbee_neigh *neigh; + int8_t i = 0, len; + + memcpy_P(&tkd, &((struct token_neighbor *)tk)->neighbor_data, + sizeof(tkd)); + dev = *tkd.xbee_dev; + + LIST_FOREACH(neigh, &dev->neigh_list, next) { + if (i++ == idx) + break; + } + + if (neigh == NULL) + return -1; + + len = snprintf(dstbuf, size, "%s", neigh->name); + if (len < 0 || len >= size) + return -1; + + return 0; +} + + +static int8_t +help_neighbor(parse_pgm_token_hdr_t *tk, char *dstbuf, + uint8_t size) +{ + snprintf(dstbuf, size, "Neighbor"); + return 0; +} + +struct token_ops token_neighbor_ops = { + .parse = parse_neighbor, + .complete_get_nb = complete_get_nb_neighbor, + .complete_get_elt = complete_get_elt_neighbor, + .get_help = help_neighbor, +}; diff --git a/parse_neighbor.h b/parse_neighbor.h new file mode 100644 index 0000000..6d4cfcd --- /dev/null +++ b/parse_neighbor.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PARSE_NEIGHBOR_H_ +#define _PARSE_NEIGHBOR_H_ + +struct token_neighbor_data { + struct xbee_dev **xbee_dev; +}; + +struct token_neighbor { + struct token_hdr hdr; + struct token_neighbor_data neighbor_data; +}; +typedef struct token_neighbor parse_token_neighbor_t; + +struct token_neighbor_pgm { + struct token_hdr hdr; + struct token_neighbor_data neighbor_data; +} PROGMEM; +typedef struct token_neighbor_pgm parse_pgm_token_neighbor_t; + +extern struct token_ops token_neighbor_ops; + +#define TOKEN_NEIGHBOR_INITIALIZER(structure, field, dev) \ + { \ + .hdr = { \ + .ops = &token_neighbor_ops, \ + .offset = offsetof(structure, field), \ + }, \ + .neighbor_data = { \ + .xbee_dev = dev, \ + }, \ +} + +#endif /* _PARSE_NEIGHBOR_H_ */ diff --git a/parse_num.c b/parse_num.c new file mode 100644 index 0000000..512a0d8 --- /dev/null +++ b/parse_num.c @@ -0,0 +1,457 @@ +#include +#include +#include +#include + +#include "parse.h" +#include "parse_num.h" + +//#define debug_printf(args...) printf(args) +#define debug_printf(args...) do {} while(0) + +/* XXX to remove ?? */ +#define U08_MIN 0x00 +#define U08_MAX 0xFF +#define U16_MIN 0x0000 +#define U16_MAX 0xFFFF +#define U32_MIN 0x00000000 +#define U32_MAX 0xFFFFFFFF +#define U64_MIN 0x0000000000000000 +#define U64_MAX 0xFFFFFFFFFFFFFFFF +#define S08_MIN 0x80 +#define S08_MAX 0x7F +#define S16_MIN 0x8000 +#define S16_MAX 0x7FFF +#define S32_MIN 0x80000000 +#define S32_MAX 0x7FFFFFFF +#define S64_MIN 0x8000000000000000 +#define S64_MAX 0x7FFFFFFFFFFFFFFF + + +struct token_ops token_num_ops = { + .parse = parse_num, + .complete_get_nb = NULL, + .complete_get_elt = NULL, + .get_help = get_help_num, +}; + + +enum num_parse_state_t { + START, + DEC_NEG, + BIN, + HEX, + FLOAT_POS, + FLOAT_NEG, + ERROR, + + FIRST_OK, /* not used */ + ZERO_OK, + HEX_OK, + OCTAL_OK, + BIN_OK, + DEC_NEG_OK, + DEC_POS_OK, + FLOAT_POS_OK, + FLOAT_NEG_OK, +}; + +/* Keep it sync with enum in .h */ +static const prog_char help1[] = "UINT8"; +static const prog_char help2[] = "UINT16"; +static const prog_char help3[] = "UINT32"; +static const prog_char help4[] = "UINT64"; +static const prog_char help5[] = "INT8"; +static const prog_char help6[] = "INT16"; +static const prog_char help7[] = "INT32"; +static const prog_char help8[] = "INT64"; +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT +static const prog_char help9[] = "FLOAT"; +#endif +static const prog_char * num_help[] = { + help1, help2, help3, help4, + help5, help6, help7, help8, +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + help9, +#endif +}; + +static inline int8_t +add_to_res(uint8_t c, uint64_t * res, uint8_t base) +{ + /* overflow */ + if ( (U64_MAX - c) / base < *res ) { + return -1; + } + + *res = *res * base + c ; + return 0; +} + + +/* parse an int or a float */ +int8_t +parse_num(parse_pgm_token_hdr_t * tk, const char * srcbuf, void * res) +{ + struct token_num_data nd; + enum num_parse_state_t st = START; + const char * buf = srcbuf; + char c = *buf; + uint64_t res1=0, res2=0, res3=1; + + memcpy_P(&nd, &((struct token_num *)tk)->num_data, sizeof(nd)); + + while ( st != ERROR && c && ! isendoftoken(c) ) { + debug_printf("%c %x -> ", c, c); + switch (st) { + case START: + if (c == '-') { + st = DEC_NEG; + } + else if (c == '0') { + st = ZERO_OK; + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if (c == '.') { + st = FLOAT_POS; + res1 = 0; + } +#endif + else if (c >= '1' && c <= '9') { + if (add_to_res(c - '0', &res1, 10) < 0) + st = ERROR; + else + st = DEC_POS_OK; + } + else { + st = ERROR; + } + break; + + case ZERO_OK: + if (c == 'x') { + st = HEX; + } + else if (c == 'b') { + st = BIN; + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if (c == '.') { + st = FLOAT_POS; + res1 = 0; + } +#endif + else if (c >= '0' && c <= '7') { + if (add_to_res(c - '0', &res1, 10) < 0) + st = ERROR; + else + st = OCTAL_OK; + } + else { + st = ERROR; + } + break; + + case DEC_NEG: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res1, 10) < 0) + st = ERROR; + else + st = DEC_NEG_OK; + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if (c == '.') { + res1 = 0; + st = FLOAT_NEG; + } +#endif + else { + st = ERROR; + } + break; + + case DEC_NEG_OK: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res1, 10) < 0) + st = ERROR; + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if (c == '.') { + st = FLOAT_NEG; + } +#endif + else { + st = ERROR; + } + break; + + case DEC_POS_OK: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res1, 10) < 0) + st = ERROR; + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if (c == '.') { + st = FLOAT_POS; + } +#endif + else { + st = ERROR; + } + break; + + case HEX: + st = HEX_OK; + /* no break */ + case HEX_OK: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res1, 16) < 0) + st = ERROR; + } + else if (c >= 'a' && c <= 'f') { + if (add_to_res(c - 'a' + 10, &res1, 16) < 0) + st = ERROR; + } + else if (c >= 'A' && c <= 'F') { + if (add_to_res(c - 'A' + 10, &res1, 16) < 0) + st = ERROR; + } + else { + st = ERROR; + } + break; + + + case OCTAL_OK: + if (c >= '0' && c <= '7') { + if (add_to_res(c - '0', &res1, 8) < 0) + st = ERROR; + } + else { + st = ERROR; + } + break; + + case BIN: + st = BIN_OK; + /* no break */ + case BIN_OK: + if (c >= '0' && c <= '1') { + if (add_to_res(c - '0', &res1, 2) < 0) + st = ERROR; + } + else { + st = ERROR; + } + break; + +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + case FLOAT_POS: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res2, 10) < 0) + st = ERROR; + else + st = FLOAT_POS_OK; + res3 = 10; + } + else { + st = ERROR; + } + break; + + case FLOAT_NEG: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res2, 10) < 0) + st = ERROR; + else + st = FLOAT_NEG_OK; + res3 = 10; + } + else { + st = ERROR; + } + break; + + case FLOAT_POS_OK: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res2, 10) < 0) + st = ERROR; + if (add_to_res(0, &res3, 10) < 0) + st = ERROR; + } + else { + st = ERROR; + } + break; + + case FLOAT_NEG_OK: + if (c >= '0' && c <= '9') { + if (add_to_res(c - '0', &res2, 10) < 0) + st = ERROR; + if (add_to_res(0, &res3, 10) < 0) + st = ERROR; + } + else { + st = ERROR; + } + break; +#endif + + default: + debug_printf("not impl "); + + } + + debug_printf("(%d) (%d) (%d)\n", + (int)res1, (int)res2, (int)res3); + + buf ++; + c = *buf; + + /* token too long */ + if (buf-srcbuf > 127) + return -1; + } + + switch (st) { + case ZERO_OK: + case DEC_POS_OK: + case HEX_OK: + case OCTAL_OK: + case BIN_OK: + if ( nd.type == INT8 && res1 <= S08_MAX ) { + if (res) + *(int8_t *)res = (int8_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT16 && res1 <= S16_MAX ) { + if (res) + *(int16_t *)res = (int16_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT32 && res1 <= S32_MAX ) { + if (res) + *(int32_t *)res = (int32_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT64 && res1 <= S64_MAX ) { + if (res) + *(int64_t *)res = (int64_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == UINT8 && res1 <= U08_MAX ) { + if (res) + *(uint8_t *)res = (uint8_t) res1; + return (buf-srcbuf); + } + else if (nd.type == UINT16 && res1 <= U16_MAX ) { + if (res) + *(uint16_t *)res = (uint16_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == UINT32 ) { + if (res) + *(uint32_t *)res = (uint32_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == UINT64 ) { + if (res) + *(uint64_t *)res = (uint64_t) res1; + return (buf-srcbuf); + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if ( nd.type == FLOAT ) { + if (res) + *(float *)res = (float)res1; + return (buf-srcbuf); + } +#endif + else { + return -1; + } + break; + + case DEC_NEG_OK: + if ( nd.type == INT8 && res1 <= S08_MAX + 1 ) { + if (res) + *(int8_t *)res = - (int8_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT16 && res1 <= (uint16_t)S16_MAX + 1 ) { + if (res) + *(int16_t *)res = - (int16_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT32 && res1 <= (uint32_t)S32_MAX + 1 ) { + if (res) + *(int32_t *)res = - (int32_t) res1; + return (buf-srcbuf); + } + else if ( nd.type == INT64 && res1 <= (uint64_t)S64_MAX + 1 ) { + if (res) + *(int64_t *)res = - (int64_t) res1; + return (buf-srcbuf); + } +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + else if ( nd.type == FLOAT ) { + if (res) + *(float *)res = - (float)res1; + return (buf-srcbuf); + } +#endif + else { + return -1; + } + break; + +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + case FLOAT_POS: + case FLOAT_POS_OK: + if ( nd.type == FLOAT ) { + if (res) + *(float *)res = (float)res1 + ((float)res2 / (float)res3); + return (buf-srcbuf); + + } + else { + return -1; + } + break; + + case FLOAT_NEG: + case FLOAT_NEG_OK: + if ( nd.type == FLOAT ) { + if (res) + *(float *)res = - ((float)res1 + ((float)res2 / (float)res3)); + return (buf-srcbuf); + + } + else { + return -1; + } + break; +#endif + default: + debug_printf("error\n"); + return -1; + } + return -1; +} + + +/* parse an int or a float */ +int8_t +get_help_num(parse_pgm_token_hdr_t * tk, char * dstbuf, uint8_t size) +{ + struct token_num_data nd; + + memcpy_P(&nd, &((struct token_num *)tk)->num_data, sizeof(nd)); + + /* should not happen.... don't so this test */ +/* if (nd.type >= (sizeof(num_help)/sizeof(const char *))) */ +/* return -1; */ + + strncpy_P(dstbuf, num_help[nd.type], size); + dstbuf[size-1] = '\0'; + return 0; +} diff --git a/parse_num.h b/parse_num.h new file mode 100644 index 0000000..40a47d5 --- /dev/null +++ b/parse_num.h @@ -0,0 +1,53 @@ +#ifndef _PARSE_NUM_H_ +#define _PARSE_NUM_H_ + +#include "parse.h" + +enum numtype { + UINT8 = 0, + UINT16, + UINT32, + UINT64, + INT8, + INT16, + INT32, + INT64, +#ifndef CONFIG_MODULE_PARSE_NO_FLOAT + FLOAT, +#endif +}; + +struct token_num_data { + enum numtype type; +}; + +struct token_num { + struct token_hdr hdr; + struct token_num_data num_data; +}; +typedef struct token_num parse_token_num_t; +struct token_num_pgm { + struct token_hdr hdr; + struct token_num_data num_data; +} PROGMEM; +typedef struct token_num_pgm parse_pgm_token_num_t; + +extern struct token_ops token_num_ops; + +int8_t parse_num(parse_pgm_token_hdr_t * tk, + const char * srcbuf, void * res); +int8_t get_help_num(parse_pgm_token_hdr_t * tk, + char * dstbuf, uint8_t size); + +#define TOKEN_NUM_INITIALIZER(structure, field, numtype) \ +{ \ + .hdr = { \ + .ops = &token_num_ops, \ + .offset = offsetof(structure, field), \ + }, \ + .num_data = { \ + .type = numtype, \ + }, \ +} + +#endif /* _PARSE_NUM_H_ */ diff --git a/parse_string.c b/parse_string.c new file mode 100644 index 0000000..2083b59 --- /dev/null +++ b/parse_string.c @@ -0,0 +1,169 @@ +#include +#include +#include +#include + +#include "parse.h" +#include "parse_string.h" + +struct token_ops token_string_ops = { + .parse = parse_string, + .complete_get_nb = complete_get_nb_string, + .complete_get_elt = complete_get_elt_string, + .get_help = get_help_string, +}; + +#define MULTISTRING_HELP PSTR("Mul-choice STRING") +#define ANYSTRING_HELP PSTR("Any STRING") +#define FIXEDSTRING_HELP PSTR("Fixed STRING") + +static uint8_t +get_token_len(const prog_char * s) +{ + prog_char c; + uint8_t i=0; + + c = pgm_read_byte(s+i); + while (c!='#' && c!='\0') { + i++; + c = pgm_read_byte(s+i); + } + return i; +} + +static const prog_char * +get_next_token(const prog_char * s) +{ + uint8_t i; + i = get_token_len(s); + if (pgm_read_byte(s+i) == '#') + return s+i+1; + return NULL; +} + +int8_t +parse_string(parse_pgm_token_hdr_t * tk, const char * buf, void * res) +{ + struct token_string_data sd; + uint8_t token_len; + const prog_char * str; + + if (! *buf) + return -1; + + memcpy_P(&sd, &((struct token_string *)tk)->string_data, sizeof(sd)); + + /* fixed string */ + if (sd.str) { + str = sd.str; + do { + token_len = get_token_len(str); + + /* if token is too big... */ + if (token_len >= STR_TOKEN_SIZE - 1) { + continue; + } + + if ( strncmp_P(buf, str, token_len) ) { + continue; + } + + if ( !isendoftoken(*(buf+token_len)) ) { + continue; + } + + break; + } while ( (str = get_next_token(str)) != NULL ); + + if (!str) + return -1; + } + /* unspecified string */ + else { + token_len=0; + while(!isendoftoken(buf[token_len]) && + token_len < (STR_TOKEN_SIZE-1)) + token_len++; + + /* return if token too long */ + if (token_len >= STR_TOKEN_SIZE - 1) { + return -1; + } + } + + if (res) { + /* we are sure that token_len is < STR_TOKEN_SIZE-1 */ + strncpy(res, buf, token_len); + *((char *)res + token_len) = 0; + } + + return token_len; +} + +int8_t complete_get_nb_string(parse_pgm_token_hdr_t * tk) +{ + struct token_string_data sd; + int8_t ret=1; + + memcpy_P(&sd, &((struct token_string *)tk)->string_data, sizeof(sd)); + + if (!sd.str) + return 0; + + while( (sd.str = get_next_token(sd.str)) != NULL ) { + ret++; + } + return ret; +} + +int8_t complete_get_elt_string(parse_pgm_token_hdr_t * tk, int8_t idx, + char * dstbuf, uint8_t size) +{ + struct token_string_data sd; + const prog_char * s; + uint8_t len; + + memcpy_P(&sd, &((struct token_string *)tk)->string_data, sizeof(sd)); + s = sd.str; + + while (idx-- && s) + s = get_next_token(s); + + if (!s) + return -1; + + len = get_token_len(s); + if (len > size - 1) + return -1; + + memcpy_P(dstbuf, s, len); + dstbuf[len] = '\0'; + + return 0; +} + + +int8_t get_help_string(parse_pgm_token_hdr_t * tk, char * dstbuf, uint8_t size) +{ + struct token_string_data sd; + const prog_char * s; + + memcpy_P(&sd, &((struct token_string *)tk)->string_data, sizeof(sd)); + s = sd.str; + + if (s) { + if (get_next_token(s)) { + strncpy_P(dstbuf, MULTISTRING_HELP, size); + } + else { + strncpy_P(dstbuf, FIXEDSTRING_HELP, size); + } + } + else { + strncpy_P(dstbuf, ANYSTRING_HELP, size); + } + + dstbuf[size-1] = '\0'; + + return 0; +} diff --git a/parse_string.h b/parse_string.h new file mode 100644 index 0000000..0d09892 --- /dev/null +++ b/parse_string.h @@ -0,0 +1,45 @@ +#ifndef _PARSE_STRING_H_ +#define _PARSE_STRING_H_ + +#include "parse.h" + +/* size of a parsed string */ +#define STR_TOKEN_SIZE 32 + +typedef char fixed_string_t[STR_TOKEN_SIZE]; + +struct token_string_data { + const prog_char * str; +}; + +struct token_string { + struct token_hdr hdr; + struct token_string_data string_data; +}; +typedef struct token_string parse_token_string_t; +struct token_string_pgm { + struct token_hdr hdr; + struct token_string_data string_data; +} PROGMEM; +typedef struct token_string_pgm parse_pgm_token_string_t; + +extern struct token_ops token_string_ops; + +int8_t parse_string(parse_pgm_token_hdr_t * tk, const char * srcbuf, void * res); +int8_t complete_get_nb_string(parse_pgm_token_hdr_t * tk); +int8_t complete_get_elt_string(parse_pgm_token_hdr_t * tk, int8_t idx, + char * dstbuf, uint8_t size); +int8_t get_help_string(parse_pgm_token_hdr_t * tk, char * dstbuf, uint8_t size); + +#define TOKEN_STRING_INITIALIZER(structure, field, string) \ +{ \ + .hdr = { \ + .ops = &token_string_ops, \ + .offset = offsetof(structure, field), \ + }, \ + .string_data = { \ + .str = string, \ + }, \ +} + +#endif /* _PARSE_STRING_H_ */ diff --git a/pid_config.h b/pid_config.h new file mode 100644 index 0000000..251cca8 --- /dev/null +++ b/pid_config.h @@ -0,0 +1,30 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * + */ + +#ifndef PID_CONFIG_H +#define PID_CONFIG_H + +/** the derivate term can be filtered to remove the noise. This value + * is the maxium sample count to keep in memory to do this + * filtering. For an instance of pid, this count is defined o*/ +#define PID_DERIVATE_FILTER_MAX_SIZE 6 + +#endif diff --git a/rc_proto.c b/rc_proto.c new file mode 100644 index 0000000..ee2888b --- /dev/null +++ b/rc_proto.c @@ -0,0 +1,48 @@ +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include "xbee_proto.h" +#include "callout.h" +#include "rc_proto.h" +#include "main.h" + + + + +struct power_levels { + int ttl; + int power_db; +}; + +struct power_levels power_levels[MAX_POWER_LEVEL]; + +static int set_power_level(void *frame, unsigned len, void *arg) +{ + struct xbee_atresp_hdr *atresp = (struct xbee_atresp_hdr *)frame; + int level = (intptr_t)arg; + uint8_t db; + db = atresp->data[0]; + + power_levels[level].power_db = db; + power_levels[level].ttl = 2; + return 0; +} + +void rc_proto_rx_range(int power_level) +{ + xbeeapp_send_atcmd("DB", NULL, 0, 0, + set_power_level, (void *)(intptr_t)power_level); + +} + + diff --git a/rc_proto.h b/rc_proto.h new file mode 100644 index 0000000..61b104b --- /dev/null +++ b/rc_proto.h @@ -0,0 +1,28 @@ +#ifndef RC_PROTO_H +#define RC_PROTO_H + +#define AXIS_NUMBER 4 + +#define RC_PROTO_TYPE_CHANNEL 0 +#define RC_PROTO_TYPE_RANGE 1 + + +/* TODO: Authenticate packet!! */ + +struct rc_proto_hdr { + uint8_t type; +}; +struct rc_proto_channel { + uint8_t type; + int16_t axis[AXIS_NUMBER]; +}; + +struct rc_proto_range { + uint8_t type; + uint8_t power_level; +}; + + +void rc_proto_rx_range(int power_level); + +#endif diff --git a/rdline.c b/rdline.c new file mode 100644 index 0000000..fd84b72 --- /dev/null +++ b/rdline.c @@ -0,0 +1,584 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: rdline.c,v 1.1.2.9 2009-02-27 21:41:31 zer0 Exp $ + * + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include "rdline.h" + +static void rdline_puts_P(struct rdline * rdl, const prog_char * buf); +static void rdline_miniprintf_P(struct rdline * rdl, + const prog_char * buf, uint8_t val); + +#ifdef CONFIG_MODULE_RDLINE_HISTORY +static void rdline_remove_old_history_item(struct rdline * rdl); +static void rdline_remove_first_history_item(struct rdline * rdl); +static uint8_t rdline_get_history_size(struct rdline * rdl); +#endif /* CONFIG_MODULE_RDLINE_HISTORY */ + + +void rdline_init(struct rdline *rdl, + rdline_write_char_t *write_char, + rdline_validate_t *validate, + rdline_complete_t *complete) +{ + memset(rdl, 0, sizeof(*rdl)); + rdl->validate = validate; + rdl->complete = complete; + rdl->write_char = write_char; + rdl->status = RDLINE_STOPPED; +#ifdef CONFIG_MODULE_RDLINE_HISTORY + cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE); +#endif /* CONFIG_MODULE_RDLINE_HISTORY */ +} + +void +rdline_newline(struct rdline * rdl, const char * prompt) +{ + uint8_t i; + + vt100_init(&rdl->vt100); + cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE); + cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE); + + if (prompt != rdl->prompt) + memcpy(rdl->prompt, prompt, sizeof(rdl->prompt)-1); + rdl->prompt_size = strlen(prompt); + + for (i=0 ; iprompt_size ; i++) + rdl->write_char(rdl->prompt[i]); + rdl->status = RDLINE_RUNNING; + +#ifdef CONFIG_MODULE_RDLINE_HISTORY + rdl->history_cur_line = -1; +#endif /* CONFIG_MODULE_RDLINE_HISTORY */ +} + +void +rdline_stop(struct rdline * rdl) +{ + rdl->status = RDLINE_STOPPED; +} + +void +rdline_restart(struct rdline * rdl) +{ + rdl->status = RDLINE_RUNNING; +} + +const char * +rdline_get_buffer(struct rdline * rdl) +{ + uint8_t len_l, len_r; + cirbuf_align_left(&rdl->left); + cirbuf_align_left(&rdl->right); + + len_l = CIRBUF_GET_LEN(&rdl->left); + len_r = CIRBUF_GET_LEN(&rdl->right); + memcpy(rdl->left_buf+len_l, rdl->right_buf, len_r); + + rdl->left_buf[len_l + len_r] = '\n'; + rdl->left_buf[len_l + len_r + 1] = '\0'; + return rdl->left_buf; +} + +static void +display_right_buffer(struct rdline * rdl) +{ + uint8_t i; + char tmp; + + rdline_puts_P(rdl, PSTR(vt100_clear_right)); + if (!CIRBUF_IS_EMPTY(&rdl->right)) { + CIRBUF_FOREACH(&rdl->right, i, tmp) { + rdl->write_char(tmp); + } + rdline_miniprintf_P(rdl, PSTR(vt100_multi_left), + CIRBUF_GET_LEN(&rdl->right)); + } +} + +void rdline_redisplay(struct rdline * rdl) +{ + uint8_t i; + char tmp; + + rdline_puts_P(rdl, PSTR(vt100_home)); + for (i=0 ; iprompt_size ; i++) + rdl->write_char(rdl->prompt[i]); + CIRBUF_FOREACH(&rdl->left, i, tmp) { + rdl->write_char(tmp); + } + display_right_buffer(rdl); +} + +int8_t +rdline_char_in(struct rdline * rdl, char c) +{ + uint8_t i; + int8_t cmd; + char tmp; +#ifdef CONFIG_MODULE_RDLINE_HISTORY + char * buf; +#endif + + if (rdl->status != RDLINE_RUNNING) + return -1; + + cmd = vt100_parser(&rdl->vt100, c); + if (cmd == -2) + return 0; + + if (cmd >= 0) { + switch (cmd) { + case KEY_CTRL_B: + case KEY_LEFT_ARR: + if (CIRBUF_IS_EMPTY(&rdl->left)) + break; + tmp = cirbuf_get_tail(&rdl->left); + cirbuf_del_tail(&rdl->left); + cirbuf_add_head(&rdl->right, tmp); + rdline_puts_P(rdl, PSTR(vt100_left_arr)); + break; + + case KEY_CTRL_F: + case KEY_RIGHT_ARR: + if (CIRBUF_IS_EMPTY(&rdl->right)) + break; + tmp = cirbuf_get_head(&rdl->right); + cirbuf_del_head(&rdl->right); + cirbuf_add_tail(&rdl->left, tmp); + rdline_puts_P(rdl, PSTR(vt100_right_arr)); + break; + + case KEY_WLEFT: + while (! CIRBUF_IS_EMPTY(&rdl->left) && + (tmp = cirbuf_get_tail(&rdl->left)) && + isblank(tmp)) { + rdline_puts_P(rdl, PSTR(vt100_left_arr)); + cirbuf_del_tail(&rdl->left); + cirbuf_add_head(&rdl->right, tmp); + } + while (! CIRBUF_IS_EMPTY(&rdl->left) && + (tmp = cirbuf_get_tail(&rdl->left)) && + !isblank(tmp)) { + rdline_puts_P(rdl, PSTR(vt100_left_arr)); + cirbuf_del_tail(&rdl->left); + cirbuf_add_head(&rdl->right, tmp); + } + break; + + case KEY_WRIGHT: + while (! CIRBUF_IS_EMPTY(&rdl->right) && + (tmp = cirbuf_get_head(&rdl->right)) && + isblank(tmp)) { + rdline_puts_P(rdl, PSTR(vt100_right_arr)); + cirbuf_del_head(&rdl->right); + cirbuf_add_tail(&rdl->left, tmp); + } + while (! CIRBUF_IS_EMPTY(&rdl->right) && + (tmp = cirbuf_get_head(&rdl->right)) && + !isblank(tmp)) { + rdline_puts_P(rdl, PSTR(vt100_right_arr)); + cirbuf_del_head(&rdl->right); + cirbuf_add_tail(&rdl->left, tmp); + } + break; + + case KEY_BKSPACE: + if(!cirbuf_del_tail_safe(&rdl->left)) { + rdline_puts_P(rdl, PSTR(vt100_bs)); + display_right_buffer(rdl); + } + break; + + case KEY_META_BKSPACE: + while (! CIRBUF_IS_EMPTY(&rdl->left) && isblank(cirbuf_get_tail(&rdl->left))) { + rdline_puts_P(rdl, PSTR(vt100_bs)); + cirbuf_del_tail(&rdl->left); + } + while (! CIRBUF_IS_EMPTY(&rdl->left) && !isblank(cirbuf_get_tail(&rdl->left))) { + rdline_puts_P(rdl, PSTR(vt100_bs)); + cirbuf_del_tail(&rdl->left); + } + display_right_buffer(rdl); + break; + + case KEY_SUPPR: + case KEY_CTRL_D: + if(!cirbuf_del_head_safe(&rdl->right)) { + display_right_buffer(rdl); + } + if (cmd == KEY_CTRL_D && + CIRBUF_IS_EMPTY(&rdl->left) && + CIRBUF_IS_EMPTY(&rdl->right)) { + return -2; + } + break; + + case KEY_CTRL_A: + if (CIRBUF_IS_EMPTY(&rdl->left)) + break; + rdline_miniprintf_P(rdl, PSTR(vt100_multi_left), + CIRBUF_GET_LEN(&rdl->left)); + while (! CIRBUF_IS_EMPTY(&rdl->left)) { + tmp = cirbuf_get_tail(&rdl->left); + cirbuf_del_tail(&rdl->left); + cirbuf_add_head(&rdl->right, tmp); + } + break; + + case KEY_CTRL_E: + if (CIRBUF_IS_EMPTY(&rdl->right)) + break; + rdline_miniprintf_P(rdl, PSTR(vt100_multi_right), + CIRBUF_GET_LEN(&rdl->right)); + while (! CIRBUF_IS_EMPTY(&rdl->right)) { + tmp = cirbuf_get_head(&rdl->right); + cirbuf_del_head(&rdl->right); + cirbuf_add_tail(&rdl->left, tmp); + } + break; + +#ifdef CONFIG_MODULE_RDLINE_KILL_BUF + case KEY_CTRL_K: + cirbuf_get_buf_head(&rdl->right, rdl->kill_buf, RDLINE_BUF_SIZE); + rdl->kill_size = CIRBUF_GET_LEN(&rdl->right); + cirbuf_del_buf_head(&rdl->right, rdl->kill_size); + rdline_puts_P(rdl, PSTR(vt100_clear_right)); + break; + + case KEY_CTRL_Y: + i=0; + while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) < + RDLINE_BUF_SIZE && + i < rdl->kill_size) { + cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]); + rdl->write_char(rdl->kill_buf[i]); + i++; + } + display_right_buffer(rdl); + break; +#endif /* CONFIG_MODULE_RDLINE_KILL_BUF */ + + case KEY_CTRL_C: + rdline_puts_P(rdl, PSTR("\r\n")); + rdline_newline(rdl, rdl->prompt); + break; + + case KEY_CTRL_L: + rdline_redisplay(rdl); + break; + + case KEY_TAB: + case KEY_HELP: + cirbuf_align_left(&rdl->left); + rdl->left_buf[CIRBUF_GET_LEN(&rdl->left)] = '\0'; + if (rdl->complete) { + char tmp_buf[127]; /* XXX */ + int16_t complete_state; + int8_t ret; + int tmp_size; + + if (cmd == KEY_TAB) + complete_state = 0; + else + complete_state = -1; + + ret = rdl->complete(rdl->left_buf, tmp_buf, sizeof(tmp_buf), + &complete_state); + /* no completion or error */ + if (ret <= 0) { + return 2; + } + + tmp_size = strlen(tmp_buf); + /* add chars */ + if (ret == 2) { + i=0; + while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) < + RDLINE_BUF_SIZE && + i < tmp_size) { + cirbuf_add_tail(&rdl->left, tmp_buf[i]); + rdl->write_char(tmp_buf[i]); + i++; + } + display_right_buffer(rdl); + return 2; /* ?? */ + } + + /* choice */ + rdline_puts_P(rdl, PSTR("\r\n")); + while (ret) { + rdl->write_char(' '); + for (i=0 ; tmp_buf[i] ; i++) + rdl->write_char(tmp_buf[i]); + rdline_puts_P(rdl, PSTR("\r\n")); + ret = rdl->complete(rdl->left_buf, tmp_buf, + sizeof(tmp_buf), &complete_state); + } + + rdline_redisplay(rdl); + } + return 2; + + case KEY_RETURN: + case KEY_RETURN2: + rdline_get_buffer(rdl); + rdline_puts_P(rdl, PSTR("\r\n")); +#ifdef CONFIG_MODULE_RDLINE_HISTORY + if (rdl->history_cur_line != -1) + rdline_remove_first_history_item(rdl); +#endif + + if (rdl->validate) + rdl->validate(rdl->left_buf, CIRBUF_GET_LEN(&rdl->left)+2); + return 1; + +#ifdef CONFIG_MODULE_RDLINE_HISTORY + case KEY_UP_ARR: + if (rdl->history_cur_line == 0) { + rdline_remove_first_history_item(rdl); + } + if (rdl->history_cur_line <= 0) { + rdline_add_history(rdl, rdline_get_buffer(rdl)); + rdl->history_cur_line = 0; + } + + buf = rdline_get_history_item(rdl, rdl->history_cur_line + 1); + if (!buf) + break; + + rdl->history_cur_line ++; + vt100_init(&rdl->vt100); + cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE); + cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE); + cirbuf_add_buf_tail(&rdl->left, buf, strlen(buf)); + rdline_redisplay(rdl); + break; + + case KEY_DOWN_ARR: + if (rdl->history_cur_line - 1 < 0) + break; + + rdl->history_cur_line --; + buf = rdline_get_history_item(rdl, rdl->history_cur_line); + if (!buf) + break; + vt100_init(&rdl->vt100); + cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE); + cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE); + cirbuf_add_buf_tail(&rdl->left, buf, strlen(buf)); + rdline_redisplay(rdl); + + break; +#endif /* CONFIG_MODULE_RDLINE_HISTORY */ + + + default: + break; + } + + return 0; + } + + if (! isprint(c)) + return 0; + + /* standard chars */ + if (CIRBUF_GET_LEN(&rdl->left) + CIRBUF_GET_LEN(&rdl->right) >= RDLINE_BUF_SIZE) + return 0; + + if (cirbuf_add_tail_safe(&rdl->left, c)) + return 0; + + rdl->write_char(c); + display_right_buffer(rdl); + + return 0; +} + + +/* HISTORY */ + +#ifdef CONFIG_MODULE_RDLINE_HISTORY +static void +rdline_remove_old_history_item(struct rdline * rdl) +{ + char tmp; + + while (! CIRBUF_IS_EMPTY(&rdl->history) ) { + tmp = cirbuf_get_head(&rdl->history); + cirbuf_del_head(&rdl->history); + if (!tmp) + break; + } +} + +static void +rdline_remove_first_history_item(struct rdline * rdl) +{ + char tmp; + + if ( CIRBUF_IS_EMPTY(&rdl->history) ) { + return; + } + else { + cirbuf_del_tail(&rdl->history); + } + + while (! CIRBUF_IS_EMPTY(&rdl->history) ) { + tmp = cirbuf_get_tail(&rdl->history); + if (!tmp) + break; + cirbuf_del_tail(&rdl->history); + } +} + +static uint8_t +rdline_get_history_size(struct rdline * rdl) +{ + uint8_t i, tmp, ret=0; + + CIRBUF_FOREACH(&rdl->history, i, tmp) { + if (tmp == 0) + ret ++; + } + + return ret; +} + +char * +rdline_get_history_item(struct rdline * rdl, uint8_t idx) +{ + uint8_t len, i, tmp; + + len = rdline_get_history_size(rdl); + if ( idx >= len ) { + return NULL; + } + + cirbuf_align_left(&rdl->history); + + CIRBUF_FOREACH(&rdl->history, i, tmp) { + if ( idx == len - 1) { + return rdl->history_buf + i; + } + if (tmp == 0) + len --; + } + + return NULL; +} + +int8_t +rdline_add_history(struct rdline * rdl, const char * buf) +{ + cirbuf_uint len, i; + + len = strlen(buf); + for (i=0; i= RDLINE_HISTORY_BUF_SIZE ) + return -1; + + while ( len >= CIRBUF_GET_FREELEN(&rdl->history) ) { + rdline_remove_old_history_item(rdl); + } + + cirbuf_add_buf_tail(&rdl->history, buf, len); + cirbuf_add_tail(&rdl->history, 0); + + return 0; +} + +void +rdline_clear_history(struct rdline * rdl) +{ + cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE); +} + +#else /* CONFIG_MODULE_RDLINE_HISTORY */ + +int8_t rdline_add_history(struct rdline * rdl, const char * buf) {return -1;} +void rdline_clear_history(struct rdline * rdl) {} +char * rdline_get_history_item(struct rdline * rdl, uint8_t i) {return NULL;} + + +#endif /* CONFIG_MODULE_RDLINE_HISTORY */ + + +/* STATIC USEFUL FUNCS */ + +static void +rdline_puts_P(struct rdline * rdl, const prog_char * buf) +{ + char c; + while ( (c=pgm_read_byte(buf++)) != '\0' ) { + rdl->write_char(c); + } +} + +/* a very very basic printf with one arg and one format 'u' */ +static void +rdline_miniprintf_P(struct rdline * rdl, const prog_char * buf, uint8_t val) +{ + char c, started=0, div=100; + + while ( (c=pgm_read_byte(buf++)) ) { + if (c=='%') { + c = pgm_read_byte(buf++); + + if (c=='u') { /* val is never more than 255 */ + while (div) { + c = val / div; + if (c || started) { + rdl->write_char(c+'0'); + started = 1; + } + val %= div; + div /= 10; + } + } + else { + rdl->write_char('%'); + rdl->write_char(c); + } + } + else { + rdl->write_char(c); + } + } +} + diff --git a/rdline.h b/rdline.h new file mode 100644 index 0000000..40bd20d --- /dev/null +++ b/rdline.h @@ -0,0 +1,192 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: rdline.h,v 1.1.2.6 2009-02-27 21:41:31 zer0 Exp $ + * + * + */ + +#ifndef _RDLINE_H_ +#define _RDLINE_H_ + +/** + * This library is a small equivalent to the GNU readline library, but + * it is designed for small systems, like Atmel AVR microcontrollers + * (8 bits). Indeed, we don't use any malloc that is sometimes not + * implemented on such systems. + */ + +#include +#include + +#define vt100_bell "\007" +#define vt100_bs "\010" +#define vt100_bs_clear "\010 \010" +#define vt100_tab "\011" +#define vt100_crnl "\012\015" +#define vt100_clear_right "\033[0K" +#define vt100_clear_left "\033[1K" +#define vt100_clear_down "\033[0J" +#define vt100_clear_up "\033[1J" +#define vt100_clear_line "\033[2K" +#define vt100_clear_screen "\033[2J" +#define vt100_up_arr "\033\133\101" +#define vt100_down_arr "\033\133\102" +#define vt100_right_arr "\033\133\103" +#define vt100_left_arr "\033\133\104" +#define vt100_multi_right "\033\133%uC" +#define vt100_multi_left "\033\133%uD" +#define vt100_suppr "\033\133\063\176" +#define vt100_home "\033M\033E" +#define vt100_word_left "\033\142" +#define vt100_word_right "\033\146" + +/* configuration */ +#define RDLINE_BUF_SIZE 64 +#define RDLINE_PROMPT_SIZE 16 +#define RDLINE_VT100_BUF_SIZE 8 +#define RDLINE_HISTORY_BUF_SIZE 128 +#define RDLINE_HISTORY_MAX_LINE 64 + +enum rdline_status { + RDLINE_STOPPED, + RDLINE_RUNNING, +}; + +struct rdline; + +typedef void (rdline_write_char_t)(char); +typedef void (rdline_validate_t)(const char *buf, uint8_t size); +typedef int8_t (rdline_complete_t)(const char *buf, char *dstbuf, + uint8_t dstsize, int16_t *state); + +struct rdline { + enum rdline_status status; + /* rdline bufs */ + struct cirbuf left; + struct cirbuf right; + char left_buf[RDLINE_BUF_SIZE+2]; /* reserve 2 chars for the \n\0 */ + char right_buf[RDLINE_BUF_SIZE]; + + char prompt[RDLINE_PROMPT_SIZE]; + uint8_t prompt_size; + +#ifdef CONFIG_MODULE_RDLINE_KILL_BUF + char kill_buf[RDLINE_BUF_SIZE]; + uint8_t kill_size; +#endif + +#ifdef CONFIG_MODULE_RDLINE_HISTORY + /* history */ + struct cirbuf history; + char history_buf[RDLINE_HISTORY_BUF_SIZE]; + int8_t history_cur_line; +#endif + + /* callbacks and func pointers */ + rdline_write_char_t *write_char; + rdline_validate_t *validate; + rdline_complete_t *complete; + + /* vt100 parser */ + struct vt100 vt100; +}; + +/** + * Init fields for a struct rdline. Call this only once at the beginning + * of your program. + * \param rdl A pointer to an uninitialized struct rdline + * \param write_char The function used by the function to write a character + * \param validate A pointer to the function to execute when the + * user validates the buffer. + * \param complete A pointer to the function to execute when the + * user completes the buffer. + */ +void rdline_init(struct rdline *rdl, + rdline_write_char_t *write_char, + rdline_validate_t *validate, + rdline_complete_t *complete); + + +/** + * Init the current buffer, and display a prompt. + * \param rdl A pointer to a struct rdline + * \param prompt A string containing the prompt + */ +void rdline_newline(struct rdline *rdl, const char *prompt); + +/** + * Call it and all received chars will be ignored. + * \param rdl A pointer to a struct rdline + */ +void rdline_stop(struct rdline *rdl); + +/** + * Restart after a call to rdline_stop() + * \param rdl A pointer to a struct rdline + */ +void rdline_restart(struct rdline *rdl); + +/** + * Redisplay the current buffer + * \param rdl A pointer to a struct rdline + */ +void rdline_redisplay(struct rdline *rdl); + + +/** + * append a char to the readline buffer. + * Return 1 when the line has been validated. + * Return 2 when the user asked to complete the buffer. + * Return -1 if it is not running. + * Return -2 if EOF (ctrl-d on an empty line). + * Else return 0. + * XXX error case when the buffer is full ? + * + * \param rdl A pointer to a struct rdline + * \param c The character to append + */ +int8_t rdline_char_in(struct rdline * rdl, char c); + +/** + * Return the current buffer, terminated by '\0'. + * \param rdl A pointer to a struct rdline + */ +const char *rdline_get_buffer(struct rdline *rdl); + + +/** + * Add the buffer to history. + * return < 0 on error. + * \param rdl A pointer to a struct rdline + * \param buf A buffer that is terminated by '\0' + */ +int8_t rdline_add_history(struct rdline *rdl, const char *buf); + +/** + * Clear current history + * \param rdl A pointer to a struct rdline + */ +void rdline_clear_history(struct rdline *rdl); + +/** + * Get the i-th history item + */ +char *rdline_get_history_item(struct rdline *rdl, uint8_t i); + +#endif /* _RDLINE_H_ */ diff --git a/rdline_config.h b/rdline_config.h new file mode 100644 index 0000000..e69de29 diff --git a/scheduler.c b/scheduler.c new file mode 100644 index 0000000..32e0a79 --- /dev/null +++ b/scheduler.c @@ -0,0 +1,68 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler.c,v 1.9.4.6 2009-11-08 17:33:14 zer0 Exp $ + * + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +/* this file is compiled for AVR version only */ + +/** declared in scheduler_host.c in case of host version */ +struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT]; + +#ifdef CONFIG_MODULE_SCHEDULER_STATS +struct scheduler_stats sched_stats; +#endif + +void scheduler_init(void) +{ + memset(g_tab_event, 0, sizeof(g_tab_event)); + +#ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS + SCHEDULER_TIMER_REGISTER(); +#endif + +#ifdef CONFIG_MODULE_SCHEDULER_TIMER0 + /* activation of corresponding interrupt */ + TOIE0_REG |= (1< + * Interface of the SCHEDULER Module + */ + +/** \file scheduler.h + * + * This module provides a function scheduler. You can call + * scheduler_add_event for adding a function to the scheduler, and + * specifying what interval between each call. During the execution of + * the function, interrupts are masked !! So use this module with + * caution (small functions) for avoiding problems. + * + * Functions with a high priority value will be call before others + * (default is 128). + * + * This module uses Timer 0 + */ + + +#ifndef _SCHEDULER_H_ +#define _SCHEDULER_H_ + +#include + +#ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS +#include +#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */ + +#include + +#ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS +#if SCHEDULER_TIMER_NUM == 0 +#define SCHEDULER_TIMER_REGISTER() timer0_register_OV_intr(scheduler_interrupt) +#define SCHEDULER_CLOCK_PRESCALER timer0_get_prescaler_div() +#ifdef TCNT0H +#define SCHEDULER_TIMER_BITS 16 +#else +#define SCHEDULER_TIMER_BITS 8 +#endif + +#elif SCHEDULER_TIMER_NUM == 1 +#define SCHEDULER_TIMER_REGISTER() timer1_register_OV_intr(scheduler_interrupt) +#define SCHEDULER_CLOCK_PRESCALER timer1_get_prescaler_div() +#ifdef TCNT1H +#define SCHEDULER_TIMER_BITS 16 +#else +#define SCHEDULER_TIMER_BITS 8 +#endif + +#elif SCHEDULER_TIMER_NUM == 2 +#define SCHEDULER_TIMER_REGISTER() timer2_register_OV_intr(scheduler_interrupt) +#define SCHEDULER_CLOCK_PRESCALER timer2_get_prescaler_div() +#ifdef TCNT2H +#define SCHEDULER_TIMER_BITS 16 +#else +#define SCHEDULER_TIMER_BITS 8 +#endif + +#elif SCHEDULER_TIMER_NUM == 3 +#define SCHEDULER_TIMER_REGISTER() timer3_register_OV_intr(scheduler_interrupt) +#define SCHEDULER_CLOCK_PRESCALER timer3_get_prescaler_div() +#ifdef TCNT3H +#define SCHEDULER_TIMER_BITS 16 +#else +#define SCHEDULER_TIMER_BITS 8 +#endif + +#else +#error "Bad SCHEDULER_TIMER_NUM value in config file" +#endif + +#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */ + +#ifdef CONFIG_MODULE_SCHEDULER_TIMER0 +#define SCHEDULER_TIMER_BITS 8 +#endif /* CONFIG_MODULE_SCHEDULER_TIMER0 */ + +#ifndef CONFIG_MODULE_SCHEDULER_MANUAL + +/** TIME_UNIT is the number of microseconds between each interruption + * if the prescaler equals 1 */ +#if SCHEDULER_TIMER_BITS == 8 +#define TIMER_UNIT_FLOAT ( 256000000.0 / (double)(CONFIG_QUARTZ) ) +#else +#define TIMER_UNIT_FLOAT ( 65536000000.0 / (double)(CONFIG_QUARTZ) ) +#endif + +/** SCHEDULER_UNIT is the number of microseconds between each + * scheduler interruption. We can use it like this : + * scheduler_add_periodical_event(f, 1000L/SCHEDULER_UNIT); + * The function f will be called every ms. + */ +#define SCHEDULER_UNIT_FLOAT ( TIMER_UNIT_FLOAT * (double)SCHEDULER_CLOCK_PRESCALER ) +#define SCHEDULER_UNIT ( (unsigned long) SCHEDULER_UNIT_FLOAT ) + +#endif /* ! CONFIG_MODULE_SCHEDULER_MANUAL */ + + + +#define SCHEDULER_PERIODICAL 0 +#define SCHEDULER_SINGLE 1 + +#define SCHEDULER_DEFAULT_PRIORITY 128 + + +/** Initialisation of the module */ +void scheduler_init(void); + +/** dump all loaded events */ +void scheduler_dump_events(void); + +/** + * Add an event to the event table. + * Return the id of the event on succes and -1 on error + * You can use static inline funcs below for simpler use. + */ +int8_t scheduler_add_event(uint8_t unicity, void (*f)(void *), void * data, uint16_t period, uint8_t priority); + + +/** + * Add a single event to the event table, specifying the priority + */ +static inline int8_t scheduler_add_single_event_priority(void (*f)(void *), void * data, uint16_t period, uint8_t priority) +{ + return scheduler_add_event(SCHEDULER_SINGLE, f, data, period, priority); +} + +/** + * Add a periodical event to the event table, specifying the priority + */ +static inline int8_t scheduler_add_periodical_event_priority(void (*f)(void *), void * data, uint16_t period, uint8_t priority) +{ + return scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period, priority); +} + +/** + * Add a single event to the event table, with the default priority + */ +static inline int8_t scheduler_add_single_event(void (*f)(void *), void * data, uint16_t period) +{ + return scheduler_add_event(SCHEDULER_SINGLE, f, data, period, SCHEDULER_DEFAULT_PRIORITY); +} + +/** + * Add a periodical event to the event table, with the default priority + */ +static inline int8_t scheduler_add_periodical_event(void (*f)(void *), void * data, uint16_t period) +{ + return scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period, SCHEDULER_DEFAULT_PRIORITY); +} + +/** + * Dels an event from the table by its ID. If there is no event, + * nothing is done. + */ +int8_t scheduler_del_event(int8_t num); + +/** Function called by the interruption. It is public in case of host + * version, because you have to call it by hand. In AVR version, you + * don't have to do anything with this function, it is called + * automatilcally by the timer interruption, except if + * CONFIG_MODULE_SCHEDULER_MANUAL is defined. In this case you have + * to call it manually too. */ +void scheduler_interrupt(void); + +/** + * Temporarily disable scheduler events. You may loose precision in + * events schedule. It returns the current priority of the scheduler. + */ +uint8_t scheduler_disable_save(void); + +/** + * Re-enable scheduler after a call to scheduler_disable_save(). + */ +void scheduler_enable_restore(uint8_t old_prio); + +#endif diff --git a/scheduler_add.c b/scheduler_add.c new file mode 100644 index 0000000..5ce78b3 --- /dev/null +++ b/scheduler_add.c @@ -0,0 +1,81 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_add.c,v 1.1.2.4 2009-11-08 17:33:14 zer0 Exp $ + * + */ + +#include +#include +#include +#include + +/** get a free event, mark it as allocated and return its index, or -1 + * if not found. */ +static inline int8_t +scheduler_alloc_event(void) +{ + uint8_t i; + uint8_t flags; + + for (i=0 ; i +#include +#include +#include + +void scheduler_del_event(int8_t i) +{ + uint8_t flags; + + /* if scheduled, it will be deleted after execution. + * if active, free it. + * else do nothing. */ + IRQ_LOCK(flags); + if (g_tab_event[i].state == SCHEDULER_EVENT_SCHEDULED) { + g_tab_event[i].state = SCHEDULER_EVENT_DELETING; + } + else if (g_tab_event[i].state == SCHEDULER_EVENT_ACTIVE) { + g_tab_event[i].state = SCHEDULER_EVENT_FREE; + } + IRQ_UNLOCK(flags); + SCHED_INC_STAT(del_event); +} diff --git a/scheduler_dump.c b/scheduler_dump.c new file mode 100644 index 0000000..49eddcb --- /dev/null +++ b/scheduler_dump.c @@ -0,0 +1,53 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_dump.c,v 1.1.2.3 2009-05-18 12:30:36 zer0 Exp $ + * + */ + +#include + +#include +#include + +#include +#include + +/** Dump the event structure table */ +void scheduler_dump_events(void) +{ + int i; + + printf_P(PSTR("== Dump events ==\r\n")); + for (i=0 ; i= SCHEDULER_EVENT_ACTIVE ) { + printf_P(PSTR(", f=%p, "), g_tab_event[i].f); + printf_P(PSTR("data=%p, "), g_tab_event[i].data); + printf_P(PSTR("period=%d, "), g_tab_event[i].period); + printf_P(PSTR("current_time=%d, "), g_tab_event[i].current_time); + printf_P(PSTR("priority=%d, "), g_tab_event[i].priority); + printf_P(PSTR("list_next=%p\r\n"), SLIST_NEXT(&g_tab_event[i], next)); + } + else { + printf_P(PSTR("\r\n")); + } + } +} + + diff --git a/scheduler_host.c b/scheduler_host.c new file mode 100644 index 0000000..965007f --- /dev/null +++ b/scheduler_host.c @@ -0,0 +1,47 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_host.c,v 1.5.10.2 2007-03-05 14:41:07 zer0 Exp $ + * + */ + +#include +#include +#include + +#include +#include +#include + +/* this file is compiled for host version only */ + +/** declared in scheduler.c in case of AVR version */ +struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT]; + +#ifdef CONFIG_MODULE_SCHEDULER_STATS +struct scheduler_stats sched_stats; +#endif + +/** init all global data */ +void scheduler_init(void) +{ + memset(g_tab_event, 0, sizeof(g_tab_event)); + printf("Scheduler init (host). Warning, you have to call\n" + "scheduler_interrupt() by yourself on host version\n"); + DUMP_EVENTS(); +} + diff --git a/scheduler_interrupt.c b/scheduler_interrupt.c new file mode 100644 index 0000000..0009883 --- /dev/null +++ b/scheduler_interrupt.c @@ -0,0 +1,203 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_interrupt.c,v 1.1.2.9 2009-11-08 17:33:14 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include + +/** priority of the running event */ +static volatile uint8_t priority_running=0; + +/** number of imbricated scheduler interruptions */ +static volatile uint8_t nb_stacking=0; + +uint8_t scheduler_disable_save(void) +{ + uint8_t ret; + ret = priority_running; + priority_running = 255; + return ret; +} + +void scheduler_enable_restore(uint8_t old_prio) +{ + priority_running = old_prio; +} + +/** + * this function is called from a timer interruption. If an event has + * to be scheduled, it will execute the fonction (IRQ are allowed + * during the execution of the function). This interruption can be + * interrupted by itself too, in this case only events with a higher + * priority can be scheduled. + * + * We assume that this function is called from a SIGNAL(), with + * global interrupt flag disabled --> that's why we can use cli() and + * sei() instead of IRQ_LOCK(flags). + */ +void +scheduler_interrupt(void) +{ + uint8_t i; + uint8_t priority_tmp; + SLIST_HEAD(event_list_t, event_t) event_list; + struct event_t *e, *next_e, *prev_e=NULL; + + /* maximize the number of imbrications */ + if (nb_stacking >= SCHEDULER_NB_STACKING_MAX) { + SCHED_INC_STAT(max_stacking); + return; + } + + nb_stacking ++; + sei(); + + SLIST_INIT(&event_list); + + /* browse events table to determine which events should be + * scheduled */ + for (i=0 ; i 1) { + g_tab_event[i].current_time --; + sei(); + continue; + } + else { + SCHED_INC_STAT2(task_delayed, i); + sei(); + continue; + } + } + + /* nothing to do with other unactive events */ + if (g_tab_event[i].state != SCHEDULER_EVENT_ACTIVE) { + sei(); + continue; + } + + /* decrement current time (we know it is >0 if it is + * in SCHEDULER_EVENT_ACTIVE state */ + g_tab_event[i].current_time --; + + /* don't need to schedule now */ + if ( g_tab_event[i].current_time != 0 ) { + sei(); + continue; + } + + /* time to schedule, but priority is too low, + * delay it */ + if (g_tab_event[i].priority <= priority_running) { + g_tab_event[i].current_time = 1; + SCHED_INC_STAT2(task_delayed, i); + sei(); + continue; + } + + /* reload event (it is 0 if it is non-periodical) */ + g_tab_event[i].current_time = g_tab_event[i].period; + + /* schedule it */ + g_tab_event[i].state = SCHEDULER_EVENT_SCHEDULED; + SCHED_INC_STAT2(task_scheduled, i); + sei(); + + /* insert it in the list (list is ordered). + this should be quite fast since the list is + expected to be small. */ + + e = SLIST_FIRST(&event_list); + /* easy case : list is empty */ + if (e == NULL) { + SLIST_INSERT_HEAD(&event_list, &g_tab_event[i], next); + continue; + } + + /* insert at head if it's the event with highest prio */ + if (g_tab_event[i].priority >= e->priority) { + SLIST_INSERT_HEAD(&event_list, &g_tab_event[i], next); + continue; + } + + /* harder : find the good place in list */ + SLIST_FOREACH(e, &event_list, next) { + next_e = SLIST_NEXT(e, next); + if (next_e == NULL || + g_tab_event[i].priority >= next_e->priority) { + SLIST_INSERT_AFTER(e, &g_tab_event[i], next); + break; + } + } + } + + /* only called if SCHEDULER_DEBUG is defined */ + DUMP_EVENTS(); + + cli(); + priority_tmp = priority_running; + + SLIST_FOREACH(e, &event_list, next) { + /* remove previous elt from list */ + if (prev_e) + SLIST_NEXT(prev_e, next) = NULL; + + /* set running priority */ + priority_running = e->priority; + sei(); + + /* the following fields (f and data) can't be modified + * while an event is in state SCHEDULED */ + e->f(e->data); + + cli(); + /* free it if it is single (non-periodical) */ + if (!e->period) { + e->state = SCHEDULER_EVENT_FREE; + } + + /* free event if someone asked for deletion during + * schedule */ + if (e->state == SCHEDULER_EVENT_DELETING) { + e->state = SCHEDULER_EVENT_FREE; + } + + /* end of schedule, mark it as active */ + if (e->state == SCHEDULER_EVENT_SCHEDULED) { + e->state = SCHEDULER_EVENT_ACTIVE; + } + + prev_e = e; + } + /* remove previous elt from list */ + if (prev_e) + SLIST_NEXT(prev_e, next) = NULL; + + priority_running = priority_tmp; + nb_stacking--; +} diff --git a/scheduler_private.h b/scheduler_private.h new file mode 100644 index 0000000..5d1ff38 --- /dev/null +++ b/scheduler_private.h @@ -0,0 +1,74 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_private.h,v 1.1.2.8 2009-05-18 12:30:36 zer0 Exp $ + * + */ + +#ifndef _SCHEDULER_PRIVATE_H_ +#define _SCHEDULER_PRIVATE_H_ + +/* sanity checks */ +#if _SCHEDULER_CONFIG_VERSION_ != 4 +#warning "You are using an old version of scheduler_config.h file" +#warning "_SCHEDULER_CONFIG_VERSION_ is != 4" +#warning "Look in modules/base/scheduler/config directory to import changes" +#warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK" +#endif + +#include + +#include + +/** state of events */ +enum event_state_t { + SCHEDULER_EVENT_FREE, /**< event is free */ + SCHEDULER_EVENT_ALLOCATED, /**< a place is reserved in the tab */ + SCHEDULER_EVENT_ACTIVE, /**< fields are filled correctly, event can be scheduled */ + SCHEDULER_EVENT_SCHEDULED, /**< event is inserted in a list to be running soon, or is running */ + SCHEDULER_EVENT_DELETING, /**< event is scheduled but we asked to delete it */ +}; + +/** The event structure */ +struct event_t +{ + void (*f)(void *); /**< a pointer to the scheduled function */ + void * data; /**< a pointer to the data parameters */ + uint16_t period; /**< interval between each call */ + uint16_t current_time; /**< time remaining before next call */ + uint8_t priority; /**< if many events occur at the + same time, the first to be executed + will be the one with the highest + value of priority */ + enum event_state_t state; /**< (scheduled, active, allocated, free, deleting) */ + + SLIST_ENTRY(event_t) next; +}; + +extern struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT]; + + +/* define dump_events() if we are in debug mode */ +#ifdef SCHEDULER_DEBUG +#define DUMP_EVENTS() scheduler_dump_events() + +#else /* SCHEDULER_DEBUG */ +#define DUMP_EVENTS() do {} while(0) + +#endif /* SCHEDULER_DEBUG */ + +#endif /* _SCHEDULER_PRIVATE_H_ */ diff --git a/scheduler_stats.c b/scheduler_stats.c new file mode 100644 index 0000000..9848730 --- /dev/null +++ b/scheduler_stats.c @@ -0,0 +1,48 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler.c,v 1.9.4.6 2009-11-08 17:33:14 zer0 Exp $ + * + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +void scheduler_stats_dump(void) +{ +#ifdef CONFIG_MODULE_SCHEDULER_STATS + uint8_t i; + + printf_P(PSTR("alloc_fails: %"PRIu32"\r\n"), sched_stats.alloc_fails); + printf_P(PSTR("add_event: %"PRIu32"\r\n"), sched_stats.add_event); + printf_P(PSTR("del_event: %"PRIu32"\r\n"), sched_stats.del_event); + printf_P(PSTR("max_stacking: %"PRIu32"\r\n"), sched_stats.max_stacking); + for (i=0; i + */ + +#ifndef _SCHEDULER_STATS_H_ +#define _SCHEDULER_STATS_H_ + +#ifdef CONFIG_MODULE_SCHEDULER_STATS +struct scheduler_stats { + uint32_t alloc_fails; + uint32_t add_event; + uint32_t del_event; + uint32_t max_stacking; + uint32_t task_delayed[SCHEDULER_NB_MAX_EVENT]; + uint32_t task_scheduled[SCHEDULER_NB_MAX_EVENT]; +}; + +extern struct scheduler_stats sched_stats; + +#define SCHED_INC_STAT(x) do { \ + uint8_t flags; \ + IRQ_LOCK(flags); \ + sched_stats.x++; \ + IRQ_UNLOCK(flags); \ + } while(0) + +#define SCHED_INC_STAT2(x, i) do { \ + uint8_t flags; \ + IRQ_LOCK(flags); \ + sched_stats.x[i]++; \ + IRQ_UNLOCK(flags); \ + } while(0) + + +#else /* CONFIG_MODULE_SCHEDULER_STATS */ + +#define SCHED_INC_STAT(x) do { } while(0) +#define SCHED_INC_STAT2(x, i) do { } while(0) + +#endif /* CONFIG_MODULE_SCHEDULER_STATS */ + +void scheduler_stats_dump(void); + +#endif /* _SCHEDULER_STATS_H_ */ diff --git a/spi_config.h b/spi_config.h new file mode 100644 index 0000000..76697c3 --- /dev/null +++ b/spi_config.h @@ -0,0 +1,36 @@ +/* + * Copyright Droids Corporation (2008) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * Author : Julien LE GUEN - jlg@jleguen.info + */ + + +/* + * Configure HERE your SPI module + */ + + + +/* Number of slave devices in your system + * Each slave have a dedicated SS line that you have to register + * before using the SPI module + */ +#define SPI_MAX_SLAVES 1 + diff --git a/stack_space.c b/stack_space.c new file mode 100644 index 0000000..158a1a0 --- /dev/null +++ b/stack_space.c @@ -0,0 +1,100 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: stack_space.c,v 1.7.4.3 2008-05-09 08:23:52 zer0 Exp $ + * + */ + +#include +#include + + +#include + + +/** This diagnostical software fills the RAM with a mark, and counts + * how many of these marks are unmodified, in order to avaluate the + * min stack space available after code execution. You can then know + * how much your stack your program needed in a peak, without looking + * espacially when this peak arises. you see the minmal stack space + * left since the reset of the microcontroller. */ + +// call this function at the beginning of program +void fill_mem_with_mark(void) __attribute__ ((naked)) \ +__attribute__ ((section (".init1"))); + + +/** this functions fills the ram with a predefined pattern after a + * reset and BEFORE any other operation */ +void fill_mem_with_mark(void) +{ +/* register int i asm("r16"); */ +/* register int end asm("r18"); */ + + +/* // where is the beginning of the RAM memory ? */ +/* #ifdef DIAG_FILL_ENTIRE_RAM // fill entire RAM */ +/* asm( "ldi r16,lo8(__data_start)" ); */ +/* asm( "ldi r17,hi8(__data_start)" ); */ +/* #else // fill only stack and heap spaces */ +/* asm( "ldi r16,lo8(__heap_start)" ); */ +/* asm( "ldi r17,hi8(__heap_start)" ); */ +/* #endif */ + +/* // end of RAM */ +/* asm( "ldi r18,lo8(__stack)" ); */ +/* asm( "ldi r19,hi8(__stack)" ); */ + +/* // fill ram with the spacified pattern */ +/* for(; i< end ; i++) */ +/* * ( (volatile unsigned char* )(i) ) = MARK; */ + +} + + +uint16_t min_stack_space_available(void) +{ + /* register int i asm("r16"); */ + /* register int end asm("r18"); */ + /* uint16_t count , max; */ + + /* // where is the beginning of the stack space ? */ + /* asm( "ldi r16,lo8(__heap_start)" ); */ + /* asm( "ldi r17,hi8(__heap_start)" ); */ + /* // end of RAM */ + /* asm( "ldi r18,lo8(__stack)" ); */ + /* asm( "ldi r19,hi8(__stack)" ); */ + + /* /\* the algorithm finds the size of the biggest zone filled */ + /* * with the mark, which is normally the stack space left *\/ */ + /* count = 0; */ + /* max = 0; */ + /* for(; i max) */ + /* max = count; */ + /* } */ + /* else */ + /* count = 0; // reset counter */ + /* } */ + + /* return max; */ + return 0; +} diff --git a/stackdump.c b/stackdump.c new file mode 100644 index 0000000..f8c9f70 --- /dev/null +++ b/stackdump.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation (2010) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: trajectory_manager.c,v 1.4.4.17 2009-05-18 12:28:36 zer0 Exp $ + * + */ + +#include +#include + +void stackdump(void) +{ + uint8_t dummy = 0x55; + uint16_t i; + + for (i=0; i<256; i++) { + printf("%.2x%s", *(&dummy + i), + ((i % 16) == 15) ? "\n" : " "); + } +} diff --git a/stackdump.h b/stackdump.h new file mode 100644 index 0000000..d640e0a --- /dev/null +++ b/stackdump.h @@ -0,0 +1,22 @@ +/* + * Copyright Droids Corporation (2010) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: trajectory_manager.c,v 1.4.4.17 2009-05-18 12:28:36 zer0 Exp $ + * + */ + +void stackdump(void); diff --git a/time.c b/time.c new file mode 100644 index 0000000..af38b83 --- /dev/null +++ b/time.c @@ -0,0 +1,161 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: time.c,v 1.4.4.5 2009-04-24 19:26:37 zer0 Exp $ + * + */ + +/* Droids-corp, Eirbot, Microb Technology 2005 - Zer0 + * Implementation of the time module + */ + +/** \file time.c + * \brief Implementation of the TIME module. + * + * + * This module can be used to get a human readable time. It uses the + * scheduler module. Its goal is not to be very precise, but just + * simple to use. + */ + + +/**********************************************************/ + +#include +#include + +#include +#include + +/**********************************************************/ + +#define NB_SCHEDULER_UNIT ( ((float)(TIME_PRECISION)) / SCHEDULER_UNIT_FLOAT ) +#define NB_SCHEDULER_UNIT_NOT_NULL (NB_SCHEDULER_UNIT == 0 ? 1.0 : NB_SCHEDULER_UNIT) + +static volatile time_h t; + +static volatile microseconds us2; // this one overflows naturally + + +void time_increment(void * dummy); + +/**********************************************************/ + +void time_init(uint8_t priority) +{ + time_reset(); + scheduler_add_periodical_event_priority(time_increment,NULL, + (int)NB_SCHEDULER_UNIT_NOT_NULL, priority); +} + +/**********************************************************/ + +seconds time_get_s(void) +{ + uint16_t tmp; + uint8_t flags; + IRQ_LOCK(flags); + tmp = t.s; + IRQ_UNLOCK(flags); + return tmp; +} + +/**********************************************************/ + +microseconds time_get_us(void) +{ + microseconds tmp; + uint8_t flags; + IRQ_LOCK(flags); + tmp = t.us; + IRQ_UNLOCK(flags); + return tmp; +} + +/**********************************************************/ + +microseconds time_get_us2(void) +{ + microseconds tmp; + uint8_t flags; + IRQ_LOCK(flags); + tmp = us2; + IRQ_UNLOCK(flags); + return tmp; +} + +/**********************************************************/ + +time_h time_get_time(void) +{ + time_h tmp; + uint8_t flags; + IRQ_LOCK(flags); + tmp = t; + IRQ_UNLOCK(flags); + return tmp; +} + +/**********************************************************/ + +void time_reset(void) +{ + uint8_t flags; + IRQ_LOCK(flags); + t.us = 0; + t.s = 0; + IRQ_UNLOCK(flags); +} + +/**********************************************************/ + +void time_set(seconds s, microseconds us) +{ + uint8_t flags; + IRQ_LOCK(flags); + t.us = us; + t.s = s; + IRQ_UNLOCK(flags); +} + +/**********************************************************/ + +void time_wait_ms(uint16_t ms) +{ + microseconds old = time_get_us2(); + while (time_get_us2() - old < ms*1000L); +} + +/**********************************************************/ +/* private */ +/**********************************************************/ + +void time_increment(__attribute__((unused)) void * dummy) +{ + uint8_t flags; + /* XXX we should lock only when writing */ + IRQ_LOCK(flags); // for reading correct time inside an interrupt + + us2 += ((int)NB_SCHEDULER_UNIT_NOT_NULL * SCHEDULER_UNIT); + t.us += ((int)NB_SCHEDULER_UNIT_NOT_NULL * SCHEDULER_UNIT); + while (t.us > 1000000) { + t.s ++; + t.us -= 1000000; + } + + IRQ_UNLOCK(flags); +} diff --git a/time_config.h b/time_config.h new file mode 100644 index 0000000..14db608 --- /dev/null +++ b/time_config.h @@ -0,0 +1,23 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: time_config.h,v 1.1 2009-02-20 21:10:01 zer0 Exp $ + * + */ + +/** precision of the time processor, in us */ +#define TIME_PRECISION 25000l diff --git a/timer.h b/timer.h new file mode 100644 index 0000000..daab02d --- /dev/null +++ b/timer.h @@ -0,0 +1,83 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer.h,v 1.1.2.4 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +/** + * Olivier MATZ - Droids-corp 2006 + * + * \brief Interface of the timer module + * + * The objective of this module is to provide a simple and portable + * interface to the hardware timers of AVR devices. + */ + +#ifndef _TIMER_H_ +#define _TIMER_H_ + +#include + +#include +#include +#include +#include + +#include + + +/** Init of all timers with static configutaion (see timer_config.h) */ +void timer_init(void); + +/* declare all timer functions (see timer_declarations.h) */ + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DECLARE_TIMER_FUNCS(0) +#endif + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DECLARE_TIMER_FUNCS(1) +#endif + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DECLARE_TIMER_FUNCS(2) +#endif + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DECLARE_TIMER_FUNCS(3) +#endif + +/* define static inline functions (see timer_definitions.h) */ + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DEFINE_TIMER_US_CONVERSIONS(0) +#endif + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DEFINE_TIMER_US_CONVERSIONS(1) +#endif + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DEFINE_TIMER_US_CONVERSIONS(2) +#endif + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DEFINE_TIMER_US_CONVERSIONS(3) +#endif + +#endif diff --git a/timer0_getset.c b/timer0_getset.c new file mode 100644 index 0000000..74798fe --- /dev/null +++ b/timer0_getset.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_getset.c,v 1.1.2.2 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DEFINE_TIMER_GET_SET(0) +#endif + diff --git a/timer0_prescaler.c b/timer0_prescaler.c new file mode 100644 index 0000000..7a63042 --- /dev/null +++ b/timer0_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright Droids-corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_prescaler.c,v 1.1.2.3 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(0) +#endif + +#else + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(0) +#endif + +#endif + diff --git a/timer0_register_OC_at_tics.c b/timer0_register_OC_at_tics.c new file mode 100644 index 0000000..873b23e --- /dev/null +++ b/timer0_register_OC_at_tics.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_register_OC_at_tics.c,v 1.1.2.3 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0 +DEFINE_REGISTER_OC_INTR_AT_TICS(0) +#endif + +#if defined TIMER0A_ENABLED && defined SIG_OUTPUT_COMPARE0A +DEFINE_REGISTER_OC_INTR_AT_TICS(0A) +#endif + +#if defined TIMER0B_ENABLED && defined SIG_OUTPUT_COMPARE0B +DEFINE_REGISTER_OC_INTR_AT_TICS(0B) +#endif + diff --git a/timer0_register_OC_in_us.c b/timer0_register_OC_in_us.c new file mode 100644 index 0000000..95c37f4 --- /dev/null +++ b/timer0_register_OC_in_us.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_register_OC_in_us.c,v 1.1.2.3 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0 +DEFINE_REGISTER_OC_INTR_IN_US(0,0) +#endif + +#if defined TIMER0A_ENABLED && defined SIG_OUTPUT_COMPARE0A +DEFINE_REGISTER_OC_INTR_IN_US(0,0A) +#endif + +#if defined TIMER0B_ENABLED && defined SIG_OUTPUT_COMPARE0B +DEFINE_REGISTER_OC_INTR_IN_US(0,0B) +#endif + diff --git a/timer0_register_OV.c b/timer0_register_OV.c new file mode 100644 index 0000000..2482ca9 --- /dev/null +++ b/timer0_register_OV.c @@ -0,0 +1,37 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_register_OV.c,v 1.1.2.2 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#if defined TIMER0_ENABLED && defined SIG_OVERFLOW0 +DEFINE_REGISTER_OV_INTR(0) +#endif + diff --git a/timer0_startstop.c b/timer0_startstop.c new file mode 100644 index 0000000..5cf0a3a --- /dev/null +++ b/timer0_startstop.c @@ -0,0 +1,36 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer0_startstop.c,v 1.1.2.2 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE +DEFINE_TIMER_START_STOP(0) +#endif + diff --git a/timer1_getset.c b/timer1_getset.c new file mode 100644 index 0000000..2f7d0e9 --- /dev/null +++ b/timer1_getset.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_getset.c,v 1.1.2.2 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DEFINE_TIMER_GET_SET(1) +#endif + diff --git a/timer1_prescaler.c b/timer1_prescaler.c new file mode 100644 index 0000000..157e301 --- /dev/null +++ b/timer1_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright DroidsDEFINE_STATIC_CONVERSIONS_FUNCSion, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_prescaler.c,v 1.1.2.2 2007-05-23 17:18:14 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(1) +#endif + +#else + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(1) +#endif + +#endif + diff --git a/timer1_register_OC_at_tics.c b/timer1_register_OC_at_tics.c new file mode 100644 index 0000000..f9570ce --- /dev/null +++ b/timer1_register_OC_at_tics.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_register_OC_at_tics.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A +DEFINE_REGISTER_OC_INTR_AT_TICS(1A) +#endif + +#if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B +DEFINE_REGISTER_OC_INTR_AT_TICS(1B) +#endif + +#if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C +DEFINE_REGISTER_OC_INTR_AT_TICS(1C) +#endif + diff --git a/timer1_register_OC_in_us.c b/timer1_register_OC_in_us.c new file mode 100644 index 0000000..d1927fb --- /dev/null +++ b/timer1_register_OC_in_us.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_register_OC_in_us.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A +DEFINE_REGISTER_OC_INTR_IN_US(1,1A) +#endif + +#if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B +DEFINE_REGISTER_OC_INTR_IN_US(1,1B) +#endif + +#if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C +DEFINE_REGISTER_OC_INTR_IN_US(1,1C) +#endif + diff --git a/timer1_register_OV.c b/timer1_register_OV.c new file mode 100644 index 0000000..338e9f8 --- /dev/null +++ b/timer1_register_OV.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_register_OV.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER1_ENABLED && defined SIG_OVERFLOW1 +DEFINE_REGISTER_OV_INTR(1) +#endif + diff --git a/timer1_startstop.c b/timer1_startstop.c new file mode 100644 index 0000000..7c8bf39 --- /dev/null +++ b/timer1_startstop.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer1_startstop.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE +DEFINE_TIMER_START_STOP(1) +#endif + diff --git a/timer2_getset.c b/timer2_getset.c new file mode 100644 index 0000000..191a712 --- /dev/null +++ b/timer2_getset.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_getset.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DEFINE_TIMER_GET_SET(2) +#endif + diff --git a/timer2_prescaler.c b/timer2_prescaler.c new file mode 100644 index 0000000..0613e0a --- /dev/null +++ b/timer2_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright DroidsDEFINE_STATIC_CONVERSIONS_FUNCSion, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_prescaler.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(2) +#endif + +#else + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(2) +#endif + +#endif + diff --git a/timer2_register_OC_at_tics.c b/timer2_register_OC_at_tics.c new file mode 100644 index 0000000..c0ea1be --- /dev/null +++ b/timer2_register_OC_at_tics.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_register_OC_at_tics.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2 +DEFINE_REGISTER_OC_INTR_AT_TICS(2) +#endif + diff --git a/timer2_register_OC_in_us.c b/timer2_register_OC_in_us.c new file mode 100644 index 0000000..de25fa0 --- /dev/null +++ b/timer2_register_OC_in_us.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_register_OC_in_us.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2 +DEFINE_REGISTER_OC_INTR_IN_US(2,2) +#endif + diff --git a/timer2_register_OV.c b/timer2_register_OV.c new file mode 100644 index 0000000..11429a4 --- /dev/null +++ b/timer2_register_OV.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_register_OV.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER2_ENABLED && defined SIG_OVERFLOW2 +DEFINE_REGISTER_OV_INTR(2) +#endif + diff --git a/timer2_startstop.c b/timer2_startstop.c new file mode 100644 index 0000000..aadc2e3 --- /dev/null +++ b/timer2_startstop.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer2_startstop.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE +DEFINE_TIMER_START_STOP(2) +#endif + diff --git a/timer3_getset.c b/timer3_getset.c new file mode 100644 index 0000000..80f52df --- /dev/null +++ b/timer3_getset.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_getset.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DEFINE_TIMER_GET_SET(3) +#endif + diff --git a/timer3_prescaler.c b/timer3_prescaler.c new file mode 100644 index 0000000..215b88a --- /dev/null +++ b/timer3_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright DroidsDEFINE_STATIC_CONVERSIONS_FUNCSion, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_prescaler.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(3) +#endif + +#else + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(3) +#endif + +#endif + diff --git a/timer3_register_OC_at_tics.c b/timer3_register_OC_at_tics.c new file mode 100644 index 0000000..03d7374 --- /dev/null +++ b/timer3_register_OC_at_tics.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_register_OC_at_tics.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A +DEFINE_REGISTER_OC_INTR_AT_TICS(3A) +#endif + +#if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B +DEFINE_REGISTER_OC_INTR_AT_TICS(3B) +#endif + +#if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C +DEFINE_REGISTER_OC_INTR_AT_TICS(3C) +#endif + diff --git a/timer3_register_OC_in_us.c b/timer3_register_OC_in_us.c new file mode 100644 index 0000000..f2f6c4e --- /dev/null +++ b/timer3_register_OC_in_us.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_register_OC_in_us.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A +DEFINE_REGISTER_OC_INTR_IN_US(3,3A) +#endif + +#if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B +DEFINE_REGISTER_OC_INTR_IN_US(3,3B) +#endif + +#if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C +DEFINE_REGISTER_OC_INTR_IN_US(3,3C) +#endif + diff --git a/timer3_register_OV.c b/timer3_register_OV.c new file mode 100644 index 0000000..9aef3bf --- /dev/null +++ b/timer3_register_OV.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_register_OV.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER3_ENABLED && defined SIG_OVERFLOW3 +DEFINE_REGISTER_OV_INTR(3) +#endif + diff --git a/timer3_startstop.c b/timer3_startstop.c new file mode 100644 index 0000000..fa09472 --- /dev/null +++ b/timer3_startstop.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer3_startstop.c,v 1.1.2.2 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE +DEFINE_TIMER_START_STOP(3) +#endif + diff --git a/timer4_getset.c b/timer4_getset.c new file mode 100644 index 0000000..b8bce6c --- /dev/null +++ b/timer4_getset.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_getset.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +#if defined TIMER4_ENABLED && defined TIMER4_AVAILABLE +DEFINE_TIMER_GET_SET(4) +#endif + diff --git a/timer4_prescaler.c b/timer4_prescaler.c new file mode 100644 index 0000000..eb76435 --- /dev/null +++ b/timer4_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright DroidsDEFINE_STATIC_CONVERSIONS_FUNCSion, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_prescaler.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER4_ENABLED && defined TIMER4_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(4) +#endif + +#else + +#if defined TIMER4_ENABLED && defined TIMER4_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(4) +#endif + +#endif + diff --git a/timer4_register_OC_at_tics.c b/timer4_register_OC_at_tics.c new file mode 100644 index 0000000..b90ada1 --- /dev/null +++ b/timer4_register_OC_at_tics.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_register_OC_at_tics.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A +DEFINE_REGISTER_OC_INTR_AT_TICS(4A) +#endif + +#if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B +DEFINE_REGISTER_OC_INTR_AT_TICS(4B) +#endif + +#if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C +DEFINE_REGISTER_OC_INTR_AT_TICS(4C) +#endif + diff --git a/timer4_register_OC_in_us.c b/timer4_register_OC_in_us.c new file mode 100644 index 0000000..4e9da47 --- /dev/null +++ b/timer4_register_OC_in_us.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_register_OC_in_us.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A +DEFINE_REGISTER_OC_INTR_IN_US(4,4A) +#endif + +#if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B +DEFINE_REGISTER_OC_INTR_IN_US(4,4B) +#endif + +#if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C +DEFINE_REGISTER_OC_INTR_IN_US(4,4C) +#endif + diff --git a/timer4_register_OV.c b/timer4_register_OV.c new file mode 100644 index 0000000..59c2a9a --- /dev/null +++ b/timer4_register_OV.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_register_OV.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER4_ENABLED && defined SIG_OVERFLOW4 +DEFINE_REGISTER_OV_INTR(4) +#endif + diff --git a/timer4_startstop.c b/timer4_startstop.c new file mode 100644 index 0000000..2fc7363 --- /dev/null +++ b/timer4_startstop.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer4_startstop.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined TIMER4_ENABLED && defined TIMER4_AVAILABLE +DEFINE_TIMER_START_STOP(4) +#endif + diff --git a/timer5_getset.c b/timer5_getset.c new file mode 100644 index 0000000..3dfca45 --- /dev/null +++ b/timer5_getset.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_getset.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +#if defined TIMER5_ENABLED && defined TIMER5_AVAILABLE +DEFINE_TIMER_GET_SET(5) +#endif + diff --git a/timer5_prescaler.c b/timer5_prescaler.c new file mode 100644 index 0000000..1eac865 --- /dev/null +++ b/timer5_prescaler.c @@ -0,0 +1,48 @@ +/* + * Copyright DroidsDEFINE_STATIC_CONVERSIONS_FUNCSion, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_prescaler.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + + +#ifdef CONFIG_MODULE_TIMER_DYNAMIC + +#if defined TIMER5_ENABLED && defined TIMER5_AVAILABLE +DEFINE_DYNAMIC_PRESCALER_FUNCS(5) +#endif + +#else + +#if defined TIMER5_ENABLED && defined TIMER5_AVAILABLE +DEFINE_STATIC_PRESCALER_FUNCS(5) +#endif + +#endif + diff --git a/timer5_register_OC_at_tics.c b/timer5_register_OC_at_tics.c new file mode 100644 index 0000000..d6069d2 --- /dev/null +++ b/timer5_register_OC_at_tics.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_register_OC_at_tics.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A +DEFINE_REGISTER_OC_INTR_AT_TICS(5A) +#endif + +#if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B +DEFINE_REGISTER_OC_INTR_AT_TICS(5B) +#endif + +#if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C +DEFINE_REGISTER_OC_INTR_AT_TICS(5C) +#endif + diff --git a/timer5_register_OC_in_us.c b/timer5_register_OC_in_us.c new file mode 100644 index 0000000..d551d2a --- /dev/null +++ b/timer5_register_OC_in_us.c @@ -0,0 +1,46 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_register_OC_in_us.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A +DEFINE_REGISTER_OC_INTR_IN_US(5,5A) +#endif + +#if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B +DEFINE_REGISTER_OC_INTR_IN_US(5,5B) +#endif + +#if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C +DEFINE_REGISTER_OC_INTR_IN_US(5,5C) +#endif + diff --git a/timer5_register_OV.c b/timer5_register_OV.c new file mode 100644 index 0000000..1ab7791 --- /dev/null +++ b/timer5_register_OV.c @@ -0,0 +1,38 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_register_OV.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#if defined TIMER5_ENABLED && defined SIG_OVERFLOW5 +DEFINE_REGISTER_OV_INTR(5) +#endif + diff --git a/timer5_startstop.c b/timer5_startstop.c new file mode 100644 index 0000000..58f6722 --- /dev/null +++ b/timer5_startstop.c @@ -0,0 +1,35 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer5_startstop.c,v 1.1.2.1 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined TIMER5_ENABLED && defined TIMER5_AVAILABLE +DEFINE_TIMER_START_STOP(5) +#endif + diff --git a/timer_conf_check.c b/timer_conf_check.c new file mode 100644 index 0000000..12ecf46 --- /dev/null +++ b/timer_conf_check.c @@ -0,0 +1,493 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_conf_check.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include +#include + +#include +#include +#include + +#include + + +#if defined TIMER0_ENABLED && ! defined TIMER0_AVAILABLE +#error This arch has no TIMER0 +#endif + +#if defined TIMER1_ENABLED && ! defined TIMER1_AVAILABLE +#error This arch has no TIMER1 +#endif + +#if defined TIMER2_ENABLED && ! defined TIMER2_AVAILABLE +#error This arch has no TIMER2 +#endif + +#if defined TIMER3_ENABLED && ! defined TIMER3_AVAILABLE +#error This arch has no TIMER3 +#endif + +#if defined TIMER4_ENABLED && ! defined TIMER4_AVAILABLE +#error This arch has no TIMER4 +#endif + +#if defined TIMER5_ENABLED && ! defined TIMER5_AVAILABLE +#error This arch has no TIMER5 +#endif + + +#if defined TIMER0_ENABLED + +#if defined TIMER0_PRESCALER_REG_0 && TIMER0_PRESCALER_REG_0 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_1 && TIMER0_PRESCALER_REG_1 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_2 && TIMER0_PRESCALER_REG_2 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_3 && TIMER0_PRESCALER_REG_3 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_4 && TIMER0_PRESCALER_REG_4 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_5 && TIMER0_PRESCALER_REG_5 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_6 && TIMER0_PRESCALER_REG_6 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_7 && TIMER0_PRESCALER_REG_7 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_8 && TIMER0_PRESCALER_REG_8 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_9 && TIMER0_PRESCALER_REG_9 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_10 && TIMER0_PRESCALER_REG_10 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_11 && TIMER0_PRESCALER_REG_11 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_12 && TIMER0_PRESCALER_REG_12 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_13 && TIMER0_PRESCALER_REG_13 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_14 && TIMER0_PRESCALER_REG_14 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#if defined TIMER0_PRESCALER_REG_15 && TIMER0_PRESCALER_REG_15 == TIMER0_PRESCALER_DIV +#define TIMER0_CONF_OK +#endif + +#ifndef TIMER0_CONF_OK +#error TIMER0 has a bad prescaler value +#endif + +#endif + + + +#if defined TIMER1_ENABLED + +#if defined TIMER1_PRESCALER_REG_0 && TIMER1_PRESCALER_REG_0 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_1 && TIMER1_PRESCALER_REG_1 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_2 && TIMER1_PRESCALER_REG_2 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_3 && TIMER1_PRESCALER_REG_3 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_4 && TIMER1_PRESCALER_REG_4 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_5 && TIMER1_PRESCALER_REG_5 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_6 && TIMER1_PRESCALER_REG_6 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_7 && TIMER1_PRESCALER_REG_7 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_8 && TIMER1_PRESCALER_REG_8 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_9 && TIMER1_PRESCALER_REG_9 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_10 && TIMER1_PRESCALER_REG_10 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_11 && TIMER1_PRESCALER_REG_11 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_12 && TIMER1_PRESCALER_REG_12 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_13 && TIMER1_PRESCALER_REG_13 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_14 && TIMER1_PRESCALER_REG_14 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#if defined TIMER1_PRESCALER_REG_15 && TIMER1_PRESCALER_REG_15 == TIMER1_PRESCALER_DIV +#define TIMER1_CONF_OK +#endif + +#ifndef TIMER1_CONF_OK +#error TIMER1 has a bad prescaler value +#endif + +#endif + + +#if defined TIMER2_ENABLED + +#if defined TIMER2_PRESCALER_REG_0 && TIMER2_PRESCALER_REG_0 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_1 && TIMER2_PRESCALER_REG_1 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_2 && TIMER2_PRESCALER_REG_2 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_3 && TIMER2_PRESCALER_REG_3 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_4 && TIMER2_PRESCALER_REG_4 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_5 && TIMER2_PRESCALER_REG_5 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_6 && TIMER2_PRESCALER_REG_6 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_7 && TIMER2_PRESCALER_REG_7 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_8 && TIMER2_PRESCALER_REG_8 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_9 && TIMER2_PRESCALER_REG_9 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_10 && TIMER2_PRESCALER_REG_10 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_11 && TIMER2_PRESCALER_REG_11 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_12 && TIMER2_PRESCALER_REG_12 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_13 && TIMER2_PRESCALER_REG_13 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_14 && TIMER2_PRESCALER_REG_14 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#if defined TIMER2_PRESCALER_REG_15 && TIMER2_PRESCALER_REG_15 == TIMER2_PRESCALER_DIV +#define TIMER2_CONF_OK +#endif + +#ifndef TIMER2_CONF_OK +#error TIMER2 has a bad prescaler value +#endif + +#endif + + +#if defined TIMER3_ENABLED + +#if defined TIMER3_PRESCALER_REG_0 && TIMER3_PRESCALER_REG_0 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_1 && TIMER3_PRESCALER_REG_1 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_2 && TIMER3_PRESCALER_REG_2 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_3 && TIMER3_PRESCALER_REG_3 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_4 && TIMER3_PRESCALER_REG_4 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_5 && TIMER3_PRESCALER_REG_5 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_6 && TIMER3_PRESCALER_REG_6 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_7 && TIMER3_PRESCALER_REG_7 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_8 && TIMER3_PRESCALER_REG_8 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_9 && TIMER3_PRESCALER_REG_9 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_10 && TIMER3_PRESCALER_REG_10 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_11 && TIMER3_PRESCALER_REG_11 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_12 && TIMER3_PRESCALER_REG_12 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_13 && TIMER3_PRESCALER_REG_13 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_14 && TIMER3_PRESCALER_REG_14 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#if defined TIMER3_PRESCALER_REG_15 && TIMER3_PRESCALER_REG_15 == TIMER3_PRESCALER_DIV +#define TIMER3_CONF_OK +#endif + +#ifndef TIMER3_CONF_OK +#error TIMER3 has a bad prescaler value +#endif + +#endif + +#if defined TIMER4_ENABLED + +#if defined TIMER4_PRESCALER_REG_0 && TIMER4_PRESCALER_REG_0 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_1 && TIMER4_PRESCALER_REG_1 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_2 && TIMER4_PRESCALER_REG_2 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_3 && TIMER4_PRESCALER_REG_3 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_4 && TIMER4_PRESCALER_REG_4 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_5 && TIMER4_PRESCALER_REG_5 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_6 && TIMER4_PRESCALER_REG_6 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_7 && TIMER4_PRESCALER_REG_7 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_8 && TIMER4_PRESCALER_REG_8 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_9 && TIMER4_PRESCALER_REG_9 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_10 && TIMER4_PRESCALER_REG_10 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_11 && TIMER4_PRESCALER_REG_11 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_12 && TIMER4_PRESCALER_REG_12 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_13 && TIMER4_PRESCALER_REG_13 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_14 && TIMER4_PRESCALER_REG_14 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#if defined TIMER4_PRESCALER_REG_15 && TIMER4_PRESCALER_REG_15 == TIMER4_PRESCALER_DIV +#define TIMER4_CONF_OK +#endif + +#ifndef TIMER4_CONF_OK +#error TIMER4 has a bad prescaler value +#endif + +#endif + +#if defined TIMER5_ENABLED + +#if defined TIMER5_PRESCALER_REG_0 && TIMER5_PRESCALER_REG_0 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_1 && TIMER5_PRESCALER_REG_1 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_2 && TIMER5_PRESCALER_REG_2 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_3 && TIMER5_PRESCALER_REG_3 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_4 && TIMER5_PRESCALER_REG_4 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_5 && TIMER5_PRESCALER_REG_5 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_6 && TIMER5_PRESCALER_REG_6 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_7 && TIMER5_PRESCALER_REG_7 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_8 && TIMER5_PRESCALER_REG_8 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_9 && TIMER5_PRESCALER_REG_9 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_10 && TIMER5_PRESCALER_REG_10 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_11 && TIMER5_PRESCALER_REG_11 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_12 && TIMER5_PRESCALER_REG_12 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_13 && TIMER5_PRESCALER_REG_13 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_14 && TIMER5_PRESCALER_REG_14 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#if defined TIMER5_PRESCALER_REG_15 && TIMER5_PRESCALER_REG_15 == TIMER5_PRESCALER_DIV +#define TIMER5_CONF_OK +#endif + +#ifndef TIMER5_CONF_OK +#error TIMER5 has a bad prescaler value +#endif + +#endif + diff --git a/timer_config.h b/timer_config.h new file mode 100644 index 0000000..47d9f18 --- /dev/null +++ b/timer_config.h @@ -0,0 +1,36 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_config.h,v 1.1 2009-02-20 21:10:01 zer0 Exp $ + * + */ + +#define TIMER0_ENABLED + +/* #define TIMER1_ENABLED */ +/* #define TIMER1A_ENABLED */ +/* #define TIMER1B_ENABLED */ +/* #define TIMER1C_ENABLED */ + +/* #define TIMER2_ENABLED */ + +/* #define TIMER3_ENABLED */ +/* #define TIMER3A_ENABLED */ +/* #define TIMER3B_ENABLED */ +/* #define TIMER3C_ENABLED */ + +#define TIMER0_PRESCALER_DIV 8 diff --git a/timer_declarations.h b/timer_declarations.h new file mode 100644 index 0000000..e3de549 --- /dev/null +++ b/timer_declarations.h @@ -0,0 +1,94 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_declarations.h,v 1.1.2.2 2006-12-04 23:48:22 zer0 Exp $ + * + */ + +#ifndef _TIMER_DECLARATIONS_H +#define _TIMER_DECLARATIONS_H_ + +#define DECLARE_TIMER_FUNCS(x) \ + \ +/** start the timer at initial prescaler */ \ +void timer##x##_start(void); \ + \ +/** stop the timer */ \ +void timer##x##_stop(void); \ + \ +/** Set the timer value */ \ +void timer##x##_set(uint16_t t); \ + \ +/** return the value of the timer */ \ +uint16_t timer##x##_get(void); \ + \ + \ +/** Enable overflow interruption, and register a function to be called */ \ +/* every interrupt. If func is NULL, unregisters interrupt. */ \ +void timer##x##_register_OV_intr(void (*func)(void)); \ + \ +/** Enable output compare interruption, and register a function to be */ \ +/* called every output compare interrupt. Note that interruption */ \ +/* will occur when the timer will reach the same value than t. If */ \ +/* func is NULL, unregisters interrupt (other arg is useless). */ \ +void timer##x##A_register_OC_intr_at_tics(void (*func)(void), uint16_t t); \ +void timer##x##B_register_OC_intr_at_tics(void (*func)(void), uint16_t t); \ +void timer##x##C_register_OC_intr_at_tics(void (*func)(void), uint16_t t); \ + \ +/** Enable output compare interruption, and register a function to be */ \ +/* called every output compare interrupt. Note that interruption */ \ +/* will occur when the timer will reach CURRENT_TIMER + t_us */ \ +/* (parameter is in microseconds). If func is NULL, unregisters */ \ +/* interrupt (other arg is useless). return 0 on success */ \ +/* WARNING : this function can be slower due to float conversion */ \ +/* If you are in static timer mode (no dynamic modifications of */ \ +/* the prescaler), and if your value is a constant, you should use */ \ +/* a code like this to allow beeing optmized by the preprocessor: */ \ +/* timerxy_register_OC_intr_in_tics(timerx_us_to_tics(1000)); */ \ +/* Indeed this code is optimized. In any case, it is better to */ \ +/* them in 2 separated funcs, because you can save the result of */ \ +/* timerx_us_to_tics() in a variable. */ \ +int8_t timer##x##A_register_OC_intr_in_us(void (*func)(void), uint16_t t); \ +int8_t timer##x##B_register_OC_intr_in_us(void (*func)(void), uint16_t t); \ +int8_t timer##x##C_register_OC_intr_in_us(void (*func)(void), uint16_t t); \ + \ +/** Return current prescaler divisor. If CONFIG_MODULE_TIMER_DYNAMIC */ \ +/* is not defined, it only returns TIMERX_PRESCALER specified in */ \ +/* configuration. If you use a dynamic configuration, it reads the */ \ +/* current prescaler register value and converts it to divisor */ \ +/* value. */ \ +uint16_t timer##x##_get_prescaler_div(void); \ + \ +/** Configure the prescaler register depending on divisor param. */ \ +/* only defined if CONFIG_MODULE_TIMER_DYNAMIC is 'y' */ \ +void timer##x##_set_prescaler_div(uint16_t); \ + \ +/** Use timerX_get_prescaler_div() and CONFIG_QUARTZ to do the */ \ +/* conversion from microseconds to tics (timer unit) */ \ +/* Be carreful, this function is inline static, so if you use it */ \ +/* quite often, you should include it in a standard function and call */ \ +/* this function instead */ \ +static inline float timer##x##_us_to_tics(float us); \ + \ +/** Use timerX_get_prescaler_div() and CONFIG_QUARTZ to do the */ \ +/* conversion from tics to microseconds */ \ +/* Be carreful, this function is inline static, so if you use it */ \ +/* quite often, you should include it in a standard function and call */ \ +/* this function instead */ \ +static inline float timer##x##_tics_to_us(float t); + +#endif diff --git a/timer_definitions.h b/timer_definitions.h new file mode 100644 index 0000000..c399271 --- /dev/null +++ b/timer_definitions.h @@ -0,0 +1,190 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_definitions.h,v 1.1.2.5 2009-04-07 20:00:46 zer0 Exp $ + * + */ + +#ifndef _TIMER_DEFINITIONS_H_ +#define _TIMER_DEFINITIONS_H_ + +/* needed by nearly all .c */ +#include + +#define DEFINE_TIMER_START_STOP(x) \ + \ +/** start the timer */ \ +void timer##x##_start(void) \ +{ \ + TCNT##x = 0; \ + CS##x##0_REG = __timer##x##_div_to_reg(TIMER##x##_PRESCALER_DIV) << CS##x##0 ; \ +} \ + \ +/** stop the timer */ \ +void timer##x##_stop(void) \ +{ \ + CS##x##0_REG = 0; \ + TCNT##x = 0; \ +} + + + +#define DEFINE_TIMER_GET_SET(x) \ + \ +uint16_t timer##x##_get(void) \ +{ \ + return TCNT##x ; \ +} \ + \ +void timer##x##_set(uint16_t t) \ +{ \ + TCNT##x = t; \ +} + + +#define DEFINE_OV_INTR(x) \ +SIGNAL(x) \ +{ \ + if(timer_OV_callback_table[x##_NUM]) \ + timer_OV_callback_table[x##_NUM](); \ +} + + +#define DEFINE_OC_INTR(x) \ +SIGNAL(x) \ +{ \ + if(timer_OC_callback_table[x##_NUM]) \ + timer_OC_callback_table[x##_NUM](); \ +} + + +#define DEFINE_REGISTER_OV_INTR(x) \ + \ +void timer##x##_register_OV_intr(void (*func)(void)) \ +{ \ + uint8_t flags; \ + \ + IRQ_LOCK(flags); \ + timer_OV_callback_table[SIG_OVERFLOW##x##_NUM] = func; \ + if (func) { \ + TOIE##x##_REG |= (1< 0xFFFF ) { /* XXX use MAX_TIMER */ \ + IRQ_UNLOCK(flags); \ + return -1; \ + } \ + \ + OCR##y = TCNT##x + tics; \ + timer_OC_callback_table[SIG_OUTPUT_COMPARE##y##_NUM] = func; \ + OCIE##y##_REG |= (1<> CS##x##0); \ +} \ + \ +void timer##x##_set_prescaler_div(uint16_t div) \ +{ \ + CS##x##0_REG = __timer##x##_div_to_reg(div) << CS##x##0 ; \ +} + + +#define DEFINE_STATIC_PRESCALER_FUNCS(x) \ + \ +int16_t timer##x##_div_to_reg(__attribute__((unused)) uint16_t div) \ +{ \ + return __timer##x##_div_to_reg(TIMER##x##_PRESCALER_DIV); \ +} \ + \ +uint16_t timer##x##_get_prescaler_div(void) \ +{ \ + return TIMER##x##_PRESCALER_DIV; \ +} + +#define DEFINE_TIMER_US_CONVERSIONS(x) \ + \ +static inline float timer##x##_us_to_tics(float us) \ +{ \ + return ((float)CONFIG_QUARTZ / \ + ((float)MHz * timer##x##_get_prescaler_div()) ) * us; \ +} \ + \ +static inline float timer##x##_tics_to_us(float t) \ +{ \ + return t / ((float)CONFIG_QUARTZ / \ + ((float)MHz * timer##x##_get_prescaler_div()) ); \ +} + +#endif diff --git a/timer_host.c b/timer_host.c new file mode 100644 index 0000000..c9ee86f --- /dev/null +++ b/timer_host.c @@ -0,0 +1,24 @@ +/* + * Copyright Droids Corporation, Microb Technology, (2010) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_init.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +void timer_init(void) +{ +} diff --git a/timer_init.c b/timer_init.c new file mode 100644 index 0000000..ddc7d08 --- /dev/null +++ b/timer_init.c @@ -0,0 +1,64 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_init.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +/** Init of all timers with static configutaion (see timer_config.h) */ +void timer_init(void) +{ + uint8_t flags; + + IRQ_LOCK(flags); + timer_intr_init(); + +#if defined TIMER0_ENABLED && defined TIMER0_AVAILABLE + CS00_REG = __timer0_div_to_reg(TIMER0_PRESCALER_DIV) << CS00 ; + TCNT0 = 0; +#endif +#if defined TIMER1_ENABLED && defined TIMER1_AVAILABLE + CS10_REG = __timer1_div_to_reg(TIMER1_PRESCALER_DIV) << CS10 ; + TCNT1 = 0; +#endif +#if defined TIMER2_ENABLED && defined TIMER2_AVAILABLE + CS20_REG = __timer2_div_to_reg(TIMER2_PRESCALER_DIV) << CS20 ; + TCNT2 = 0; +#endif +#if defined TIMER3_ENABLED && defined TIMER3_AVAILABLE + CS30_REG = __timer3_div_to_reg(TIMER3_PRESCALER_DIV) << CS30 ; + TCNT3 = 0; +#endif +#if defined TIMER4_ENABLED && defined TIMER4_AVAILABLE + CS40_REG = __timer4_div_to_reg(TIMER4_PRESCALER_DIV) << CS40 ; + TCNT4 = 0; +#endif +#if defined TIMER5_ENABLED && defined TIMER5_AVAILABLE + CS50_REG = __timer5_div_to_reg(TIMER5_PRESCALER_DIV) << CS50 ; + TCNT5 = 0; +#endif + IRQ_UNLOCK(flags); +} diff --git a/timer_intr.c b/timer_intr.c new file mode 100644 index 0000000..def10ab --- /dev/null +++ b/timer_intr.c @@ -0,0 +1,154 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_intr.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +volatile timer_callback_t timer_OV_callback_table[SIG_OVERFLOW_TOTAL_NUM]; +volatile timer_callback_t timer_OC_callback_table[SIG_OUTPUT_COMPARE_TOTAL_NUM]; + +/*************************/ + +#if defined TIMER0_ENABLED && defined SIG_OVERFLOW0 +DEFINE_OV_INTR(SIG_OVERFLOW0) +#endif + +#if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0 +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0) +#endif + +#if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0A) +#endif + +#if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0B) +#endif + +/*************************/ + +#if defined TIMER1_ENABLED && defined SIG_OVERFLOW1 +DEFINE_OV_INTR(SIG_OVERFLOW1) +#endif + +#if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1A) +#endif + +#if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1B) +#endif + +#if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1C) +#endif + +/*************************/ + +#if defined TIMER2_ENABLED && defined SIG_OVERFLOW2 +DEFINE_OV_INTR(SIG_OVERFLOW2) +#endif + +#if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2 +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2) +#endif + +#if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2A) +#endif + +#if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2B) +#endif + +/*************************/ + +#if defined TIMER3_ENABLED && defined SIG_OVERFLOW3 +DEFINE_OV_INTR(SIG_OVERFLOW3) +#endif + +#if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3A) +#endif + +#if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3B) +#endif + +#if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3C) +#endif + +/*************************/ + +#if defined TIMER4_ENABLED && defined SIG_OVERFLOW4 +DEFINE_OV_INTR(SIG_OVERFLOW4) +#endif + +#if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4A) +#endif + +#if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4B) +#endif + +#if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4C) +#endif + +/*************************/ + +#if defined TIMER5_ENABLED && defined SIG_OVERFLOW5 +DEFINE_OV_INTR(SIG_OVERFLOW5) +#endif + +#if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5A) +#endif + +#if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5B) +#endif + +#if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C +DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5C) +#endif + +/*************************/ + +void timer_intr_init(void) +{ + memset((void*)timer_OV_callback_table, 0, sizeof(timer_OV_callback_table)); + memset((void*)timer_OC_callback_table, 0, sizeof(timer_OC_callback_table)); +} + + diff --git a/timer_intr.h b/timer_intr.h new file mode 100644 index 0000000..e14afb6 --- /dev/null +++ b/timer_intr.h @@ -0,0 +1,30 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_intr.h,v 1.1.2.3 2007-05-23 17:18:15 zer0 Exp $ + * + */ + +#include + +typedef void (*timer_callback_t)(void); + +extern volatile timer_callback_t timer_OV_callback_table[SIG_OVERFLOW_TOTAL_NUM]; +extern volatile timer_callback_t timer_OC_callback_table[SIG_OUTPUT_COMPARE_TOTAL_NUM]; + +/* initialisation of callback table */ +void timer_intr_init(void); diff --git a/timer_prescaler.h b/timer_prescaler.h new file mode 100644 index 0000000..e30e34b --- /dev/null +++ b/timer_prescaler.h @@ -0,0 +1,1113 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2006) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: timer_prescaler.h,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $ + * + */ + +#ifndef _TIMER_PRESCALER_H_ +#define _TIMER_PRESCALER_H_ + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer0_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER0_PRESCALER_REG_0 && TIMER0_PRESCALER_REG_0 >= 0 + case TIMER0_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER0_PRESCALER_REG_1 && TIMER0_PRESCALER_REG_1 >= 0 + case TIMER0_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER0_PRESCALER_REG_2 && TIMER0_PRESCALER_REG_2 >= 0 + case TIMER0_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER0_PRESCALER_REG_3 && TIMER0_PRESCALER_REG_3 >= 0 + case TIMER0_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER0_PRESCALER_REG_4 && TIMER0_PRESCALER_REG_4 >= 0 + case TIMER0_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER0_PRESCALER_REG_5 && TIMER0_PRESCALER_REG_5 >= 0 + case TIMER0_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER0_PRESCALER_REG_6 && TIMER0_PRESCALER_REG_6 >= 0 + case TIMER0_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER0_PRESCALER_REG_7 && TIMER0_PRESCALER_REG_7 >= 0 + case TIMER0_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER0_PRESCALER_REG_8 && TIMER0_PRESCALER_REG_8 >= 0 + case TIMER0_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER0_PRESCALER_REG_9 && TIMER0_PRESCALER_REG_9 >= 0 + case TIMER0_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER0_PRESCALER_REG_10 && TIMER0_PRESCALER_REG_10 >= 0 + case TIMER0_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER0_PRESCALER_REG_11 && TIMER0_PRESCALER_REG_11 >= 0 + case TIMER0_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER0_PRESCALER_REG_12 && TIMER0_PRESCALER_REG_12 >= 0 + case TIMER0_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER0_PRESCALER_REG_13 && TIMER0_PRESCALER_REG_13 >= 0 + case TIMER0_PRESCALER_REG_13: + return 13; +#endif + +#if defined TIMER0_PRESCALER_REG_14 && TIMER0_PRESCALER_REG_14 >= 0 + case TIMER0_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER0_PRESCALER_REG_15 && TIMER0_PRESCALER_REG_15 >= 0 + case TIMER0_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer0_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER0_PRESCALER_DIV_0 + case TIMER0_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER0_PRESCALER_DIV_1 + case TIMER0_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER0_PRESCALER_DIV_2 + case TIMER0_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER0_PRESCALER_DIV_4 + case TIMER0_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER0_PRESCALER_DIV_8 + case TIMER0_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER0_PRESCALER_DIV_16 + case TIMER0_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER0_PRESCALER_DIV_32 + case TIMER0_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER0_PRESCALER_DIV_64 + case TIMER0_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER0_PRESCALER_DIV_128 + case TIMER0_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER0_PRESCALER_DIV_256 + case TIMER0_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER0_PRESCALER_DIV_512 + case TIMER0_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER0_PRESCALER_DIV_1024 + case TIMER0_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER0_PRESCALER_DIV_2048 + case TIMER0_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER0_PRESCALER_DIV_4096 + case TIMER0_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER0_PRESCALER_DIV_8192 + case TIMER0_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER0_PRESCALER_DIV_16384 + case TIMER0_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer1_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER1_PRESCALER_REG_0 && TIMER1_PRESCALER_REG_0 >= 0 + case TIMER1_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER1_PRESCALER_REG_1 && TIMER1_PRESCALER_REG_1 >= 0 + case TIMER1_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER1_PRESCALER_REG_2 && TIMER1_PRESCALER_REG_2 >= 0 + case TIMER1_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER1_PRESCALER_REG_3 && TIMER1_PRESCALER_REG_3 >= 0 + case TIMER1_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER1_PRESCALER_REG_4 && TIMER1_PRESCALER_REG_4 >= 0 + case TIMER1_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER1_PRESCALER_REG_5 && TIMER1_PRESCALER_REG_5 >= 0 + case TIMER1_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER1_PRESCALER_REG_6 && TIMER1_PRESCALER_REG_6 >= 0 + case TIMER1_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER1_PRESCALER_REG_7 && TIMER1_PRESCALER_REG_7 >= 0 + case TIMER1_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER1_PRESCALER_REG_8 && TIMER1_PRESCALER_REG_8 >= 0 + case TIMER1_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER1_PRESCALER_REG_9 && TIMER1_PRESCALER_REG_9 >= 0 + case TIMER1_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER1_PRESCALER_REG_10 && TIMER1_PRESCALER_REG_10 >= 0 + case TIMER1_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER1_PRESCALER_REG_11 && TIMER1_PRESCALER_REG_11 >= 0 + case TIMER1_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER1_PRESCALER_REG_12 && TIMER1_PRESCALER_REG_12 >= 0 + case TIMER1_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER1_PRESCALER_REG_13 && TIMER1_PRESCALER_REG_13 >= 0 + case TIMER1_PRESCALER_REG_13: + return 13; +#endif + +#if defined TIMER1_PRESCALER_REG_14 && TIMER1_PRESCALER_REG_14 >= 0 + case TIMER1_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER1_PRESCALER_REG_15 && TIMER1_PRESCALER_REG_15 >= 0 + case TIMER1_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer1_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER1_PRESCALER_DIV_0 + case TIMER1_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER1_PRESCALER_DIV_1 + case TIMER1_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER1_PRESCALER_DIV_2 + case TIMER1_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER1_PRESCALER_DIV_4 + case TIMER1_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER1_PRESCALER_DIV_8 + case TIMER1_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER1_PRESCALER_DIV_16 + case TIMER1_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER1_PRESCALER_DIV_32 + case TIMER1_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER1_PRESCALER_DIV_64 + case TIMER1_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER1_PRESCALER_DIV_128 + case TIMER1_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER1_PRESCALER_DIV_256 + case TIMER1_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER1_PRESCALER_DIV_512 + case TIMER1_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER1_PRESCALER_DIV_1024 + case TIMER1_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER1_PRESCALER_DIV_2048 + case TIMER1_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER1_PRESCALER_DIV_4096 + case TIMER1_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER1_PRESCALER_DIV_8192 + case TIMER1_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER1_PRESCALER_DIV_16384 + case TIMER1_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + + + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer2_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER2_PRESCALER_REG_0 && TIMER2_PRESCALER_REG_0 >= 0 + case TIMER2_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER2_PRESCALER_REG_1 && TIMER2_PRESCALER_REG_1 >= 0 + case TIMER2_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER2_PRESCALER_REG_2 && TIMER2_PRESCALER_REG_2 >= 0 + case TIMER2_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER2_PRESCALER_REG_3 && TIMER2_PRESCALER_REG_3 >= 0 + case TIMER2_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER2_PRESCALER_REG_4 && TIMER2_PRESCALER_REG_4 >= 0 + case TIMER2_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER2_PRESCALER_REG_5 && TIMER2_PRESCALER_REG_5 >= 0 + case TIMER2_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER2_PRESCALER_REG_6 && TIMER2_PRESCALER_REG_6 >= 0 + case TIMER2_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER2_PRESCALER_REG_7 && TIMER2_PRESCALER_REG_7 >= 0 + case TIMER2_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER2_PRESCALER_REG_8 && TIMER2_PRESCALER_REG_8 >= 0 + case TIMER2_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER2_PRESCALER_REG_9 && TIMER2_PRESCALER_REG_9 >= 0 + case TIMER2_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER2_PRESCALER_REG_10 && TIMER2_PRESCALER_REG_10 >= 0 + case TIMER2_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER2_PRESCALER_REG_11 && TIMER2_PRESCALER_REG_11 >= 0 + case TIMER2_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER2_PRESCALER_REG_12 && TIMER2_PRESCALER_REG_12 >= 0 + case TIMER2_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER2_PRESCALER_REG_13 && TIMER2_PRESCALER_REG_13 >= 0 + case TIMER2_PRESCALER_REG_13: + return 13; +#endif + +#if defined TIMER2_PRESCALER_REG_14 && TIMER2_PRESCALER_REG_14 >= 0 + case TIMER2_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER2_PRESCALER_REG_15 && TIMER2_PRESCALER_REG_15 >= 0 + case TIMER2_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer2_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER2_PRESCALER_DIV_0 + case TIMER2_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER2_PRESCALER_DIV_1 + case TIMER2_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER2_PRESCALER_DIV_2 + case TIMER2_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER2_PRESCALER_DIV_4 + case TIMER2_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER2_PRESCALER_DIV_8 + case TIMER2_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER2_PRESCALER_DIV_16 + case TIMER2_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER2_PRESCALER_DIV_32 + case TIMER2_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER2_PRESCALER_DIV_64 + case TIMER2_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER2_PRESCALER_DIV_128 + case TIMER2_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER2_PRESCALER_DIV_256 + case TIMER2_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER2_PRESCALER_DIV_512 + case TIMER2_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER2_PRESCALER_DIV_1024 + case TIMER2_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER2_PRESCALER_DIV_2048 + case TIMER2_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER2_PRESCALER_DIV_4096 + case TIMER2_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER2_PRESCALER_DIV_8192 + case TIMER2_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER2_PRESCALER_DIV_16384 + case TIMER2_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + + + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer3_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER3_PRESCALER_REG_0 && TIMER3_PRESCALER_REG_0 >= 0 + case TIMER3_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER3_PRESCALER_REG_1 && TIMER3_PRESCALER_REG_1 >= 0 + case TIMER3_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER3_PRESCALER_REG_2 && TIMER3_PRESCALER_REG_2 >= 0 + case TIMER3_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER3_PRESCALER_REG_3 && TIMER3_PRESCALER_REG_3 >= 0 + case TIMER3_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER3_PRESCALER_REG_4 && TIMER3_PRESCALER_REG_4 >= 0 + case TIMER3_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER3_PRESCALER_REG_5 && TIMER3_PRESCALER_REG_5 >= 0 + case TIMER3_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER3_PRESCALER_REG_6 && TIMER3_PRESCALER_REG_6 >= 0 + case TIMER3_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER3_PRESCALER_REG_7 && TIMER3_PRESCALER_REG_7 >= 0 + case TIMER3_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER3_PRESCALER_REG_8 && TIMER3_PRESCALER_REG_8 >= 0 + case TIMER3_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER3_PRESCALER_REG_9 && TIMER3_PRESCALER_REG_9 >= 0 + case TIMER3_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER3_PRESCALER_REG_10 && TIMER3_PRESCALER_REG_10 >= 0 + case TIMER3_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER3_PRESCALER_REG_11 && TIMER3_PRESCALER_REG_11 >= 0 + case TIMER3_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER3_PRESCALER_REG_12 && TIMER3_PRESCALER_REG_12 >= 0 + case TIMER3_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER3_PRESCALER_REG_13 && TIMER3_PRESCALER_REG_13 >= 0 + case TIMER3_PRESCALER_REG_13: + return 13; +#endif +#if defined TIMER3_PRESCALER_REG_14 && TIMER3_PRESCALER_REG_14 >= 0 + case TIMER3_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER3_PRESCALER_REG_15 && TIMER3_PRESCALER_REG_15 >= 0 + case TIMER3_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer3_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER3_PRESCALER_DIV_0 + case TIMER3_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER3_PRESCALER_DIV_1 + case TIMER3_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER3_PRESCALER_DIV_2 + case TIMER3_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER3_PRESCALER_DIV_4 + case TIMER3_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER3_PRESCALER_DIV_8 + case TIMER3_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER3_PRESCALER_DIV_16 + case TIMER3_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER3_PRESCALER_DIV_32 + case TIMER3_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER3_PRESCALER_DIV_64 + case TIMER3_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER3_PRESCALER_DIV_128 + case TIMER3_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER3_PRESCALER_DIV_256 + case TIMER3_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER3_PRESCALER_DIV_512 + case TIMER3_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER3_PRESCALER_DIV_1024 + case TIMER3_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER3_PRESCALER_DIV_2048 + case TIMER3_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER3_PRESCALER_DIV_4096 + case TIMER3_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER3_PRESCALER_DIV_8192 + case TIMER3_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER3_PRESCALER_DIV_16384 + case TIMER3_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer4_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER4_PRESCALER_REG_0 && TIMER4_PRESCALER_REG_0 >= 0 + case TIMER4_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER4_PRESCALER_REG_1 && TIMER4_PRESCALER_REG_1 >= 0 + case TIMER4_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER4_PRESCALER_REG_2 && TIMER4_PRESCALER_REG_2 >= 0 + case TIMER4_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER4_PRESCALER_REG_3 && TIMER4_PRESCALER_REG_3 >= 0 + case TIMER4_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER4_PRESCALER_REG_4 && TIMER4_PRESCALER_REG_4 >= 0 + case TIMER4_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER4_PRESCALER_REG_5 && TIMER4_PRESCALER_REG_5 >= 0 + case TIMER4_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER4_PRESCALER_REG_6 && TIMER4_PRESCALER_REG_6 >= 0 + case TIMER4_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER4_PRESCALER_REG_7 && TIMER4_PRESCALER_REG_7 >= 0 + case TIMER4_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER4_PRESCALER_REG_8 && TIMER4_PRESCALER_REG_8 >= 0 + case TIMER4_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER4_PRESCALER_REG_9 && TIMER4_PRESCALER_REG_9 >= 0 + case TIMER4_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER4_PRESCALER_REG_10 && TIMER4_PRESCALER_REG_10 >= 0 + case TIMER4_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER4_PRESCALER_REG_11 && TIMER4_PRESCALER_REG_11 >= 0 + case TIMER4_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER4_PRESCALER_REG_12 && TIMER4_PRESCALER_REG_12 >= 0 + case TIMER4_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER4_PRESCALER_REG_13 && TIMER4_PRESCALER_REG_13 >= 0 + case TIMER4_PRESCALER_REG_13: + return 13; +#endif +#if defined TIMER4_PRESCALER_REG_14 && TIMER4_PRESCALER_REG_14 >= 0 + case TIMER4_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER4_PRESCALER_REG_15 && TIMER4_PRESCALER_REG_15 >= 0 + case TIMER4_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer4_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER4_PRESCALER_DIV_0 + case TIMER4_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER4_PRESCALER_DIV_1 + case TIMER4_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER4_PRESCALER_DIV_2 + case TIMER4_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER4_PRESCALER_DIV_4 + case TIMER4_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER4_PRESCALER_DIV_8 + case TIMER4_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER4_PRESCALER_DIV_16 + case TIMER4_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER4_PRESCALER_DIV_32 + case TIMER4_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER4_PRESCALER_DIV_64 + case TIMER4_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER4_PRESCALER_DIV_128 + case TIMER4_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER4_PRESCALER_DIV_256 + case TIMER4_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER4_PRESCALER_DIV_512 + case TIMER4_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER4_PRESCALER_DIV_1024 + case TIMER4_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER4_PRESCALER_DIV_2048 + case TIMER4_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER4_PRESCALER_DIV_4096 + case TIMER4_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER4_PRESCALER_DIV_8192 + case TIMER4_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER4_PRESCALER_DIV_16384 + case TIMER4_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + +/* return <0 on error, else return reg value */ +/* This static inline function is very optimized if div is + * a constant */ +static inline int16_t __timer5_div_to_reg(uint16_t div) +{ + switch(div) { +#if defined TIMER5_PRESCALER_REG_0 && TIMER5_PRESCALER_REG_0 >= 0 + case TIMER5_PRESCALER_REG_0: + return 0; +#endif + +#if defined TIMER5_PRESCALER_REG_1 && TIMER5_PRESCALER_REG_1 >= 0 + case TIMER5_PRESCALER_REG_1: + return 1; +#endif + +#if defined TIMER5_PRESCALER_REG_2 && TIMER5_PRESCALER_REG_2 >= 0 + case TIMER5_PRESCALER_REG_2: + return 2; +#endif + +#if defined TIMER5_PRESCALER_REG_3 && TIMER5_PRESCALER_REG_3 >= 0 + case TIMER5_PRESCALER_REG_3: + return 3; +#endif + +#if defined TIMER5_PRESCALER_REG_4 && TIMER5_PRESCALER_REG_4 >= 0 + case TIMER5_PRESCALER_REG_4: + return 4; +#endif + +#if defined TIMER5_PRESCALER_REG_5 && TIMER5_PRESCALER_REG_5 >= 0 + case TIMER5_PRESCALER_REG_5: + return 5; +#endif + +#if defined TIMER5_PRESCALER_REG_6 && TIMER5_PRESCALER_REG_6 >= 0 + case TIMER5_PRESCALER_REG_6: + return 6; +#endif + +#if defined TIMER5_PRESCALER_REG_7 && TIMER5_PRESCALER_REG_7 >= 0 + case TIMER5_PRESCALER_REG_7: + return 7; +#endif + +#if defined TIMER5_PRESCALER_REG_8 && TIMER5_PRESCALER_REG_8 >= 0 + case TIMER5_PRESCALER_REG_8: + return 8; +#endif + +#if defined TIMER5_PRESCALER_REG_9 && TIMER5_PRESCALER_REG_9 >= 0 + case TIMER5_PRESCALER_REG_9: + return 9; +#endif + +#if defined TIMER5_PRESCALER_REG_10 && TIMER5_PRESCALER_REG_10 >= 0 + case TIMER5_PRESCALER_REG_10: + return 10; +#endif + +#if defined TIMER5_PRESCALER_REG_11 && TIMER5_PRESCALER_REG_11 >= 0 + case TIMER5_PRESCALER_REG_11: + return 11; +#endif + +#if defined TIMER5_PRESCALER_REG_12 && TIMER5_PRESCALER_REG_12 >= 0 + case TIMER5_PRESCALER_REG_12: + return 12; +#endif + +#if defined TIMER5_PRESCALER_REG_13 && TIMER5_PRESCALER_REG_13 >= 0 + case TIMER5_PRESCALER_REG_13: + return 13; +#endif +#if defined TIMER5_PRESCALER_REG_14 && TIMER5_PRESCALER_REG_14 >= 0 + case TIMER5_PRESCALER_REG_14: + return 14; +#endif + +#if defined TIMER5_PRESCALER_REG_15 && TIMER5_PRESCALER_REG_15 >= 0 + case TIMER5_PRESCALER_REG_15: + return 15; +#endif + default: + return -1; + } +} + +/* return <0 on error, else return div value */ +/* This static inline function is very optimized if reg is + * a constant */ +static inline int16_t __timer5_reg_to_div(uint8_t reg) +{ + switch(reg) { +#if defined TIMER5_PRESCALER_DIV_0 + case TIMER5_PRESCALER_DIV_0: + return 0; +#endif + +#if defined TIMER5_PRESCALER_DIV_1 + case TIMER5_PRESCALER_DIV_1: + return 1; +#endif + +#if defined TIMER5_PRESCALER_DIV_2 + case TIMER5_PRESCALER_DIV_2: + return 2; +#endif + +#if defined TIMER5_PRESCALER_DIV_4 + case TIMER5_PRESCALER_DIV_4: + return 4; +#endif + +#if defined TIMER5_PRESCALER_DIV_8 + case TIMER5_PRESCALER_DIV_8: + return 8; +#endif + +#if defined TIMER5_PRESCALER_DIV_16 + case TIMER5_PRESCALER_DIV_16: + return 16; +#endif + +#if defined TIMER5_PRESCALER_DIV_32 + case TIMER5_PRESCALER_DIV_32: + return 32; +#endif + +#if defined TIMER5_PRESCALER_DIV_64 + case TIMER5_PRESCALER_DIV_64: + return 64; +#endif + +#if defined TIMER5_PRESCALER_DIV_128 + case TIMER5_PRESCALER_DIV_128: + return 128; +#endif + +#if defined TIMER5_PRESCALER_DIV_256 + case TIMER5_PRESCALER_DIV_256: + return 256; +#endif + +#if defined TIMER5_PRESCALER_DIV_512 + case TIMER5_PRESCALER_DIV_512: + return 512; +#endif + +#if defined TIMER5_PRESCALER_DIV_1024 + case TIMER5_PRESCALER_DIV_1024: + return 1024; +#endif + +#if defined TIMER5_PRESCALER_DIV_2048 + case TIMER5_PRESCALER_DIV_2048: + return 2048; +#endif + +#if defined TIMER5_PRESCALER_DIV_4096 + case TIMER5_PRESCALER_DIV_4096: + return 4096; +#endif + +#if defined TIMER5_PRESCALER_DIV_8192 + case TIMER5_PRESCALER_DIV_8192: + return 8192; +#endif + +#if defined TIMER5_PRESCALER_DIV_16384 + case TIMER5_PRESCALER_DIV_16384: + return 16384; +#endif + + default: + return -1; + } +} + +#endif diff --git a/uart.c b/uart.c new file mode 100644 index 0000000..ab82224 --- /dev/null +++ b/uart.c @@ -0,0 +1,280 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart.c,v 1.33.4.7 2009-01-23 23:08:42 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include + +#include +#include +#include + +struct cirbuf g_tx_fifo[UART_HW_NUM]; +struct cirbuf g_rx_fifo[UART_HW_NUM]; + +/* global vars are initialized to 0 (NULL) */ +event *rx_event[UART_HW_NUM]; +event *tx_event[UART_HW_NUM]; + +const struct regs uart_regs[UART_HW_NUM] = { +#ifdef UDR0 + { + .udr = &UDR0, + .ucsra = &UCSR0A, + .ucsrb = &UCSR0B, + .ucsrc = &UCSR0C, + .ubrrl = &UBRR0L, + .ubrrh = &UBRR0H, + }, +#endif +#ifdef UDR1 + { + .udr = &UDR1, + .ucsra = &UCSR1A, + .ucsrb = &UCSR1B, + .ucsrc = &UCSR1C, + .ubrrl = &UBRR1L, + .ubrrh = &UBRR1H, + }, +#endif +#ifdef UDR2 + { + .udr = &UDR2, + .ucsra = &UCSR2A, + .ucsrb = &UCSR2B, + .ucsrc = &UCSR2C, + .ubrrl = &UBRR2L, + .ubrrh = &UBRR2H, + }, +#endif +#ifdef UDR3 + { + .udr = &UDR3, + .ucsra = &UCSR3A, + .ucsrb = &UCSR3B, + .ucsrc = &UCSR3C, + .ubrrl = &UBRR3L, + .ubrrh = &UBRR3H, + }, +#endif +}; + +/** + * This is the interruption function which occurs when the entire + * frame in the transmit shift register has been shifted out and + * there is no new data in the transmit buffer. + */ +#ifdef UART0_COMPILE +#ifndef SIG_UART0_DATA +#define SIG_UART0_DATA USART0_UDRE_vect +#endif +#ifndef SIG_UART0_DATA +#define SIG_UART0_DATA SIG_USART0_DATA +#endif +SIGNAL(SIG_UART0_DATA) +{ + uart_send_next_char(0); +} +#endif +#ifdef UART1_COMPILE +#ifndef SIG_UART1_DATA +#define SIG_UART1_DATA USART1_UDRE_vect +#endif +#ifndef SIG_UART1_DATA +#define SIG_UART1_DATA SIG_USART1_DATA +#endif +SIGNAL(SIG_UART1_DATA) +{ + uart_send_next_char(1); +} +#endif +#ifdef UART2_COMPILE +#ifndef SIG_UART2_DATA +#define SIG_UART2_DATA USART2_UDRE_vect +#endif +#ifndef SIG_UART2_DATA +#define SIG_UART2_DATA SIG_USART2_DATA +#endif +SIGNAL(SIG_UART2_DATA) +{ + uart_send_next_char(2); +} +#endif +#ifdef UART3_COMPILE +#ifndef SIG_UART3_DATA +#define SIG_UART3_DATA USART3_UDRE_vect +#endif +#ifndef SIG_UART3_DATA +#define SIG_UART3_DATA SIG_USART3_DATA +#endif +SIGNAL(SIG_UART3_DATA) +{ + uart_send_next_char(3); +} +#endif + +static void uart_recv_next_char(uint8_t num); + +/** + * This is the interruption function which occurs when there is + * a new unread data in the reception buffer. + */ +#ifdef UART0_COMPILE +#ifndef SIG_UART0_RECV +#define SIG_UART0_RECV USART0_RX_vect +#endif +#ifndef SIG_UART0_RECV +#define SIG_UART0_RECV SIG_USART0_RECV +#endif +SIGNAL(SIG_UART0_RECV) +{ + uart_recv_next_char(0); +} +#endif +#ifdef UART1_COMPILE +#ifndef SIG_UART1_RECV +#define SIG_UART1_RECV USART1_RX_vect +#endif +#ifndef SIG_UART1_RECV +#define SIG_UART1_RECV SIG_USART1_RECV +#endif +SIGNAL(SIG_UART1_RECV) +{ + uart_recv_next_char(1); +} +#endif +#ifdef UART2_COMPILE +#ifndef SIG_UART2_RECV +#define SIG_UART2_RECV USART2_RX_vect +#endif +#ifndef SIG_UART2_RECV +#define SIG_UART2_RECV SIG_USART2_RECV +#endif +SIGNAL(SIG_UART2_RECV) +{ + uart_recv_next_char(2); +} +#endif +#ifdef UART3_COMPILE +#ifndef SIG_UART3_RECV +#define SIG_UART3_RECV USART3_RX_vect +#endif +#ifndef SIG_UART3_RECV +#define SIG_UART3_RECV SIG_USART3_RECV +#endif +SIGNAL(SIG_UART3_RECV) +{ + uart_recv_next_char(3); +} +#endif + + +/** + * transmit next character of fifo if any, and call the event function. + * This function is executed with intr locked. + */ +void uart_send_next_char(uint8_t num) +{ +#ifdef CONFIG_MODULE_UART_9BITS + if (uart_getconf_nbits(num) == 9) { + int elt = 0; + + /* for 9 bits, it uses 2 places in the fifo */ + if (CIRBUF_GET_LEN(&g_tx_fifo[num]) < 2) { + cbi(*uart_regs[num].ucsrb, UDRIE); + return; + } + + cirbuf_get_buf_tail(&g_tx_fifo[num], (char *)&elt, 2); + cirbuf_del_buf_tail(&g_tx_fifo[num], 2); + + uart_set_udr_9bits(num, elt); + sbi(*uart_regs[num].ucsrb, UDRIE); + } + else /* 5, 6, 7 or 8 bits */ +#endif /* CONFIG_MODULE_UART_9BITS */ + { + char elt = 0; + + if (CIRBUF_IS_EMPTY(&g_tx_fifo[num])) { + cbi(*uart_regs[num].ucsrb, UDRIE); + return; + } + + elt = cirbuf_get_tail(&g_tx_fifo[num]); + cirbuf_del_tail(&g_tx_fifo[num]); + uart_set_udr(num, elt); + sbi(*uart_regs[num].ucsrb, UDRIE); + } +} + +/** + * UART RX Interrupt + */ +static void uart_recv_next_char(uint8_t num) +{ +#ifdef CONFIG_MODULE_UART_9BITS + if (uart_getconf_nbits() == 9) { + int elt = 0; + + elt = uart_get_udr_9bits(num); + if (CIRBUF_GET_FREELEN(&g_rx_fifo[num]) >= 2) { + cirbuf_add_buf_head(&g_rx_fifo[num], (char *)&elt, 2); + } + + if (rx_event[num]) + ((event_9bits *)rx_event[num])(elt); + } + else +#endif /* CONFIG_MODULE_UART_9BITS */ + { + char elt = 0; + + elt = uart_get_udr(num); + if (!CIRBUF_IS_FULL(&g_rx_fifo[num])) { + cirbuf_add_head(&g_rx_fifo[num], elt); + } + + if (rx_event[num]) + rx_event[num](elt); + } +} + +/* init all uarts */ +void uart_init(void) +{ +#if (defined UDR0) && (defined UART0_COMPILE) + uart_setconf(0, NULL); +#endif + +#if (defined UDR1) && (defined UART1_COMPILE) + uart_setconf(1, NULL); +#endif + +#if (defined UDR2) && (defined UART2_COMPILE) + uart_setconf(2, NULL); +#endif + +#if (defined UDR3) && (defined UART3_COMPILE) + uart_setconf(3, NULL); +#endif +} diff --git a/uart.h b/uart.h new file mode 100644 index 0000000..06ba9f0 --- /dev/null +++ b/uart.h @@ -0,0 +1,194 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart.h,v 1.22.4.4 2008-12-27 16:29:07 zer0 Exp $ + * + */ + +/* Olivier MATZ, 2004 - 2006 + * Interface of the uart module + */ + +/** \file uart.h + * \brief Interface of the UART module. + * + * This module provides : + * - Tx and Rx with fifo + * - Speed selection + * - Parity selection (if the uC support it) + * - 5 to 8 data bits (if the uC support it). + * - 1 or 2 stop bits (if the uC support it). + * - up to 4 UARTs (if the uC support it). + * + * Number of bits in frame, parity, stop bits are the same for tx and + * rx. TX fifo is useless if interrupts are disabled because the uart + * wait that all bytes are transmitted before returning. + * + * It doesn't support some USART capabilities : + * - Synchronous mode + * - Multiprocessor communication + */ + +#ifndef _UART_H_ +#define _UART_H_ + +#include +#include +#include +#include + +#include + +/** this structure stores the configuration of the uart */ +struct uart_config { + uint8_t enabled : 1, /**< enable or disable the uart */ + intr_enabled : 1, /**< use interruptions or not */ + use_double_speed : 1, /**< less acurate, but can reach faster baudrate */ + parity : 2, /**< none, odd or even */ + stop_bits : 1, /**< 1 or 2 bits at the end of the frame */ + reserved : 1; /**< nothing for now */ + uint8_t nbits; /**< number of bits in frame, 5,6,7,8 or 9 */ + uint32_t baudrate; /**< speed of uart */ +}; + +/** The emission fifo of uart */ +extern struct cirbuf g_tx_fifo[UART_HW_NUM]; + +/** The reception fifo of uart */ +extern struct cirbuf g_rx_fifo[UART_HW_NUM]; + +/** + * Initialisation function. This function puts the registers of the + * microcontroler in a correct state in order to use the uart. It + * uses the configuration file ; this function is + * equivalent to call uartX_setconf(NULL) for each uart. + */ +void uart_init(void); + +/** + * Configure the uart 'num' with the given configuration. Returns 0 on + * success. + */ +int8_t uart_setconf(uint8_t num, struct uart_config *u); + +/** Get the current configuration of the uart 'num' */ +void uart_getconf(uint8_t num, struct uart_config *u); + +/** + * uart_recv returns the next character, taken from the fifo (if + * any). If there is nothing to read, the function waits until + * something come on the uart. + */ +int uart_recv(uint8_t num); + +/** + * uart_recv returns the next character, taken from the fifo (if + * any). If there is nothing to read, the function returns -1. + */ +int uart_recv_nowait(uint8_t num); + +/** + * same than uart_recv with 9 bits. + */ +int uart_9bits_recv(uint8_t num); + +/** + * same than uart_recv_nowait() with 9 bits. + */ +int uart_9bits_recv_nowait(uint8_t num); + +/** + * uart_send_nowait is used to send data to the uart 'num'. The data + * is first stored in the FIFO before beeing sent. If the FIFO is + * full, data is dropped and the function returns -1, else it returns + * the character c. + */ +int uart_send_nowait(uint8_t num, char c); + +/** + * uart_send is used to send data to the uart 'num'. The data is first + * stored in the FIFO before beeing sent. If the FIFO is full, the + * function wait until the uart is ready. The function returns c. + */ +int uart_send(uint8_t num, char c); + +/** + * uart_send_9bits is the same that uart_send but arg is 16 bits so + * data can be 9 bits wide. + */ +int uart_send_9bits_nowait(uint8_t num, int c); + +/* uart_send_9bits_wait is the same that uart_send_wait but arg is + * 16 bits so data can be 9 bits wide. + */ +int uart_send_9bits(uint8_t num, int c); + + + +/** + * This function is used to register another function which will be + * executed at each byte transmission (5, 6 ,7 ,8 bits) + */ +void uart_register_tx_event(uint8_t num, void (*f)(char)); + +/** + * This function is used to register another function which will be + * executed at each byte reception (5, 6 ,7 ,8 bits) + */ +void uart_register_rx_event(uint8_t num, void (*f)(char)); + + +/** + * This function is used to register another function which will be + * executed at each 9 bits frame transmission. WARNING : it uses the + * same internal pointer that the 8 bits event, so be carreful to + * unregister 8 bits events when doing 9 bits and vice versa. + */ +void uart_register_tx_9bits_event(uint8_t num, void (*f)(int)); + +/** + * This function is used to register another function which will be + * executed at each 9 bits reception. WARNING : it uses the + * same internal pointer that the 8 bits event, so be carreful to + * unregister 8 bits events when doing 9 bits and vice versa. + */ +void uart_register_rx_9bits_event(uint8_t num, void (*f)(int)); + +/* funcs for use with fdevopen (avrlibc > 1.4.0) */ +int uart0_dev_send_nowait(char c, FILE* f); +int uart0_dev_send(char c, FILE* f); +int uart0_dev_recv_nowait(FILE* f); +int uart0_dev_recv(FILE* f); + +int uart1_dev_send_nowait(char c, FILE* f); +int uart1_dev_send(char c, FILE* f); +int uart1_dev_recv_nowait(FILE* f); +int uart1_dev_recv(FILE* f); + +int uart2_dev_send_nowait(char c, FILE* f); +int uart2_dev_send(char c, FILE* f); +int uart2_dev_recv_nowait(FILE* f); +int uart2_dev_recv(FILE* f); + +int uart3_dev_send_nowait(char c, FILE* f); +int uart3_dev_send(char c, FILE* f); +int uart3_dev_recv_nowait(FILE* f); +int uart3_dev_recv(FILE* f); + + +#endif /* _UART_H_ */ + diff --git a/uart_config.h b/uart_config.h new file mode 100644 index 0000000..8795a7e --- /dev/null +++ b/uart_config.h @@ -0,0 +1,61 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.5 2009-11-08 17:24:33 zer0 Exp $ + * + */ + +/* Droids-corp 2004 - Zer0 + * config for uart module + */ + +#ifndef UART_CONFIG_H +#define UART_CONFIG_H + +/* + * UART1 definitions + */ + +/* compile uart1 fonctions, undefine it to pass compilation */ +#define UART1_COMPILE + +/* enable uart1 if == 1, disable if == 0 */ +#define UART1_ENABLED 1 + +/* enable uart1 interrupts if == 1, disable if == 0 */ +#define UART1_INTERRUPT_ENABLED 1 + +#define UART1_BAUDRATE 57600 + +/* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ +#define UART1_USE_DOUBLE_SPEED 1 + +#define UART1_RX_FIFO_SIZE 64 +#define UART1_TX_FIFO_SIZE 127 +#define UART1_NBITS 8 + +#define UART1_PARITY UART_PARTITY_NONE + +#define UART1_STOP_BIT UART_STOP_BITS_1 + +/* .... same for uart 1, 2, 3 ... */ + +#endif + diff --git a/uart_defs.h b/uart_defs.h new file mode 100644 index 0000000..e8d6171 --- /dev/null +++ b/uart_defs.h @@ -0,0 +1,234 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_defs.h,v 1.2.4.13 2009-06-29 20:28:27 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2006 + * Uart specific definitions + */ + +#ifndef _UART_DEFS_H_ +#define _UART_DEFS_H_ + +#define UART_PARTITY_NONE 0 +#define UART_PARTITY_ODD 1 +#define UART_PARTITY_EVEN 2 + +#define UART_STOP_BITS_1 0 +#define UART_STOP_BITS_2 1 + +#if (defined UDR3) +#define UART_HW_NUM 4 +#elif (defined UDR2) +#define UART_HW_NUM 3 +#elif (defined UDR1) +#define UART_HW_NUM 2 +#else /* assume 1 uart */ +#define UART_HW_NUM 1 +#endif + + +/* For arch with only one UART, we consider that UART0 = UART */ +#if !defined(SIG_UART0_DATA) && !defined(SIG_USART0_DATA) +#if defined SIG_UART_DATA +#define SIG_UART0_DATA SIG_UART_DATA +#elif defined SIG_USART_DATA +#define SIG_UART0_DATA SIG_USART_DATA +#endif +#endif + +#if !defined(SIG_UART0_RECV) && !defined(SIG_USART0_RECV) +#if defined SIG_UART_RECV +#define SIG_UART0_RECV SIG_UART_RECV +#elif defined SIG_USART_RECV +#define SIG_UART0_RECV SIG_USART_RECV +#endif +#endif + +#if !defined(UDR0) && defined(UDR) +#define UDR0 UDR +#endif +#ifndef UCSR0A +#define UCSR0A UCSRA +#endif +#ifndef UCSR0B +#define UCSR0B UCSRB +#endif +#ifndef UCSR0C +#define UCSR0C UCSRC +#endif +#ifndef UBRR0L +#define UBRR0L UBRRL +#endif +#ifndef UBRR0H +#define UBRR0H UBRRH +#endif +#if !defined(U2X) && defined(U2X0) +#define U2X U2X0 +#endif +#if !defined(UCSZ0) && defined(UCSZ00) +#define UCSZ0 UCSZ00 +#endif +#if !defined(UCSZ1) && defined(UCSZ01) +#define UCSZ1 UCSZ01 +#endif +#if !defined(UCSZ2) && defined(UCSZ02) +#define UCSZ2 UCSZ02 +#endif +#if !defined(UPM0) && defined(UPM00) +#define UPM0 UPM00 +#endif +#if !defined(UPM1) && defined(UPM01) +#define UPM1 UPM01 +#endif +#if !defined(USBS) && defined(USBS0) +#define USBS USBS0 +#endif +#if !defined(TXEN) && defined(TXEN0) +#define TXEN TXEN0 +#endif +#if !defined(TXCIE) && defined(TXCIE0) +#define TXCIE TXCIE0 +#endif +#if !defined(RXEN) && defined(RXEN0) +#define RXEN RXEN0 +#endif +#if !defined(RXCIE) && defined(RXCIE0) +#define RXCIE RXCIE0 +#endif +#if !defined(TXC) && defined(TXC0) +#define TXC TXC0 +#endif +#if !defined(RXC) && defined(RXC0) +#define RXC RXC0 +#endif +#if !defined(RXB8) && defined(RXB80) +#define RXB8 RXB80 +#endif +#if !defined(UDRIE) && defined(UDRIE0) +#define UDRIE UDRIE0 +#endif +#if !defined(UDRE) && defined(UDRE0) +#define UDRE UDRE0 +#endif +#if !defined(U2X) && defined(U2X1) +#define U2X U2X1 +#endif +#if !defined(UCSZ1) && defined(UCSZ10) +#define UCSZ0 UCSZ10 +#endif +#if !defined(UCSZ1) && defined(UCSZ11) +#define UCSZ1 UCSZ11 +#endif +#if !defined(UCSZ2) && defined(UCSZ12) +#define UCSZ2 UCSZ12 +#endif +#if !defined(UPM1) && defined(UPM10) +#define UPM0 UPM10 +#endif +#if !defined(UPM1) && defined(UPM11) +#define UPM1 UPM11 +#endif +#if !defined(USBS) && defined(USBS1) +#define USBS USBS1 +#endif +#if !defined(TXEN) && defined(TXEN1) +#define TXEN TXEN1 +#endif +#if !defined(TXCIE) && defined(TXCIE1) +#define TXCIE TXCIE1 +#endif +#if !defined(RXEN) && defined(RXEN1) +#define RXEN RXEN1 +#endif +#if !defined(RXCIE) && defined(RXCIE1) +#define RXCIE RXCIE1 +#endif +#if !defined(TXC) && defined(TXC1) +#define TXC TXC1 +#endif +#if !defined(RXC) && defined(RXC1) +#define RXC RXC1 +#endif +#if !defined(RXB8) && defined(RXB81) +#define RXB8 RXB81 +#endif +#if !defined(UDRIE) && defined(UDRIE1) +#define UDRIE UDRIE1 +#endif +#if !defined(UDRIE) && defined(UDRIE1) +#define UDRIE UDRIE1 +#endif +#if !defined(UDRE) && defined(UDRE1) +#define UDRE UDRE1 +#endif + +/* makes functions more generic, we associate USR and UCR with UCSRA + * and UCSRB, respectively */ +#if ( ! defined UCSRA ) && ( defined USR ) +#define UCSRA USR +#endif + +#if ( ! defined UCSRB ) && ( defined UCR ) +#define UCSRB UCR +#endif + +/* UBRR is UBRRL */ +#ifndef UBRRL +#define UBRRL UBRR +#endif + + +/* workaround for libc incomplete headers when using CAN AVR + * (avr/iocanxx.h): USART is valid. + * see http://savannah.nongnu.org/bugs/?18964 + */ +#if defined (__AVR_AT90CAN128__) || defined (__AVR_AT90CAN64__) || defined (__AVR_AT90CAN32__) + +#ifndef SIG_USART0_RECV +#define SIG_USART0_RECV SIG_UART0_RECV +#define SIG_USART1_RECV SIG_UART1_RECV +#define SIG_USART0_DATA SIG_UART0_DATA +#define SIG_USART1_DATA SIG_UART1_DATA +#define SIG_USART0_TRANS SIG_UART0_TRANS +#define SIG_USART1_TRANS SIG_UART1_TRANS +#endif + +#endif + + +/* if the signal USART is defined, the uC has a USART. */ +#if ( defined SIG_USART0_RECV ) || ( defined SIG_USART_RECV ) +#define UART_IS_USART 1 +#elif (defined USART_UDRE_vect) || (defined USART_TXC_vect) || (defined USART_RXC_vect) +#define UART_IS_USART 1 +#elif (defined USART1_UDRE_vect) || (defined USART1_TXC_vect) || (defined USART1_RXC_vect) +#define UART_IS_USART 1 +#else +#define UART_IS_USART 0 +#endif + +/* if the U2X macro is defined, the uC has the U2X option. */ +#ifdef U2X +#define UART_HAS_U2X 1 +#else +#define UART_HAS_U2X 0 +#endif + +#endif //_UART_DEFS_H_ diff --git a/uart_dev_io.c b/uart_dev_io.c new file mode 100644 index 0000000..51d0ed1 --- /dev/null +++ b/uart_dev_io.c @@ -0,0 +1,114 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_dev_io.c,v 1.1.2.2 2009-04-07 20:00:47 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +#ifdef UART0_COMPILE +int uart0_dev_send_nowait(char c, __attribute__((unused)) FILE *f) +{ + return uart_send_nowait(0, c); +} + +int uart0_dev_send(char c, __attribute__((unused)) FILE *f) +{ + return uart_send(0, c); +} + +int uart0_dev_recv_nowait(__attribute__((unused)) FILE *f) +{ + return uart_recv_nowait(0); +} + +int uart0_dev_recv(__attribute__((unused)) FILE *f) +{ + return uart_recv(0); +} +#endif + +#ifdef UART1_COMPILE +int uart1_dev_send_nowait(char c, __attribute__((unused)) FILE *f) +{ + return uart_send_nowait(1, c); +} + +int uart1_dev_send(char c, __attribute__((unused)) FILE *f) +{ + return uart_send(1, c); +} + +int uart1_dev_recv_nowait(__attribute__((unused)) FILE *f) +{ + return uart_recv_nowait(1); +} + +int uart1_dev_recv(__attribute__((unused)) FILE *f) +{ + return uart_recv(1); +} +#endif + +#ifdef UART2_COMPILE +int uart2_dev_send_nowait(char c, __attribute__((unused)) FILE *f) +{ + return uart_send_nowait(2, c); +} + +int uart2_dev_send(char c, __attribute__((unused)) FILE *f) +{ + return uart_send(2, c); +} + +int uart2_dev_recv_nowait(__attribute__((unused)) FILE *f) +{ + return uart_recv_nowait(2); +} + +int uart2_dev_recv(__attribute__((unused)) FILE *f) +{ + return uart_recv(2); +} +#endif + +#ifdef UART3_COMPILE +int uart3_dev_send_nowait(char c, __attribute__((unused)) FILE *f) +{ + return uart_send_nowait(3, c); +} + +int uart3_dev_send(char c, __attribute__((unused)) FILE *f) +{ + return uart_send(3, c); +} + +int uart3_dev_recv_nowait(__attribute__((unused)) FILE *f) +{ + return uart_recv_nowait(3); +} + +int uart3_dev_recv(__attribute__((unused)) FILE *f) +{ + return uart_recv(3); +} +#endif diff --git a/uart_errors.h b/uart_errors.h new file mode 100644 index 0000000..32ee436 --- /dev/null +++ b/uart_errors.h @@ -0,0 +1,67 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_errors.h,v 1.5.6.1 2006-11-26 21:06:02 zer0 Exp $ + * + */ + +/* Droids-corp 2004 - Zer0 + * Errors of the uart module + */ + +/** \file uart.c + * \brief Errors of the UART module. + * + * \todo None + * + * \test None + */ + + +/* check if uart configuration is correct at compilation time */ +#ifndef UART_IS_USART +#if (UART0_PARITY == UART_PARTITY_ODD) || (UART0_PARITY == UART_PARTITY_EVEN) +#error Currently this module does not support parity if your uC has no USART +#endif + +#if (UART0_STOP_BIT == 2) +#error Currently this module does not support another stop bit if your uC has no USART +#endif + +#if (UART0_NBITS < 8) +#error Currently this module does not support 5/6/7 bits frames if your uC has no USART +#endif +#endif // !UART_USART + + +/* check if uart configuration is correct */ +#if !defined(UART_USART) && defined(UART_DOUBLE) // is this possible ?? +#if (UART1_PARITY == UART_PARTITY_ODD) || (UART1_PARITY == UART_PARTITY_EVEN) +#error Currently this module does not support parity if your uC has no USART +#endif + +#if (UART1_STOP_BIT == 2) +#error Currently this module does not support another stop bit if your uC has no USART +#endif + +#if (UART1_NBITS < 8) +#error Currently this module does not support 5/6/7 bits frames if your uC has no USART +#endif +#endif // !UART_USART && UART_DOUBLE + + + diff --git a/uart_events.c b/uart_events.c new file mode 100644 index 0000000..42b2c2a --- /dev/null +++ b/uart_events.c @@ -0,0 +1,51 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_events.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +/* This function is used to register another function which will be */ +/* executed at each byte transmission. */ +void uart_register_tx_event(uint8_t num, void (*f)(char)) +{ + uint8_t flags; + if (num >= UART_HW_NUM) + return; + IRQ_LOCK(flags); + tx_event[num] = f; + IRQ_UNLOCK(flags); +} + +/* This function is used to register another function which will be */ +/* executed at each byte reception */ +void uart_register_rx_event(uint8_t num, void (*f)(char)) +{ + uint8_t flags; + if (num >= UART_HW_NUM) + return; + IRQ_LOCK(flags); + rx_event[num] = f; + IRQ_UNLOCK(flags); +} + diff --git a/uart_getconf.c b/uart_getconf.c new file mode 100644 index 0000000..dafa500 --- /dev/null +++ b/uart_getconf.c @@ -0,0 +1,177 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_getconf.c,v 1.1.2.3 2009-02-20 20:16:09 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2007 */ + +#include +#include +#include + +#if UART_IS_USART + +static inline uint8_t get_ucsrc(uint8_t num) +{ +#ifdef URSEL + uint8_t tmp; + /* on some uC, reading UCSRxC is a bit tricky */ + switch(num) { +#ifdef UART0_COMPILE + case 0: + tmp = UBRR0H; + tmp = UCSR0C; + break; +#endif +#ifdef UART1_COMPILE + case 1: + tmp = UBRR1H; + tmp = UCSR1C; + break; +#endif +#ifdef UART2_COMPILE + case 2: + tmp = UBRR2H; + tmp = UCSR2C; + break; +#endif +#ifdef UART3_COMPILE + case 3: + tmp = UBRR3H; + tmp = UCSR3C; + break; +#endif + default: + tmp = 0; + break; + } + return tmp; +#else + return *uart_regs[num].ucsrc; +#endif /* URSEL */ +} + +/* return number of bits in current conf. Intr must be disabled. */ +uint8_t uart_getconf_nbits(uint8_t num) +{ + uint8_t nbits; + + nbits = (get_ucsrc(num) >> UCSZ0) & 0x03; +#ifdef CONFIG_MODULE_UART_9BITS + if (*uart_regs[num].ucsrb & (1 << UCSZ2)) + nbits += 4; +#endif + nbits += 5; + return nbits; +} + +#else /* UART_IS_USART */ + +/* return number of bits in current conf */ +uint8_t uart_getconf_nbits(uint8_t num) +{ +#ifdef CONFIG_MODULE_UART_9BITS + if (*uart_regs[num].ucsrb & (uint8_t)(1 << CHR9)) + return 8; + else + return 9; +#else + return 8; +#endif +} + +#endif /* UART_IS_USART */ + + +#if UART_IS_USART + +/* return number of bits in current conf */ +static inline uint16_t uart_get_baudreg(uint8_t num) +{ + return ((uint16_t)*uart_regs[num].ubrrh << 8) | + (uint16_t)*uart_regs[num].ubrrl; +} + +#else /* UART_IS_USART */ + +/* return number of bits in current conf */ +static inline uint16_t uart_get_baudreg(uint8_t num) +{ + return (uint16_t)*uart_regs[num].ubrrl; +} + +#endif /* UART_IS_USART */ + + +/* get the running uart configurtion */ +void uart_getconf(uint8_t num, struct uart_config *u) +{ + uint8_t tmp; + uint8_t flags; + + IRQ_LOCK(flags); + + /* XXX */ + /* enabled if RXEN is set */ + if (*uart_regs[num].ucsrb & (1 << RXEN)) + u->enabled = 1; + else + u->enabled = 0; + + /* intrp enabled if RXCIE is set */ + if (*uart_regs[num].ucsrb & (1 << RXCIE)) + u->intr_enabled = 1; + else + u->intr_enabled = 0; + + /* use double speed */ + if (UART_HAS_U2X && (*uart_regs[num].ucsra & (1 << U2X))) + u->use_double_speed = 1; + else + u->use_double_speed = 0; + + + /* parity */ + if (UART_IS_USART) { + tmp = get_ucsrc(num) & ((1 << UPM1) | (1 << UPM0)); + if (tmp == ((1 << UPM1) | (1 << UPM0))) + u->parity = UART_PARTITY_ODD; + else if (tmp == (1 << UPM1)) + u->parity = UART_PARTITY_EVEN; + else + u->parity = UART_PARTITY_NONE; + } + else { + u->parity = UART_PARTITY_NONE; + } + + /* stop_bits */ + if (UART_IS_USART && (get_ucsrc(num) & (1 << USBS))) { + u->stop_bits = UART_STOP_BITS_2; + } + else { + u->stop_bits = UART_STOP_BITS_1; + } + + /* nbits */ + u->nbits = uart_getconf_nbits(num); + u->baudrate = (F_CPU / ((uart_get_baudreg(num)+1) * 16)) ; + + IRQ_UNLOCK(flags); +} diff --git a/uart_host.c b/uart_host.c new file mode 100644 index 0000000..04231c2 --- /dev/null +++ b/uart_host.c @@ -0,0 +1,84 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_host.c,v 1.3.4.3 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include + +#include + +/* this file os a stub for host */ + +void uart_init(void) +{ +} + +/* global vars are initialized to 0 (NULL) */ +event *rx_event[UART_HW_NUM]; +event *tx_event[UART_HW_NUM]; + +void uart_host_rx_event(char c) +{ + /* only one uart */ + if (rx_event[0]) + rx_event[0](c); +} + +void uart_host_tx_event(char c) +{ + /* only one uart */ + if (tx_event[0]) + tx_event[0](c); +} + +int8_t uart_setconf(uint8_t num, struct uart_config *u) +{ + /* XXX todo */ + return 0; +} + +void uart_getconf(uint8_t num, struct uart_config *u) +{ + return; +} + +int uart_recv(uint8_t num) +{ + fcntl(0, F_SETFL, 0); + return getchar(); +} + +int uart_recv_nowait(uint8_t num) +{ + fcntl(0, F_SETFL, O_NONBLOCK); + return getchar(); +} + +int uart_send_nowait(uint8_t num, char c) +{ + return putchar(c); +} + +int uart_send(uint8_t num, char c) +{ + return putchar(c); +} diff --git a/uart_host.h b/uart_host.h new file mode 100644 index 0000000..fec9e5d --- /dev/null +++ b/uart_host.h @@ -0,0 +1,25 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_host.c,v 1.3.4.3 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2010 */ + +void uart_host_rx_event(char c); +void uart_host_tx_event(char c); diff --git a/uart_private.h b/uart_private.h new file mode 100644 index 0000000..34a9453 --- /dev/null +++ b/uart_private.h @@ -0,0 +1,93 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_private.h,v 1.1.2.5 2009-01-03 16:24:50 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#ifndef _UART_PRIVATE_H_ +#define _UART_PRIVATE_H_ + +#include +#include + +#include +#include +#include + +typedef volatile uint8_t *uart_reg_t; + +struct regs { + uart_reg_t udr; + uart_reg_t ucsra; + uart_reg_t ucsrb; + uart_reg_t ucsrc; + uart_reg_t ubrrl; + uart_reg_t ubrrh; +}; + +const struct regs uart_regs[UART_HW_NUM]; + +typedef void (event)(char); +typedef void (event_9bits)(int); + +extern event *rx_event[UART_HW_NUM]; +extern event *tx_event[UART_HW_NUM]; + +void uart_send_next_char(uint8_t num); +int8_t uart_setconf(uint8_t num, struct uart_config *u); + +static inline char uart_get_udr(uint8_t num) +{ + return *uart_regs[num].udr; +} + +static inline void uart_set_udr(uint8_t num, char c) +{ + *uart_regs[num].udr = c; + /* tx event function. We suppose interrupts are already + * locked, so no pb with tx_event pointer */ + if (tx_event[num]) + tx_event[num](c); +} + +#ifdef CONFIG_MODULE_UART_9BITS +static inline int uart_get_udr_9bits(uint8_t num) +{ + int val = *uart_regs[num].udr; + val |= (*uart_regs[num].ucsrb & ((1 << RXB8) ? 0x100 : 0)); + return val; +} + +static inline void uart_set_udr_9bits(uint8_t num, int c) +{ + if (c & 0x100 ) + *uart_regs[num].ucsrb |= (1 << RXB8); + else + *uart_regs[num].ucsrb &= ~(1 << RXB8); + *uart_regs[num].udr = c; + + /* tx event function. We suppose interrupts are already + * locked, so no pb with tx_event pointer */ + if (tx_event[num]) + ((event_9bits *)tx_event[num])(c); +} +#endif /* CONFIG_MODULE_UART_9BITS */ + +#endif /* _UART_PRIVATE_H_ */ diff --git a/uart_recv.c b/uart_recv.c new file mode 100644 index 0000000..8e1bd36 --- /dev/null +++ b/uart_recv.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_recv.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +/* get a char from the receive fifo */ +int uart_recv(uint8_t num) +{ + int elt = 0; + while ( (elt = uart_recv_nowait(num)) == -1 ); + return elt; +} diff --git a/uart_recv9.c b/uart_recv9.c new file mode 100644 index 0000000..d0522d4 --- /dev/null +++ b/uart_recv9.c @@ -0,0 +1,34 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_recv9.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +/* get a char from the receive fifo */ +int uart_9bits_recv(uint8_t num) +{ + int elt = 0; + while ( (elt = uart_9bits_recv_nowait(num)) == -1 ); + return elt; +} diff --git a/uart_recv9_nowait.c b/uart_recv9_nowait.c new file mode 100644 index 0000000..3cded5c --- /dev/null +++ b/uart_recv9_nowait.c @@ -0,0 +1,53 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_recv9_nowait.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +/* get a char from the receive fifo */ +int uart_9bits_recv_nowait(uint8_t num) +{ + char elt = 0; + uint8_t flags; + + /* if interrupt mode is off, we have to check the status + * register */ + if (!(*uart_regs[num].ucsrb & (1 << RXCIE))) { + if ( !(*uart_regs[num].ucsra & (1 << RXC)) ) + return -1; + return uart_get_udr_9bits(num); + } + /* else check the fifo */ + else { + IRQ_LOCK(flags); + if( CIRBUF_GET_LEN(&g_rx_fifo[num]) >= 2) { + cirbuf_get_buf_tail(&g_rx_fifo[num], (char *)&elt, 2); + cirbuf_del_buf_tail(&g_rx_fifo[num], 2); + IRQ_UNLOCK(flags); + return (int)elt; + } + IRQ_UNLOCK(flags); + return -1; + } +} diff --git a/uart_recv_nowait.c b/uart_recv_nowait.c new file mode 100644 index 0000000..2872d21 --- /dev/null +++ b/uart_recv_nowait.c @@ -0,0 +1,53 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_recv_nowait.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +/* get a char from the receive fifo */ +int uart_recv_nowait(uint8_t num) +{ + char elt = 0; + uint8_t flags; + + /* if interrupt mode is off, we have to check the status + * register */ + if (!(*uart_regs[num].ucsrb & (1 << RXCIE))) { + if ( !(*uart_regs[num].ucsra & (1 << RXC)) ) + return -1; + return uart_get_udr(num); + } + /* else check the fifo */ + else { + IRQ_LOCK(flags); + if( !CIRBUF_IS_EMPTY(&g_rx_fifo[num]) ) { + elt = cirbuf_get_tail(&g_rx_fifo[num]); + cirbuf_del_tail(&g_rx_fifo[num]); + IRQ_UNLOCK(flags); + return (int)elt; + } + IRQ_UNLOCK(flags); + return -1; + } +} diff --git a/uart_send.c b/uart_send.c new file mode 100644 index 0000000..e2faed1 --- /dev/null +++ b/uart_send.c @@ -0,0 +1,48 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_send.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +int uart_send(uint8_t num, char c) +{ + /* if cannot send the char */ + if (uart_send_nowait(num, c) == -1) { + + /* if irq lock are masked and interrupt mode is on, we + * have to poll the status register */ + if (GLOBAL_IRQ_ARE_MASKED() && (*uart_regs[num].ucsrb & (1 << RXCIE)) ) { + while( !(*uart_regs[num].ucsra & (1 << UDRE)) ); + /* send the next char in the fifo to free a + * place */ + uart_send_next_char(num); + cirbuf_add_head(&g_tx_fifo[num], c); + } + else { + /* if irq are not locked, we can loop to emit */ + while(uart_send_nowait(num, c) == -1); + } + } + return 0; +} diff --git a/uart_send9.c b/uart_send9.c new file mode 100644 index 0000000..7967b12 --- /dev/null +++ b/uart_send9.c @@ -0,0 +1,48 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_send9.c,v 1.1.2.1 2008-12-27 16:29:08 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +int uart_send_9bits(uint8_t num, int c) +{ + /* if cannot send the char */ + if (uart_send_9bits_nowait(num, c) == -1) { + + /* if irq lock are masked and interrupt mode is on, we + * have to poll the status register */ + if (GLOBAL_IRQ_ARE_MASKED() && (*uart_regs[num].ucsrb & (1 << RXCIE)) ) { + while( !(*uart_regs[num].ucsra & (1 << UDRE)) ); + /* send the next char in the fifo to free two + * places */ + uart_send_next_char(num); + cirbuf_add_buf_head(&g_tx_fifo[num], (char *)&c, 2); + } + else { + /* if irq are not locked, we can loop to emit */ + while(uart_send_9bits_nowait(num, c) == -1); + } + } + return 0; +} diff --git a/uart_send9_nowait.c b/uart_send9_nowait.c new file mode 100644 index 0000000..86bed9c --- /dev/null +++ b/uart_send9_nowait.c @@ -0,0 +1,65 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_send9_nowait.c,v 1.1.2.2 2008-12-27 16:50:01 zer0 Exp $ + * + */ + +/* Olivier MATZ, Droids-corp 2004 - 2009 */ + +#include +#include +#include + +int uart_send_9bits_nowait(uint8_t num, int c) +{ + uint8_t flags; + IRQ_LOCK(flags); + + /* if tx intrp are disabled (RXCIE is 0) */ + if ( !(*uart_regs[num].ucsrb & (1 << RXCIE )) ) { + /* we have to poll the status register before xmit */ + if (*uart_regs[num].ucsra & (1< +#include +#include + + +/* send a char, or put it in the fifo if uart is not ready. Return -1 + * if fifo is full */ +int uart_send_nowait(uint8_t num, char c) +{ + uint8_t flags; + + IRQ_LOCK(flags); + + /* if uart intrp mode is disabled (note that we look rx */ + /* intrp -- RXCIE is 0) */ + if ( !(*uart_regs[num].ucsrb & (1 << RXCIE )) ) { + /* we have to poll the status register before xmit */ + if (*uart_regs[num].ucsra & (1< +#include +#include + +/** The emission fifo of uart */ +#ifdef UART0_COMPILE +char g_tx0_buf[UART0_TX_FIFO_SIZE]; +char g_rx0_buf[UART0_RX_FIFO_SIZE]; +#endif +#ifdef UART1_COMPILE +char g_tx1_buf[UART1_TX_FIFO_SIZE]; +char g_rx1_buf[UART1_RX_FIFO_SIZE]; +#endif +#ifdef UART2_COMPILE +char g_tx2_buf[UART2_TX_FIFO_SIZE]; +char g_rx2_buf[UART2_RX_FIFO_SIZE]; +#endif +#ifdef UART3_COMPILE +char g_tx3_buf[UART3_TX_FIFO_SIZE]; +char g_rx3_buf[UART3_RX_FIFO_SIZE]; +#endif + +#if UART_IS_USART + +static int8_t uart_set_nbits_parity(uint8_t num, struct uart_config * u) +{ + uint8_t ucsrc = 0; + + /* number of bit in the frame */ +#ifdef CONFIG_MODULE_UART_9BITS + if (u->nbits < 5 || u->nbits > 9) { + return ENOTSUP; + } +#else + if (u->nbits < 5 || u->nbits > 8) { + return ENOTSUP; + } +#endif + + ucsrc |= ( ((u->nbits - 5) & 0x03) << UCSZ0 ); +#ifdef CONFIG_MODULE_UART_9BITS + if (u->nbits == 9) + *uart_regs[num].ucsrb |= (1 << UCSZ2); + else +#endif + *uart_regs[num].ucsrb &= ~(1 << UCSZ2); + + /* parity */ + if (u->parity == UART_PARTITY_ODD) + ucsrc |= ((1 << UPM0) | (1 << UPM1)); + else if (u->parity == UART_PARTITY_EVEN) + ucsrc |= (1 << UPM1); + else if (u->parity != UART_PARTITY_NONE) { + return EINVAL; + } + + /* nb of stop bits */ + if (u->stop_bits == UART_STOP_BITS_2) + ucsrc |= (1 << USBS); + else if (u->stop_bits != UART_STOP_BITS_1) + return EINVAL; + +#ifdef URSEL + /* some uC use a special bit URSEL to access to UCSRC */ + ucsrc |= (1<nbits == 8) + *uart_regs[num].ucsrb &= ~(1 << CHR9); +#ifdef CONFIG_MODULE_UART_9BITS + else if (u->nbits == 9) + *uart_regs[num].ucsrb |= (1 << CHR9); +#endif + else + return ENOTSUP; + + /* parity and stop */ + if (u->parity != UART_PARTITY_NONE || + u->stop_bits != UART_STOP_BITS_1) { + return ENOTSUP; + } + + return ESUCCESS; +} +#endif /* UART_IS_USART */ + + +#if UART_IS_USART + +static int8_t uart_set_baudreg(uint8_t num, uint16_t baudreg) +{ + uint8_t lo, hi; + + /* set msb bit of hi to 0 (useful fot uC with URSEL, and not + * important for the others because the baudreg will never be + * as big */ + lo = (uint8_t)baudreg; + hi = (uint8_t)(baudreg>>8) & 0x7F; + + *uart_regs[num].ubrrl = lo; + *uart_regs[num].ubrrh = hi; + + return ESUCCESS; +} + +#else /* UART_IS_USART */ + +static int8_t uart_set_baudreg(uint8_t num, uint16_t baudreg) +{ + uint8_t lo, hi; + + lo=(uint8_t)baudreg; + hi=(uint8_t)(baudreg>>8); + + if (hi != 0) + return EINVAL; + *uart_regs[num].ubrrl = lo; + + return ESUCCESS; +} +#endif /* UART_IS_USART */ + +/* configuration from uart_config.h */ +#define UART_SET_STATICCONF(x) \ + u->enabled = UART##x##_ENABLED; \ + u->intr_enabled = UART##x##_INTERRUPT_ENABLED; \ + u->use_double_speed = UART##x##_USE_DOUBLE_SPEED; \ + u->parity = UART##x##_PARITY; \ + u->stop_bits = UART##x##_STOP_BIT; \ + u->nbits = UART##x##_NBITS; \ + u->baudrate = UART##x##_BAUDRATE; \ + break + +int8_t uart_setconf(uint8_t num, struct uart_config *u) +{ + uint8_t ret = ESUCCESS; + uint16_t baudrate_reg; + struct uart_config static_conf; + uint8_t flags; + + IRQ_LOCK(flags); + + /* static configuration */ + if (!u) { + u = &static_conf; + switch (num) { +#ifdef UART0_COMPILE + case 0: + UART_SET_STATICCONF(0); +#endif +#ifdef UART1_COMPILE + case 1: + UART_SET_STATICCONF(1); +#endif +#ifdef UART2_COMPILE + case 2: + UART_SET_STATICCONF(2); +#endif +#ifdef UART3_COMPILE + case 3: + UART_SET_STATICCONF(3); +#endif + default: + ret = EINVAL; + goto out; + } + } + + /* wait xmit finished (UDRE = 1) */ + while( !(*uart_regs[num].ucsra & (1<enabled) + *uart_regs[num].ucsrb = ((1 << TXEN) | (1 << RXEN)); + else { + *uart_regs[num].ucsrb = 0; + goto out; /* no more conf */ + } + + /* we only enable recv interrupt, the xmit intrpt will be + * enabled in the xmit function */ + if (u->intr_enabled) + *uart_regs[num].ucsrb |= (1 << RXCIE); + + if (UART_HAS_U2X) { /* if u2x is supported */ + if (u->use_double_speed) /* u2x is enabled */ + *uart_regs[num].ucsra |= (1 << U2X); + else + *uart_regs[num].ucsra &= ~(1 << U2X); + } + else if (u->use_double_speed) { + ret = ENOTSUP; + goto out; + } + + uart_set_nbits_parity(num, u); + + /* baudrate */ + if(u->use_double_speed) + baudrate_reg = (F_CPU / (u->baudrate*8l)) - 1; + else + baudrate_reg = (F_CPU / (u->baudrate*16l)) - 1; + + uart_set_baudreg(num, baudrate_reg); + + /* exit */ + out: + IRQ_UNLOCK(flags); + return ret; +} diff --git a/vt100.c b/vt100.c new file mode 100644 index 0000000..f006119 --- /dev/null +++ b/vt100.c @@ -0,0 +1,146 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: vt100.c,v 1.1.2.1 2008-01-05 22:46:28 zer0 Exp $ + * + * + */ + +#include +#include +#include +#include +#include + +#include + +#include "vt100.h" + +static const prog_char cmd0[] = vt100_up_arr; +static const prog_char cmd1[] = vt100_down_arr; +static const prog_char cmd2[] = vt100_right_arr; +static const prog_char cmd3[] = vt100_left_arr; +static const prog_char cmd4[] = "\177"; +static const prog_char cmd5[] = "\n"; +static const prog_char cmd6[] = "\001"; +static const prog_char cmd7[] = "\005"; +static const prog_char cmd8[] = "\013"; +static const prog_char cmd9[] = "\031"; +static const prog_char cmd10[] = "\003"; +static const prog_char cmd11[] = "\006"; +static const prog_char cmd12[] = "\002"; +static const prog_char cmd13[] = vt100_suppr; +static const prog_char cmd14[] = vt100_tab; +static const prog_char cmd15[] = "\004"; +static const prog_char cmd16[] = "\014"; +static const prog_char cmd17[] = "\r"; +static const prog_char cmd18[] = "\033\177"; +static const prog_char cmd19[] = vt100_word_left; +static const prog_char cmd20[] = vt100_word_right; +static const prog_char cmd21[] = "?"; + +const prog_char * vt100_commands[] PROGMEM = { + cmd0, cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, cmd7, + cmd8, cmd9, cmd10, cmd11, cmd12, cmd13, cmd14, + cmd15, cmd16, cmd17, cmd18, cmd19, cmd20, + cmd21, +}; + +void +vt100_init(struct vt100 * vt) +{ + vt->state = VT100_INIT; +} + + +static int8_t +match_command(char * buf, uint8_t size) +{ + const prog_char * cmd; + uint8_t i = 0; + + for (i=0 ; ibufpos > VT100_BUF_SIZE) { + vt->state = VT100_INIT; + vt->bufpos = 0; + } + + vt->buf[vt->bufpos++] = c; + size = vt->bufpos; + + switch (vt->state) { + case VT100_INIT: + if (c == 033) { + vt->state = VT100_ESCAPE; + } + else { + vt->bufpos = 0; + goto match_command; + } + break; + + case VT100_ESCAPE: + if (c == 0133) { + vt->state = VT100_ESCAPE_CSI; + } + else if (c >= 060 && c <= 0177) { /* XXX 0177 ? */ + vt->bufpos = 0; + vt->state = VT100_INIT; + goto match_command; + } + break; + + case VT100_ESCAPE_CSI: + if (c >= 0100 && c <= 0176) { + vt->bufpos = 0; + vt->state = VT100_INIT; + goto match_command; + } + break; + + default: + vt->bufpos = 0; + break; + } + + return -2; + + match_command: + return match_command(vt->buf, size); +} diff --git a/vt100.h b/vt100.h new file mode 100644 index 0000000..c41becd --- /dev/null +++ b/vt100.h @@ -0,0 +1,103 @@ +/* + * Copyright Droids Corporation (2007) + * Olivier MATZ + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: vt100.h,v 1.1.2.2 2009-04-07 20:01:16 zer0 Exp $ + * + * + */ + +#ifndef _VT100_H_ +#define _VT100_H_ + +#define vt100_bell "\007" +#define vt100_bs "\010" +#define vt100_bs_clear "\010 \010" +#define vt100_tab "\011" +#define vt100_crnl "\012\015" +#define vt100_clear_right "\033[0K" +#define vt100_clear_left "\033[1K" +#define vt100_clear_down "\033[0J" +#define vt100_clear_up "\033[1J" +#define vt100_clear_line "\033[2K" +#define vt100_clear_screen "\033[2J" +#define vt100_up_arr "\033\133\101" +#define vt100_down_arr "\033\133\102" +#define vt100_right_arr "\033\133\103" +#define vt100_left_arr "\033\133\104" +#define vt100_multi_right "\033\133%uC" +#define vt100_multi_left "\033\133%uD" +#define vt100_suppr "\033\133\063\176" +#define vt100_home "\033M\033E" +#define vt100_word_left "\033\142" +#define vt100_word_right "\033\146" + + +/* Result of parsing : it must be synchronized with vt100_commands[] + * in vt100.c */ +#define KEY_UP_ARR 0 +#define KEY_DOWN_ARR 1 +#define KEY_RIGHT_ARR 2 +#define KEY_LEFT_ARR 3 +#define KEY_BKSPACE 4 +#define KEY_RETURN 5 +#define KEY_CTRL_A 6 +#define KEY_CTRL_E 7 +#define KEY_CTRL_K 8 +#define KEY_CTRL_Y 9 +#define KEY_CTRL_C 10 +#define KEY_CTRL_F 11 +#define KEY_CTRL_B 12 +#define KEY_SUPPR 13 +#define KEY_TAB 14 +#define KEY_CTRL_D 15 +#define KEY_CTRL_L 16 +#define KEY_RETURN2 17 +#define KEY_META_BKSPACE 18 +#define KEY_WLEFT 19 +#define KEY_WRIGHT 20 +#define KEY_HELP 21 + +extern const prog_char * vt100_commands[] PROGMEM; + +enum vt100_parser_state { + VT100_INIT, + VT100_ESCAPE, + VT100_ESCAPE_CSI, +}; + +#define VT100_BUF_SIZE 8 +struct vt100 { + uint8_t bufpos; + char buf[VT100_BUF_SIZE]; + enum vt100_parser_state state; +}; + +/** + * Init + */ +void vt100_init(struct vt100 *vt); + +/** + * Input a new character. + * Return -1 if the character is not part of a control sequence + * Return -2 if c is not the last char of a control sequence + * Else return the index in vt100_commands[] + */ +int8_t vt100_parser(struct vt100 *vt, char c); + +#endif diff --git a/xbee.c b/xbee.c new file mode 100644 index 0000000..3aead5e --- /dev/null +++ b/xbee.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + + +#include +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" + +int xbee_init(void) +{ + return 0; +} + +int xbee_register_channel(struct xbee_dev *dev, int channel, + xbee_rx_cb_t *rx_cb, void *opaque) +{ + /* user asked for any channel */ + if (channel == XBEE_CHANNEL_ANY) { + int ch; + + /* skip XBEE_DEFAULT_CHANNEL == 0 */ + for (ch = 1; ch < XBEE_MAX_CHANNEL; ch++) { + if (dev->channel[ch].registered == 0) { + channel = ch; + break; + } + } + /* no available channels */ + if (channel == XBEE_CHANNEL_ANY) + return -1; + } + /* user requested a specific channel */ + else if (channel < 0 || channel >= XBEE_MAX_CHANNEL || + dev->channel[channel].registered == 1) + return -1; /* not available */ + + dev->channel[channel].registered = 1; + dev->channel[channel].rx_cb = rx_cb; + dev->channel[channel].arg = opaque; + return channel; +} + +int xbee_unregister_channel(struct xbee_dev *dev, int channel) +{ + if (channel < 0 || channel >= XBEE_MAX_CHANNEL || + dev->channel[channel].registered == 0) + return -1; + dev->channel[channel].registered = 0; + dev->channel[channel].rx_cb = NULL; + dev->channel[channel].arg = NULL; + return 0; +} + +int xbee_set_opaque(struct xbee_dev *dev, int channel, void *opaque) +{ + if (channel < 0 || channel >= XBEE_MAX_CHANNEL || + dev->channel[channel].registered == 0) + return -1; + + dev->channel[channel].arg = opaque; + return 0; +} + +int xbee_open(struct xbee_dev *dev, FILE *xbee_file) +{ + memset(dev, 0, sizeof(*dev)); + dev->file = xbee_file; + xbee_neigh_init(dev); + return 0; +} diff --git a/xbee.h b/xbee.h new file mode 100644 index 0000000..0efdb22 --- /dev/null +++ b/xbee.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Callback when receiving data on a specific channel. The arguments + * of the function are the xbee device, the channel ID, the type of + * the frame (example: XBEE_TYPE_ATRESP), the pointer to the frame, + * the length of the frame, and an opaque pointer (reserved for user) */ +typedef void (xbee_rx_cb_t)(struct xbee_dev *, int, int, void *, + unsigned, void *); + +/* an xbee queue */ +struct xbee_channel { + int registered; + xbee_rx_cb_t *rx_cb; + void *arg; +}; + +#define XBEE_DEFAULT_CHANNEL 0 +#define XBEE_MAX_CHANNEL 16 +#define XBEE_CHANNEL_ANY XBEE_MAX_CHANNEL + +/* structure identifying a xbee device */ +struct xbee_dev { + FILE *file; + struct xbee_channel channel[XBEE_MAX_CHANNEL]; + uint8_t frame_len; + char frame[XBEE_MAX_FRAME_LEN]; + struct xbee_stats stats; + struct xbee_neigh_list neigh_list; +}; + +/* initialize xbee library */ +int xbee_init(void); + +/* open an xbee device */ +int xbee_open(struct xbee_dev *dev, FILE *xbee_file); + +/* closes an xbee device */ +int xbee_close(struct xbee_dev *dev); + +/* Register a channel, return the ID of the channel or a negative + * value on error. The rx_cb is a pointer to a function that will be + * called by xbee_read() when a frame is received for this channel. If + * rx_cb is NULL, no callback will occur. The "channel" argument can + * be XBEE_CHANNEL_ANY to let the library choose the channel, or a + * channel number to request a specific one. */ +int xbee_register_channel(struct xbee_dev *dev, int channel, + xbee_rx_cb_t *rx_cb, void *opaque); + +/* This function (re)sets the opaque pointer on a registered + * channel. The function returns 0 on success and -1 on error (channel + * not registered). As the opaque pointer can already be set after a + * call to xbee_register_channel(), this function is only useful if + * the opaque pointer has to be modified. */ +int xbee_set_opaque(struct xbee_dev *dev, int channel, void *opaque); + +/* Unregister a channel, return 0 on success */ +int xbee_unregister_channel(struct xbee_dev *dev, int channel_id); + +/* read data from device fd and put it in queue */ +int xbee_read(struct xbee_dev *dev); + +/* process all data in queue */ +int xbee_process_queue(struct xbee_dev *dev); diff --git a/xbee_atcmd.c b/xbee_atcmd.c new file mode 100644 index 0000000..bd2a2d7 --- /dev/null +++ b/xbee_atcmd.c @@ -0,0 +1,1168 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include + +#include "xbee_atcmd.h" + +prog_char atcmd0_name[] = "WR"; +prog_char atcmd0_desc[] = "write-param"; +prog_char atcmd0_help[] = + "Write parameter values to non-volatile memory."; + +prog_char atcmd1_name[] = "RE"; +prog_char atcmd1_desc[] = "restore-defaults"; +prog_char atcmd1_help[] = + "Restore module parameters to factory defaults."; + +prog_char atcmd2_name[] = "FR"; +prog_char atcmd2_desc[] = "soft-reset"; +prog_char atcmd2_help[] = + "Software Reset. Responds with 'OK' then performs a " + "reset 100ms later."; + +prog_char atcmd3_name[] = "AC"; +prog_char atcmd3_desc[] = "apply-changes"; +prog_char atcmd3_help[] = + "Apply Changes without exiting command mode."; + +prog_char atcmd4_name[] = "R1"; +prog_char atcmd4_desc[] = "restore-compiled"; +prog_char atcmd4_help[] = + "Restore module parameters to compiled defaults."; + +prog_char atcmd5_name[] = "VL"; +prog_char atcmd5_desc[] = "version-long"; +prog_char atcmd5_help[] = + "Shows detailed version information including" + "application build date and time."; + +prog_char atcmd6_name[] = "DH"; +prog_char atcmd6_desc[] = "dst-addr-high"; +prog_char atcmd6_help[] = + "Upper 32 bits of the 64-bit destination address (0 " + "to 0xFFFFFFFF, default is 0x0000FFFF)."; + +prog_char atcmd7_name[] = "DL"; +prog_char atcmd7_desc[] = "dst-addr-low"; +prog_char atcmd7_help[] = + "Lower 32 bits of the 64-bit destination address (0 " + "to 0xFFFFFFFF, default is 0x0000FFFF)."; + +prog_char atcmd8_name[] = "DD"; +prog_char atcmd8_desc[] = "device-type-id"; +prog_char atcmd8_help[] = + "Device Type Identifier, it can be used to differentiate " + "multiple XBee-based products (0 to 0xFFFFFFFF, read-only, " + "default is 0x40000)."; + +prog_char atcmd9_name[] = "SH"; +prog_char atcmd9_desc[] = "src-addr-high"; +prog_char atcmd9_help[] = + "Upper 32 bits of the 64-bit source address (read-only)."; + +prog_char atcmd10_name[] = "SL"; +prog_char atcmd10_desc[] = "src-addr-low"; +prog_char atcmd10_help[] = + "Lower 32 bits of the 64-bit source address (read-only)."; + +prog_char atcmd11_name[] = "SE"; +prog_char atcmd11_desc[] = "src-endpoint"; +prog_char atcmd11_help[] = + "The application source endpoint for all data transmissions " + "(0 to 0xFF, default is 0xE8)."; + +prog_char atcmd12_name[] = "DE"; +prog_char atcmd12_desc[] = "dst-endpoint"; +prog_char atcmd12_help[] = + "The application destination endpoint for all data " + "transmissions (0 to 0xFF, default is 0xE8)."; + +prog_char atcmd13_name[] = "CI"; +prog_char atcmd13_desc[] = "cluster-id"; +prog_char atcmd13_help[] = + "Cluster Identifier for all data transmissions (0 to 0xFFFF, " + "default is 0x11)."; + +prog_char atcmd14_name[] = "NP"; +prog_char atcmd14_desc[] = "max-rf-payload"; +prog_char atcmd14_help[] = + "Maximum RF Payload Bytes that can be sent in a unicast " + "transmission based on the current configuration (0 to " + "0xFFFF)."; + +prog_char atcmd15_name[] = "CE"; +prog_char atcmd15_desc[] = "coord-end-device"; +prog_char atcmd15_help[] = + "Coordinator/End Device, messaging mode of the module " + "(0 - Normal, 1 - Indirect coordinator, 2 - Polling, default " + "is 0)."; + +prog_char atcmd16_name[] = "AP"; +prog_char atcmd16_desc[] = "api-mode"; +prog_char atcmd16_help[] = + "API mode (0 - off, 1 - on, 2 - on with escape sequences)."; + +prog_char atcmd17_name[] = "AO"; +prog_char atcmd17_desc[] = "api-output-format"; +prog_char atcmd17_help[] = + "API Output Format (0 - standard [0x90 for RX], 1 - explicit " + "addressing [0x91 for RX])."; + +prog_char atcmd18_name[] = "BD"; +prog_char atcmd18_desc[] = "baud-rate"; +prog_char atcmd18_help[] = + "Baud rate of serial interface (0-8 select preset standard " + "rates, and 0x39 to 0x1c9c38 select baud rate)."; + +prog_char atcmd19_name[] = "RO"; +prog_char atcmd19_desc[] = "packetization-timeout"; +prog_char atcmd19_help[] = + "Packetization Timeout: the inter-character silence required " + "before packetization specified in character times (0 to 0xFF, " + "default is 3)."; + +prog_char atcmd20_name[] = "FT"; +prog_char atcmd20_desc[] = "flow-control-thres"; +prog_char atcmd20_help[] = + "Flow Control Threshhold. De-assert CTS and/or send XOFF when " + "FT bytes are in the UART receive buffer. Re-assert CTS when " + "less than FT - 16 bytes are in the UART receive buffer (0x11 " + "to 0xEE, default is 0xBE)."; + +prog_char atcmd21_name[] = "NB"; +prog_char atcmd21_desc[] = "parity"; +prog_char atcmd21_help[] = + "Parity (0 - no parity, 1 - even parity, 2 - odd parity, 3 - " + "forced high parity, 4 - forced low parity). Default is 0."; + +prog_char atcmd22_name[] = "D7"; +prog_char atcmd22_desc[] = "dio7"; +prog_char atcmd22_help[] = + "DIO7 Configuration (0 - unmonitored input, 1 - CTS, 3 - " + "digital input, 4 - digital output low, 5 - digital output " + "high, 6 - RS-485 low Tx, 7 - RS-485 high Tx). Default is " + "0."; + +prog_char atcmd23_name[] = "D6"; +prog_char atcmd23_desc[] = "dio6"; +prog_char atcmd23_help[] = + "DIO6 Configuration (0 - unmonitored input, 1 - RTS, 3 - " + "digital input, 4 - digital output low, 5 - digital output " + "high). Default is 0."; + +prog_char atcmd24_name[] = "P0"; +prog_char atcmd24_desc[] = "dio10-pwm0"; +prog_char atcmd24_help[] = + "DIO10/PWM0 Configuration. (0 - unmonitored input, 1 - RSSI, 2 " + "- PWM0, 3 - digital input, 4 - digital output low, 5 - " + "digital output high). Default is 1."; + +prog_char atcmd25_name[] = "P1"; +prog_char atcmd25_desc[] = "dio11-pwm1"; +prog_char atcmd25_help[] = + "DIO11/PWM1 Configuration. (0 - unmonitored input, 2 " + "- PWM1, 3 - digital input, 4 - digital output low, 5 - " + "digital output high). Default is 0."; + +prog_char atcmd26_name[] = "P2"; +prog_char atcmd26_desc[] = "dio12"; +prog_char atcmd26_help[] = + "DIO12 Configuration. (0 - unmonitored input, " + "3 - digital input, 4 - digital output low, 5 - " + "digital output high). Default is 0."; + +prog_char atcmd27_name[] = "RP"; +prog_char atcmd27_desc[] = "rssi-pwm"; +prog_char atcmd27_help[] = + "Time RSSI signal will be output after last transmission. " + "When RP[] = 0xFF, output will always be on (0 - 0xFF, default " + "is 0x28[] = 4 seconds)."; + +prog_char atcmd28_name[] = "1S"; +prog_char atcmd28_desc[] = "sensor-sample"; +prog_char atcmd28_help[] = + "Forces a sample to be taken on an XBee Sensor device."; + +prog_char atcmd29_name[] = "D0"; +prog_char atcmd29_desc[] = "dio0-ad0"; +prog_char atcmd29_help[] = + "AD0/DIO0 Configuration. (0 - unmonitored input, 1 - " + "commission button enabled, 2 - analog input, 3 - digital " + "input, 4 - digital output low, 5 - digital output high). " + "Default is 1."; + +prog_char atcmd30_name[] = "D1"; +prog_char atcmd30_desc[] = "dio1-ad1"; +prog_char atcmd30_help[] = + "AD1/DIO1 Configuration. (0 - unmonitored input, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 0."; + +prog_char atcmd31_name[] = "D2"; +prog_char atcmd31_desc[] = "dio2-ad2"; +prog_char atcmd31_help[] = + "AD2/DIO2 Configuration. (0 - unmonitored input, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 0."; + +prog_char atcmd32_name[] = "D3"; +prog_char atcmd32_desc[] = "dio3-ad3"; +prog_char atcmd32_help[] = + "AD3/DIO3 Configuration. (0 - unmonitored input, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 0."; + +prog_char atcmd33_name[] = "D4"; +prog_char atcmd33_desc[] = "dio4-ad4"; +prog_char atcmd33_help[] = + "AD4/DIO4 Configuration. (0 - unmonitored input, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 0."; + +prog_char atcmd34_name[] = "D5"; +prog_char atcmd34_desc[] = "dio5-ad5"; +prog_char atcmd34_help[] = + "AD4/DIO4 Configuration. (0 - unmonitored input, 1 - LED, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 1."; + +prog_char atcmd35_name[] = "D8"; +prog_char atcmd35_desc[] = "dio8-sleep-rq"; +prog_char atcmd35_help[] = + "DIO8/SLEEP_RQ Configuration. (0 - unmonitored input, 1 - LED, " + "2 - analog input, 3 - digital input, 4 - digital output " + "low, 5 - digital output high). Default is 0. When used as " + "SLEEP_RQ, the D8 parameter should be configured in mode 0 " + "or 3."; + +prog_char atcmd36_name[] = "D9"; +prog_char atcmd36_desc[] = "dio9-on-sleep"; +prog_char atcmd36_help[] = + "DIO9/ON_SLEEP Configuration. (0 - unmonitored input, 1 - " + "ON/SLEEP, 2 - analog input, 3 - digital input, 4 - digital " + "output low, 5 - digital output high). Default is ?."; + +prog_char atcmd37_name[] = "PR"; +prog_char atcmd37_desc[] = "pull-up-resistor"; +prog_char atcmd37_help[] = + "Pull-up Resistor. Bit field that configures the internal " + "pull-up resistors for the I/O lines (bit set = pull-up " + "enabled). Range is from 0 to 0x1FFF, default is 0x1FFF."; + +prog_char atcmd38_name[] = "M0"; +prog_char atcmd38_desc[] = "pwm0-out-level"; +prog_char atcmd38_help[] = + "PWM0 Output Level. The line should be configured as a PWM " + "output using the P0 command (0 to 0x3FF, default is 0)."; + +prog_char atcmd39_name[] = "M1"; +prog_char atcmd39_desc[] = "pwm1-out-level"; +prog_char atcmd39_help[] = + "PWM1 Output Level. The line should be configured as a PWM " + "output using the P1 command (0 to 0x3FF, default is 0)."; + +prog_char atcmd40_name[] = "LT"; +prog_char atcmd40_desc[] = "led-blink-time"; +prog_char atcmd40_help[] = + "Associate LED Blink Time (should be enabled through D5 "; + +prog_char atcmd41_name[] = "IS"; +prog_char atcmd41_desc[] = "force-sample"; +prog_char atcmd41_help[] = + "Forces a read of all enabled digital and " + "analog input lines."; + +prog_char atcmd42_name[] = "IC"; +prog_char atcmd42_desc[] = "digital-change-detect"; +prog_char atcmd42_help[] = + "I/O Digital Change Detection. If a pin is enabled as a " + "digital input/output, the IC command can be used to " + "force an immediate I/O sample transmission when the DIO " + "state changes. IC is a bitmask, range is 0 to 0xFFFF, " + "default is 0"; + +prog_char atcmd43_name[] = "IR"; +prog_char atcmd43_desc[] = "io-sample-rate"; +prog_char atcmd43_help[] = + "IO Sample Rate for periodic sampling. If zero, periodic " + "sampling is disabled. Else the value is in milliseconds " + "(range 0 to 0xFFFF, default is 0)."; + +prog_char atcmd44_name[] = "CB"; +prog_char atcmd44_desc[] = "comissioning-button"; +prog_char atcmd44_help[] = + "Commissioning Pushbutton, simulate commissioning button " + "in software. The parameter value should be set to the number " + "of button presses to be simulated (range is 0 to 4)."; + +prog_char atcmd45_name[] = "VR"; +prog_char atcmd45_desc[] = "firmware-version"; +prog_char atcmd45_help[] = + "Firmware version of the module (read only)."; + +prog_char atcmd46_name[] = "HV"; +prog_char atcmd46_desc[] = "hardware-version"; +prog_char atcmd46_help[] = + "Hardware version of the module (read only)."; + +prog_char atcmd47_name[] = "CK"; +prog_char atcmd47_desc[] = "config-code"; +prog_char atcmd47_help[] = + "Configuration Code, that can be used as a quick " + "check to determine if a node has been configured as " + "desired (read-only, 0-0xFFFFFFFF)."; + +prog_char atcmd48_name[] = "ER"; +prog_char atcmd48_desc[] = "rf-errors"; +prog_char atcmd48_help[] = + "Number of times a packet was received which contained errors " + "of some sort. Read-only, saturate at 0xFFFF."; + +prog_char atcmd49_name[] = "GD"; +prog_char atcmd49_desc[] = "good-packets"; +prog_char atcmd49_help[] = + "Number of good received frames. Read-only, saturate at " + "0xFFFF."; + +prog_char atcmd50_name[] = "RP"; +prog_char atcmd50_desc[] = "rssi-pwm-timer"; +prog_char atcmd50_help[] = + "RSSI PWM timer, the time in tenth of seconds that the RSSI " + "output indicating signal strength will remain active after " + "the last reception (1 to 0xff, default is 0x20 = 3.2 secs)."; + +prog_char atcmd51_name[] = "TR"; +prog_char atcmd51_desc[] = "tx-errors"; +prog_char atcmd51_help[] = + "Transmission Errors, the number of MAC frames that " + "exhaust MAC retries without ever receiving a MAC " + "acknowledgement message. Read-only, saturate at 0xFFFF."; + +prog_char atcmd52_name[] = "TP"; +prog_char atcmd52_desc[] = "temperature"; +prog_char atcmd52_help[] = + "Temperature. Read module temperature in (tenths of ?) " + "Celsius. Negatives temperatures can be returned (read-only, " + "from 0xff74 [-140] to 0x0258 [600])."; + +prog_char atcmd53_name[] = "DB"; +prog_char atcmd53_desc[] = "rx-signal-strength"; +prog_char atcmd53_help[] = + "Received Signal Strength of the last received RF data " + "packet measured in -dBm. For example if DB returns 0x60, " + "then the RSSI of the last packet received was -96dBm " + "(read-only)."; + +prog_char atcmd54_name[] = "DC"; +prog_char atcmd54_desc[] = "duty-cycle"; +prog_char atcmd54_help[] = + "Duty Cycle. Returns a current usage percentage of the " + "10% duty cycle measured over the period of 1 hour " + "(read-only, from 0 to 0x64)."; + +prog_char atcmd55_name[] = "RC"; +prog_char atcmd55_desc[] = "rssi-for-channel"; +prog_char atcmd55_help[] = + "Reads the dBm level (RSSI) of the designated " + "channel."; + +prog_char atcmd56_name[] = "R#"; +prog_char atcmd56_desc[] = "reset-number"; +prog_char atcmd56_help[] = + "Tells the reason for the last module reset (0 - Power up " + "reset, 2 - Watchdog reset, 3 - Software reset, 4 - Reset " + "line reset, 5 - Brownout reset). Read-only."; + +prog_char atcmd57_name[] = "TA"; +prog_char atcmd57_desc[] = "tx-ack-errors"; +prog_char atcmd57_help[] = + "Transmit Acknowlegement Errors. Incremented once for " + "each failed ack retry (read-only, from 0 to 0xFFFF)."; + +prog_char atcmd58_name[] = "%V"; +prog_char atcmd58_desc[] = "supply-voltage"; +prog_char atcmd58_help[] = + "Voltage on the Vcc pin in mV (read-only, from 0 to 0xF00)."; + +prog_char atcmd59_name[] = "CT"; +prog_char atcmd59_desc[] = "cmd-mode-timeout"; +prog_char atcmd59_help[] = + "Command Mode Timeout: the period of inactivity (no valid " + "commands received) after which the RF module automatically " + "exits AT Command Mode and returns to Idle Mode (2 to 0x1770, " + "default is 0x64)."; + +prog_char atcmd60_name[] = "CN"; +prog_char atcmd60_desc[] = "exit-cmd-mode"; +prog_char atcmd60_help[] = + "Exit Command Mode."; + +prog_char atcmd61_name[] = "GT"; +prog_char atcmd61_desc[] = "guard-times"; +prog_char atcmd61_help[] = + "Guard Times: period of silence in ms before and after the " + "Command Sequence Characters of the AT Command Mode Sequence, " + "used to prevent inadvertent entrance into AT Command Mode " + "(0 to 0xFFFF, default is 0x3E8)."; + +prog_char atcmd62_name[] = "CC"; +prog_char atcmd62_desc[] = "command-chars"; +prog_char atcmd62_help[] = + "Command Character used between guard times of the AT Command " + "Mode Sequence (0 to 0xFF, default is 0x2B)."; + +prog_char atcmd63_name[] = "ID"; +prog_char atcmd63_desc[] = "network-id"; +prog_char atcmd63_help[] = + "Network ID. Nodes must have the same network identifier " + "to communicate (0 to 0x7FFF, default is 0x7FFF)."; + +prog_char atcmd64_name[] = "NT"; +prog_char atcmd64_desc[] = "ndisc-timeout"; +prog_char atcmd64_help[] = + "Node Discover Timeout, time in tenth of secs a node will " + "spend discovering other nodes when ND or DN is issued (0 " + "to 0xFC, default is 0x82)."; + +prog_char atcmd65_name[] = "NI"; +prog_char atcmd65_desc[] = "node-id"; +prog_char atcmd65_help[] = + "Node Identifier in printable ASCII characters. This string is " + "returned as part of the ATND (Network Discover) command. This " + "identifier is also used with the ATDN (Destination Node) " + "command. The string contains up to 20 byte ASCII string, " + "default is a space character."; + +prog_char atcmd66_name[] = "DN"; +prog_char atcmd66_desc[] = "disc-node"; +prog_char atcmd66_help[] = /* XXX */ + "Resolves a Node Identifier string to a physical address " + "(case sensitive). 0xFFFE and the 64bits extended address are " + "returned."; + +prog_char atcmd67_name[] = "ND"; +prog_char atcmd67_desc[] = "network-discover"; +prog_char atcmd67_help[] = "Network Discovery, see doc"; /* XXX */ + +prog_char atcmd68_name[] = "NO"; +prog_char atcmd68_desc[] = "ndisc-options"; +prog_char atcmd68_help[] = + "Network Discovery Options, a bitfield value that changes the " + "behavior of the ND command (bit0 - Append DD value, bit1 - " + "Local device sends ND response frame when ND is issued). " + "Default is 0."; + +prog_char atcmd69_name[] = "EE"; +prog_char atcmd69_desc[] = "security enable"; +prog_char atcmd69_help[] = + "Enable or disable 128-bit AES encryption (0 or 1, 0 is the " + "default)."; + +prog_char atcmd70_name[] = "KY"; /* XXX */; +prog_char atcmd70_desc[] = "security-key"; +prog_char atcmd70_help[] = + "The 128bits security key (the command is write-only)."; + +prog_char atcmd71_name[] = "MT"; +prog_char atcmd71_desc[] = "bcast-multi-xmit"; +prog_char atcmd71_help[] = + "Number of additional MAC-level broadcast transmissions. All " + "broadcast packets are transmitted MT+1 times to ensure " + "it is received (0 to 0xF, default is 3)."; + +prog_char atcmd72_name[] = "RR"; +prog_char atcmd72_desc[] = "unicast-retries"; +prog_char atcmd72_help[] = + "Number of additional MAC-level packet delivery attempts for " + "unicast transactions. If RR is non-zero, packets sent from " + "the radio will request an acknowledgement, and can be resent " + "up to RR times if no acknowledgement is received. (0 to 0xF, " + "default is 10)."; + +prog_char atcmd73_name[] = "PL"; +prog_char atcmd73_desc[] = "power-level"; +prog_char atcmd73_help[] = + "Power Level of RF transmitter (0 - 1mW, 1 - 23mW, 2 - 100mW, " + "3 - 158 mW, 4 - 316 mW). Default is 4."; + +prog_char atcmd74_name[] = "SM"; +prog_char atcmd74_desc[] = "sleep-mode"; +prog_char atcmd74_help[] = + "Sleep Mode (0 - disabled, 1 - pin sleep, 4 - async cyclic " + "sleep, 5 - async cyclic sleep with pin wakeup). Default " + "is 0."; + +prog_char atcmd75_name[] = "SO"; +prog_char atcmd75_desc[] = "sleep-options"; +prog_char atcmd75_help[] = + "Sleep Options bitmask (bit8 - always wake for ST time). " + "Default is 0."; + +prog_char atcmd76_name[] = "ST"; +prog_char atcmd76_desc[] = "wake-time"; +prog_char atcmd76_help[] = + "Wake Time: the amount of time in ms that the module will stay " + "awake after receiving RF or serial data (from 0x45 to " + "0x36EE80, default is 0x7D0 = 2 secs)."; + +prog_char atcmd77_name[] = "SP"; +prog_char atcmd77_desc[] = "sleep-period"; +prog_char atcmd77_help[] = + "Sleep Period: the amount of time in 10ms unit the module will " + "sleep per cycle. For a node operating as an Indirect " + "Messaging Coordinator, this command defines the amount of " + "time that it will hold an indirect message for an end device. " + "The coordinator will hold the message for (2.5 * SP). Range " + "is from 1 to 1440000, default is 200 (2 secs)."; + +prog_char atcmd78_name[] = "SN"; +prog_char atcmd78_desc[] = "num-sleep-periods"; +prog_char atcmd78_help[] = + "Number of Sleep Periods that must elapse between assertions " + "of the ON_SLEEP line during the wake time of asynchronous " + "cyclic sleep (1 to 0xFFFF, default is 1)."; + +prog_char atcmd79_name[] = "WH"; +prog_char atcmd79_desc[] = "wake-host"; +prog_char atcmd79_help[] = "Wake Host time. If it is set to a non-zero value, it " + "specifies the time in ms that the device should allow after " + "waking from sleep before sending data out the UART or " + "transmitting an I/O sample. If serial characters are " + "received, the WH timer is stopped immediately. Range is " + "from 0 to 0xFFFF, default is 0."; + +struct xbee_atcmd_pgm xbee_atcmd_list[] = { + { + /* "WR" */ + atcmd0_name, + atcmd0_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd0_help, + }, + { + /* "RE" */ + atcmd1_name, + atcmd1_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd1_help, + }, + { + /* "FR" */ + atcmd2_name, + atcmd2_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd2_help, + }, + { + /* "AC" */ + atcmd3_name, + atcmd3_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd3_help, + }, + { + /* "R1" */ + atcmd4_name, + atcmd4_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd4_help, + }, + { + /* "VL" */ + atcmd5_name, + atcmd5_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd5_help, + }, + { + /* "DH" */ + atcmd6_name, + atcmd6_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd6_help, + }, + { + /* "DL" */ + atcmd7_name, + atcmd7_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd7_help, + }, + { + /* "DD" */ + atcmd8_name, + atcmd8_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ, + atcmd8_help, + }, + { + /* "SH" */ + atcmd9_name, + atcmd9_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ, + atcmd9_help, + }, + { + /* "SL" */ + atcmd10_name, + atcmd10_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ, + atcmd10_help, + }, + { + /* "SE" */ + atcmd11_name, + atcmd11_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd11_help, + }, + { + /* "DE" */ + atcmd12_name, + atcmd12_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd12_help, + }, + { + /* "CI" */ + atcmd13_name, + atcmd13_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd13_help, + }, + { + /* "NP" */ + atcmd14_name, + atcmd14_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd14_help, + }, + { + /* "CE" */ + atcmd15_name, + atcmd15_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd15_help, + }, + { + /* "AP" */ + atcmd16_name, + atcmd16_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd16_help, + }, + { + /* "AO" */ + atcmd17_name, + atcmd17_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd17_help, + }, + { + /* "BD" */ + atcmd18_name, + atcmd18_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd18_help, + }, + { + /* "RO" */ + atcmd19_name, + atcmd19_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd19_help, + }, + { + /* "FT" */ + atcmd20_name, + atcmd20_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd20_help, + }, + { + /* "NB" */ + atcmd21_name, + atcmd21_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd21_help, + }, + { + /* "D7" */ + atcmd22_name, + atcmd22_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd22_help, + }, + { + /* "D6" */ + atcmd23_name, + atcmd23_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd23_help, + }, + { + /* "P0" */ + atcmd24_name, + atcmd24_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd24_help, + }, + { + /* "P1" */ + atcmd25_name, + atcmd25_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd25_help, + }, + { + /* "P2" */ + atcmd26_name, + atcmd26_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd26_help, + }, + { + /* "RP" */ + atcmd27_name, + atcmd27_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd27_help, + }, + { + /* "1S" */ + atcmd28_name, + atcmd28_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd28_help, + }, + { + /* "D0" */ + atcmd29_name, + atcmd29_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd29_help, + }, + { + /* "D1" */ + atcmd30_name, + atcmd30_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd30_help, + }, + { + /* "D2" */ + atcmd31_name, + atcmd31_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd31_help, + }, + { + /* "D3" */ + atcmd32_name, + atcmd32_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd32_help, + }, + { + /* "D4" */ + atcmd33_name, + atcmd33_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd33_help, + }, + { + /* "D5" */ + atcmd34_name, + atcmd34_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd34_help, + }, + { + /* "D8" */ + atcmd35_name, + atcmd35_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd35_help, + }, + { + /* "D9" */ + atcmd36_name, + atcmd36_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd36_help, + }, + { + /* "PR" */ + atcmd37_name, + atcmd37_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd37_help, + }, + { + /* "M0" */ + atcmd38_name, + atcmd38_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd38_help, + }, + { + /* "M1" */ + atcmd39_name, + atcmd39_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd39_help, + }, + { + /* "LT" */ + atcmd40_name, + atcmd40_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd40_help, + }, + { + /* "IS" */ + atcmd41_name, + atcmd41_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd41_help, + }, + { + /* "IC" */ + atcmd42_name, + atcmd42_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd42_help, + }, + { + /* "IR" */ + atcmd43_name, + atcmd43_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd43_help, + }, + { + /* "CB" */ + atcmd44_name, + atcmd44_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd44_help, + }, + { + /* "VR" */ + atcmd45_name, + atcmd45_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ, + atcmd45_help, + }, + { + /* "HV" */ + atcmd46_name, + atcmd46_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd46_help, + }, + { + /* "CK" */ + atcmd47_name, + atcmd47_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ, + atcmd47_help, + }, + { + /* "ER" */ + atcmd48_name, + atcmd48_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd48_help, + }, + { + /* "GD" */ + atcmd49_name, + atcmd49_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd49_help, + }, + { + /* "RP" */ + atcmd50_name, + atcmd50_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd50_help, + }, + { + /* "TR" */ + atcmd51_name, + atcmd51_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd51_help, + }, + { + /* "TP" */ + atcmd52_name, + atcmd52_desc, + XBEE_ATCMD_F_PARAM_S16 | XBEE_ATCMD_F_READ, + atcmd52_help, + }, + { + /* "DB" */ + atcmd53_name, + atcmd53_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ, + atcmd53_help, + }, + { + /* "DC" */ + atcmd54_name, + atcmd54_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ, + atcmd54_help, + }, + { + /* "RC" */ + atcmd55_name, + atcmd55_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ, + atcmd55_help, + }, + { + /* "R#" */ + atcmd56_name, + atcmd56_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ, + atcmd56_help, + }, + { + /* "TA" */ + atcmd57_name, + atcmd57_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ, + atcmd57_help, + }, + { + /* "%V" */ + atcmd58_name, + atcmd58_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ, + atcmd58_help, + }, + { + /* "CT" */ + atcmd59_name, + atcmd59_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd59_help, + }, + { + /* "CN" */ + atcmd60_name, + atcmd60_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd60_help, + }, + { + /* "GT" */ + atcmd61_name, + atcmd61_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd61_help, + }, + { + /* "CC" */ + atcmd62_name, + atcmd62_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd62_help, + }, + { + /* "ID" */ + atcmd63_name, + atcmd63_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd63_help, + }, + { + /* "NT" */ + atcmd64_name, + atcmd64_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd64_help, + }, + { + /* "NI" */ + atcmd65_name, + atcmd65_desc, + XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ | + XBEE_ATCMD_F_WRITE, + atcmd65_help, + }, + { + /* "DN" */ + atcmd66_name, + atcmd66_desc, + XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ | + XBEE_ATCMD_F_WRITE, + atcmd66_help, + }, + { + /* "ND" */ + atcmd67_name, + atcmd67_desc, + XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE, + atcmd67_help, + }, + { + /* "NO" */ + atcmd68_name, + atcmd68_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd68_help, + }, + { + /* "EE" */ + atcmd69_name, + atcmd69_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd69_help, + }, + { + /* "KY" XXX */ + atcmd70_name, + atcmd70_desc, + XBEE_ATCMD_F_PARAM_HEXBUF_16B | XBEE_ATCMD_F_WRITE, + atcmd70_help, + }, + { + /* "MT" */ + atcmd71_name, + atcmd71_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd71_help, + }, + { + /* "RR" */ + atcmd72_name, + atcmd72_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd72_help, + }, + { + /* "PL" */ + atcmd73_name, + atcmd73_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd73_help, + }, + { + /* "SM" */ + atcmd74_name, + atcmd74_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd74_help, + }, + { + /* "SO" */ + atcmd75_name, + atcmd75_desc, + XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd75_help, + }, + { + /* "ST" */ + atcmd76_name, + atcmd76_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd76_help, + }, + { + /* "SP" */ + atcmd77_name, + atcmd77_desc, + XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd77_help, + }, + { + /* "SN" */ + atcmd78_name, + atcmd78_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd78_help, + }, + { + /* "WH" */ + atcmd79_name, + atcmd79_desc, + XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE, + atcmd79_help, + }, + { + NULL, + NULL, + 0, + NULL, + }, +}; + +struct xbee_atcmd_pgm *xbee_atcmd_lookup_name(const char *atcmd_str) +{ + struct xbee_atcmd_pgm *cmd; + struct xbee_atcmd copy; + + for (cmd = &xbee_atcmd_list[0], memcpy_P(©, cmd, sizeof(copy)); + copy.name != NULL; + cmd++, memcpy_P(©, cmd, sizeof(copy))) { + + if (!strcmp_P(atcmd_str, copy.name)) + break; + } + + if (copy.name == NULL) /* not found */ + return NULL; + + return cmd; +} + +struct xbee_atcmd_pgm *xbee_atcmd_lookup_desc(const char *desc) +{ + struct xbee_atcmd_pgm *cmd; + struct xbee_atcmd copy; + + for (cmd = &xbee_atcmd_list[0], memcpy_P(©, cmd, sizeof(copy)); + copy.name != NULL; + cmd++, memcpy_P(©, cmd, sizeof(copy))) { + if (!strcmp_P(desc, copy.desc)) + break; + } + if (copy.name == NULL) /* not found */ + return NULL; + + return cmd; +} diff --git a/xbee_atcmd.h b/xbee_atcmd.h new file mode 100644 index 0000000..327df8b --- /dev/null +++ b/xbee_atcmd.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _XBEE_ATCMD_H_ +#define _XBEE_ATCMD_H_ + +#define XBEE_ATCMD_F_READ 0x001 +#define XBEE_ATCMD_F_WRITE 0x002 +#define XBEE_ATCMD_F_PARAM_NONE 0x004 +#define XBEE_ATCMD_F_PARAM_U8 0x008 +#define XBEE_ATCMD_F_PARAM_U16 0x010 +#define XBEE_ATCMD_F_PARAM_S16 0x020 +#define XBEE_ATCMD_F_PARAM_U32 0x040 +#define XBEE_ATCMD_F_PARAM_STRING_20B 0x080 +#define XBEE_ATCMD_F_PARAM_HEXBUF_16B 0x100 + +/* list of xbee at commands */ +struct xbee_atcmd { + prog_char *name; + prog_char *desc; + unsigned int flags; + prog_char *help; +}; + +struct xbee_atcmd_pgm { + prog_char *name; + prog_char *desc; + unsigned int flags; + prog_char *help; +} PROGMEM; + +extern struct xbee_atcmd_pgm xbee_atcmd_list[]; + +struct xbee_atcmd_pgm *xbee_atcmd_lookup_name(const char *atcmd_str); +struct xbee_atcmd_pgm *xbee_atcmd_lookup_desc(const char *desc); + +#endif /* _xBEE_ATCMD_H_ */ diff --git a/xbee_buf.c b/xbee_buf.c new file mode 100644 index 0000000..1306b2c --- /dev/null +++ b/xbee_buf.c @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee.h" + +struct xbee_buf *xbee_buf_alloc(void) +{ + struct xbee_buf *xbuf; + + xbuf = malloc(sizeof(*xbuf)); + if (xbuf == NULL) + return NULL; + memset(xbuf, 0, sizeof(*xbuf)); + xbuf->offset = 0; + xbuf->len = 0; + return xbuf; +} + +int xbee_buf_tailroom(struct xbee_buf *xbuf) +{ + return XBEE_BUF_SIZE - xbuf->len - xbuf->offset; +} + +char *xbee_buf_data(struct xbee_buf *xbuf, unsigned off) +{ + if (off >= xbuf->len) + return NULL; + return xbuf->buf + xbuf->offset + off; +} + +char *xbee_buf_head(struct xbee_buf *xbuf) +{ + return xbuf->buf + xbuf->offset; +} + +char *xbee_buf_tail(struct xbee_buf *xbuf) +{ + return xbuf->buf + xbuf->offset + xbuf->len; +} + +void xbee_buf_enqueue(struct xbee_bufq *q, struct xbee_buf *xbuf) +{ + CIRCLEQ_INSERT_TAIL(&q->xbq, xbuf, next); + q->len += xbuf->len; + q->nseg++; +} + +struct xbee_buf *xbee_bufq_last(struct xbee_bufq *q) +{ + if (CIRCLEQ_EMPTY(&q->xbq)) + return NULL; + return CIRCLEQ_LAST(&q->xbq); +} + +void xbee_bufq_init(struct xbee_bufq *q) +{ + CIRCLEQ_INIT(&q->xbq); + q->len = 0; + q->nseg = 0; +} + +void xbee_bufq_append(struct xbee_bufq *q, unsigned len) +{ + struct xbee_buf *xbuf; + + q->len += len; + xbuf = CIRCLEQ_LAST(&q->xbq); + xbuf->len += len; +} + +void xbee_bufq_flush(struct xbee_bufq *q) +{ + struct xbee_buf *xbuf; + + while (!CIRCLEQ_EMPTY(&q->xbq)) { + xbuf = CIRCLEQ_FIRST(&q->xbq); + CIRCLEQ_REMOVE(&q->xbq, xbuf, next); + q->nseg --; + q->len -= xbuf->len; + free(xbuf); + } +} + +char *xbee_bufq_data(struct xbee_bufq *q, unsigned off) +{ + struct xbee_buf *xbuf; + char *data = NULL; + + if (off >= q->len) + return NULL; + + CIRCLEQ_FOREACH(xbuf, &q->xbq, next) { + data = xbee_buf_data(xbuf, off); + if (data != NULL) + return data; + off -= xbuf->len; + } + + return data; +} + +/* drop data in front of queue */ +int xbee_bufq_drop(struct xbee_bufq *q, unsigned len) +{ + struct xbee_buf *xbuf; + + if (len > q->len) + return -1; + + while (!CIRCLEQ_EMPTY(&q->xbq)) { + xbuf = CIRCLEQ_FIRST(&q->xbq); + if (xbuf->len > len) + break; + CIRCLEQ_REMOVE(&q->xbq, xbuf, next); + len -= xbuf->len; + q->nseg --; + q->len -= xbuf->len; + free(xbuf); + xbuf = NULL; + } + + if (xbuf != NULL) { + xbuf->len -= len; + xbuf->offset += len; + q->len -= len; + } + + return 0; +} + +int xbee_bufq_copy(struct xbee_bufq *q, void *buf, unsigned len) +{ + struct xbee_buf *xbuf; + unsigned dstoff = 0, copylen; + + if (len > q->len) + return -1; + + CIRCLEQ_FOREACH(xbuf, &q->xbq, next) { + copylen = len; + if (xbuf->len < len) + copylen = xbuf->len; + memcpy(buf + dstoff, xbuf->buf + xbuf->offset, copylen); + len -= copylen; + if (len == 0) + break; + dstoff += copylen; + } + + return 0; +} + diff --git a/xbee_buf.h b/xbee_buf.h new file mode 100644 index 0000000..cecddcf --- /dev/null +++ b/xbee_buf.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define XBEE_BUF_SIZE 0x200 + +/* a xbee data buffer */ +struct xbee_buf { + CIRCLEQ_ENTRY(xbee_buf) next; + unsigned offset; + unsigned len; + char buf[XBEE_BUF_SIZE]; +}; + +/* queue of xbee_buf */ +CIRCLEQ_HEAD(xbufq, xbee_buf); + +struct xbee_bufq { + struct xbufq xbq; + unsigned len; + unsigned nseg; +}; + +/* allocate a new xbee_buf */ +struct xbee_buf *xbee_buf_alloc(void); + +/* return the number of remaining bytes in xbee_buf */ +int xbee_buf_tailroom(struct xbee_buf *xbuf); + +/* return the pointer to data at offset 'off', or NULL if off > xbuf->len */ +char *xbee_buf_data(struct xbee_buf *xbuf, unsigned off); + +/* return the first data of a xbuf (also works if len is 0) */ +char *xbee_buf_head(struct xbee_buf *xbuf); + +/* return the pointer just after data of a xbuf (also works if len is 0) */ +char *xbee_buf_tail(struct xbee_buf *xbuf); + +/* enqueue a xbuf in a xbufq */ +void xbee_buf_enqueue(struct xbee_bufq *q, struct xbee_buf *xbuf); + + + +/* return the last xbuf of a queue, or NULL if the queue is empty */ +struct xbee_buf *xbee_bufq_last(struct xbee_bufq *q); + +/* initialize a xbuf queue */ +void xbee_bufq_init(struct xbee_bufq *q); + +/* flush a xbuf queue */ +void xbee_bufq_flush(struct xbee_bufq *q); + +/* append data in queue (just update lens), user should memcpy first */ +void xbee_bufq_append(struct xbee_bufq *q, unsigned len); + +/* return the pointer to data at offset 'off', or NULL if off > q->len */ +char *xbee_bufq_data(struct xbee_bufq *q, unsigned off); + +/* drop data in front of queue */ +int xbee_bufq_drop(struct xbee_bufq *q, unsigned len); + +/* copy data in front of queue in a linear buffer */ +int xbee_bufq_copy(struct xbee_bufq *q, void *buf, unsigned len); diff --git a/xbee_neighbor.c b/xbee_neighbor.c new file mode 100644 index 0000000..fc4fcda --- /dev/null +++ b/xbee_neighbor.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_atcmd.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" + +void xbee_neigh_init(struct xbee_dev *dev) +{ + LIST_INIT(&dev->neigh_list); +} + +struct xbee_neigh *xbee_neigh_lookup(struct xbee_dev *dev, const char *name) +{ + struct xbee_neigh *neigh; + + LIST_FOREACH(neigh, &dev->neigh_list, next) { + if (!strcmp(name, neigh->name)) + break; + } + + return neigh; +} + +struct xbee_neigh *xbee_neigh_rlookup(struct xbee_dev *dev, uint64_t addr) +{ + struct xbee_neigh *neigh; + + LIST_FOREACH(neigh, &dev->neigh_list, next) { + if (addr == neigh->addr) + break; + } + + return neigh; +} + +struct xbee_neigh *xbee_neigh_add(struct xbee_dev *dev, const char *name, + uint64_t addr) +{ + struct xbee_neigh *neigh; + + if (xbee_neigh_rlookup(dev, addr) != NULL) + return NULL; + + if (xbee_neigh_lookup(dev, name) != NULL) + return NULL; + + neigh = malloc(sizeof(*neigh)); + if (neigh == NULL) + return NULL; + + neigh->addr = addr; + snprintf(neigh->name, sizeof(neigh->name), "%s", name); + LIST_INSERT_HEAD(&dev->neigh_list, neigh, next); + + return neigh; +} + +void xbee_neigh_del(struct xbee_dev *dev, struct xbee_neigh *neigh) +{ + dev = dev; /* silent compiler */ + LIST_REMOVE(neigh, next); + free(neigh); +} diff --git a/xbee_neighbor.h b/xbee_neighbor.h new file mode 100644 index 0000000..0939a24 --- /dev/null +++ b/xbee_neighbor.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _XBEE_NEIGHBOR_H_ +#define _XBEE_NEIGHBOR_H_ + +struct xbee_neigh { + LIST_ENTRY(xbee_neigh) next; + char name[21]; + uint64_t addr; +}; + +struct xbee_dev; + +/* define struct xbee_neigh_list */ +LIST_HEAD(xbee_neigh_list, xbee_neigh); + +/* init neighbor list of an xbee device */ +void xbee_neigh_init(struct xbee_dev *dev); + +/* return a neighbor from its name */ +struct xbee_neigh *xbee_neigh_lookup(struct xbee_dev *dev, const char *name); + +/* return a neighbor from its address (in host order) */ +struct xbee_neigh *xbee_neigh_rlookup(struct xbee_dev *dev, uint64_t addr); + +/* add a neighbor */ +struct xbee_neigh *xbee_neigh_add(struct xbee_dev *dev, const char *name, + uint64_t addr); + +/* del a neighbor from list */ +void xbee_neigh_del(struct xbee_dev *dev, struct xbee_neigh *neigh); + +#endif /* _XBEE_NEIGHBOR_H_ */ diff --git a/xbee_proto.c b/xbee_proto.c new file mode 100644 index 0000000..7072a6c --- /dev/null +++ b/xbee_proto.c @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_stats.h" +#include "xbee_buf.h" +#include "xbee_proto.h" +#include "xbee.h" + +/* return -1 if the frame is invalid */ +static int xbee_proto_parse_atresp(struct xbee_dev *dev, void *buf, + unsigned len) +{ + struct xbee_atresp_hdr *atresp_hdr; + + dev->stats.rx_atresp++; + + if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_atresp_hdr)) { + dev->stats.rx_frame_too_small++; + return -1; + } + + atresp_hdr = buf + sizeof(struct xbee_hdr); + + /* bad status, but let the frame continue */ + if (atresp_hdr->status != 0) + dev->stats.rx_atresp_error++; + + return 0; +} + +/* return -1 if the frame is invalid */ +static int xbee_proto_parse_rmt_atresp(struct xbee_dev *dev, void *buf, + unsigned len) +{ + struct xbee_rmt_atresp_hdr *rmt_atresp_hdr; + + dev->stats.rx_rmt_atresp++; + + if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_rmt_atresp_hdr)) { + dev->stats.rx_frame_too_small++; + return -1; + } + + rmt_atresp_hdr = buf + sizeof(struct xbee_hdr); + + /* bad status, but let the frame continue */ + if (rmt_atresp_hdr->status != 0) + dev->stats.rx_rmt_atresp_error++; + + return 0; +} + +/* return -1 if the frame is invalid */ +static int xbee_proto_parse_xmit_status(struct xbee_dev *dev, void *buf, + unsigned len) +{ + struct xbee_xmit_status_hdr *xmit_status_hdr; + + dev->stats.rx_xmit_status++; + + if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_xmit_status_hdr)) { + dev->stats.rx_frame_too_small++; + return -1; + } + + xmit_status_hdr = buf + sizeof(struct xbee_hdr); + dev->stats.tx_xmit_retries += xmit_status_hdr->xmit_retry_cnt; + + /* bad status, but let the frame continue */ + if (xmit_status_hdr->delivery_status != 0) + dev->stats.rx_xmit_status_error++; + + return 0; +} + +/* parse the frame stored in the device: return 0 if the frame is + * valid, else a negative value */ +static int xbee_proto_parse_frame(struct xbee_dev *dev) +{ + void *buf = dev->frame; + uint8_t len = dev->frame_len; + struct xbee_hdr *hdr = buf; + int i; + uint8_t cksum = 0; + int channel = XBEE_DEFAULT_CHANNEL; + + dev->stats.rx_frame++; + + /* check frame len */ + if (len < (sizeof(*hdr) + 1)) { + dev->stats.rx_frame_too_small++; + fprintf(stderr, "Frame too small\n"); + return -1; + } + + /* validate the cksum */ + for (i = 3; i < (len - 1); i++) + cksum += ((uint8_t *)buf)[i]; + cksum = 0xff - cksum; + if (cksum != ((uint8_t *)buf)[len-1]) { + fprintf(stderr, "Invalid cksum\n"); + dev->stats.rx_invalid_cksum++; + return -1; + } + + /* dispatch */ + switch (hdr->type) { + case XBEE_TYPE_MODEM_STATUS: + dev->stats.rx_modem_status++; + channel = XBEE_DEFAULT_CHANNEL; + break; + case XBEE_TYPE_ATRESP: + if (xbee_proto_parse_atresp(dev, buf, len) < 0) + return -1; + channel = hdr->id; + break; + case XBEE_TYPE_RMT_ATRESP: + if (xbee_proto_parse_rmt_atresp(dev, buf, len) < 0) + return -1; + channel = hdr->id; + break; + case XBEE_TYPE_XMIT_STATUS: + if (xbee_proto_parse_xmit_status(dev, buf, len) < 0) + return -1; + channel = hdr->id; + break; + case XBEE_TYPE_RECV: + dev->stats.rx_data++; + channel = XBEE_DEFAULT_CHANNEL; + break; + case XBEE_TYPE_EXPL_RECV: + dev->stats.rx_expl_data++; + channel = XBEE_DEFAULT_CHANNEL; + break; + case XBEE_TYPE_NODE_ID: + dev->stats.rx_node_id++; + channel = hdr->id; //XXX + break; + /* invalid commands */ + case XBEE_TYPE_ATCMD: + case XBEE_TYPE_ATCMD_Q: + case XBEE_TYPE_XMIT: + case XBEE_TYPE_EXPL_XMIT: + case XBEE_TYPE_RMT_ATCMD: + default: + dev->stats.rx_invalid_type++; + break; + } + + /* fallback to default channel if not registered */ + if (channel < 0 || channel >= XBEE_MAX_CHANNEL || + dev->channel[channel].registered == 0) + channel = XBEE_DEFAULT_CHANNEL; + + /* execute the callback if any */ + if (dev->channel[channel].rx_cb != NULL) + dev->channel[channel].rx_cb(dev, channel, hdr->type, + buf + sizeof(struct xbee_hdr), + len - sizeof(struct xbee_hdr) - 1, + dev->channel[channel].arg); + + return 0; +} + +int xbee_proto_xmit(struct xbee_dev *dev, uint8_t channel_id, uint8_t type, + void *buf, unsigned len) +{ + struct xbee_hdr hdr; + unsigned i; + uint8_t cksum = 0; + + /* there is no empty message, so return an error */ + if (len == 0) + return -1; + + /* prepare an iovec to avoid a copy: prepend a header to the + * buffer and append a checksum */ + hdr.delimiter = XBEE_DELIMITER; + hdr.len = htons(len + 2); + hdr.type = type; + hdr.id = channel_id; + + if (channel_id < 0 || channel_id >= XBEE_MAX_CHANNEL || + dev->channel[channel_id].registered == 0) { + dev->stats.tx_invalid_channel ++; + return -1; + } + + /* calculate the cksum */ + cksum = hdr.type; + cksum += hdr.id; + for (i = 0; i < len; i++) + cksum += ((uint8_t *)buf)[i]; + cksum = 0xff - cksum; + dev->stats.tx_frame ++; + + /* some additional checks before sending */ + switch (hdr.type) { + + case XBEE_TYPE_ATCMD: + // XXX some checks ? + dev->stats.tx_atcmd ++; + break; + case XBEE_TYPE_ATCMD_Q: + dev->stats.tx_atcmd_q ++; + break; + case XBEE_TYPE_XMIT: + dev->stats.tx_data ++; + break; + case XBEE_TYPE_EXPL_XMIT: + dev->stats.tx_expl_data ++; + break; + case XBEE_TYPE_RMT_ATCMD: + dev->stats.tx_rmt_atcmd ++; + break; + + /* invalid commands */ + case XBEE_TYPE_XMIT_STATUS: + case XBEE_TYPE_MODEM_STATUS: + case XBEE_TYPE_ATRESP: + case XBEE_TYPE_RECV: + case XBEE_TYPE_EXPL_RECV: + case XBEE_TYPE_NODE_ID: + case XBEE_TYPE_RMT_ATRESP: + default: + dev->stats.tx_invalid_type ++; + fprintf(stderr, "unhandled xmit type=%x\n", hdr.type); + return -1; + } + + /* send the frame on the wire */ + fwrite((uint8_t *)&hdr, 1, sizeof(hdr), dev->file); + fwrite((uint8_t *)buf, 1, len, dev->file); + fwrite(&cksum, 1, 1, dev->file); + + return 0; +} + +void xbee_proto_rx(struct xbee_dev *dev) +{ + uint8_t framelen; + struct xbee_hdr *hdr = (struct xbee_hdr *)dev->frame; + int c; + + while (1) { + + /* read from UART */ + c = fgetc(dev->file); + if (c == EOF) + break; + + /* frame too long XXX stats */ + if (dev->frame_len >= XBEE_MAX_FRAME_LEN) { + dev->frame_len = 0; + continue; + } + + dev->frame[dev->frame_len++] = c; + + /* not enough data to read len */ + if (dev->frame_len < sizeof(*hdr)) + continue; + + framelen = ntohs(hdr->len); + framelen += 4; /* 1 for delimiter, 2 for len, 1 for cksum */ + + /* not enough data */ + if (dev->frame_len < framelen) + continue; + if (xbee_proto_parse_frame(dev) < 0) + ;//XXX stats + dev->frame_len = 0; + } +} diff --git a/xbee_proto.h b/xbee_proto.h new file mode 100644 index 0000000..d2570fd --- /dev/null +++ b/xbee_proto.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* protocol headers */ + +#define XBEE_DELIMITER 0x7E +#define XBEE_MAX_FRAME_LEN 0x200 + +struct xbee_hdr { + uint8_t delimiter; + uint16_t len; + uint8_t type; + uint8_t id; +} __attribute__((packed)); + +#define XBEE_TYPE_ATCMD 0x08 +struct xbee_atcmd_hdr { + uint16_t cmd; + uint8_t params[]; +} __attribute__((packed)); + +#define XBEE_TYPE_ATCMD_Q 0x09 +struct xbee_atcmd_q_hdr { + uint16_t cmd; + uint8_t params[]; +} __attribute__((packed)); + +#define XBEE_TYPE_XMIT 0x10 +struct xbee_xmit_hdr { + uint64_t dstaddr; + uint16_t reserved; + uint8_t bcast_radius; + uint8_t opts; + uint8_t data[]; +} __attribute__((packed)); + +#define XBEE_TYPE_EXPL_XMIT 0x11 +struct xbee_expl_xmit_hdr { + uint64_t dstaddr; + uint16_t reserved; + uint8_t src_endpoint; + uint8_t dst_endpoint; + uint16_t cluster_id; + uint16_t profile_id; + uint8_t bcast_radius; + uint8_t opts; + uint8_t data[]; +} __attribute__((packed)); + +#define XBEE_TYPE_RMT_ATCMD 0x17 +struct xbee_rmt_atcmd_hdr { + uint64_t dstaddr; + uint16_t reserved; + uint8_t opts; + uint16_t cmd; + uint8_t params[]; +} __attribute__((packed)); + +#define XBEE_TYPE_ATRESP 0x88 +struct xbee_atresp_hdr { + uint16_t cmd; + uint8_t status; + uint8_t data[]; +} __attribute__((packed)); + +#define XBEE_TYPE_MODEM_STATUS 0x8A +struct xbee_modem_status_hdr { + /* empty */ +} __attribute__((packed)); + +#define XBEE_TYPE_XMIT_STATUS 0x8B +struct xbee_xmit_status_hdr { + uint16_t reserved; + uint8_t xmit_retry_cnt; + uint8_t delivery_status; + uint8_t discovery_status; +} __attribute__((packed)); + +#define XBEE_TYPE_RECV 0x90 +struct xbee_recv_hdr { + uint64_t srcaddr; + uint16_t reserved; + uint8_t opts; + uint8_t data[]; +} __attribute__((packed)); + +#define XBEE_TYPE_EXPL_RECV 0x91 +struct xbee_expl_recv_hdr { + uint64_t srcaddr; + uint16_t reserved; + uint8_t src_endpoint; + uint8_t dst_endpoint; + uint16_t cluster_id; + uint16_t profile_id; + uint8_t opts; + uint8_t data[]; +} __attribute__((packed)); + +#define XBEE_TYPE_NODE_ID 0x95 +struct xbee_node_id_hdr { + uint64_t srcaddr; + uint16_t srcnetwork; + uint8_t opts; + uint16_t dstnetwork; + uint64_t dstaddr; + uint8_t ni_string[]; + /* uint16_t parentaddr; after variable field */ +} __attribute__((packed)); + +#define XBEE_TYPE_RMT_ATRESP 0x97 +struct xbee_rmt_atresp_hdr { + uint64_t srcaddr; + uint16_t reserved; + uint16_t cmd; + uint8_t status; + uint8_t data[]; +} __attribute__((packed)); + +struct xbee_dev; + +/* return negative on error, 0 if there is not frame, or framelen */ +int xbee_proto_get_frame(struct xbee_dev *dev, void *buf, unsigned len); + +/* send a frame */ +int xbee_proto_xmit(struct xbee_dev *dev, uint8_t id, uint8_t type, + void *buf, unsigned len); + +void xbee_proto_rx(struct xbee_dev *dev); diff --git a/xbee_stats.c b/xbee_stats.c new file mode 100644 index 0000000..6e3c403 --- /dev/null +++ b/xbee_stats.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include + +#include "xbee_neighbor.h" +#include "xbee_stats.h" +#include "xbee_proto.h" +#include "xbee_buf.h" +#include "xbee.h" + +struct xbee_stats *xbee_get_stats(struct xbee_dev *dev) +{ + return &dev->stats; +} + +void xbee_reset_stats(struct xbee_dev *dev) +{ + memset(&dev->stats, 0, sizeof(dev->stats)); +} + +//XXX printf_P +void xbee_dump_stats(struct xbee_dev *dev) +{ + printf("statistics on xbee_dev %p:\n", dev); + printf(" rx_frame: %d\n", dev->stats.rx_frame); + printf(" rx_atresp: %d\n", dev->stats.rx_atresp); + printf(" rx_atresp_error: %d\n", dev->stats.rx_atresp_error); + printf(" rx_modem_status: %d\n", dev->stats.rx_modem_status); + printf(" rx_xmit_status: %d\n", dev->stats.rx_xmit_status); + printf(" rx_xmit_status_error: %d\n", dev->stats.rx_xmit_status_error); + printf(" rx_data: %d\n", dev->stats.rx_data); + printf(" rx_expl_data: %d\n", dev->stats.rx_expl_data); + printf(" rx_node_id: %d\n", dev->stats.rx_node_id); + printf(" rx_rmt_atresp: %d\n", dev->stats.rx_rmt_atresp); + printf(" rx_rmt_atresp_error: %d\n", dev->stats.rx_rmt_atresp_error); + printf(" rx_frame_too_small: %d\n", dev->stats.rx_frame_too_small); + printf(" rx_frame_too_large: %d\n", dev->stats.rx_frame_too_large); + printf(" rx_invalid_cksum: %d\n", dev->stats.rx_invalid_cksum); + printf(" rx_invalid_type: %d\n", dev->stats.rx_invalid_type); + printf(" rx_no_delim: %d\n", dev->stats.rx_no_delim); + printf(" tx_frame: %d\n", dev->stats.tx_frame); + printf(" tx_atcmd: %d\n", dev->stats.tx_atcmd); + printf(" tx_atcmd_q: %d\n", dev->stats.tx_atcmd_q); + printf(" tx_data: %d\n", dev->stats.tx_data); + printf(" tx_expl_data: %d\n", dev->stats.tx_expl_data); + printf(" tx_xmit_retries: %d\n", dev->stats.tx_xmit_retries); + printf(" tx_rmt_atcmd: %d\n", dev->stats.tx_rmt_atcmd); + printf(" tx_invalid_type: %d\n", dev->stats.tx_invalid_type); + printf(" tx_invalid_channel: %d\n", dev->stats.tx_invalid_channel); +} diff --git a/xbee_stats.h b/xbee_stats.h new file mode 100644 index 0000000..3747946 --- /dev/null +++ b/xbee_stats.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2011, Olivier MATZ + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* per-device statistics */ +struct xbee_stats { + int rx_frame; + int rx_atresp; + int rx_atresp_error; + int rx_modem_status; + int rx_xmit_status; + int rx_xmit_status_error; + int rx_data; + int rx_expl_data; + int rx_node_id; + int rx_rmt_atresp; + int rx_rmt_atresp_error; + int rx_frame_too_small; + int rx_frame_too_large; + int rx_invalid_cksum; + int rx_invalid_type; + int rx_no_delim; + + int tx_frame; + int tx_atcmd; + int tx_atcmd_q; + int tx_data; + int tx_expl_data; + int tx_xmit_retries; + int tx_rmt_atcmd; + int tx_invalid_type; + int tx_invalid_channel; +}; + +struct xbee_dev; + +/* return pointer to device stats */ +struct xbee_stats *xbee_get_stats(struct xbee_dev *dev); + +/* reset statistics of device */ +void xbee_reset_stats(struct xbee_dev *dev); + +/* dump statistics on stdout */ +void xbee_dump_stats(struct xbee_dev *dev); -- 2.39.5