Difference between revisions of "GPIO Services"

From 3dbrew
Jump to navigation Jump to search
(26 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
[[Category:Services]]
 
[[Category:Services]]
 
= GPIO Service Names =
 
= GPIO Service Names =
* "gpio:CDC"
+
{| class="wikitable" border="1"
* "gpio:MCU"
+
|-
* "gpio:HID"
+
!  Service name
* "gpio:NWM"
+
!  Permitted GPIO bitmasks
* "gpio:IR"
+
|-
* "gpio:NFC"
+
| gpio:CDC
 +
| 0x48
 +
|-
 +
| gpio:MCU
 +
| 0x48020
 +
|-
 +
| gpio:HID
 +
| 0x4301
 +
|-
 +
| gpio:NWM
 +
| 0x40020
 +
|-
 +
| gpio:IR
 +
| 0xEC0
 +
|-
 +
| gpio:NFC
 +
| 0x13000
 +
|-
 +
| gpio:QTM
 +
| 0x20000
 +
|}
  
= HID Service =
+
For the mapping between GPIO bitmasks and IRQs see: [[GPIO:BindInterrupt#Supported_values]].
 +
 
 +
The commands for these services are identical.
 +
 
 +
The input bitmask for each command is masked with the above permission bitmask, if the result is non-zero an error is occurred.
 +
 
 +
= GPIO Services =
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
 
!  Command Header
 
!  Command Header
 
!  Description
 
!  Description
 +
!  Uses [[GPIO_Registers|GPIO Regs]]
 +
|-
 +
| 0x00010040
 +
| u32 GetRegPart1(u32 mask)
 +
| 0x10147010, 0x10147020
 +
|-
 +
| 0x00020080
 +
| void SetRegPart1(u32 value, u32 mask)
 +
| 0x10147010, 0x10147020
 +
|-
 +
| 0x00030040
 +
| u32 GetRegPart2(u32 mask)
 +
| 0x10147010, 0x10147024
 +
|-
 +
| 0x00040080
 +
| u32 SetRegPart2(u32 value, u32 mask)
 +
| 0x10147010, 0x10147024
 +
|-
 +
| 0x00050040
 +
| u32 GetInterruptMask(u32 mask)
 +
| 0x10147010, 0x10147024
 +
|-
 +
| 0x00060080
 +
| void SetInterruptMask(u32 value, u32 mask)
 +
| 0x10147010, 0x10147024
 
|-
 
|-
 
| 0x00070040
 
| 0x00070040
| u32 unk
+
| [[GPIO:GetGPIOData|GetGPIOData]]
 +
| 0x10147000, 0x10147010, 0x10147014, 0x10147020, 0x10147028
 +
|-
 +
| 0x00080080
 +
| [[GPIO:SetGPIOData|SetGPIOData]]
 +
| 0x10147010, 0x10147014, 0x10147020, 0x10147028
 +
|-
 +
| 0x00090082
 +
| [[GPIO:BindInterrupt|BindInterrupt]]
 +
| None
 +
|-
 +
| 0x000A0042
 +
| [[GPIO:UnbindInterrupt|UnbindInterrupt]]
 +
| None
 
|}
 
|}
  
= I2C Service =
+
=GPIO Bitmask=
 +
The bitmask used by the service commands determines which bits in the GPIO registers to access. The output value from [[GPIO:GetGPIOData|GetGPIOData]] uses the same format as the bitmask: the values of bits in the output field are set to the value of GPIO data when those bits are set in the input bitmask.
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Command Header
+
Bits in the bitmask
 +
!  Register
 +
!  Bits from register
 +
!  Handled with [[GPIO:SetGPIOData]]
 +
|-
 +
| 0-2 (0x7)
 +
| 0x10147000
 +
| 0-2
 +
| No
 +
|-
 +
| 3-4 (0x18)
 +
| 0x10147010
 +
| 0-1
 +
| Yes
 +
|-
 +
| 5 (0x20)
 +
| 0x10147014
 +
| 0
 +
| Yes
 +
|-
 +
| 6-17 (0x3FFC0)
 +
| 0x10147020
 +
| 0-11
 +
| Yes
 +
|-
 +
| 18 (0x40000)
 +
| 0x10147028
 +
| 0
 +
| Yes
 +
|}
 +
 
 +
==GPIO Bits==
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Bit
 +
!  Bitmask
 +
!  Accessible via GPIO service
 +
!  Used by
 
!  Description
 
!  Description
 
|-
 
|-
| 0x0001....
+
| 0
| ?(u32 unk1,u32* ret) //reads from 0x1ec47020
+
| 0x1
 +
| gpio:HID
 +
| HID-sysmodule
 +
| Used with [[HID_Shared_Memory|HID]] PAD state.
 +
|-
 +
| 1
 +
| 0x2
 +
| None
 +
|
 +
| Not known to be used by ''anything'', with the latest system-version at least.
 +
|-
 +
| 2
 +
| 0x4
 +
| None
 +
|
 +
| Not known to be used by ''anything'', with the latest system-version at least.
 +
|-
 +
| 3
 +
| 0x8
 +
| gpio:CDC
 +
| ?
 +
| ?
 +
|-
 +
| 4
 +
| 0x10
 +
| None
 +
|
 +
| Not known to be used by ''anything'', with the latest system-version at least.
 
|-
 
|-
| 0x0002....
+
| 5
| ?(u32 unk1,u32 unk2)
+
| 0x20
 +
| gpio:MCU, gpio:NWM
 +
| ?
 +
| ?
 
|-
 
|-
| 0x0003....
+
| 6
| ?(u32 unk1,u32* ret)
+
| 0x40
 +
| gpio:CDC, gpio:IR
 +
| ?
 +
| ?
 
|-
 
|-
| 0x0004....
+
| 7
| ?(u32 unk1,u32 unk2)
+
| 0x80
 +
| gpio:IR
 +
| Boot11
 +
| ?
 
|-
 
|-
| 0x0005....
+
| 8
| ?(u32 unk1,u32* ret)
+
| 0x100
 +
| gpio:HID
 +
| ?
 +
| ?
 
|-
 
|-
| 0x0006....
+
| 9
| ?(u32 unk1,u32 unk2)
+
| 0x200
 +
| gpio:HID, gpio:IR
 +
| HID-sysmodule and IR-sysmodule
 +
| Unknown, used with ir:rst.
 
|-
 
|-
| 0x0007....
+
| 10
| GetIRGPIO(u32 unk1,u32* ret)
+
| 0x400
 +
| gpio:IR
 +
| IR-sysmodule, Boot11
 +
| IR [[IRU:SetIRLEDState|send]]. 1 = IR LED enable, 0 = IR LED disable.
 
|-
 
|-
| 0x0008....
+
| 11
| SetIRGPIO(u32 unk1,u32 unk2)
+
| 0x800
 +
| gpio:IR
 +
| IR-sysmodule
 +
| IR [[IRU:GetIRLEDRecvState|receive]]
 
|-
 
|-
| 0x00090082
+
| 12
| ?(u32 unk1,u32 unk2,HANDEL unk3)
+
| 0x1000
 +
| gpio:NFC
 +
| ?
 +
| ?
 +
|-
 +
| 13
 +
| 0x2000
 +
| gpio:NFC
 +
| ?
 +
| ?
 +
|-
 +
| 14
 +
| 0x4000
 +
| gpio:HID
 +
| HID-sysmodule
 +
| Used with [[HID_Shared_Memory|HID]]  PAD state.
 +
|-
 +
| 15
 +
| 0x8000
 +
| gpio:MCU
 +
| ?
 +
| ?
 +
|-
 +
| 16
 +
| 0x10000
 +
| gpio:NFC
 +
| ?
 +
| ?
 +
|-
 +
| 17
 +
| 0x20000
 +
| gpio:QTM
 +
| ?
 +
| ?
 +
|-
 +
| 18
 +
| 0x40000
 +
| gpio:MCU, gpio:NWM
 +
| NWM-sysmodule
 +
| Wifi enable. 1=Enabled, 0=Disabled.
 
|}
 
|}

Revision as of 14:49, 1 October 2017

GPIO Service Names

Service name Permitted GPIO bitmasks
gpio:CDC 0x48
gpio:MCU 0x48020
gpio:HID 0x4301
gpio:NWM 0x40020
gpio:IR 0xEC0
gpio:NFC 0x13000
gpio:QTM 0x20000

For the mapping between GPIO bitmasks and IRQs see: GPIO:BindInterrupt#Supported_values.

The commands for these services are identical.

The input bitmask for each command is masked with the above permission bitmask, if the result is non-zero an error is occurred.

GPIO Services

Command Header Description Uses GPIO Regs
0x00010040 u32 GetRegPart1(u32 mask) 0x10147010, 0x10147020
0x00020080 void SetRegPart1(u32 value, u32 mask) 0x10147010, 0x10147020
0x00030040 u32 GetRegPart2(u32 mask) 0x10147010, 0x10147024
0x00040080 u32 SetRegPart2(u32 value, u32 mask) 0x10147010, 0x10147024
0x00050040 u32 GetInterruptMask(u32 mask) 0x10147010, 0x10147024
0x00060080 void SetInterruptMask(u32 value, u32 mask) 0x10147010, 0x10147024
0x00070040 GetGPIOData 0x10147000, 0x10147010, 0x10147014, 0x10147020, 0x10147028
0x00080080 SetGPIOData 0x10147010, 0x10147014, 0x10147020, 0x10147028
0x00090082 BindInterrupt None
0x000A0042 UnbindInterrupt None

GPIO Bitmask

The bitmask used by the service commands determines which bits in the GPIO registers to access. The output value from GetGPIOData uses the same format as the bitmask: the values of bits in the output field are set to the value of GPIO data when those bits are set in the input bitmask.

Bits in the bitmask Register Bits from register Handled with GPIO:SetGPIOData
0-2 (0x7) 0x10147000 0-2 No
3-4 (0x18) 0x10147010 0-1 Yes
5 (0x20) 0x10147014 0 Yes
6-17 (0x3FFC0) 0x10147020 0-11 Yes
18 (0x40000) 0x10147028 0 Yes

GPIO Bits

Bit Bitmask Accessible via GPIO service Used by Description
0 0x1 gpio:HID HID-sysmodule Used with HID PAD state.
1 0x2 None Not known to be used by anything, with the latest system-version at least.
2 0x4 None Not known to be used by anything, with the latest system-version at least.
3 0x8 gpio:CDC ? ?
4 0x10 None Not known to be used by anything, with the latest system-version at least.
5 0x20 gpio:MCU, gpio:NWM ? ?
6 0x40 gpio:CDC, gpio:IR ? ?
7 0x80 gpio:IR Boot11 ?
8 0x100 gpio:HID ? ?
9 0x200 gpio:HID, gpio:IR HID-sysmodule and IR-sysmodule Unknown, used with ir:rst.
10 0x400 gpio:IR IR-sysmodule, Boot11 IR send. 1 = IR LED enable, 0 = IR LED disable.
11 0x800 gpio:IR IR-sysmodule IR receive
12 0x1000 gpio:NFC ? ?
13 0x2000 gpio:NFC ? ?
14 0x4000 gpio:HID HID-sysmodule Used with HID PAD state.
15 0x8000 gpio:MCU ? ?
16 0x10000 gpio:NFC ? ?
17 0x20000 gpio:QTM ? ?
18 0x40000 gpio:MCU, gpio:NWM NWM-sysmodule Wifi enable. 1=Enabled, 0=Disabled.