Main Loop - Mainloop.c; Protocol Layer - Chap_9.C, Protodma.c; Porting The Firmware To Other Cpu Platform; Using The Firmware In Polling Mode - Philips PDIUSBD12 Firmware Programming Manual

Hide thumbs Also See for PDIUSBD12:
Table of Contents

Advertisement

Interconnectivity
Firmware Programming Guide for PDIUSBD12

2.1.4 Main Loop - MAINLOOP.C

The Main Loop checks the event flags and passes to appropriate subroutine for further processing. It also
contains the code for human interface, such as LED and key scan.

2.1.5 Protocol Layer - CHAP_9.C, PROTODMA.C

The Protocol layer handles standard USB device requests, as well as specific vendor requests such as DMA and
TWAIN.

2.2 Porting the Firmware to Other CPU Platform

Below table shows the modifications on building blocks need to be done. There are two levels of porting. First is
Chapter 9 only, which is only make the firmware to pass enumeration by supporting standard USB requests. The
second level is full product development, this will involve product specific firmware code.
File Name
Chapter 9 Only
EPPHAL.C
Port to hardware specific.
D12CI.C
No change.
CHAP_9.C
No change.
PROTODMA.C
No change.
ISR.C
No change.
MAINLOOP.C
Depends on the CPU and system,
ports, timer and interrupt initialization
need to be rewritten.
There are CPU and compiler dependent pre-definitions in MAINLOOP.H:
#ifdef __C51__
#define SWAP(x) ((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#else
#define SWAP(x) (x)
#define code
#define idata
#endif
Note the "SWAP" is necessary for micro-controllers, which are big endian format, such as 8031. The "code" and
"idata" is only necessary when using 8031 and Keil C compiler.

2.3 Using the Firmware in Polling Mode

It's very easy to use the firmware in polling mode. Inside the Main Loop, add following code:
if(interrupt_pin_low)
fn_usb_isr();
Normally ISR is initiated by hardware. In polling mode, the Main Loop detects interrupt pin's state, and invokes
ISR if necessary.
Philips Semiconductors - Asia Product Innovation Centre
Visit
http://www.flexiusb.com
Product Level
Port to hardware specific.
No change.
Product specific USB descriptors.
Add vendor request supports if necessary.
Add product specific processing on Generic and
Main endpoints.
Add product specific Main Loop processing.
Page 6 of 22

Advertisement

Table of Contents
loading

Table of Contents