summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-11-13 15:36:14 +0100
committerSylvain Munaut <tnt@246tNt.com>2011-11-13 20:26:22 +0100
commitab4b5f43a95140910079dce00617e7d6179f8255 (patch)
treec1f55518a148b55ce18e2c661c0ec83dd6f250b9
parent718790fc4fab2b25940cdff2dca68a1cf8b18ff8 (diff)
[HACK] Increase speed of l1ctl to 408250bps after boot
This is required to deal with the increased traffic of a passive listener Note that it break the 'auto-restart' of osmocon when active because the bootloader will send the prompt at 115200 baud and we won't see it ... Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/host/osmocon/osmocon.c32
-rw-r--r--src/target/firmware/board/compal_e86/init.c2
-rw-r--r--src/target/firmware/board/compal_e88/init.c2
-rw-r--r--src/target/firmware/board/compal_e99/init.c2
-rw-r--r--src/target/firmware/board/gta0x/init.c2
-rw-r--r--src/target/firmware/board/pirelli_dpl10/init.c2
6 files changed, 37 insertions, 5 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 5f28992..6ad65e2 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -216,6 +216,34 @@ static const uint8_t mtk_init_cmd[] = { 0xa0, 0x0a, 0x50, 0x05 };
static const uint8_t mtk_init_resp[] = { 0x5f, 0xf5, 0xaf, 0xfa };
static const uint8_t mtk_command[] = { 0xa1, 0xa2, 0xa4, 0xa8 };
+
+int serial_up_to_eleven(void)
+{
+ int rv;
+
+ /* Attempt custom baudrate */
+ rv = osmo_serial_set_custom_baudrate(dnload.serial_fd.fd, 406250);
+ if (rv == 0)
+ return 0;
+
+#ifdef I_HAVE_A_CP210x /* and I know what I'm doing, I swear ! */
+ /* Try closest standard baudrate (CP210x reprogrammed adapters) */
+ rv = osmo_serial_set_baudrate(dnload.serial_fd.fd, B460800);
+ if (rv == 0)
+ return 0;
+#endif
+
+ /* Everything failed */
+ fprintf(stderr, "!!!\n");
+ fprintf(stderr, "!!! ERROR !!!\n");
+ fprintf(stderr, "!!!\n");
+ fprintf(stderr, "!!! Unable to set custom baudrate, please use appropriate cable\n");
+ fprintf(stderr, "!!! ( see wiki http://bb.osmocom.org/trac/wiki/Sniffing )\n");
+ fprintf(stderr, "!!!\n");
+
+ exit(-1);
+}
+
static void beacon_timer_cb(void *p)
{
int rc;
@@ -812,6 +840,7 @@ static int handle_read(void)
dnload.write_ptr = dnload.data;
dnload.expect_hdlc = 1;
+
/* check for romloader chainloading mode used as a workaround
* for the magic on the C139/C140 and J100i */
if (dnload.chainload_filename != NULL) {
@@ -827,6 +856,8 @@ static int handle_read(void)
tick_timer.data = &tick_timer;
osmo_timer_schedule(&tick_timer, 0, dnload.beacon_interval);
}
+ else
+ serial_up_to_eleven();
} else if (!memcmp(buffer, phone_nack, sizeof(phone_nack))) {
printf("Received DOWNLOAD NACK from phone, something went"
" wrong :(\n");
@@ -970,6 +1001,7 @@ static int handle_read_romload(void)
if (!memcmp(buffer, romload_branch_ack,
sizeof(romload_branch_ack))) {
printf("Received branch ack, your code is running now!\n");
+ serial_up_to_eleven();
dnload.serial_fd.when = BSC_FD_READ;
dnload.romload_state = FINISHED;
dnload.write_ptr = dnload.data;
diff --git a/src/target/firmware/board/compal_e86/init.c b/src/target/firmware/board/compal_e86/init.c
index 1de6193..85499f1 100644
--- a/src/target/firmware/board/compal_e86/init.c
+++ b/src/target/firmware/board/compal_e86/init.c
@@ -107,7 +107,7 @@ void board_init(void)
/* initialize MODEM UART to be used for sercomm*/
uart_init(SERCOMM_UART_NR, 1);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
+ uart_baudrate(SERCOMM_UART_NR, UART_460800);
/* initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */
diff --git a/src/target/firmware/board/compal_e88/init.c b/src/target/firmware/board/compal_e88/init.c
index a5bf880..2b33f34 100644
--- a/src/target/firmware/board/compal_e88/init.c
+++ b/src/target/firmware/board/compal_e88/init.c
@@ -103,7 +103,7 @@ void board_init(void)
/* initialize MODEM UART to be used for sercomm*/
uart_init(SERCOMM_UART_NR, 1);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
+ uart_baudrate(SERCOMM_UART_NR, UART_460800);
/* Initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */
diff --git a/src/target/firmware/board/compal_e99/init.c b/src/target/firmware/board/compal_e99/init.c
index 0c218a8..6c9f847 100644
--- a/src/target/firmware/board/compal_e99/init.c
+++ b/src/target/firmware/board/compal_e99/init.c
@@ -107,7 +107,7 @@ void board_init(void)
/* initialize MODEM UART to be used for sercomm*/
uart_init(SERCOMM_UART_NR, 1);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
+ uart_baudrate(SERCOMM_UART_NR, UART_460800);
/* initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */
diff --git a/src/target/firmware/board/gta0x/init.c b/src/target/firmware/board/gta0x/init.c
index 4f256ea..f332a7a 100644
--- a/src/target/firmware/board/gta0x/init.c
+++ b/src/target/firmware/board/gta0x/init.c
@@ -103,7 +103,7 @@ void board_init(void)
/* initialize MODEM UART to be used for sercomm*/
uart_init(SERCOMM_UART_NR, 1);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
+ uart_baudrate(SERCOMM_UART_NR, UART_460800);
/* Initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */
diff --git a/src/target/firmware/board/pirelli_dpl10/init.c b/src/target/firmware/board/pirelli_dpl10/init.c
index 53fb257..af9a1e2 100644
--- a/src/target/firmware/board/pirelli_dpl10/init.c
+++ b/src/target/firmware/board/pirelli_dpl10/init.c
@@ -91,7 +91,7 @@ void board_init(void)
/* initialize MODEM UART to be used for sercomm*/
uart_init(SERCOMM_UART_NR, 1);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
+ uart_baudrate(SERCOMM_UART_NR, UART_460800);
/* Initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */