Changeset 6ff1da40 in rtems


Ignore:
Timestamp:
Jun 14, 2019, 5:35:21 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
2be6ab7f
Parents:
d7d0bba
Message:

dev/sc16is752: Add RS485 mode variants

Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/dev/serial/sc16is752-regs.h

    rd7d0bba r6ff1da40  
    6969#define SC16IS752_EFCR_RX_DISABLE (1u << 1)
    7070#define SC16IS752_EFCR_TX_DISABLE (1u << 2)
     71#define SC16IS752_EFCR_RTSCON (1u << 4)
     72#define SC16IS752_EFCR_RTSINVER (1u << 5)
    7173
    7274/* IER */
     
    9294#define SC16IS752_LCR_SET_PARITY (1u << 3)
    9395#define SC16IS752_LCR_EVEN_PARITY (1u << 4)
     96#define SC16IS752_LCR_BREAK (1u << 5)
    9497#define SC16IS752_LCR_ENABLE_DIVISOR (1u << 7)
    9598
  • cpukit/dev/serial/sc16is752.c

    rd7d0bba r6ff1da40  
    213213  bool ok;
    214214  uint8_t fcr;
     215  uint8_t efcr;
    215216
    216217  (void)args;
     
    224225  }
    225226
    226   if (ctx->mode == SC16IS752_MODE_RS485) {
    227     ctx->efcr = SC16IS752_EFCR_RS485_ENABLE;
    228   } else {
    229     ctx->efcr = 0;
    230   }
    231 
     227  efcr = 0;
     228
     229  switch (ctx->mode) {
     230    case SC16IS752_MODE_RS485_RTS_INV:
     231      efcr |= SC16IS752_EFCR_RTSINVER;
     232      /* Fall through */
     233    case SC16IS752_MODE_RS485_RTS:
     234      efcr |= SC16IS752_EFCR_RTSCON;
     235      /* Fall through */
     236    case SC16IS752_MODE_RS485:
     237      efcr |= SC16IS752_EFCR_RS485_ENABLE;
     238      break;
     239    default:
     240      break;
     241  }
     242
     243  ctx->efcr = efcr;
    232244  write_reg(ctx, SC16IS752_FCR, &ctx->efcr, 1);
    233245
  • cpukit/include/dev/serial/sc16is752.h

    rd7d0bba r6ff1da40  
    3232typedef enum {
    3333  SC16IS752_MODE_RS232,
    34   SC16IS752_MODE_RS485
     34
     35  /* Enable RS485 mode */
     36  SC16IS752_MODE_RS485,
     37
     38  /* Enable RS485 mode, enable the transmitter to control the #RTS pin */
     39  SC16IS752_MODE_RS485_RTS,
     40
     41  /*
     42   * Enable RS485 mode, enable the transmitter to control the #RTS pin, invert
     43   * RTS signal (#RTS = 1 during transmission and #RTS = 0 during reception)
     44   */
     45  SC16IS752_MODE_RS485_RTS_INV
    3546} sc16is752_mode;
    3647
Note: See TracChangeset for help on using the changeset viewer.