summaryrefslogtreecommitdiff
path: root/src/flash/nor/pic32mx.h
diff options
context:
space:
mode:
authorSpencer Oliver <ntfreak@users.sourceforge.net>2010-03-08 22:54:18 +0000
committerSpencer Oliver <ntfreak@users.sourceforge.net>2010-03-10 21:03:22 +0000
commit257a764582f52235414b5c35717b0ee2b49d4b0d (patch)
treea27fc813a19942d0bee8c58fe170a9f838ea2294 /src/flash/nor/pic32mx.h
parentf10ed95a5ce6be416bcb2ec20826c6e508e4b622 (diff)
downloadopenocd+libswd-257a764582f52235414b5c35717b0ee2b49d4b0d.tar.gz
openocd+libswd-257a764582f52235414b5c35717b0ee2b49d4b0d.tar.bz2
openocd+libswd-257a764582f52235414b5c35717b0ee2b49d4b0d.tar.xz
openocd+libswd-257a764582f52235414b5c35717b0ee2b49d4b0d.zip
PIC32: add flash algorithm support
Add flash algorithm support for the PIC32MX. Still a few things todo but this dramatically decreases the programing time, eg. approx programming for 2.5k test file. - without fastload: 60secs - with fastload: 45secs - with fastload and algorithm: 2secs. Add new devices to supported list. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src/flash/nor/pic32mx.h')
-rw-r--r--src/flash/nor/pic32mx.h31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/flash/nor/pic32mx.h b/src/flash/nor/pic32mx.h
index b3bdad29..79fa40ef 100644
--- a/src/flash/nor/pic32mx.h
+++ b/src/flash/nor/pic32mx.h
@@ -29,8 +29,6 @@
struct pic32mx_flash_bank
{
struct working_area *write_algorithm;
- int devid;
- int ppage_size;
int probed;
};
@@ -38,18 +36,6 @@ struct pic32mx_flash_bank
/* pic32mx memory locations */
-#define PIC32MX_KUSEG_PGM_FLASH 0x7D000000
-#define PIC32MX_KUSEG_RAM 0x7F000000
-
-#define PIC32MX_KSEG0_RAM 0x80000000
-#define PIC32MX_KSEG0_PGM_FLASH 0x9D000000
-#define PIC32MX_KSEG0_BOOT_FLASH 0x9FC00000
-
-#define PIC32MX_KSEG1_RAM 0xA0000000
-#define PIC32MX_KSEG1_PGM_FLASH 0xBD000000
-#define PIC32MX_KSEG1_PERIPHERAL 0xBF800000
-#define PIC32MX_KSEG1_BOOT_FLASH 0xBFC00000
-
#define PIC32MX_PHYS_RAM 0x00000000
#define PIC32MX_PHYS_PGM_FLASH 0x1D000000
#define PIC32MX_PHYS_PERIPHERALS 0x1F800000
@@ -59,19 +45,21 @@ struct pic32mx_flash_bank
* Translate Virtual and Physical addresses.
* Note: These macros only work for KSEG0/KSEG1 addresses.
*/
-#define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000)
-#define Phys2KS1Virt(paddr) ((paddr) + 0xA0000000)
-#define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000)
-#define Phys2KS0Virt(paddr) ((paddr) + 0x80000000)
+
+#define Virt2Phys(v) ((v) & 0x1FFFFFFF)
/* pic32mx configuration register locations */
#define PIC32MX_DEVCFG0 0xBFC02FFC
#define PIC32MX_DEVCFG1 0xBFC02FF8
#define PIC32MX_DEVCFG2 0xBFC02FF4
-#define PIC32MX_DEVCFG3 0XBFC02FF0
+#define PIC32MX_DEVCFG3 0xBFC02FF0
#define PIC32MX_DEVID 0xBF80F220
+#define PIC32MX_BMXPFMSZ 0xBF882060
+#define PIC32MX_BMXBOOTSZ 0xBF882070
+#define PIC32MX_BMXDRMSZ 0xBF882040
+
/* pic32mx flash controller register locations */
#define PIC32MX_NVMCON 0xBF80F400
@@ -102,10 +90,5 @@ struct pic32mx_flash_bank
#define NVMKEY1 0xAA996655
#define NVMKEY2 0x556699AA
-struct pic32mx_mem_layout {
- uint32_t sector_start;
- uint32_t sector_size;
-};
-
#endif /* PIC32MX_H */