Commit 28fc9a0a authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Create placeholder NVMemory HAL device when EEPROM detected

Merged from OMAP3-0_87, builds but not tested.
Expanded tabs in hdr/StaticWS.

Version 0.17. Tagged as 'OMAP4-0_17'
parent f1d23095
/* (0.16)
/* (0.17)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.16
#define Module_MajorVersion_CMHG 0.17
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Apr 2013
#define Module_Date_CMHG 15 Aug 2013
#define Module_MajorVersion "0.16"
#define Module_Version 16
#define Module_MajorVersion "0.17"
#define Module_Version 17
#define Module_MinorVersion ""
#define Module_Date "13 Apr 2013"
#define Module_Date "15 Aug 2013"
#define Module_ApplicationDate "13-Apr-13"
#define Module_ApplicationDate "15-Aug-13"
#define Module_ComponentName "OMAP4"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP4"
#define Module_FullVersion "0.16"
#define Module_HelpVersion "0.16 (13 Apr 2013)"
#define Module_LibraryVersionInfo "0:16"
#define Module_FullVersion "0.17"
#define Module_HelpVersion "0.17 (15 Aug 2013)"
#define Module_LibraryVersionInfo "0:17"
......@@ -29,16 +29,16 @@ sb RN 9
; Per-SDHCI workspace
^ 0
SDHCIDevice # HALDevice_SDHCISize ; see Hdr:SDHCIDevice
SDHCISB # 4 ; pointer to HAL workspace for HAL calls
SDHCISlotInfo # HALDeviceSDHCI_SlotInfo_Size ; each of our controllers has just the 1 slot
SDHCISize * :INDEX:@
^ 0
SDHCIDevice # HALDevice_SDHCISize ; see Hdr:SDHCIDevice
SDHCISB # 4 ; pointer to HAL workspace for HAL calls
SDHCISlotInfo # HALDeviceSDHCI_SlotInfo_Size ; each of our controllers has just the 1 slot
SDHCISize * :INDEX:@
MaxSDControllers * 2 ; I don't think any platform uses all 3 controllers?
MaxSDControllers * 2 ; I don't think any platform uses all 3 controllers?
^ 0,sb
BoardConfig # BoardConfig_Size
BoardConfig # BoardConfig_Size
; NOTE: Almost all code assumes the board config is at the start. You have been warned!
OSheader # 4
OSentries # 4*(HighestOSEntry+1)
......@@ -100,15 +100,16 @@ VideoDevice # Video_DeviceSize
VideoBoardConfig # VideoBoardConfig_Size
AudioWS # Audio_WorkspaceSize
GPIOWS # HALDevice_GPIO_Size
GPIOWS # HALDevice_GPIO_Size
NVRAMWS # HALDeviceSize
SDIOWS # SDHCISize * MaxSDControllers
SDIOWS # SDHCISize * MaxSDControllers
; align on 16 byte boundary
# (((:INDEX:@)+15):AND::NOT:15)-(:INDEX:@)
USBAllocAreaSize * 16*1024
USBAllocAreaSize * 16*1024
; With an ordinary setup, about half of this memory gets used.
; About 3K goes to some big allocs (looks like the bus structs)
......
......@@ -589,11 +589,6 @@ HAL_Init
] ; MoreDebug
BL USB_Init
[ MoreDebug
DebugTX "NVMemory_Init"
] ; MoreDebug
BL NVMemory_Init
[ MoreDebug
DebugTX "Timer_Init"
] ; MoreDebug
......@@ -728,6 +723,7 @@ HAL_InitDevices
Entry "v1-v3"
DebugTime a1, "HAL_InitDevices @ "
; Common HAL devices
BL NVMemory_Init
BL RTC_Init
BL SDMA_Init
BL VideoDevice_Init
......
......@@ -33,6 +33,7 @@
EXPORT HAL_NVMemoryRead
EXPORT HAL_NVMemoryWrite
IMPORT memcpy
IMPORT HAL_CounterDelay
; Autodetect the EEPROM at runtime in the range 2kbit to 16kbit
......@@ -301,6 +302,11 @@ NVMemory_Init
BNE %BT45
50
]
; If some was found, create a placeholder HAL device
LDR a1, NVMemoryFound
TEQ a1, #0
BLNE NVMemory_AddDevice
Pull "v1-v3, pc"
NVMemory_Barrel16
......@@ -326,6 +332,73 @@ NVMemory_Barrel16
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
; int32_t NVMemory_BGet(uint32_t loc)
; 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