Changes

2,051 bytes added ,  18:07, 23 October 2019
Line 443: Line 443:  
| 0 || [[#HasPort]]
 
| 0 || [[#HasPort]]
 
|-
 
|-
| 1 || HasPortForDev
+
| 1 || [[#HasPortForDev]]
 
|-
 
|-
 
| 2 || [[#IsSupportedBaudRate]]
 
| 2 || [[#IsSupportedBaudRate]]
 
|-
 
|-
| 3 || IsSupportedBaudRateForDev
+
| 3 || [[#IsSupportedBaudRateForDev]]
 
|-
 
|-
 
| 4 || [[#IsSupportedFlowControlMode]]
 
| 4 || [[#IsSupportedFlowControlMode]]
 
|-
 
|-
| 5 || IsSupportedFlowControlModeForDev
+
| 5 || [[#IsSupportedFlowControlModeForDev]]
 
|-
 
|-
 
| 6 || [[#CreatePortSession]]
 
| 6 || [[#CreatePortSession]]
 
|-
 
|-
| 7 || IsSupportedPortEvent
+
| 7 || [[#IsSupportedPortEvent]]
 
|-
 
|-
| 8 || IsSupportedPortEventForDev
+
| 8 || [[#IsSupportedPortEventForDev]]
 
|-
 
|-
| 9 || [7.0.0+] IsSupportedUnknown
+
| 9 || [7.0.0+] [[#IsSupportedDevice]]
 
|-
 
|-
| 10 || [7.0.0+] IsSupportedUnknownForDev
+
| 10 || [7.0.0+] [[#IsSupportedDeviceForDev]]
 
|}
 
|}
    
== HasPort ==
 
== HasPort ==
Takes a u32 [[#UartPort]] and returns boolean success value.
+
Takes an u32 [[#UartPort]]. Returns a boolean success value.
 +
 
 +
== HasPortForDev ==
 +
Takes an u32 [[#UartPortForDev]]. Returns a boolean success value.
    
== IsSupportedBaudRate ==
 
== IsSupportedBaudRate ==
Takes a u32 [[#UartPort]] and a u32 baudrate and returns boolean success value.
+
Takes an u32 [[#UartPort]] and an u32 '''baudrate'''. Returns a boolean success value.
 +
 
 +
Supported baud rates are 57600, 115200, 1000000 and 3000000.
 +
 
 +
== IsSupportedBaudRateForDev ==
 +
Takes an u32 [[#UartPortForDev]] and an u32 '''baudrate'''. Returns a boolean success value.
 +
 
 +
Supported baud rates are 57600, 115200, 1000000 and 3000000.
    
== IsSupportedFlowControlMode ==
 
== IsSupportedFlowControlMode ==
Takes a u32 [[#UartPort]] and returns boolean success value.
+
Takes an u32 [[#UartPort]] and an u32 '''mode'''. Returns a boolean success value.
 +
 
 +
Supported modes are 0 (RTS) and 1 (CTS).
 +
 
 +
== IsSupportedFlowControlModeForDev ==
 +
Takes an u32 [[#UartPortForDev]] and an u32 '''mode'''. Returns a boolean success value.
 +
 
 +
Supported modes are 0 (RTS) and 1 (CTS).
    
== CreatePortSession ==
 
== CreatePortSession ==
Takes a u32 [[#UartPort]] and returns an [[#IPortSession]].
+
No input. Returns an [[#IPortSession]].
 +
 
 +
== IsSupportedPortEvent ==
 +
Takes an u32 [[#UartPort]] and an u32 '''event'''. Returns a boolean success value.
 +
 
 +
Supported events are 0 (data), 1 (break), 2 (unknown) and 3 (unknown).
 +
 
 +
== IsSupportedPortEventForDev ==
 +
Takes an u32 [[#UartPortForDev]] and an u32 '''event'''. Returns a boolean success value.
 +
 
 +
Supported events are 0 (data), 1 (break), 2 (unknown) and 3 (unknown).
 +
 
 +
== IsSupportedDevice ==
 +
Takes an u32 [[#UartPort]] and an u32 '''device'''. Returns a boolean success value.
 +
 
 +
Supported devices are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C.
 +
 
 +
== IsSupportedDeviceForDev ==
 +
Takes an u32 [[#UartPortForDev]] and an u32 '''device'''. Returns a boolean success value.
 +
 
 +
Supported devices are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C.
    
== UartPort ==
 
== UartPort ==
 
{| class="wikitable sortable" border="1"
 
{| class="wikitable sortable" border="1"
 
|-
 
|-
! Name || DeviceCode || Port || Usage
+
! Name || DeviceCode (internal) || DeviceCode (mapped) || Port || Usage
 +
|-
 +
| 0 || 0x03000001 || || UART-A || Invalid
 +
|-
 +
| 1 || 0x03000004 || 0x37000001 || UART-D || Bluetooth
 +
|-
 +
| 2 || 0x03000002 || 0x35000405 || UART-B || Joy-Con(R)
 +
|-
 +
| 3 || 0x03000003 || 0x3500040F || UART-C || Joy-Con(L)
 +
|-
 +
| 4 || 0x03000003 || 0x35000419 || UART-C || MCU
 +
|}
 +
 
 +
== UartPortForDev ==
 +
{| class="wikitable sortable" border="1"
 +
|-
 +
! Name || DeviceCode (internal) || DeviceCode (mapped) || Port || Usage
 
|-
 
|-
| 1 || 0x37000001 || UART-D || Bluetooth
+
| 0 || 0x03000001 || || UART-A || Invalid
 
|-
 
|-
| 2 || 0x35000405 || UART-B || Joy-Con(R)
+
| 1 || 0x03000002 || 0x35000405 || UART-B || Joy-Con(R)
 
|-
 
|-
| 3 || 0x3500040F || UART-C || Joy-Con(L)
+
| 2 || 0x03000003 || 0x3500040F || UART-C || Joy-Con(L)
 
|-
 
|-
| 4 || 0x35000419 || UART-B || MCU
+
| 3 || 0x03000004 || 0x37000001 || UART-D || Bluetooth
 
|}
 
|}
   Line 497: Line 550:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || OpenPort
+
| 0 || [[#OpenPort]]
 
|-
 
|-
| 1 || OpenPortForDev
+
| 1 || [[#OpenPortForDev]]
 
|-
 
|-
 
| 2 || GetWritableLength
 
| 2 || GetWritableLength
Line 514: Line 567:  
|}
 
|}
   −
[7.0.0+] OpenPort/OpenPortForDev now takes an additional 0x8-bytes of input.
+
=== OpenPort ===
 +
Takes an u32 [[#UartPort]], 3 u32s, 2 copy handles and 4 u8s. Returns a boolean success value.
 +
 
 +
[7.0.0+] Now takes an additional u64.
   −
=== Port Mapping ===
+
=== OpenPortForDev ===
OpenPort translates user IDs to to the [[#UartPort]] index.
+
Takes an u32 [[#UartPortForDev]], 3 u32s, 2 copy handles and 4 u8s. Returns a boolean success value.
   −
OpenPortForDev takes the port index verbatim.
+
[7.0.0+] Now takes an additional u64.
    
= pwm =
 
= pwm =