Interconnectivity
Page 7 of 22
Firmware Programming Guide for PDIUSBD12
Philips Semiconductors - Asia Product Innovation Centre
Visit
http://www.flexiusb.com
3. Hardware Abstraction Layer
This layer contains the lowest layer functions that need to be changed on different CPU platforms.
void outportb(unsigned char port, unsigned char val);
void inportb(unsigned char port);
void dma_start(PIO_REQUEST pio)
All I/O access to PDIUSBD12 should be implemented by the first two functions above (outportb and inportb).
As for the last function, it is meant for implementing the "EPP DMA" function. The latter is for setting the EPP
page address and CPLD counter. This type of implementation can allow the system to be platform independent,
which means that the application's architecture can be used for platform other than 8051 or the PC.
For USB_EPP evaluation board, the dma_start() functions calls the 2 function below, which are not necessary to
be implemented in target application.
void eppAwrite(unsigned char A_data);
void program_cpld(unsigned short uSize, unsigned char bCommand);
4. PDIUSBD12 Command Interface
The following functions are defined as PDIUSBD12 command interface to simplify device programming. They
are simple implementations of the PDIUSBD12 command set, which is defined in the data sheet.
void D12_SetAddressEnable(unsigned char bAddress, unsigned char bEnable);
void D12_SetEndpointEnable(unsigned char bEnable);
void D12_SetMode(unsigned char bConfig, unsigned char bClkDiv);
void D12_SetDMA(unsigned char bMode);
unsigned short D12_ReadInterruptRegister(void);
unsigned char D12_SelectEndpoint(unsigned char bEndp);
unsigned char D12_ReadLastTransactionStatus(unsigned char bEndp);
void D12_SetEndpointStatus(unsigned char bEndp, unsigned char bStalled);
void D12_SendResume(void);
unsigned short D12_ReadCurrentFrameNumber(void);
unsigned char D12_ReadEndpoint(unsigned char endp, unsigned char * buf, unsigned char len);
unsigned char D12_WriteEndpoint(unsigned char endp, unsigned char * buf, unsigned char len);
void D12_AcknowledgeEndpoint(unsigned char endp);