; Copyright 2010 Castle Technology Ltd ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; GET Hdr:ListOpts GET Hdr:Macros GET Hdr:System GET Hdr:Machine.<Machine> GET Hdr:ImageSize.<ImageSize> $GetIO GET Hdr:OSEntries GET Hdr:HALEntries GET hdr.omap3530 GET hdr.StaticWS GET hdr.Timers GET hdr.GPMC AREA |Asm$$Code|, CODE, READONLY, PIC EXPORT GPMC_Init EXPORT GPMC_Enable GPMC_Init ; Do the usual - poke the reset bit ; Might also want to enable/configure clocks? LDR a1, GPMC_Regs_Log MOV a2, #2 STR a2, [a1, #GPMC_SYSCONFIG] 10 LDR a2, [a1, #GPMC_SYSTATUS] TST a2, #1 BEQ %BT10 MOV a2, #&11 ; smart-idle, autoidle STR a2, [a1, #GPMC_SYSCONFIG] MOV pc, lr GPMC_Enable ; a1 = CS number ; a2 = pointer to values to use for the 7 configuration registers. CS_VALID must be set ; Returns: ; a2 = CS physical base addr ; a3 = CS size ; (registers chosen for ease of OS_MapInIO call) LDR a3, GPMC_Regs_Log MOV a4, #GPMC_CS_SIZE MLA a3, a4, a1, a3 LDMIA a2!, {a1, a4, ip} ADD a3, a3, #GPMC_CS_BASE STMIA a3!, {a1, a4, ip} LDMIA a2, {a1, a2, a4, ip} STMIA a3, {a1, a2, a4, ip} MOV a3, #&10 MOV a2, ip, LSL #24 ; Shift base address to correct location SUB a3, a3, ip, LSR #8 ; Get CS size in 16MB units BIC a2, a2, #&C0000000 ; Mask off unwanted bits (CS_VALID) MOV a3, a3, LSL #24 MOV pc, lr END