Commit 014137bf authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Create placeholder NVMemory HAL device when EEPROM detected

The HAL device created is merely a dummy one, but presents any EEPROM detected for completeness of stuff the HAL knows about.

Version 0.87. Tagged as 'OMAP3-0_87'
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "0.86" Module_MajorVersion SETS "0.87"
Module_Version SETA 86 Module_Version SETA 87
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "21 Feb 2013" Module_Date SETS "15 Aug 2013"
Module_ApplicationDate SETS "21-Feb-13" Module_ApplicationDate SETS "15-Aug-13"
Module_ComponentName SETS "OMAP3" Module_ComponentName SETS "OMAP3"
Module_ComponentPath SETS "castle/RiscOS/Sources/HAL/OMAP3" Module_ComponentPath SETS "castle/RiscOS/Sources/HAL/OMAP3"
Module_FullVersion SETS "0.86" Module_FullVersion SETS "0.87"
Module_HelpVersion SETS "0.86 (21 Feb 2013)" Module_HelpVersion SETS "0.87 (15 Aug 2013)"
END END
/* (0.86) /* (0.87)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.86 #define Module_MajorVersion_CMHG 0.87
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 21 Feb 2013 #define Module_Date_CMHG 15 Aug 2013
#define Module_MajorVersion "0.86" #define Module_MajorVersion "0.87"
#define Module_Version 86 #define Module_Version 87
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "21 Feb 2013" #define Module_Date "15 Aug 2013"
#define Module_ApplicationDate "21-Feb-13" #define Module_ApplicationDate "15-Aug-13"
#define Module_ComponentName "OMAP3" #define Module_ComponentName "OMAP3"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP3" #define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP3"
#define Module_FullVersion "0.86" #define Module_FullVersion "0.87"
#define Module_HelpVersion "0.86 (21 Feb 2013)" #define Module_HelpVersion "0.87 (15 Aug 2013)"
#define Module_LibraryVersionInfo "0:86" #define Module_LibraryVersionInfo "0:87"
...@@ -110,6 +110,7 @@ AudioWS # Audio_WorkspaceSize ...@@ -110,6 +110,7 @@ AudioWS # Audio_WorkspaceSize
NICWS # NIC_DeviceSize NICWS # NIC_DeviceSize
CPUClkWS # CPUClk_WorkspaceSize CPUClkWS # CPUClk_WorkspaceSize
GPIOWS # HALDevice_GPIO_Size GPIOWS # HALDevice_GPIO_Size
NVRAMWS # HALDeviceSize
SDIOWS # SDHCISize * MaxSDControllers SDIOWS # SDHCISize * MaxSDControllers
BMUWS1 # BMUSize BMUWS1 # BMUSize
......
...@@ -604,11 +604,6 @@ Board_Init_IGEPv2 ...@@ -604,11 +604,6 @@ Board_Init_IGEPv2
] ]
BL USB_Init ; Uses GPTIMER2 BL USB_Init ; Uses GPTIMER2
[ MoreDebug
DebugTX "NVMemory_Init"
]
BL NVMemory_Init ; Uses GPTIMER2
[ MoreDebug [ MoreDebug
DebugTX "Timer_Init" DebugTX "Timer_Init"
] ]
...@@ -907,6 +902,7 @@ HAL_InitDevices ...@@ -907,6 +902,7 @@ HAL_InitDevices
DebugTime a1, "HAL_InitDevices @ " DebugTime a1, "HAL_InitDevices @ "
; Common HAL devices ; Common HAL devices
BL CPUClk_Init BL CPUClk_Init
BL NVMemory_Init
BL RTC_Init BL RTC_Init
BL SDMA_Init BL SDMA_Init
BL VideoDevice_Init BL VideoDevice_Init
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
EXPORT HAL_NVMemoryRead EXPORT HAL_NVMemoryRead
EXPORT HAL_NVMemoryWrite EXPORT HAL_NVMemoryWrite
IMPORT memcpy
IMPORT HAL_CounterDelay IMPORT HAL_CounterDelay
; Autodetect the EEPROM at runtime in the range 2kbit to 16kbit ; Autodetect the EEPROM at runtime in the range 2kbit to 16kbit
...@@ -212,7 +213,6 @@ NVMemory_Init ...@@ -212,7 +213,6 @@ NVMemory_Init
GPIO_SetAsOutput a1, a2, a4 GPIO_SetAsOutput a1, a2, a4
GPIO_SetAsInput a1, a3, a4 GPIO_SetAsInput a1, a3, a4
MOV a1, #0 MOV a1, #0
BL NVMemory_BGet BL NVMemory_BGet
05 05
...@@ -262,7 +262,7 @@ NVMemory_Init ...@@ -262,7 +262,7 @@ NVMemory_Init
30 30
] ]
STR v3, NVMemoryFound STR v3, NVMemoryFound
[ TryLoadedCMOS [ TryLoadedCMOS
TEQ v3, #0 TEQ v3, #0
BNE %FT50 BNE %FT50
...@@ -299,7 +299,12 @@ NVMemory_Init ...@@ -299,7 +299,12 @@ NVMemory_Init
SUBS v1, v1, #1 SUBS v1, v1, #1
BNE %BT45 BNE %BT45
50 50
] ]
; If some was found, create a placeholder HAL device
LDR a1, NVMemoryFound
TEQ a1, #0
BLNE NVMemory_AddDevice
Pull "v1-v3, pc" Pull "v1-v3, pc"
NVMemory_Barrel16 NVMemory_Barrel16
...@@ -325,6 +330,73 @@ NVMemory_Barrel16 ...@@ -325,6 +330,73 @@ NVMemory_Barrel16
Pull "v1-v2, pc" Pull "v1-v2, pc"
NVMemory_AddDevice
; void NVMemory_AddDevice(uint32_t bytesize)
Push "a1, lr"
; Copy over template
ADRL a1, NVRAMWS
ADR a2, NVMemory_AddDevice_Template
MOV a3, #HALDeviceSize
BL memcpy
; Map 256/512/1024/2048 to table index 0/1/2/3
MOV a2, a1
Pull "a3, lr"
CLZ a1, a3
RSB a1, a1, #31 - 8
ADR a4, NVMemory_AddDevice_IDs
MOV a3, a1, LSL #1
LDRH a3, [a4, a3]
STRH a3, [a2, #HALDevice_ID]
ADR a4, NVMemory_AddDevice_Descs
MOV a3, #1 + :LEN:"24Cxx EEPROM"
MLA a3, a3, a1, a4
STR a3, [a2, #HALDevice_Description]
; Tail call the OS to add it
MOV a1, #0
LDR pc, OSentries + 4*OS_AddDevice
NVMemory_AddDevice_Template
DCW HALDeviceType_SysPeri + HALDeviceSysPeri_NVRAM
DCW &1234 ; ID filled at runtime
DCD HALDeviceBus_Ser + HALDeviceSerBus_IIC
DCD 0 ; API version 0
DCD &12345678 ; Description filled at runtime
DCD 0 ; Address - N/A
% 12 ; Reserved
DCD NVMemory_AddDevice_Activate
DCD NVMemory_AddDevice_Deactivate
DCD NVMemory_AddDevice_Reset
DCD NVMemory_AddDevice_Sleep
DCD -1
DCD 0
% 8
ASSERT (. - NVMemory_AddDevice_Template) = HALDeviceSize
NVMemory_AddDevice_Activate
MOV a1, #1
MOV pc, lr
NVMemory_AddDevice_Sleep
MOV a1, #0
NVMemory_AddDevice_Deactivate
NVMemory_AddDevice_Reset
MOV pc, lr
NVMemory_AddDevice_IDs
DCW HALDeviceID_NVRAM_24C02
DCW HALDeviceID_NVRAM_24C04
DCW HALDeviceID_NVRAM_24C08
DCW HALDeviceID_NVRAM_24C16
NVMemory_AddDevice_Descs
DCB "24C02 EEPROM", 0
DCB "24C04 EEPROM", 0
DCB "24C08 EEPROM", 0
DCB "24C16 EEPROM", 0
ALIGN
NVMemory_BGet NVMemory_BGet
; int32_t NVMemory_BGet(uint32_t loc) ; int32_t NVMemory_BGet(uint32_t loc)
; Returns -1 if no ACK otherwise the byte read ; Returns -1 if no ACK otherwise the byte read
......
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