uart

package
v0.0.0-...-1cacaac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package uart implements a driver for SiFive UART controllers adopting the following reference specifications:

  • FU540C00RM - SiFive FU540-C000 Manual - v1p4 2021/03/25

This package is only meant to be used with `GOOS=tamago GOARCH=riscv64` as supported by the TamaGo framework for bare metal Go on RISC-V SoCs, see https://github.com/usbarmory/tamago.

Index

Constants

View Source
const (
	UART_DEFAULT_BAUDRATE = 115200

	UARTx_TXDATA = 0x0000
	TXDATA_FULL  = 31
	TXDATA_DATA  = 0

	UARTx_RXDATA = 0x0004
	RXDATA_EMPTY = 31
	RXDATA_DATA  = 0

	UARTx_TXCTRL = 0x0008
	UARTx_RXCTRL = 0x000c
)

UART registers

Variables

This section is empty.

Functions

This section is empty.

Types

type UART

type UART struct {
	// Controller index
	Index int
	// Base register
	Base uint32
	// contains filtered or unexported fields
}

UART represents a serial port instance.

func (*UART) Init

func (hw *UART) Init()

Init initializes and enables the UART for RS-232 mode, p3605, 55.13.1 Programming the UART in RS-232 mode, IMX6ULLRM.

func (*UART) Read

func (hw *UART) Read(buf []byte) (n int, _ error)

Read available data to buffer from serial port.

func (*UART) Rx

func (hw *UART) Rx() (c byte, valid bool)

Rx receives a single character from the serial port.

func (*UART) Tx

func (hw *UART) Tx(c byte)

Tx transmits a single character to the serial port.

func (*UART) Write

func (hw *UART) Write(buf []byte) (n int, _ error)

Write data from buffer to serial port.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL