static FlashType flashType = FLASH_INVALID;
static uint32_t manId = 0;
-static const char trbflash_version[] = "$Revision: 2.16 $";
+static const char trbflash_version[] = "$Revision: 2.17 $";
static uint32_t mdcFlashSelect = 1;
free(imageBuffer);
}
-static int readSetupRegister(uint16_t trb_address,
- uint8_t value[NUM_ENDPOINTS])
-{
- unsigned int ctr = 0;
- int status = -1;
- int c;
- int i;
-
- /* Wait until NoMoreData is withdrawn */
- do {
- if ((status = trb_register_read(trb_address, SetupReg,
- trbBuffer, TRB_BUFFER_SIZE)) == -1) {
- fprintf(logFile, "Error > readSetupRegister: TRBNet %s\n",
- trb_strerror(trb_errno));
- return -1;
- }
-
- /* Check timeout */
- if (ctr >= timeout) {
- fprintf(logFile, "Error > readSetupRegister: timeout\n");
- return -1;
- }
- ctr++;
- } while (trb_term.status_channel == 0x04);
-
- if (trb_term.status_channel != 0) {
- fprintf(logFile, "Error > readSetupRegister: invalid Status returned %s\n",
- trb_strerror(trb_errno));
- return -1;
- }
-
- if (status <= 0) {
- fprintf(logFile, "Error > readSetupRegister: invalid length returned\n");
- return -1;
- }
-
- c = 0;
- for (i = 1; i < status; i += 2) {
- if (value != NULL) value[c] = (uint8_t)((trbBuffer[i] >> 24) & 0xff);
- c++;
- }
-
- return c;
-}
-
static int writeSetupRegister(uint16_t trb_address, uint8_t value)
{
unsigned int ctr = 0;
/* Overwrite Header with 0xff */
end = 0;
for (i = 0; i < 2 * PAGE_SIZE; i++) {
- if (strncmp(imageBuffer + i, "Bitstream CRC: 0x", 17) == 0) {
+ if (strncmp((char*)(imageBuffer + i), "Bitstream CRC: 0x", 17) == 0) {
end = i + 22;
break;
}
static int createInfoPage(const char* fileName, const char* userString)
{
- char* buffer = imageBuffer + (NUM_PAGES - 1) * PAGE_SIZE;
+ char* buffer = (char*)(imageBuffer + (NUM_PAGES - 1) * PAGE_SIZE);
struct stat statBuf;
unsigned int i;
exit(EXIT_FAILURE);
}
-#ifndef TRB_RPC
if (init_ports() == -1) {
trb_error("Init_Ports");
exit(EXIT_FAILURE);
}
-#else
- trb_connect(NULL);
-#endif
atexit(atexit0);
fprintf(stdout, "\nEndPoint: 0x%04x InfoPage\n",
pageBufferAddress[i]);
if (
- (strncmp(pageBuffer[i] + 0, "NAME:", 5) != 0) ||
- (strncmp(pageBuffer[i] + 64, "DATE:", 5) != 0) ||
- (strncmp(pageBuffer[i] + 96, "USER:", 5) != 0)
+ (strncmp((char*)(pageBuffer[i] + 0), "NAME:", 5) != 0) ||
+ (strncmp((char*)(pageBuffer[i] + 64), "DATE:", 5) != 0) ||
+ (strncmp((char*)(pageBuffer[i] + 96), "USER:", 5) != 0)
) {
fprintf(stdout, "INVALID CONTENT\n");
continue;