Skip to content

GPIF Streaming

The GPIF (General Programmable Interface) engine in the Cypress FX2 provides a hardware-managed data path from the BCM4500 demodulator to the USB host. After initial setup, no firmware intervention occurs in the data path — the GPIF engine reads transport stream data directly into the EP2 FIFO, and the AUTOIN mechanism automatically commits full packets to the USB controller.

Cypress FX2 (CY7C68013A)
+-----------------------------+
| |
BCM4500 P3.5 TS_EN | GPIF Engine EP2 FIFO | USB 2.0 HS
Demodulator <-----------------+ (Master Read) (AUTOIN) +------------> Host
(I2C:0x08) GPIF Data Bus | 0xE4xx wfm 4x buf | EP2 (0x82)
-------------------> CTL/RDY pins 8-bit | Bulk IN
8-bit parallel TS | | 7 URBs x 8KB
+-----------------------------+

All values are identical across the three stock firmware versions (v2.06, Rev.2 v2.10, v2.13):

RegisterAddressValueFunction
IFCONFIG0xE6010xEEInternal 48 MHz clock, GPIF master, async, debug output
EP2FIFOCFG0xE6180x0CAUTOIN=1, ZEROLENIN=1, 8-bit data path
REVCTL0xE60B0x03NOAUTOARM + SKIPCOMMIT
CPUCS0xE600bits [4:3]=1048 MHz CPU clock
FLOWSTATEA0xE668OR 0x09FSEN (flow state enable) + FS[3]
GPIFIE0xE65COR 0x3DWaveform, TC, DONE, FIFO flag, WF2 interrupts
BitNameValueMeaning
7IFCLKSRC1Internal clock source
63048MHZ148 MHz IFCLK frequency
5IFCLKOE1IFCLK pin drives output (clock to BCM4500)
4IFCLKPOL0Non-inverted clock polarity
3ASYNC1Asynchronous GPIF (RDY pin handshaking)
2GSTATE1Debug state output on PORTE
1:0IFCFG10GPIF internal master mode

The FX2 operates as a GPIF master, reading data from the BCM4500’s parallel transport stream output. Asynchronous mode means the GPIF uses RDY pin handshaking rather than clock-edge sampling.

BitNameValueMeaning
4INFM10Packet count not decremented
3AUTOIN1Auto-commit IN packets when FIFO buffer full
2ZEROLENIN1Allow zero-length IN packets
1(reserved)0
0WORDWIDE08-bit data path (not 16-bit)

The AUTOIN bit is critical: when the GPIF fills an EP2 FIFO buffer to the configured packet size, the FX2 hardware automatically arms the buffer for USB transfer.

The GPIF waveform descriptors occupy 128 bytes at 0xE400-0xE47F and are loaded from a compressed init table during firmware startup. The waveform programs a straightforward read cycle:

States 0-5: CTL outputs = 0x01 (control line asserted), 1 IFCLK each
State 6: CTL = 0x07, length = 0 (idle/terminate)
Opcode: 0x00 (SDP = sample data point)
Output: 0xF0 (FIFO write flags)

This encodes a simple “assert read strobe, capture data, de-assert” cycle that reads one byte per GPIF transaction from the BCM4500’s parallel port into the EP2 FIFO.

All endpoint FIFOs are reset during initialization using the Cypress-prescribed procedure:

FIFO Reset (FUN_CODE_10d9)
FIFORESET = 0x80; // NAKALL: NAK all host transfers during reset
// 3-NOP SYNCDELAY
FIFORESET = 0x02; // Reset EP2 FIFO
// 3-NOP SYNCDELAY
FIFORESET = 0x04; // Reset EP4 FIFO
// 3-NOP SYNCDELAY
FIFORESET = 0x06; // Reset EP6 FIFO
// 3-NOP SYNCDELAY
FIFORESET = 0x08; // Reset EP8 FIFO
// 3-NOP SYNCDELAY
FIFORESET = 0x00; // Release NAKALL

The triple-NOP delays (mandatory SYNCDELAY) between writes are required by the FX2 architecture: XRAM register writes take 2 cycles to propagate, and back-to-back writes to the same register need at least 3 instruction cycles.

The host issues vendor command 0x85 to start or stop the MPEG-2 transport stream. The handler checks the configuration status byte bit 0 (demodulator active) before proceeding.

When wValue=1 and the demodulator is active:

  1. Set streaming flag — config_byte bit 7 = 1 (bmArmed).

  2. Load GPIF transaction count — GPIFTCB3:2 = 0x8000 (2 GB, effectively infinite).

  3. Reset address and byte count — Clear GPIF address registers and EP2 FIFO byte count.

  4. Assert TS_EN — P3.5 LOW (BCM4500 transport stream output enabled).

  5. Wait for initial GPIF transaction — Poll GPIFTRIG bit 7 (DONE) until set.

  6. De-assert TS_EN — P3.5 HIGH.

  7. Trigger continuous GPIF read — GPIFTRIG = 0x04 (read direction, EP2 select).

  8. Set streaming indicator — P0.7 LOW.

Start Streaming (Rev.2 at CODE:0D84)
ORL 0x4e, #0x80 ; config_byte |= 0x80 (streaming flag)
MOV DPTR, #0xE630 ; GPIFTCB3
MOV A, #0x80
MOVX @DPTR, A ; GPIFTCB3 = 0x80 (huge transaction count)
; ... address/FIFO reset ...
ANL 0xb0, #0xDF ; P3 &= 0xDF -> P3.5 = 0 (TS_EN assert)
; Poll GPIFTRIG.DONE ...
ORL 0xb0, #0x20 ; P3 |= 0x20 -> P3.5 = 1
MOV 0xbb, #0x04 ; GPIFTRIG = 0x04 (read EP2)
ANL 0x80, #0x7F ; P0 &= 0x7F -> P0.7 = 0 (streaming)

INT4 and INT6 (GPIF/FIFO events) share a common handler that sets a software flag and clears EXIF.4:

GPIF Interrupt Handler (Rev.2 at CODE:2084)
PUSH A
PUSH DPH
PUSH DPL
SETB 0x01 ; Set GPIF event flag (_0_1)
ANL 0x91, #0xEF ; Clear EXIF.4 (INT4/INT6 IRQ flag)
MOV DPTR, #0xE65D ; GPIFIRQ
MOV A, #0x01
MOVX @DPTR, A ; Clear GPIFIRQ bit 0
POP DPL
POP DPH
POP A
RETI

The main loop polls this flag, enters CPU idle mode (PCON.0) between events, and checks EP2CS for buffer availability before re-arming the GPIF. The FLOWSTATE engine (FSEN=1) automatically re-triggers GPIF transactions when EP2 buffers become available.

BitNameEnabledPurpose
0GPIFWFYesWaveform completion interrupt
1(reserved)No
2GPIFTCEXPYesTransaction count expired
3GPIFGPIFDONEYesGPIF operation done
4GPIFFFYesFIFO flag interrupt
5GPIFWF2YesWaveform 2 completion
MetricValue
USB 2.0 HS bulk (theoretical)480 Mbps
USB 2.0 HS bulk (practical)~280 Mbps (~35 MB/s)
GPIF engine (theoretical)48 MHz x 8 bits = 384 Mbps
Typical DVB-S TS rate1—5 MB/s
Maximum DVB-S2 rate (hypothetical)~7.25 MB/s (58 Mbps)

The USB/GPIF path has approximately 5x headroom even at the maximum theoretical data rate. The bottleneck for all supported modes is the satellite link, not the USB data path.

ParameterValue
GPIF clock48 MHz internal
CPU clock48 MHz
GPIF modeAsynchronous (RDY pin handshaking)
NOP delays3 NOPs between XRAM writes (~62.5 ns at 48 MHz)
EP2 buffer commitAutomatic via AUTOIN on FIFO fullness
GPIF re-triggerAutomatic via FLOWSTATE when EP2 buffer space available

The GPIF streaming path is functionally identical across all three firmware versions. Only code addresses differ due to recompilation:

Aspectv2.06v2.13 FW1Rev.2 v2.10
ARM_TRANSFER handlerCODE:0110CODE:0110CODE:00FA
GPIF control functionCODE:1919CODE:1800CODE:0D7C
Config byte IRAM0x6D0x4F0x4E
EP2FIFOCFG value0x0C0x0C0x0C
IFCONFIG value0xEE0xEE0xEE
FLOWSTATEA settingOR 0x09OR 0x09OR 0x09