Skip to content

Commit

Permalink
20170922 :
Browse files Browse the repository at this point in the history
Commit changed files to github. We add the "--device" command to let the user to assign the device number to work.
  • Loading branch information
root committed Sep 22, 2017
1 parent 8794481 commit 8c9de3a
Show file tree
Hide file tree
Showing 22 changed files with 1,020 additions and 578 deletions.
Empty file modified 60-dediprog.rules
100644 → 100755
Empty file.
Empty file modified ChipInfoDb.dedicfg
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion ChipInfoDb.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int ChipInfoDbFindItem(CHIP_INFO ChipInfoDb[], int NumberOfItems, long JedecDevi
void ChipInfoDump(long JedecDeviceIDToFind);

long ChipInfoDumpChipSizeInKByte(long Jedec);
int Dedi_Search_Chip_Db_ByTypeName(char* TypeName, CHIP_INFO *Chip_Info, int search_all);
int Dedi_Search_Chip_Db_ByTypeName(char* TypeName, CHIP_INFO *Chip_Info, int Index);
void getExecPath(char* Path);


Expand Down
5 changes: 2 additions & 3 deletions FlashCommand.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int FlashCommand_TransceiveIn(unsigned char *v, int len, int Index)


int FlashCommand_SendCommand_OutOnlyInstruction(unsigned char *v, int len, int Index)
{
{
return FlashCommand_TransceiveOut(v, len,NO_RESULT_IN, Index);
}

Expand Down Expand Up @@ -145,8 +145,7 @@ int FlashCommand_SendCommand_SetupPacketForBulkWrite(struct CAddressRange *AddrR
rq.Value = (unsigned short)(AddrRange->start & 0xffff) ; //16 bits LSB
rq.Index = (unsigned short)((AddrRange->start >> 16) & 0xffff) ; //16 bits MSB
rq.Length = (unsigned long)(5) ;
}

}
// send rq via control pipe
return OutCtrlRequest(&rq, vInstruction, rq.Length,Index);
}
Expand Down
2 changes: 1 addition & 1 deletion FlashCommand.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ int FlashCommand_SendCommand_SetupPacketForAT45DBBulkWrite(struct CAddressRange

int FlashCommand_SendCommand_SetupPacketForBulkRead(struct CAddressRange *AddrRange, unsigned char modeRead,unsigned char ReadCom,int Index);

#endif //FLASHCOMMANDS
#endif //FLASHCOMMANDS
Empty file modified IntelHexFile.c
100644 → 100755
Empty file.
Empty file modified IntelHexFile.h
100644 → 100755
Empty file.
Empty file modified Macro.h
100644 → 100755
Empty file.
Empty file modified MotorolaFile.c
100644 → 100755
Empty file.
Empty file modified MotorolaFile.h
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions SerialFlash.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ unsigned int g_AT45_PageSizeMask=0;
size_t AT45ChipSize=0;
size_t AT45PageSize=0;
bool AT45doRDSR(unsigned char* cSR, int Index)
{
unsigned char Out=0xD7;
{
CNTRPIPE_RQ rq ;
unsigned char vInstruction; //size 1

Expand Down Expand Up @@ -1245,7 +1244,7 @@ int SerialFlash_Enable4ByteAddrMode(int bEnable,int Index)
// strstr(Chip_Info.Class,SUPPORT_NUMONYX_N25Qxxx_Large_4Die) != NULL)
return CN25Qxxx_LargeEnable4ByteAddrMode(bEnable, Index);

return SerialFlash_TRUE;
return SerialFlash_TRUE;
}


Expand Down Expand Up @@ -1525,6 +1524,7 @@ int SerialFlash_chipErase(int Index)
return AT45chipErase(0, Chip_Info.ChipSizeInByte, Index);

if( SerialFlash_protectBlock(false,Index) == SerialFlash_FALSE) return false ;

SerialFlash_waitForWEL(Index) ;
unsigned char v = mcode_ChipErase;
FlashCommand_SendCommand_OutOnlyInstruction(&v,1,Index);
Expand Down
3 changes: 3 additions & 0 deletions SerialFlash.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#define SerialFlash_FALSE -1
#define SerialFlash_TRUE 1

#ifdef _NON_UBUNTU
typedef unsigned long uintptr_t;
#endif
//#define size_t unsigned int

enum //list of all chip-specific instruction, for ST serial flash
Expand Down
59 changes: 32 additions & 27 deletions board.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void QueryBoard(int Index)
{
// printf("QueryBoard\r\n");
return;
if(!Is_usbworking())
if(!Is_usbworking(Index))
{
printf("Do not find SFxx programmer!!\n");
return ;
Expand Down Expand Up @@ -148,7 +148,7 @@ bool SetTargetFlash(unsigned char StartupMode,int Index)

bool SetLEDProgBoard(size_t Color,int Index)
{
if(! Is_usbworking())
if(! Is_usbworking(Index))
{
return false;
}
Expand Down Expand Up @@ -195,23 +195,28 @@ bool SetRedLEDOn(bool boOn, int Index)

bool SetLEDOnOff(size_t Color,int Index)
{
bool result=true;
switch(Color)
{
case SITE_ERROR:
return SetRedLEDOn(true,Index);
result&=SetRedLEDOn(true,Index);
break;
case SITE_BUSY:
return SetOrangeLEDOn(true,Index);
result&=SetOrangeLEDOn(true,Index);
break;
case SITE_OK:
return SetGreenLEDOn(true,Index);
result&=SetGreenLEDOn(true,Index);
break;
case SITE_NORMAL:
return SetLEDProgBoard(0x0709,Index);// Turn off LED
}
return false;
result&=SetLEDProgBoard(0x0709,Index);// Turn off LED
break;
}
return result;
}

bool SetCS(size_t value,int Index)
{
if(! Is_usbworking())
if(! Is_usbworking(Index))
{
return false;
}
Expand All @@ -235,7 +240,7 @@ bool SetCS(size_t value,int Index)

bool SetIOModeToSF600(size_t value,int Index)
{
if(! Is_usbworking())
if(! Is_usbworking(Index))
{
return false;
}
Expand All @@ -259,16 +264,16 @@ bool SetIOModeToSF600(size_t value,int Index)

bool BlinkProgBoard(bool boIsV5,int Index)
{
if(! Is_usbworking() )
if(! Is_usbworking(Index) )
{
return false;
}

SetGreenLEDOn(true,0);
SetGreenLEDOn(true,Index);

Sleep(500);

SetGreenLEDOn(false,0);
SetGreenLEDOn(false,Index);

return true;
}
Expand Down Expand Up @@ -300,9 +305,9 @@ bool ReadOnBoardFlash(unsigned char* Data,bool ReadUID,int Index)
memcpy(Data,vBuffer,16);
}

bool LeaveSF600Standalone(bool Enable,int USBIndex)
bool LeaveSF600Standalone(bool Enable,int Index)
{
if(! Is_usbworking())
if(! Is_usbworking(Index))
{
return false;
}
Expand All @@ -316,7 +321,7 @@ bool LeaveSF600Standalone(bool Enable,int USBIndex)
rq.Index = RFU ;
rq.Length = 0 ;

if(OutCtrlRequest(&rq,&vBuffer,0,USBIndex)==SerialFlash_FALSE)
if(OutCtrlRequest(&rq,&vBuffer,0,Index)==SerialFlash_FALSE)
{
return false;
}
Expand All @@ -326,7 +331,7 @@ bool LeaveSF600Standalone(bool Enable,int USBIndex)

bool SetSPIClockValue(unsigned short v,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

// send request
Expand All @@ -347,7 +352,7 @@ bool SetSPIClockValue(unsigned short v,int Index)

unsigned int ReadUID(int Index)
{
if(! Is_usbworking() )
if(! Is_usbworking(Index) )
{
return false;
}
Expand Down Expand Up @@ -383,7 +388,7 @@ unsigned int ReadUID(int Index)

bool SetSPIClockDefault(int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;
// send request
CNTRPIPE_RQ rq ;
Expand All @@ -406,7 +411,7 @@ bool SetSPIClockDefault(int Index)

bool SetVpp4IAP(bool bOn,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;
// send request
CNTRPIPE_RQ rq ;
Expand All @@ -430,7 +435,7 @@ bool SetVpp4IAP(bool bOn,int Index)

bool UnlockRASS(int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

// send request
Expand All @@ -453,7 +458,7 @@ bool UnlockRASS(int Index)

unsigned char ReadManufacturerID(int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

if(g_bIsSF600==true)
Expand Down Expand Up @@ -484,7 +489,7 @@ unsigned char ReadManufacturerID(int Index)

bool EraseST7Sectors(bool bSect1,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

// send request
Expand Down Expand Up @@ -602,7 +607,7 @@ bool ProgramSectors(const char* sFilePath, bool bSect1,int Index)

bool UpdateChkSum(int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

CNTRPIPE_RQ rq ;
Expand All @@ -626,7 +631,7 @@ bool UpdateChkSum(int Index)

bool WriteUID(unsigned int dwUID,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

if(g_bIsSF600)
Expand Down Expand Up @@ -669,7 +674,7 @@ bool WriteUID(unsigned int dwUID,int Index)

bool WriteManufacturerID(unsigned char ManuID,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

if(g_bIsSF600)
Expand All @@ -696,7 +701,7 @@ bool WriteManufacturerID(unsigned char ManuID,int Index)

bool ReadMemOnST7(unsigned int iAddr,int Index)
{
if(!Is_usbworking() )
if(!Is_usbworking(Index) )
return false;

CNTRPIPE_RQ rq ;
Expand Down
5 changes: 2 additions & 3 deletions board.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ bool SetRedLEDOn(bool boOn, int Index);
bool SetLEDOnOff(size_t Color,int Index);
bool SetCS(size_t value,int Index);
bool SetIOModeToSF600(size_t value,int Index);
bool BlinkProgBoard(bool boIsV5,int Index);
bool ReadOnBoardFlash(unsigned char* Data,bool ReadUID,int Index);
bool LeaveSF600Standalone(bool Enable,int USBIndex);
bool BlinkProgBoard(bool boIsV5,int Index);
bool LeaveSF600Standalone(bool Enable,int Index);
bool SetSPIClockValue(unsigned short v,int Index);
unsigned int ReadUID(int Index);
bool SetSPIClockDefault(int Index);
Expand Down
Loading

0 comments on commit 8c9de3a

Please sign in to comment.