teensy36: add to smoketest
This required some changes to the UART code to get it to compile on Go 1.11.
Этот коммит содержится в:
родитель
39b1f8b6f5
коммит
9a7e633997
2 изменённых файлов: 16 добавлений и 16 удалений
2
Makefile
2
Makefile
|
@ -327,6 +327,8 @@ smoketest:
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
$(TINYGO) build -size short -o test.hex -target=teensy40 examples/blinky1
|
$(TINYGO) build -size short -o test.hex -target=teensy40 examples/blinky1
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=teensy36 examples/blinky1
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
# test pwm
|
# test pwm
|
||||||
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
|
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
|
|
|
@ -64,7 +64,7 @@ func gosched()
|
||||||
|
|
||||||
// PutcharUART writes a byte to the UART synchronously, without using interrupts
|
// PutcharUART writes a byte to the UART synchronously, without using interrupts
|
||||||
// or calling the scheduler
|
// or calling the scheduler
|
||||||
func PutcharUART(u UART, c byte) {
|
func PutcharUART(u *UART, c byte) {
|
||||||
// ensure the UART has been configured
|
// ensure the UART has been configured
|
||||||
if !u.SCGC.HasBits(u.SCGCMask) {
|
if !u.SCGC.HasBits(u.SCGCMask) {
|
||||||
u.configure(UARTConfig{}, false)
|
u.configure(UARTConfig{}, false)
|
||||||
|
@ -79,15 +79,13 @@ func PutcharUART(u UART, c byte) {
|
||||||
|
|
||||||
// PollUART manually checks a UART status and calls the ISR. This should only be
|
// PollUART manually checks a UART status and calls the ISR. This should only be
|
||||||
// called by runtime.abort.
|
// called by runtime.abort.
|
||||||
func PollUART(u UART) {
|
func PollUART(u *UART) {
|
||||||
if u.SCGC.HasBits(u.SCGCMask) {
|
if u.SCGC.HasBits(u.SCGCMask) {
|
||||||
u.handleStatusInterrupt(u.Interrupt)
|
u.handleStatusInterrupt(u.Interrupt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type UART = *UARTData
|
type UART struct {
|
||||||
|
|
||||||
type UARTData struct {
|
|
||||||
*nxp.UART_Type
|
*nxp.UART_Type
|
||||||
SCGC *volatile.Register32
|
SCGC *volatile.Register32
|
||||||
SCGCMask uint32
|
SCGCMask uint32
|
||||||
|
@ -103,11 +101,11 @@ type UARTData struct {
|
||||||
Interrupt interrupt.Interrupt
|
Interrupt interrupt.Interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
var UART0 = UARTData{UART_Type: nxp.UART0, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART0, DefaultRX: defaultUART0RX, DefaultTX: defaultUART0TX}
|
var UART0 = UART{UART_Type: nxp.UART0, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART0, DefaultRX: defaultUART0RX, DefaultTX: defaultUART0TX}
|
||||||
var UART1 = UARTData{UART_Type: nxp.UART1, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART1, DefaultRX: defaultUART1RX, DefaultTX: defaultUART1TX}
|
var UART1 = UART{UART_Type: nxp.UART1, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART1, DefaultRX: defaultUART1RX, DefaultTX: defaultUART1TX}
|
||||||
var UART2 = UARTData{UART_Type: nxp.UART2, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART2, DefaultRX: defaultUART2RX, DefaultTX: defaultUART2TX}
|
var UART2 = UART{UART_Type: nxp.UART2, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART2, DefaultRX: defaultUART2RX, DefaultTX: defaultUART2TX}
|
||||||
var UART3 = UARTData{UART_Type: nxp.UART3, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART3, DefaultRX: defaultUART3RX, DefaultTX: defaultUART3TX}
|
var UART3 = UART{UART_Type: nxp.UART3, SCGC: &nxp.SIM.SCGC4, SCGCMask: nxp.SIM_SCGC4_UART3, DefaultRX: defaultUART3RX, DefaultTX: defaultUART3TX}
|
||||||
var UART4 = UARTData{UART_Type: nxp.UART4, SCGC: &nxp.SIM.SCGC1, SCGCMask: nxp.SIM_SCGC1_UART4, DefaultRX: defaultUART4RX, DefaultTX: defaultUART4TX}
|
var UART4 = UART{UART_Type: nxp.UART4, SCGC: &nxp.SIM.SCGC1, SCGCMask: nxp.SIM_SCGC1_UART4, DefaultRX: defaultUART4RX, DefaultTX: defaultUART4TX}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
UART0.Interrupt = interrupt.New(nxp.IRQ_UART0_RX_TX, UART0.handleStatusInterrupt)
|
UART0.Interrupt = interrupt.New(nxp.IRQ_UART0_RX_TX, UART0.handleStatusInterrupt)
|
||||||
|
@ -118,11 +116,11 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the UART.
|
// Configure the UART.
|
||||||
func (u UART) Configure(config UARTConfig) {
|
func (u *UART) Configure(config UARTConfig) {
|
||||||
u.configure(config, true)
|
u.configure(config, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u UART) configure(config UARTConfig, canSched bool) {
|
func (u *UART) configure(config UARTConfig, canSched bool) {
|
||||||
// from: serial_begin
|
// from: serial_begin
|
||||||
|
|
||||||
if !u.Configured {
|
if !u.Configured {
|
||||||
|
@ -183,7 +181,7 @@ func (u UART) configure(config UARTConfig, canSched bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u UART) Disable() {
|
func (u *UART) Disable() {
|
||||||
// from: serial_end
|
// from: serial_end
|
||||||
|
|
||||||
// check if the device has been enabled already
|
// check if the device has been enabled already
|
||||||
|
@ -206,13 +204,13 @@ func (u UART) Disable() {
|
||||||
u.Buffer.Clear()
|
u.Buffer.Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u UART) Flush() {
|
func (u *UART) Flush() {
|
||||||
for u.Transmitting.Get() != 0 {
|
for u.Transmitting.Get() != 0 {
|
||||||
gosched()
|
gosched()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u UART) handleStatusInterrupt(interrupt.Interrupt) {
|
func (u *UART) handleStatusInterrupt(interrupt.Interrupt) {
|
||||||
// from: uart0_status_isr
|
// from: uart0_status_isr
|
||||||
|
|
||||||
// receive
|
// receive
|
||||||
|
@ -290,7 +288,7 @@ func (u UART) handleStatusInterrupt(interrupt.Interrupt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteByte writes a byte of data to the UART.
|
// WriteByte writes a byte of data to the UART.
|
||||||
func (u UART) WriteByte(c byte) error {
|
func (u *UART) WriteByte(c byte) error {
|
||||||
if !u.Configured {
|
if !u.Configured {
|
||||||
return ErrNotConfigured
|
return ErrNotConfigured
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче