From c384851198f64949128272d91959bee2a5a48495 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 11 Jan 2023 16:07:37 +0800 Subject: [PATCH] fixBug --- ChipInfoDb.dedicfg | 21 ++++++++++++++++++++- FlashCommand.c | 8 ++++---- dpcmd.c | 9 +++------ project.c | 7 ++++--- usbdriver.c | 46 +++++++++++++++++++++++++++++++--------------- 5 files changed, 62 insertions(+), 29 deletions(-) diff --git a/ChipInfoDb.dedicfg b/ChipInfoDb.dedicfg index 303399a..ecf27eb 100755 --- a/ChipInfoDb.dedicfg +++ b/ChipInfoDb.dedicfg @@ -2,7 +2,7 @@ + length >> 9; + vInstruction[0] = (unsigned char)(pageNum & 0xff); // lowest byte of length : page number vInstruction[1] = (unsigned char)((pageNum >> 8) & 0xff); // highest byte of length: page number vInstruction[2] = (unsigned char)((pageNum >> 16) & 0xff); // reserved diff --git a/dpcmd.c b/dpcmd.c index f81701a..ada89b6 100755 --- a/dpcmd.c +++ b/dpcmd.c @@ -500,7 +500,7 @@ int main(int argc, char* argv[]) unsigned long r; char* env; - printf("\nDpCmd Linux 1.12.11.%02d Engine Version:\nLast Built on October 27 2021\n\n", GetConfigVer()); // 1. new feature.bug.configS + printf("\nDpCmd Linux 1.13.11.%02d Engine Version:\nLast Built on October 27 2021\n\n", GetConfigVer()); // 1. new feature.bug.configS g_ucOperation = 0; GetLogPath(g_LogPath); @@ -1311,12 +1311,9 @@ bool ListTypes(void) return Dedi_List_AllChip(); } bool CheckProgrammerInfo(void) -{ - //printf("evy-- CheckProgrammerInfo 1\n"); +{ if ((g_ucOperation & CHECK_INFO) != CHECK_INFO) - return false; - - //printf("evy-- CheckProgrammerInfo 2\n"); + return false; int dev_cnt = get_usb_dev_cnt(); unsigned int uiFPGAVer = 0; if (g_uiDevNum == 0) { diff --git a/project.c b/project.c index 49696a2..6662cf9 100755 --- a/project.c +++ b/project.c @@ -1153,10 +1153,11 @@ bool is_BoardVersionGreaterThan_5_0_0(int Index) } bool is_SF100nBoardVersionGreaterThan_5_5_0(int Index) -{ - if ((g_firmversion >= FIRMWARE_VERSION(5, 5, 0)) && strstr(g_board_type, "SF100") != NULL) +{ + if ((g_firmversion >= FIRMWARE_VERSION(5, 5, 0)) && strstr(g_board_type, "SF100") != NULL) return true; - return false; + + return false; } bool is_SF600nBoardVersionGreaterThan_6_9_0(int Index) diff --git a/usbdriver.c b/usbdriver.c index 31039ac..abf0c80 100755 --- a/usbdriver.c +++ b/usbdriver.c @@ -33,10 +33,9 @@ unsigned g_usb_busnum = -1; bool Is_NewUSBCommand(int Index) { - if (is_SF100nBoardVersionGreaterThan_5_5_0(Index) || is_SF600nBoardVersionGreaterThan_6_9_0(Index) || is_SF700(Index)) { - //printf("\n====>usbdriver.c ---- Is_NewUSBCommand(Index=%d) == ture\n",Index); + if (is_SF100nBoardVersionGreaterThan_5_5_0(Index) || is_SF600nBoardVersionGreaterThan_6_9_0(Index) || is_SF700(Index)) { return true; - } + } return false; } extern unsigned char GetFPGAVersion(int Index); @@ -66,8 +65,7 @@ void usb_db_init(void) } void AssignSF600orSF700var(int Index) -{ - //printf("\n===>usbdrive.c --- IsSF600\n"); +{ if (Index == -1) Index = DevIndex; @@ -86,20 +84,19 @@ void AssignSF600orSF700var(int Index) rq.Value = 0; rq.Index = 0; rq.Length = 32; - + if (InCtrlRequest(&rq, vBuffer, 32, Index) == SerialFlash_FALSE) - return; + return; memcpy(g_board_type, &vBuffer[0], 8); //memcpy(g_firmversion,&vBuffer[10],8); sscanf((char*)&vBuffer[8], "V:%d.%d.%d", &fw[0], &fw[1], &fw[2]); g_firmversion = ((fw[0] << 16) | (fw[1] << 8) | fw[2]); - if (strstr(g_board_type, "SF700") != NULL) - g_bIsSF700[Index] = true; - + if (strstr(g_board_type, "SF700") != NULL) + g_bIsSF700[Index] = true; else if (strstr(g_board_type, "SF600") != NULL) - { + { if (strstr(g_board_type, "SF600PG2") != NULL) { g_bIsSF600PG2[Index] = true; @@ -108,7 +105,7 @@ void AssignSF600orSF700var(int Index) { g_bIsSF600[Index] = true; } - } + } GetFPGAVersion(Index); @@ -199,11 +196,12 @@ int OutCtrlRequest(CNTRPIPE_RQ* rq, unsigned char* buf, unsigned long buf_size, int InCtrlRequest(CNTRPIPE_RQ* rq, unsigned char* buf, unsigned long buf_size, int Index) { - int requesttype; - int ret = 0; + unsigned int requesttype; + unsigned int ret = 0; if ((rq->Function != URB_FUNCTION_VENDOR_ENDPOINT) && ((g_bIsSF600[Index] == true) || (g_bIsSF700[Index] == true))) return true; + if (Index == -1) Index = DevIndex; @@ -229,7 +227,25 @@ int InCtrlRequest(CNTRPIPE_RQ* rq, unsigned char* buf, unsigned long buf_size, i printf("no device"); } - if (ret != buf_size) { + if (ret != 0 /*!= buf_size*/) + return ret; + else + { + +#if 0 + + printf("InCtrlRequest ---ret=%X\n",ret); + printf("evInCtrlRequesty ---Control Pipe output error!\n"); + printf("InCtrlRequest ---rq->Direction=%lX\n",rq->Direction); + printf("InCtrlRequest ---rq->Function=%X\n",rq->Function); + printf("InCtrlRequest ---rq->Request=%X\n",rq->Request); + printf("InCtrlRequest ---rq->Value=%X\n",rq->Value); + printf("InCtrlRequest ---rq->Index=%X\n",rq->Index); + printf("InCtrlRequest ---rq->Length=%lX\n",rq->Length); + printf("InCtrlRequest ---buf_size=%lX\n",buf_size); + printf("InCtrlRequest ---buf[0]=%X\n",buf[0]); + //printf("g_bIsSF600=%d\n",g_bIsSF600); +#endif printf("Control Pipe input error!\n"); return -1; }