mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
restrict gpio/uart commands on 17.0.0
This commit is contained in:
parent
3cb556acb3
commit
3bb619f46e
@ -64,8 +64,8 @@ Result gpioPadSetInterruptMode(GpioPadSession *p, GpioInterruptMode mode);
|
||||
Result gpioPadGetInterruptMode(GpioPadSession *p, GpioInterruptMode *out);
|
||||
Result gpioPadSetInterruptEnable(GpioPadSession *p, bool en);
|
||||
Result gpioPadGetInterruptEnable(GpioPadSession *p, bool *out);
|
||||
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out);
|
||||
Result gpioPadClearInterruptStatus(GpioPadSession *p);
|
||||
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out); ///< [1.0.0-16.1.0]
|
||||
Result gpioPadClearInterruptStatus(GpioPadSession *p); ///< [1.0.0-16.1.0]
|
||||
Result gpioPadSetValue(GpioPadSession *p, GpioValue val);
|
||||
Result gpioPadGetValue(GpioPadSession *p, GpioValue *out);
|
||||
Result gpioPadBindInterrupt(GpioPadSession *p, Event *out);
|
||||
|
@ -54,6 +54,7 @@ Service* uartGetServiceSession(void);
|
||||
|
||||
/**
|
||||
* @brief HasPort
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPort
|
||||
* @param[out] out Output success flag.
|
||||
*/
|
||||
@ -61,6 +62,7 @@ Result uartHasPort(UartPort port, bool *out);
|
||||
|
||||
/**
|
||||
* @brief HasPortForDev
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPortForDev
|
||||
* @param[out] out Output success flag.
|
||||
*/
|
||||
@ -68,6 +70,7 @@ Result uartHasPortForDev(UartPortForDev port, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsSupportedBaudRate
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPort
|
||||
* @param[in] baud_rate BaudRate
|
||||
* @param[out] out Output success flag.
|
||||
@ -76,6 +79,7 @@ Result uartIsSupportedBaudRate(UartPort port, u32 baud_rate, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsSupportedBaudRateForDev
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPortForDev
|
||||
* @param[in] baud_rate BaudRate
|
||||
* @param[out] out Output success flag.
|
||||
@ -84,6 +88,7 @@ Result uartIsSupportedBaudRateForDev(UartPortForDev port, u32 baud_rate, bool *o
|
||||
|
||||
/**
|
||||
* @brief IsSupportedFlowControlMode
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPort
|
||||
* @param[in] flow_control_mode \ref UartFlowControlMode
|
||||
* @param[out] out Output success flag.
|
||||
@ -92,6 +97,7 @@ Result uartIsSupportedFlowControlMode(UartPort port, UartFlowControlMode flow_co
|
||||
|
||||
/**
|
||||
* @brief IsSupportedFlowControlModeForDev
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPortForDev
|
||||
* @param[in] flow_control_mode \ref UartFlowControlMode
|
||||
* @param[out] out Output success flag.
|
||||
@ -107,6 +113,7 @@ Result uartCreatePortSession(UartPortSession *s);
|
||||
|
||||
/**
|
||||
* @brief IsSupportedPortEvent
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPort
|
||||
* @param[in] port_event_type \ref UartPortEventType
|
||||
* @param[out] out Output success flag.
|
||||
@ -115,6 +122,7 @@ Result uartIsSupportedPortEvent(UartPort port, UartPortEventType port_event_type
|
||||
|
||||
/**
|
||||
* @brief IsSupportedPortEventForDev
|
||||
* @note Only available on [1.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPortForDev
|
||||
* @param[in] port_event_type \ref UartPortEventType
|
||||
* @param[out] out Output success flag.
|
||||
@ -123,7 +131,7 @@ Result uartIsSupportedPortEventForDev(UartPortForDev port, UartPortEventType por
|
||||
|
||||
/**
|
||||
* @brief IsSupportedDeviceVariation
|
||||
* @note Only available on [7.0.0+].
|
||||
* @note Only available on [7.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPort
|
||||
* @param[in] device_variation DeviceVariation
|
||||
* @param[out] out Output success flag.
|
||||
@ -132,7 +140,7 @@ Result uartIsSupportedDeviceVariation(UartPort port, u32 device_variation, bool
|
||||
|
||||
/**
|
||||
* @brief IsSupportedDeviceVariationForDev
|
||||
* @note Only available on [7.0.0+].
|
||||
* @note Only available on [7.0.0-16.1.0].
|
||||
* @param[in] port \ref UartPortForDev
|
||||
* @param[in] device_variation DeviceVariation
|
||||
* @param[out] out Output success flag.
|
||||
|
@ -123,10 +123,16 @@ Result gpioPadGetInterruptEnable(GpioPadSession *p, bool *out) {
|
||||
|
||||
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out) {
|
||||
_Static_assert(sizeof(*out) == sizeof(u32), "GpioInterruptStatus size");
|
||||
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _gpioCmdNoInOutU32(&p->s, (u32 *)out, 6);
|
||||
}
|
||||
|
||||
Result gpioPadClearInterruptStatus(GpioPadSession *p) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _gpioCmdNoInNoOut(&p->s, 7);
|
||||
}
|
||||
|
||||
|
@ -45,26 +45,44 @@ static Result _uartCmdInTwoU32sOutBool(Service* srv, u32 inval0, u32 inval1, boo
|
||||
}
|
||||
|
||||
Result uartHasPort(UartPort port, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInU32OutBool(&g_uartSrv, port, out, 0);
|
||||
}
|
||||
|
||||
Result uartHasPortForDev(UartPortForDev port, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInU32OutBool(&g_uartSrv, port, out, 1);
|
||||
}
|
||||
|
||||
Result uartIsSupportedBaudRate(UartPort port, u32 baud_rate, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, baud_rate, out, 2);
|
||||
}
|
||||
|
||||
Result uartIsSupportedBaudRateForDev(UartPortForDev port, u32 baud_rate, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, baud_rate, out, 3);
|
||||
}
|
||||
|
||||
Result uartIsSupportedFlowControlMode(UartPort port, UartFlowControlMode flow_control_mode, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, flow_control_mode, out, 4);
|
||||
}
|
||||
|
||||
Result uartIsSupportedFlowControlModeForDev(UartPortForDev port, UartFlowControlMode flow_control_mode, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, flow_control_mode, out, 5);
|
||||
}
|
||||
|
||||
@ -76,22 +94,28 @@ Result uartCreatePortSession(UartPortSession *s) {
|
||||
}
|
||||
|
||||
Result uartIsSupportedPortEvent(UartPort port, UartPortEventType port_event_type, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, port_event_type, out, 7);
|
||||
}
|
||||
|
||||
Result uartIsSupportedPortEventForDev(UartPortForDev port, UartPortEventType port_event_type, bool *out) {
|
||||
if (hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, port_event_type, out, 8);
|
||||
}
|
||||
|
||||
Result uartIsSupportedDeviceVariation(UartPort port, u32 device_variation, bool *out) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
if (hosversionBefore(7,0,0) || hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, device_variation, out, 9);
|
||||
}
|
||||
|
||||
Result uartIsSupportedDeviceVariationForDev(UartPortForDev port, u32 device_variation, bool *out) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
if (hosversionBefore(7,0,0) || hosversionAtLeast(17,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, device_variation, out, 10);
|
||||
|
Loading…
Reference in New Issue
Block a user