FreeCalypso > hg > freecalypso-tools
view old/linux-2.6.37.6-ftdi_sio.c.patch @ 497:74610c4f10f7
target-utils: added 10 ms delay at the end of abb_power_off()
The deosmification of the ABB access code (replacement of osmo_delay_ms()
bogus delays with correctly-timed ones, which are significantly shorter)
had one annoying side effect: when executing the poweroff command from
any of the programs, one last '=' prompt character was being sent (and
received by the x86 host) as the Calypso board powers off. With delays
being shorter now, the abb_power_off() function was returning and the
standalone program's main loop was printing its prompt before the Iota chip
fully executed the switch-off sequence!
I thought about inserting an endless tight loop at the end of the
abb_power_off() function, but the implemented solution of a 10 ms delay
is a little nicer IMO because if the DEVOFF operation doesn't happen for
some reason in a manual hacking scenario, there won't be an artificial
blocker in the form of a tight loop keeping us from further poking around.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 25 May 2019 20:44:05 +0000 |
parents | 40f44aa49dd0 |
children |
line wrap: on
line source
--- ftdi_sio.c.orig 2011-03-27 11:01:41.000000000 -0800 +++ ftdi_sio.c 2015-10-30 13:18:40.879000032 -0800 @@ -949,7 +949,7 @@ static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; __u32 divisor; /* divisor shifted 3 bits to the left */ - int divisor3 = base / 2 / baud; + int divisor3 = (base / 2 + baud / 2) / baud; divisor = divisor3 >> 3; divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; /* Deal with special cases for highest baud rates. */ @@ -1087,6 +1087,17 @@ baud = tty_get_baud_rate(tty); dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud); + /* + * FreeCalypso hack: translate non-std high + * baud rates for GSM like CP2102 does. + */ + if (baud == 230400) + baud = 203125; + else if (baud == 460800) + baud = 406250; + else if (baud == 921600) + baud = 812500; + /* 2. Observe async-compatible custom_divisor hack, update baudrate if needed */