usart

package
v0.0.0-...-168ccc2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package usart provides interface to Universal Synchronous Asynchronous Receiver Transmitter.

Peripheral: USART_Periph Universal Synchronous Asynchronous Receiver Transmitter. Instances:

USART2  mmap.USART2_BASE
USART1  mmap.USART1_BASE
USART6  mmap.USART6_BASE

Registers:

0x00 32  SR   Status register.
0x04 32  DR   Data register.
0x08 32  BRR  Baud rate register.
0x0C 32  CR1  Control register 1.
0x10 32  CR2  Control register 2.
0x14 32  CR3  Control register 3.
0x18 32  GTPR Guard time and prescaler register.

Import:

stm32/o/f411xe/mmap

Index

Constants

View Source
const (
	PEn   = 0
	FEn   = 1
	NEn   = 2
	OREn  = 3
	IDLEn = 4
	RXNEn = 5
	TCn   = 6
	TXEn  = 7
	LBDn  = 8
	CTSn  = 9
)
View Source
const (
	DIV_Fractionn = 0
	DIV_Mantissan = 4
)
View Source
const (
	SBKn    = 0
	RWUn    = 1
	REn     = 2
	TEn     = 3
	IDLEIEn = 4
	RXNEIEn = 5
	TCIEn   = 6
	TXEIEn  = 7
	PEIEn   = 8
	PSn     = 9
	PCEn    = 10
	WAKEn   = 11
	Mn      = 12
	UEn     = 13
	OVER8n  = 15
)
View Source
const (
	ADDn   = 0
	LBDLn  = 5
	LBDIEn = 6
	LBCLn  = 8
	CPHAn  = 9
	CPOLn  = 10
	CLKENn = 11
	STOPn  = 12
	LINENn = 14
)
View Source
const (
	EIEn    = 0
	IRENn   = 1
	IRLPn   = 2
	HDSELn  = 3
	NACKn   = 4
	SCENn   = 5
	DMARn   = 6
	DMATn   = 7
	RTSEn   = 8
	CTSEn   = 9
	CTSIEn  = 10
	ONEBITn = 11
)
View Source
const (
	PSCn = 0
	GTn  = 8
)

Variables

Functions

This section is empty.

Types

type BRR

type BRR uint32
const (
	DIV_Fraction BRR = 0x0F << 0  //+ Fraction of USARTDIV.
	DIV_Mantissa BRR = 0xFFF << 4 //+ Mantissa of USARTDIV.
)

func (BRR) Field

func (b BRR) Field(mask BRR) int

func (BRR) J

func (mask BRR) J(v int) BRR

type CR1

type CR1 uint32
const (
	SBK    CR1 = 0x01 << 0  //+ Send Break.
	RWU    CR1 = 0x01 << 1  //+ Receiver wakeup.
	RE     CR1 = 0x01 << 2  //+ Receiver Enable.
	TE     CR1 = 0x01 << 3  //+ Transmitter Enable.
	IDLEIE CR1 = 0x01 << 4  //+ IDLE Interrupt Enable.
	RXNEIE CR1 = 0x01 << 5  //+ RXNE Interrupt Enable.
	TCIE   CR1 = 0x01 << 6  //+ Transmission Complete Interrupt Enable.
	TXEIE  CR1 = 0x01 << 7  //+ TXE Interrupt Enable.
	PEIE   CR1 = 0x01 << 8  //+ PE Interrupt Enable.
	PS     CR1 = 0x01 << 9  //+ Parity Selection.
	PCE    CR1 = 0x01 << 10 //+ Parity Control Enable.
	WAKE   CR1 = 0x01 << 11 //+ Wakeup method.
	M      CR1 = 0x01 << 12 //+ Word length.
	UE     CR1 = 0x01 << 13 //+ USART Enable.
	OVER8  CR1 = 0x01 << 15 //+ USART Oversampling by 8 enable.
)

func (CR1) Field

func (b CR1) Field(mask CR1) int

func (CR1) J

func (mask CR1) J(v int) CR1

type CR2

type CR2 uint32
const (
	ADD   CR2 = 0x0F << 0  //+ Address of the USART node.
	LBDL  CR2 = 0x01 << 5  //+ LIN Break Detection Length.
	LBDIE CR2 = 0x01 << 6  //+ LIN Break Detection Interrupt Enable.
	LBCL  CR2 = 0x01 << 8  //+ Last Bit Clock pulse.
	CPHA  CR2 = 0x01 << 9  //+ Clock Phase.
	CPOL  CR2 = 0x01 << 10 //+ Clock Polarity.
	CLKEN CR2 = 0x01 << 11 //+ Clock Enable.
	STOP  CR2 = 0x03 << 12 //+ STOP[1:0] bits (STOP bits).
	LINEN CR2 = 0x01 << 14 //+ LIN mode enable.
)

func (CR2) Field

func (b CR2) Field(mask CR2) int

func (CR2) J

func (mask CR2) J(v int) CR2

type CR3

type CR3 uint32
const (
	EIE    CR3 = 0x01 << 0  //+ Error Interrupt Enable.
	IREN   CR3 = 0x01 << 1  //+ IrDA mode Enable.
	IRLP   CR3 = 0x01 << 2  //+ IrDA Low-Power.
	HDSEL  CR3 = 0x01 << 3  //+ Half-Duplex Selection.
	NACK   CR3 = 0x01 << 4  //+ Smartcard NACK enable.
	SCEN   CR3 = 0x01 << 5  //+ Smartcard mode enable.
	DMAR   CR3 = 0x01 << 6  //+ DMA Enable Receiver.
	DMAT   CR3 = 0x01 << 7  //+ DMA Enable Transmitter.
	RTSE   CR3 = 0x01 << 8  //+ RTS Enable.
	CTSE   CR3 = 0x01 << 9  //+ CTS Enable.
	CTSIE  CR3 = 0x01 << 10 //+ CTS Interrupt Enable.
	ONEBIT CR3 = 0x01 << 11 //+ USART One bit method enable.
)

func (CR3) Field

func (b CR3) Field(mask CR3) int

func (CR3) J

func (mask CR3) J(v int) CR3

type DR

type DR uint32

func (DR) Field

func (b DR) Field(mask DR) int

func (DR) J

func (mask DR) J(v int) DR

type GTPR

type GTPR uint32
const (
	PSC GTPR = 0xFF << 0 //+ PSC[7:0] bits (Prescaler value).
	GT  GTPR = 0xFF << 8 //+ Guard time value.
)

func (GTPR) Field

func (b GTPR) Field(mask GTPR) int

func (GTPR) J

func (mask GTPR) J(v int) GTPR

type RBRR

type RBRR struct{ mmio.U32 }

func (*RBRR) AtomicClearBits

func (r *RBRR) AtomicClearBits(mask BRR)

func (*RBRR) AtomicSetBits

func (r *RBRR) AtomicSetBits(mask BRR)

func (*RBRR) AtomicStoreBits

func (r *RBRR) AtomicStoreBits(mask, b BRR)

func (*RBRR) Bits

func (r *RBRR) Bits(mask BRR) BRR

func (*RBRR) ClearBits

func (r *RBRR) ClearBits(mask BRR)

func (*RBRR) Load

func (r *RBRR) Load() BRR

func (*RBRR) SetBits

func (r *RBRR) SetBits(mask BRR)

func (*RBRR) Store

func (r *RBRR) Store(b BRR)

func (*RBRR) StoreBits

func (r *RBRR) StoreBits(mask, b BRR)

type RCR1

type RCR1 struct{ mmio.U32 }

func (*RCR1) AtomicClearBits

func (r *RCR1) AtomicClearBits(mask CR1)

func (*RCR1) AtomicSetBits

func (r *RCR1) AtomicSetBits(mask CR1)

func (*RCR1) AtomicStoreBits

func (r *RCR1) AtomicStoreBits(mask, b CR1)

func (*RCR1) Bits

func (r *RCR1) Bits(mask CR1) CR1

func (*RCR1) ClearBits

func (r *RCR1) ClearBits(mask CR1)

func (*RCR1) Load

func (r *RCR1) Load() CR1

func (*RCR1) SetBits

func (r *RCR1) SetBits(mask CR1)

func (*RCR1) Store

func (r *RCR1) Store(b CR1)

func (*RCR1) StoreBits

func (r *RCR1) StoreBits(mask, b CR1)

type RCR2

type RCR2 struct{ mmio.U32 }

func (*RCR2) AtomicClearBits

func (r *RCR2) AtomicClearBits(mask CR2)

func (*RCR2) AtomicSetBits

func (r *RCR2) AtomicSetBits(mask CR2)

func (*RCR2) AtomicStoreBits

func (r *RCR2) AtomicStoreBits(mask, b CR2)

func (*RCR2) Bits

func (r *RCR2) Bits(mask CR2) CR2

func (*RCR2) ClearBits

func (r *RCR2) ClearBits(mask CR2)

func (*RCR2) Load

func (r *RCR2) Load() CR2

func (*RCR2) SetBits

func (r *RCR2) SetBits(mask CR2)

func (*RCR2) Store

func (r *RCR2) Store(b CR2)

func (*RCR2) StoreBits

func (r *RCR2) StoreBits(mask, b CR2)

type RCR3

type RCR3 struct{ mmio.U32 }

func (*RCR3) AtomicClearBits

func (r *RCR3) AtomicClearBits(mask CR3)

func (*RCR3) AtomicSetBits

func (r *RCR3) AtomicSetBits(mask CR3)

func (*RCR3) AtomicStoreBits

func (r *RCR3) AtomicStoreBits(mask, b CR3)

func (*RCR3) Bits

func (r *RCR3) Bits(mask CR3) CR3

func (*RCR3) ClearBits

func (r *RCR3) ClearBits(mask CR3)

func (*RCR3) Load

func (r *RCR3) Load() CR3

func (*RCR3) SetBits

func (r *RCR3) SetBits(mask CR3)

func (*RCR3) Store

func (r *RCR3) Store(b CR3)

func (*RCR3) StoreBits

func (r *RCR3) StoreBits(mask, b CR3)

type RDR

type RDR struct{ mmio.U32 }

func (*RDR) AtomicClearBits

func (r *RDR) AtomicClearBits(mask DR)

func (*RDR) AtomicSetBits

func (r *RDR) AtomicSetBits(mask DR)

func (*RDR) AtomicStoreBits

func (r *RDR) AtomicStoreBits(mask, b DR)

func (*RDR) Bits

func (r *RDR) Bits(mask DR) DR

func (*RDR) ClearBits

func (r *RDR) ClearBits(mask DR)

func (*RDR) Load

func (r *RDR) Load() DR

func (*RDR) SetBits

func (r *RDR) SetBits(mask DR)

func (*RDR) Store

func (r *RDR) Store(b DR)

func (*RDR) StoreBits

func (r *RDR) StoreBits(mask, b DR)

type RGTPR

type RGTPR struct{ mmio.U32 }

func (*RGTPR) AtomicClearBits

func (r *RGTPR) AtomicClearBits(mask GTPR)

func (*RGTPR) AtomicSetBits

func (r *RGTPR) AtomicSetBits(mask GTPR)

func (*RGTPR) AtomicStoreBits

func (r *RGTPR) AtomicStoreBits(mask, b GTPR)

func (*RGTPR) Bits

func (r *RGTPR) Bits(mask GTPR) GTPR

func (*RGTPR) ClearBits

func (r *RGTPR) ClearBits(mask GTPR)

func (*RGTPR) Load

func (r *RGTPR) Load() GTPR

func (*RGTPR) SetBits

func (r *RGTPR) SetBits(mask GTPR)

func (*RGTPR) Store

func (r *RGTPR) Store(b GTPR)

func (*RGTPR) StoreBits

func (r *RGTPR) StoreBits(mask, b GTPR)

type RMBRR

type RMBRR struct{ mmio.UM32 }

func (RMBRR) Load

func (rm RMBRR) Load() BRR

func (RMBRR) Store

func (rm RMBRR) Store(b BRR)

type RMCR1

type RMCR1 struct{ mmio.UM32 }

func (RMCR1) Load

func (rm RMCR1) Load() CR1

func (RMCR1) Store

func (rm RMCR1) Store(b CR1)

type RMCR2

type RMCR2 struct{ mmio.UM32 }

func (RMCR2) Load

func (rm RMCR2) Load() CR2

func (RMCR2) Store

func (rm RMCR2) Store(b CR2)

type RMCR3

type RMCR3 struct{ mmio.UM32 }

func (RMCR3) Load

func (rm RMCR3) Load() CR3

func (RMCR3) Store

func (rm RMCR3) Store(b CR3)

type RMDR

type RMDR struct{ mmio.UM32 }

func (RMDR) Load

func (rm RMDR) Load() DR

func (RMDR) Store

func (rm RMDR) Store(b DR)

type RMGTPR

type RMGTPR struct{ mmio.UM32 }

func (RMGTPR) Load

func (rm RMGTPR) Load() GTPR

func (RMGTPR) Store

func (rm RMGTPR) Store(b GTPR)

type RMSR

type RMSR struct{ mmio.UM32 }

func (RMSR) Load

func (rm RMSR) Load() SR

func (RMSR) Store

func (rm RMSR) Store(b SR)

type RSR

type RSR struct{ mmio.U32 }

func (*RSR) AtomicClearBits

func (r *RSR) AtomicClearBits(mask SR)

func (*RSR) AtomicSetBits

func (r *RSR) AtomicSetBits(mask SR)

func (*RSR) AtomicStoreBits

func (r *RSR) AtomicStoreBits(mask, b SR)

func (*RSR) Bits

func (r *RSR) Bits(mask SR) SR

func (*RSR) ClearBits

func (r *RSR) ClearBits(mask SR)

func (*RSR) Load

func (r *RSR) Load() SR

func (*RSR) SetBits

func (r *RSR) SetBits(mask SR)

func (*RSR) Store

func (r *RSR) Store(b SR)

func (*RSR) StoreBits

func (r *RSR) StoreBits(mask, b SR)

type SR

type SR uint32
const (
	PE   SR = 0x01 << 0 //+ Parity Error.
	FE   SR = 0x01 << 1 //+ Framing Error.
	NE   SR = 0x01 << 2 //+ Noise Error Flag.
	ORE  SR = 0x01 << 3 //+ OverRun Error.
	IDLE SR = 0x01 << 4 //+ IDLE line detected.
	RXNE SR = 0x01 << 5 //+ Read Data Register Not Empty.
	TC   SR = 0x01 << 6 //+ Transmission Complete.
	TXE  SR = 0x01 << 7 //+ Transmit Data Register Empty.
	LBD  SR = 0x01 << 8 //+ LIN Break Detection Flag.
	CTS  SR = 0x01 << 9 //+ CTS Flag.
)

func (SR) Field

func (b SR) Field(mask SR) int

func (SR) J

func (mask SR) J(v int) SR

type USART_Periph

type USART_Periph struct {
	SR   RSR
	DR   RDR
	BRR  RBRR
	CR1  RCR1
	CR2  RCR2
	CR3  RCR3
	GTPR RGTPR
}

func (*USART_Periph) ADD

func (p *USART_Periph) ADD() RMCR2

func (*USART_Periph) BaseAddr

func (p *USART_Periph) BaseAddr() uintptr

func (*USART_Periph) CLKEN

func (p *USART_Periph) CLKEN() RMCR2

func (*USART_Periph) CPHA

func (p *USART_Periph) CPHA() RMCR2

func (*USART_Periph) CPOL

func (p *USART_Periph) CPOL() RMCR2

func (*USART_Periph) CTS

func (p *USART_Periph) CTS() RMSR

func (*USART_Periph) CTSE

func (p *USART_Periph) CTSE() RMCR3

func (*USART_Periph) CTSIE

func (p *USART_Periph) CTSIE() RMCR3

func (*USART_Periph) DIV_Fraction

func (p *USART_Periph) DIV_Fraction() RMBRR

func (*USART_Periph) DIV_Mantissa

func (p *USART_Periph) DIV_Mantissa() RMBRR

func (*USART_Periph) DMAR

func (p *USART_Periph) DMAR() RMCR3

func (*USART_Periph) DMAT

func (p *USART_Periph) DMAT() RMCR3

func (*USART_Periph) EIE

func (p *USART_Periph) EIE() RMCR3

func (*USART_Periph) FE

func (p *USART_Periph) FE() RMSR

func (*USART_Periph) GT

func (p *USART_Periph) GT() RMGTPR

func (*USART_Periph) HDSEL

func (p *USART_Periph) HDSEL() RMCR3

func (*USART_Periph) IDLE

func (p *USART_Periph) IDLE() RMSR

func (*USART_Periph) IDLEIE

func (p *USART_Periph) IDLEIE() RMCR1

func (*USART_Periph) IREN

func (p *USART_Periph) IREN() RMCR3

func (*USART_Periph) IRLP

func (p *USART_Periph) IRLP() RMCR3

func (*USART_Periph) LBCL

func (p *USART_Periph) LBCL() RMCR2

func (*USART_Periph) LBD

func (p *USART_Periph) LBD() RMSR

func (*USART_Periph) LBDIE

func (p *USART_Periph) LBDIE() RMCR2

func (*USART_Periph) LBDL

func (p *USART_Periph) LBDL() RMCR2

func (*USART_Periph) LINEN

func (p *USART_Periph) LINEN() RMCR2

func (*USART_Periph) M

func (p *USART_Periph) M() RMCR1

func (*USART_Periph) NACK

func (p *USART_Periph) NACK() RMCR3

func (*USART_Periph) NE

func (p *USART_Periph) NE() RMSR

func (*USART_Periph) ONEBIT

func (p *USART_Periph) ONEBIT() RMCR3

func (*USART_Periph) ORE

func (p *USART_Periph) ORE() RMSR

func (*USART_Periph) OVER8

func (p *USART_Periph) OVER8() RMCR1

func (*USART_Periph) PCE

func (p *USART_Periph) PCE() RMCR1

func (*USART_Periph) PE

func (p *USART_Periph) PE() RMSR

func (*USART_Periph) PEIE

func (p *USART_Periph) PEIE() RMCR1

func (*USART_Periph) PS

func (p *USART_Periph) PS() RMCR1

func (*USART_Periph) PSC

func (p *USART_Periph) PSC() RMGTPR

func (*USART_Periph) RE

func (p *USART_Periph) RE() RMCR1

func (*USART_Periph) RTSE

func (p *USART_Periph) RTSE() RMCR3

func (*USART_Periph) RWU

func (p *USART_Periph) RWU() RMCR1

func (*USART_Periph) RXNE

func (p *USART_Periph) RXNE() RMSR

func (*USART_Periph) RXNEIE

func (p *USART_Periph) RXNEIE() RMCR1

func (*USART_Periph) SBK

func (p *USART_Periph) SBK() RMCR1

func (*USART_Periph) SCEN

func (p *USART_Periph) SCEN() RMCR3

func (*USART_Periph) STOP

func (p *USART_Periph) STOP() RMCR2

func (*USART_Periph) TC

func (p *USART_Periph) TC() RMSR

func (*USART_Periph) TCIE

func (p *USART_Periph) TCIE() RMCR1

func (*USART_Periph) TE

func (p *USART_Periph) TE() RMCR1

func (*USART_Periph) TXE

func (p *USART_Periph) TXE() RMSR

func (*USART_Periph) TXEIE

func (p *USART_Periph) TXEIE() RMCR1

func (*USART_Periph) UE

func (p *USART_Periph) UE() RMCR1

func (*USART_Periph) WAKE

func (p *USART_Periph) WAKE() RMCR1

Jump to

Keyboard shortcuts

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