# SPDX-License-Identifier: GPL-2.0-or-later

if { [info exists CHIPNAME] } {
	set _CHIPNAME $_CHIPNAME
} else {
	set _CHIPNAME ar9344
}

if { [info exists CPUTAPID] } {
	set _CPUTAPID $CPUTAPID
} else {
	set _CPUTAPID 0x00000001
}

jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME mips_m4k -endian big -chain-position $_TARGETNAME

proc test_ar9344_uart0_tx {} {
	echo "configuring uart0.."
	mww 0xb802000c 0x87
	mww 0xb8020000 0x15
	mww 0xb8020004 0
	mww 0xb802000c 7
	mww 0xb8020004 0

	echo "send message: hallo world"
	mww 0xb8020000 0x68
	mww 0xb8020000 0x65
	mww 0xb8020000 0x6c
	mww 0xb8020000 0x6c
	mww 0xb8020000 0x6f
	mww 0xb8020000 0x20
	mww 0xb8020000 0x77
	mww 0xb8020000 0x6f
	mww 0xb8020000 0x72
	mww 0xb8020000 0x6c
	mww 0xb8020000 0x64
	mww 0xb8020000 0x0a
}
