# drivers/console/serial.c File Reference

Serial console driver. More...

`#include <assert.h>`
`#include <interrupt.h>`
`#include <status-codes.h>`
`#include <util.h>`
`#include <chip/clk.h>`
`#include <console/core.h>`
`#include <console/driver.h>`
`#include <console/serial.h>`
`#include <hardware/usart.h>`

Include dependency graph for serial.c:

Go to the source code of this file.

## Functions
static uint32_t | usart_calc_brgr (unsigned long base_hz, unsigned long baud)

## Detailed Description

Serial console driver.

This is a very simple serial driver serving as a backend for the console layer. Everything that the console layer writes is dumped over the serial line.

- 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.c.

## Function Documentation

static uint32_t usart_calc_brgr | ( | unsigned long | base_hz,
|  | unsigned long | baud |
| ) |  |  | `[static]`

Calculate the value to be written to the BRGR register given a baud rate and assuming 8x oversampling. To calculate the baud rate with 16x oversampling, use base_hz = peripheral_clock / 2.

Parameters:

  | base_hz | The input clock rate after accounting for oversampling
  | baud | Desired baud rate.

Returns:
  BRGR value that will generate approximately the baud rate specified by baud, or 0 if this is not possible with the specified input clock rate.

Definition at line 117 of file serial.c.