├── README.md ├── examples └── samd20 │ ├── Makefile │ ├── demo.cproj │ ├── main.c │ ├── samd20.h │ ├── samd20j18.ld │ └── startup.c ├── headers ├── Makefile ├── headers.py ├── headers │ ├── sam3u.h │ ├── sam4s.h │ └── samd20.h ├── sam3u │ ├── __init__.py │ ├── adc.py │ ├── adc12b.py │ ├── chipid.py │ ├── common.py │ ├── dmac.py │ ├── eefc.py │ ├── gpbr.py │ ├── hsmci.py │ ├── matrix.py │ ├── mpu.py │ ├── nvic.py │ ├── pdc.py │ ├── pio.py │ ├── pmc.py │ ├── pwm.py │ ├── rstc.py │ ├── rtc.py │ ├── rtt.py │ ├── scb.py │ ├── smc.py │ ├── spi.py │ ├── ssc.py │ ├── supc.py │ ├── systick.py │ ├── tc.py │ ├── twi.py │ ├── uart.py │ ├── udphs.py │ ├── usart.py │ └── wdt.py ├── sam4s │ ├── acc.py │ ├── adc.py │ ├── chipid.py │ ├── common.py │ ├── crccu.py │ ├── dacc.py │ ├── eefc.py │ ├── gen_sam4s.py │ ├── gpbr.py │ ├── hsmci.py │ ├── matrix.py │ ├── mpu.py │ ├── nvic.py │ ├── pdc.py │ ├── pio.py │ ├── pmc.py │ ├── pwm.py │ ├── rstc.py │ ├── rtc.py │ ├── rtt.py │ ├── scb.py │ ├── smc.py │ ├── spi.py │ ├── ssc.py │ ├── supc.py │ ├── syst.py │ ├── tc.py │ ├── twi.py │ ├── uart.py │ ├── udp.py │ ├── usart.py │ └── wdt.py └── samd20 │ ├── __init__.py │ ├── ac.py │ ├── adc.py │ ├── cm0_nvic.py │ ├── cm0_scb.py │ ├── cm0_systick.py │ ├── dac.py │ ├── dsu.py │ ├── eic.py │ ├── evsys.py │ ├── gclk.py │ ├── nvmctrl.py │ ├── pac0.py │ ├── pac1.py │ ├── pac2.py │ ├── pm.py │ ├── port.py │ ├── ptc.py │ ├── rtc_m0.py │ ├── rtc_m1.py │ ├── rtc_m2.py │ ├── sc_i2cm.py │ ├── sc_i2cs.py │ ├── sc_spi.py │ ├── sc_usart.py │ ├── sysctrl.py │ ├── tc_16.py │ ├── tc_32.py │ ├── tc_8.py │ ├── tc_common.py │ └── wdt.py ├── sam-ba ├── sam-ba-c21.py ├── sam-ba.py └── sma-ba-v71.py └── snprintf ├── Makefile └── p_vsnprintf.c /README.md: -------------------------------------------------------------------------------- 1 | A collection of all sorts of embedded stuff. I expect to move things to their own repositories over time. 2 | 3 | **NOTE**: Atmel EDBG project has moved from here to its own location https://github.com/ataradov/edbg 4 | 5 | **NOTE**: Header files generator and related sample applications are here for historical reasons only. This project is not maintained and not recommended for use. For better version of the sample projects have a look at https://github.com/ataradov/mcu-starter-projects 6 | -------------------------------------------------------------------------------- /examples/samd20/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | CONFIG = Debug 3 | #CONFIG = Release 4 | 5 | ############################################################################## 6 | .PHONY: all clean size 7 | 8 | CC = arm-none-eabi-gcc 9 | OBJCOPY = arm-none-eabi-objcopy 10 | SIZE = arm-none-eabi-size 11 | 12 | CFLAGS += -W -Wall --std=gnu99 -O3 13 | CFLAGS += -ffunction-sections -fdata-sections 14 | CFLAGS += -mcpu=cortex-m0plus -mthumb 15 | 16 | LDFLAGS += -Wl,--gc-sections 17 | LDFLAGS += -mcpu=cortex-m0plus -mthumb 18 | LDFLAGS += -Wl,--script=samd20j18.ld 19 | 20 | ifeq ($(CONFIG), Debug) 21 | CFLAGS += -g 22 | endif 23 | 24 | DEFINES = \ 25 | -DF_CPU=8000000 26 | 27 | INCLUDES += \ 28 | -I . 29 | 30 | CFLAGS += $(INCLUDES) $(DEFINES) 31 | 32 | SRCS = \ 33 | startup.c \ 34 | main.c 35 | 36 | OBJS = $(addprefix $(CONFIG)/, $(notdir %/$(subst .c,.o, $(SRCS)))) 37 | 38 | all: directory $(CONFIG)/demo.elf $(CONFIG)/demo.bin size 39 | 40 | $(CONFIG)/demo.elf: $(OBJS) 41 | @echo LD $@ 42 | @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ 43 | 44 | $(CONFIG)/demo.bin: $(CONFIG)/demo.elf 45 | @echo OBJCOPY $@ 46 | @$(OBJCOPY) -O binary $^ $@ 47 | 48 | %.o: 49 | @echo CC $@ 50 | @$(CC) $(CFLAGS) $(filter %$(subst .o,.c,$(notdir $@)), $(SRCS)) -c -o $@ 51 | 52 | directory: 53 | @mkdir -p $(CONFIG) 54 | 55 | size: $(CONFIG)/demo.elf 56 | @echo 57 | @$(SIZE) -t $^ 58 | 59 | clean: 60 | @echo clean 61 | @-rm -rf $(CONFIG) 62 | 63 | -------------------------------------------------------------------------------- /examples/samd20/samd20j18.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | MEMORY 30 | { 31 | flash (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 /* 256k */ 32 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32k */ 33 | } 34 | 35 | __top_flash = 0x40000; 36 | __top_ram = 0x20000000 + 0x8000; 37 | 38 | ENTRY(irq_handler_reset) 39 | 40 | SECTIONS 41 | { 42 | .text : ALIGN(4) 43 | { 44 | FILL(0xff) 45 | KEEP(*(.vectors)) 46 | *(.text*) 47 | *(.rodata) 48 | *(.rodata.*) 49 | . = ALIGN(4); 50 | } > flash 51 | 52 | . = ALIGN(4); 53 | _etext = .; 54 | 55 | .uninit_RESERVED : ALIGN(4) 56 | { 57 | KEEP(*(.bss.$RESERVED*)) 58 | } > ram 59 | 60 | .data : ALIGN(4) 61 | { 62 | FILL(0xff) 63 | _data = .; 64 | *(vtable) 65 | *(.data*) 66 | . = ALIGN(4); 67 | _edata = .; 68 | } > ram AT > flash 69 | 70 | .bss : ALIGN(4) 71 | { 72 | _bss = .; 73 | *(.bss*) 74 | *(COMMON) 75 | . = ALIGN(4); 76 | _ebss = .; 77 | PROVIDE(_end = .); 78 | } > ram 79 | 80 | PROVIDE(_stack_top = __top_ram - 0); 81 | } 82 | 83 | -------------------------------------------------------------------------------- /headers/Makefile: -------------------------------------------------------------------------------- 1 | CONFIG = 2 | 3 | .PHONY: all clean sam3u samd20 4 | 5 | all: sam3u samd20 6 | 7 | sam3u: 8 | python headers.py -t sam3u $(CONFIG) -o headers/sam3u.h 9 | 10 | samd20: 11 | python headers.py -t samd20 $(CONFIG) -o headers/samd20.h 12 | 13 | clean: 14 | -rm sam3u/*.pyc 15 | -rm samd20/*.pyc 16 | 17 | 18 | -------------------------------------------------------------------------------- /headers/sam3u/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import pdc 31 | import hsmci 32 | import ssc 33 | import spi 34 | import tc 35 | import twi 36 | import pwm 37 | import usart 38 | import udphs 39 | import adc12b 40 | import adc 41 | import dmac 42 | import smc 43 | import matrix 44 | import pmc 45 | import uart 46 | import chipid 47 | import eefc 48 | import pio 49 | import rstc 50 | import supc 51 | import rtt 52 | import wdt 53 | import rtc 54 | import gpbr 55 | import systick 56 | import scb 57 | import nvic 58 | import mpu 59 | 60 | #------------------------------------------------------------------------------ 61 | series = 'SAM' 62 | name = 'SAM3U' 63 | 64 | peripherals = [ 65 | pdc, hsmci, ssc, spi, tc, twi, pwm, usart, udphs, adc12b, adc, dmac, 66 | smc, matrix, pmc, uart, chipid, eefc, pio, rstc, supc, rtt, wdt, rtc, 67 | gpbr, systick, scb, nvic, mpu, 68 | ] 69 | 70 | registers = [ 71 | ('HSMCI', 0x40000000, hsmci ), 72 | ('SSC', 0x40004000, ssc ), 73 | ('SPI', 0x40008000, spi ), 74 | ('TC0', 0x40080000, tc ), 75 | ('TC1', 0x40080040, tc ), 76 | ('TC2', 0x40080080, tc ), 77 | ('TWI0', 0x40084000, twi ), 78 | ('TWI0_PDC', 0x40084100, pdc ), 79 | ('TWI1', 0x40088000, twi ), 80 | ('TWI1_PDC', 0x40088100, pdc ), 81 | ('PWM', 0x4008c000, pwm ), 82 | ('PWM_PDC', 0x4008c100, pdc ), 83 | ('USART0', 0x40090000, usart ), 84 | ('USART0_PDC', 0x40090100, pdc ), 85 | ('USART1', 0x40094000, usart ), 86 | ('USART1_PDC', 0x40094100, pdc ), 87 | ('USART2', 0x40098000, usart ), 88 | ('USART2_PDC', 0x40098100, pdc ), 89 | ('USART3', 0x4009c000, usart ), 90 | ('USART3_PDC', 0x4009c100, pdc ), 91 | ('UDPHS', 0x400a4000, udphs ), 92 | ('ADC12B', 0x400a8000, adc12b ), 93 | ('ADC12B_PDC', 0x400a8100, pdc ), 94 | ('ADC', 0x400ac000, adc ), 95 | ('ADC_PDC', 0x400ac100, pdc ), 96 | ('DMAC', 0x400b0000, dmac ), 97 | ('SMC', 0x400e0000, smc ), 98 | ('MATRIX', 0x400e0200, matrix ), 99 | ('PMC', 0x400e0400, pmc ), 100 | ('UART', 0x400e0600, uart ), 101 | ('UART_PDC', 0x400e0700, pdc ), 102 | ('CHIPID', 0x400e0740, chipid ), 103 | ('EEFC0', 0x400e0800, eefc ), 104 | ('EEFC1', 0x400e0a00, eefc ), 105 | ('PIOA', 0x400e0c00, pio ), 106 | ('PIOB', 0x400e0e00, pio ), 107 | ('PIOC', 0x400e1000, pio ), 108 | ('RSTC', 0x400e1200, rstc ), 109 | ('SUPC', 0x400e1210, supc ), 110 | ('RTT', 0x400e1230, rtt ), 111 | ('WDT', 0x400e1250, wdt ), 112 | ('RTC', 0x400e1260, rtc ), 113 | ('GPBR', 0x400e1290, gpbr ), 114 | 115 | # System Control Space 116 | ('SYSTICK', 0xe000e010, systick ), 117 | ('SCB', 0xe000e000, scb ), 118 | ('NVIC', 0xe000e100, nvic ), 119 | ('MPU', 0xe000ed90, mpu ), 120 | ] 121 | 122 | db = (series, name, peripherals, registers) 123 | 124 | -------------------------------------------------------------------------------- /headers/sam3u/adc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'ADC' 34 | 35 | #------------------------------------------------------------------------------ 36 | adc_channels = [ 37 | ('ch0', 1), 38 | ('ch1', 1), 39 | ('ch2', 1), 40 | ('ch3', 1), 41 | ('ch4', 1), 42 | ('ch5', 1), 43 | ('ch6', 1), 44 | ('ch7', 1), 45 | ('', 24), 46 | ] 47 | 48 | adc_ints = [ 49 | ('eoc0', 1), 50 | ('eoc1', 1), 51 | ('eoc2', 1), 52 | ('eoc3', 1), 53 | ('eoc4', 1), 54 | ('eoc5', 1), 55 | ('eoc6', 1), 56 | ('eoc7', 1), 57 | ('ovre0', 1), 58 | ('ovre1', 1), 59 | ('ovre2', 1), 60 | ('ovre3', 1), 61 | ('ovre4', 1), 62 | ('ovre5', 1), 63 | ('ovre6', 1), 64 | ('ovre7', 1), 65 | ('drdy', 1), 66 | ('govre', 1), 67 | ('endrx', 1), 68 | ('rxbuff', 1), 69 | ('', 12), 70 | ] 71 | 72 | adc_cdr = [ 73 | ('data', 10), 74 | ('', 22), 75 | ] 76 | 77 | #------------------------------------------------------------------------------ 78 | registers = [ 79 | (0x00, 'CR', [ 80 | ('swrst', 1), 81 | ('start', 1), 82 | ('', 30), 83 | ]), 84 | (0x04, 'MR', [ 85 | ('trgen', 1), 86 | ('trgsel', 3, [ 87 | ('TC_0', 0), 88 | ('TC_1', 1), 89 | ('TC_2', 2), 90 | ('PWM_0', 3), 91 | ('PWM_1', 4), 92 | ('EXT', 6), 93 | ]), 94 | ('lowres', 1), 95 | ('sleep', 1), 96 | ('', 2), 97 | ('prescal', 8), 98 | ('startup', 7), 99 | ('', 1), 100 | ('shtim', 4), 101 | ('', 4), 102 | ]), 103 | (0x10, 'CHER', adc_channels), 104 | (0x14, 'CHDR', adc_channels), 105 | (0x18, 'CHSR', adc_channels), 106 | (0x1c, 'SR', adc_ints), 107 | (0x20, 'LCDR', [ 108 | ('ldata', 10), 109 | ('', 22), 110 | ]), 111 | (0x24, 'IER', adc_ints), 112 | (0x28, 'IDR', adc_ints), 113 | (0x2c, 'IMR', adc_ints), 114 | [ 8, 4, 115 | (0x0030, 'CDR', adc_cdr), 116 | ], 117 | ] 118 | 119 | -------------------------------------------------------------------------------- /headers/sam3u/adc12b.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'ADC12B' 31 | 32 | #------------------------------------------------------------------------------ 33 | adc12b_channels = [ 34 | ('ch0', 1), 35 | ('ch1', 1), 36 | ('ch2', 1), 37 | ('ch3', 1), 38 | ('ch4', 1), 39 | ('ch5', 1), 40 | ('ch6', 1), 41 | ('ch7', 1), 42 | ('', 24), 43 | ] 44 | 45 | adc12b_ints = [ 46 | ('eoc0', 1), 47 | ('eoc1', 1), 48 | ('eoc2', 1), 49 | ('eoc3', 1), 50 | ('eoc4', 1), 51 | ('eoc5', 1), 52 | ('eoc6', 1), 53 | ('eoc7', 1), 54 | ('ovre0', 1), 55 | ('ovre1', 1), 56 | ('ovre2', 1), 57 | ('ovre3', 1), 58 | ('ovre4', 1), 59 | ('ovre5', 1), 60 | ('ovre6', 1), 61 | ('ovre7', 1), 62 | ('drdy', 1), 63 | ('govre', 1), 64 | ('endrx', 1), 65 | ('rxbuff', 1), 66 | ('', 12), 67 | ] 68 | 69 | adc12b_cdr = [ 70 | ('data', 12), 71 | ('', 20), 72 | ] 73 | 74 | #------------------------------------------------------------------------------ 75 | registers = [ 76 | (0x00, 'CR', [ 77 | ('swrst', 1), 78 | ('start', 1), 79 | ('', 30), 80 | ]), 81 | (0x04, 'MR', [ 82 | ('trgen', 1), 83 | ('trgsel', 3, [ 84 | ('EXT', 0), 85 | ('TC_0', 1), 86 | ('TC_1', 2), 87 | ('TC_2', 3), 88 | ('PWM_0', 4), 89 | ('PWM_1', 5), 90 | ]), 91 | ('lowres', 1), 92 | ('sleep', 1), 93 | ('', 2), 94 | ('prescal', 8), 95 | ('startup', 8), 96 | ('shtim', 4), 97 | ('', 4), 98 | ]), 99 | (0x10, 'CHER', adc12b_channels), 100 | (0x14, 'CHDR', adc12b_channels), 101 | (0x18, 'CHSR', adc12b_channels), 102 | (0x1c, 'SR', adc12b_ints), 103 | (0x20, 'LCDR', [ 104 | ('ldata', 12), 105 | ('', 20), 106 | ]), 107 | (0x24, 'IER', adc12b_ints), 108 | (0x28, 'IDR', adc12b_ints), 109 | (0x2c, 'IMR', adc12b_ints), 110 | [ 8, 4, 111 | (0x0030, 'CDR', adc12b_cdr), 112 | ], 113 | (0x64, 'ACR', [ 114 | ('gain', 2), 115 | ('', 6), 116 | ('ibctl', 2, [ 117 | ('TYP_M20', 0), 118 | ('TYP', 1), 119 | ('TYP_P20', 2), 120 | ('TYP_P40', 3), 121 | ]), 122 | ('', 6), 123 | ('diff', 1), 124 | ('offset', 1), 125 | ('', 14), 126 | ]), 127 | (0x68, 'EMR', [ 128 | ('offmodes', 1), 129 | ('', 15), 130 | ('off_mode_startup_time', 8), 131 | ('', 8), 132 | ]), 133 | ] 134 | 135 | -------------------------------------------------------------------------------- /headers/sam3u/chipid.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'EEFC' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CIDR', [ 35 | ('version', 5), 36 | ('eproc', 3, [ 37 | ('ARM946ES', 1), 38 | ('ARM7TDMI', 2), 39 | ('CM3', 3), 40 | ('ARM920T', 4), 41 | ('ARM926EJS', 5), 42 | ('CA5', 6), 43 | ('CM4', 7), 44 | ]), 45 | ('nvpsiz', 4, [ 46 | ('NONE', 0), 47 | ('8K', 1), 48 | ('16K', 2), 49 | ('32K', 3), 50 | ('64K', 5), 51 | ('128K', 7), 52 | ('256K', 9), 53 | ('512K', 10), 54 | ('1024K', 12), 55 | ('2048K', 14), 56 | ]), 57 | ('nvpsiz2', 4, [ 58 | ('NONE', 0), 59 | ('8K', 1), 60 | ('16K', 2), 61 | ('32K', 3), 62 | ('64K', 5), 63 | ('128K', 7), 64 | ('256K', 9), 65 | ('512K', 10), 66 | ('1024K', 12), 67 | ('2048K', 14), 68 | ]), 69 | ('sramsiz', 4, [ 70 | ('48K', 0), 71 | ('1K', 1), 72 | ('2K', 2), 73 | ('6K', 3), 74 | ('24K', 4), 75 | ('4K', 5), 76 | ('80K', 6), 77 | ('160K', 7), 78 | ('8K', 8), 79 | ('16K', 9), 80 | ('32K', 10), 81 | ('64K', 11), 82 | ('128K', 12), 83 | ('256K', 13), 84 | ('96K', 14), 85 | ('512K', 15), 86 | ]), 87 | ('arch', 8, [ 88 | ('AT91SAM9xx', 0x19), 89 | ('AT91SAM9XExx', 0x29), 90 | ('AT91x34', 0x34), 91 | ('CAP7', 0x37), 92 | ('CAP9', 0x39), 93 | ('CAP11', 0x3b), 94 | ('AT91x40', 0x40), 95 | ('AT91x42', 0x42), 96 | ('AT91x55', 0x55), 97 | ('AT91SAM7Axx', 0x60), 98 | ('AT91SAM7AQxx', 0x61), 99 | ('AT91x63', 0x63), 100 | ('AT91SAM7Sxx', 0x70), 101 | ('AT91SAM7XCxx', 0x71), 102 | ('AT91SAM7SExx', 0x72), 103 | ('AT91SAM7Lxx', 0x73), 104 | ('AT91SAM7Xxx', 0x75), 105 | ('AT91SAM7SLxx', 0x76), 106 | ('SAM3UxC', 0x80), 107 | ('SAM3UxE', 0x81), 108 | ('SAM3AxC', 0x83), 109 | ('SAM4AxC', 0x83), 110 | ('SAM3XxC', 0x84), 111 | ('SAM4XxC', 0x84), 112 | ('SAM3XxE', 0x85), 113 | ('SAM4XxE', 0x85), 114 | ('SAM3XxG', 0x86), 115 | ('SAM4XxG', 0x86), 116 | ('SAM3SxA', 0x88), 117 | ('SAM4SxA', 0x88), 118 | ('SAM3SxB', 0x89), 119 | ('SAM4SxB', 0x89), 120 | ('SAM3SxC', 0x8a), 121 | ('SAM4SxC', 0x8a), 122 | ('AT91x92', 0x92), 123 | ('SAM3NxA', 0x93), 124 | ('SAM3NxB', 0x94), 125 | ('SAM3NxC', 0x95), 126 | ('SAM3SDxB', 0x99), 127 | ('SAM3SDxC', 0x9a), 128 | ('SAM5A', 0xa5), 129 | ('AT75Cxx', 0xf0), 130 | ]), 131 | ('nvptyp', 3, [ 132 | ('ROM', 0), 133 | ('ROMLESS', 1), 134 | ('FLASH', 2), 135 | ('ROM_FLASH', 3), 136 | ('SRAM', 4), 137 | ]), 138 | ('ext', 1), 139 | ]), 140 | (0x04, 'EXID'), 141 | ] 142 | 143 | -------------------------------------------------------------------------------- /headers/sam3u/common.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | def wpmr(key): 31 | return [ 32 | ('wpen', 1), 33 | ('', 7), 34 | ('wpkey', 24, [ 35 | ('KEY', key) 36 | ]), 37 | ] 38 | 39 | wpsr = [ 40 | ('wpvs', 1), 41 | ('', 7), 42 | ('wpvsrc', 16), 43 | ('', 8), 44 | ] 45 | 46 | pid = [ 47 | ('supc', 1), 48 | ('rstc', 1), 49 | ('rtc', 1), 50 | ('rtt', 1), 51 | ('wdt', 1), 52 | ('pmc', 1), 53 | ('eefc0', 1), 54 | ('eefc1', 1), 55 | ('uart', 1), 56 | ('smc', 1), 57 | ('pioa', 1), 58 | ('piob', 1), 59 | ('pioc', 1), 60 | ('usart0', 1), 61 | ('usart1', 1), 62 | ('usart2', 1), 63 | ('usart3', 1), 64 | ('hsmci', 1), 65 | ('twi0', 1), 66 | ('twi1', 1), 67 | ('spi', 1), 68 | ('ssc', 1), 69 | ('tc0', 1), 70 | ('tc1', 1), 71 | ('tc2', 1), 72 | ('pwm', 1), 73 | ('adc12b', 1), 74 | ('adc', 1), 75 | ('dmac', 1), 76 | ('udphs', 1), 77 | ('', 2), 78 | ] 79 | 80 | -------------------------------------------------------------------------------- /headers/sam3u/eefc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'EEFC' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'FMR', [ 35 | ('frdy', 1), 36 | ('', 7), 37 | ('fws', 4), 38 | ('', 4), 39 | ('scod', 1), 40 | ('', 7), 41 | ('fam', 1), 42 | ('', 7), 43 | ]), 44 | (0x04, 'FCR', [ 45 | ('fcmd', 8), 46 | ('farg', 16), 47 | ('fkey', 8, [ 48 | ('KEY', 0x5a), 49 | ]), 50 | ]), 51 | (0x08, 'FSR', [ 52 | ('frdy', 1), 53 | ('fcmde', 1), 54 | ('flocke', 1), 55 | ('', 29), 56 | ]), 57 | (0x0c, 'FRR'), 58 | ] 59 | 60 | -------------------------------------------------------------------------------- /headers/sam3u/gpbr.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'GPBR' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | [ 4, 4, 35 | (0x00, 'SYS_GPBR0'), 36 | ] 37 | ] 38 | 39 | -------------------------------------------------------------------------------- /headers/sam3u/matrix.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'MATRIX' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = [ 37 | [ 5, 4, 38 | (0x0000, 'MCFG', [ 39 | ('ulbt', 3), 40 | ('', 29), 41 | ]), 42 | ], 43 | [ 10, 4, 44 | (0x0040, 'SCFG', [ 45 | ('slot_cycle', 8), 46 | ('', 8), 47 | ('defmstr_type', 2), 48 | ('fixed_defmstr', 3), 49 | ('', 3), 50 | ('arbt', 2), 51 | ('', 6), 52 | ]), 53 | ], 54 | [ 10, 4, 55 | (0x0080, 'PRAS', [ 56 | ('m0pr', 2), 57 | ('', 2), 58 | ('m1pr', 2), 59 | ('', 2), 60 | ('m2pr', 2), 61 | ('', 2), 62 | ('m3pr', 2), 63 | ('', 2), 64 | ('m4pr', 2), 65 | ('', 14), 66 | ]), 67 | ], 68 | (0x0100, 'MRCR', [ 69 | ('rcb0', 1), 70 | ('rcb1', 1), 71 | ('rcb2', 1), 72 | ('rcb3', 1), 73 | ('rcb4', 1), 74 | ('', 27), 75 | ]), 76 | (0x01e4, 'WPMR', common.wpmr(0x4d4154)), 77 | (0x01e8, 'WPSR', common.wpsr), 78 | ] 79 | 80 | -------------------------------------------------------------------------------- /headers/sam3u/mpu.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'MPU' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = [ 37 | (0x00, 'TYPE', [ 38 | ('separate', 1), 39 | ('', 7), 40 | ('dregion', 8), 41 | ('iregion', 8), 42 | ('', 8), 43 | ]), 44 | (0x04, 'CTRL', [ 45 | ('enable', 1), 46 | ('hfnmiena', 1), 47 | ('privdefena', 1), 48 | ('', 29), 49 | ]), 50 | (0x08, 'RNR', [ 51 | ('region', 8), 52 | ('', 24), 53 | ]), 54 | [ 4, 8, 55 | (0x0c, 'RBAR', [ 56 | ('region', 4), 57 | ('valid', 1), 58 | ('addr', 27), 59 | ]), 60 | (0x10, 'RASR', [ 61 | ('enable', 1), 62 | ('size', 5), 63 | ('', 2), 64 | ('srd', 8), 65 | ('b', 1), 66 | ('c', 1), 67 | ('s', 1), 68 | ('tex', 3), 69 | ('', 2), 70 | ('ap', 3), 71 | ('', 1), 72 | ('xn', 1), 73 | ('', 3), 74 | ]), 75 | ], 76 | ] 77 | 78 | -------------------------------------------------------------------------------- /headers/sam3u/nvic.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'NVIC' 34 | 35 | #------------------------------------------------------------------------------ 36 | def nvic_ipr(ipr0, ipr1, ipr2, ipr3): 37 | return [('', 4), (ipr0, 4), ('', 4), (ipr1, 4), ('', 4), (ipr2, 4), ('', 4), (ipr3, 4)] 38 | 39 | #------------------------------------------------------------------------------ 40 | registers = [ 41 | (0x0000, 'ISER0', common.pid), 42 | (0x0080, 'ICER0', common.pid), 43 | (0x0100, 'ISPR0', common.pid), 44 | (0x0180, 'ICPR0', common.pid), 45 | (0x0200, 'IABR0', common.pid), 46 | (0x0300, 'IPR0', nvic_ipr('supc', 'rstc', 'rtc', 'rtt')), 47 | (0x0304, 'IPR1', nvic_ipr('wdt', 'pmc', 'eefc0', 'eefc1')), 48 | (0x0308, 'IPR2', nvic_ipr('uart', 'smc', 'pioa', 'piob')), 49 | (0x030c, 'IPR3', nvic_ipr('pioc', 'usart0', 'usart1', 'usart2')), 50 | (0x0310, 'IPR4', nvic_ipr('usart3', 'hsmci', 'twi0', 'twi1')), 51 | (0x0314, 'IPR5', nvic_ipr('spi', 'ssc', 'tc0', 'tc1')), 52 | (0x0318, 'IPR6', nvic_ipr('tc2', 'pwm', 'adc12b', 'adc')), 53 | (0x031c, 'IPR7', nvic_ipr('dmac', 'udphs', '', '')), 54 | (0x0e00, 'STIR', [ 55 | ('intid', 9), 56 | ('', 23), 57 | ]), 58 | ] 59 | 60 | -------------------------------------------------------------------------------- /headers/sam3u/pdc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PDC' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'RPR'), 35 | (0x04, 'RCR'), 36 | (0x08, 'TPR'), 37 | (0x0c, 'TCR'), 38 | (0x10, 'RNPR'), 39 | (0x14, 'RNCR'), 40 | (0x18, 'TNPR'), 41 | (0x1c, 'TNCR'), 42 | (0x20, 'PTCR', [ 43 | ('rxten', 1), 44 | ('rxtdis', 1), 45 | ('', 6), 46 | ('txten', 1), 47 | ('txtdis', 1), 48 | ('', 22), 49 | ]), 50 | (0x24, 'PTSR', [ 51 | ('rxten', 1), 52 | ('', 7), 53 | ('txten', 1), 54 | ('', 23), 55 | ]), 56 | ] 57 | 58 | -------------------------------------------------------------------------------- /headers/sam3u/pio.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'PIO' 34 | 35 | #------------------------------------------------------------------------------ 36 | pio_bits = [('p%d' % i, 1) for i in range(32)] 37 | 38 | #------------------------------------------------------------------------------ 39 | registers = [ 40 | (0x00, 'PER', pio_bits), 41 | (0x04, 'PDR', pio_bits), 42 | (0x08, 'PSR', pio_bits), 43 | (0x10, 'OER', pio_bits), 44 | (0x14, 'ODR', pio_bits), 45 | (0x18, 'OSR', pio_bits), 46 | (0x20, 'IFER', pio_bits), 47 | (0x24, 'IFDR', pio_bits), 48 | (0x28, 'IFSR', pio_bits), 49 | (0x30, 'SODR', pio_bits), 50 | (0x34, 'CODR', pio_bits), 51 | (0x38, 'ODSR', pio_bits), 52 | (0x3c, 'PDSR', pio_bits), 53 | (0x40, 'IER', pio_bits), 54 | (0x44, 'IDR', pio_bits), 55 | (0x48, 'IMR', pio_bits), 56 | (0x4c, 'ISR', pio_bits), 57 | (0x50, 'MDER', pio_bits), 58 | (0x54, 'MDDR', pio_bits), 59 | (0x58, 'MDSR', pio_bits), 60 | (0x60, 'PUDR', pio_bits), 61 | (0x64, 'PUER', pio_bits), 62 | (0x68, 'PUSR', pio_bits), 63 | (0x70, 'ABSR', pio_bits), 64 | (0x80, 'SCIFSR', pio_bits), 65 | (0x84, 'DIFSR', pio_bits), 66 | (0x88, 'IFDGSR', pio_bits), 67 | (0x8c, 'SCDR', [ 68 | ('div', 14), 69 | ('', 18), 70 | ]), 71 | (0xa0, 'OWER', pio_bits), 72 | (0xa4, 'OWDR', pio_bits), 73 | (0xa8, 'OWSR', pio_bits), 74 | (0xb0, 'AIMER', pio_bits), 75 | (0xb4, 'AIMDR', pio_bits), 76 | (0xb8, 'AIMMR', pio_bits), 77 | (0xc0, 'ESR', pio_bits), 78 | (0xc4, 'LSR', pio_bits), 79 | (0xc8, 'ELSR', pio_bits), 80 | (0xd0, 'FELLSR', pio_bits), 81 | (0xd4, 'REHLSR', pio_bits), 82 | (0xd8, 'FRLHSR', pio_bits), 83 | (0xe0, 'LOCKSR', pio_bits), 84 | (0xe4, 'WPMR', common.wpmr(0x50494f)), 85 | (0xe8, 'WPSR', common.wpsr), 86 | ] 87 | 88 | -------------------------------------------------------------------------------- /headers/sam3u/rstc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'RSTC' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CR', [ 35 | ('procrst', 1), 36 | ('', 1), 37 | ('perrst', 1), 38 | ('extrst', 1), 39 | ('', 20), 40 | ('key', 8, [ 41 | ('KEY', 0xa5), 42 | ]), 43 | ]), 44 | (0x04, 'SR', [ 45 | ('ursts', 1), 46 | ('', 7), 47 | ('rsttyp', 3, [ 48 | ('GENERAL', 0), 49 | ('BACKUP', 1), 50 | ('WATCHDOG', 2), 51 | ('SOFTWARE', 3), 52 | ('USER', 4), 53 | ]), 54 | ('', 5), 55 | ('nrstl', 1), 56 | ('srcmp', 1), 57 | ('', 14), 58 | ]), 59 | (0x08, 'MR', [ 60 | ('ursten', 1), 61 | ('', 3), 62 | ('urstien', 1), 63 | ('', 3), 64 | ('erstl', 4), 65 | ('', 12), 66 | ('key', 8, [ 67 | ('KEY', 0xa5), 68 | ]), 69 | ]), 70 | ] 71 | 72 | -------------------------------------------------------------------------------- /headers/sam3u/rtc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'RTC' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = [ 37 | (0x00, 'CR', [ 38 | ('updtim', 1), 39 | ('updcal', 1), 40 | ('', 6), 41 | ('timevsel', 2, [ 42 | ('MINUTE', 0), 43 | ('HOUR', 1), 44 | ('MIDNIGHT', 2), 45 | ('NOON', 3), 46 | ]), 47 | ('', 6), 48 | ('calevsel', 2, [ 49 | ('WEEK', 0), 50 | ('MONTH', 1), 51 | ('YEAR', 2), 52 | ]), 53 | ('', 14), 54 | ]), 55 | (0x04, 'MR', [ 56 | ('hrmod', 1), 57 | ('', 31), 58 | ]), 59 | (0x08, 'TIMR', [ 60 | ('sec', 7), 61 | ('', 1), 62 | ('min', 7), 63 | ('', 1), 64 | ('hour', 6), 65 | ('ampm', 1), 66 | ('', 9), 67 | ]), 68 | (0x0c, 'CALR', [ 69 | ('cent', 7), 70 | ('', 1), 71 | ('year', 8), 72 | ('month', 5), 73 | ('day', 3), 74 | ('date', 6), 75 | ('', 2), 76 | ]), 77 | (0x10, 'TIMALR', [ 78 | ('sec', 7), 79 | ('secen', 1), 80 | ('min', 7), 81 | ('minen', 1), 82 | ('hour', 6), 83 | ('ampm', 1), 84 | ('houren', 1), 85 | ('', 8), 86 | ]), 87 | (0x14, 'CALALR', [ 88 | ('', 16), 89 | ('month', 5), 90 | ('', 2), 91 | ('mthen', 1), 92 | ('date', 6), 93 | ('', 1), 94 | ('dateen', 1), 95 | ]), 96 | (0x18, 'SR', [ 97 | ('ackupd', 1), 98 | ('alarm', 1), 99 | ('sec', 1), 100 | ('timev', 1), 101 | ('calev', 1), 102 | ('', 27), 103 | ]), 104 | (0x1c, 'SCCR', [ 105 | ('ackclr', 1), 106 | ('alrclr', 1), 107 | ('secclr', 1), 108 | ('timclr', 1), 109 | ('calclr', 1), 110 | ('', 27), 111 | ]), 112 | (0x20, 'IER', [ 113 | ('acken', 1), 114 | ('alren', 1), 115 | ('secen', 1), 116 | ('timen', 1), 117 | ('calen', 1), 118 | ('', 27), 119 | ]), 120 | (0x24, 'IDR', [ 121 | ('ackdis', 1), 122 | ('alrdis', 1), 123 | ('secdis', 1), 124 | ('timdis', 1), 125 | ('caldis', 1), 126 | ('', 27), 127 | ]), 128 | (0x28, 'IMR', [ 129 | ('ack', 1), 130 | ('alr', 1), 131 | ('sec', 1), 132 | ('tim', 1), 133 | ('cal', 1), 134 | ('', 27), 135 | ]), 136 | (0x2c, 'VER', [ 137 | ('nvtim', 1), 138 | ('nvcal', 1), 139 | ('nvtimalr', 1), 140 | ('nvcalalr', 1), 141 | ('', 28), 142 | ]), 143 | (0xe4, 'WPMR', common.wpmr(0x525443)), 144 | ] 145 | 146 | -------------------------------------------------------------------------------- /headers/sam3u/rtt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'RTT' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'MR', [ 35 | ('rtpres', 16), 36 | ('almien', 1), 37 | ('rttincien', 1), 38 | ('rttrst', 1), 39 | ('', 13), 40 | ]), 41 | (0x04, 'AR', [ 42 | ('almv', 32), 43 | ]), 44 | (0x08, 'VR', [ 45 | ('crtv', 32), 46 | ]), 47 | (0x0c, 'SR', [ 48 | ('alms', 1), 49 | ('rttinc', 1), 50 | ('', 30), 51 | ]), 52 | ] 53 | 54 | -------------------------------------------------------------------------------- /headers/sam3u/spi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'SPI' 34 | 35 | #------------------------------------------------------------------------------ 36 | spi_irqs = [ 37 | ('rdrf', 1), 38 | ('tdre', 1), 39 | ('modf', 1), 40 | ('ovres', 1), 41 | ('', 4), 42 | ('nssr', 1), 43 | ('txempty', 1), 44 | ('undes', 1), 45 | ('', 21), 46 | ] 47 | 48 | #------------------------------------------------------------------------------ 49 | registers = [ 50 | (0x00, 'CR', [ 51 | ('spien', 1), 52 | ('spidis', 1), 53 | ('', 5), 54 | ('swrst', 1), 55 | ('', 16), 56 | ('lastxfer', 1), 57 | ('', 7), 58 | ]), 59 | (0x04, 'MR', [ 60 | ('mstr', 1), 61 | ('ps', 1), 62 | ('pcsdec', 1), 63 | ('', 1), 64 | ('modfdis', 1), 65 | ('wdrbt', 1), 66 | ('', 1), 67 | ('llb', 1), 68 | ('', 8), 69 | ('pcs', 4), 70 | ('', 4), 71 | ('dlybcs', 8), 72 | ]), 73 | (0x08, 'RDR', [ 74 | ('rd', 16), 75 | ('pcs', 4), 76 | ('', 12), 77 | ]), 78 | (0x0c, 'TDR', [ 79 | ('td', 16), 80 | ('pcs', 4), 81 | ('', 4), 82 | ('lastxfer', 1), 83 | ('', 7), 84 | ]), 85 | (0x10, 'SR', [ 86 | ('rdrf', 1), 87 | ('tdre', 1), 88 | ('modf', 1), 89 | ('ovres', 1), 90 | ('', 4), 91 | ('nssr', 1), 92 | ('txempty', 1), 93 | ('undes', 1), 94 | ('', 5), 95 | ('spiens', 1), 96 | ('', 15), 97 | ]), 98 | (0x14, 'IER', spi_irqs), 99 | (0x18, 'IDR', spi_irqs), 100 | (0x1c, 'IMR', spi_irqs), 101 | [ 4, 4, 102 | (0x30, 'CSR', [ 103 | ('cpol', 1), 104 | ('ncpha', 1), 105 | ('csnaat', 1), 106 | ('csaat', 1), 107 | ('bits', 4, [ 108 | ('8_BIT', 0), 109 | ('9_BIT', 1), 110 | ('10_BIT', 2), 111 | ('11_BIT', 3), 112 | ('12_BIT', 4), 113 | ('13_BIT', 5), 114 | ('14_BIT', 6), 115 | ('15_BIT', 7), 116 | ('16_BIT', 8), 117 | ]), 118 | ('scbr', 8), 119 | ('dlybs', 8), 120 | ('dlybct', 8), 121 | ]), 122 | ], 123 | (0xe4, 'WPMR', common.wpmr(0x535049)), 124 | (0xe8, 'WPSR', common.wpsr), 125 | ] 126 | 127 | -------------------------------------------------------------------------------- /headers/sam3u/systick.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SYSTICK' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CSR', [ 35 | ('enable', 1), 36 | ('tickint', 1), 37 | ('clksource', 1), 38 | ('', 13), 39 | ('countflag', 1), 40 | ('', 15), 41 | ]), 42 | (0x04, 'RVR', [ 43 | ('reload', 24), 44 | ('', 8), 45 | ]), 46 | (0x08, 'CVR', [ 47 | ('current', 24), 48 | ('', 8), 49 | ]), 50 | (0x0c, 'CALIB', [ 51 | ('tenms', 24), 52 | ('', 6), 53 | ('skew', 1), 54 | ('noref', 1), 55 | ]), 56 | ] 57 | 58 | -------------------------------------------------------------------------------- /headers/sam3u/tc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'TC' 31 | 32 | #------------------------------------------------------------------------------ 33 | tc_edge = [ 34 | ('NONE', 0), 35 | ('RISING', 1), 36 | ('FALLING', 2), 37 | ('EDGE', 3), 38 | ] 39 | 40 | tc_irqs = [ 41 | ('covfs', 1), 42 | ('lovrs', 1), 43 | ('cpas', 1), 44 | ('cpbs', 1), 45 | ('cpcs', 1), 46 | ('ldras', 1), 47 | ('ldrbs', 1), 48 | ('etrgs', 1), 49 | ('', 24), 50 | ] 51 | 52 | tc_qirqs = [ 53 | ('idx', 1), 54 | ('dirchg', 1), 55 | ('qerr', 1), 56 | ('', 29), 57 | ] 58 | 59 | #------------------------------------------------------------------------------ 60 | registers = [ 61 | [ 3, 0x40, 62 | (0x00, 'CCR', [ 63 | ('clken', 1), 64 | ('clkdis', 1), 65 | ('swtrg', 1), 66 | ('', 29), 67 | ]), 68 | (0x04, 'CMR', [ 69 | ('tcclks', 3, [ 70 | ('TIMER_CLOCK1', 0), 71 | ('TIMER_CLOCK2', 1), 72 | ('TIMER_CLOCK3', 2), 73 | ('TIMER_CLOCK4', 3), 74 | ('TIMER_CLOCK5', 4), 75 | ('XC0', 5), 76 | ('XC1', 6), 77 | ('XC2', 7), 78 | ]), 79 | ('clki', 1), 80 | ('burst', 2, [ 81 | ('NONE', 0), 82 | ('XC0', 1), 83 | ('XC1', 2), 84 | ('XC2', 3), 85 | ]), 86 | ('ldbstop', 1), 87 | ('ldbdis', 1), 88 | ('etrgedg', 2, tc_edge), 89 | ('abetrg', 1), 90 | ('', 3), 91 | ('cpctrg', 1), 92 | ('wave', 1), 93 | ('ldra', 2, tc_edge), 94 | ('ldrb', 2, tc_edge), 95 | ('', 12), 96 | ]), 97 | (0x10, 'CV'), 98 | (0x14, 'RA'), 99 | (0x18, 'RB'), 100 | (0x1c, 'RC'), 101 | (0x20, 'SR', [ 102 | ('covfs', 1), 103 | ('lovrs', 1), 104 | ('cpas', 1), 105 | ('cpbs', 1), 106 | ('cpcs', 1), 107 | ('ldras', 1), 108 | ('ldrbs', 1), 109 | ('etrgs', 1), 110 | ('', 8), 111 | ('clksta', 1), 112 | ('mtioa', 1), 113 | ('mtiob', 1), 114 | ('', 13), 115 | ]), 116 | (0x24, 'IER', tc_irqs), 117 | (0x28, 'IDR', tc_irqs), 118 | (0x2c, 'IMR', tc_irqs), 119 | ], 120 | (0xc0, 'BCR', [ 121 | ('sync', 1), 122 | ('', 31), 123 | ]), 124 | (0xc4, 'BMR', [ 125 | ('tc0xc0s', 2, [ 126 | ('TCLK0', 0), 127 | ('TIOA1', 2), 128 | ('TIOA2', 3), 129 | ]), 130 | ('tc1xc1s', 2, [ 131 | ('TCLK1', 0), 132 | ('TIOA0', 2), 133 | ('TIOA2', 3), 134 | ]), 135 | ('tc2xc2s', 2, [ 136 | ('TCLK2', 0), 137 | ('TIOA1', 2), 138 | ('TIOA2', 3), 139 | ]), 140 | ('', 2), 141 | ('qden', 1), 142 | ('posen', 1), 143 | ('speeden', 1), 144 | ('qdtrans', 1), 145 | ('edgpha', 1), 146 | ('inva', 1), 147 | ('invb', 1), 148 | ('invidx', 1), 149 | ('swap', 1), 150 | ('idxphb', 1), 151 | ('', 1), 152 | ('filter', 1), 153 | ('maxfilt', 6), 154 | ('', 6), 155 | ]), 156 | (0xc8, 'QIER', tc_qirqs), 157 | (0xcc, 'QIDR', tc_qirqs), 158 | (0xd0, 'QIMR', tc_qirqs), 159 | (0xd4, 'QISR', [ 160 | ('idx', 1), 161 | ('dirchg', 1), 162 | ('qerr', 1), 163 | ('', 5), 164 | ('dir', 1), 165 | ('', 23), 166 | ]), 167 | ] 168 | 169 | -------------------------------------------------------------------------------- /headers/sam3u/twi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'TWI' 31 | 32 | #------------------------------------------------------------------------------ 33 | twi_irqs = [ 34 | ('txcomp', 1), 35 | ('rxrdy', 1), 36 | ('txrdy', 1), 37 | ('', 1), 38 | ('svacc', 1), 39 | ('gacc', 1), 40 | ('ovre', 1), 41 | ('', 1), 42 | ('nack', 1), 43 | ('arblst', 1), 44 | ('scl_ws', 1), 45 | ('eosacc', 1), 46 | ('endrx', 1), 47 | ('endtx', 1), 48 | ('rxbuff', 1), 49 | ('txbufe', 1), 50 | ('', 16), 51 | ] 52 | 53 | #------------------------------------------------------------------------------ 54 | registers = [ 55 | (0x00, 'CR', [ 56 | ('start', 1), 57 | ('stop', 1), 58 | ('msen', 1), 59 | ('msdis', 1), 60 | ('sven', 1), 61 | ('svdis', 1), 62 | ('quick', 1), 63 | ('swrst', 1), 64 | ('', 24), 65 | ]), 66 | (0x04, 'MMR', [ 67 | ('', 8), 68 | ('iadrsz', 2, [ 69 | ('NONE', 0), 70 | ('1_BYTE', 1), 71 | ('2_BYTE', 2), 72 | ('3_BYTE', 3), 73 | ]), 74 | ('', 2), 75 | ('mread', 1), 76 | ('', 3), 77 | ('dadr', 7), 78 | ('', 9), 79 | ]), 80 | (0x08, 'SMR', [ 81 | ('', 16), 82 | ('sadr', 7), 83 | ('', 9), 84 | ]), 85 | (0x0c, 'IADR', [ 86 | ('iadr', 24), 87 | ('', 8), 88 | ]), 89 | (0x10, 'CWGR', [ 90 | ('cldiv', 8), 91 | ('chdiv', 8), 92 | ('ckdiv', 3), 93 | ('', 13), 94 | ]), 95 | (0x20, 'SR', [ 96 | ('txcomp', 1), 97 | ('rxrdy', 1), 98 | ('txrdy', 1), 99 | ('svread', 1), 100 | ('svacc', 1), 101 | ('gacc', 1), 102 | ('ovre', 1), 103 | ('', 1), 104 | ('nack', 1), 105 | ('arblst', 1), 106 | ('sclws', 1), 107 | ('eosacc', 1), 108 | ('endrx', 1), 109 | ('endtx', 1), 110 | ('rxbuff', 1), 111 | ('txbufe', 1), 112 | ('', 16), 113 | ]), 114 | (0x24, 'IER', twi_irqs), 115 | (0x28, 'IDR', twi_irqs), 116 | (0x2c, 'IMR', twi_irqs), 117 | (0x30, 'RHR', [ 118 | ('rxdata', 8), 119 | ('', 24), 120 | ]), 121 | (0x34, 'THR', [ 122 | ('txdata', 8), 123 | ('', 24), 124 | ]), 125 | ] 126 | 127 | -------------------------------------------------------------------------------- /headers/sam3u/uart.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'UART' 31 | 32 | #------------------------------------------------------------------------------ 33 | uart_irqs = [ 34 | ('rxrdy', 1), 35 | ('txrdy', 1), 36 | ('', 1), 37 | ('endrx', 1), 38 | ('endtx', 1), 39 | ('ovre', 1), 40 | ('frame', 1), 41 | ('pare', 1), 42 | ('', 1), 43 | ('txempty', 1), 44 | ('', 1), 45 | ('txbufe', 1), 46 | ('rxbuff', 1), 47 | ('', 19), 48 | ] 49 | 50 | #------------------------------------------------------------------------------ 51 | registers = [ 52 | (0x0000, 'CR', [ 53 | ('', 2), 54 | ('rstrx', 1), 55 | ('rsttx', 1), 56 | ('rxen', 1), 57 | ('rxdis', 1), 58 | ('txen', 1), 59 | ('txdis', 1), 60 | ('rststa', 1), 61 | ('', 23), 62 | ]), 63 | (0x0004, 'MR', [ 64 | ('', 9), 65 | ('par', 3, [ 66 | ('EVEN', 0), 67 | ('ODD', 1), 68 | ('SPACE', 2), 69 | ('MARK', 3), 70 | ('NO', 4), 71 | ]), 72 | ('', 2), 73 | ('chmode', 2, [ 74 | ('NORMAL', 0), 75 | ('AUTOMATIC', 1), 76 | ('LOCAL_LOOPBACK', 2), 77 | ('REMOTE_LOOPBACK', 3), 78 | ]), 79 | ('', 16), 80 | ]), 81 | (0x0008, 'IER', uart_irqs), 82 | (0x000c, 'IDR', uart_irqs), 83 | (0x0010, 'IMR', uart_irqs), 84 | (0x0014, 'SR', uart_irqs), 85 | (0x0018, 'RHR', [ 86 | ('rxchr', 8), 87 | ('', 24), 88 | ]), 89 | (0x001c, 'THR', [ 90 | ('txchr', 8), 91 | ('', 24), 92 | ]), 93 | (0x0020, 'BRGR', [ 94 | ('cd', 16), 95 | ('', 16), 96 | ]), 97 | ] 98 | 99 | -------------------------------------------------------------------------------- /headers/sam3u/wdt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'WDT' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CR', [ 35 | ('wdrstt', 1), 36 | ('', 23), 37 | ('key', 8), 38 | ]), 39 | (0x04, 'MR', [ 40 | ('wdv', 12), 41 | ('wdfien', 1), 42 | ('wdrsten', 1), 43 | ('wdrproc', 1), 44 | ('wddis', 1), 45 | ('wdd', 12), 46 | ('wddbghlt', 1), 47 | ('wdidlehlt', 1), 48 | ('', 2), 49 | ]), 50 | (0x08, 'SR', [ 51 | ('wdunf', 1), 52 | ('wderr', 1), 53 | ('', 30), 54 | ]), 55 | ] 56 | 57 | -------------------------------------------------------------------------------- /headers/sam4s/acc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | regs = [ 34 | (0x00, 'CR', common.one_bit('swrst')), 35 | (0x04, 'MR', [ 36 | ('selminus', 3), 37 | ('', 1), 38 | ('selplus', 3), 39 | ('', 1), 40 | ('acen', 1), 41 | ('edgetyp', 2), 42 | ('', 1), 43 | ('inv', 1), 44 | ('selfs', 1), 45 | ('fe', 1), 46 | ('', 17), 47 | ]), 48 | (0x24, 'IER', common.one_bit('ce')), 49 | (0x28, 'IDR', common.one_bit('ce')), 50 | (0x2c, 'IMR', common.one_bit('ce')), 51 | (0x30, 'ISR', [ 52 | ('ce', 1), 53 | ('sco', 1), 54 | ('', 30), 55 | ]), 56 | (0x94, 'ACR', [ 57 | ('isel', 1), 58 | ('hyst', 2), 59 | ('', 29), 60 | ]), 61 | (0xe4, 'WPMR', common.wpmr), 62 | (0xe8, 'WPSR', common.wpsr), 63 | ] 64 | 65 | -------------------------------------------------------------------------------- /headers/sam4s/chipid.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CIDR', [ 32 | ('version', 5), 33 | ('eproc', 3), 34 | ('nvpsiz', 4), 35 | ('nvpsiz2', 4), 36 | ('sramsiz', 4), 37 | ('arch', 8), 38 | ('nvptyp', 3), 39 | ('ext', 1), 40 | ]), 41 | (0x04, 'EXID'), 42 | ] 43 | 44 | -------------------------------------------------------------------------------- /headers/sam4s/common.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | def one_bit(name): 31 | return [(name, 1), ('', 31)] 32 | 33 | wpmr = [ 34 | ('wpen', 1), 35 | ('', 7), 36 | ('wpkey', 24), 37 | ] 38 | 39 | wpsr = [ 40 | ('wpvs', 1), 41 | ('', 7), 42 | ('wpvsrc', 16), 43 | ('', 8), 44 | ] 45 | 46 | pid0 = [ 47 | ('supc', 1), 48 | ('rstc', 1), 49 | ('rtc', 1), 50 | ('rtt', 1), 51 | ('wdt', 1), 52 | ('pmc', 1), 53 | ('eefc0', 1), 54 | ('eefc1', 1), 55 | ('uart0', 1), 56 | ('uart1', 1), 57 | ('smc', 1), 58 | ('pioa', 1), 59 | ('piob', 1), 60 | ('pioc', 1), 61 | ('usart0', 1), 62 | ('usart1', 1), 63 | ('', 2), 64 | ('hsmci', 1), 65 | ('twi0', 1), 66 | ('twi1', 1), 67 | ('spi', 1), 68 | ('ssc', 1), 69 | ('tc0', 1), 70 | ('tc1', 1), 71 | ('tc2', 1), 72 | ('tc3', 1), 73 | ('tc4', 1), 74 | ('tc5', 1), 75 | ('adc', 1), 76 | ('dacc', 1), 77 | ('pwm', 1), 78 | ] 79 | 80 | pid1 = [ 81 | ('crccu', 1), 82 | ('acc', 1), 83 | ('udp', 1), 84 | ('', 29), 85 | ] 86 | 87 | -------------------------------------------------------------------------------- /headers/sam4s/crccu.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | regs = [ 34 | (0x00, 'DSCR', [ 35 | ('', 9), 36 | ('dscr', 23), 37 | ]), 38 | (0x08, 'DMA_EN', common.one_bit('dmaen')), 39 | (0x0c, 'DMA_DIS', common.one_bit('dmadis')), 40 | (0x10, 'DMA_SR', common.one_bit('dmasr')), 41 | (0x14, 'DMA_IER', common.one_bit('dmaier')), 42 | (0x18, 'DMA_IDR', common.one_bit('dmaidr')), 43 | (0x1c, 'DMA_IMR', common.one_bit('dmaimr')), 44 | (0x20, 'DMA_ISR', common.one_bit('dmaisr')), 45 | (0x34, 'CR', common.one_bit('reset')), 46 | (0x38, 'MR', [ 47 | ('enable', 1), 48 | ('compare', 1), 49 | ('ptype', 2), 50 | ('divider', 4), 51 | ('', 24), 52 | ]), 53 | (0x3c, 'SR'), 54 | (0x40, 'IER', common.one_bit('errier')), 55 | (0x44, 'IDR', common.one_bit('erridr')), 56 | (0x48, 'IMR', common.one_bit('errimr')), 57 | (0x4c, 'ISR', common.one_bit('errisr')), 58 | ] 59 | 60 | -------------------------------------------------------------------------------- /headers/sam4s/dacc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | regs = [ 34 | (0x00, 'CR', common.one_bit('swrst')), 35 | (0x04, 'MR', [ 36 | ('trgen', 1), 37 | ('trgsel', 3), 38 | ('word', 1), 39 | ('sleep', 1), 40 | ('fastwkup', 1), 41 | ('', 1), 42 | ('refresh', 8), 43 | ('user_sel', 2), 44 | ('', 2), 45 | ('tag', 1), 46 | ('maxs', 1), 47 | ('', 2), 48 | ('startup', 6), 49 | ('', 2), 50 | ]), 51 | (0x10, 'CHER', [ 52 | ('ch0', 1), 53 | ('ch1', 1), 54 | ('', 30), 55 | ]), 56 | (0x14, 'CHDR', [ 57 | ('ch0', 1), 58 | ('ch1', 1), 59 | ('', 30), 60 | ]), 61 | (0x18, 'CHSR', [ 62 | ('ch0', 1), 63 | ('ch1', 1), 64 | ('', 30), 65 | ]), 66 | (0x20, 'CDR'), 67 | (0x24, 'IER', [ 68 | ('txrdy', 1), 69 | ('eoc', 1), 70 | ('endtx', 1), 71 | ('txbufe', 1), 72 | ('', 28), 73 | ]), 74 | (0x28, 'IDR', [ 75 | ('txrdy', 1), 76 | ('eoc', 1), 77 | ('endtx', 1), 78 | ('txbufe', 1), 79 | ('', 28), 80 | ]), 81 | (0x2c, 'IMR', [ 82 | ('txrdy', 1), 83 | ('eoc', 1), 84 | ('endtx', 1), 85 | ('txbufe', 1), 86 | ('', 28), 87 | ]), 88 | (0x30, 'ISR', [ 89 | ('txrdy', 1), 90 | ('eoc', 1), 91 | ('endtx', 1), 92 | ('txbufe', 1), 93 | ('', 28), 94 | ]), 95 | (0x94, 'ACR', [ 96 | ('ibctlch0', 2), 97 | ('ibctlch1', 2), 98 | ('', 4), 99 | ('ibctldaccore', 2), 100 | ('', 22), 101 | ]), 102 | (0xe4, 'WPMR', common.wpmr), 103 | (0xe8, 'WPSR', common.wpsr), 104 | ] 105 | -------------------------------------------------------------------------------- /headers/sam4s/eefc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'FMR', [ 32 | ('frdy', 1), 33 | ('', 7), 34 | ('fws', 4), 35 | ('', 4), 36 | ('scod', 1), 37 | ('', 7), 38 | ('fam', 1), 39 | ('', 1), 40 | ('cloe', 1), 41 | ('', 5), 42 | ]), 43 | (0x04, 'FCR', [ 44 | ('fcmd', 8), 45 | ('farg', 16), 46 | ('fkey', 8), 47 | ]), 48 | (0x08, 'FSR', [ 49 | ('frdy', 1), 50 | ('fcmde', 1), 51 | ('flocke', 1), 52 | ('flerr', 1), 53 | ('', 28), 54 | ]), 55 | (0x0c, 'FRR'), 56 | ] 57 | 58 | -------------------------------------------------------------------------------- /headers/sam4s/gpbr.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, '0'), 32 | (0x04, '1'), 33 | (0x08, '2'), 34 | (0x0c, '3'), 35 | (0x10, '4'), 36 | (0x14, '5'), 37 | (0x18, '6'), 38 | (0x1c, '7'), 39 | ] 40 | -------------------------------------------------------------------------------- /headers/sam4s/hsmci.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | # not implemented 32 | ] 33 | -------------------------------------------------------------------------------- /headers/sam4s/matrix.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | matrix_mcfg = [ 34 | ('ulbt', 3), 35 | ('', 29), 36 | ] 37 | 38 | matrix_scfg = [ 39 | ('slot_cycle', 8), 40 | ('', 8), 41 | ('defmstr_type', 2), 42 | ('fixed_defmstr', 3), 43 | ('', 3), 44 | ('arbt', 2), 45 | ('', 6), 46 | ] 47 | 48 | matrix_pras = [ 49 | ('m0pr', 2), 50 | ('', 2), 51 | ('m1pr', 2), 52 | ('', 2), 53 | ('m2pr', 2), 54 | ('', 2), 55 | ('m3pr', 2), 56 | ('', 2), 57 | ('m4pr', 2), 58 | ('', 14), 59 | ] 60 | 61 | regs = [ 62 | (0x0000, 'MCFG0', matrix_mcfg), 63 | (0x0004, 'MCFG1', matrix_mcfg), 64 | (0x0008, 'MCFG2', matrix_mcfg), 65 | (0x000c, 'MCFG3', matrix_mcfg), 66 | (0x0040, 'SCFG0', matrix_scfg), 67 | (0x0044, 'SCFG1', matrix_scfg), 68 | (0x0048, 'SCFG2', matrix_scfg), 69 | (0x004c, 'SCFG3', matrix_scfg), 70 | (0x0050, 'SCFG4', matrix_scfg), 71 | (0x0080, 'PRAS0', matrix_pras), 72 | (0x0088, 'PRAS1', matrix_pras), 73 | (0x0090, 'PRAS2', matrix_pras), 74 | (0x0098, 'PRAS3', matrix_pras), 75 | (0x00a0, 'PRAS4', matrix_pras), 76 | (0x0114, 'CCFG_SYSIO', [ 77 | ('', 4), 78 | ('sysio4', 1), 79 | ('sysio5', 1), 80 | ('sysio6', 1), 81 | ('sysio7', 1), 82 | ('', 2), 83 | ('sysio10', 1), 84 | ('sysio11', 1), 85 | ('sysio12', 1), 86 | ('', 19), 87 | ]), 88 | (0x011c, 'CCFG_SMCNFCS', [ 89 | ('smc_nfcs0', 1), 90 | ('smc_nfcs1', 1), 91 | ('smc_nfcs2', 1), 92 | ('smc_nfcs3', 1), 93 | ('', 28), 94 | ]), 95 | (0x01e4, 'WPMR', common.wpmr), 96 | (0x01e8, 'WPSR', common.wpsr), 97 | ] 98 | 99 | -------------------------------------------------------------------------------- /headers/sam4s/mpu.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | mpu_rbar = [ 31 | ('region', 4), 32 | ('valid', 1), 33 | ('', 3), 34 | ('addr', 24), 35 | ] 36 | 37 | mpu_rasr = [ 38 | ('enable', 1), 39 | ('size', 5), 40 | ('', 2), 41 | ('srd', 8), 42 | ('b', 1), 43 | ('c', 1), 44 | ('s', 1), 45 | ('tex', 3), 46 | ('', 2), 47 | ('ap', 3), 48 | ('', 1), 49 | ('xn', 1), 50 | ('', 3), 51 | ] 52 | 53 | regs = [ 54 | (0x00, 'TYPE', [ 55 | ('separate', 1), 56 | ('', 7), 57 | ('dregion', 8), 58 | ('iregion', 8), 59 | ('', 8), 60 | ]), 61 | (0x04, 'CTRL', [ 62 | ('enable', 1), 63 | ('hfnmiena', 1), 64 | ('privdefena', 1), 65 | ('', 29), 66 | ]), 67 | (0x08, 'RNR', [ 68 | ('region', 8), 69 | ('', 24), 70 | ]), 71 | (0x0c, 'RBAR', mpu_rbar), 72 | (0x10, 'RASR', mpu_rasr), 73 | (0x14, 'RBAR_A1', mpu_rbar), 74 | (0x18, 'RASR_A1', mpu_rasr), 75 | (0x1c, 'RBAR_A2', mpu_rbar), 76 | (0x20, 'RASR_A2', mpu_rasr), 77 | (0x24, 'RBAR_A3', mpu_rbar), 78 | (0x28, 'RASR_A3', mpu_rasr), 79 | ] 80 | 81 | -------------------------------------------------------------------------------- /headers/sam4s/nvic.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | regs = [ 34 | (0x0000, 'ISER0', common.pid0), 35 | (0x0004, 'ISER1', common.pid1), 36 | # (0x0008, 'ISER2'), 37 | # (0x000c, 'ISER3'), 38 | # (0x0010, 'ISER4'), 39 | # (0x0014, 'ISER5'), 40 | # (0x0018, 'ISER6'), 41 | # (0x001c, 'ISER7'), 42 | 43 | (0x0080, 'ICER0', common.pid0), 44 | (0x0084, 'ICER1', common.pid1), 45 | # (0x0088, 'ICER2'), 46 | # (0x008c, 'ICER3'), 47 | # (0x0090, 'ICER4'), 48 | # (0x0094, 'ICER5'), 49 | # (0x0098, 'ICER6'), 50 | # (0x009c, 'ICER7'), 51 | 52 | (0x0100, 'ISPR0', common.pid0), 53 | (0x0104, 'ISPR1', common.pid1), 54 | # (0x0108, 'ISPR2'), 55 | # (0x010c, 'ISPR3'), 56 | # (0x0110, 'ISPR4'), 57 | # (0x0114, 'ISPR5'), 58 | # (0x0118, 'ISPR6'), 59 | # (0x011c, 'ISPR7'), 60 | 61 | (0x0180, 'ICPR0', common.pid0), 62 | (0x0184, 'ICPR1', common.pid1), 63 | # (0x0188, 'ICPR2'), 64 | # (0x018c, 'ICPR3'), 65 | # (0x0190, 'ICPR4'), 66 | # (0x0194, 'ICPR5'), 67 | # (0x0198, 'ICPR6'), 68 | # (0x019c, 'ICPR7'), 69 | 70 | (0x0200, 'IABR0', common.pid0), 71 | (0x0204, 'IABR1', common.pid1), 72 | # (0x0208, 'IABR2'), 73 | # (0x020c, 'IABR3'), 74 | # (0x0210, 'IABR4'), 75 | # (0x0214, 'IABR5'), 76 | # (0x0218, 'IABR6'), 77 | # (0x021c, 'IABR7'), 78 | 79 | (0x0300, 'IPR0', [ 80 | ('supc', 8), 81 | ('rstc', 8), 82 | ('rtc', 8), 83 | ('rtt', 8), 84 | ]), 85 | (0x0304, 'IPR1', [ 86 | ('wdt', 8), 87 | ('pmc', 8), 88 | ('eefc0', 8), 89 | ('eefc1', 8), 90 | ]), 91 | (0x0308, 'IPR2', [ 92 | ('uart0', 8), 93 | ('uart1', 8), 94 | ('smc', 8), 95 | ('pioa', 8), 96 | ]), 97 | (0x030c, 'IPR3', [ 98 | ('piob', 8), 99 | ('pioc', 8), 100 | ('usart0', 8), 101 | ('usart1', 8), 102 | ]), 103 | (0x0310, 'IPR4', [ 104 | ('', 8), 105 | ('', 8), 106 | ('hsmci', 8), 107 | ('twi0', 8), 108 | ]), 109 | (0x0314, 'IPR5', [ 110 | ('twi1', 8), 111 | ('spi', 8), 112 | ('ssc', 8), 113 | ('tc0', 8), 114 | ]), 115 | (0x0318, 'IPR6', [ 116 | ('tc1', 8), 117 | ('tc2', 8), 118 | ('tc3', 8), 119 | ('tc4', 8), 120 | ]), 121 | (0x031c, 'IPR7', [ 122 | ('tc5', 8), 123 | ('adc', 8), 124 | ('dacc', 8), 125 | ('pwm', 8), 126 | ]), 127 | (0x0320, 'IPR8', [ 128 | ('crccu', 8), 129 | ('acc', 8), 130 | ('udp', 8), 131 | ('', 8), 132 | ]), 133 | 134 | (0x0e00, 'STIR', [ 135 | ('intid', 9), 136 | ('', 23), 137 | ]), 138 | ] 139 | 140 | -------------------------------------------------------------------------------- /headers/sam4s/pdc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'RPR'), 32 | (0x04, 'RCR'), 33 | (0x08, 'TPR'), 34 | (0x0c, 'TCR'), 35 | (0x10, 'RNPR'), 36 | (0x14, 'RNCR'), 37 | (0x18, 'TNPR'), 38 | (0x1c, 'TNCR'), 39 | (0x20, 'PTCR', [ 40 | ('rxten', 1), 41 | ('rxtdis', 1), 42 | ('', 6), 43 | ('txten', 1), 44 | ('txtdis', 1), 45 | ('', 22), 46 | ]), 47 | (0x24, 'PTSR', [ 48 | ('rxten', 1), 49 | ('', 7), 50 | ('txten', 1), 51 | ('', 23), 52 | ]), 53 | ] 54 | 55 | -------------------------------------------------------------------------------- /headers/sam4s/pio.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | pio_bits = [('p%d' % i, 1) for i in range(32)] 34 | 35 | regs = [ 36 | (0x0000, 'PER', pio_bits), 37 | (0x0004, 'PDR', pio_bits), 38 | (0x0008, 'PSR', pio_bits), 39 | (0x0010, 'OER', pio_bits), 40 | (0x0014, 'ODR', pio_bits), 41 | (0x0018, 'OSR', pio_bits), 42 | (0x0020, 'IFER', pio_bits), 43 | (0x0024, 'IFDR', pio_bits), 44 | (0x0028, 'IFSR', pio_bits), 45 | (0x0030, 'SODR', pio_bits), 46 | (0x0034, 'CODR', pio_bits), 47 | (0x0038, 'ODSR', pio_bits), 48 | (0x003c, 'PDSR', pio_bits), 49 | (0x0040, 'IER', pio_bits), 50 | (0x0044, 'IDR', pio_bits), 51 | (0x0048, 'IMR', pio_bits), 52 | (0x004c, 'ISR', pio_bits), 53 | (0x0050, 'MDER', pio_bits), 54 | (0x0054, 'MDDR', pio_bits), 55 | (0x0058, 'MDSR', pio_bits), 56 | (0x0060, 'PUDR', pio_bits), 57 | (0x0064, 'PUER', pio_bits), 58 | (0x0068, 'PUSR', pio_bits), 59 | (0x0070, 'ABCDSR1', pio_bits), 60 | (0x0074, 'ABCDSR2', pio_bits), 61 | (0x0080, 'IFSCDR', pio_bits), 62 | (0x0084, 'IFSCER', pio_bits), 63 | (0x0088, 'IFSCSR', pio_bits), 64 | (0x008c, 'SCDR',[ 65 | ('div', 14), 66 | ('', 18), 67 | ]), 68 | (0x0090, 'PPDDR', pio_bits), 69 | (0x0094, 'PPDER', pio_bits), 70 | (0x0098, 'PPDSR', pio_bits), 71 | (0x00A0, 'OWER', pio_bits), 72 | (0x00A4, 'OWDR', pio_bits), 73 | (0x00A8, 'OWSR', pio_bits), 74 | (0x00B0, 'AIMER', pio_bits), 75 | (0x00B4, 'AIMDR', pio_bits), 76 | (0x00B8, 'AIMMR', pio_bits), 77 | (0x00c0, 'ESR', pio_bits), 78 | (0x00c4, 'LSR', pio_bits), 79 | (0x00c8, 'ELSR', pio_bits), 80 | (0x00D0, 'FELLSR', pio_bits), 81 | (0x00D4, 'REHLSR', pio_bits), 82 | (0x00D8, 'FRLHSR', pio_bits), 83 | (0x00E0, 'LOCKSR', pio_bits), 84 | (0x00E4, 'WPMR', common.wpmr), 85 | (0x00E8, 'WPSR', common.wpsr), 86 | (0x0100, 'SCHMITT', pio_bits), 87 | (0x0150, 'PCMR', [ 88 | ('pcen', 1), 89 | ('', 3), 90 | ('dsize', 2), 91 | ('', 3), 92 | ('alwys', 1), 93 | ('halfs', 1), 94 | ('frsts', 1), 95 | ('', 20), 96 | ]), 97 | (0x0154, 'PCIER', [ 98 | ('drdy', 1), 99 | ('ovre', 1), 100 | ('endrx', 1), 101 | ('rxbuff', 1), 102 | ('', 28), 103 | ]), 104 | (0x0158, 'PCIDR', [ 105 | ('drdy', 1), 106 | ('ovre', 1), 107 | ('endrx', 1), 108 | ('rxbuff', 1), 109 | ('', 28), 110 | ]), 111 | (0x015c, 'PCIMR', [ 112 | ('drdy', 1), 113 | ('ovre', 1), 114 | ('endrx', 1), 115 | ('rxbuff', 1), 116 | ('', 28), 117 | ]), 118 | (0x0160, 'PCISR', [ 119 | ('drdy', 1), 120 | ('ovre', 1), 121 | ('endrx', 1), 122 | ('rxbuff', 1), 123 | ('', 28), 124 | ]), 125 | (0x0164, 'PCRHR'), 126 | ] 127 | 128 | -------------------------------------------------------------------------------- /headers/sam4s/rstc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CR', [ 32 | ('procrst', 1), 33 | ('', 1), 34 | ('perrst', 1), 35 | ('extrst', 1), 36 | ('', 20), 37 | ('key', 8), 38 | ]), 39 | (0x04, 'SR', [ 40 | ('ursts', 1), 41 | ('', 7), 42 | ('rsttyp', 3), 43 | ('', 5), 44 | ('nrstl', 1), 45 | ('srcmp', 1), 46 | ('', 14), 47 | ]), 48 | (0x08, 'MR', [ 49 | ('ursten', 1), 50 | ('', 3), 51 | ('urstien', 1), 52 | ('', 3), 53 | ('erstl', 4), 54 | ('', 12), 55 | ('key', 8), 56 | ]), 57 | ] 58 | 59 | -------------------------------------------------------------------------------- /headers/sam4s/rtt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'MR', [ 32 | ('rtpres', 16), 33 | ('almien', 1), 34 | ('rttincien', 1), 35 | ('rttrst', 1), 36 | ('', 13), 37 | ]), 38 | (0x04, 'AR'), 39 | (0x08, 'VR'), 40 | (0x0c, 'SR', [ 41 | ('alms', 1), 42 | ('rttinc', 1), 43 | ('', 30), 44 | ]), 45 | ] 46 | 47 | -------------------------------------------------------------------------------- /headers/sam4s/smc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import common 31 | 32 | #------------------------------------------------------------------------------ 33 | smc_setup = [ 34 | ('nwe_setup', 6), 35 | ('', 2), 36 | ('ncs_wr_setup', 6), 37 | ('', 2), 38 | ('nrd_setup', 6), 39 | ('', 2), 40 | ('ncs_rd_setup', 6), 41 | ('', 2), 42 | ] 43 | 44 | smc_pulse = [ 45 | ('nwe_pulse', 7), 46 | ('', 1), 47 | ('ncs_wr_pulse', 7), 48 | ('', 1), 49 | ('nrd_pulse', 7), 50 | ('', 1), 51 | ('ncs_rd_pulse', 7), 52 | ('', 1), 53 | ] 54 | 55 | smc_cycle = [ 56 | ('nwe_cycle', 9), 57 | ('', 7), 58 | ('nrd_cycle', 9), 59 | ('', 7), 60 | ] 61 | 62 | smc_mode = [ 63 | ('read_mode', 1), 64 | ('write_mode', 1), 65 | ('', 2), 66 | ('exnw_mode', 2), 67 | ('', 9), 68 | ('tdf_cycles', 4), 69 | ('tdf_mode', 1), 70 | ('', 3), 71 | ('pmen', 1), 72 | ('', 3), 73 | ('ps', 2), 74 | ('', 3), 75 | ] 76 | 77 | regs = [ 78 | (0x00, 'SETUP0', smc_setup), 79 | (0x04, 'PULSE0', smc_pulse), 80 | (0x08, 'CYCLE0', smc_cycle), 81 | (0x0c, 'MODE0', smc_mode), 82 | (0x10, 'SETUP1', smc_setup), 83 | (0x14, 'PULSE1', smc_pulse), 84 | (0x18, 'CYCLE1', smc_cycle), 85 | (0x1c, 'MODE1', smc_mode), 86 | (0x20, 'SETUP2', smc_setup), 87 | (0x24, 'PULSE2', smc_pulse), 88 | (0x28, 'CYCLE2', smc_cycle), 89 | (0x2c, 'MODE2', smc_mode), 90 | (0x30, 'SETUP3', smc_setup), 91 | (0x34, 'PULSE3', smc_pulse), 92 | (0x38, 'CYCLE3', smc_cycle), 93 | (0x3c, 'MODE3', smc_mode), 94 | (0x80, 'OCMS', [ 95 | ('smse', 1), 96 | ('', 15), 97 | ('cs0se', 1), 98 | ('cs1se', 1), 99 | ('cs2se', 1), 100 | ('cs3se', 1), 101 | ('', 12), 102 | ]), 103 | (0x84, 'KEY1'), 104 | (0x88, 'KEY2'), 105 | (0xe4, 'WPMR', common.wpmr), 106 | (0xe8, 'WPSR', common.wpsr), 107 | ] 108 | 109 | -------------------------------------------------------------------------------- /headers/sam4s/spi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ # not fully described 31 | (0x00, 'CR'), 32 | (0x04, 'MR'), 33 | (0x08, 'RDR'), 34 | (0x0c, 'TDR'), 35 | (0x10, 'SR'), 36 | (0x14, 'IER'), 37 | (0x18, 'IDR'), 38 | (0x1c, 'IMR'), 39 | (0x30, 'CSR0'), 40 | (0x34, 'CSR1'), 41 | (0x38, 'CSR2'), 42 | (0x3c, 'CSR3'), 43 | (0xe4, 'WPMR'), 44 | (0xe8, 'WPSR'), 45 | ] 46 | 47 | -------------------------------------------------------------------------------- /headers/sam4s/ssc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ # not fully described 31 | (0x00, 'CR'), 32 | (0x04, 'CMR'), 33 | (0x10, 'RCMR'), 34 | (0x14, 'RFMR'), 35 | (0x18, 'TCMR'), 36 | (0x1c, 'TFMR'), 37 | (0x20, 'RHR'), 38 | (0x24, 'THR'), 39 | (0x30, 'RSHR'), 40 | (0x34, 'TSHR'), 41 | (0x38, 'RC0R'), 42 | (0x3c, 'RC1R'), 43 | (0x40, 'SR'), 44 | (0x44, 'IER'), 45 | (0x48, 'IDR'), 46 | (0x4c, 'IMR'), 47 | (0xe4, 'WPMR'), 48 | (0xe8, 'WPSR'), 49 | ] 50 | 51 | -------------------------------------------------------------------------------- /headers/sam4s/supc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CR', [ 32 | ('', 2), 33 | ('vroff', 1), 34 | ('xtalsel', 1), 35 | ('', 20), 36 | ('key', 8), 37 | ]), 38 | (0x04, 'SMMR', [ 39 | ('smth', 4), 40 | ('', 4), 41 | ('smsmpl', 3), 42 | ('', 1), 43 | ('smrsten', 1), 44 | ('smien', 1), 45 | ('', 18), 46 | ]), 47 | (0x08, 'MR', [ 48 | ('', 12), 49 | ('bodrsten', 1), 50 | ('boddis', 1), 51 | ('onreg', 1), 52 | ('', 5), 53 | ('oscbypass', 1), 54 | ('', 3), 55 | ('key', 8), 56 | ]), 57 | (0x0c, 'WUMR', [ 58 | ('', 1), 59 | ('smen', 1), 60 | ('rtten', 1), 61 | ('rtcen', 1), 62 | ('', 1), 63 | ('lpdbcen0', 1), 64 | ('lpdbcen1', 1), 65 | ('lpdbcclr', 1), 66 | ('', 4), 67 | ('wkupdbc', 3), 68 | ('', 1), 69 | ('lpdbc', 3), 70 | ('', 13), 71 | ]), 72 | (0x10, 'WUIR', 73 | [('wkupen%d' % i, 1) for i in range(16)] + 74 | [('wkupt%d' % i, 1) for i in range(16)] 75 | ), 76 | (0x14, 'SR', [ 77 | ('', 1), 78 | ('wkups', 1), 79 | ('smws', 1), 80 | ('bodrsts', 1), 81 | ('smrsts', 1), 82 | ('sms', 1), 83 | ('smos', 1), 84 | ('oscsel', 1), 85 | ('', 5), 86 | ('lpdbcs0', 1), 87 | ('lpdbcs1', 1), 88 | ('', 1)] + 89 | [('wkupis%d' % i, 1) for i in range(16)] 90 | ), 91 | ] 92 | 93 | -------------------------------------------------------------------------------- /headers/sam4s/syst.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CSR', [ 32 | ('enable', 1), 33 | ('tickint', 1), 34 | ('clksource', 1), 35 | ('', 13), 36 | ('countflag', 1), 37 | ('', 15), 38 | ]), 39 | (0x04, 'RVR', [ 40 | ('reload', 24), 41 | ('', 8), 42 | ]), 43 | (0x08, 'CVR', [ 44 | ('current', 24), 45 | ('', 8), 46 | ]), 47 | (0x0c, 'CALIB', [ 48 | ('tenms', 24), 49 | ('', 6), 50 | ('skew', 1), 51 | ('noref', 1), 52 | ]), 53 | ] 54 | 55 | -------------------------------------------------------------------------------- /headers/sam4s/twi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | twi_irqs = [ 31 | ('txcomp', 1), 32 | ('rxrdy', 1), 33 | ('txrdy', 1), 34 | ('', 1), 35 | ('svacc', 1), 36 | ('gacc', 1), 37 | ('ovre', 1), 38 | ('', 1), 39 | ('nack', 1), 40 | ('arblst', 1), 41 | ('sclws', 1), 42 | ('eosacc', 1), 43 | ('endrx', 1), 44 | ('endtx', 1), 45 | ('rxbuff', 1), 46 | ('txbufe', 1), 47 | ('', 16), 48 | ] 49 | 50 | regs = [ 51 | (0x00, 'CR', [ 52 | ('start', 1), 53 | ('stop', 1), 54 | ('msen', 1), 55 | ('msdis', 1), 56 | ('sven', 1), 57 | ('svdis', 1), 58 | ('quick', 1), 59 | ('swrst', 1), 60 | ('', 24), 61 | ]), 62 | (0x04, 'MMR', [ 63 | ('', 8), 64 | ('iadrsz', 2), 65 | ('', 2), 66 | ('mread', 1), 67 | ('', 3), 68 | ('daddr', 7), 69 | ('', 9), 70 | ]), 71 | (0x08, 'SMR', [ 72 | ('', 16), 73 | ('sadr', 7), 74 | ('', 9), 75 | ]), 76 | (0x0c, 'IADR', [ 77 | ('iadr', 24), 78 | ('', 8), 79 | ]), 80 | (0x10, 'CWGR', [ 81 | ('cldiv', 8), 82 | ('chdiv', 8), 83 | ('ckdiv', 3), 84 | ('', 13), 85 | ]), 86 | (0x20, 'SR', [ 87 | ('txcomp', 1), 88 | ('rxrdy', 1), 89 | ('txrdy', 1), 90 | ('svread', 1), 91 | ('svacc', 1), 92 | ('gacc', 1), 93 | ('ovre', 1), 94 | ('', 1), 95 | ('nack', 1), 96 | ('arblst', 1), 97 | ('sclws', 1), 98 | ('eosacc', 1), 99 | ('endrx', 1), 100 | ('endtx', 1), 101 | ('rxbuff', 1), 102 | ('txbufe', 1), 103 | ('', 16), 104 | ]), 105 | (0x24, 'IER', twi_irqs), 106 | (0x28, 'IDR', twi_irqs), 107 | (0x2c, 'IMR', twi_irqs), 108 | (0x30, 'RHR', [ 109 | ('rxdata', 8), 110 | ('', 24), 111 | ]), 112 | (0x34, 'THR', [ 113 | ('txdata', 8), 114 | ('', 24), 115 | ]), 116 | ] 117 | 118 | -------------------------------------------------------------------------------- /headers/sam4s/uart.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CR', [ 32 | ('', 2), 33 | ('rstrx', 1), 34 | ('rsttx', 1), 35 | ('rxen', 1), 36 | ('rxdis', 1), 37 | ('txen', 1), 38 | ('txdis', 1), 39 | ('rststa', 1), 40 | ('', 23), 41 | ]), 42 | (0x04, 'MR', [ 43 | ('', 9), 44 | ('par', 3), 45 | ('', 2), 46 | ('chmode', 2), 47 | ('', 16), 48 | ]), 49 | (0x08, 'IER', [ 50 | ('rxrdy', 1), 51 | ('txrdy', 1), 52 | ('', 1), 53 | ('endrx', 1), 54 | ('endtx', 1), 55 | ('ovre', 1), 56 | ('frame', 1), 57 | ('pare', 1), 58 | ('', 1), 59 | ('txempty', 1), 60 | ('', 1), 61 | ('txbufe', 1), 62 | ('rxbuff', 1), 63 | ('', 19), 64 | ]), 65 | (0x0c, 'IDR', [ 66 | ('rxrdy', 1), 67 | ('txrdy', 1), 68 | ('', 1), 69 | ('endrx', 1), 70 | ('endtx', 1), 71 | ('ovre', 1), 72 | ('frame', 1), 73 | ('pare', 1), 74 | ('', 1), 75 | ('txempty', 1), 76 | ('', 1), 77 | ('txbufe', 1), 78 | ('rxbuff', 1), 79 | ('', 19), 80 | ]), 81 | (0x10, 'IMR', [ 82 | ('rxrdy', 1), 83 | ('txrdy', 1), 84 | ('', 1), 85 | ('endrx', 1), 86 | ('endtx', 1), 87 | ('ovre', 1), 88 | ('frame', 1), 89 | ('pare', 1), 90 | ('', 1), 91 | ('txempty', 1), 92 | ('', 1), 93 | ('txbufe', 1), 94 | ('rxbuff', 1), 95 | ('', 19), 96 | ]), 97 | (0x14, 'SR', [ 98 | ('rxrdy', 1), 99 | ('txrdy', 1), 100 | ('', 1), 101 | ('endrx', 1), 102 | ('endtx', 1), 103 | ('ovre', 1), 104 | ('frame', 1), 105 | ('pare', 1), 106 | ('', 1), 107 | ('txempty', 1), 108 | ('', 1), 109 | ('txbufe', 1), 110 | ('rxbuff', 1), 111 | ('', 19), 112 | ]), 113 | (0x18, 'RHR', [ 114 | ('rxchr', 8), 115 | ('', 24), 116 | ]), 117 | (0x1c, 'THR', [ 118 | ('txchr', 8), 119 | ('', 24), 120 | ]), 121 | (0x20, 'BRGR', [ 122 | ('cd', 16), 123 | ('', 16), 124 | ]), 125 | ] 126 | 127 | -------------------------------------------------------------------------------- /headers/sam4s/udp.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | udp_ep_int = [('ep%dint' % i, 1) for i in range(8)] 31 | 32 | udp_ep = [('ep%d' % i, 1) for i in range(8)] + [('', 24)] 33 | 34 | udp_csr = [ 35 | ('txcomp', 1), 36 | ('rx_data_bk0', 1), 37 | ('rxsetup', 1), 38 | ('stallsent', 1), 39 | ('txpktrdy', 1), 40 | ('forcestall', 1), 41 | ('rx_data_bk1', 1), 42 | ('dir', 1), 43 | ('eptype', 3), 44 | ('dtgle', 1), 45 | ('', 3), 46 | ('epeds', 1), 47 | ('rxbytecnt', 11), 48 | ('', 5), 49 | ] 50 | 51 | udp_fdr = [ 52 | ('fifo_data', 8), 53 | ('', 24), 54 | ] 55 | 56 | regs = [ 57 | (0x00, 'FRM_NUM', [ 58 | ('frm_num', 11), 59 | ('', 5), 60 | ('frm_err', 1), 61 | ('frm_ok', 1), 62 | ('', 14), 63 | ]), 64 | (0x04, 'GLB_STAT', [ 65 | ('fadden', 1), 66 | ('confg', 1), 67 | ('esr', 1), 68 | ('rsminpr', 1), 69 | ('rmwupe', 1), 70 | ('', 27), 71 | ]), 72 | (0x08, 'FADDR', [ 73 | ('fadd', 7), 74 | ('', 1), 75 | ('fen', 1), 76 | ('', 23), 77 | ]), 78 | (0x10, 'IER', 79 | udp_ep_int + [ 80 | ('rxsusp', 1), 81 | ('rxrsm', 1), 82 | ('extrsm', 1), 83 | ('sofint', 1), 84 | ('', 1), 85 | ('wakeup', 1), 86 | ('', 18), 87 | ]), 88 | (0x14, 'IDR', 89 | udp_ep_int + [ 90 | ('rxsusp', 1), 91 | ('rxrsm', 1), 92 | ('extrsm', 1), 93 | ('sofint', 1), 94 | ('', 1), 95 | ('wakeup', 1), 96 | ('', 18), 97 | ]), 98 | (0x18, 'IMR', 99 | udp_ep_int + [ 100 | ('rxsusp', 1), 101 | ('rxrsm', 1), 102 | ('extrsm', 1), 103 | ('sofint', 1), 104 | ('bit12', 1), 105 | ('wakeup', 1), 106 | ('', 18), 107 | ]), 108 | (0x1c, 'ISR', 109 | udp_ep_int + [ 110 | ('rxsusp', 1), 111 | ('rxrsm', 1), 112 | ('extrsm', 1), 113 | ('sofint', 1), 114 | ('endbusres', 1), 115 | ('wakeup', 1), 116 | ('', 18), 117 | ]), 118 | (0x20, 'ICR', [ 119 | ('', 8), 120 | ('rxsusp', 1), 121 | ('rxrsm', 1), 122 | ('extrsm', 1), 123 | ('sofint', 1), 124 | ('endbusres', 1), 125 | ('wakeup', 1), 126 | ('', 18), 127 | ]), 128 | (0x28, 'RST_EP', udp_ep), 129 | ((0x30, 0x4c), 'CSR', udp_csr), 130 | ((0x50, 0x6c), 'FDR', udp_fdr), 131 | (0x74, 'TXVC', [ 132 | ('', 8), 133 | ('txvdis', 1), 134 | ('puon', 1), 135 | ('', 22), 136 | ]), 137 | ] 138 | 139 | -------------------------------------------------------------------------------- /headers/sam4s/wdt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | regs = [ 31 | (0x00, 'CR', [ 32 | ('wdrstt', 1), 33 | ('', 23), 34 | ('key', 8), 35 | ]), 36 | (0x04, 'MR', [ 37 | ('wdv', 12), 38 | ('wdfien', 1), 39 | ('wdrsten', 1), 40 | ('wdrproc', 1), 41 | ('wddis', 1), 42 | ('wdd', 12), 43 | ('wddbghlt', 1), 44 | ('wdidlehlt', 1), 45 | ('', 2), 46 | ]), 47 | (0x08, 'SR', [ 48 | ('wdunf', 1), 49 | ('wderr', 1), 50 | ('', 30), 51 | ]), 52 | ] 53 | 54 | -------------------------------------------------------------------------------- /headers/samd20/ac.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'AC' 31 | 32 | #------------------------------------------------------------------------------ 33 | ac_ints = [ 34 | ('comp0', 1), 35 | ('comp1', 1), 36 | ('', 2), 37 | ('win0', 1), 38 | ('', 3), 39 | ] 40 | 41 | #------------------------------------------------------------------------------ 42 | registers = [ 43 | (0x00, 'CTRLA', [ 44 | ('swrst', 1), 45 | ('enable', 1), 46 | ('runstdby', 1), 47 | ('', 5), 48 | ]), 49 | (0x01, 'CTRLB', [ 50 | ('start0', 1), 51 | ('start1', 1), 52 | ('', 6), 53 | ]), 54 | (0x02, 'EVCTRL', [ 55 | ('compeo0', 1), 56 | ('compeo1', 1), 57 | ('', 2), 58 | ('wineo0', 1), 59 | ('', 3), 60 | ('compei0', 1), 61 | ('compei1', 1), 62 | ('', 6), 63 | ]), 64 | (0x04, 'INTENCLR', ac_ints), 65 | (0x05, 'INTENSET', ac_ints), 66 | (0x06, 'INTFLAG', ac_ints), 67 | (0x08, 'STATUSA', [ 68 | ('state0', 1), 69 | ('state1', 1), 70 | ('', 2), 71 | ('wstate0', 2, [ 72 | ('ABOVE', 0), 73 | ('INSIDE', 1), 74 | ('BELOW', 2), 75 | ]), 76 | ('', 2), 77 | ]), 78 | (0x09, 'STATUSB', [ 79 | ('ready0', 1), 80 | ('ready1', 1), 81 | ('', 5), 82 | ('syncbusy', 1), 83 | ]), 84 | (0x0a, 'STATUSC', [ 85 | ('state0', 1), 86 | ('state1', 1), 87 | ('', 2), 88 | ('wstate0', 2, [ 89 | ('ABOVE', 0), 90 | ('INSIDE', 1), 91 | ('BELOW', 2), 92 | ]), 93 | ('', 2), 94 | ]), 95 | (0x0c, 'WINCTRL', [ 96 | ('wen0', 1), 97 | ('wintsel0', 2, [ 98 | ('ABOVE', 0), 99 | ('INSIDE', 1), 100 | ('BELOW', 2), 101 | ('OUTSIDE', 3), 102 | ]), 103 | ('', 5), 104 | ]), 105 | [2, 4, 106 | (0x10, 'COMPCTRL', [ 107 | ('enable', 1), 108 | ('single', 1), 109 | ('speed', 2, [ 110 | ('LOW', 0), 111 | ('HIGH', 1), 112 | ]), 113 | ('', 1), 114 | ('intsel', 2, [ 115 | ('TOGGLE', 0), 116 | ('RISING', 1), 117 | ('FALLING', 2), 118 | ('EOC', 3), 119 | ]), 120 | ('', 1), 121 | ('muxneg', 3, [ 122 | ('PIN0', 0), 123 | ('PIN1', 1), 124 | ('PIN2', 2), 125 | ('PIN3', 3), 126 | ('GND', 4), 127 | ('VSCALE', 5), 128 | ('BANDGAP', 6), 129 | ('DAC', 7), 130 | ]), 131 | ('', 1), 132 | ('muxpos', 2, [ 133 | ('PIN0', 0), 134 | ('PIN1', 1), 135 | ('PIN2', 2), 136 | ('PIN3', 3), 137 | ]), 138 | ('', 1), 139 | ('swap', 1), 140 | ('out', 2, [ 141 | ('OFF', 0), 142 | ('ASYNC', 1), 143 | ('SYNC', 2), 144 | ]), 145 | ('', 1), 146 | ('hyst', 1), 147 | ('', 4), 148 | ('flen', 3, [ 149 | ('OFF', 0), 150 | ('MAJ3', 1), 151 | ('MAJ5', 2), 152 | ]), 153 | ('', 5), 154 | ]), 155 | ], 156 | [2, 1, 157 | (0x20, 'SCALER', [ 158 | ('value', 6), 159 | ('', 2), 160 | ]), 161 | ], 162 | ] 163 | 164 | -------------------------------------------------------------------------------- /headers/samd20/cm0_nvic.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'NVIC' 31 | 32 | #------------------------------------------------------------------------------ 33 | cm0_nvic_ints = [ 34 | ('pm', 1), 35 | ('sysctrl', 1), 36 | ('wdt', 1), 37 | ('rtc', 1), 38 | ('eic', 1), 39 | ('nvmctrl', 1), 40 | ('evsys', 1), 41 | ('sercom0', 1), 42 | ('sercom1', 1), 43 | ('sercom2', 1), 44 | ('sercom3', 1), 45 | ('sercom4', 1), 46 | ('sercom5', 1), 47 | ('tc0', 1), 48 | ('tc1', 1), 49 | ('tc2', 1), 50 | ('tc3', 1), 51 | ('tc4', 1), 52 | ('tc5', 1), 53 | ('tc6', 1), 54 | ('tc7', 1), 55 | ('adc', 1), 56 | ('ac', 1), 57 | ('dac', 1), 58 | ('ptc', 1), 59 | ('', 7), 60 | ] 61 | 62 | def cm0_nvic_ipr(ipr0, ipr1, ipr2, ipr3): 63 | return [('', 6), (ipr0, 2), ('', 6), (ipr1, 2), ('', 6), (ipr2, 2), ('', 6), (ipr3, 2)] 64 | 65 | #------------------------------------------------------------------------------ 66 | registers = [ 67 | (0x0000, 'ISER', cm0_nvic_ints), 68 | (0x0080, 'ICER', cm0_nvic_ints), 69 | (0x0100, 'ISPR', cm0_nvic_ints), 70 | (0x0180, 'ICPR', cm0_nvic_ints), 71 | (0x0300, 'IPR0', cm0_nvic_ipr('pm', 'sysctrl', 'wdt', 'rtc')), 72 | (0x0304, 'IPR1', cm0_nvic_ipr('eic', 'nvmctrl', 'evsys', 'sercom0')), 73 | (0x0308, 'IPR2', cm0_nvic_ipr('sercom1', 'sercom2', 'sercom3', 'sercom4')), 74 | (0x030c, 'IPR3', cm0_nvic_ipr('sercom5', 'tc0', 'tc1', 'tc2')), 75 | (0x0310, 'IPR4', cm0_nvic_ipr('tc3', 'tc4', 'tc5', 'tc6')), 76 | (0x0314, 'IPR5', cm0_nvic_ipr('tc7', 'adc', 'ac', 'dac')), 77 | (0x0318, 'IPR6', cm0_nvic_ipr('ptc', '', '', '')), 78 | ] 79 | 80 | -------------------------------------------------------------------------------- /headers/samd20/cm0_scb.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SCB' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CPUID', [ 35 | ('revision', 4), 36 | ('partno', 12), 37 | ('_1100', 4), 38 | ('variant', 4), 39 | ('implementer', 8), 40 | ]), 41 | (0x04, 'ICSR', [ 42 | ('vectactive', 9), 43 | ('', 3), 44 | ('vectpending', 9), 45 | ('', 1), 46 | ('isrpending', 1), 47 | ('isrpreempt', 1), 48 | ('', 1), 49 | ('pendstclr', 1), 50 | ('pendstset', 1), 51 | ('pendsvclr', 1), 52 | ('pendsvset', 1), 53 | ('', 2), 54 | ('nmipendset', 1), 55 | ]), 56 | (0x08, 'VTOR', [ 57 | ('', 7), 58 | ('tbloff', 25), 59 | ]), 60 | (0x0c, 'AIRCR', [ 61 | ('', 1), 62 | ('vectclractive', 1), 63 | ('sysresetreq', 1), 64 | ('', 12), 65 | ('endianness', 1), 66 | ('vectkey', 16), 67 | ]), 68 | (0x10, 'SCR', [ 69 | ('', 1), 70 | ('sleeponexit', 1), 71 | ('sleepdeep', 1), 72 | ('', 1), 73 | ('sevonpend', 1), 74 | ('', 27), 75 | ]), 76 | (0x14, 'CCR', [ 77 | ('', 3), 78 | ('unalign_trp', 1), 79 | ('', 5), 80 | ('stkalign', 1), 81 | ('', 22), 82 | ]), 83 | (0x1c, 'SHPR2', [ 84 | ('', 30), 85 | ('pri_11', 2), 86 | ]), 87 | (0x20, 'SHPR3', [ 88 | ('', 22), 89 | ('pri_14', 2), 90 | ('', 6), 91 | ('pri_15', 2), 92 | ]), 93 | (0x24, 'SHCSR', [ 94 | ('', 15), 95 | ('svcallpended', 1), 96 | ('', 16), 97 | ]), 98 | (0x30, 'DFSR', [ 99 | ('halted', 1), 100 | ('bkpt', 1), 101 | ('dwttrap', 1), 102 | ('vcatch', 1), 103 | ('external', 1), 104 | ('', 27), 105 | ]), 106 | ] 107 | 108 | -------------------------------------------------------------------------------- /headers/samd20/cm0_systick.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SYSTICK' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CSR', [ 35 | ('enable', 1), 36 | ('tickint', 1), 37 | ('clksource', 1), 38 | ('', 13), 39 | ('countflag', 1), 40 | ('', 15), 41 | ]), 42 | (0x04, 'RVR', [ 43 | ('reload', 24), 44 | ('', 8), 45 | ]), 46 | (0x08, 'CVR', [ 47 | ('current', 24), 48 | ('', 8), 49 | ]), 50 | (0x0c, 'CALIB', [ 51 | ('tenms', 24), 52 | ('', 6), 53 | ('skew', 1), 54 | ('noref', 1), 55 | ]), 56 | ] 57 | 58 | -------------------------------------------------------------------------------- /headers/samd20/dac.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'DAC' 31 | 32 | #------------------------------------------------------------------------------ 33 | dac_ints = [ 34 | ('underrun', 1), 35 | ('empty', 1), 36 | ('syncrdy', 1), 37 | ('', 5), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRLA', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('runstdby', 1), 46 | ('', 5), 47 | ]), 48 | (0x01, 'CTRLB', [ 49 | ('eoen', 1), 50 | ('ioen', 1), 51 | ('leftadj', 1), 52 | ('vpd', 1), 53 | ('', 2), 54 | ('refsel', 2, [ 55 | ('INT1V', 0), 56 | ('AVCC', 1), 57 | ('VREFP', 2), 58 | ]), 59 | ]), 60 | (0x02, 'EVCTRL', [ 61 | ('startei', 1), 62 | ('emptyeo', 1), 63 | ('', 6), 64 | ]), 65 | (0x04, 'INTENCLR', dac_ints), 66 | (0x05, 'INTENSET', dac_ints), 67 | (0x06, 'INTFLAG', dac_ints), 68 | (0x07, 'STATUS', [ 69 | ('', 7), 70 | ('syncbusy', 1), 71 | ]), 72 | (0x08, 'DATA', 16), 73 | (0x0c, 'DATABUF', 16), 74 | ] 75 | 76 | -------------------------------------------------------------------------------- /headers/samd20/dsu.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'DSU' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CTRL', [ 35 | ('swrst', 1), 36 | ('', 1), 37 | ('crc', 1), 38 | ('mbist', 1), 39 | ('ce', 1), 40 | ('', 3), 41 | ]), 42 | (0x01, 'STATUSA', [ 43 | ('done', 1), 44 | ('crstext', 1), 45 | ('berr', 1), 46 | ('fail', 1), 47 | ('perr', 1), 48 | ('', 3), 49 | ]), 50 | (0x02, 'STATUSB', [ 51 | ('prot', 1), 52 | ('dbgpres', 1), 53 | ('dccd0', 1), 54 | ('dccd1', 1), 55 | ('hpe', 1), 56 | ('', 3), 57 | ]), 58 | (0x04, 'ADDR', [ 59 | ('', 2), 60 | ('addr', 30), 61 | ]), 62 | (0x08, 'LENGTH', [ 63 | ('', 2), 64 | ('length', 30), 65 | ]), 66 | (0x0c, 'DATA'), 67 | [ 2, 4, 68 | (0x10, 'DCC'), 69 | ], 70 | (0x18, 'DID', [ 71 | ('devsel', 8, [ 72 | ('SAMD20J18A', 0x0), 73 | ('SAMD20J17A', 0x1), 74 | ('SAMD20J16A', 0x2), 75 | ('SAMD20J15A', 0x3), 76 | ('SAMD20J14A', 0x4), 77 | ('SAMD20G18A', 0x5), 78 | ('SAMD20G17A', 0x6), 79 | ('SAMD20G16A', 0x7), 80 | ('SAMD20G15A', 0x8), 81 | ('SAMD20G14A', 0x9), 82 | ('SAMD20E18A', 0xa), 83 | ('SAMD20E17A', 0xb), 84 | ('SAMD20E16A', 0xc), 85 | ('SAMD20E15A', 0xd), 86 | ('SAMD20E14A', 0xe), 87 | ]), 88 | ('revision', 4), 89 | ('die', 4), 90 | ('series', 6), 91 | ('', 1), 92 | ('family', 5), 93 | ('processor', 4), 94 | ]), 95 | [ 2, 4, 96 | (0x1000, 'ENTRY', [ 97 | ('epres', 1), 98 | ('fmt', 1), 99 | ('', 10), 100 | ('addoff', 20), 101 | ]), 102 | ], 103 | (0x1008, 'END'), 104 | (0x1fcc, 'MEMTYPE', [ 105 | ('smemp', 1), 106 | ('', 31), 107 | ]), 108 | (0x1fd0, 'PID4', [ 109 | ('jepcc', 4), 110 | ('fkbc', 4), 111 | ('', 24), 112 | ]), 113 | (0x1fe0, 'PID0', [ 114 | ('partnbl', 8), 115 | ('', 24), 116 | ]), 117 | (0x1fe4, 'PID1', [ 118 | ('partnbh', 4), 119 | ('jepidcl', 4), 120 | ('', 24), 121 | ]), 122 | (0x1fe8, 'PID2', [ 123 | ('jepidch', 3), 124 | ('jepu', 1), 125 | ('revision', 4), 126 | ('', 24), 127 | ]), 128 | (0x1fec, 'PID3', [ 129 | ('cusmod', 4), 130 | ('revand', 4), 131 | ('', 24), 132 | ]), 133 | (0x1ff0, 'CID0', [ 134 | ('preambleb0', 8), 135 | ('', 24), 136 | ]), 137 | (0x1ff4, 'CID1', [ 138 | ('preamble', 4), 139 | ('cclass', 4), 140 | ('', 24), 141 | ]), 142 | (0x1ff8, 'CID2', [ 143 | ('preambleb2', 8), 144 | ('', 24), 145 | ]), 146 | (0x1ffc, 'CID3', [ 147 | ('preambleb3', 8), 148 | ('', 24), 149 | ]), 150 | ] 151 | 152 | -------------------------------------------------------------------------------- /headers/samd20/eic.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'EIC' 31 | 32 | #------------------------------------------------------------------------------ 33 | eic_ints = [ 34 | ('extint', 16), 35 | ('', 16), 36 | ] 37 | 38 | eic_sense = [ 39 | ('NONE', 0), 40 | ('RISE', 1), 41 | ('FALL', 2), 42 | ('BOTH', 3), 43 | ('HIGH', 4), 44 | ('LOW', 5), 45 | ] 46 | 47 | #------------------------------------------------------------------------------ 48 | registers = [ 49 | (0x00, 'CTRL', [ 50 | ('swrst', 1), 51 | ('enable', 1), 52 | ('', 6), 53 | ]), 54 | (0x01, 'STATUS', [ 55 | ('', 7), 56 | ('syncbusy', 1), 57 | ]), 58 | (0x02, 'NMICTRL', [ 59 | ('nmisense', 3, eic_sense), 60 | ('nmifilten', 1), 61 | ('', 4), 62 | ]), 63 | (0x03, 'NMIFLAG', [ 64 | ('nmi', 1), 65 | ('', 7), 66 | ]), 67 | (0x04, 'EVCTRL', [ 68 | ('extinteo', 16), 69 | ('', 16), 70 | ]), 71 | (0x08, 'INTENCLR', eic_ints), 72 | (0x0c, 'INTENSET', eic_ints), 73 | (0x10, 'INTFLAG', eic_ints), 74 | (0x14, 'WAKEUP', [ 75 | ('wakeupen', 16), 76 | ('', 16), 77 | ]), 78 | [ 2, 4, 79 | (0x18, 'CONFIG', [ 80 | ('sense0', 3, ), 81 | ('filten0', 1), 82 | ('sense1', 3, eic_sense), 83 | ('filten1', 1), 84 | ('sense2', 3, eic_sense), 85 | ('filten2', 1), 86 | ('sense3', 3, eic_sense), 87 | ('filten3', 1), 88 | ('sense4', 3, eic_sense), 89 | ('filten4', 1), 90 | ('sense5', 3, eic_sense), 91 | ('filten5', 1), 92 | ('sense6', 3, eic_sense), 93 | ('filten6', 1), 94 | ('sense7', 3, eic_sense), 95 | ('filten7', 1), 96 | ]), 97 | ], 98 | ] 99 | 100 | -------------------------------------------------------------------------------- /headers/samd20/gclk.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'GCLK' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | (0x00, 'CTRL', [ 35 | ('swrst', 1), 36 | ('', 7), 37 | ]), 38 | (0x01, 'STATUS', [ 39 | ('', 7), 40 | ('syncbusy', 1), 41 | ]), 42 | (0x02, 'CLKCTRL', [ 43 | ('id', 6, [ 44 | ('DFLL48M', 0x00), 45 | ('WDT', 0x01), 46 | ('RTC', 0x02), 47 | ('EIC', 0x03), 48 | ('EVSYS_0', 0x04), 49 | ('EVSYS_1', 0x05), 50 | ('EVSYS_2', 0x06), 51 | ('EVSYS_3', 0x07), 52 | ('EVSYS_4', 0x08), 53 | ('EVSYS_5', 0x09), 54 | ('EVSYS_6', 0x0a), 55 | ('EVSYS_7', 0x0b), 56 | ('SERCOMX_SLOW', 0x0c), 57 | ('SERCOM0_CORE', 0x0d), 58 | ('SERCOM1_CORE', 0x0e), 59 | ('SERCOM2_CORE', 0x0f), 60 | ('SERCOM3_CORE', 0x10), 61 | ('SERCOM4_CORE', 0x11), 62 | ('SERCOM5_CORE', 0x12), 63 | ('TC0_TC1', 0x13), 64 | ('TC2_TC3', 0x14), 65 | ('TC4_TC5', 0x15), 66 | ('TC6_TC7', 0x16), 67 | ('ADC', 0x17), 68 | ('AC_DIG', 0x18), 69 | ('AC_ANA', 0x19), 70 | ('DAC', 0x1a), 71 | ('PTC', 0x1b), 72 | ]), 73 | ('', 2), 74 | ('gen', 4), 75 | ('', 2), 76 | ('clken', 1), 77 | ('wrtlock', 1), 78 | ]), 79 | (0x04, 'GENCTRL', [ 80 | ('id', 4), 81 | ('', 4), 82 | ('src', 5, [ 83 | ('XOSC', 0), 84 | ('GCLKIN', 1), 85 | ('GCLKGEN1', 2), 86 | ('OSCULP32K', 3), 87 | ('OSC32K', 4), 88 | ('XOSC32K', 5), 89 | ('OSC8M', 6), 90 | ('DFLL48M', 7), 91 | ]), 92 | ('', 3), 93 | ('genen', 1), 94 | ('idc', 1), 95 | ('oov', 1), 96 | ('oe', 1), 97 | ('divsel', 1), 98 | ('runstdby', 1), 99 | ('', 10), 100 | ]), 101 | (0x08, 'GENDIV', [ 102 | ('id', 4), 103 | ('', 4), 104 | ('div', 16), 105 | ('', 8), 106 | ]), 107 | ] 108 | 109 | -------------------------------------------------------------------------------- /headers/samd20/nvmctrl.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'NVMCTRL' 31 | 32 | 33 | #------------------------------------------------------------------------------ 34 | nvmctrl_ints = [ 35 | ('ready', 1), 36 | ('error', 1), 37 | ('', 6), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRLA', [ 43 | ('cmd', 7, [ 44 | ('ER', 0x2), 45 | ('WP', 0x4), 46 | ('EAR', 0x5), 47 | ('WAP', 0x6), 48 | ('LR', 0x40), 49 | ('UR', 0x41), 50 | ('SPRM', 0x42), 51 | ('CPRM', 0x43), 52 | ('PBC', 0x44), 53 | ('SSB', 0x45), 54 | ('INVALL', 0x46), 55 | ]), 56 | ('', 1), 57 | ('cmdex', 8, [ 58 | ('KEY', 0xa5), 59 | ]), 60 | ]), 61 | (0x04, 'CTRLB', [ 62 | ('', 1), 63 | ('rws', 4, [ 64 | ('SINGLE', 0), 65 | ('HALF', 1), 66 | ('DUAL', 2), 67 | ]), 68 | ('', 2), 69 | ('manw', 1), 70 | ('sleepprm', 2, [ 71 | ('WAKEONACCESS', 0), 72 | ('WAKEUPINSTANT', 1), 73 | ('DISABLED', 3), 74 | ]), 75 | ('', 6), 76 | ('readmode', 2, [ 77 | ('NO_MISS_PENALTY', 0), 78 | ('LOW_POWER', 1), 79 | ('DETERMINISTIC', 2), 80 | ]), 81 | ('cachedis', 1), 82 | ('', 13), 83 | ]), 84 | (0x08, 'PARAM', [ 85 | ('nvmp', 16), 86 | ('psz', 3, [ 87 | ('8', 0), 88 | ('16', 1), 89 | ('32', 2), 90 | ('64', 3), 91 | ('128', 4), 92 | ('256', 5), 93 | ('512', 6), 94 | ('1024', 7), 95 | ]), 96 | ('', 13), 97 | ]), 98 | (0x0c, 'INTENCLR', nvmctrl_ints), 99 | (0x10, 'INTENSET', nvmctrl_ints), 100 | (0x14, 'INTFLAG', nvmctrl_ints), 101 | (0x18, 'STATUS', [ 102 | ('prm', 1), 103 | ('load', 1), 104 | ('proge', 1), 105 | ('locke', 1), 106 | ('nvme', 1), 107 | ('', 3), 108 | ('sb', 1), 109 | ('', 7), 110 | ]), 111 | (0x1c, 'ADDR', [ 112 | ('addr', 22), 113 | ('', 10), 114 | ]), 115 | (0x20, 'LOCK', 16), 116 | ] 117 | 118 | -------------------------------------------------------------------------------- /headers/samd20/pac0.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PAC0' 31 | 32 | #------------------------------------------------------------------------------ 33 | pac0_bits = [ 34 | ('', 1), 35 | ('pm', 1), 36 | ('sysctrl', 1), 37 | ('gclk', 1), 38 | ('wdt', 1), 39 | ('rtc', 1), 40 | ('eic', 1), 41 | ('', 25), 42 | ] 43 | 44 | #------------------------------------------------------------------------------ 45 | registers = [ 46 | (0x00, 'WPCLR', pac0_bits), 47 | (0x04, 'WPSET', pac0_bits), 48 | ] 49 | 50 | -------------------------------------------------------------------------------- /headers/samd20/pac1.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PAC1' 31 | 32 | #------------------------------------------------------------------------------ 33 | pac1_bits = [ 34 | ('', 1), 35 | ('dsu', 1), 36 | ('nvmctrl', 1), 37 | ('port', 1), 38 | ('', 28), 39 | ] 40 | 41 | #------------------------------------------------------------------------------ 42 | registers = [ 43 | (0x00, 'WPCLR', pac1_bits), 44 | (0x04, 'WPSET', pac1_bits), 45 | ] 46 | 47 | -------------------------------------------------------------------------------- /headers/samd20/pac2.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PAC2' 31 | 32 | #------------------------------------------------------------------------------ 33 | pac2_bits = [ 34 | ('', 1), 35 | ('evsys', 1), 36 | ('sercom0', 1), 37 | ('sercom1', 1), 38 | ('sercom2', 1), 39 | ('sercom3', 1), 40 | ('sercom4', 1), 41 | ('sercom5', 1), 42 | ('tc0', 1), 43 | ('tc1', 1), 44 | ('tc2', 1), 45 | ('tc3', 1), 46 | ('tc4', 1), 47 | ('tc5', 1), 48 | ('tc6', 1), 49 | ('tc7', 1), 50 | ('adc', 1), 51 | ('ac', 1), 52 | ('dac', 1), 53 | ('ptc', 1), 54 | ('', 12), 55 | ] 56 | 57 | #------------------------------------------------------------------------------ 58 | registers = [ 59 | (0x00, 'WPCLR', pac2_bits), 60 | (0x04, 'WPSET', pac2_bits), 61 | ] 62 | 63 | -------------------------------------------------------------------------------- /headers/samd20/pm.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PM' 31 | 32 | #------------------------------------------------------------------------------ 33 | pm_div = [ 34 | ('1', 0), 35 | ('2', 1), 36 | ('4', 2), 37 | ('8', 3), 38 | ('16', 4), 39 | ('32', 5), 40 | ('64', 6), 41 | ('128', 7), 42 | ] 43 | 44 | pm_ints = [ 45 | ('ckrdy', 1), 46 | ('cfd', 1), 47 | ('', 6), 48 | ] 49 | 50 | #------------------------------------------------------------------------------ 51 | registers = [ 52 | (0x00, 'CTRL', [ 53 | ('', 2), 54 | ('cfden', 1), 55 | ('', 1), 56 | ('bkupclk', 1), 57 | ('', 3), 58 | ]), 59 | (0x01, 'SLEEP', [ 60 | ('idle', 2), 61 | ('', 6), 62 | ]), 63 | (0x08, 'CPUSEL', [ 64 | ('cpudiv', 3, pm_div), 65 | ('', 5), 66 | ]), 67 | (0x09, 'APBASEL', [ 68 | ('apbadiv', 3, pm_div), 69 | ('', 5), 70 | ]), 71 | (0x0a, 'APBBSEL', [ 72 | ('apbbdiv', 3, pm_div), 73 | ('', 5), 74 | ]), 75 | (0x0b, 'APBCSEL', [ 76 | ('apbcdiv', 3, pm_div), 77 | ('', 5), 78 | ]), 79 | (0x14, 'AHBMASK', [ 80 | ('hpb0', 1), 81 | ('hpb1', 1), 82 | ('hpb2', 1), 83 | ('dsu', 1), 84 | ('nvmctrl', 1), 85 | ('', 27), 86 | ]), 87 | (0x18, 'APBAMASK', [ 88 | ('pac0', 1), 89 | ('pm', 1), 90 | ('sysctrl', 1), 91 | ('gclk', 1), 92 | ('wdt', 1), 93 | ('rtc', 1), 94 | ('eic', 1), 95 | ('', 25), 96 | ]), 97 | (0x1c, 'APBBMASK', [ 98 | ('pac1', 1), 99 | ('dsu', 1), 100 | ('nvmctrl', 1), 101 | ('port', 1), 102 | ('', 28), 103 | ]), 104 | (0x20, 'APBCMASK', [ 105 | ('pac2', 1), 106 | ('evsys', 1), 107 | ('sercom0', 1), 108 | ('sercom1', 1), 109 | ('sercom2', 1), 110 | ('sercom3', 1), 111 | ('sercom4', 1), 112 | ('sercom5', 1), 113 | ('tc0', 1), 114 | ('tc1', 1), 115 | ('tc2', 1), 116 | ('tc3', 1), 117 | ('tc4', 1), 118 | ('tc5', 1), 119 | ('tc6', 1), 120 | ('tc7', 1), 121 | ('adc', 1), 122 | ('ac', 1), 123 | ('dac', 1), 124 | ('ptc', 1), 125 | ('', 12), 126 | ]), 127 | (0x34, 'INTENCLR', pm_ints), 128 | (0x35, 'INTENSET', pm_ints), 129 | (0x36, 'INTFLAG', pm_ints), 130 | (0x38, 'RCAUSE', [ 131 | ('por', 1), 132 | ('bod12', 1), 133 | ('bod33', 1), 134 | ('', 1), 135 | ('ext', 1), 136 | ('wdt', 1), 137 | ('syst', 1), 138 | ('', 1), 139 | ]), 140 | ] 141 | 142 | -------------------------------------------------------------------------------- /headers/samd20/port.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PORT' 31 | 32 | #------------------------------------------------------------------------------ 33 | port_bits = [('p%d' % i, 1) for i in range(32)] 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = [ 37 | (0x00, 'DIR', port_bits), 38 | (0x04, 'DIRCLR', port_bits), 39 | (0x08, 'DIRSET', port_bits), 40 | (0x0c, 'DIRTGL', port_bits), 41 | (0x10, 'OUT', port_bits), 42 | (0x14, 'OUTCLR', port_bits), 43 | (0x18, 'OUTSET', port_bits), 44 | (0x1c, 'OUTTGL', port_bits), 45 | (0x20, 'IN', port_bits), 46 | (0x24, 'CTRL', port_bits), 47 | (0x28, 'WRCONFIG', [ 48 | ('pinmask', 16), 49 | ('pmuxen', 1), 50 | ('inen', 1), 51 | ('pullen', 1), 52 | ('', 3), 53 | ('drvstr', 1), 54 | ('', 1), 55 | ('pmux', 4), 56 | ('wrpmux', 1), 57 | ('', 1), 58 | ('wrpincfg', 1), 59 | ('hwsel', 1), 60 | ]), 61 | [ 16, 1, 62 | (0x30, 'PMUX', [ 63 | ('pmuxe', 4), 64 | ('pmuxo', 4), 65 | ]), 66 | ], 67 | [ 32, 1, 68 | (0x40, 'PINCFG', [ 69 | ('pmuxen', 1), 70 | ('inen', 1), 71 | ('pullen', 1), 72 | ('', 3), 73 | ('drvstr', 1), 74 | ('', 1), 75 | ]), 76 | ], 77 | ] 78 | 79 | -------------------------------------------------------------------------------- /headers/samd20/ptc.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'PTC' 31 | 32 | #------------------------------------------------------------------------------ 33 | registers = [ 34 | # Not described in the datasheet 35 | ] 36 | 37 | -------------------------------------------------------------------------------- /headers/samd20/rtc_m0.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'RTC_M0' 31 | 32 | #------------------------------------------------------------------------------ 33 | rtc_m0_ints = [ 34 | ('cmp0', 1), 35 | ('', 5), 36 | ('syncrdy', 1), 37 | ('ovf', 1), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRL', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('mode', 2, [ 46 | ('COUNT32', 0), 47 | ('COUNT16', 1), 48 | ('CLOCK', 2), 49 | ]), 50 | ('', 3), 51 | ('matchclr', 1), 52 | ('prescaler', 4, [ 53 | ('1', 0x0), 54 | ('2', 0x1), 55 | ('4', 0x2), 56 | ('8', 0x3), 57 | ('16', 0x4), 58 | ('32', 0x5), 59 | ('64', 0x6), 60 | ('128', 0x7), 61 | ('256', 0x8), 62 | ('512', 0x9), 63 | ('1024', 0xa), 64 | ]), 65 | ('', 4), 66 | ]), 67 | (0x02, 'READREQ', [ 68 | ('addr', 6), 69 | ('', 8), 70 | ('rcont', 1), 71 | ('rreq', 1), 72 | ]), 73 | (0x04, 'EVCTRL', [ 74 | ('pereo0', 1), 75 | ('pereo1', 1), 76 | ('pereo2', 1), 77 | ('pereo3', 1), 78 | ('pereo4', 1), 79 | ('pereo5', 1), 80 | ('pereo6', 1), 81 | ('pereo7', 1), 82 | ('cmpeo0', 1), 83 | ('', 6), 84 | ('ovfeo', 1), 85 | ]), 86 | (0x06, 'INTENCLR', rtc_m0_ints), 87 | (0x07, 'INTENSET', rtc_m0_ints), 88 | (0x08, 'INTFLAG', rtc_m0_ints), 89 | (0x0a, 'STATUS', [ 90 | ('', 7), 91 | ('syncbusy', 1), 92 | ]), 93 | (0x0b, 'DBGCTRL', [ 94 | ('dbgrun', 1), 95 | ('', 7), 96 | ]), 97 | (0x0c, 'FREQCORR', [ 98 | ('value', 7), 99 | ('sign', 1), 100 | ]), 101 | (0x10, 'COUNT'), 102 | [ 4, 4, 103 | (0x18, 'COMP'), 104 | ], 105 | ] 106 | 107 | -------------------------------------------------------------------------------- /headers/samd20/rtc_m1.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'RTC_M1' 31 | 32 | #------------------------------------------------------------------------------ 33 | rtc_m1_ints = [ 34 | ('cmp0', 1), 35 | ('cmp1', 1), 36 | ('', 4), 37 | ('syncrdy', 1), 38 | ('ovf', 1), 39 | ] 40 | 41 | #------------------------------------------------------------------------------ 42 | registers = [ 43 | (0x00, 'CTRL', [ 44 | ('swrst', 1), 45 | ('enable', 1), 46 | ('mode', 2, [ 47 | ('COUNT32', 0), 48 | ('COUNT16', 1), 49 | ('CLOCK', 2), 50 | ]), 51 | ('', 4), 52 | ('prescaler', 4, [ 53 | ('1', 0x0), 54 | ('2', 0x1), 55 | ('4', 0x2), 56 | ('8', 0x3), 57 | ('16', 0x4), 58 | ('32', 0x5), 59 | ('64', 0x6), 60 | ('128', 0x7), 61 | ('256', 0x8), 62 | ('512', 0x9), 63 | ('1024', 0xa), 64 | ]), 65 | ('', 4), 66 | ]), 67 | (0x02, 'READREQ', [ 68 | ('addr', 6), 69 | ('', 8), 70 | ('rcont', 1), 71 | ('rreq', 1), 72 | ]), 73 | (0x04, 'EVCTRL', [ 74 | ('pereo0', 1), 75 | ('pereo1', 1), 76 | ('pereo2', 1), 77 | ('pereo3', 1), 78 | ('pereo4', 1), 79 | ('pereo5', 1), 80 | ('pereo6', 1), 81 | ('pereo7', 1), 82 | ('cmpeo0', 1), 83 | ('cmpeo1', 1), 84 | ('', 5), 85 | ('ovfeo', 1), 86 | ]), 87 | (0x06, 'INTENCLR', rtc_m1_ints), 88 | (0x07, 'INTENSET', rtc_m1_ints), 89 | (0x08, 'INTFLAG', rtc_m1_ints), 90 | (0x0a, 'STATUS', [ 91 | ('', 7), 92 | ('syncbusy', 1), 93 | ]), 94 | (0x0b, 'DBGCTRL', [ 95 | ('dbgrun', 1), 96 | ('', 7), 97 | ]), 98 | (0x0c, 'FREQCORR', [ 99 | ('value', 7), 100 | ('sign', 1), 101 | ]), 102 | (0x10, 'COUNT', 16), 103 | (0x14, 'PER', 16), 104 | [ 6, 2, 105 | (0x18, 'COMP', 16), 106 | ], 107 | ] 108 | 109 | -------------------------------------------------------------------------------- /headers/samd20/rtc_m2.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'RTC_M2' 31 | 32 | #------------------------------------------------------------------------------ 33 | rtc_m2_ints = [ 34 | ('alarm0', 1), 35 | ('', 5), 36 | ('syncrdy', 1), 37 | ('ovf', 1), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRL', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('mode', 2, [ 46 | ('COUNT32', 0), 47 | ('COUNT16', 1), 48 | ('CLOCK', 2), 49 | ]), 50 | ('', 2), 51 | ('clkrep', 1), 52 | ('matchclr', 1), 53 | ('prescaler', 4, [ 54 | ('1', 0x0), 55 | ('2', 0x1), 56 | ('4', 0x2), 57 | ('8', 0x3), 58 | ('16', 0x4), 59 | ('32', 0x5), 60 | ('64', 0x6), 61 | ('128', 0x7), 62 | ('256', 0x8), 63 | ('512', 0x9), 64 | ('1024', 0xa), 65 | ]), 66 | ('', 4), 67 | ]), 68 | (0x02, 'READREQ', [ 69 | ('addr', 6), 70 | ('', 8), 71 | ('rcont', 1), 72 | ('rreq', 1), 73 | ]), 74 | (0x04, 'EVCTRL', [ 75 | ('pereo0', 1), 76 | ('pereo1', 1), 77 | ('pereo2', 1), 78 | ('pereo3', 1), 79 | ('pereo4', 1), 80 | ('pereo5', 1), 81 | ('pereo6', 1), 82 | ('pereo7', 1), 83 | ('alarmeo0', 1), 84 | ('', 6), 85 | ('ovfeo', 1), 86 | ]), 87 | (0x06, 'INTENCLR', rtc_m2_ints), 88 | (0x07, 'INTENSET', rtc_m2_ints), 89 | (0x08, 'INTFLAG', rtc_m2_ints), 90 | (0x0a, 'STATUS', [ 91 | ('', 7), 92 | ('syncbusy', 1), 93 | ]), 94 | (0x0b, 'DBGCTRL', [ 95 | ('dbgrun', 1), 96 | ('', 7), 97 | ]), 98 | (0x0c, 'FREQCORR', [ 99 | ('value', 7), 100 | ('sign', 1), 101 | ]), 102 | (0x10, 'CLOCK', [ 103 | ('second', 6), 104 | ('minute', 6), 105 | ('hour', 5), 106 | ('day', 5), 107 | ('month', 4), 108 | ('year', 6), 109 | ]), 110 | [ 4, 8, 111 | (0x18, 'ALARM', [ 112 | ('second', 6), 113 | ('minute', 6), 114 | ('hour', 5), 115 | ('day', 5), 116 | ('month', 4), 117 | ('year', 6), 118 | ]), 119 | (0x1c, 'MASK', [ 120 | ('sel', 3, [ 121 | ('OFF', 0), 122 | ('SS', 1), 123 | ('MMSS', 2), 124 | ('HHMMSS', 3), 125 | ('DDHHMMSS', 4), 126 | ('MMDDHHMMSS', 5), 127 | ('YYMMDDHHMMSS', 6), 128 | ]), 129 | ('', 5), 130 | ]), 131 | ], 132 | ] 133 | 134 | -------------------------------------------------------------------------------- /headers/samd20/sc_i2cm.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SC_I2CM' 31 | 32 | #------------------------------------------------------------------------------ 33 | sc_i2cm_ints = [ 34 | ('mb', 1), 35 | ('sb', 1), 36 | ('', 6), 37 | ] 38 | 39 | #------------------------------------------------------------------------------ 40 | registers = [ 41 | (0x00, 'CTRLA', [ 42 | ('swrst', 1), 43 | ('enable', 1), 44 | ('mode', 3, [ 45 | ('I2C_MASTER', 5), 46 | ]), 47 | ('', 2), 48 | ('runstdby', 1), 49 | ('', 8), 50 | ('pinout', 1), 51 | ('', 3), 52 | ('sdahold', 2, [ 53 | ('DIS', 0), 54 | ('75_NS', 1), 55 | ('450_NS', 2), 56 | ('600_NS', 3), 57 | ]), 58 | ('', 6), 59 | ('inactout', 2, [ 60 | ('DIS', 0), 61 | ('55_US', 1), 62 | ('105_US', 2), 63 | ('205_US', 3), 64 | ]), 65 | ('lowtout', 1), 66 | ('', 1), 67 | ]), 68 | (0x04, 'CTRLB', [ 69 | ('', 8), 70 | ('smen', 1), 71 | ('qcen', 1), 72 | ('', 6), 73 | ('cmd', 2), 74 | ('ackact', 1), 75 | ('', 13), 76 | ]), 77 | (0x08, 'DBGCTRL', [ 78 | ('dbgstop', 1), 79 | ('', 7), 80 | ]), 81 | (0x0a, 'BAUD', [ 82 | ('baud', 8), 83 | ('baudlow', 8), 84 | ]), 85 | (0x0c, 'INTENCLR', sc_i2cm_ints), 86 | (0x0d, 'INTENSET', sc_i2cm_ints), 87 | (0x0e, 'INTFLAG', sc_i2cm_ints), 88 | (0x10, 'STATUS', [ 89 | ('buserr', 1), 90 | ('arblost', 1), 91 | ('rxnack', 1), 92 | ('', 1), 93 | ('busstate', 2, [ 94 | ('UNKNOWN', 0), 95 | ('IDLE', 1), 96 | ('OWNER', 2), 97 | ('BUSY', 3), 98 | ]), 99 | ('lowtout', 1), 100 | ('clkhold', 1), 101 | ('', 7), 102 | ('syncbusy', 1), 103 | ]), 104 | (0x14, 'ADDR', 8), 105 | (0x18, 'DATA', 8), 106 | ] 107 | 108 | -------------------------------------------------------------------------------- /headers/samd20/sc_i2cs.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SC_I2CS' 31 | 32 | #------------------------------------------------------------------------------ 33 | sc_i2cs_ints = [ 34 | ('prec', 1), 35 | ('amatch', 1), 36 | ('drdy', 1), 37 | ('', 5), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRLA', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('mode', 3, [ 46 | ('I2C_SLAVE', 4), 47 | ]), 48 | ('', 2), 49 | ('runstdby', 1), 50 | ('', 8), 51 | ('pinout', 1), 52 | ('', 3), 53 | ('sdahold', 2, [ 54 | ('DIS', 0), 55 | ('75_NS', 1), 56 | ('450_NS', 2), 57 | ('600_NS', 3), 58 | ]), 59 | ('', 8), 60 | ('lowtout', 1), 61 | ('', 1), 62 | ]), 63 | (0x04, 'CTRLB', [ 64 | ('', 8), 65 | ('smen', 1), 66 | ('', 5), 67 | ('amode', 2, [ 68 | ('MASK', 0), 69 | ('2_ADDRS', 1), 70 | ('RANGE', 2), 71 | ]), 72 | ('cmd', 2), 73 | ('ackact', 1), 74 | ('', 13), 75 | ]), 76 | (0x0c, 'INTENCLR', sc_i2cs_ints), 77 | (0x0d, 'INTENSET', sc_i2cs_ints), 78 | (0x0e, 'INTFLAG', sc_i2cs_ints), 79 | (0x10, 'STATUS', [ 80 | ('buserr', 1), 81 | ('coll', 1), 82 | ('rxnack', 1), 83 | ('dir', 1), 84 | ('sr', 1), 85 | ('', 1), 86 | ('lowtout', 1), 87 | ('clkhold', 1), 88 | ('', 7), 89 | ('syncbusy', 1), 90 | ]), 91 | (0x14, 'ADDR', [ 92 | ('gencen', 1), 93 | ('addr', 7), 94 | ('', 9), 95 | ('addrmask', 7), 96 | ('', 8), 97 | ]), 98 | (0x18, 'DATA', 8), 99 | ] 100 | 101 | -------------------------------------------------------------------------------- /headers/samd20/sc_spi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SC_SPI' 31 | 32 | #------------------------------------------------------------------------------ 33 | sc_spi_ints = [ 34 | ('dre', 1), 35 | ('txc', 1), 36 | ('rxc', 1), 37 | ('', 5), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRLA', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('mode', 3, [ 46 | ('SPI_SLAVE', 2), 47 | ('SPI_MASTER', 3), 48 | ]), 49 | ('', 2), 50 | ('runstdby', 1), 51 | ('', 8), 52 | ('dopo', 1), 53 | ('', 3), 54 | ('dipo', 2), 55 | ('', 2), 56 | ('form', 4, [ 57 | ('SPI', 0), 58 | ('SPI_ADDR', 2), 59 | ]), 60 | ('cpha', 1), 61 | ('cpol', 1), 62 | ('dord', 1, [ 63 | ('MSB_FIRST', 0), 64 | ('LSB_FIRST', 1), 65 | ]), 66 | ('', 1), 67 | ]), 68 | (0x04, 'CTRLB', [ 69 | ('chsize', 3, [ 70 | ('8_BITS', 0), 71 | ('9_BITS', 1), 72 | ]), 73 | ('', 3), 74 | ('ploaden', 1), 75 | ('', 7), 76 | ('amode', 2, [ 77 | ('MASK', 0), 78 | ('2_ADDRS', 1), 79 | ('RANGE', 2), 80 | ]), 81 | ('', 1), 82 | ('rxen', 1), 83 | ('', 14), 84 | ]), 85 | (0x08, 'DBGCTRL', [ 86 | ('dbgstop', 1), 87 | ('', 7), 88 | ]), 89 | (0x0a, 'BAUD', 8), 90 | (0x0c, 'INTENCLR', sc_spi_ints), 91 | (0x0d, 'INTENSET', sc_spi_ints), 92 | (0x0e, 'INTFLAG', sc_spi_ints), 93 | (0x10, 'STATUS', [ 94 | ('', 2), 95 | ('bufovf', 1), 96 | ('', 12), 97 | ('syncbusy', 1), 98 | ]), 99 | (0x14, 'ADDR', [ 100 | ('addr', 8), 101 | ('', 8), 102 | ('addrmask', 8), 103 | ('', 8), 104 | ]), 105 | (0x18, 'DATA', [ 106 | ('data', 9), 107 | ('', 7), 108 | ]), 109 | ] 110 | 111 | -------------------------------------------------------------------------------- /headers/samd20/sc_usart.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'SC_USART' 31 | 32 | #------------------------------------------------------------------------------ 33 | sc_usart_ints = [ 34 | ('dre', 1), 35 | ('txc', 1), 36 | ('rxc', 1), 37 | ('rxs', 1), 38 | ('', 4), 39 | ] 40 | 41 | #------------------------------------------------------------------------------ 42 | registers = [ 43 | (0x00, 'CTRLA', [ 44 | ('swrst', 1), 45 | ('enable', 1), 46 | ('mode', 3, [ 47 | ('USART_EXT_CLK', 0), 48 | ('USART_INT_CLK', 1), 49 | ]), 50 | ('', 2), 51 | ('runstdby', 1), 52 | ('', 8), 53 | ('txpo', 1), 54 | ('', 3), 55 | ('rxpo', 2), 56 | ('', 2), 57 | ('form', 4, [ 58 | ('NO_PARITY', 0), 59 | ('PARITY', 1), 60 | ]), 61 | ('cmode', 1, [ 62 | ('ASYNC', 0), 63 | ('SYNC', 1), 64 | ]), 65 | ('cpol', 1), 66 | ('dord', 1, [ 67 | ('MSB_FIRST', 0), 68 | ('LSB_FIRST', 1), 69 | ]), 70 | ('', 1), 71 | ]), 72 | (0x04, 'CTRLB', [ 73 | ('chsize', 3, [ 74 | ('8_BITS', 0), 75 | ('9_BITS', 1), 76 | ('5_BITS', 5), 77 | ('6_BITS', 6), 78 | ('7_BITS', 7), 79 | ]), 80 | ('', 3), 81 | ('sbmode', 1, [ 82 | ('ONE_STOP_BIT', 0), 83 | ('TWO_STOP_BITS', 1), 84 | ]), 85 | ('', 2), 86 | ('sfde', 1), 87 | ('', 3), 88 | ('pmode', 1), 89 | ('', 2), 90 | ('txen', 1), 91 | ('rxen', 1), 92 | ('', 14), 93 | ]), 94 | (0x08, 'DBGCTRL', [ 95 | ('dbgstop', 1), 96 | ('', 7), 97 | ]), 98 | (0x0a, 'BAUD', 16), 99 | (0x0c, 'INTENCLR', sc_usart_ints), 100 | (0x0d, 'INTENSET', sc_usart_ints), 101 | (0x0e, 'INTFLAG', sc_usart_ints), 102 | (0x10, 'STATUS', [ 103 | ('perr', 1), 104 | ('ferr', 1), 105 | ('bufovf', 1), 106 | ('', 12), 107 | ('syncbusy', 1), 108 | ]), 109 | (0x18, 'DATA', [ 110 | ('data', 9), 111 | ('', 7), 112 | ]), 113 | ] 114 | 115 | -------------------------------------------------------------------------------- /headers/samd20/tc_16.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import tc_common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'TC_16' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = tc_common.registers + [ 37 | (0x10, 'COUNT', 16), 38 | [ 4, 2, 39 | (0x18, 'CC', 16), 40 | ], 41 | ] 42 | 43 | -------------------------------------------------------------------------------- /headers/samd20/tc_32.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import tc_common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'TC_32' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = tc_common.registers + [ 37 | (0x10, 'COUNT'), 38 | [ 4, 4, 39 | (0x18, 'CC'), 40 | ], 41 | ] 42 | 43 | -------------------------------------------------------------------------------- /headers/samd20/tc_8.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | import tc_common 31 | 32 | #------------------------------------------------------------------------------ 33 | name = 'TC_8' 34 | 35 | #------------------------------------------------------------------------------ 36 | registers = tc_common.registers + [ 37 | (0x10, 'COUNT', 8), 38 | (0x14, 'PER', 8), 39 | [ 4, 1, 40 | (0x18, 'CC', 8), 41 | ], 42 | ] 43 | 44 | -------------------------------------------------------------------------------- /headers/samd20/tc_common.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | tc_ints = [ 31 | ('ovf', 1), 32 | ('err', 1), 33 | ('', 1), 34 | ('syncrdy', 1), 35 | ('mc0', 1), 36 | ('mc1', 1), 37 | ('', 2), 38 | ] 39 | 40 | #------------------------------------------------------------------------------ 41 | registers = [ 42 | (0x00, 'CTRLA', [ 43 | ('swrst', 1), 44 | ('enable', 1), 45 | ('mode', 2, [ 46 | ('COUNT16', 0), 47 | ('COUNT8', 1), 48 | ('COUNT32', 2), 49 | ]), 50 | ('', 1), 51 | ('wavegen', 2, [ 52 | ('NFRQ', 0), 53 | ('MFRQ', 1), 54 | ('NPWM', 2), 55 | ('MPWM', 3), 56 | ]), 57 | ('', 1), 58 | ('prescaler', 3, [ 59 | ('1', 0), 60 | ('2', 1), 61 | ('4', 2), 62 | ('8', 3), 63 | ('16', 4), 64 | ('64', 5), 65 | ('256', 6), 66 | ('1024 ', 7), 67 | ]), 68 | ('runstdby', 1), 69 | ('prescsync', 2, [ 70 | ('GCLK', 0), 71 | ('PRESC', 1), 72 | ('RESYNC', 2), 73 | ]), 74 | ('', 2), 75 | ]), 76 | (0x02, 'READREQ', [ 77 | ('addr', 5), 78 | ('', 9), 79 | ('rcont', 1), 80 | ('rreq', 1), 81 | ]), 82 | (0x04, 'CTRLBCLR', [ 83 | ('dir', 1), 84 | ('', 1), 85 | ('oneshot', 1), 86 | ('', 3), 87 | ('cmd', 2, [ 88 | ('NONE', 0), 89 | ('RETRIGGER', 1), 90 | ('STOP', 2), 91 | ]), 92 | ]), 93 | (0x05, 'CTRLBSET', [ 94 | ('dir', 1), 95 | ('', 1), 96 | ('oneshot', 1), 97 | ('', 3), 98 | ('cmd', 2, [ 99 | ('NONE', 0), 100 | ('RETRIGGER', 1), 101 | ('STOP', 2), 102 | ]), 103 | ]), 104 | (0x06, 'CTRLC', [ 105 | ('inven0', 1), 106 | ('inven1', 1), 107 | ('', 2), 108 | ('cpten0', 1), 109 | ('cpten1', 1), 110 | ('', 2), 111 | ]), 112 | (0x08, 'DBGCTRL', [ 113 | ('dbgrun', 1), 114 | ('', 7), 115 | ]), 116 | (0x0a, 'EVCTRL', [ 117 | ('evact', 3, [ 118 | ('OFF', 0), 119 | ('RETRIGGER', 1), 120 | ('COUNT', 2), 121 | ('START', 3), 122 | ('PPW', 5), 123 | ('PWP', 6), 124 | ]), 125 | ('', 1), 126 | ('tcinv', 1), 127 | ('tcei', 1), 128 | ('', 2), 129 | ('ovfeo', 1), 130 | ('', 3), 131 | ('mceo0', 1), 132 | ('mceo1', 1), 133 | ('', 2), 134 | ]), 135 | (0x0c, 'INTENCLR', tc_ints), 136 | (0x0d, 'INTENSET', tc_ints), 137 | (0x0e, 'INTFLAG', tc_ints), 138 | (0x0f, 'STATUS', [ 139 | ('', 3), 140 | ('stop', 1), 141 | ('slave', 1), 142 | ('', 2), 143 | ('syncbusy', 1), 144 | ]), 145 | ] 146 | 147 | -------------------------------------------------------------------------------- /headers/samd20/wdt.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, Alex Taradov 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | #------------------------------------------------------------------------------ 30 | name = 'WDT' 31 | 32 | #------------------------------------------------------------------------------ 33 | wdt_timing = [ 34 | ('8', 0x0), 35 | ('16', 0x1), 36 | ('32', 0x2), 37 | ('64', 0x3), 38 | ('128', 0x4), 39 | ('256', 0x5), 40 | ('512', 0x6), 41 | ('1024', 0x7), 42 | ('2048', 0x8), 43 | ('4096', 0x9), 44 | ('8192', 0xa), 45 | ('16384', 0xb), 46 | ] 47 | 48 | wdt_ints = [ 49 | ('ew', 1), 50 | ('', 7), 51 | ] 52 | 53 | #------------------------------------------------------------------------------ 54 | registers = [ 55 | (0x00, 'CTRL', [ 56 | ('', 1), 57 | ('enable', 1), 58 | ('wen', 1), 59 | ('', 4), 60 | ('alwayson', 1), 61 | ]), 62 | (0x01, 'CONFIG', [ 63 | ('per', 4, wdt_timing), 64 | ('window', 4, wdt_timing), 65 | ]), 66 | (0x02, 'EWCTRL', [ 67 | ('ewoffset', 4, wdt_timing), 68 | ('', 4), 69 | ]), 70 | (0x04, 'INTENCLR', wdt_ints), 71 | (0x05, 'INTENSET', wdt_ints), 72 | (0x06, 'INTFLAG', wdt_ints), 73 | (0x07, 'STATUS', [ 74 | ('', 7), 75 | ('syncbusy', 1), 76 | ]), 77 | (0x08, 'CLEAR', [ 78 | ('clear', 8, [ 79 | ('KEY', 0xa5), 80 | ]), 81 | ]), 82 | ] 83 | 84 | -------------------------------------------------------------------------------- /snprintf/Makefile: -------------------------------------------------------------------------------- 1 | all: p_vsnprintf.c 2 | gcc -W -Wall -O3 --std=gnu11 -DENABLE_TESTS p_vsnprintf.c -o p_vsnprintf 3 | 4 | clean: 5 | -rm -rf p_vsnprintf 6 | 7 | --------------------------------------------------------------------------------