
C Library Functions
Simulator Object Library Entry Points
MOTOROLA DSP SIMULATOR REFERENCE MANUAL 7-29
7.2.26 dsp_wport: Write DSP Port State
dsp_wport(device_index,port,mask,data,force)
int device_index; /* DSP device index to be affected by command */
int port; /* Port number to write */
unsigned long mask; /* Pin mask for this port */
unsigned long data; /* Port data value */
unsigned long force; /* Port forcing state */
This function forces data on a DSP device port from outside the device. The value sup-
plied in the data parameter contains the new input data to be written to the port. The value
supplied in the force parameter indicates which port bits are actually being driven as in-
puts to the device. The value supplied in the mask parameter specifies which pins in the
port are to be affected by this write; the other pins in the port remain in their previous state.
The port parameter acts as the index to the dev_var.xportval array. A list of port names
and the corresponding port index can be obtained using the Simulator’s "help port" and
"help periph" commands. The port index and mask value can also be obtained by using
the port name as a key when calling dsp_findport.
This function call can be paired with the dsp_rport function to simulate a port to port con-
nection between devices.
EXAMPLE
/* Write portb of device 1 from portb of device 0 */
int portnum;
unsigned long portbdata, portbforce;
unsigned long portmask;
dsp_startup();
dsp_new(0,"56116"); /* Allocate structure for device 0, a 56116 */
dsp_new(1,"56116"); /* Allocate structure for device 1, a 56116 */
dsp_findport(0,"portb",&portnum,&portmask);
dsp_rport(0,portnum,&portbdata,&portbforce)
dsp_wport(1,portnum,portmask,portbdata,portbforce)
Komentáře k této Příručce