We aren't using RS485 but single wire.

This commit is contained in:
Simon Wilks 2013-01-21 23:31:12 +01:00
parent 64925c33cd
commit ecd01dc2e8
3 changed files with 12 additions and 6 deletions

View File

@ -143,7 +143,7 @@ int test_hott_telemetry(int argc, char *argv[])
}
/* Activate single wire mode */
ioctl(fd, TIOCSRS485, SER_RS485_ENABLED);
ioctl(fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED);
char send = 'a';
write(fd, &send, 1);
@ -223,7 +223,7 @@ int test_hott_telemetry(int argc, char *argv[])
/* Disable single wire */
ioctl(fd, TIOCSRS485, ~SER_RS485_ENABLED);
ioctl(fd, TIOCSSINGLEWIRE, ~SER_SINGLEWIRE_ENABLED);
write(fd, &send, 1);

View File

@ -1307,11 +1307,11 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
}
break;
/* Set RS485 mode */
case TIOCSRS485:
/* Set single-wire mode */
case TIOCSSINGLEWIRE:
{
/* Change the TX port to be open-drain/push-pull */
if (arg == SER_RS485_ENABLED) {
if (arg == SER_SINGLEWIRE_ENABLED) {
stm32_configgpio(priv->tx_gpio | GPIO_OPENDRAIN);
} else {
stm32_configgpio(priv->tx_gpio | GPIO_PUSHPULL);
@ -1319,7 +1319,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
/* Enable/disable half-duplex mode */
uint32_t cr = up_serialin(priv, STM32_USART_CR3_OFFSET);
if (arg == SER_RS485_ENABLED) {
if (arg == SER_SINGLEWIRE_ENABLED) {
cr |= (USART_CR3_HDSEL);
} else {
cr &= ~(USART_CR3_HDSEL);

View File

@ -169,6 +169,9 @@
#define TIOCSERGSTRUCT _TIOC(0x002c) /* Get device TTY structure */
#define TIOCSSINGLEWIRE _TIOC(0x002d) /* Set single-wire mode */
#define TIOCGSINGLEWIRE _TIOC(0x002e) /* Get single-wire mode */
/* Definitions used in struct serial_rs485 (Linux compatible) */
#define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */
@ -176,6 +179,9 @@
#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */
#define SER_RS485_RX_DURING_TX (1 << 4)
/* single-wire definitions */
#define SER_SINGLEWIRE_ENABLED (1 << 0) /* Enable/disble single-wire support */
/********************************************************************************************
* Public Type Definitions
********************************************************************************************/