IBM ECS-320A Benutzerhandbuch

Seite von 63
S
ERIAL 
I
NTERFACE 
D
EVELOPERS 
G
UIDE
 
 
… 
// Wait until DSP is ready for next command 
 
status = GetPCMStatus(m_hComPCM); 
 
 
// Send Focus Motor Far Command 
 
retVal = McbSendAppCmd( 
  m_hComPCM, 
  (BYTE)CMD_FOCUS_MOTOR_FAR, 
  0, 
  NULL 
 ); 
 
 
// If failed we need to break 
 if 
(FAILED(retVal)) 
 { 
  tStr.Format(IDS_PC_MSTR_ERROR, 
retVal); 
  DoMessageBox(tStr, 
MB_OK, 
0); 
 } 
… 
 
 
Notes: 
•  The third argument of the call ‘McbSendAppCmd’ is set to zero and the fourth argument is 
NULL.  That is because this command requires no additional data for the command to perform 
its task. 
•  Several of the commands refer to the ‘scratch pad’ buffer.  The scratch pad buffer is fixed at 
memory location 0x00C0 and has a length of 160 16-bit words (320 bytes).  This gives the 
embedded application a place to temporarily store large amounts of data without having to 
break up serial flash, NUC flash, or utility memory reads/writes while trying to interface with 
the host. 
•  Some of the commands are part of a multi-command/function sequence to achieve the 
desired result.  For example it takes two commands to read memory from the serial data flash.  
The first command takes the serial data flash address and the data transfer size as an 
argument, reads the appropriate flash page, and places the data read into a global ‘scratch 
pad’ buffer.  The second command (function) calls the standard ‘McbReadDataMem’ to 
retrieve the data from the ‘scratch pad’ buffer into a local host buffer. 
•  The base data type for the PC side is 32-bit.  The DSP on the other hand has a base of 16-
bits.  Bit fields are used as often as possible to provide efficient access to register values and 
configuration parameters.  Also with the bit manipulation capability of the DSP it creates more 
efficient code for the embedded application.  But the size difference between the base data 
types makes it difficult to use the same structures on both platforms.  The structures that are 
listed in this document are pulled from the code on the PC side.  This means that some data 
members are listed just as UWord16 instead of being cast to a 16-bit data structure.  So bit 
fields within some data members will need a different method of extracting values (masking, 
cast after read, etc.). 
5.3.1 CMD_COPY_SFLASH_PAGE 
Description:  Copy a page of serial flash memory to the DSP scratch pad buffer.  Serial flash pages 
are 264 bytes long.  The serial flash is used to store operational mode descriptor tables, NUC mode 
descriptor tables, vide palettes, overlay palettes, FPGA configuration files, and other additional items. 
Command Code: Enumeration for CMD_COPY_SFLASH_PAGE 
Argument Size: size of UWord16 
Argument: Page number to be copied (0 - 4095) 
Note: Use the McbReadDataMem function to read data from scratch pad.