Bus services: Difference between revisions
No edit summary |
|||
Line 116: | Line 116: | ||
== OpenSessionForDev == | == OpenSessionForDev == | ||
Takes an u32 ''' | Takes an input u32 '''BusIdx''', an input u16 '''SlaveAddress''', and 2 input u32s [[#AddressingMode]] and [[#SpeedMode]]. Returns an [[#II2cSession]]. | ||
== OpenSession == | == OpenSession == | ||
Takes an [[#I2cDevice]] | Takes an input u32 [[#I2cDevice]]. Returns an output [[#II2cSession]]. | ||
== HasDevice == | == HasDevice == | ||
Takes an [[#I2cDevice]] | Takes an input u32 [[#I2cDevice]]. Returns an output boolean success value. | ||
== HasDeviceForDev == | == HasDeviceForDev == | ||
Takes an u32 ''' | Takes an input u32 '''BusIdx''', an input u16 '''SlaveAddress''', and 2 input u32s [[#AddressingMode]] and [[#SpeedMode]]. Returns an output boolean success value. | ||
== OpenSession2 == | == OpenSession2 == | ||
Same as [[#OpenSession_2|OpenSession]] but takes | Same as [[#OpenSession_2|OpenSession]] but takes an input u32 [[#I2cDevice|DeviceCode]]. | ||
== II2cSession == | == II2cSession == | ||
Line 137: | Line 137: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || [1.0.0-5.1.0] | | 0 || [1.0.0-5.1.0] SendOld | ||
|- | |- | ||
| 1 || [1.0.0-5.1.0] | | 1 || [1.0.0-5.1.0] ReceiveOld | ||
|- | |- | ||
| 2 || [1.0.0-5.1.0] | | 2 || [1.0.0-5.1.0] ExecuteCommandListOld | ||
|- | |- | ||
| 10 || [[# | | 10 || [[#Send]] | ||
|- | |- | ||
| 11 || | | 11 || [[#Receive]] | ||
|- | |- | ||
| 12 || [[# | | 12 || [[#ExecuteCommandList]] | ||
|- | |- | ||
| 13 || [6.0.0+] [[#SetRetryValues]] | | 13 || [6.0.0+] [[#SetRetryValues]] | ||
|} | |} | ||
== | == Send == | ||
Takes | Takes a type-0x21 input buffer '''InData''' and an input u32 [[#TransactionOption]]. No output. | ||
== | == Receive == | ||
Takes a | Takes a type-0x22 output buffer '''OutData''' and an input u32 [[#TransactionOption]]. No output. | ||
== ExecuteCommandList == | |||
Takes a type-0x22 output buffer '''ReceiveBuffer''' and a type-0x9 input buffer '''CommandList'''. No output. | |||
=== Commands === | === Commands === | ||
This is "nn::i2c::I2cCommand". | |||
{| class=wikitable | {| class=wikitable | ||
! | ! Bits || Name | ||
|- | |- | ||
| 0 || | | 0-5 || [[#CommandId]] | ||
|- | |- | ||
| 6 | | 6-7 || [[#TransactionOption]] | ||
|} | |} | ||
A send command will write bytes to the device using the format: [u8 cmd_send] [u8 len] <bytes> | |||
A receive command will read bytes from the device using the format: [u8 cmd_receive] [u8 len] | |||
An extension sleep command will stall the device using the format: [u8 cmd_extension] [u8 ms] | |||
== SetRetryValues == | == SetRetryValues == | ||
Takes 2 u32s '''MaxRetries''' and '''RetryDelay'''. | Takes 2 input u32s '''MaxRetries''' and '''RetryDelay'''. No output. | ||
= uart = | = uart = | ||
Line 212: | Line 218: | ||
== IsSupportedBaudRate == | == IsSupportedBaudRate == | ||
Takes | Takes 2 input u32s [[#UartPort]] and '''BaudRate'''. Returns an output boolean success value. | ||
Supported baud rates are 57600, 115200, 1000000 and 3000000. | Supported baud rates are 57600, 115200, 1000000 and 3000000. | ||
== IsSupportedBaudRateForDev == | == IsSupportedBaudRateForDev == | ||
Takes | Takes 2 input u32s [[#UartPortForDev]] '''BaudRate'''. Returns an output boolean success value. | ||
Supported baud rates are 57600, 115200, 1000000 and 3000000. | Supported baud rates are 57600, 115200, 1000000 and 3000000. | ||
== IsSupportedFlowControlMode == | == IsSupportedFlowControlMode == | ||
Takes | Takes 2 input u32s [[#UartPort]] and [[#FlowControlMode]]. Returns an output boolean success value. | ||
== IsSupportedFlowControlModeForDev == | == IsSupportedFlowControlModeForDev == | ||
Takes | Takes 2 input u32s [[#UartPortForDev]] and [[#FlowControlMode]]. Returns an output boolean success value. | ||
== CreatePortSession == | == CreatePortSession == | ||
Line 235: | Line 237: | ||
== IsSupportedPortEvent == | == IsSupportedPortEvent == | ||
Takes | Takes 2 input u32s [[#UartPort]] and [[#PortEventType]]. Returns an output boolean success value. | ||
== IsSupportedPortEventForDev == | == IsSupportedPortEventForDev == | ||
Takes | Takes 2 input u32s [[#UartPortForDev]] and [[#PortEventType]]. Returns an output boolean success value. | ||
== IsSupportedDeviceVariation == | == IsSupportedDeviceVariation == | ||
Takes | Takes 2 input u32s [[#UartPort]] and '''DeviceVariation'''. Returns an output boolean success value. | ||
Supported device variations are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C. | Supported device variations are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C. | ||
== IsSupportedDeviceVariationForDev == | == IsSupportedDeviceVariationForDev == | ||
Takes | Takes 2 input u32s [[#UartPortForDev]] and '''DeviceVariation'''. Returns an output boolean success value. | ||
Supported device variations are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C. | Supported device variations are 0 (Bluetooth) for UART-D, 0 (Joy-Con(R)) for UART-B, 0 (Joy-Con(L)) and 1 (MCU) for UART-C. | ||
Line 279: | Line 277: | ||
=== OpenPort === | === OpenPort === | ||
Takes | Takes 3 input u32s [[#UartPort]], '''BaudRate''' and [[#FlowControlMode]], 2 input u64s '''SendBufferLength''' and '''ReceiveBufferLength''' and 2 input TransferMemory handles '''SendHandle''' and '''ReceiveHandle'''. Returns an output boolean success value. | ||
[6.0.0+] Takes 4 input u8s (padded as u32) '''IsInvertTx''', '''IsInvertRx''', '''IsInvertRts''' and '''IsInvertCts''', | [6.0.0+] Takes 4 input u8s (padded as u32) '''IsInvertTx''', '''IsInvertRx''', '''IsInvertRts''' and '''IsInvertCts''', 3 input u32s [[#UartPort]], '''BaudRate''' and [[#FlowControlMode]], 2 input u64s '''SendBufferLength''' and '''ReceiveBufferLength''' and 2 input TransferMemory handles '''SendHandle''' and '''ReceiveHandle'''. Returns an output boolean success value. | ||
[7.0.0+] Takes 4 input u8s (padded as u32) '''IsInvertTx''', '''IsInvertRx''', '''IsInvertRts''' and '''IsInvertCts''', | [7.0.0+] Takes 4 input u8s (padded as u32) '''IsInvertTx''', '''IsInvertRx''', '''IsInvertRts''' and '''IsInvertCts''', 4 input u32s [[#UartPort]], '''BaudRate''', [[#FlowControlMode]] and '''DeviceVariation''', 2 input u64s '''SendBufferLength''' and '''ReceiveBufferLength''' and 2 input TransferMemory handles '''SendHandle''' and '''ReceiveHandle'''. Returns an output boolean success value. | ||
=== OpenPortForDev === | === OpenPortForDev === | ||
Line 292: | Line 290: | ||
=== Send === | === Send === | ||
Takes a type-0x21 input buffer ''' | Takes a type-0x21 input buffer '''InData'''. Returns an output u64 size. | ||
=== GetReadableLength === | === GetReadableLength === | ||
Line 298: | Line 296: | ||
=== Receive === | === Receive === | ||
Takes a type-0x22 output buffer ''' | Takes a type-0x22 output buffer '''OutData'''. Returns an output u64 size. | ||
=== BindPortEvent === | === BindPortEvent === | ||
Takes an input u32 | Takes an input u32 [[#PortEventType]] and an input s64 '''Threshold'''. Returns an output boolean success value and an Event handle with EventClearMode=0. | ||
=== UnbindPortEvent === | === UnbindPortEvent === | ||
Takes an input u32 | Takes an input u32 [[#PortEventType]]. Returns an output boolean success value. | ||
= pwm = | = pwm = | ||
Line 787: | Line 785: | ||
|- | |- | ||
| [8.0.0+] 31 || || 0x36000001 || 1:08 || N || 400000 || 3 || 5000000 || NFC IC || [[NFC services]] || Hoag | | [8.0.0+] 31 || || 0x36000001 || 1:08 || N || 400000 || 3 || 5000000 || NFC IC || [[NFC services]] || Hoag | ||
|} | |||
= AddressingMode = | |||
This is "nn::i2c::AddressingMode". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || BitWidth7 | |||
|- | |||
| 1 || BitWidth10 | |||
|} | |||
= TransactionOption = | |||
This is "nn::i2c::TransactionOption". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 1 || StartCondition | |||
|- | |||
| 2 || StopCondition | |||
|} | |||
= SpeedMode = | |||
This is "nn::i2c::SpeedMode". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0x186A0 || Standard | |||
|- | |||
| 0x61A80 || Fast | |||
|- | |||
| 0xF4240 || FastPlus | |||
|- | |||
| 0x33E140 || HighSpeed | |||
|} | |||
= CommandId = | |||
This is "nn::i2c::detail::CommandId". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || Send | |||
|- | |||
| 1 || Receive | |||
|- | |||
| 2 || Extension | |||
|} | |||
= SubCommandId = | |||
This is "nn::i2c::detail::SubCommandId". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || Sleep | |||
|} | |} | ||
= UartPort = | = UartPort = | ||
This is "nn::uart::UartPort". | |||
{| class="wikitable sortable" border="1" | {| class="wikitable sortable" border="1" | ||
|- | |- | ||
! Name || DeviceCode (internal) || DeviceCode (mapped) || | ! Value || Name || DeviceCode (internal) || DeviceCode (mapped) || Description | ||
|- | |- | ||
| 0 || | | 0 || UART-A || 0x03000001 || || Invalid | ||
|- | |- | ||
| 1 || 0x03000004 || 0x37000001 | | 1 || UART-D || 0x03000004 || 0x37000001 || Bluetooth | ||
|- | |- | ||
| 2 || 0x03000002 || 0x35000405 | | 2 || UART-B || 0x03000002 || 0x35000405 || Joy-Con(R) | ||
|- | |- | ||
| 3 || 0x03000003 || 0x3500040F | | 3 || UART-C || 0x03000003 || 0x3500040F || Joy-Con(L) | ||
|- | |- | ||
| 4 || 0x03000003 || 0x35000419 | | 4 || UART-C || 0x03000003 || 0x35000419 || MCU | ||
|} | |} | ||
= UartPortForDev = | = UartPortForDev = | ||
This is "nn::uart::UartPortForDev". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name || DeviceCode (internal) || DeviceCode (mapped) || Description | |||
|- | |||
| 0 || UART-A || 0x03000001 || || Invalid | |||
|- | |||
| 1 || UART-B || 0x03000002 || 0x35000405 || Joy-Con(R) | |||
|- | |||
| 2 || UART-C || 0x03000003 || 0x3500040F || Joy-Con(L) | |||
|- | |||
| 3 || UART-D || 0x03000004 || 0x37000001 || Bluetooth | |||
|} | |||
= FlowControlMode = | |||
This is "nn::uart::FlowControlMode". | |||
{| class="wikitable sortable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || Hardware | |||
|} | |||
= PortEventType = | |||
This is "nn::uart::PortEventType". | |||
{| class="wikitable sortable" border="1" | {| class="wikitable sortable" border="1" | ||
|- | |- | ||
! | ! Value || Name | ||
|- | |- | ||
| 0 || | | 0 || SendBufferEmpty | ||
|- | |- | ||
| 1 || | | 1 || SendBufferReady | ||
|- | |- | ||
| 2 || | | 2 || ReceiveBufferReady | ||
|- | |- | ||
| 3 || | | 3 || ReceiveEnd | ||
|} | |} | ||