slorquet commented on code in PR #9530: URL: https://github.com/apache/nuttx/pull/9530#discussion_r1229164897
########## arch/arm/src/stm32h7/stm32_serial.c: ########## @@ -2660,6 +2719,201 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; #endif +#ifdef CONFIG_STM32H7_USART_SMARTCARD + case TIOCGSMARTCARD: + { + struct serial_smartcard_s *sc = (struct serial_smartcard_s *)arg; + + /* Determine argument validity */ + + if (!sc) + { + ret = -EINVAL; + break; + } + + /* Determine if this uart supports smartcard mode */ + + if (!priv->sc_supported) + { + ret = -ENOTTY; + break; + } + + memcpy(sc, &priv->smartcard, sizeof(struct serial_smartcard_s)); + break; + } + + case TIOCSSMARTCARD: + { + struct serial_smartcard_s *sc = (struct serial_smartcard_s *)arg; + uint32_t cr1; + uint32_t cr1_ue; + uint32_t cr2; + uint32_t cr3; + uint32_t gtpr; + irqstate_t flags; + + /* Determine argument validity */ + + if (!sc) + { + ret = -EINVAL; + break; + } + + /* Determine if this uart supports smartcard mode */ + + if (!priv->sc_supported) + { + ret = -ENOTTY; + break; + } + + memcpy(&priv->smartcard, sc, sizeof(struct serial_smartcard_s)); + + flags = enter_critical_section(); + + /* Get the original state of UE */ + + cr1 = up_serialin(priv, STM32_USART_CR1_OFFSET); + cr1_ue = cr1 & USART_CR1_UE; + cr1 &= ~USART_CR1_UE; Review Comment: same cosmetic alignment issue, I'm waiting feedback from the project before I update this globally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org