spinnaker_tools  development
SpiNNaker API, sark, sc&mp, bmp firmware and build tools
spinnaker.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
10 // Email: steven.temple@manchester.ac.uk
11 //
12 //------------------------------------------------------------------------------
13 
14 /*
15  * Copyright (c) 2009 The University of Manchester
16  *
17  * Licensed under the Apache License, Version 2.0 (the "License");
18  * you may not use this file except in compliance with the License.
19  * You may obtain a copy of the License at
20  *
21  * https://www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an "AS IS" BASIS,
25  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  */
29 
30 #ifndef __SPINNAKER_H__
31 #define __SPINNAKER_H__
32 
33 //------------------------------------------------------------------------------
34 
35 // Type definitions for unsigned integers
36 
37 typedef unsigned char uchar;
38 typedef unsigned short ushort;
39 typedef unsigned int uint;
40 typedef unsigned long long uint64;
41 
42 // Used in register offset definitions below
46 #define INT_AT(t) ((t) / 4)
47 
48 // Miscellaneous...
49 
50 #ifndef NULL
51 #define NULL 0
52 #endif
53 
54 #define BIT_31 0x80000000
55 
57 
58 #define BUF_WRITE 1
59 
60 //------------------------------------------------------------------------------
61 
62 // Numbers of CPUS, links
63 
64 #define NUM_CPUS 18
65 #define NUM_LINKS 6
66 
67 //------------------------------------------------------------------------------
68 
73 
75 #define ITCM_BASE 0x00000000
77 #define ITCM_SIZE 0x00008000 // 32 KB
79 #define ITCM_TOP (ITCM_BASE + ITCM_SIZE)
80 
82 #define DTCM_BASE 0x00400000
84 #define DTCM_SIZE 0x00010000 // 64 KB
86 #define DTCM_TOP (DTCM_BASE + DTCM_SIZE)
87 
89 #define SDRAM_BASE_UNBUF 0x70000000
91 #define SDRAM_BASE_BUF 0x60000000
92 
94 #ifdef BUF_WRITE
95 #define SDRAM_BASE SDRAM_BASE_BUF
96 #else
97 #define SDRAM_BASE SDRAM_BASE_UNBUF
98 #endif
99 
101 #define SDRAM_SIZE (128 * 1024 * 1024) // 128 MB
103 #define SDRAM_TOP (SDRAM_BASE + SDRAM_SIZE)
104 
106 #define SYSRAM_BASE_UNBUF 0xf5000000
108 #define SYSRAM_BASE_BUF 0xe5000000
109 
111 #ifdef BUF_WRITE
112 #define SYSRAM_BASE SYSRAM_BASE_BUF
113 #else
114 #define SYSRAM_BASE SYSRAM_BASE_UNBUF
115 #endif
116 
118 #define SYSRAM_SIZE 0x00008000 // 32 KB
120 #define SYSRAM_TOP (SYSRAM_BASE + SYSRAM_SIZE)
121 
123 #define ROM_BASE 0xf6000000
125 #define ROM_SIZE 0x00008000 // 32 KB
127 #define ROM_TOP (ROM_BASE + ROM_SIZE)
129 
130 //------------------------------------------------------------------------------
131 
136 
138 #define CC_BASE_UNBUF 0x10000000 // Unbuffered
140 #define CC_BASE_BUF 0x20000000 // Buffered
141 
143 #ifdef BUF_WRITE
144 #define CC_BASE CC_BASE_BUF
145 #else
146 #define CC_BASE CC_BASE_UNBUF
147 #endif
148 
150 #define CC_TCR INT_AT(0x00)
152 #define CC_TXDATA INT_AT(0x04)
154 #define CC_TXKEY INT_AT(0x08)
156 #define CC_RSR INT_AT(0x0c)
158 #define CC_RXDATA INT_AT(0x10)
160 #define CC_RXKEY INT_AT(0x14)
162 #define CC_SAR INT_AT(0x18)
164 #define CC_TEST INT_AT(0x1c)
166 
167 //------------------------------------------------------------------------------
168 
173 
175 #define TIMER_BASE_UNBUF 0x11000000
177 #define TIMER_BASE_BUF 0x21000000
178 
180 #ifdef BUF_WRITE
181 #define TIMER_BASE TIMER_BASE_BUF
182 #else
183 #define TIMER_BASE TIMER_BASE_UNBUF
184 #endif
185 
186 #define TIMER_OFFSET 0x20
187 
189 #define TIMER1_BASE (TIMER_BASE)
191 #define TIMER2_BASE (TIMER_BASE + TIMER_OFFSET)
192 
194 #define TC_LOAD INT_AT(0x00)
196 #define TC_COUNT INT_AT(0x04)
198 #define TC_CONTROL INT_AT(0x08)
200 #define TC_INT_CLR INT_AT(0x0c)
202 #define TC_RAW_INT INT_AT(0x10)
204 #define TC_MASK_INT INT_AT(0x14)
206 #define TC_BG_LOAD INT_AT(0x18)
207 
209 #define T1_LOAD INT_AT(0x00)
211 #define T1_COUNT INT_AT(0x04)
213 #define T1_CONTROL INT_AT(0x08)
215 #define T1_INT_CLR INT_AT(0x0c)
217 #define T1_RAW_INT INT_AT(0x10)
219 #define T1_MASK_INT INT_AT(0x14)
221 #define T1_BG_LOAD INT_AT(0x18)
222 
224 #define T2_LOAD INT_AT(0x20)
226 #define T2_COUNT INT_AT(0x24)
228 #define T2_CONTROL INT_AT(0x28)
230 #define T2_INT_CLR INT_AT(0x2c)
232 #define T2_RAW_INT INT_AT(0x30)
234 #define T2_MASK_INT INT_AT(0x34)
236 #define T2_BG_LOAD INT_AT(0x38)
238 
239 //------------------------------------------------------------------------------
240 
245 
247 #define VIC_BASE_UNBUF 0x1f000000
249 #define VIC_BASE_BUF 0x2f000000
250 
252 #ifdef BUF_WRITE
253 #define VIC_BASE VIC_BASE_BUF
254 #else
255 #define VIC_BASE VIC_BASE_UNBUF
256 #endif
257 
259 #define VIC_IRQST INT_AT(0x00)
261 #define VIC_FIQST INT_AT(0x04)
263 #define VIC_RAW INT_AT(0x08)
265 #define VIC_SELECT INT_AT(0x0c)
267 #define VIC_ENABLE INT_AT(0x10)
269 #define VIC_DISABLE INT_AT(0x14)
271 #define VIC_SOFT_SET INT_AT(0x18)
273 #define VIC_SOFT_CLR INT_AT(0x1c)
275 #define VIC_PROTECT INT_AT(0x20)
277 #define VIC_VADDR INT_AT(0x30)
279 #define VIC_DEFADDR INT_AT(0x34)
280 
282 #define VIC_ADDR INT_AT(0x100)
283 
285 #define VIC_ADDR0 INT_AT(0x100)
287 #define VIC_ADDR1 INT_AT(0x104)
289 #define VIC_ADDR2 INT_AT(0x108)
291 #define VIC_ADDR3 INT_AT(0x10c)
293 #define VIC_ADDR4 INT_AT(0x110)
295 #define VIC_ADDR5 INT_AT(0x114)
297 #define VIC_ADDR6 INT_AT(0x118)
299 #define VIC_ADDR7 INT_AT(0x11c)
301 #define VIC_ADDR8 INT_AT(0x120)
303 #define VIC_ADDR9 INT_AT(0x124)
305 #define VIC_ADDR10 INT_AT(0x128)
307 #define VIC_ADDR11 INT_AT(0x12c)
309 #define VIC_ADDR12 INT_AT(0x130)
311 #define VIC_ADDR13 INT_AT(0x134)
313 #define VIC_ADDR14 INT_AT(0x138)
315 #define VIC_ADDR15 INT_AT(0x13c)
316 
318 #define VIC_CNTL INT_AT(0x200)
319 
321 #define VIC_CNTL0 INT_AT(0x200)
323 #define VIC_CNTL1 INT_AT(0x204)
325 #define VIC_CNTL2 INT_AT(0x208)
327 #define VIC_CNTL3 INT_AT(0x20c)
329 #define VIC_CNTL4 INT_AT(0x210)
331 #define VIC_CNTL5 INT_AT(0x214)
333 #define VIC_CNTL6 INT_AT(0x218)
335 #define VIC_CNTL7 INT_AT(0x21c)
337 #define VIC_CNTL8 INT_AT(0x220)
339 #define VIC_CNTL9 INT_AT(0x224)
341 #define VIC_CNTL10 INT_AT(0x228)
343 #define VIC_CNTL11 INT_AT(0x22c)
345 #define VIC_CNTL12 INT_AT(0x230)
347 #define VIC_CNTL13 INT_AT(0x234)
349 #define VIC_CNTL14 INT_AT(0x238)
351 #define VIC_CNTL15 INT_AT(0x23c)
352 
355  WDOG_INT = 0,
365  CC_TOV_INT = 10,
366  CC_TMT_INT = 11,
368  DMA_ERR_INT = 13,
369  DMA_TO_INT = 14,
372  RTR_ERR_INT = 17,
373  CPU_INT = 18,
374  ETH_TX_INT = 19,
375  ETH_RX_INT = 20,
376  ETH_PHY_INT = 21,
378  CC_TNF_INT = 23,
379  CC_MC_INT = 24,
380  CC_P2P_INT = 25,
381  CC_NN_INT = 26,
382  CC_FR_INT = 27,
383  INT0_INT = 28,
384  INT1_INT = 29,
385  GPIO8_INT = 30,
386  GPIO9_INT = 31,
387 };
389 
390 //------------------------------------------------------------------------------
391 
396 
398 #define DMA_BASE_UNBUF 0x30000000
400 #define DMA_BASE_BUF 0x40000000
401 
403 #ifdef BUF_WRITE
404 #define DMA_BASE DMA_BASE_BUF
405 #else
406 #define DMA_BASE DMA_BASE_UNBUF
407 #endif
408 
410 #define DMA_ADRS INT_AT(0x04)
412 #define DMA_ADRT INT_AT(0x08)
414 #define DMA_DESC INT_AT(0x0c)
416 #define DMA_CTRL INT_AT(0x10)
418 #define DMA_STAT INT_AT(0x14)
420 #define DMA_GCTL INT_AT(0x18)
422 #define DMA_CRCC INT_AT(0x1c)
424 #define DMA_CRCR INT_AT(0x20)
426 #define DMA_TMTV INT_AT(0x24)
428 #define DMA_SCTL INT_AT(0x28)
429 
431 #define DMA_STAT0 INT_AT(0x40)
433 #define DMA_STAT1 INT_AT(0x44)
435 #define DMA_STAT2 INT_AT(0x48)
437 #define DMA_STAT3 INT_AT(0x4c)
439 #define DMA_STAT4 INT_AT(0x50)
441 #define DMA_STAT5 INT_AT(0x54)
443 #define DMA_STAT6 INT_AT(0x58)
445 #define DMA_STAT7 INT_AT(0x5c)
446 
448 #define DMA_AD2S INT_AT(0x104)
450 #define DMA_AD2T INT_AT(0x108)
452 #define DMA_DES2 INT_AT(0x10c)
453 
455 #define DMA_CRCT INT_AT(0x180)
457 
458 //------------------------------------------------------------------------------
459 
464 
466 #define PL340_BASE_UNBUF 0xf0000000
468 #define PL340_BASE_BUF 0xe0000000
469 
471 #ifdef BUF_WRITE
472 #define PL340_BASE PL340_BASE_BUF
473 #else
474 #define PL340_BASE PL340_BASE_UNBUF
475 #endif
476 
478 #define MC_STAT INT_AT(0x00)
480 #define MC_CMD INT_AT(0x04)
482 #define MC_DIRC INT_AT(0x08)
484 #define MC_MCFG INT_AT(0x0c)
485 
487 #define MC_REFP INT_AT(0x10)
489 #define MC_CASL INT_AT(0x14)
491 #define MC_DQSS INT_AT(0x18)
493 #define MC_MRD INT_AT(0x1c)
495 #define MC_RAS INT_AT(0x20)
497 #define MC_RC INT_AT(0x24)
499 #define MC_RCD INT_AT(0x28)
501 #define MC_RFC INT_AT(0x2c)
503 #define MC_RP INT_AT(0x30)
505 #define MC_RRD INT_AT(0x34)
507 #define MC_WR INT_AT(0x38)
509 #define MC_WTR INT_AT(0x3c)
511 #define MC_XP INT_AT(0x40)
513 #define MC_XSR INT_AT(0x44)
515 #define MC_ESR INT_AT(0x48)
516 
518 #define MC_MCFG2 INT_AT(0x4c)
520 #define MC_MCFG3 INT_AT(0x50)
521 
523 #define MC_QOS0 INT_AT(0x100)
525 #define MC_QOS1 INT_AT(0x104)
527 #define MC_QOS2 INT_AT(0x108)
529 #define MC_QOS3 INT_AT(0x10c)
531 #define MC_QOS4 INT_AT(0x110)
533 #define MC_QOS5 INT_AT(0x114)
535 #define MC_QOS6 INT_AT(0x118)
537 #define MC_QOS7 INT_AT(0x11c)
539 #define MC_QOS8 INT_AT(0x120)
541 #define MC_QOS9 INT_AT(0x124)
543 #define MC_QOS10 INT_AT(0x128)
545 #define MC_QOS11 INT_AT(0x12c)
547 #define MC_QOS12 INT_AT(0x130)
549 #define MC_QOS13 INT_AT(0x134)
551 #define MC_QOS14 INT_AT(0x138)
553 #define MC_QOS15 INT_AT(0x13c)
554 
556 #define MC_CCFG0 INT_AT(0x200)
558 #define MC_CCFG1 INT_AT(0x204)
560 #define MC_CCFG2 INT_AT(0x208)
562 #define MC_CCFG3 INT_AT(0x20c)
563 
565 #define DLL_STATUS INT_AT(0x300)
567 #define DLL_CONFIG0 INT_AT(0x304)
569 #define DLL_CONFIG1 INT_AT(0x308)
571 
572 //------------------------------------------------------------------------------
573 
578 
580 #define RTR_BASE_UNBUF 0xf1000000
582 #define RTR_BASE_BUF 0xe1000000
583 
585 #ifdef BUF_WRITE
586 #define RTR_BASE RTR_BASE_BUF
587 #else
588 #define RTR_BASE RTR_BASE_UNBUF
589 #endif
590 
592 #define RTR_CONTROL INT_AT(0x00)
594 #define RTR_STATUS INT_AT(0x04)
595 
597 #define RTR_EHDR INT_AT(0x08)
599 #define RTR_EKEY INT_AT(0x0c)
601 #define RTR_EDAT INT_AT(0x10)
603 #define RTR_ESTAT INT_AT(0x14)
605 #define RTR_DHDR INT_AT(0x18)
607 #define RTR_DKEY INT_AT(0x1c)
609 #define RTR_DDAT INT_AT(0x20)
611 #define RTR_DLINK INT_AT(0x24)
613 #define RTR_DSTAT INT_AT(0x28)
615 #define RTR_DGEN INT_AT(0x2c)
616 
617 // registers r12-r32 are NOT described here!
618 
620 #define RTR_FR INT_AT(0x84)
621 
623 #define RTR_DGF0 INT_AT(0x200)
625 #define RTR_DGF1 INT_AT(0x204)
627 #define RTR_DGF2 INT_AT(0x208)
629 #define RTR_DGF3 INT_AT(0x20c)
631 #define RTR_DGF4 INT_AT(0x210)
633 #define RTR_DGF5 INT_AT(0x214)
635 #define RTR_DGF6 INT_AT(0x218)
637 #define RTR_DGF7 INT_AT(0x21c)
639 #define RTR_DGF8 INT_AT(0x220)
641 #define RTR_DGF9 INT_AT(0x224)
643 #define RTR_DGF10 INT_AT(0x228)
645 #define RTR_DGF11 INT_AT(0x22c)
647 #define RTR_DGF12 INT_AT(0x230)
649 #define RTR_DGF13 INT_AT(0x234)
651 #define RTR_DGF14 INT_AT(0x238)
653 #define RTR_DGF15 INT_AT(0x23c)
654 
656 #define RTR_DGC0 INT_AT(0x300)
658 #define RTR_DGC1 INT_AT(0x304)
660 #define RTR_DGC2 INT_AT(0x308)
662 #define RTR_DGC3 INT_AT(0x30c)
664 #define RTR_DGC4 INT_AT(0x310)
666 #define RTR_DGC5 INT_AT(0x314)
668 #define RTR_DGC6 INT_AT(0x318)
670 #define RTR_DGC7 INT_AT(0x31c)
672 #define RTR_DGC8 INT_AT(0x320)
674 #define RTR_DGC9 INT_AT(0x324)
676 #define RTR_DGC10 INT_AT(0x328)
678 #define RTR_DGC11 INT_AT(0x32c)
680 #define RTR_DGC12 INT_AT(0x330)
682 #define RTR_DGC13 INT_AT(0x334)
684 #define RTR_DGC14 INT_AT(0x338)
686 #define RTR_DGC15 INT_AT(0x33c)
687 
689 #define RTR_TST1 INT_AT(0xf00)
691 #define RTR_TST2 INT_AT(0xf04)
692 
694 #define P2P_TABLE_SIZE 8192
696 #define MC_TABLE_SIZE 1024
697 
699 #define MC_RAM_WIDTH (NUM_CPUS + NUM_LINKS)
701 #define MC_RAM_MASK ((1 << MC_RAM_WIDTH) - 1)
702 
706 #define MC_CORE_ROUTE(x) (1 << ((x) + NUM_LINKS))
710 #define MC_LINK_ROUTE(x) (1 << (x))
711 
712 #define P2P_EPW 8
713 #define P2P_LOG_EPW 3
714 #define P2P_EMASK (P2P_EPW-1)
715 #define P2P_BPE 3
716 #define P2P_BMASK 7
717 
719 #define P2P_INIT 0x00db6db6
720 
722 #define RTR_MCRAM_BASE (RTR_BASE + 0x00004000)
724 #define RTR_MCRAM_TOP (RTR_MCRAM_BASE + MC_TABLE_SIZE * 4)
725 
727 #define RTR_MCKEY_BASE (RTR_BASE + 0x00008000)
729 #define RTR_MCKEY_TOP (RTR_MCKEY_BASE + MC_TABLE_SIZE * 4)
730 
732 #define RTR_MCMASK_BASE (RTR_BASE + 0x0000c000)
734 #define RTR_MCMASK_TOP (RTR_MCMASK_BASE + MC_TABLE_SIZE * 4)
735 
737 #define RTR_P2P_BASE (RTR_BASE + 0x00010000)
739 #define RTR_P2P_TOP (RTR_P2P_BASE + P2P_TABLE_SIZE * 4)
740 
742 #define MC_CAM_WIDTH 32
744 
745 //------------------------------------------------------------------------------
746 
751 
753 #define SYSCTL_BASE_UNBUF 0xf2000000
755 #define SYSCTL_BASE_BUF 0xe2000000
756 
758 #ifdef BUF_WRITE
759 #define SYSCTL_BASE SYSCTL_BASE_BUF
760 #else
761 #define SYSCTL_BASE SYSCTL_BASE_UNBUF
762 #endif
763 
765 #define SC_CODE 0x5ec00000
766 
768 #define CHIP_ID_CODE 0x59111012
769 
771 #define SC_CHIP_ID INT_AT(0x00)
773 #define SC_CPU_DIS INT_AT(0x04)
775 #define SC_SET_IRQ INT_AT(0x08)
777 #define SC_CLR_IRQ INT_AT(0x0c)
779 #define SC_SET_OK INT_AT(0x10)
781 #define SC_CPU_OK INT_AT(0x10)
783 #define SC_CLR_OK INT_AT(0x14)
784 
786 #define SC_SOFT_RST_L INT_AT(0x18)
788 #define SC_HARD_RST_L INT_AT(0x1c)
790 #define SC_SUBS_RST_L INT_AT(0x20)
791 
793 #define SC_SOFT_RST_P INT_AT(0x24)
795 #define SC_HARD_RST_P INT_AT(0x28)
797 #define SC_SUBS_RST_P INT_AT(0x2c)
798 
800 #define SC_RST_CODE INT_AT(0x30)
802 #define SC_MON_ID INT_AT(0x34)
803 
805 #define SC_MISC_CTRL INT_AT(0x38)
806 
808 #define GPIO_RES INT_AT(0x3c)
809 
811 #define GPIO_PORT INT_AT(0x40)
813 #define GPIO_DIR INT_AT(0x44)
815 #define GPIO_SET INT_AT(0x48)
817 #define GPIO_CLR INT_AT(0x4c)
819 #define GPIO_READ INT_AT(0x48)
820 
822 #define SC_PLL1 INT_AT(0x50)
824 #define SC_PLL2 INT_AT(0x54)
825 
827 #define SC_FLAG INT_AT(0x58)
829 #define SC_SETFLAG INT_AT(0x58)
831 #define SC_CLRFLAG INT_AT(0x5c)
832 
834 #define SC_CLKMUX INT_AT(0x60)
836 #define SC_SLEEP INT_AT(0x64)
837 
839 #define SC_TS0 INT_AT(0x68)
841 #define SC_TS1 INT_AT(0x6c)
843 #define SC_TS2 INT_AT(0x70)
844 
846 #define SC_ARB0 INT_AT(0x080)
848 #define SC_TAS0 INT_AT(0x100)
850 #define SC_TAC0 INT_AT(0x180)
851 
853 #define SC_LINK_DIS INT_AT(0x200)
854 
856 enum {
857  RST_POR = 0,
858  RST_WDT = 1,
859  RST_USER = 2,
860  RST_SW = 3,
861  RST_WDI = 4
862 };
864 
865 //------------------------------------------------------------------------------
866 
871 
873 #define WDOG_BASE_UNBUF 0xf3000000
875 #define WDOG_BASE_BUF 0xe3000000
876 
878 #ifdef BUF_WRITE
879 #define WDOG_BASE WDOG_BASE_BUF
880 #else
881 #define WDOG_BASE WDOG_BASE_UNBUF
882 #endif
883 
885 #define WD_LOAD INT_AT(0x00)
887 #define WD_COUNT INT_AT(0x04)
889 #define WD_CTRL INT_AT(0x08)
891 #define WD_INTCLR INT_AT(0x0c)
893 #define WD_RAWINT INT_AT(0x10)
895 #define WD_MSKINT INT_AT(0x14)
897 #define WD_LOCK INT_AT(0xc00)
898 
900 #define WD_CODE 0x1acce551
901 
903 enum {
904  WD_INT_B = 1,
905  WD_RST_B = 2
906 };
908 
909 //------------------------------------------------------------------------------
910 
915 
917 #define ETH_BASE_UNBUF 0xf4000000
919 #define ETH_BASE_BUF 0xe4000000
920 
922 #ifdef BUF_WRITE
923 #define ETH_BASE ETH_BASE_BUF
924 #else
925 #define ETH_BASE ETH_BASE_UNBUF
926 #endif
927 
929 #define ETH_TX_BASE (ETH_BASE + 0x0000)
931 #define ETH_TX_SIZE 0x0600
933 #define ETH_TX_TOP (ETH_TX_BASE + ETH_TX_SIZE)
934 
936 #define ETH_RX_BASE (ETH_BASE + 0x4000)
938 #define ETH_RX_SIZE 0x0c00
940 #define ETH_RX_TOP (ETH_RX_BASE + ETH_RX_SIZE)
941 
943 #define ETH_RX_DESC_RAM (ETH_BASE + 0x8000)
945 #define ETH_REGS (ETH_BASE + 0xc000)
946 
948 #define ETH_CONTROL INT_AT(0x00)
950 #define ETH_STATUS INT_AT(0x04)
952 #define ETH_TX_LEN INT_AT(0x08)
954 #define ETH_TX_CMD INT_AT(0x0c)
956 #define ETH_RX_CMD INT_AT(0x10)
958 #define ETH_MAC_LO INT_AT(0x14)
960 #define ETH_MAC_HI INT_AT(0x18)
962 #define ETH_PHY_CTRL INT_AT(0x1c)
964 #define ETH_INT_CLR INT_AT(0x20)
966 #define ETH_RX_BUF_RP INT_AT(0x24)
968 #define ETH_RX_DESC_RP INT_AT(0x2c)
969 
971 enum {
972  ETH_TX_CLR = 0x01,
973  ETH_RX_CLR = 0x10
974 };
975 
977 enum {
982  PHY_CTRL_CLK = 16
983 };
985 
986 //------------------------------------------------------------------------------
987 
991 
993 static volatile uint * const cc = (uint *) CC_BASE;
995 static volatile uint * const tc = (uint *) TIMER_BASE;
997 static volatile uint * const tc1 = (uint *) TIMER1_BASE;
999 static volatile uint * const tc2 = (uint *) TIMER2_BASE;
1001 static volatile uint * const vic = (uint *) VIC_BASE_UNBUF; // NB unbuffered
1003 static volatile uint * const dma = (uint *) DMA_BASE;
1004 
1006 static volatile uint * const sc = (uint *) SYSCTL_BASE;
1008 static volatile uint * const rtr = (uint *) RTR_BASE;
1010 static volatile uint * const er = (uint *) ETH_REGS;
1012 static volatile uint * const mc = (uint *) PL340_BASE;
1014 static volatile uint * const wd = (uint *) WDOG_BASE;
1015 
1017 static uint * const sdram = (uint *) SDRAM_BASE;
1019 static uint * const sysram = (uint *) SYSRAM_BASE;
1020 
1022 static uint * const rtr_ram = (uint *) RTR_MCRAM_BASE;
1024 static uint * const rtr_key = (uint *) RTR_MCKEY_BASE;
1026 static uint * const rtr_mask = (uint *) RTR_MCMASK_BASE;
1028 static uint * const rtr_p2p = (uint *) RTR_P2P_BASE;
1029 
1031 static uchar * const eth_tx_ram = (uchar *) ETH_TX_BASE;
1033 static uchar * const eth_rx_ram = (uchar *) ETH_RX_BASE;
1035 static uint * const eth_rx_desc = (uint *) ETH_RX_DESC_RAM;
1037 
1038 //------------------------------------------------------------------------------
1039 
1043 
1045 enum {
1046  PKT_MC = 0x00000000,
1047  PKT_P2P = 0x00400000,
1048  PKT_NN = 0x00800000,
1049  PKT_NND = 0x00a00000,
1050  PKT_FR = 0x00c00000,
1051 
1052  PKT_PL = 0x00020000,
1053 
1057  PKT_FR_PL = (PKT_FR + PKT_PL)
1058 };
1060 
1061 //------------------------------------------------------------------------------
1062 
1066 
1067 #define CLK_XTAL_MHZ 10
1068 
1070 #define PLL_260 0x0007011a
1072 #define PLL_300 0x0007011e
1074 #define PLL_330 0x00070121
1076 #define PLL_400 0x00070128
1077 
1079 #define PLL_LOCK_TIME 80
1080 
1081 #define PLL_CLK_SEL 0x809488a5
1083 
1084 //------------------------------------------------------------------------------
1085 
1089 
1091 enum {
1092  SERIAL_NCS = 0x00000020, // Out
1093  SERIAL_CLK = 0x00000010, // Out
1094  SERIAL_SI = 0x00000008, // Out
1095  SERIAL_SO = 0x00000004, // In
1096 
1097  SERIAL_OE = (SERIAL_NCS + SERIAL_CLK + SERIAL_SI)
1098 };
1099 
1101 #define TOP_BIT 0x80000000
1102 #ifndef __GNUC__
1103 // Don't warn out-of-int-range on armcc; uint is used anyway according to:
1104 // https://developer.arm.com/documentation/dui0491/c/
1105 // c-and-c---implementation-details/
1106 // structures--unions--enumerations--and-bitfields?lang=en
1107 #pragma push
1108 #pragma diag_suppress 66
1109 #endif
1110 // On-chip SDRAM
1112 enum {
1113  SDRAM_TQ = TOP_BIT,
1114  SDRAM_DPD = (1 << 30),
1115  SDRAM_HERE = (1 << 29),
1116 
1117  JTAG_NTRST = (1 << 27),
1118  JTAG_TMS = (1 << 26),
1119  JTAG_TDI = (1 << 25),
1120  JTAG_TCK = (1 << 24)
1121 };
1122 #ifndef __GNUC__
1123 // Undo suppression of warning
1124 #pragma pop
1125 #endif
1126 
1128 enum {
1129  JTAG_RTCK = (1 << 20),
1130  JTAG_TDO = (1 << 19),
1131  JTAG_INT = (1 << 15)
1132 };
1133 
1134 // LEDs
1135 
1136 #define LED_0 0x00000001
1138 
1139 //------------------------------------------------------------------------------
1140 
1144 
1148 #define MODE_USER 0x10
1149 #define MODE_FIQ 0x11
1150 #define MODE_IRQ 0x12
1151 #define MODE_SVC 0x13
1152 #define MODE_ABT 0x17
1153 #define MODE_UND 0x1b
1154 #define MODE_SYS 0x1f
1155 
1156 #define THUMB_BIT 0x20
1157 
1158 #define IMASK_IRQ 0x80
1159 #define IMASK_FIQ 0x40
1160 #define IMASK_ALL 0xc0
1162 
1163 //------------------------------------------------------------------------------
1164 
1165 #endif
@ PKT_P2P
Packet is peer-to-peer packet.
Definition: spinnaker.h:1047
@ PKT_NN
Packet is normal nearest-neighbour packet.
Definition: spinnaker.h:1048
@ PKT_P2P_PL
Peer-to-peer with payload.
Definition: spinnaker.h:1055
@ PKT_FR_PL
Fixed-route with payload.
Definition: spinnaker.h:1057
@ PKT_NN_PL
Nearest-neighbour with payload.
Definition: spinnaker.h:1056
@ PKT_NND
Packet is peek/poke nearest-neighbour.
Definition: spinnaker.h:1049
@ PKT_PL
Packet has payload word.
Definition: spinnaker.h:1052
@ PKT_FR
Packet is fixed route packet.
Definition: spinnaker.h:1050
@ PKT_MC_PL
Multicast with payload.
Definition: spinnaker.h:1054
@ PKT_MC
Packet is multicast packet.
Definition: spinnaker.h:1046
static uint *const rtr_key
Router key array.
Definition: spinnaker.h:1024
#define WDOG_BASE
Watchdog timer base address.
Definition: spinnaker.h:879
#define VIC_BASE_UNBUF
Vectored interrupt controller base address: writes unbuffered.
Definition: spinnaker.h:247
static volatile uint *const tc
Timer controller.
Definition: spinnaker.h:995
static uint *const sysram
Base address of System RAM.
Definition: spinnaker.h:1019
static uint *const rtr_mask
Router mask array.
Definition: spinnaker.h:1026
static uchar *const eth_rx_ram
Ethernet receive memory.
Definition: spinnaker.h:1033
#define SYSRAM_BASE
Base address of System RAM.
Definition: spinnaker.h:112
#define TIMER_BASE
Timer controller base address.
Definition: spinnaker.h:181
#define RTR_P2P_BASE
Router controller: peer-to-peer table base address.
Definition: spinnaker.h:737
static volatile uint *const sc
System controller.
Definition: spinnaker.h:1006
unsigned long long uint64
Unsigned integer - 64 bits.
Definition: spinnaker.h:40
#define TOP_BIT
The top bit of an unsigned integer.
Definition: spinnaker.h:1101
@ JTAG_TDO
read value on JTAG_TDO pin
Definition: spinnaker.h:1130
@ JTAG_INT
select on-chip (1) or off-chip (0) control of JTAG pins
Definition: spinnaker.h:1131
@ JTAG_RTCK
read value on JTAG_RTCK pin
Definition: spinnaker.h:1129
static uint *const sdram
Base address of SDRAM.
Definition: spinnaker.h:1017
static volatile uint *const cc
Communications controller.
Definition: spinnaker.h:993
#define RTR_MCKEY_BASE
Router controller: multicast key table base address (write only)
Definition: spinnaker.h:727
#define SYSCTL_BASE
System controller base address.
Definition: spinnaker.h:759
spinnaker_interrupt_numbers_e
Interrupt numbers for SpiNNaker.
Definition: spinnaker.h:354
@ GPIO8_INT
Signal on Pin GPIO[8].
Definition: spinnaker.h:385
@ INT0_INT
External interrupt request: Pin INT[0].
Definition: spinnaker.h:383
@ CC_RFE_INT
Local comms controller received packet framing error.
Definition: spinnaker.h:363
@ SOFTWARE_INT
Used only for local software interrupt generation.
Definition: spinnaker.h:356
@ INT1_INT
External interrupt request: Pin INT[1].
Definition: spinnaker.h:384
@ RTR_DUMP_INT
Router packet dumped - indicates failed delivery.
Definition: spinnaker.h:371
@ DMA_TO_INT
Local DMA controller transfer timed out.
Definition: spinnaker.h:369
@ CC_RDY_INT
Local comms controller packet received.
Definition: spinnaker.h:361
@ COMM_RX_INT
Debug communications receiver interrupt.
Definition: spinnaker.h:357
@ CC_NN_INT
Local comms controller nearest neighbour packet receive.
Definition: spinnaker.h:381
@ ETH_TX_INT
Ethernet transmit frame interrupt.
Definition: spinnaker.h:374
@ CC_TNF_INT
Local comms controller can accept new Tx packet.
Definition: spinnaker.h:378
@ CC_FR_INT
Local comms controller fixed route packet received.
Definition: spinnaker.h:382
@ CC_TFL_INT
Local comms controller transmit buffer full.
Definition: spinnaker.h:364
@ DMA_DONE_INT
Local DMA controller transfer complete.
Definition: spinnaker.h:367
@ TIMER2_INT
Local counter/timer interrupt 2.
Definition: spinnaker.h:360
@ RTR_DIAG_INT
Router diagnostic counter event has occurred.
Definition: spinnaker.h:370
@ CC_TOV_INT
Local comms controller transmit buffer overflow.
Definition: spinnaker.h:365
@ COMM_TX_INT
Debug communications transmitter interrupt.
Definition: spinnaker.h:358
@ CC_MC_INT
Local comms controller multicast packet received.
Definition: spinnaker.h:379
@ RTR_ERR_INT
Router error - packet parity, framing, or time stamp error.
Definition: spinnaker.h:372
@ DMA_ERR_INT
Local DMA controller error.
Definition: spinnaker.h:368
@ CPU_INT
System Controller interrupt bit set for this processor.
Definition: spinnaker.h:373
@ GPIO9_INT
Signal on Pin GPIO[9].
Definition: spinnaker.h:386
@ ETH_RX_INT
Ethernet receive frame interrupt.
Definition: spinnaker.h:375
@ CC_RPE_INT
Local comms controller received packet parity error.
Definition: spinnaker.h:362
@ ETH_PHY_INT
Ethernet PHY/external interrupt.
Definition: spinnaker.h:376
@ SLOW_CLK_INT
System-wide slow (nominally 32 KHz) timer interrupt.
Definition: spinnaker.h:377
@ CC_TMT_INT
Local comms controller transmit buffer empty.
Definition: spinnaker.h:366
@ TIMER1_INT
Local counter/timer interrupt 1.
Definition: spinnaker.h:359
@ CC_P2P_INT
Local comms controller point-to-point packet received.
Definition: spinnaker.h:380
@ WDOG_INT
Watchdog timer interrupt.
Definition: spinnaker.h:355
static volatile uint *const mc
PL340 memory controller.
Definition: spinnaker.h:1012
static uint *const rtr_p2p
Router peer-to-peer table.
Definition: spinnaker.h:1028
static volatile uint *const vic
Vectored interrupt controller.
Definition: spinnaker.h:1001
@ ETH_RX_CLR
Clear receive interrupt request.
Definition: spinnaker.h:973
@ ETH_TX_CLR
Clear transmit interrupt request.
Definition: spinnaker.h:972
#define RTR_MCRAM_BASE
Router controller: multicast route table base address.
Definition: spinnaker.h:722
unsigned char uchar
Unsigned integer - 8 bits.
Definition: spinnaker.h:37
#define CC_BASE
Communications controller base address.
Definition: spinnaker.h:144
@ PHY_CTRL_DIN
SMI data input.
Definition: spinnaker.h:979
@ PHY_CTRL_OE
SMI data output enable.
Definition: spinnaker.h:981
@ PHY_CTRL_NRST
PHY reset (active low)
Definition: spinnaker.h:978
@ PHY_CTRL_CLK
SMI clock (active rising)
Definition: spinnaker.h:982
@ PHY_CTRL_DOUT
SMI data output.
Definition: spinnaker.h:980
#define ETH_TX_BASE
Ethernet transmit buffer: base address.
Definition: spinnaker.h:929
static volatile uint *const rtr
Router controller.
Definition: spinnaker.h:1008
#define TIMER1_BASE
Timer 1 base address.
Definition: spinnaker.h:189
#define ETH_REGS
Ethernet controller registers: base address.
Definition: spinnaker.h:945
#define RTR_MCMASK_BASE
Router controller: multicast mask table base address (write only)
Definition: spinnaker.h:732
unsigned int uint
Unsigned integer - 32 bits.
Definition: spinnaker.h:39
#define TIMER2_BASE
Timer 2 base address.
Definition: spinnaker.h:191
#define ETH_RX_DESC_RAM
Ethernet receive descriptors: base address.
Definition: spinnaker.h:943
static uint *const eth_rx_desc
Ethernet receive descriptor array.
Definition: spinnaker.h:1035
static uchar *const eth_tx_ram
Ethernet transmit memory.
Definition: spinnaker.h:1031
#define PL340_BASE
Memory controller base address.
Definition: spinnaker.h:472
#define DMA_BASE
DMA controller base address.
Definition: spinnaker.h:404
static uint *const rtr_ram
Router memory.
Definition: spinnaker.h:1022
unsigned short ushort
Unsigned integer - 16 bits.
Definition: spinnaker.h:38
static volatile uint *const tc2
Timer 2.
Definition: spinnaker.h:999
@ RST_SW
Reset entire chip.
Definition: spinnaker.h:860
@ RST_WDI
Watchdog interrupt (monitor only)
Definition: spinnaker.h:861
@ RST_WDT
Watchdog reset.
Definition: spinnaker.h:858
@ RST_USER
User reset.
Definition: spinnaker.h:859
@ RST_POR
Power-on reset.
Definition: spinnaker.h:857
#define SDRAM_BASE
Base address of SDRAM.
Definition: spinnaker.h:95
#define ETH_RX_BASE
Ethernet receive buffer: base address.
Definition: spinnaker.h:936
static volatile uint *const er
Ethernet controller.
Definition: spinnaker.h:1010
static volatile uint *const wd
Watchdog controller.
Definition: spinnaker.h:1014
@ WD_RST_B
enable watchdog reset output
Definition: spinnaker.h:905
@ WD_INT_B
enable watchdog counter and interrupt
Definition: spinnaker.h:904
static volatile uint *const dma
DMA controller.
Definition: spinnaker.h:1003
#define RTR_BASE
Router base address.
Definition: spinnaker.h:586
static volatile uint *const tc1
Timer 1.
Definition: spinnaker.h:997