Fixed GoodFETSPI by adding optional third argument to peek8().
[goodfet] / client / GoodFETAT91SAM7S.py
1 from GoodFETARM7 import *
2 """
3 This is the ARM7 series of microcontrollers from Atmel, including:
4 * AT91SAM7S512
5 * AT91SAM7S256
6 * AT91SAM7S128
7 * AT91SAM7S64
8 * AT91SAM7S321
9 * AT91SAM7S32
10 * AT91SAM7S161
11 * AT91SAM7S16
12
13
14 SAM-BA boot-assistant can be used (not through this module) by setting PA0, PA1, and PA2 high for at least 10 seconds followed by a power cycle.  SAM-BA supports reprogramming through the DBGU port or USB port.
15
16 The System Controller peripherals are all mapped to the highest 4 Kbytes of address space,
17 between addresses 0xFFFF F000 and 0xFFFF FFFF.
18
19 """
20
21 FLASH_BASE =    0x100000
22 TCx_BASE =      0xfffa0000      # Timer/Counter
23 UDP_BASE =      0xfffb0000      # USB Device Port
24 TWI_BASE =      0xfffb8000      # Two-Wire-Interface Controller
25 USART0_BASE =   0xfffc0000      # Universal Syncronous/Asyncronous Receiver/Transmitter 0
26 USART1_BASE =   0xfffc4000      # Universal Syncronous/Asyncronous Receiver/Transmitter 1
27 PWMC_BASE =     0xfffcc000      # PWM Controller
28 SSC_BASE =      0xfffd4000      # Syncronous Serial Controller
29 ADC_BASE =      0xfffd8000      # Analog-Digital Converter
30 SPI_BASE =      0xfffe0000      # Serial Peripheral Interface
31 SYSC_BASE =     0xfffff000      # System
32 AIC_BASE =      SYSC_BASE       # Advanced Interrupt Controller
33 DBGU_BASE =     0xfffff200      # Debug unit
34 PIOA_BASE =     0xfffff400      # Programmable IO
35 PMC_BASE =      0xfffffc00      # Power Management Controller
36 RSTC_BASE =     0xfffffd00      # Reset Controller
37 RTT_BASE =      0xfffffd20      # Real-Time Timer
38 PIT_BASE =      0xfffffd30      # Periodic Interval Timer
39 WDT_BASE =      0xfffffd40      # Watchdog Timer
40 VREG_BASE =     0xfffffd60      # Voltage Regulator
41 MC_BASE =       0xffffff00      # Memory Controller
42
43 PERIPHERAL_BASE=0xf0000000
44 PERIPH0_BASE =  0xf0004000
45 PERIPH1_BASE =  0xf0008000
46 # etc...
47
48
49 class GoodFETAT91SAM7S(GoodFETARM):
50     def getChipID(self):
51         chipid = self.ARMreadMem(SF_CIDR,1)
52         return chipid[0]
53
54     def FFPI_Read(self):
55         raise Exception("Not implemented yet...")
56     def FFPI_PageProgram(self):
57         raise Exception("Not implemented yet...")
58     def FFPI_PageErase(self):
59         raise Exception("Not implemented yet...")
60     def FFPI_FullErase(self):
61         raise Exception("Not implemented yet...")
62     def FFPI_Lock(self):
63         raise Exception("Not implemented yet...")
64     def FFPI_Unlock(self):
65         raise Exception("Not implemented yet...")
66     def FFPI_Protect(self):
67         raise Exception("Not implemented yet...")
68
69 # todo:
70 # * Test Pin, SAM-BA, Tri-state
71