I have two UInt16 pointers and i want to use the armlet to
copy data from one pointer to another.  It crashes badly.

typedef struct _MyUserData {
  UInt16 *source;
  UInt16 *dest;
 } MyUserData


// armlet code
int copy_data_arm(MyUserData *userData)
{
 unsigned short i, j;
 char *source = (char *)ByteSwap32(userData->source),
  *dest = (char *)ByteSwap32(userData->dest);
 
   
 for (i= 0; i< 320 ; i++)
 {
  for (j= 0; j< 320; j++)
  {
   *dest = *source;
   ++bufferPtr;
   ++dest;
  }
 }
}

// 68k code calling the above code

// assumed valid data

UInt16 *sourceData, *destData;


void arm_copy_bitmap(int offsetx, int offsety)
{
 UInt32 processor;
 MyUserData *myUserData1 = NULL;
  
 myUserData1=(MyUserData *)MemPtrNew(sizeof(MyUserData));
 if (!myUserData1)
  return;
  
 myUserData1->source = sourceData;
 myUserData1->dest = destData;
 
 // call the ARMlet
 FtrGet(sysFtrCreator, sysFtrNumProcessorID, &processor);

 if (sysFtrNumProcessorIsARM(processor))
 {
  MemHandle mh;
  NativeFuncType *armlet;
  UInt32 result;
  
  mh = DmGetResource('ARMC', 1);
  *armlet = (NativeFuncType *)MemHandleLock(mh);

  result = PceNativeCall(armlet, myUserData1);
  MemHandleUnlock(mh);
  DmReleaseResource(mh);
 }
 MemPtrFree(myUserData1);
 myUserData = NULL;
}

thanks







-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to