Difference between revisions of "Bus services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 50: Line 50:
 
| 9 || 0x91 || S, 1 || || ||  
 
| 9 || 0x91 || S, 1 || || ||  
 
|-
 
|-
| 0xA || 0x96 || S, 6 || Power supply monitor related. || Out || [[PTM services]]
+
| 0xA || 0x96 || S, 6 || bq24192 Charge Enable || Out || [[PTM services]]
 
|-
 
|-
 
| 0xB || 0x97 || S, 7 || || ||  
 
| 0xB || 0x97 || S, 7 || || ||  
Line 56: Line 56:
 
| 0xC || 0x26 || E, 6 || joycon(L) NwcpDriver0.GpioMonitorTask0 (insertion) || || [[HID services]]
 
| 0xC || 0x26 || E, 6 || joycon(L) NwcpDriver0.GpioMonitorTask0 (insertion) || || [[HID services]]
 
|-
 
|-
| 0xD || 5 || A, 5 || Battery event monitor related. || Out || [[PTM services]]
+
| 0xD || 5 || A, 5 || Fan enable (normal) || Out || [[PTM services]]
 
|-
 
|-
 
| 0xE || 0x78 || P, 0 || || ||  
 
| 0xE || 0x78 || P, 0 || || ||  
Line 84: Line 84:
 
| 0x1A || 0xBF || X, 7 || Volume Down || In || [[Boot2]], [[Audio services]]
 
| 0x1A || 0xBF || X, 7 || Volume Down || In || [[Boot2]], [[Audio services]]
 
|-
 
|-
| 0x1B || 0xC0 || Y, 0 || Power supply monitor related. || In || [[PTM services]]
+
| 0x1B || 0xC0 || Y, 0 || max17050 irq || In || [[PTM services]]
 
|-
 
|-
 
| 0x1C || 0xC1 || Y, 1 || || ||  
 
| 0x1C || 0xC1 || Y, 1 || || ||  
Line 92: Line 92:
 
| 0x1E || 0xAA || V, 2 || Backlight || Out || [[NV services]]
 
| 0x1E || 0xAA || V, 2 || Backlight || Out || [[NV services]]
 
|-
 
|-
| 0x1F || 0x55 || K, 5 || Charger watchdog related. || Out || [[PTM services]], [[USB services]]
+
| 0x1F || 0x55 || K, 5 || bq24192 OTG charge select || Out || [[PTM services]], [[USB services]]
 
|-
 
|-
 
| 0x20 || 0xAD || V, 5 || PD related || Out || [[USB services]]
 
| 0x20 || 0xAD || V, 5 || PD related || Out || [[USB services]]
 
|-
 
|-
| 0x21 || 0xC8 || Z, 0 || Power supply monitor related. || In || [[PTM services]]  
+
| 0x21 || 0xC8 || Z, 0 || bq24192 irq || In || [[PTM services]]  
 
|-
 
|-
 
| 0x22 || 0xCA || Z, 2 || || ||  
 
| 0x22 || 0xCA || Z, 2 || || ||  
Line 110: Line 110:
 
| 0x27 || 0x52 || K, 2 || || ||  
 
| 0x27 || 0x52 || K, 2 || || ||  
 
|-
 
|-
| 0x28 || 0x54 || K, 4 || PD related, irq || In || [[USB services]]
+
| 0x28 || 0x54 || K, 4 || bm92t36 irq || In || [[USB services]]
 
|-
 
|-
 
| 0x29 || 0x56 || K, 6 || || ||  
 
| 0x29 || 0x56 || K, 6 || || ||  
Line 138: Line 138:
 
| 0x35 || 0xE2 || CC, 2 || || ||
 
| 0x35 || 0xE2 || CC, 2 || || ||
 
|-
 
|-
| 0x36 || 0xE4 || CC, 4 || Battery event monitor related. || Out || [[PTM services]]
+
| 0x36 || 0xE4 || CC, 4 || Fan enable (high power) || Out || [[PTM services]]
 
|-
 
|-
 
| 0x37 || 0x3A || H, 2 || || ||
 
| 0x37 || 0x3A || H, 2 || || ||
Line 144: Line 144:
 
| 0x38 || 0xC9 || Z, 1 || SDCard Card Detect || In || [[Filesystem services]]
 
| 0x38 || 0xC9 || Z, 1 || SDCard Card Detect || In || [[Filesystem services]]
 
|-
 
|-
| 0x39 || 0x4D || J, 5 || Charger watchdog related. || Out || [[PTM services]], [[USB services]]
+
| 0x39 || 0x4D || J, 5 || bq24192 OTG charge select || Out || [[PTM services]], [[USB services]]
 
|-
 
|-
| 0x3A || 0x58 || L, 0 || Charger watchdog related. || Out || [[PTM services]], [[USB services]]
+
| 0x3A || 0x58 || L, 0 || bq24192 OTG charge select || Out || [[PTM services]], [[USB services]]
 
|-
 
|-
 
| 0x3B || 0x3E || H, 6 || || ||
 
| 0x3B || 0x3E || H, 6 || || ||

Revision as of 14:31, 20 February 2018

gpio

This is "nn::gpio::IManager".

Cmd Name
0 #OpenSessionForDev
1 #OpenSession
2 #OpenSessionForTest
3 IsWakeEventActive
4 GetWakeEventActiveFlagSet
5 SetWakeEventActiveFlagSetForDebug
6

OpenSessionForDev

Takes a raw GpioPadDescriptor and returns a #IPadSession session for it.

OpenSession

Same thing as OpenSessionForDev except the descriptor is looked up in the table below. Returns an #IPadSession session.

GpioPadName GpioPadDescriptor Tegra (port, pin) Usage Direction Used by
1 0xCC Z, 4 Out Audio services, Fatal services
2 0x24 E, 4 SDCard Power Out Filesystem services
3 0x3C H, 4 Out Bluetooth services
4 0xDA BB, 2
5 0xDB BB, 3 GcAsic Power Out Filesystem services
6 0xDC BB, 4 In Audio services
7 0x25 E, 5
8 0x90 S, 0 DebugPadDriver In HID services
9 0x91 S, 1
0xA 0x96 S, 6 bq24192 Charge Enable Out PTM services
0xB 0x97 S, 7
0xC 0x26 E, 6 joycon(L) NwcpDriver0.GpioMonitorTask0 (insertion) HID services
0xD 5 A, 5 Fan enable (normal) Out PTM services
0xE 0x78 P, 0
0xF 0x93 S, 3 GcAsic irq In Filesystem services
0x10 0x7D P, 5
0x11 0x7C P, 4
0x12 0x7B P, 3
0x13 0x7A P, 2
0x14 0xBC X, 4
0x15 0xAE V, 6 In Audio services
0x16 0xBA X, 2
0x17 0xB9 X, 1 In HID services
0x18 0xBD X, 5
0x19 0xBE X, 6 Volume Up In Boot2, Audio services
0x1A 0xBF X, 7 Volume Down In Boot2, Audio services
0x1B 0xC0 Y, 0 max17050 irq In PTM services
0x1C 0xC1 Y, 1
0x1D 0xA9 V, 1 Backlight Out NV services, Backlight services
0x1E 0xAA V, 2 Backlight Out NV services
0x1F 0x55 K, 5 bq24192 OTG charge select Out PTM services, USB services
0x20 0xAD V, 5 PD related Out USB services
0x21 0xC8 Z, 0 bq24192 irq In PTM services
0x22 0xCA Z, 2
0x23 0xCB Z, 3
0x24 0x4F J, 7 Touchscreen power Out HID services
0x25 0x50 K, 0
0x26 0x51 K, 1
0x27 0x52 K, 2
0x28 0x54 K, 4 bm92t36 irq In USB services
0x29 0x56 K, 6
0x2A 0x57 K, 7
0x2B 0x53 K, 3 joycon(R) NwcpDriver1.NwcpCharger Out HID services
0x2C 0xE3 CC, 3 joycon(L) NwcpDriver0.NwcpCharger Out HID services
0x2D 0x38 H, 0
0x2E 0x39 H, 1 Out Wlan services, PCIe services
0x2F 0x3B H, 3 Out Bluetooth services
0x30 0x3D H, 5
0x31 0x3F H, 7
0x32 0x40 I, 0 Backlight Out NV services
0x33 0x41 I, 1 Backlight Out NV services
0x34 0x3E H, 6 joycon(R) NwcpDriver1.GpioMonitorTask0 (insertion) HID services
0x35 0xE2 CC, 2
0x36 0xE4 CC, 4 Fan enable (high power) Out PTM services
0x37 0x3A H, 2
0x38 0xC9 Z, 1 SDCard Card Detect In Filesystem services
0x39 0x4D J, 5 bq24192 OTG charge select Out PTM services, USB services
0x3A 0x58 L, 0 bq24192 OTG charge select Out PTM services, USB services
0x3B 0x3E H, 6
0x3C 0x26 E, 6
0x3D -1
0x3E 0x33 G, 3 joycon(R) NwcpDriver1.GpioMonitorTask1 HID services
0x3F 0x1C D, 4 joycon(L) NwcpDriver0.GpioMonitorTask1 HID services
0x40 0xD9 BB, 1
0x41 0x0C B, 4
0x42 0x0D B, 5
0x43 0x21 E, 1 USB power Out USB services
0x44 0x27 E, 7
0x45 0x92 S, 2
0x46 0x95 S, 5 USB root port 4 power Out USB services
0x47 0x98 T, 0 USB root port 3 power Out USB services
0x48 0x10 C, 0 HdmiHotplug Out NV services
0x49 0x11 C, 1 USB root port 2 power Out USB services
0x4A 0x12 C, 2 HdmiHotplug Out NV services
0x4B 0x42 I, 2
0x4C 0xE6 CC, 6
-- 0xE1 CC, 1 HdmiHotplug In NV services

OpenSessionForTest

Same as #OpenSession but panics on failure.

IPadSession

This is "nn::gpio::IPadSession".

Cmd Name
0 SetDirection
1 GetDirection
2 SetInterruptMode
3 GetInterruptMode
4 SetInterruptEnable
5 GetInterruptEnable
6 GetInterruptStatus
7 ClearInterruptStatus
8 SetValue
9 GetValue
10 BindInterrupt
11 UnbindInterrupt
12 SetDebounceEnabled
13 GetDebounceEnabled
14 SetDebounceTime
15 GetDebounceTime

GpioPadDescriptor

Bits Description
7-5 Controller index
4-3 Port index
2-0 Pin number

i2c

This is "nn::i2c::IManager".

Cmd Name
0 OpenSessionForDev
1 OpenSession
2 HasDevice
3 HasDeviceForDev

Known Devices

Name Port:Addr 10bit? Speed Max Retries Retry Delay Usage Used by
0 0:52 N 100000 0 0 DebugPadDriver HID services
1 2:49 N 400000 0 0 STM touchscreen HID services
2 0:4c N 100000 0 0 TI Temperature Sensor (tmp451) PTM services
3 0:4c N 100000 0 0 duplicate, unused entry?
4 0:1c N 100000 0 0 Audio codec (rt5639) Audio services, Fatal services
5 4:68 N 400000 3 5000000 max77620_rtc0, max77620_irq0 PCV services
6 4:3c N 400000 3 5000000 PMIC (max77620), max77620_irq0 PCV services
7 4:1b N 400000 3 5000000 max77621_cpu PCV services
8 4:1c N 400000 3 5000000 max77621_gpu PCV services
9 0:6b N 100000 3 5000000 TI Charger (bq24192) PTM services
10 0:36 N 100000 3 5000000 Maxim Fuel Gauge (max17050) PCV services, PTM services
11 0:18 N 100000 3 5000000 USB-PD controller (rohm bm92t36) USB services
12 1:40 N 400000 3 5000000
13 1:41 N 400000 3 5000000
14 1:44 N 400000 3 5000000
15 1:45 N 400000 3 5000000
16 1:46 N 400000 3 5000000
17 1:47 N 400000 3 5000000
18 1:29 N 400000 3 5000000 rohm ambient light sensor (bh1730fvc) Backlight services
19 1:48 N 400000 3 5000000
20 1:49 N 400000 3 5000000
21 1:4a N 400000 3 5000000
22 1:4b N 400000 3 5000000
23 1:4d N 400000 3 5000000
24 3:50 N 100000 0 0 DisplayHdmiHotplugHandler NV services
25 3:54 N 100000 0 0 DisplayHdmiHotplugHandler NV services
26 3:3a N 100000 0 0 DisplayHdmiHotplugHandler NV services

This table is believed to be complete - entries with empty "Used by" column haven't been seen being used (devices not present on switch?).

II2cSession

This is "nn::i2c::ISession".

Cmd Name
0
1
2
3 Send
4 Receive
5 ExecuteCommandList

i2c:pcv

Cmd Name
0
1
2
10
11
12

uart

This is "nn::uart::IManager".

Cmd Name
0 DoesUartExist
1 DoesUartExistForTest
2 SetUartBaudrate
3 SetUartBaudrateForTest
4 IsSomethingUartValid
5 IsSomethingUartValidForTest
6 GetSession
7 IsSomethingUartValid2
8 IsSomethingUartValid2ForTest

IPortSession

This is "nn::uart::IPortSession".

Cmd Name Notes
0 Takes marshalled arguments
1 Takes marshalled arguments
2
3 Takes marshalled arguments
4 Returns 2x u64. Both zero.
5
6
7

pwm

This is "nn::pwm::IManager".

Cmd Name
0 OpenSessionForDev
1 OpenSession

Known Channels

Name Interface Usage Used by
1 PWM Channel 0 Fan PTM services
2 PWM Channel 1 Backlight Backlight services, NV services
3 PMC Blinker

IChannelSession

This is "nn::pwm::IChannelSession".

Cmd Name
0 SetPeriod
1 GetPeriod
2 SetDuty
3 GetDuty
4 SetEnabled
5 GetEnabled