Download Reference Manual

Transcript
Library Function Descriptions
Example 14-36. dsp_findmem()
/* Get map index for memory space "P" */
#include "simcom.h"
#include "protocom.h"
#include "coreaddr.h"
int devn;
enum memory_map map;
int ok;
devn=0;
dsp_new(devn,"56002");/* Allocate structure for device 0, a 56002 */
ok=dsp_findmem(devn,"P",&map)/* Get memory map index for "P" memory */
14.2.37 dsp_findreg—Get Peripheral and Register Index
#include "simcom.h"
#include "protocom.h"
dsp_findreg(device_index,reg_name,periph_number,reg_number)
int device_index;
/* DSP device index to be affected by command */
char *reg_name;/* register name */
int *periph_number;/* return peripheral index */
int *reg_number;/* return register index */
dsp_findreg() searches the dt_var.periph structures for a match to the reg_name
string provided in the function call. If a match is found, dsp_findreg() returns the
peripheral index through periph_number, the register number through the reg_number
parameter, and 1 as the function return value; otherwise it just returns 0 as the function
return value.
You may also use the emulator "help reg" command to obtain a list of the valid
periph_num and reg_num values, and reg_val size for each register. See
Example 14-37.
Example 14-37. dsp_findreg()
/* Get peripheral index and register number for register ’n3’ */
#include "simcom.h"
#include "protocom.h"
int devn;
int regnum, pnum;
int ok;
devn=0;
dsp_new(devn,"56002");/* Allocate structure for device 0, a 56002 */
ok=dsp_findreg(devn,"n3",&pnum,&regnum);/* Get index for "n3" register
*/
14-38
Suite56 ADS Debugger User’s Manual
Motorola