Browse Source

* Aldonante cc_delay_calibrate por agordi tempojn bazitajn sur CPU-rapideco.

* superfluo-eraro korektita en cc_delay
master
Jean Michault 5 years ago
parent
commit
8b4a5d3b76
6 changed files with 20 additions and 1 deletions
  1. +17
    -1
      CCDebugger.c
  2. BIN
      cc_chipid
  3. BIN
      cc_erase
  4. BIN
      cc_read
  5. +3
    -0
      cc_read.c
  6. BIN
      cc_write

+ 17
- 1
CCDebugger.c View File

@@ -69,12 +69,14 @@
#define I_GET_BM 14
#define I_BURST_WRITE 15

void cc_delay_calibrate( );
int cc_init( int pRST, int pDC, int pDD )
{
if(wiringPiSetup() == -1){
printf("no wiring pi detected\n");
return 0;
}
cc_delay_calibrate();

pinRST=pRST;
pinDC=pDC;
@@ -172,15 +174,29 @@ uint8_t cc_error()
* Delay a particular number of cycles
*/
struct timespec tp={0,0};
static int cc_delay_mult=50;
void cc_delay( unsigned char d )
{
volatile unsigned char i = 50*d;
volatile unsigned int i = cc_delay_mult*d;
while( i-- );
//tp.tv_nsec=40*d;
//nanosleep(&tp,NULL);

}

/* provas konsideri la rapidecon de la procesoro */
void cc_delay_calibrate( )
{
long time0=micros();
cc_delay(200);
cc_delay(200);
cc_delay(200);
cc_delay(200);
cc_delay(200);
long time1=micros();
cc_delay_mult=cc_delay_mult*200/(time1-time0);
}

/**
* Enter debug mode
*/


BIN
cc_chipid View File


BIN
cc_erase View File


BIN
cc_read View File


+ 3
- 0
cc_read.c View File

@@ -76,6 +76,7 @@ int main(int argc,char **argv)
uint16_t offset=0;
uint8_t bank=0;
int progress=1;
// int nbread=0;
for( bank=0 ; bank<8 ; bank++)
{
printf(".");fflush(stdout);
@@ -93,12 +94,14 @@ int main(int argc,char **argv)
{
read1k(bank,i*1024, buf1);
read1k(bank,i*1024, buf2);
// nbread++;
} while(memcmp(buf1,buf2,1024));
for(uint16_t j=0 ; j<64 ; j++)
writeHexLine(ficout,buf1+j*16, 16,(bank&1)*32*1024+ i*1024+j*16);
printf("\r reading %dk/256k",progress++);fflush(stdout);
}
}
// fprintf(stderr,"nbread=%d\n",nbread);
fprintf(ficout,":00000001FF\n");
// exit from debug
cc_setActive(false);


BIN
cc_write View File


Loading…
Cancel
Save