Académique Documents
Professionnel Documents
Culture Documents
*/
#if defined(_WIN32)
#if !defined __BORLANDC__
#include "StdAfx.h"
#endif
#endif // defined(_WIN32)
#include "lpc21isp.h"
#ifdef AD_SUPPORT
#include "adprog.h"
if (memcmp(response.product_id, ANALOG_DEVICES_SYNC_RESPONSE,
ANALOG_DEVICES_SYNC_SIZE) == 0)
{
return;
}
else
{
DumpString(3, &response, sizeof(response),
"Unexpected response to sync attempt ");
}
}
else
{
DebugPrintf(3, "No (or incomplete) answer on sync attempt\n");
}
ClearSerialPortBuffers(IspEnvironment);
}
typedef struct {
char start1;
char start2;
BINARY bytes;
char cmd;
BINARY address_h;
BINARY address_u;
BINARY address_m;
BINARY address_l;
BINARY data[251];
} AD_PACKET;
checksum += packet->bytes;
checksum += cmd;
checksum += packet->address_l;
checksum += packet->address_m;
checksum += packet->address_u;
checksum += packet->address_h;
/* Copy the data bytes into the packet. We could use memcpy */
/* but we have to calculate the checksum anyway. */
for (i = 0; i < no_bytes; i++)
{
packet->data[i] = data_in[i];
checksum += data_in[i];
}
do {
retry++;
pages = 0;
DebugPrintf(2, "Erasing .. ");
AnalogDevicesFormPacket(IspEnvironment, 'E', 1, 0, &pages, &packet);
AnalogDevicesSendPacket(IspEnvironment, &packet);
DebugPrintf(2, "Erased\n");
}