Skip to content

Commit

Permalink
* Fix space/tabs
Browse files Browse the repository at this point in the history
 * Cleanup debugging output
 * Actually clear programmer state.
  • Loading branch information
cnlohr committed Mar 4, 2025
1 parent 297d9f8 commit 11eae6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions minichlink/minichlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ int main( int argc, char ** argv )

if( MCF.WriteBinaryBlob )
{
printf("Writing image\n");
printf("Writing image\n");
if( MCF.WriteBinaryBlob( dev, offset, len, image ) )
{
fprintf( stderr, "Error: Fault writing image.\n" );
Expand Down Expand Up @@ -890,7 +890,6 @@ int DefaultSetupInterface( void * dev )
return r;
}


iss->statetag = STTAG( "STRT" );
return 0;
}
Expand Down
15 changes: 9 additions & 6 deletions minichlink/pgm-esp32s2-ch32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ int ESPFlushLLCommands( void * dev )

#if DETAILED_DEBUG
int i;
printf( "CHAL: %d\n", eps->commandplace );
for( i = 0; i < eps->commandplace; i++ )
printf( "CHAL: %d", eps->commandplace );
for( i = 0; i < eps->commandplace+1; i++ )
{
if( ( i & 0xff ) == 0 ) printf( "\n" );
printf( "%02x ", eps->commandbuffer[i] );
Expand All @@ -245,12 +245,11 @@ int ESPFlushLLCommands( void * dev )
eps->reply[0] = 0xad; // Key report ID
r = hid_get_feature_report( eps->hd, eps->reply, eps->replysize );
#if DETAILED_DEBUG
printf( "RESP: %d %d\n", r,eps->reply[0] );

printf( "RESP: %d %d", (int)r, (int)eps->reply[0] );
for( int i = 0; i < eps->reply[0]; i++ )
{
if( (i % 16) == 0 ) printf( "\n" );
printf( "%02x ", eps->reply[i+1] );
if( (i % 16) == 15 ) printf( "\n" );
}
printf( "\n" );
#endif
Expand Down Expand Up @@ -569,7 +568,9 @@ void * TryInit_ESP32S2CHFUN()
MCF.ReadAllCPURegisters = ESPReadAllCPURegisters;
#endif

// Reset internal programmer state and force programmer mode.
ESPFlushLLCommands( eps );

// Force programmer mode.
Write1( eps, 0xfe );
Write1( eps, 0xfd );
Write1( eps, 0x00 );
Expand All @@ -581,6 +582,8 @@ void * TryInit_ESP32S2CHFUN()
}
Write2LE( eps, 0x0efe ); // Trigger Init.
ESPFlushLLCommands( eps );
Write2LE( eps, 0x0afe ); // Reset programmer internals
ESPFlushLLCommands( eps );
return eps;
}

Expand Down

0 comments on commit 11eae6d

Please sign in to comment.