This program below, i can sucessful run this problem once, but i call it
again my Visor Plateimun will halt.
I find it it halt in MemPtrNew(Databytes);
Can anyone tell me what does it wrong and how to correct it
Thank you
Edmond
static Err RcvSerialData(UInt16 Databytes)
{
UInt32 bytesRcvd,waitTime, totalRcvBytes = 0;
UInt16 dataLen = sizeof(UInt32);
Err error;
UInt8 * newRcvBuffer;
UInt8 * Imagedata;
newRcvBuffer = (UInt8*)MemPtrNew(Databytes);
Imagedata = (UInt8*)MemPtrNew(Databytes);
error = SrmSetReceiveBuffer(gPortID, newRcvBuffer,Databytes);
if (error == serErrBadPort || error == memErrNotEnoughSpace)
{
goto Exit;
}
waitTime = SysTicksPerSecond() +5 ;
WriteSerial((UInt8*)"RFil",4);
SrmReceive(gPortID, Imagedata,Databytes, waitTime, &error);
WriteSerial((UInt8*)"X",1);
DmCreateDatabaseFromImage (Imagedata);
WriteSerial((UInt8*)"Y",1);
Exit:
SrmSetReceiveBuffer(gPortID, 0L, 0);
MemPtrFree(newRcvBuffer); // Free the space.
MemPtrFree(Imagedata);
Databytes = 0;
return error;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/