Documentation for “Zerocat Chipflasher” as of Fri, 30 Sep 2022 18:26:54 +0200
Repository: git://zerocat.org/zerocat/projects/chipflasher
Version: v0.6.9-1497-91b1f109
Branch: flashrom-interface

../../firmware2/src/serprog-SPI-PASM.spin.txt.html

Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2016 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.78
Compiling...
../../firmware2/src/serprog-SPI-PASM.spin
|-pins.spin
Done.
Program size is 2492 bytes
TYPE: 43   VALUE: 04C4B400 (00000000)   NAME: __CLKFREQ
TYPE: 43   VALUE: 00061A80 (00000000)   NAME: POWERUP_SPI
TYPE: 43   VALUE: 00013880 (00000000)   NAME: POWERUP_SPILINES
TYPE: 43   VALUE: 003D0900 (00000000)   NAME: POWERDOWN_SPI
TYPE: 43   VALUE: 00000001 (00000000)   NAME: REPETITIVE_POWERUP
TYPE: 43   VALUE: 00000000 (00000000)   NAME: FUNCID__READY
TYPE: 43   VALUE: 00000001 (00000000)   NAME: FUNCID__INIT1
TYPE: 43   VALUE: 00000002 (00000000)   NAME: FUNCID__POWERON
TYPE: 43   VALUE: 00000003 (00000000)   NAME: FUNCID__POWEROFF
TYPE: 43   VALUE: 00000004 (00000000)   NAME: FUNCID__TRIGGER
TYPE: 43   VALUE: 00000005 (00000000)   NAME: FUNCID__LO_CEN
TYPE: 43   VALUE: 00000006 (00000000)   NAME: FUNCID__HI_CEN
TYPE: 43   VALUE: 00000007 (00000000)   NAME: FUNCID__LO_WPN
TYPE: 43   VALUE: 00000008 (00000000)   NAME: FUNCID__HI_WPN
TYPE: 43   VALUE: 00000009 (00000000)   NAME: FUNCID__READ
TYPE: 43   VALUE: 0000000A (00000000)   NAME: FUNCID__WRITE
TYPE: 43   VALUE: 0000000B (00000000)   NAME: FUNCID__SETSPIFRQ
TYPE: 53   VALUE: 00000101 (00000004)   NAME: GO
TYPE: 53   VALUE: 00000002 (00000004)   NAME: INIT
TYPE: 53   VALUE: 00000103 (00000004)   NAME: POWER_ON
TYPE: 53   VALUE: 00000004 (00000004)   NAME: POWER_OFF
TYPE: 53   VALUE: 00000005 (00000004)   NAME: FINAL_TRIGGER
TYPE: 53   VALUE: 00000006 (00000004)   NAME: CHIP_ENABLE
TYPE: 53   VALUE: 00000007 (00000004)   NAME: CHIP_DISABLE
TYPE: 53   VALUE: 00000008 (00000004)   NAME: WPN_LOW
TYPE: 53   VALUE: 00000009 (00000004)   NAME: WPN_HIGH
TYPE: 53   VALUE: 0000040A (00000004)   NAME: IN
TYPE: 53   VALUE: 0000040B (00000004)   NAME: OUT
TYPE: 53   VALUE: 0000000C (00000005)   NAME: POWER_ON_ONCE
TYPE: 4F   VALUE: 0000000D (00000000)   NAME: PINS
TYPE: 51   VALUE: 00000000 (00000000)   NAME: PIN_CEN1^A
TYPE: 51   VALUE: 00000001 (00000000)   NAME: PIN_CEN0^A
TYPE: 51   VALUE: 00000002 (00000000)   NAME: PIN_MOSI^A
TYPE: 51   VALUE: 00000003 (00000000)   NAME: PIN_WPN^A
TYPE: 51   VALUE: 00000004 (00000000)   NAME: PIN_SCLK3^A
TYPE: 51   VALUE: 00000005 (00000000)   NAME: PIN_SCLK2^A
TYPE: 51   VALUE: 00000006 (00000000)   NAME: PIN_SCLK1^A
TYPE: 51   VALUE: 00000007 (00000000)   NAME: PIN_SCLK0^A
TYPE: 51   VALUE: 00000008 (00000000)   NAME: PIN_MISO^A
TYPE: 51   VALUE: 00000009 (00000000)   NAME: PIN_PLUGTESTN^A
TYPE: 51   VALUE: 0000000A (00000000)   NAME: PIN_PNP^A
TYPE: 51   VALUE: 0000000C (00000000)   NAME: PIN_HOLDN^A
TYPE: 51   VALUE: 0000000D (00000000)   NAME: PIN_D3^A
TYPE: 51   VALUE: 0000000E (00000000)   NAME: PIN_D2^A
TYPE: 51   VALUE: 0000000F (00000000)   NAME: PIN_D1^A
TYPE: 51   VALUE: 0000001D (00000000)   NAME: PIN_TRIGGER^A
TYPE: 51   VALUE: 0000001E (00000000)   NAME: PIN_TX^A
TYPE: 51   VALUE: 0000001F (00000000)   NAME: PIN_RX^A
TYPE: 51   VALUE: 00000010 (00000000)   NAME: SWDIP_A^A
TYPE: 51   VALUE: 00000011 (00000000)   NAME: SWDIP_B^A
TYPE: 51   VALUE: 00000012 (00000000)   NAME: SWDIP_1^A
TYPE: 51   VALUE: 00000013 (00000000)   NAME: SWDIP_2^A
TYPE: 51   VALUE: 00000014 (00000000)   NAME: SWDIP_3^A
TYPE: 51   VALUE: 00000015 (00000000)   NAME: SWDIP_4^A
TYPE: 51   VALUE: 00000016 (00000000)   NAME: SWDIP_5^A
TYPE: 51   VALUE: 00000017 (00000000)   NAME: SWDIP_6^A
TYPE: 51   VALUE: 00000010 (00000000)   NAME: RST_DISABLE^A
TYPE: 51   VALUE: 00000018 (00000000)   NAME: RS232_RST^A
TYPE: 51   VALUE: 0000000B (00000000)   NAME: RST_INHIBIT^A
TYPE: 51   VALUE: 0000001B (00000000)   NAME: ADC_OUT^A
TYPE: 51   VALUE: 0000001A (00000000)   NAME: ADC_CALIBRATION^A
TYPE: 51   VALUE: 00000019 (00000000)   NAME: ADC_IN^A
TYPE: 51   VALUE: 00000003 (00000000)   NAME: MASK_CEN_AVAIL^A
TYPE: 51   VALUE: 000000F0 (00000000)   NAME: MASK_SCLK_AVAIL^A
TYPE: 51   VALUE: 000011FF (00000000)   NAME: MASK_SPI_BUS_AVAIL^A
TYPE: 51   VALUE: 000000F0 (00000000)   NAME: MASK_SCLK_ACTIVE100^A
TYPE: 51   VALUE: 000000E0 (00000000)   NAME: MASK_SCLK_ACTIVE75^A
TYPE: 51   VALUE: 000000C0 (00000000)   NAME: MASK_SCLK_ACTIVE50^A
TYPE: 51   VALUE: 00000080 (00000000)   NAME: MASK_SCLK_ACTIVE25^A
TYPE: 51   VALUE: 00000000 (00000000)   NAME: MASK_SCLK_ACTIVE0^A
TYPE: 51   VALUE: 000000F0 (00000000)   NAME: MASK_SCLK_ACTIVE^A
TYPE: 50   VALUE: 00000001 (00000000)   NAME: GET_BOARD_CONFIG^A
TYPE: 50   VALUE: 00000102 (00000000)   NAME: GET_BOARD_VERSION^A
TYPE: 50   VALUE: 00000103 (00000000)   NAME: GET_PIN_RSTINHIBIT^A
TYPE: 50   VALUE: 00000104 (00000000)   NAME: GET_MONITOR_HARDWARE^A
TYPE: 50   VALUE: 00000105 (00000000)   NAME: GET_POWERUP_TYPE^A
TYPE: 50   VALUE: 00000106 (00000000)   NAME: GET_ACCESS_TYPE^A
TYPE: 50   VALUE: 00000107 (00000000)   NAME: GET_MODE_SPI^A
TYPE: 50   VALUE: 00000108 (00000000)   NAME: GET_DRIVER_STRENGTH^A
TYPE: 50   VALUE: 00000109 (00000000)   NAME: GET_BAUDRATE^A
TYPE: 50   VALUE: 0000010A (00000000)   NAME: HIGH^A
TYPE: 50   VALUE: 0000010B (00000000)   NAME: LOW^A
TYPE: 43   VALUE: 0000000A (00000000)   NAME: SPI_PNP
TYPE: 43   VALUE: 00000001 (00000000)   NAME: SPI_CEN0
TYPE: 43   VALUE: 00000000 (00000000)   NAME: SPI_CEN1
TYPE: 43   VALUE: 00000008 (00000000)   NAME: SPI_MISO
TYPE: 43   VALUE: 00000002 (00000000)   NAME: SPI_MOSI
TYPE: 43   VALUE: 00000003 (00000000)   NAME: SPI_WPN
TYPE: 43   VALUE: 0000000C (00000000)   NAME: SPI_HOLDN
TYPE: 43   VALUE: 00000007 (00000000)   NAME: SPI_SCLK0
TYPE: 43   VALUE: 00000006 (00000000)   NAME: SPI_SCLK1
TYPE: 43   VALUE: 00000005 (00000000)   NAME: SPI_SCLK2
TYPE: 43   VALUE: 00000004 (00000000)   NAME: SPI_SCLK3
TYPE: 43   VALUE: 0000001D (00000000)   NAME: PIN_TRG_FSEL
TYPE: 43   VALUE: 00000003 (00000000)   NAME: BITMASK_CEN
TYPE: 43   VALUE: 000000F0 (00000000)   NAME: BITMASK_SCLK
TYPE: 43   VALUE: 000011FF (00000000)   NAME: BITMASK_SPI
TYPE: 47   VALUE: 00000000 (00000000)   NAME: STACK
TYPE: 45   VALUE: 00000000 (00000000)   NAME: BOARD_CONFIG
TYPE: 4A   VALUE: 00000038 (00000000)   NAME: SPI_PASM
TYPE: 4A   VALUE: 00000058 (00000020)   NAME: LOOP0^B^A^A^A
TYPE: 4A   VALUE: 000000B4 (0000007c)   NAME: HI_WPN
TYPE: 4A   VALUE: 000000BC (00000084)   NAME: HI_WPN_RET
TYPE: 4A   VALUE: 000000C0 (00000088)   NAME: LO_WPN
TYPE: 4A   VALUE: 000000C8 (00000090)   NAME: LO_WPN_RET
TYPE: 4A   VALUE: 000000CC (00000094)   NAME: LO_CEN
TYPE: 4A   VALUE: 000000D4 (0000009c)   NAME: LO_CEN_RET
TYPE: 4A   VALUE: 000000D8 (000000a0)   NAME: HI_CEN
TYPE: 4A   VALUE: 000000E0 (000000a8)   NAME: HI_CEN_RET
TYPE: 4A   VALUE: 000000E4 (000000ac)   NAME: INIT1
TYPE: 4A   VALUE: 0000010C (000000d4)   NAME: INIT1_RET
TYPE: 4A   VALUE: 00000110 (000000d8)   NAME: POWERON
TYPE: 4A   VALUE: 00000138 (00000100)   NAME: SKIP
^A^A^A
TYPE: 4A   VALUE: 0000014C (00000114)   NAME: POWERON_RET
TYPE: 4A   VALUE: 00000150 (00000118)   NAME: POWEROFF
TYPE: 4A   VALUE: 00000170 (00000138)   NAME: POWEROFF_RET
TYPE: 4A   VALUE: 00000174 (0000013c)   NAME: TRIGGER
TYPE: 4A   VALUE: 0000017C (00000144)   NAME: TRIGGER_MODE0
TYPE: 4A   VALUE: 000001A4 (0000016c)   NAME: TRIGGER_MODE3
TYPE: 4A   VALUE: 000001CC (00000194)   NAME: TRIGGER_RET
TYPE: 4A   VALUE: 000001D0 (00000198)   NAME: WRITE
TYPE: 4A   VALUE: 000001EC (000001b4)   NAME: WRITE_MODE3
TYPE: 4A   VALUE: 0000021C (000001e4)   NAME: WRITE_MODE0
TYPE: 4A   VALUE: 0000024C (00000214)   NAME: WRITE_3M_MODE0
TYPE: 4A   VALUE: 0000026C (00000234)   NAME: WRITE8_5M_MODE0
TYPE: 4A   VALUE: 000002F4 (000002bc)   NAME: WRITE8_10M_MODE0
TYPE: 4A   VALUE: 00000348 (00000310)   NAME: WRITE8_40M_MODE0
TYPE: 4A   VALUE: 0000036C (00000334)   NAME: WRITE_3M_MODE3
TYPE: 4A   VALUE: 0000038C (00000354)   NAME: WRITE8_5M_MODE3
TYPE: 4A   VALUE: 00000414 (000003dc)   NAME: WRITE8_10M_MODE3
TYPE: 4A   VALUE: 00000470 (00000438)   NAME: WRITE8_40M_MODE3
TYPE: 4A   VALUE: 0000049C (00000464)   NAME: WRITE_RET
TYPE: 4A   VALUE: 000004A0 (00000468)   NAME: READ
TYPE: 4A   VALUE: 000004BC (00000484)   NAME: READ_MODE3
TYPE: 4A   VALUE: 000004D8 (000004a0)   NAME: READ_MODE0
TYPE: 4A   VALUE: 000004F0 (000004b8)   NAME: READ_3M_MODE0
TYPE: 4A   VALUE: 00000518 (000004e0)   NAME: READ8_5M_MODE0
TYPE: 4A   VALUE: 000005A8 (00000570)   NAME: READ8_10M_MODE0
TYPE: 4A   VALUE: 00000610 (000005d8)   NAME: READ_3M_MODE3
TYPE: 4A   VALUE: 00000638 (00000600)   NAME: READ8_5M_MODE3
TYPE: 4A   VALUE: 000006C8 (00000690)   NAME: READ8_10M_MODE3
TYPE: 4A   VALUE: 0000072C (000006f4)   NAME: READ_RET
TYPE: 4A   VALUE: 00000730 (000006f8)   NAME: READY
TYPE: 4A   VALUE: 00000734 (000006fc)   NAME: MASK_TRIGGER
TYPE: 4A   VALUE: 00000738 (00000700)   NAME: MASK_SPI_AND_PNP
TYPE: 4A   VALUE: 0000073C (00000704)   NAME: MASK_SPI
TYPE: 4A   VALUE: 00000740 (00000708)   NAME: MASK_SCLK
TYPE: 4A   VALUE: 00000744 (0000070c)   NAME: MASK_CEN
TYPE: 4A   VALUE: 00000748 (00000710)   NAME: MASK_PNP
TYPE: 4A   VALUE: 0000074C (00000714)   NAME: MASK_MOSI
TYPE: 4A   VALUE: 00000750 (00000718)   NAME: MASK_MISO
TYPE: 4A   VALUE: 00000754 (0000071c)   NAME: MASK_HOLDN
TYPE: 4A   VALUE: 00000758 (00000720)   NAME: MASK_WPN
TYPE: 4A   VALUE: 0000075C (00000724)   NAME: FREQ_3M
TYPE: 4A   VALUE: 00000760 (00000728)   NAME: FREQ_5M
TYPE: 4A   VALUE: 00000764 (0000072c)   NAME: FREQ_10M
TYPE: 4A   VALUE: 00000768 (00000730)   NAME: FREQ_40M
TYPE: 4A   VALUE: 0000076C (00000734)   NAME: TIME_POWERUP
TYPE: 4A   VALUE: 00000770 (00000738)   NAME: TIME_LINESUP
TYPE: 4A   VALUE: 00000774 (0000073c)   NAME: TIME_POWERDOWN
TYPE: 4B   VALUE: 00000778 (00000740)   NAME: FUNCID
TYPE: 4B   VALUE: 00000778 (00000744)   NAME: FREQSPI
TYPE: 4B   VALUE: 00000778 (00000748)   NAME: P_STACK
TYPE: 4B   VALUE: 00000778 (0000074c)   NAME: P_READY
TYPE: 4B   VALUE: 00000778 (00000750)   NAME: P
TYPE: 4B   VALUE: 00000778 (00000754)   NAME: MASK_SPI_SEL
TYPE: 4B   VALUE: 00000778 (00000758)   NAME: MODE_SPI
TYPE: 4B   VALUE: 00000778 (0000075c)   NAME: MBIT
TYPE: 4B   VALUE: 00000778 (00000760)   NAME: NBIT
TYPE: 4B   VALUE: 00000778 (00000764)   NAME: VALUE
TYPE: 4B   VALUE: 00000778 (00000768)   NAME: TIMETARGET
TYPE: 4E   VALUE: 00000004 (00000000)   NAME: CFGBOARD
TYPE: 4E   VALUE: 00000008 (00000000)   NAME: MASK_SCLK_EN
TYPE: 4E   VALUE: 00000004 (00000000)   NAME: FREQ
TYPE: 4E   VALUE: 00000004 (00000000)   NAME: FREQ
TYPE: 4E   VALUE: 00000008 (00000000)   NAME: BITLENGTH
TYPE: 4E   VALUE: 0000000C (00000000)   NAME: BITMASK
TYPE: 4E   VALUE: 00000010 (00000000)   NAME: FID
TYPE: 4E   VALUE: 00000004 (00000000)   NAME: FREQ
TYPE: 4E   VALUE: 00000008 (00000000)   NAME: DATA_OUT
TYPE: 4E   VALUE: 0000000C (00000000)   NAME: MSBIT
TYPE: 4E   VALUE: 00000010 (00000000)   NAME: FID

Distilled longs: 0

OBJ bytes: 3105

_CLKMODE: 00
_CLKFREQ: 00B71B00

0000- 1C 00 AC 09 9C 08 0D 01 78 07 04 00 CD 07 00 00   ........x.......
0010- DD 07 00 00 FF 07 00 00 10 08 00 00 21 08 00 00   ............!...
0020- 32 08 00 00 43 08 00 00 54 08 00 00 65 08 00 00   2...C...T...e...
0030- 7A 08 00 00 8A 08 00 00 9C 08 1C 00 F0 A5 BF A0   z...............
0040- D2 A9 BF A0 0C A8 FF 80 D4 A7 BF A0 04 A8 FF 80   ................
0050- D4 AB BF 08 04 A8 FF 80 D4 AD BF 08 D3 A1 BF 08   ................
0060- 08 A0 7F EC 09 A0 7F 86 1A 7B EB 5C 0A A0 7F 86   .........{.\....
0070- 66 32 EA 5C 05 A0 7F 86 25 4E E8 5C 06 A0 7F 86   f2.\....%N.\....
0080- 28 54 E8 5C 07 A0 7F 86 22 48 E8 5C 08 A0 7F 86   (T.\...."H.\....
0090- 1F 42 E8 5C 02 A0 7F 86 36 8A E8 5C 03 A0 7F 86   .B.\....6..\....
00A0- 46 9C E8 5C 04 A0 7F 86 4F CA E8 5C 01 A0 7F 86   F..\....O..\....
00B0- 2B 6A E8 5C 08 00 7C 5C C8 E9 BF 68 D3 7D 3F 08   +j.\..|\...h.}?.
00C0- 00 00 7C 5C C8 E9 BF 64 D3 7D 3F 08 00 00 7C 5C   ..|\...d.}?...|\
00D0- C3 ED BF 68 D3 7D 3F 08 00 00 7C 5C C3 ED BF 64   ...h.}?...|\...d
00E0- D3 7D 3F 08 00 00 7C 5C BF E9 BF 64 BF ED BF 68   .}?...|\...d...h
00F0- C0 ED BF 64 C4 E9 BF 68 C1 E9 BF 64 C7 E9 BF 68   ...d...h...d...h
0100- 00 AC 7F 86 C2 E9 AB 64 C2 E9 97 68 D3 7D 3F 08   .......d...h.}?.
0110- 00 00 7C 5C D2 A9 BF A0 08 A8 FF 80 D4 A3 BF 08   ..|\............
0120- C4 ED 3F 62 40 00 54 5C C4 E9 BF 64 C4 ED BF 68   ..?b@.T\...d...h
0130- F1 B5 BF A0 CD B5 BF 80 00 B4 7F F8 D5 ED BF 68   ...............h
0140- F1 B5 BF A0 CE B5 BF 80 00 B4 7F F8 D3 7D 3F 08   .............}?.
0150- 00 00 7C 5C C1 ED BF 64 C4 E9 BF 68 00 00 00 00   ..|\...d...h....
0160- C4 ED BF 64 F1 B5 BF A0 CF B5 BF 80 00 B4 7F F8   ...d............
0170- D3 7D 3F 08 00 00 7C 5C 00 AC 7F 86 5B 00 54 5C   .}?...|\....[.T\
0180- BF E9 BF 68 BF E9 BF 64 C5 E9 BF 64 00 00 00 00   ...h...d...d....
0190- 00 00 00 00 F1 B5 BF A0 30 B4 FF 80 00 B4 FF F8   ........0.......
01A0- D3 7D 3F 08 65 00 7C 5C BF E9 BF 68 BF E9 BF 64   .}?.e.|\...h...d
01B0- C5 E9 BF 64 C2 E9 BF 64 00 00 00 00 F1 B5 BF A0   ...d...d........
01C0- 30 B4 FF 80 00 B4 FF F8 C2 E9 BF 68 D3 7D 3F 08   0..........h.}?.
01D0- 00 00 7C 5C D2 A9 BF A0 D4 A3 BF 08 04 A8 FF 80   ..|\............
01E0- D4 B3 BF 08 04 A8 FF 80 D4 AF BF 08 79 AC 7F EC   ............y...
01F0- C9 A3 3F 87 CD 00 78 5C 80 AE 7F 86 CD 00 54 5C   ..?...x\......T\
0200- CA A3 3F 87 D5 00 78 5C CB A3 3F 87 F7 00 78 5C   ..?...x\..?...x\
0210- FF B2 7F 85 00 B2 7F 86 0E 01 6C 5C F7 00 7C 5C   ..........l\..|\
0220- C9 A3 3F 87 85 00 78 5C 80 AE 7F 86 85 00 54 5C   ..?...x\......T\
0230- CA A3 3F 87 8D 00 78 5C CB A3 3F 87 AF 00 78 5C   ..?...x\..?...x\
0240- FF B2 7F 85 00 B2 7F 86 C4 00 6C 5C AF 00 7C 5C   ..........l\..|\
0250- D7 B3 3F 62 C5 E9 BF 7C C2 E9 BF 68 01 AE FF 2A   ..?b...|...h...*
0260- C2 E9 BF 64 85 00 54 5C D3 7D 3F 08 19 01 7C 5C   ...d..T\.}?...|\
0270- 80 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
0280- 40 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   @..b...|...h...d
0290- 20 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64    ..b...|...h...d
02A0- 10 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
02B0- 08 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
02C0- 04 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
02D0- 02 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
02E0- 01 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 C2 E9 BF 64   ...b...|...h...d
02F0- D3 7D 3F 08 19 01 7C 5C BF E9 BF 68 BF E9 BF 64   .}?...|\...h...d
0300- 80 B2 7F 62 C5 E9 BF 7C 00 00 00 00 40 B2 7F 62   ...b...|....@..b
0310- C5 E9 BF 7C 20 B2 7F 62 C5 E9 BF 7C 10 B2 7F 62   ...| ..b...|...b
0320- C5 E9 BF 7C 08 B2 7F 62 C5 E9 BF 7C 04 B2 7F 62   ...|...b...|...b
0330- C5 E9 BF 7C 02 B2 7F 62 C5 E9 BF 7C 01 B2 7F 62   ...|...b...|...b
0340- C5 E9 BF 7C D3 7D 3F 08 19 01 7C 5C BF E9 BF 68   ...|.}?...|\...h
0350- 00 00 00 00 C5 E9 BF 7C BF E9 BF 64 BF E9 BF 64   .......|...d...d
0360- 00 00 00 00 00 00 00 00 D3 7D 3F 08 19 01 7C 5C   .........}?...|\
0370- D7 B3 3F 62 C5 E9 BF 7C C2 E9 BF 64 01 AE FF 2A   ..?b...|...d...*
0380- C2 E9 BF 68 CD 00 54 5C D3 7D 3F 08 19 01 7C 5C   ...h..T\.}?...|\
0390- 80 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
03A0- 40 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   @..b...|...d...h
03B0- 20 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68    ..b...|...d...h
03C0- 10 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
03D0- 08 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
03E0- 04 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
03F0- 02 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
0400- 01 B2 7F 62 C5 E9 BF 7C C2 E9 BF 64 C2 E9 BF 68   ...b...|...d...h
0410- D3 7D 3F 08 19 01 7C 5C 80 B2 7F 62 BF E9 BF 68   .}?...|\...b...h
0420- BF E9 BF 64 C5 E9 BF 7C C2 E9 BF 64 00 00 00 00   ...d...|...d....
0430- 40 B2 7F 62 C5 E9 BF 7C 20 B2 7F 62 C5 E9 BF 7C   @..b...| ..b...|
0440- 10 B2 7F 62 C5 E9 BF 7C 08 B2 7F 62 C5 E9 BF 7C   ...b...|...b...|
0450- 04 B2 7F 62 C5 E9 BF 7C 02 B2 7F 62 C5 E9 BF 7C   ...b...|...b...|
0460- 01 B2 7F 62 C5 E9 BF 7C C2 E9 BF 68 D3 7D 3F 08   ...b...|...h.}?.
0470- 19 01 7C 5C BF E9 BF 68 00 00 00 00 C5 E9 BF 7C   ..|\...h.......|
0480- BF E9 BF 64 C2 E9 BF 64 BF E9 BF 64 00 00 00 00   ...d...d...d....
0490- 00 00 00 00 00 00 00 00 C2 E9 BF 68 D3 7D 3F 08   ...........h.}?.
04A0- 00 00 7C 5C D2 A9 BF A0 D4 A3 BF 08 04 A8 FF 80   ..|\............
04B0- D4 B1 BF 08 04 A8 FF 80 D4 AF BF 08 28 AD 7F EC   ............(...
04C0- C9 A3 3F 87 76 01 78 5C 08 B0 7F 86 CB A3 3F 85   ..?.v.x\......?.
04D0- A4 01 48 5C 80 01 60 5C 76 01 7C 5C C9 A3 3F 87   ..H\..`\v.|\..?.
04E0- 2E 01 78 5C 08 B0 7F 86 CB A3 3F 85 5C 01 48 5C   ..x\......?.\.H\
04F0- 38 01 60 5C 00 00 00 00 F2 8D 3F 61 01 B2 FF 34   8.`\......?a...4
0500- C2 E9 BF 68 C2 E9 BF 64 2E B1 FF E4 D7 B3 BF 60   ...h...d.......`
0510- D4 B3 3F 08 D3 7D 3F 08 BD 01 7C 5C F2 8D 3F 61   ..?..}?...|\..?a
0520- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0530- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0540- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0550- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0560- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0570- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0580- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 F2 8D 3F 61   ...4...h...d..?a
0590- 01 B2 FF 34 C2 E9 BF 68 C2 E9 BF 64 D7 B3 BF 60   ...4...h...d...`
05A0- D4 B3 3F 08 D3 7D 3F 08 BD 01 7C 5C BF E9 BF 68   ..?..}?...|\...h
05B0- BF E9 BF 64 00 00 00 00 00 00 00 00 00 00 00 00   ...d............
05C0- 00 00 00 00 F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61   ......?a...4..?a
05D0- 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61   ...4..?a...4..?a
05E0- 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61   ...4..?a...4..?a
05F0- 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61   ...4..?a...4..?a
0600- 01 B2 FF 34 D7 B3 BF 60 D4 B3 3F 08 D3 7D 3F 08   ...4...`..?..}?.
0610- BD 01 7C 5C 00 00 00 00 F2 8D 3F 61 01 B2 FF 34   ..|\......?a...4
0620- C2 E9 BF 64 C2 E9 BF 68 76 B1 FF E4 D7 B3 BF 60   ...d...hv......`
0630- D4 B3 3F 08 D3 7D 3F 08 BD 01 7C 5C C2 E9 BF 64   ..?..}?...|\...d
0640- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
0650- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
0660- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
0670- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
0680- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
0690- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
06A0- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 64   ...h..?a...4...d
06B0- C2 E9 BF 68 F2 8D 3F 61 01 B2 FF 34 D7 B3 BF 60   ...h..?a...4...`
06C0- D4 B3 3F 08 D3 7D 3F 08 BD 01 7C 5C BF E9 BF 68   ..?..}?...|\...h
06D0- BF E9 BF 64 00 00 00 00 C2 E9 BF 64 00 00 00 00   ...d.......d....
06E0- F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34   ..?a...4..?a...4
06F0- F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34   ..?a...4..?a...4
0700- F2 8D 3F 61 01 B2 FF 34 F2 8D 3F 61 01 B2 FF 34   ..?a...4..?a...4
0710- F2 8D 3F 61 01 B2 FF 34 C2 E9 BF 68 F2 8D 3F 61   ..?a...4...h..?a
0720- 01 B2 FF 34 D7 B3 BF 60 D4 B3 3F 08 D3 7D 3F 08   ...4...`..?..}?.
0730- 00 00 7C 5C 00 00 00 00 00 00 00 20 FF 15 00 00   ..|\....... ....
0740- FF 11 00 00 F0 00 00 00 03 00 00 00 00 04 00 00   ................
0750- 04 00 00 00 00 01 00 00 00 10 00 00 08 00 00 00   ................
0760- D5 DC 32 00 40 4B 4C 00 80 96 98 00 00 5A 62 02   ..2.@KL......Zb.
0770- 80 1A 06 00 80 38 01 00 00 09 3D 00 64 8B 18 81   .....8....=.d...
0780- 39 07 A3 00 64 06 0D 08 35 0D 0C 36 0D 0D 37 00   9...d...5..6..7.
0790- 0D 0D 37 21 0D 0D 0C 37 06 69 0C 38 C0 69 0C 38   ..7!...7.i.8.i.8
07A0- E0 69 0C 38 F0 69 0C 68 37 21 F3 EA 38 0C F3 EA   .i.8.i.h7!..8...
07B0- 37 00 F3 EA 43 37 01 D1 00 64 06 0D 07 43 38 05   7...C7...d...C8.
07C0- D1 43 35 37 01 1A 35 43 37 21 D1 34 C7 38 43 2C   .C57..5C7!.4.8C,
07D0- 32 36 43 37 21 D1 43 37 21 D0 35 FC 0B 02 04 76   26C7!.C7!.5....v
07E0- 32 64 43 37 00 D1 00 8B 18 80 06 0D 05 0A 10 36   2dC7...........6
07F0- 08 08 01 05 0C 01 05 04 09 78 01 05 0C 04 03 01   .........x......
0800- 05 0C 32 37 21 43 37 21 D1 43 37 21 D0 35 FC 0B   ..27!C7!.C7!.5..
0810- 02 04 76 32 37 01 43 37 21 D1 43 37 21 D0 35 FC   ..v27.C7!.C7!.5.
0820- 0B 02 04 76 32 38 05 43 37 21 D1 43 37 21 D0 35   ...v28.C7!.C7!.5
0830- FC 0B 02 04 76 32 38 06 43 37 21 D1 43 37 21 D0   ....v28.C7!.C7!.
0840- 35 FC 0B 02 04 76 32 37 22 43 37 21 D1 43 37 21   5....v27"C7!.C7!
0850- D0 35 FC 0B 02 04 76 32 37 02 43 37 21 D1 43 37   .5....v27.C7!.C7
0860- 21 D0 35 FC 0B 02 04 76 32 43 67 37 01 1E 43 37   !.5....v2Cg7..C7
0870- 21 D0 35 FC 0B 02 04 76 43 37 00 D0 33 32 43 67   !.5....vC7..32Cg
0880- 37 01 1E 43 37 21 D0 35 FC 0B 02 04 76 32 37 00   7..C7!.5....v27.
0890- 43 37 21 D1 43 37 21 D0 35 FC 0B 02 04 76 32 00   C7!.C7!.5....v2.
08A0- 10 01 0C 00 30 00 00 00 4B 00 00 00 53 00 00 00   ....0...K...S...
08B0- 65 00 00 00 75 00 00 00 8A 00 00 00 9F 00 00 00   e...u...........
08C0- BB 00 00 00 D1 00 00 00 FD 00 00 00 06 01 00 00   ................
08D0- 38 17 38 12 3E 92 E7 37 25 E8 61 37 00 62 43 38   8.8.>..7%.a7.bC8
08E0- 11 37 03 3E 92 37 21 E8 62 4A 32 64 37 21 E8 36   .7.>.7!.bJ2d7!.6
08F0- EC 33 32 38 64 00 64 05 02 36 0D 04 38 0B 33 0C   .328d.d..6..8.3.
0900- 37 03 33 0C 32 38 74 00 64 05 02 36 0D 03 34 33   7.3.28t.d..6..43
0910- 0C 35 33 0C 32 38 89 00 64 05 02 36 0D 08 64 37   .53.28..d..6..d7
0920- 06 E8 35 FB 33 0C 34 33 0C 32 38 9E 00 64 05 02   ..5.3.43.28..d..
0930- 36 0D 08 64 37 05 E8 35 FB 33 0C 35 33 0C 32 38   6..d7..5.3.53.28
0940- BA 00 64 05 02 36 0D 0E 64 37 03 E8 0A 04 35 33   ..d..6..d7....53
0950- 04 03 37 21 33 0C 37 21 33 0C 32 38 D0 00 64 05   ..7!3.7!3.28..d.
0960- 02 36 0D 09 64 38 0C E8 37 00 E2 33 0C 36 33 0C   .6..d8..7..3.63.
0970- 32 38 FC 00 64 05 02 36 0D 1C 38 F5 64 37 04 E8   28..d..6..8.d7..
0980- 38 05 E2 35 0D 04 36 0D 07 0C 3A 01 C2 00 33 0C   8..5..6...:...3.
0990- 39 E1 00 33 0C 0C 3A 01 C2 00 33 0C 32 64 3D D4   9..3..:...3.2d=.
09A0- 1C 64 3D D6 1C 32 64 3D D4 18 64 3D D6 1C 32 00   .d=..2d=..d=..2.
09B0- CE 5F 5F 43 4C 4B 46 52 45 51 10 00 B4 C4 04 50   .__CLKFREQ.....P
09C0- 4F 57 45 52 55 50 5F 53 50 49 10 80 1A 06 00 50   OWERUP_SPI.....P
09D0- 4F 57 45 52 55 50 5F 53 50 49 4C 49 4E 45 53 10   OWERUP_SPILINES.
09E0- 80 38 01 00 50 4F 57 45 52 44 4F 57 4E 5F 53 50   .8..POWERDOWN_SP
09F0- 49 10 00 09 3D 00 52 45 50 45 54 49 54 49 56 45   I...=.REPETITIVE
0A00- 5F 50 4F 57 45 52 55 50 10 01 00 00 00 46 55 4E   _POWERUP.....FUN
0A10- 43 49 44 5F 5F 52 45 41 44 59 10 00 00 00 00 46   CID__READY.....F
0A20- 55 4E 43 49 44 5F 5F 49 4E 49 54 31 10 01 00 00   UNCID__INIT1....
0A30- 00 46 55 4E 43 49 44 5F 5F 50 4F 57 45 52 4F 4E   .FUNCID__POWERON
0A40- 10 02 00 00 00 46 55 4E 43 49 44 5F 5F 50 4F 57   .....FUNCID__POW
0A50- 45 52 4F 46 46 10 03 00 00 00 46 55 4E 43 49 44   EROFF.....FUNCID
0A60- 5F 5F 54 52 49 47 47 45 52 10 04 00 00 00 46 55   __TRIGGER.....FU
0A70- 4E 43 49 44 5F 5F 4C 4F 5F 43 45 4E 10 05 00 00   NCID__LO_CEN....
0A80- 00 46 55 4E 43 49 44 5F 5F 48 49 5F 43 45 4E 10   .FUNCID__HI_CEN.
0A90- 06 00 00 00 46 55 4E 43 49 44 5F 5F 4C 4F 5F 57   ....FUNCID__LO_W
0AA0- 50 4E 10 07 00 00 00 46 55 4E 43 49 44 5F 5F 48   PN.....FUNCID__H
0AB0- 49 5F 57 50 4E 10 08 00 00 00 46 55 4E 43 49 44   I_WPN.....FUNCID
0AC0- 5F 5F 52 45 41 44 10 09 00 00 00 46 55 4E 43 49   __READ.....FUNCI
0AD0- 44 5F 5F 57 52 49 54 45 10 0A 00 00 00 46 55 4E   D__WRITE.....FUN
0AE0- 43 49 44 5F 5F 53 45 54 53 50 49 46 52 51 10 0B   CID__SETSPIFRQ..
0AF0- 00 00 00 47 4F 01 49 4E 49 54 00 50 4F 57 45 52   ...GO.INIT.POWER
0B00- 5F 4F 4E 01 50 4F 57 45 52 5F 4F 46 46 00 46 49   _ON.POWER_OFF.FI
0B10- 4E 41 4C 5F 54 52 49 47 47 45 52 00 43 48 49 50   NAL_TRIGGER.CHIP
0B20- 5F 45 4E 41 42 4C 45 00 43 48 49 50 5F 44 49 53   _ENABLE.CHIP_DIS
0B30- 41 42 4C 45 00 57 50 4E 5F 4C 4F 57 00 57 50 4E   ABLE.WPN_LOW.WPN
0B40- 5F 48 49 47 48 00 49 4E 04 4F 55 54 04 53 50 49   _HIGH.IN.OUT.SPI
0B50- 5F 50 4E 50 10 0A 00 00 00 53 50 49 5F 43 45 4E   _PNP.....SPI_CEN
0B60- 30 10 01 00 00 00 53 50 49 5F 43 45 4E 31 10 00   0.....SPI_CEN1..
0B70- 00 00 00 53 50 49 5F 4D 49 53 4F 10 08 00 00 00   ...SPI_MISO.....
0B80- 53 50 49 5F 4D 4F 53 49 10 02 00 00 00 53 50 49   SPI_MOSI.....SPI
0B90- 5F 57 50 4E 10 03 00 00 00 53 50 49 5F 48 4F 4C   _WPN.....SPI_HOL
0BA0- 44 4E 10 0C 00 00 00 53 50 49 5F 53 43 4C 4B 30   DN.....SPI_SCLK0
0BB0- 10 07 00 00 00 53 50 49 5F 53 43 4C 4B 31 10 06   .....SPI_SCLK1..
0BC0- 00 00 00 53 50 49 5F 53 43 4C 4B 32 10 05 00 00   ...SPI_SCLK2....
0BD0- 00 53 50 49 5F 53 43 4C 4B 33 10 04 00 00 00 50   .SPI_SCLK3.....P
0BE0- 49 4E 5F 54 52 47 5F 46 53 45 4C 10 1D 00 00 00   IN_TRG_FSEL.....
0BF0- 42 49 54 4D 41 53 4B 5F 43 45 4E 10 03 00 00 00   BITMASK_CEN.....
0C00- 42 49 54 4D 41 53 4B 5F 53 43 4C 4B 10 F0 00 00   BITMASK_SCLK....
0C10- 00 42 49 54 4D 41 53 4B 5F 53 50 49 10 FF 11 00   .BITMASK_SPI....
0C20- 00                                                .

______________________________________________________________________________
********************************************************* File starts here ***
Zerocat Chipflasher --- Flash free firmware, kick the Management Engine.

Copyright (C) 2020, 2021, 2022  Kai Mertens 

File serprog-SPI-PASM.spin --- access chip via SPI Bus

This file is part of Zerocat Chipflasher.

See end of file for terms of use.

******************************************************************************


# SPI Modes

    Mode#     CPOL (Clock Polarity)     CPHA (Clock Phase)
    -----     ---------------------     ------------------
    0         0                         0
    1         0                         1
    2         1                         0
    3         1                         1


## Mode Descriptions

Mode 0 --- The clock is active when HIGH. Data is written on the rising edge
of the clock. Data is read on the falling edge of the clock. (Default mode
for most SPI applications and chips.)

Mode 3 --- The clock is active when LOW. Data is written on the falling edge
of the clock.  Data is read on the rising edge of the clock.



# Object Summary

Object "../../firmware2/src/serprog-SPI-PASM" Interface:

PUB  go(cfgboard)
PUB  init
PUB  power_on(freq)
PUB  power_off
PUB  final_trigger
PUB  chip_enable
PUB  chip_disable
PUB  WPn_low
PUB  WPn_high
PUB  in(freq, bitlength, bitmask, fid)
PUB  out(freq, data_out, msbit, fid)

Program:  619 Longs
Variable: 7 Longs


# Objects

Load pin configuration object.


# Constants

Pin Configuration
  SPI_PNP
  SPI_CEn0
  SPI_CEn1
  SPI_MISO
  SPI_MOSI
  SPI_WPn
  SPI_HOLDn
  SPI_SCLK0
  SPI_SCLK1
  SPI_SCLK2
  SPI_SCLK3
  PIN_TRG_FSEL

SPI Bitmasks
  BITMASK_CEn
  BITMASK_SCLK
  BITMASK_SPI

SPI Power Up Timings in Milliseconds

  __CLKFREQ (80_000_000):
    fixed to 80MHz operation,
    should be set according to CLKFREQ value instead
  Measurements with Cin=10uF Tantalum, Cout=1000uF

  Model         |  POWERUP  |  Repetitive?  |  Decay?  |  POWERDOWN
  --------------|-----------|---------------|----------|-------------
  T60/MX        |  5.0ms    |  no           |  yes     |  2.0ms
  T60/SST       |  1.8ms    |  yes          |  yes     |  4.5ms
  T60/Atmel     |  1.6ms    |  no           |  yes     |  2.0ms
  T500/MX       |  2.0ms    |  no           |  no      | 50.0ms
  X230 64Mbit   |  instant  |  no           |  no      |  instant

  POWERUP_SPI (5ms):
    let voltage rise up on target board

  POWERUP_SPILINES (1ms):
    give lines some time to settle
    TODO: Check old settings (Power-up 30ms, Lines 25ms) for
          target GA-G41M-ES2L!

  POWERDOWN_SPI (50ms):
    a) blind out spikes on net Vcc_SPI (100us)
    b) let voltage come down on target board

  REPETITIVE_POWERUP (1)

ENUM t_FUNCID
  FUNCID__READY, must be zero
  FUNCID__init1
  FUNCID__poweron
  FUNCID__poweroff
  FUNCID__trigger
  FUNCID__lo_CEn
  FUNCID__hi_CEn
  FUNCID__lo_WPn
  FUNCID__hi_WPn
  FUNCID__read
  FUNCID__write
  FUNCID__setspifrq


# Variables

stack[]         --- Provide some stack space
board_config


# Functions

_________________
PUB  go(cfgboard)

Initialize board_config.
Initialize static parameter.
Launch PASM code into new cog: SPI_PASM

_________
PUB  init

Launch PASM routine: init1

___________________
PUB  power_on(freq)

Repetitive power on.

______________
PUB  power_off

Launch PASM routine: poweroff

__________________
PUB  final_trigger

Launch a final trigger to break endless loop.

________________
PUB  chip_enable

Launch PASM routine: lo_CEn

_________________
PUB  chip_disable

Launch PASM routine: hi_CEn

____________
PUB  WPn_low

Launch PASM routine: lo_WPn

_____________
PUB  WPn_high

Launch PASM routine: hi_WPn

______________________________________
PUB  in(freq, bitlength, bitmask, fid)

Launch PASM routine: read
Return value.

____________________________________
PUB  out(freq, data_out, msbit, fid)

Launch PASM routine: write


# PASM/Data

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  SPI_PASM --- PASM code entry

  Parameter:

  * stack[3] = function ID / Ready Flag
  * stack[4] = mask_SPI_SEL
  * stack[5] = mode_SPI


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  hi_WPn --- deassert WPn

  Description:

  Sets #WP high, disables hardware write protection (if any).
  Note timing.

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  lo_WPn --- assert WPn

  Description:

  Sets #WP low, enables hardware write protection (if configured).
  Note timing.

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  lo_CEn --- chip enable/select

  Description:

  Activates output, CE# goes low.
  Note timing.

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  hi_CEn --- chip disable/deselect

  Description:

  Uses tristate pin, as CE# goes high via pull-up.
  Note timing.

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  init1 --- initialize SPI bus

  Description:

  * set up free wheeling counter modules to provide high frequency clock rates
  * initialize SPI bus pins to be in tristate mode
  * clear SPI bus latches
  * disable hold function
  * initialize clock pins

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  poweron --- power SPI bus on

  Entry condition:

  * all SPI bus pins are in tristate mode
  * output latches are initialized
  * PNP MOSFET disabled, thus chip and #CE pull-up are not powered

  Power-up SPI bus:

  * activate PNP MOSFET, thus power chip on, with delay
  * activate SPI bus pins, with delay
  * the number of SPI clock driver pins is reduced for high frequencies

  Parameter:

  * stack[2] = targeted SPI frequency
  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  poweroff --- power off the SPI bus

  Description:

  Leaves Propeller pins in tristate condition,
  as they might be used by other cogs.

  Parameter:

  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  trigger --- trigger a final, dummy pulse train


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  write --- send a value to SPI bus

  Description:

  This routine starts with HUB instructions, which might take odd numbers
  of cycles. Are we just lucky that the code for high speed data transfer
  is in sync with the free wheeling clock modules? Do we have to expect an
  out-of-sync exception at some point in future??

  * Case msbit == 128 has been rolled out to speed up byte transfer.
  * Cases $00 and $ff have been rolled out to speed up byte transfer even
    more.

  Parameter:

  * stack[2] = most significant bit, i.e. 128 for a byte to transfer
  * stack[1] = data to transmit
  * stack[0] = freqSPI
  * stack[3] = function ID, will be set to 'ready' when done


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  read --- read a value from SPI bus, apply bitmask

  Description:

  This routine starts with HUB instructions, which might take odd numbers
  of cycles. Are we just lucky that the code for high speed data transfer
  is in sync with the free wheeling clock modules? Do we have to expect an
  out-of-sync exception at some point in future??

  Bit length 8 has been rolled out to speed up transfer, using a higher
  frequency.

  Parameter:

  * stack[2] = bitmask / return value
  * stack[1] = bitlength
  * stack[0] = freqSPI
  * stack[3] = function ID, will be set to 'ready' when done
  * stack[5] = SPI mode

  The return value is not cleared upon entry.
  Therefore, bitmask should correspond to bitlength,
  as higher bits are not neccessarily zero.


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  Named registers, initialized

  ready             --- used to flag valid data or end of function
  mask_TRIGGER      --- pin bit mask
  mask_SPI_AND_PNP  --- compound bit mask
  mask_SPI          --- compound bit mask
  mask_SCLK         --- compound bit mask
  mask_CEn          --- compound bit mask
  mask_PNP          --- pin bit mask
  mask_MOSI         --- pin bit mask
  mask_MISO         --- pin bit mask
  mask_HOLDn        --- pin bit mask
  mask_WPn          --- pin bit mask
  time_POWERUP
  time_LINESUP
  time_POWERDOWN


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  Named registers, reserved space, not initialized

  funcID          --- PASM function to call
  freqSPI         --- targeted SPI frequency
  p_stack         --- stack base address, as passed via PAR
  p_ready         --- pointer into stack, func ID and ready flag
  p               --- pointer into stack
  mask_SPI_SEL    --- selected pins of SPI Bus, i.e. different sets of clock pins
  mode_SPI
  mbit            --- most significant bit / bit mask
  nbit            --- number of bit
  value           --- in/out data
  timetarget      --- temporary future time stamp


******************************************************************************
Terms of Use:

Zerocat Chipflasher is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

Zerocat Chipflasher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License along
with Zerocat Chipflasher.  If not, see <http://www.gnu.org/licenses/>.

************************************************************** End of File ***