Commit 94ea5609 authored by Ben Avison's avatar Ben Avison
Browse files

Initial import of GPIO module sources

Admin:
  Relicenced under the BSD licence with the permission of the author
parents
Dir <Obey$Dir>
amu_machine rom THROWBACK=-throwback
Dir <Obey$Dir>
amu_machine clean
stripdepnd
hdr/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
**/hdr/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
*,ffb gitlab-language=bbcbasic linguist-language=bbcbasic linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
Config block layout
GPIO number :Bits 0-7
Pin Mode ;Bits 8-11
I/O mode :Bit 12
PullUp/Down :Bit 13
input enable :Bit 14
Extended :Bit 15
Level 0 :Bit 16
Level 1 :Bit 17
Rising :Bit 18
Falling :Bit 19
Debounce :Bit 20
IRQ 1 :Bit 21
IRQ 2 :Bit 22
I2Cflag :Bit 31
File added
SWI Chunk 0x00058F80 - 0x00058FBF
Error block 0x0081DD20 - 0x0081DD2F
Module name GPIO
Star GPIOMap
GPIOMachine
^ &58F80
GPIO_ReadData # 1
GPIO_WriteData # 1
GPIO_ReadOE # 1
GPIO_WriteOE # 1
GPIO_AuxAsGPIO # 1
GPIO_ExpAsGPIO # 1
GPIO_CameraAsGPIO # 1
GPIO_AuxAsSafe # 1
GPIO_ExpAsSafe # 1
GPIO_CameraAsSafe # 1
GPIO_AuxAsUSB # 1
GPIO_ExpAsUART # 1
GPIO_AuxAsMMC # 1
GPIO_ExpAsMMC # 1
GPIO_AuxAsMM # 1
GPIO_ReadMode # 1
GPIO_WriteMode # 1
GPIO_ReadLevel0 # 1
GPIO_WriteLevel0 # 1
GPIO_ReadLevel1 # 1
GPIO_WriteLevel1 # 1
GPIO_ReadRising # 1
GPIO_WriteRising # 1
GPIO_ReadFalling # 1
GPIO_WriteFalling # 1
GPIO_ReadDebounceEnable # 1
GPIO_WriteDebounceEnable # 1
GPIO_ReadIRQ1 # 1
GPIO_WriteIRQ1 # 1
GPIO_ReadIRQ2 # 1
GPIO_WriteIRQ2 # 1
GPIO_ReadExp32 # 1
GPIO_ReadAux32 # 1
GPIO_ReadCam32 # 1
GPIO_WriteExp32 # 1
GPIO_WriteAux32 # 1
GPIO_WriteCam32 # 1
GPIO_ReadExpOE32 # 1
GPIO_ReadAuxOE32 # 1
GPIO_ReadCamOE32 # 1
GPIO_WriteExpOE32 # 1
GPIO_WriteAuxOE32 # 1
GPIO_WriteCamOE32 # 1
GPIO_Reserved1 # 1
GPIO_Reserved2 # 1
GPIO_Reserved3 # 1
GPIO_Reserved4 # 1
GPIO_Reserved5 # 1
GPIO_Reserved6 # 1
GPIO_Reserved7 # 1
GPIO_Reserved8 # 1
GPIO_Reserved9 # 1
GPIO_FlashOn # 1
GPIO_FlashOff # 1
GPIO_Info # 1
GPIO_I2CInfo # 1
GPIO_SRAMRead # 1
GPIO_SRAMWrite # 1
GPIO_Address # 1
GPIO_LoadConfig # 1
GPIO_ReadConfig # 1
GPIO_EnableI2C # 1
GPIO_GetBoard # 1
GPIO_RescanI2C # 1
Copyright (c) 2011, Tank Stage Lighting
Copyright (c) 2011, RISC OS Open Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of their
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
# Makefile for GPIO
COMPONENT = GPIO
RESOURCES = No
ROM_SOURCE = GetAll.s
ROM_MODULE ?= rm.${COMPONENT}
ROM_OBJECT ?= o.${TARGET}
include StdTools
include AAsmModule
# Dynamic dependencies:
Iconsprites <Obey$Dir>.!Sprites
PiLED is a simple program to show the use of the SWI's.
It reads the OE state of GPIO16 and then changes it to output if needed,
so that it can then switch the File LED on and off when you press any key.
Press Close to exit the program.
|wimpslot -min 32K -max 32K
|run <obey$dir>.!RunImage
TaskWindow <obey$dir>.!RunImage -wimpslot 32K
\ No newline at end of file
GBLS Module_MajorVersion
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.50"
Module_Version SETA 050
Module_MinorVersion SETS ""
Module_Date SETS "20 Mar 2013"
Module_ApplicationDate SETS "20-Mar-13"
Module_ComponentName SETS "GPIO"
Module_ComponentPath SETS ""
Module_FullVersion SETS "0.50"
Module_HelpVersion SETS "0.50 (20 Mar 2013)"
END
*
!.gitignore
;
; Copyright (c) 2011, Tank Stage Lighting
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the copyright holder nor the names of their
; contributors may be used to endorse or promote products derived from
; this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;hdr.reals
;********************** D A T A S T R U C T U R E ************************
^ 0 ; beginaddress
;which machine are we running on
machine # 4 ;gpio machine number
halproc # 4
halboard # 4
halrevision # 4
machinename # 32
;store for logical addresses
logicalstore # 4*8 ;only 6 used atm
logicalstore1 # 4
logicalsram # 4
;pi pull up/down
pipullen # 32
pipullud # 32
;i2cprotect flag
i2cprotect # 4
;i2c gpio info store
i2clowgpio # 4 ;lowest available pin number
i2chighgpio # 4 ;highest
;i2c buffers
i2csend # 4*8
i2cdata # 4*8
i2creturn # 4*8
;flash stuff
flashcount * 6 ;max GPIOs/32
flashflags # 4*flashcount ;are we a flash ?
flashmark # 32*flashcount ;on time
flashspace # 32*flashcount ;off time
flashstate # 32*flashcount ;present count
padding # 4
;--- for string displaying ----------Memory cleared upto here
MainTemp # &20
;copy of GPIO tables
gpiotablecopy # 4*((8*8)+(4*8)) ;enough for i2c as well
;cofig data space
configdata # ((6*32)+(16*8)+32) ;space for all gpio (and i2c) pins
RMAlimit * :INDEX: @
;*************************** SWI bits **************************************
Error_block * &0081DD20
Error_block_end * &0081DD2F
SWI_base * &00058F80
;*************************** Constants **************************************
;physical map locations
GPIO_1 * &48310000
GPIO_2 * &49050000
GPIO_3 * &49052000
GPIO_4 * &49054000
GPIO_5 * &49056000
GPIO_6 * &49058000
mapsize * &200
;physical for control registers for GPIO's
PADCONF_1 * &48002000
padsize * &B00
;sram
sramstart * &40200000
sramsize * &00010000
;interupt line mapping
GPIO_1_int * 29
GPIO_2_int * 30
GPIO_3_int * 31
GPIO_4_int * 32
GPIO_5_int * 33
GPIO_6_int * 34
HALDeviceBus_Interconnect * 5 :SHL: 28
HALDeviceInterconnectBus_L4 * 1 :SHL: 24
;gpio-controlreg map physical Xm use &0 to protect the register
C_gpio_0 * &1E0
C_gpio_1 * &A06
C_gpio_2 * &A0A
C_gpio_3 * &A0C
C_gpio_4 * &A0E
C_gpio_5 * &A10
C_gpio_6 * &A12
C_gpio_7 * &A14
C_gpio_8 * &A16
C_gpio_9 * &A18
C_gpio_10 * &A1A
C_gpio_11 * &A24
C_gpio_12 * &5D8
C_gpio_13 * &5DA
C_gpio_14 * &5DC
C_gpio_15 * &5DE
C_gpio_16 * &5E0
C_gpio_17 * &5E2
C_gpio_18 * &5E4
C_gpio_19 * &5E6
C_gpio_20 * &5E8
C_gpio_21 * &5EA
C_gpio_22 * &5EC
C_gpio_23 * &5EE
C_gpio_24 * &5F0
C_gpio_25 * &5F2
C_gpio_26 * &5F4
C_gpio_27 * &5F6
C_gpio_28 * &5F8
C_gpio_29 * &5FA
C_gpio_30 * &A08
C_gpio_31 * &A26
C_gpio_32 * &0 ;&238 ;INPUT ONLY, NOT AVAILABLE?
C_gpio_33 * &0 ;NOT AVAILABLE ?
C_gpio_34 * &07A
C_gpio_35 * &07C
C_gpio_36 * &07E
C_gpio_37 * &080
C_gpio_38 * &082
C_gpio_39 * &084
C_gpio_40 * &086
C_gpio_41 * &088
C_gpio_42 * &08A
C_gpio_43 * &08C
C_gpio_44 * &09E
C_gpio_45 * &0A0
C_gpio_46 * &0A2
C_gpio_47 * &0A4
C_gpio_48 * &0A6
C_gpio_49 * &0A8
C_gpio_50 * &0AA
C_gpio_51 * &0AC
C_gpio_52 * &0B0
C_gpio_53 * &0B2
C_gpio_54 * &0B4
C_gpio_55 * &0B6
C_gpio_56 * &0B8
C_gpio_57 * &0BA
C_gpio_58 * &0BC
C_gpio_59 * &0BE
C_gpio_60 * &0C6
C_gpio_61 * &0C8
C_gpio_62 * &0CA
C_gpio_63 * &0CE
C_gpio_64 * &0D0
C_gpio_65 * &0D2
C_gpio_66 * &0D4
C_gpio_67 * &0D6
C_gpio_68 * &0D8
C_gpio_69 * &0DA
C_gpio_70 * &0DC
C_gpio_71 * &0DE
C_gpio_72 * &0E0
C_gpio_73 * &0E2
C_gpio_74 * &0E4
C_gpio_75 * &0E6
C_gpio_76 * &0E8
C_gpio_77 * &0EA
C_gpio_78 * &0EC
C_gpio_79 * &0EE
C_gpio_80 * &0F0
C_gpio_81 * &0F2
C_gpio_82 * &0F4
C_gpio_83 * &0F6
C_gpio_84 * &0F8
C_gpio_85 * &0FA
C_gpio_86 * &0FC
C_gpio_87 * &0FE
C_gpio_88 * &100
C_gpio_89 * &102
C_gpio_90 * &104
C_gpio_91 * &106
C_gpio_92 * &108
C_gpio_93 * &10A
C_gpio_94 * &10C
C_gpio_95 * &10E
C_gpio_96 * &110
C_gpio_97 * &112
C_gpio_98 * &114
C_gpio_99 * &116 ;INPUT ONLY
C_gpio_100 * &118 ;INPUT ONLY
C_gpio_101 * &11A
C_gpio_102 * &11C
C_gpio_103 * &11E
C_gpio_104 * &120
C_gpio_105 * &122 ;INPUT ONLY
C_gpio_106 * &124 ;INPUT ONLY
C_gpio_107 * &126 ;INPUT ONLY
C_gpio_108 * &128 ;INPUT ONLY
C_gpio_109 * &12A
C_gpio_110 * &12C
C_gpio_111 * &12E
C_gpio_112 * &134 ;INPUT ONLY
C_gpio_113 * &136 ;INPUT ONLY
C_gpio_114 * &138 ;INPUT ONLY
C_gpio_115 * &13A ;INPUT ONLY
C_gpio_116 * &13C
C_gpio_117 * &13E
C_gpio_118 * &140
C_gpio_119 * &142
C_gpio_120 * &144
C_gpio_121 * &146
C_gpio_122 * &148
C_gpio_123 * &14A
C_gpio_124 * &14C
C_gpio_125 * &14E
C_gpio_126 * &132
C_gpio_127 * &0 ;&A54 ;different on35xx
C_gpio_128 * &0 ;&A58 ;different on35xx
C_gpio_129 * &0 ;&A5A ;different on35xx
C_gpio_130 * &158
C_gpio_131 * &15A
C_gpio_132 * &15C
C_gpio_133 * &15E
C_gpio_134 * &160
C_gpio_135 * &162
C_gpio_136 * &164
C_gpio_137 * &166
C_gpio_138 * &168
C_gpio_139 * &16A
C_gpio_140 * &16C
C_gpio_141 * &16E
C_gpio_142 * &170
C_gpio_143 * &172
C_gpio_144 * &174
C_gpio_145 * &176
C_gpio_146 * &178
C_gpio_147 * &17A
C_gpio_148 * &17C
C_gpio_149 * &17E
C_gpio_150 * &180
C_gpio_151 * &182
C_gpio_152 * &184
C_gpio_153 * &186
C_gpio_154 * &188
C_gpio_155 * &18A
C_gpio_156 * &18C
C_gpio_157 * &18E
C_gpio_158 * &190
C_gpio_159 * &192
C_gpio_160 * &194
C_gpio_161 * &196
C_gpio_162 * &198
C_gpio_163 * &19A
C_gpio_164 * &19C
C_gpio_165 * &19E
C_gpio_166 * &1A0
C_gpio_167 * &130
C_gpio_168 * &1BE
C_gpio_169 * &1B0
C_gpio_170 * &1C6
C_gpio_171 * &1C8
C_gpio_172 * &1CA
C_gpio_173 * &1CC
C_gpio_174 * &1CE
C_gpio_175 * &1D0
C_gpio_176 * &1D2
C_gpio_177 * &1D4
C_gpio_178 * &1D6
C_gpio_179 * &1D8
C_gpio_180 * &1DA
C_gpio_181 * &1DC
C_gpio_182 * &1DE
C_gpio_183 * &1C0
C_gpio_184 * &1C2
C_gpio_185 * &1C4
C_gpio_186 * &1E2
C_gpio_187 * &0 ;&23A ;INPUT ONLY NOT AVAILABLE ?
C_gpio_188 * &1B2
C_gpio_189 * &1B4
C_gpio_190 * &1B6
C_gpio_191 * &1B8
top_gpio * 191
;gpio pin numbers we need for connectors
gpio_0 * 0
gpio_1 * 1
gpio_2 * 2
gpio_3 * 3
gpio_4 * 4
gpio_5 * 5
gpio_6 * 6
gpio_7 * 7
gpio_8 * 8
gpio_9 * 9
gpio_10 * 10
gpio_11 * 11
gpio_12 * 12
gpio_13 * 13
gpio_14 * 14
gpio_15 * 15
gpio_16 * 16
gpio_17 * 17
gpio_18 * 18
gpio_19 * 19
gpio_20 * 20
gpio_21 * 21
gpio_22 * 22
gpio_23 * 23
gpio_24 * 24
gpio_25 * 25
gpio_26 * 26
gpio_27 * 27
gpio_28 * 28
gpio_29 * 29
gpio_30 * 30
gpio_31 * 31
gpio_57 * 57
gpio_66 * 66
gpio_67 * 67
gpio_68 * 68
gpio_69 * 69
gpio_70 * 70
gpio_71 * 71
gpio_72 * 72
gpio_73 * 73
gpio_74 * 74
gpio_75 * 75
gpio_76 * 76
gpio_77 * 77
gpio_78 * 78
gpio_79 * 79
gpio_80 * 80
gpio_81 * 81
gpio_82 * 82
gpio_83 * 83
gpio_84 * 84
gpio_85 * 85
gpio_86 * 86
gpio_87 * 87
gpio_88 * 88
gpio_89 * 89
gpio_90 * 90
gpio_91 * 91
gpio_92 * 92
gpio_93 * 93
gpio_94 * 94
gpio_95 * 95
gpio_96 * 96
gpio_97 * 97
gpio_99 * 99 ;INPUT ONLY
gpio_100 * 100 ;INPUT ONLY
gpio_101 * 101
gpio_102 * 102
gpio_103 * 103
gpio_104 * 104
gpio_105 * 105 ;INPUT ONLY
gpio_106 * 106 ;INPUT ONLY
gpio_107 * 107 ;INPUT ONLY
gpio_108 * 108 ;INPUT ONLY
gpio_109 * 109
gpio_110 * 110
gpio_130 * 130
gpio_131 * 131
gpio_132 * 132
gpio_133 * 133
gpio_134 * 134
gpio_135 * 135
gpio_136 * 136
gpio_137 * 137
gpio_138 * 138
gpio_139 * 139
gpio_140 * 140
gpio_141 * 141
gpio_142 * 142
gpio_143 * 143
gpio_144 * 144
gpio_145 * 145
gpio_146 * 146
gpio_148 * 148
gpio_149 * 149
gpio_150 * 150
gpio_151 * 151
gpio_153 * 153
gpio_156 * 156
gpio_157 * 157
gpio_158 * 158
gpio_159 * 159
gpio_160 * 160
gpio_161 * 161
gpio_162 * 162
gpio_163 * 163
gpio_164 * 164
gpio_167 * 167
gpio_168 * 168
gpio_170 * 170
gpio_171 * 171
gpio_172 * 172
gpio_173 * 173
gpio_174 * 174
gpio_177 * 177
gpio_183 * 183
gpio_184 * 184
gpio_185 * 185
gpio_186 * 186
;GPIO system registers
GPIO_SYSCONFIG * &010
GPIO_SYSTATUS * &014
GPIO_IRQSTATUS1 * &018
GPIO_IRQENABLE1 * &01C
GPIO_WAKEUPENABLE * &020
GPIO_IRQSTATUS2 * &028
GPIO_IRQENABLE2 * &02C
GPIO_CTRL * &030
GPIO_OE * &034
GPIO_DATAIN * &038
GPIO_DATAOUT * &03C
GPIO_LEVELDETECT0 * &040
GPIO_LEVELDETECT1 * &044
GPIO_RISINGDETECT * &048
GPIO_FALLINGDETECT * &04C
GPIO_DEBOUNCEENABLE * &050
GPIO_DEBOUNCETIME * &054
GPIO_CLEARIRQENABLE1 * &060