# include/console/serial.h File Reference

Serial console backend. More...

`#include <status-codes.h>`
`#include <chip/usart.h>`

Include dependency graph for serial.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | SERIAL_ENABLE_TX (1 << 0)
| Enable USART TX.
#define | SERIAL_ENABLE_RX (1 << 1)
| Enable USART RX.
## Functions
void | __serial_console_bad_constant_port (unsigned int port)
static int | serial_console_init (struct console *con, unsigned int port, unsigned long baud_rate, unsigned long flags)
| Initialize a serial console.

## Detailed Description

Serial console backend.

This is the interface to a very simple serial driver serving as a console backend driver.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file serial.h.

## Define Documentation

#define SERIAL_ENABLE_RX (1 << 1)

Enable USART RX.

Definition at line 62 of file serial.h.

#define SERIAL_ENABLE_TX (1 << 0)

Enable USART TX.

Definition at line 61 of file serial.h.

Referenced by dbg_init().

## Function Documentation

void __serial_console_bad_constant_port | ( | unsigned int | port | ) |

For internal use only.

Undefined function which will cause a linker error if serial_console_init() is called with a constant and invalid serial port ID.

Referenced by serial_console_init().

static int serial_console_init | ( | struct console * | con,
|  | unsigned int | port,
|  | unsigned long | baud_rate,
|  | unsigned long | flags |
| ) |  |  | `[inline, static]`

Initialize a serial console.

Parameters:

  | con | The console to be initialized
  | port | The serial port ID to use
  | baud_rate | The initial baud rate of the serial port
  | flags | Bitmask of flags specifying additional configuration parameters.

Returns:
  0 on success, or a negative error code on failure.

Note:
  Defined partially inline because port and flags will usually be constant.

Definition at line 78 of file serial.h.

References __serial_console_bad_constant_port(), get_usart_regs(), is_constant, and STATUS_INVALID_PARAM.

Referenced by dbg_init().

Here is the call graph for this function: