mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
color
This commit is contained in:
parent
ed2ff985bf
commit
3832cf26fd
8 changed files with 38 additions and 28 deletions
|
@ -114,10 +114,10 @@ void BigBuf_free_keep_EM(void) {
|
|||
}
|
||||
|
||||
void BigBuf_print_status(void) {
|
||||
DbpString(_BLUE_("Memory"));
|
||||
DbpString(_CYAN_("Memory"));
|
||||
Dbprintf(" BigBuf_size.............%d", BigBuf_size);
|
||||
Dbprintf(" Available memory........%d", BigBuf_hi);
|
||||
DbpString(_BLUE_("Tracing"));
|
||||
DbpString(_CYAN_("Tracing"));
|
||||
Dbprintf(" tracing ................%d", tracing);
|
||||
Dbprintf(" traceLen ...............%d", traceLen);
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ static void TimingIntervalAcquisition(void) {
|
|||
// measure the Connection Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
|
||||
static void printConnSpeed(void) {
|
||||
DbpString(_BLUE_("Transfer Speed"));
|
||||
DbpString(_CYAN_("Transfer Speed"));
|
||||
Dbprintf(" Sending packets to client...");
|
||||
|
||||
#define CONN_SPEED_TEST_MIN_TIME 500 // in milliseconds
|
||||
|
@ -360,7 +360,7 @@ static void SendStatus(void) {
|
|||
printT55xxConfig(); // LF T55XX Config
|
||||
#endif
|
||||
printConnSpeed();
|
||||
DbpString(_BLUE_("Various"));
|
||||
DbpString(_CYAN_("Various"));
|
||||
for (uint32_t *p = &_stack_start; ; ++p) {
|
||||
if (*p != 0xdeadbeef) {
|
||||
Dbprintf(" Max stack usage so far..%d", (&_stack_end - p)*4);
|
||||
|
@ -385,7 +385,7 @@ static void SendStatus(void) {
|
|||
Dbprintf(_YELLOW_(" Slow Clock actual speed seems closer to %d kHz"),
|
||||
(16 * MAINCK / 1000) / mainf * delta_time / SLCK_CHECK_MS);
|
||||
}
|
||||
DbpString(_BLUE_("Installed StandAlone Mode"));
|
||||
DbpString(_CYAN_("Installed StandAlone Mode"));
|
||||
ModInfo();
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
|
|
|
@ -523,7 +523,7 @@ void Flash_EraseChip(void) {
|
|||
*/
|
||||
|
||||
void Flashmem_print_status(void) {
|
||||
DbpString(_BLUE_("Flash memory"));
|
||||
DbpString(_CYAN_("Flash memory"));
|
||||
Dbprintf(" Baudrate................" _GREEN_("%d MHz"), FLASHMEM_SPIBAUDRATE / 1000000);
|
||||
|
||||
if (!FlashInit()) {
|
||||
|
@ -562,7 +562,7 @@ void Flashmem_print_info(void) {
|
|||
|
||||
if (!FlashInit()) return;
|
||||
|
||||
DbpString(_BLUE_("Flash memory dictionary loaded"));
|
||||
DbpString(_CYAN_("Flash memory dictionary loaded"));
|
||||
|
||||
// load dictionary offsets.
|
||||
uint8_t keysum[2];
|
||||
|
|
|
@ -507,7 +507,7 @@ void SetAdcMuxFor(uint32_t whichGpio) {
|
|||
}
|
||||
|
||||
void Fpga_print_status(void) {
|
||||
DbpString(_BLUE_("Currently loaded FPGA image"));
|
||||
DbpString(_CYAN_("Current FPGA image"));
|
||||
Dbprintf(" mode....................%s", g_fpga_version_information[downloaded_bitstream - 1]);
|
||||
}
|
||||
|
||||
|
|
40
armsrc/i2c.c
40
armsrc/i2c.c
|
@ -27,12 +27,12 @@
|
|||
#define SDA_H HIGH(GPIO_SDA)
|
||||
#define SDA_L LOW(GPIO_SDA)
|
||||
|
||||
#define SCL_read (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SCL)
|
||||
#define SDA_read (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SDA)
|
||||
#define SCL_read ((AT91C_BASE_PIOA->PIO_PDSR & GPIO_SCL) == GPIO_SCL)
|
||||
#define SDA_read ((AT91C_BASE_PIOA->PIO_PDSR & GPIO_SDA) == GPIO_SDA)
|
||||
|
||||
#define I2C_ERROR "I2C_WaitAck Error"
|
||||
|
||||
static volatile unsigned long c;
|
||||
static volatile uint32_t c;
|
||||
|
||||
// Direct use the loop to delay. 6 instructions loop, Masterclock 48MHz,
|
||||
// delay=1 is about 200kbps
|
||||
|
@ -47,6 +47,12 @@ static void __attribute__((optimize("O0"))) I2CSpinDelayClk(uint16_t delay) {
|
|||
#define I2C_DELAY_2CLK I2CSpinDelayClk(2)
|
||||
#define I2C_DELAY_XCLK(x) I2CSpinDelayClk((x))
|
||||
|
||||
#define I2C_DELAY_100us I2CSpinDelayClk( 100 / 3)
|
||||
#define I2C_DELAY_600us I2CSpinDelayClk( 600 / 3)
|
||||
#define I2C_DELAY_10ms I2CSpinDelayClk( 10 * 1000 / 3 )
|
||||
#define I2C_DELAY_30ms I2CSpinDelayClk( 30 * 1000 / 3 )
|
||||
#define I2C_DELAY_100ms I2CSpinDelayClk( 100 * 1000 / 3)
|
||||
|
||||
#define ISO7618_MAX_FRAME 255
|
||||
|
||||
// try i2c bus recovery at 100kHz = 5us high, 5us low
|
||||
|
@ -69,6 +75,7 @@ void I2C_recovery(void) {
|
|||
//a STOP signal (SDA from low to high while CLK is high)
|
||||
SDA_L;
|
||||
WaitUS(5);
|
||||
|
||||
SCL_H;
|
||||
WaitUS(2);
|
||||
SDA_H;
|
||||
|
@ -127,11 +134,11 @@ void I2C_Reset_EnterMainProgram(void) {
|
|||
StartTicks();
|
||||
I2C_init();
|
||||
I2C_SetResetStatus(0, 0, 0);
|
||||
WaitMS(30);
|
||||
I2C_DELAY_30ms;
|
||||
I2C_SetResetStatus(1, 0, 0);
|
||||
WaitMS(30);
|
||||
I2C_DELAY_30ms;
|
||||
I2C_SetResetStatus(1, 1, 1);
|
||||
WaitMS(10);
|
||||
I2C_DELAY_10ms;
|
||||
}
|
||||
|
||||
// Reset the SIM_Adapter, then enter the bootloader program
|
||||
|
@ -140,9 +147,9 @@ void I2C_Reset_EnterBootloader(void) {
|
|||
StartTicks();
|
||||
I2C_init();
|
||||
I2C_SetResetStatus(0, 1, 1);
|
||||
WaitMS(100);
|
||||
I2C_DELAY_100ms;
|
||||
I2C_SetResetStatus(1, 1, 1);
|
||||
WaitMS(10);
|
||||
I2C_DELAY_10ms;
|
||||
}
|
||||
|
||||
// Wait for the clock to go High.
|
||||
|
@ -180,13 +187,13 @@ static bool WaitSCL_L(void) {
|
|||
// It timeout reading response from card
|
||||
// Which ever comes first
|
||||
static bool WaitSCL_L_timeout(void) {
|
||||
volatile uint16_t delay = 1800;
|
||||
volatile uint32_t delay = 18000;
|
||||
while (delay--) {
|
||||
// exit on SCL LOW
|
||||
if (!SCL_read)
|
||||
return true;
|
||||
|
||||
WaitMS(1);
|
||||
I2C_DELAY_100us;
|
||||
}
|
||||
return (delay == 0);
|
||||
}
|
||||
|
@ -218,7 +225,7 @@ static bool I2C_WaitForSim(void) {
|
|||
// 8051 speaks with smart card.
|
||||
// 1000*50*3.07 = 153.5ms
|
||||
// 1byte transfer == 1ms with max frame being 256bytes
|
||||
if (!WaitSCL_H_delay(10 * 1000 * 50))
|
||||
if (!WaitSCL_H_delay(20 * 1000 * 50))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -433,7 +440,9 @@ int16_t I2C_BufferRead(uint8_t *data, uint8_t len, uint8_t device_cmd, uint8_t d
|
|||
|
||||
// extra wait 500us (514us measured)
|
||||
// 200us (xx measured)
|
||||
WaitUS(600);
|
||||
// WaitUS(600);
|
||||
I2C_DELAY_600us;
|
||||
|
||||
bool bBreak = true;
|
||||
uint16_t readcount = 0;
|
||||
|
||||
|
@ -474,7 +483,7 @@ int16_t I2C_BufferRead(uint8_t *data, uint8_t len, uint8_t device_cmd, uint8_t d
|
|||
*data = (uint8_t)tmp & 0xFF;
|
||||
|
||||
len--;
|
||||
// 读取的第一个字节为后续长度
|
||||
|
||||
// The first byte in response is the message length
|
||||
if (!readcount && (len > *data)) {
|
||||
len = *data;
|
||||
|
@ -601,7 +610,7 @@ bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t d
|
|||
}
|
||||
|
||||
void I2C_print_status(void) {
|
||||
DbpString(_BLUE_("Smart card module (ISO 7816)"));
|
||||
DbpString(_CYAN_("Smart card module (ISO 7816)"));
|
||||
uint8_t maj, min;
|
||||
if (I2C_get_version(&maj, &min) == PM3_SUCCESS)
|
||||
Dbprintf(" version................." _YELLOW_("v%x.%02d"), maj, min);
|
||||
|
@ -799,7 +808,8 @@ void SmartCardUpgrade(uint64_t arg0) {
|
|||
}
|
||||
|
||||
// writing takes time.
|
||||
WaitMS(50);
|
||||
// WaitMS(50);
|
||||
I2C_DELAY_100ms;
|
||||
|
||||
// read
|
||||
res = I2C_ReadFW(verfiydata, size, msb, lsb, I2C_DEVICE_ADDRESS_BOOT);
|
||||
|
|
|
@ -198,7 +198,7 @@ void printT55xxConfig(void) {
|
|||
|
||||
#define PRN_NA sprintf(s + strlen(s), _RED_("N/A") " | ");
|
||||
|
||||
DbpString(_BLUE_("LF T55XX config"));
|
||||
DbpString(_CYAN_("LF T55XX config"));
|
||||
Dbprintf(" [r] [a] [b] [c] [d] [e] [f] [g]");
|
||||
Dbprintf(" mode |start|write|write|write| read|write|write");
|
||||
Dbprintf(" | gap | gap | 0 | 1 | gap | 2 | 3");
|
||||
|
|
|
@ -31,7 +31,7 @@ static sample_config config = { 1, 8, 1, LF_DIVISOR_125, 0, 0, 1} ;
|
|||
|
||||
void printConfig(void) {
|
||||
uint32_t d = config.divisor;
|
||||
DbpString(_BLUE_("LF Sampling config"));
|
||||
DbpString(_CYAN_("LF Sampling config"));
|
||||
Dbprintf(" [q] divisor.............%d ( "_GREEN_("%d.%02d kHz")" )", d, 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
Dbprintf(" [b] bits per sample.....%d", config.bits_per_sample);
|
||||
Dbprintf(" [d] decimation..........%d", config.decimation);
|
||||
|
|
|
@ -536,13 +536,13 @@ int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, R
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////// MISC HIGH LEVEL FUNCTIONS ////////////////////////////////////////////
|
||||
#define SPIFFS_BANNER DbpString(_BLUE_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
#define SPIFFS_BANNER DbpString(_CYAN_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
|
||||
void rdv40_spiffs_safe_print_fsinfo(void) {
|
||||
rdv40_spiffs_fsinfo fsinfo;
|
||||
rdv40_spiffs_getfsinfo(&fsinfo, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
|
||||
DbpString(_BLUE_("Flash Memory FileSystem Info (SPIFFS)"));
|
||||
DbpString(_CYAN_("Flash Memory FileSystem Info (SPIFFS)"));
|
||||
|
||||
|
||||
Dbprintf(" Logical Block Size........." _YELLOW_("%d")" bytes", fsinfo.blockSize);
|
||||
|
@ -570,7 +570,7 @@ void rdv40_spiffs_safe_print_fsinfo(void) {
|
|||
void rdv40_spiffs_safe_print_tree(uint8_t banner) {
|
||||
|
||||
if (banner) {
|
||||
DbpString(_BLUE_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
DbpString(_CYAN_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
Dbprintf("-------------------------------------");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue