[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 ...

Change-Id: I3434bb020286ab72ba3556124786656eeacf10a9
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2010-11-13 15:36:14 +01:00 committed by Harald Welte
parent 1df60c1063
commit d981cf357c
6 changed files with 36 additions and 5 deletions

View File

@ -236,6 +236,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 };
static 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;
@ -865,6 +893,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");
@ -1000,6 +1030,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();
osmo_fd_update_when(&dnload.serial_fd, 0, OSMO_FD_READ);
dnload.romload_state = FINISHED;
dnload.write_ptr = dnload.data;

View File

@ -115,7 +115,7 @@ void board_init(int with_irq)
/* initialize MODEM UART to be used for sercomm */
uart_init(UART_MODEM, with_irq);
uart_baudrate(UART_MODEM, UART_115200);
uart_baudrate(UART_MODEM, UART_460800);
/* initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */

View File

@ -110,7 +110,7 @@ void board_init(int with_irq)
/* initialize MODEM UART to be used for sercomm */
uart_init(UART_MODEM, with_irq);
uart_baudrate(UART_MODEM, UART_115200);
uart_baudrate(UART_MODEM, UART_460800);
/* Initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */

View File

@ -120,7 +120,7 @@ void board_init(int with_irq)
/* initialize MODEM UART to be used for sercomm */
uart_init(UART_MODEM, with_irq);
uart_baudrate(UART_MODEM, UART_115200);
uart_baudrate(UART_MODEM, UART_460800);
/* initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */

View File

@ -105,7 +105,7 @@ void board_init(int with_irq)
/* initialize MODEM UART to be used for sercomm */
uart_init(UART_MODEM, with_irq);
uart_baudrate(UART_MODEM, UART_115200);
uart_baudrate(UART_MODEM, UART_460800);
/* Initialize IRDA UART to be used for old-school console code.
* note: IRDA uart only accessible on C115 and C117 PCB */

View File

@ -125,7 +125,7 @@ void board_init(int with_irq)
/* initialize IRDA UART to be used for sercomm */
uart_init(UART_IRDA, with_irq);
uart_baudrate(UART_IRDA, UART_115200);
uart_baudrate(UART_IRDA, UART_460800);
/* Initialize MODEM UART to be used for old-school console code. */
uart_init(UART_MODEM, with_irq);