Commit 0b2f7c19 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

Fix OS_SerialOp default handshaking use on Pi

The default state for the Serial device (aka OS_SerialOp, and redirection to serial via *FX) is to expect hardware handshaking. However the implementation of HAL_UARTModemStatus when ModemControl = {FALSE} state didn't set a return value so ended up returning a1 = the port number (=0) rather than valid status bits. In turn, DualSerial took that to mean CTS/DSR deasserted and refused to send anything.
To a lesser extent HAL_UARTModemControl also affected, returning a1 = port number 0 too.
For both, set a return value; the value is as though a cable is always present with RTS=CTS and DTR=DSR.

Also, fix the bugs in ModemControl = {TRUE}. This also fakes DTR=DSR which status/control bits don't appear to be implemented in the UART peripheral. Tested briefly, checking CTS state when plugging/unplugging a cable.

Version 0.82. Tagged as 'HAL_BCM2835-0_82'
parent 699a746a
/* (0.81)
/* (0.82)
* This file is automatically maintained by srccommit, do not edit manually.
#define Module_MajorVersion_CMHG 0.81
#define Module_MajorVersion_CMHG 0.82
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 10 Aug 2019
#define Module_Date_CMHG 05 Feb 2020
#define Module_MajorVersion "0.81"
#define Module_Version 81
#define Module_MajorVersion "0.82"
#define Module_Version 82
#define Module_MinorVersion ""
#define Module_Date "10 Aug 2019"
#define Module_Date "05 Feb 2020"
#define Module_ApplicationDate "10-Aug-19"
#define Module_ApplicationDate "05-Feb-20"
#define Module_ComponentName "HAL_BCM2835"
#define Module_FullVersion "0.81"
#define Module_HelpVersion "0.81 (10 Aug 2019)"
#define Module_LibraryVersionInfo "0:81"
#define Module_FullVersion "0.82"
#define Module_HelpVersion "0.82 (05 Feb 2020)"
#define Module_LibraryVersionInfo "0:82"
......@@ -122,6 +122,9 @@ HAL_UARTStartUp
LDR a2, PeriBase ; first turn on the serial pins
ADD a3, a2, #GPIO_Base ; (for setting pins up)
LDR a2, [a3, #GPFSel1] ;
[ ModemControl
ORR a2, a2, #8_77000000 ; set GPIO 16 + 17 to alt3 (111)
BIC a2, a2, #8_00770000 ;
ORR a2, a2, #8_00440000 ; set GPIO 14 + 15 to alt0 (100)
STR a2, [a3, #GPFSel1] ;
......@@ -637,9 +640,12 @@ HAL_UARTModemControl
STRNE a2, [a1, #UARTCR]
DataSyncBarrier a2
MOV a1, ip
; Ensure DTR
ORR a1, ip, #1:SHL:0
; Fake control lines as though a modem is plugged in
MOV a1, #2_00011
MOV pc, lr
......@@ -672,7 +678,7 @@ HAL_UARTModemStatus
; Get current status
LDR a2, [a1, #UARTFLAG]
DataSyncBarrier a4
AND a2, a2, #FLAG_CTS
AND a2, a2, #1:SHL:FLAG_CTS
; Get old status
LDR a4, UARTOldModemStatus
; Store new status
......@@ -680,8 +686,13 @@ HAL_UARTModemStatus
PLP a3
; Calc return value
EOR a1, a4, a2
MOV a1, a1, LSR #UI_CTS
ORR a1, a1, a2, LSL #4-UI_CTS
ORR a1, a1, a2, LSL #4-FLAG_CTS
; Ensure DSR
ORR a1, a1, #1:SHL:5
; Fake control lines as though a modem is plugged in but offline
MOV a1, #2_00110000
MOV pc, lr
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment