mirror of https://gerrit.osmocom.org/simtrace2
change from \r\n (CRLF) to \n\r (LFCR)
For some strange reason my output is garbled in both the 'screen' and 'cu' teerminal programs and 'raw' terminal (stty) mode. I fail to understand why, but let's simply adjust the code as needed for now.
This commit is contained in:
parent
0de99cd069
commit
ec0837c463
|
@ -134,18 +134,18 @@ extern int main(void)
|
|||
|
||||
EEFC_ReadUniqueID(g_unique_id);
|
||||
|
||||
printf("\r\n\r\n"
|
||||
"=============================================================================\r\n"
|
||||
"SIMtrace2 firmware " GIT_VERSION " (C) 2010-2016 by Harald Welte\r\n"
|
||||
"=============================================================================\r\n");
|
||||
printf("\n\r\n\r"
|
||||
"=============================================================================\n\r"
|
||||
"SIMtrace2 firmware " GIT_VERSION " (C) 2010-2016 by Harald Welte\n\r"
|
||||
"=============================================================================\n\r");
|
||||
|
||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\r\n",
|
||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
|
||||
g_unique_id[0], g_unique_id[1],
|
||||
g_unique_id[2], g_unique_id[3]);
|
||||
|
||||
board_main_top();
|
||||
|
||||
TRACE_INFO("USB init...\r\n");
|
||||
TRACE_INFO("USB init...\n\r");
|
||||
SIMtrace_USB_Initialize();
|
||||
|
||||
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
|
||||
|
@ -153,25 +153,25 @@ extern int main(void)
|
|||
#if 0
|
||||
if (i >= MAX_USB_ITER * 3) {
|
||||
TRACE_ERROR("Resetting board (USB could "
|
||||
"not be configured)\r\n");
|
||||
"not be configured)\n\r");
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
|
||||
TRACE_INFO("calling configure of all configurations...\r\n");
|
||||
TRACE_INFO("calling configure of all configurations...\n\r");
|
||||
for (i = 1; i < sizeof(config_func_ptrs) / sizeof(config_func_ptrs[0]);
|
||||
++i) {
|
||||
if (config_func_ptrs[i].configure)
|
||||
config_func_ptrs[i].configure();
|
||||
}
|
||||
|
||||
TRACE_INFO("calling init of config %u...\r\n", simtrace_config);
|
||||
TRACE_INFO("calling init of config %u...\n\r", simtrace_config);
|
||||
config_func_ptrs[simtrace_config].init();
|
||||
last_simtrace_config = simtrace_config;
|
||||
|
||||
TRACE_INFO("entering main loop...\r\n");
|
||||
TRACE_INFO("entering main loop...\n\r");
|
||||
while (1) {
|
||||
#if TRACE_LEVEL >= TRACE_LEVEL_DEBUG
|
||||
const char rotor[] = { '-', '\\', '|', '/' };
|
||||
|
@ -188,14 +188,14 @@ extern int main(void)
|
|||
isUsbConnected = 0;
|
||||
}
|
||||
} else if (isUsbConnected == 0) {
|
||||
TRACE_INFO("USB is now configured\r\n");
|
||||
TRACE_INFO("USB is now configured\n\r");
|
||||
LED_Set(LED_NUM_GREEN);
|
||||
LED_Clear(LED_NUM_RED);
|
||||
|
||||
isUsbConnected = 1;
|
||||
}
|
||||
if (last_simtrace_config != simtrace_config) {
|
||||
TRACE_INFO("USB config chg %u -> %u\r\n",
|
||||
TRACE_INFO("USB config chg %u -> %u\n\r",
|
||||
last_simtrace_config, simtrace_config);
|
||||
config_func_ptrs[last_simtrace_config].exit();
|
||||
config_func_ptrs[simtrace_config].init();
|
||||
|
|
|
@ -99,7 +99,7 @@ int USBDFU_handle_upload(uint8_t altif, unsigned int offset,
|
|||
/* FIXME: set error codes */
|
||||
return -1;
|
||||
}
|
||||
printf("=%u\r\n", req_len);
|
||||
printf("=%u\n\r", req_len);
|
||||
return req_len;
|
||||
}
|
||||
|
||||
|
@ -139,20 +139,20 @@ extern int main(void)
|
|||
|
||||
EEFC_ReadUniqueID(g_unique_id);
|
||||
|
||||
printf("\r\n\r\n"
|
||||
"=============================================================================\r\n"
|
||||
"DFU bootloader %s for board %s (C) 2010-2017 by Harald Welte\r\n"
|
||||
"=============================================================================\r\n",
|
||||
printf("\n\r\n\r"
|
||||
"=============================================================================\n\r"
|
||||
"DFU bootloader %s for board %s (C) 2010-2017 by Harald Welte\n\r"
|
||||
"=============================================================================\n\r",
|
||||
manifest_revision, manifest_board);
|
||||
|
||||
TRACE_INFO("Chip ID: 0x%08x (Ext 0x%08x)\r\n", CHIPID->CHIPID_CIDR, CHIPID->CHIPID_EXID);
|
||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\r\n",
|
||||
TRACE_INFO("Chip ID: 0x%08x (Ext 0x%08x)\n\r", CHIPID->CHIPID_CIDR, CHIPID->CHIPID_EXID);
|
||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
|
||||
g_unique_id[0], g_unique_id[1],
|
||||
g_unique_id[2], g_unique_id[3]);
|
||||
|
||||
//board_main_top();
|
||||
|
||||
TRACE_INFO("USB init...\r\n");
|
||||
TRACE_INFO("USB init...\n\r");
|
||||
USBDFU_Initialize(&dfu_descriptors);
|
||||
|
||||
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
|
||||
|
@ -160,7 +160,7 @@ extern int main(void)
|
|||
#if 1
|
||||
if (i >= MAX_USB_ITER * 3) {
|
||||
TRACE_ERROR("Resetting board (USB could "
|
||||
"not be configured)\r\n");
|
||||
"not be configured)\n\r");
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
#endif
|
||||
|
@ -168,7 +168,7 @@ extern int main(void)
|
|||
}
|
||||
|
||||
FLASHD_Initialize(BOARD_MCK, 1);
|
||||
TRACE_INFO("entering main loop...\r\n");
|
||||
TRACE_INFO("entering main loop...\n\r");
|
||||
while (1) {
|
||||
#if TRACE_LEVEL >= TRACE_LEVEL_DEBUG
|
||||
const char rotor[] = { '-', '\\', '|', '/' };
|
||||
|
@ -185,7 +185,7 @@ extern int main(void)
|
|||
isUsbConnected = 0;
|
||||
}
|
||||
} else if (isUsbConnected == 0) {
|
||||
TRACE_INFO("USB is now configured\r\n");
|
||||
TRACE_INFO("USB is now configured\n\r");
|
||||
LED_Set(LED_NUM_GREEN);
|
||||
LED_Clear(LED_NUM_RED);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static int write_hub_eeprom(void)
|
|||
v = 0;
|
||||
}
|
||||
|
||||
TRACE_INFO("Writing EEPROM...\r\n");
|
||||
TRACE_INFO("Writing EEPROM...\n\r");
|
||||
/* write the EEPROM once */
|
||||
for (i = 0; i < 256; i++) {
|
||||
int rc = eeprom_write_byte(0x50, i, __eeprom_bin[i]);
|
||||
|
@ -68,12 +68,12 @@ static int write_hub_eeprom(void)
|
|||
}
|
||||
|
||||
/* then pursue re-reading it again and again */
|
||||
TRACE_INFO("Verifying EEPROM...\r\n");
|
||||
TRACE_INFO("Verifying EEPROM...\n\r");
|
||||
for (i = 0; i < 256; i++) {
|
||||
int byte = eeprom_read_byte(0x50, i);
|
||||
TRACE_INFO("0x%02x: %02x\r\n", i, byte);
|
||||
TRACE_INFO("0x%02x: %02x\n\r", i, byte);
|
||||
if (byte != __eeprom_bin[i])
|
||||
TRACE_ERROR("Byte %u is wrong, expected 0x%02x, found 0x%02x\r\n",
|
||||
TRACE_ERROR("Byte %u is wrong, expected 0x%02x, found 0x%02x\n\r",
|
||||
i, __eeprom_bin[i], byte);
|
||||
}
|
||||
|
||||
|
@ -90,88 +90,88 @@ void board_exec_dbg_cmd(int ch)
|
|||
|
||||
switch (ch) {
|
||||
case '?':
|
||||
printf("\t?\thelp\r\n");
|
||||
printf("\tE\tprogram EEPROM\r\n");
|
||||
printf("\tR\treset SAM3\r\n");
|
||||
printf("\tO\tEnable PRTPWR_OVERRIDE\r\n");
|
||||
printf("\to\tDisable PRTPWR_OVERRIDE\r\n");
|
||||
printf("\tH\tRelease HUB RESET (high)\r\n");
|
||||
printf("\th\tAssert HUB RESET (low)\r\n");
|
||||
printf("\tw\tWrite single byte in EEPROM\r\n");
|
||||
printf("\tr\tRead single byte from EEPROM\r\n");
|
||||
printf("\tX\tRelease peer SAM3 from reset\r\n");
|
||||
printf("\tx\tAssert peer SAM3 reset\r\n");
|
||||
printf("\tY\tRelease peer SAM3 ERASE signal\r\n");
|
||||
printf("\ty\tAssert peer SAM3 ERASE signal\r\n");
|
||||
printf("\tU\tProceed to USB Initialization\r\n");
|
||||
printf("\t1\tGenerate 1ms reset pulse on WWAN1\r\n");
|
||||
printf("\t2\tGenerate 1ms reset pulse on WWAN2\r\n");
|
||||
printf("\t?\thelp\n\r");
|
||||
printf("\tE\tprogram EEPROM\n\r");
|
||||
printf("\tR\treset SAM3\n\r");
|
||||
printf("\tO\tEnable PRTPWR_OVERRIDE\n\r");
|
||||
printf("\to\tDisable PRTPWR_OVERRIDE\n\r");
|
||||
printf("\tH\tRelease HUB RESET (high)\n\r");
|
||||
printf("\th\tAssert HUB RESET (low)\n\r");
|
||||
printf("\tw\tWrite single byte in EEPROM\n\r");
|
||||
printf("\tr\tRead single byte from EEPROM\n\r");
|
||||
printf("\tX\tRelease peer SAM3 from reset\n\r");
|
||||
printf("\tx\tAssert peer SAM3 reset\n\r");
|
||||
printf("\tY\tRelease peer SAM3 ERASE signal\n\r");
|
||||
printf("\ty\tAssert peer SAM3 ERASE signal\n\r");
|
||||
printf("\tU\tProceed to USB Initialization\n\r");
|
||||
printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r");
|
||||
printf("\t2\tGenerate 1ms reset pulse on WWAN2\n\r");
|
||||
break;
|
||||
case 'E':
|
||||
write_hub_eeprom();
|
||||
break;
|
||||
case 'R':
|
||||
printf("Asking NVIC to reset us\r\n");
|
||||
printf("Asking NVIC to reset us\n\r");
|
||||
NVIC_SystemReset();
|
||||
break;
|
||||
case 'O':
|
||||
printf("Setting PRTPWR_OVERRIDE\r\n");
|
||||
printf("Setting PRTPWR_OVERRIDE\n\r");
|
||||
PIO_Set(&pin_hubpwr_override);
|
||||
break;
|
||||
case 'o':
|
||||
printf("Clearing PRTPWR_OVERRIDE\r\n");
|
||||
printf("Clearing PRTPWR_OVERRIDE\n\r");
|
||||
PIO_Clear(&pin_hubpwr_override);
|
||||
break;
|
||||
case 'H':
|
||||
printf("Clearing _HUB_RESET -> HUB_RESET high (inactive)\r\n");
|
||||
printf("Clearing _HUB_RESET -> HUB_RESET high (inactive)\n\r");
|
||||
PIO_Clear(&pin_hub_rst);
|
||||
break;
|
||||
case 'h':
|
||||
/* high level drives transistor -> HUB_RESET low */
|
||||
printf("Asserting _HUB_RESET -> HUB_RESET low (active)\r\n");
|
||||
printf("Asserting _HUB_RESET -> HUB_RESET low (active)\n\r");
|
||||
PIO_Set(&pin_hub_rst);
|
||||
break;
|
||||
case 'w':
|
||||
if (PIO_GetOutputDataStatus(&pin_hub_rst) == 0)
|
||||
printf("WARNING: attempting EEPROM access while HUB not in reset\r\n");
|
||||
printf("Please enter EEPROM offset:\r\n");
|
||||
printf("WARNING: attempting EEPROM access while HUB not in reset\n\r");
|
||||
printf("Please enter EEPROM offset:\n\r");
|
||||
UART_GetIntegerMinMax(&addr, 0, 255);
|
||||
printf("Please enter EEPROM value:\r\n");
|
||||
printf("Please enter EEPROM value:\n\r");
|
||||
UART_GetIntegerMinMax(&val, 0, 255);
|
||||
printf("Writing value 0x%02x to EEPROM offset 0x%02x\r\n", val, addr);
|
||||
printf("Writing value 0x%02x to EEPROM offset 0x%02x\n\r", val, addr);
|
||||
eeprom_write_byte(0x50, addr, val);
|
||||
break;
|
||||
case 'r':
|
||||
printf("Please enter EEPROM offset:\r\n");
|
||||
printf("Please enter EEPROM offset:\n\r");
|
||||
UART_GetIntegerMinMax(&addr, 0, 255);
|
||||
printf("EEPROM[0x%02x] = 0x%02x\r\n", addr, eeprom_read_byte(0x50, addr));
|
||||
printf("EEPROM[0x%02x] = 0x%02x\n\r", addr, eeprom_read_byte(0x50, addr));
|
||||
break;
|
||||
case 'X':
|
||||
printf("Clearing _SIMTRACExx_RST -> SIMTRACExx_RST high (inactive)\r\n");
|
||||
printf("Clearing _SIMTRACExx_RST -> SIMTRACExx_RST high (inactive)\n\r");
|
||||
PIO_Clear(&pin_peer_rst);
|
||||
break;
|
||||
case 'x':
|
||||
printf("Setting _SIMTRACExx_RST -> SIMTRACExx_RST low (active)\r\n");
|
||||
printf("Setting _SIMTRACExx_RST -> SIMTRACExx_RST low (active)\n\r");
|
||||
PIO_Set(&pin_peer_rst);
|
||||
break;
|
||||
case 'Y':
|
||||
printf("Clearing SIMTRACExx_ERASE (inactive)\r\n");
|
||||
printf("Clearing SIMTRACExx_ERASE (inactive)\n\r");
|
||||
PIO_Clear(&pin_peer_erase);
|
||||
break;
|
||||
case 'y':
|
||||
printf("Seetting SIMTRACExx_ERASE (active)\r\n");
|
||||
printf("Seetting SIMTRACExx_ERASE (active)\n\r");
|
||||
PIO_Set(&pin_peer_erase);
|
||||
break;
|
||||
case '1':
|
||||
printf("Resetting Modem 1 (of this SAM3)\r\n");
|
||||
printf("Resetting Modem 1 (of this SAM3)\n\r");
|
||||
wwan_perst_do_reset(1);
|
||||
break;
|
||||
case '2':
|
||||
printf("Resetting Modem 2 (of this SAM3)\r\n");
|
||||
printf("Resetting Modem 2 (of this SAM3)\n\r");
|
||||
wwan_perst_do_reset(2);
|
||||
break;
|
||||
default:
|
||||
printf("Unknown command '%c'\r\n", ch);
|
||||
printf("Unknown command '%c'\n\r", ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -191,9 +191,9 @@ void board_main_top(void)
|
|||
i2c_pin_init();
|
||||
|
||||
if (qmod_sam3_is_12()) {
|
||||
TRACE_INFO("Detected Quad-Modem ST12\r\n");
|
||||
TRACE_INFO("Detected Quad-Modem ST12\n\r");
|
||||
} else {
|
||||
TRACE_INFO("Detected Quad-Modem ST34\r\n");
|
||||
TRACE_INFO("Detected Quad-Modem ST34\n\r");
|
||||
}
|
||||
|
||||
/* Obtain the circuit board version (currently just prints voltage */
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
/// \param condition Condition to verify.
|
||||
#define ASSERT(condition) { \
|
||||
if (!(condition)) { \
|
||||
printf("-F- ASSERT: %s %s:%d\r\n", #condition, __BASE_FILE__, __LINE__); \
|
||||
printf("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \
|
||||
while (1); \
|
||||
} \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue