Download Reference Manual
Transcript
Library Function Descriptions
#include "simcom.h"
#include "protocom.h"
void *dsp_alloc(nbytes,clearmem)
unsigned int nbytes;/* Number of bytes to allocate */
int clearmem;/* Clear allocated memory */
dsp_alloc() allocates the number of bytes of memory specified in nbytes. The
memory block allocated is aligned for use as any data type. If clearmem is true (nonzero),
the allocated memory is cleared to zero.
The address of the allocated buffer is returned as the return value, type void*.
If the requested memory cannot be allocated, the error message "Insufficient
memory: dsp_alloc" is output, and the return value is the NULL pointer. See
Example 14-25.
Example 14-25. dsp_alloc()
/* Allocate temporary buffer of 50 int. Buffer is cleared. */
#include "simcom.h"
#include "protocom.h"
int *tbptr
tbptr = (int *) dsp_alloc(50*sizeof(int), 1)
if (tbptr == NULL)
{...handle error...
14.2.26 dsp_cc_fmem—Fill Command Converter Memory with a Value
#include "simcom.h"
#include "protocom.h"
#include "cc.h"
#include "coreaddr.h"
int dsp_cc_fmem(device, mtype, address, count, value)
int device;/* Command Converter affected by command */
enum memory_map mtype;/* Memory space to fill */
unsigned long address;/* Address of start of memory block */
unsigned long count;/* Length of memory block */
unsigned long *value;/* Fill value */
dsp_cc_fmem() initializes a block of memory in the Command Converter device
starting at address address, length count, in address space mtype with the value
pointed to by value.
Valid values for mtype are:
• DSP_CC_YMEM
• DSP_CC_XMEM
• DSP_CC_PMEM
Motorola
Library Functions
14-29