52
52
/* Ungrouped common registers */
53
#define GPIOR0 _SFR_MEM8(0x0000) /* General Purpose IO Register 0 */
54
#define GPIOR1 _SFR_MEM8(0x0001) /* General Purpose IO Register 1 */
55
#define GPIOR2 _SFR_MEM8(0x0002) /* General Purpose IO Register 2 */
56
#define GPIOR3 _SFR_MEM8(0x0003) /* General Purpose IO Register 3 */
57
#define GPIOR4 _SFR_MEM8(0x0004) /* General Purpose IO Register 4 */
58
#define GPIOR5 _SFR_MEM8(0x0005) /* General Purpose IO Register 5 */
59
#define GPIOR6 _SFR_MEM8(0x0006) /* General Purpose IO Register 6 */
60
#define GPIOR7 _SFR_MEM8(0x0007) /* General Purpose IO Register 7 */
61
#define GPIOR8 _SFR_MEM8(0x0008) /* General Purpose IO Register 8 */
62
#define GPIOR9 _SFR_MEM8(0x0009) /* General Purpose IO Register 9 */
63
#define GPIORA _SFR_MEM8(0x000A) /* General Purpose IO Register 10 */
64
#define GPIORB _SFR_MEM8(0x000B) /* General Purpose IO Register 11 */
65
#define GPIORC _SFR_MEM8(0x000C) /* General Purpose IO Register 12 */
66
#define GPIORD _SFR_MEM8(0x000D) /* General Purpose IO Register 13 */
67
#define GPIORE _SFR_MEM8(0x000E) /* General Purpose IO Register 14 */
68
#define GPIORF _SFR_MEM8(0x000F) /* General Purpose IO Register 15 */
53
71
#define GPIO0 _SFR_MEM8(0x0000) /* General Purpose IO Register 0 */
54
72
#define GPIO1 _SFR_MEM8(0x0001) /* General Purpose IO Register 1 */
55
73
#define GPIO2 _SFR_MEM8(0x0002) /* General Purpose IO Register 2 */
1207
1225
register8_t REFCTRL; /* Reference Control */
1208
1226
register8_t EVCTRL; /* Event Control */
1209
1227
register8_t PRESCALER; /* Clock Prescaler */
1210
register8_t CALCTRL; /* Calibration Control Register */
1228
register8_t reserved_0x05;
1211
1229
register8_t INTFLAGS; /* Interrupt Flags */
1212
1230
register8_t reserved_0x07;
1213
1231
register8_t reserved_0x08;
1471
1489
DAC_REFRESH_512CLK_gc = (0x05<<0), /* 512 CLK */
1472
1490
DAC_REFRESH_1024CLK_gc = (0x06<<0), /* 1024 CLK */
1473
1491
DAC_REFRESH_2048CLK_gc = (0x07<<0), /* 2048 CLK */
1474
DAC_REFRESH_4086CLK_gc = (0x08<<0), /* 4096 CLK */
1492
DAC_REFRESH_4096CLK_gc = (0x08<<0), /* 4096 CLK */
1475
1493
DAC_REFRESH_8192CLK_gc = (0x09<<0), /* 8192 CLK */
1476
1494
DAC_REFRESH_16384CLK_gc = (0x0A<<0), /* 16384 CLK */
1477
1495
DAC_REFRESH_32768CLK_gc = (0x0B<<0), /* 32768 CLK */
1580
1598
/* Chip Select adress space */
1581
typedef enum EBI_CS_ASPACE_enum
1599
typedef enum EBI_CS_ASIZE_enum
1583
EBI_CS_ASPACE_256B_gc = (0x00<<2), /* 256 bytes */
1584
EBI_CS_ASPACE_512B_gc = (0x01<<2), /* 512 bytes */
1585
EBI_CS_ASPACE_1KB_gc = (0x02<<2), /* 1K bytes */
1586
EBI_CS_ASPACE_2KB_gc = (0x03<<2), /* 2K bytes */
1587
EBI_CS_ASPACE_4KB_gc = (0x04<<2), /* 4K bytes */
1588
EBI_CS_ASPACE_8KB_gc = (0x05<<2), /* 8K bytes */
1589
EBI_CS_ASPACE_16KB_gc = (0x06<<2), /* 16K bytes */
1590
EBI_CS_ASPACE_32KB_gc = (0x07<<2), /* 32K bytes */
1591
EBI_CS_ASPACE_64KB_gc = (0x08<<2), /* 64K bytes */
1592
EBI_CS_ASPACE_128KB_gc = (0x09<<2), /* 128K bytes */
1593
EBI_CS_ASPACE_256KB_gc = (0x0A<<2), /* 256K bytes */
1594
EBI_CS_ASPACE_512KB_gc = (0x0B<<2), /* 512K bytes */
1595
EBI_CS_ASPACE_1MB_gc = (0x0C<<2), /* 1M bytes */
1596
EBI_CS_ASPACE_2MB_gc = (0x0D<<2), /* 2M bytes */
1597
EBI_CS_ASPACE_4MB_gc = (0x0E<<2), /* 4M bytes */
1598
EBI_CS_ASPACE_8MB_gc = (0x0F<<2), /* 8M bytes */
1599
EBI_CS_ASPACE_16M_gc = (0x10<<2), /* 16M bytes */
1601
EBI_CS_ASIZE_256B_gc = (0x00<<2), /* 256 bytes */
1602
EBI_CS_ASIZE_512B_gc = (0x01<<2), /* 512 bytes */
1603
EBI_CS_ASIZE_1KB_gc = (0x02<<2), /* 1K bytes */
1604
EBI_CS_ASIZE_2KB_gc = (0x03<<2), /* 2K bytes */
1605
EBI_CS_ASIZE_4KB_gc = (0x04<<2), /* 4K bytes */
1606
EBI_CS_ASIZE_8KB_gc = (0x05<<2), /* 8K bytes */
1607
EBI_CS_ASIZE_16KB_gc = (0x06<<2), /* 16K bytes */
1608
EBI_CS_ASIZE_32KB_gc = (0x07<<2), /* 32K bytes */
1609
EBI_CS_ASIZE_64KB_gc = (0x08<<2), /* 64K bytes */
1610
EBI_CS_ASIZE_128KB_gc = (0x09<<2), /* 128K bytes */
1611
EBI_CS_ASIZE_256KB_gc = (0x0A<<2), /* 256K bytes */
1612
EBI_CS_ASIZE_512KB_gc = (0x0B<<2), /* 512K bytes */
1613
EBI_CS_ASIZE_1MB_gc = (0x0C<<2), /* 1M bytes */
1614
EBI_CS_ASIZE_2MB_gc = (0x0D<<2), /* 2M bytes */
1615
EBI_CS_ASIZE_4MB_gc = (0x0E<<2), /* 4M bytes */
1616
EBI_CS_ASIZE_8MB_gc = (0x0F<<2), /* 8M bytes */
1617
EBI_CS_ASIZE_16M_gc = (0x10<<2), /* 16M bytes */
1603
1621
typedef enum EBI_CS_SRWS_enum
2535
2553
==========================================================================
2538
#define GPIO (*(GPIO_t *) 0x0000) /* General Purpose IO Registers */
2539
2556
#define VPORT0 (*(VPORT_t *) 0x0010) /* Virtual Port 0 */
2540
2557
#define VPORT1 (*(VPORT_t *) 0x0014) /* Virtual Port 1 */
2541
2558
#define VPORT2 (*(VPORT_t *) 0x0018) /* Virtual Port 2 */
2542
2559
#define VPORT3 (*(VPORT_t *) 0x001C) /* Virtual Port 3 */
2543
2560
#define OCD (*(OCD_t *) 0x002E) /* On-Chip Debug System */
2544
#define CPU (*(CPU_t *) 0x0030) /* CPU Registers */
2545
2561
#define CLK (*(CLK_t *) 0x0040) /* Clock System */
2546
2562
#define SLEEP (*(SLEEP_t *) 0x0048) /* Sleep Controller */
2547
2563
#define OSC (*(OSC_t *) 0x0050) /* Oscillator Control */
2594
2610
/* ========== Flattened fully qualified IO register names ========== */
2596
2612
/* GPIO - General Purpose IO Registers */
2613
#define GPIO_GPIOR0 _SFR_MEM8(0x0000)
2614
#define GPIO_GPIOR1 _SFR_MEM8(0x0001)
2615
#define GPIO_GPIOR2 _SFR_MEM8(0x0002)
2616
#define GPIO_GPIOR3 _SFR_MEM8(0x0003)
2617
#define GPIO_GPIOR4 _SFR_MEM8(0x0004)
2618
#define GPIO_GPIOR5 _SFR_MEM8(0x0005)
2619
#define GPIO_GPIOR6 _SFR_MEM8(0x0006)
2620
#define GPIO_GPIOR7 _SFR_MEM8(0x0007)
2621
#define GPIO_GPIOR8 _SFR_MEM8(0x0008)
2622
#define GPIO_GPIOR9 _SFR_MEM8(0x0009)
2623
#define GPIO_GPIORA _SFR_MEM8(0x000A)
2624
#define GPIO_GPIORB _SFR_MEM8(0x000B)
2625
#define GPIO_GPIORC _SFR_MEM8(0x000C)
2626
#define GPIO_GPIORD _SFR_MEM8(0x000D)
2627
#define GPIO_GPIORE _SFR_MEM8(0x000E)
2628
#define GPIO_GPIORF _SFR_MEM8(0x000F)
2597
2631
#define GPIO_GPIO0 _SFR_MEM8(0x0000)
2598
2632
#define GPIO_GPIO1 _SFR_MEM8(0x0001)
2599
2633
#define GPIO_GPIO2 _SFR_MEM8(0x0002)
4814
4847
#define ADC_PRESCALER2_bp 2 /* Clock Prescaler Selection bit 2 position. */
4817
/* ADC.CALCTRL bit masks and bit positions */
4818
#define ADC_CAL_bm 0x01 /* ADC Calibration Start bit mask. */
4819
#define ADC_CAL_bp 0 /* ADC Calibration Start bit position. */
4822
4850
/* ADC.INTFLAGS bit masks and bit positions */
4823
4851
#define ADC_CH3IF_bm 0x08 /* Channel 3 Interrupt Flag bit mask. */
4824
4852
#define ADC_CH3IF_bp 3 /* Channel 3 Interrupt Flag bit position. */
4963
4991
/* EBI - External Bus Interface */
4964
4992
/* EBI_CS.CTRLA bit masks and bit positions */
4965
#define EBI_CS_ASPACE_gm 0x7C /* Address Space group mask. */
4966
#define EBI_CS_ASPACE_gp 2 /* Address Space group position. */
4967
#define EBI_CS_ASPACE0_bm (1<<2) /* Address Space bit 0 mask. */
4968
#define EBI_CS_ASPACE0_bp 2 /* Address Space bit 0 position. */
4969
#define EBI_CS_ASPACE1_bm (1<<3) /* Address Space bit 1 mask. */
4970
#define EBI_CS_ASPACE1_bp 3 /* Address Space bit 1 position. */
4971
#define EBI_CS_ASPACE2_bm (1<<4) /* Address Space bit 2 mask. */
4972
#define EBI_CS_ASPACE2_bp 4 /* Address Space bit 2 position. */
4973
#define EBI_CS_ASPACE3_bm (1<<5) /* Address Space bit 3 mask. */
4974
#define EBI_CS_ASPACE3_bp 5 /* Address Space bit 3 position. */
4975
#define EBI_CS_ASPACE4_bm (1<<6) /* Address Space bit 4 mask. */
4976
#define EBI_CS_ASPACE4_bp 6 /* Address Space bit 4 position. */
4993
#define EBI_CS_ASIZE_gm 0x7C /* Address Size group mask. */
4994
#define EBI_CS_ASIZE_gp 2 /* Address Size group position. */
4995
#define EBI_CS_ASIZE0_bm (1<<2) /* Address Size bit 0 mask. */
4996
#define EBI_CS_ASIZE0_bp 2 /* Address Size bit 0 position. */
4997
#define EBI_CS_ASIZE1_bm (1<<3) /* Address Size bit 1 mask. */
4998
#define EBI_CS_ASIZE1_bp 3 /* Address Size bit 1 position. */
4999
#define EBI_CS_ASIZE2_bm (1<<4) /* Address Size bit 2 mask. */
5000
#define EBI_CS_ASIZE2_bp 4 /* Address Size bit 2 position. */
5001
#define EBI_CS_ASIZE3_bm (1<<5) /* Address Size bit 3 mask. */
5002
#define EBI_CS_ASIZE3_bp 5 /* Address Size bit 3 position. */
5003
#define EBI_CS_ASIZE4_bm (1<<6) /* Address Size bit 4 mask. */
5004
#define EBI_CS_ASIZE4_bp 6 /* Address Size bit 4 position. */
4978
5006
#define EBI_CS_MODE_gm 0x03 /* Memory Mode group mask. */
4979
5007
#define EBI_CS_MODE_gp 0 /* Memory Mode group position. */