mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-12 10:30:23 +00:00
Add skeleton for a serial device test.
Not really working yet, so commented out in Kyuafile.
This commit is contained in:
parent
10b9778383
commit
0735487ed0
@ -5,6 +5,7 @@ test_suite('rk65c02-tests')
|
||||
atf_test_program{name='test_assemble'}
|
||||
atf_test_program{name='test_bus'}
|
||||
atf_test_program{name='test_debug'}
|
||||
--atf_test_program{name='test_device_serial'}
|
||||
atf_test_program{name='test_emulation'}
|
||||
atf_test_program{name='test_interrupt'}
|
||||
atf_test_program{name='test_stepping'}
|
||||
|
@ -5,7 +5,7 @@ VASM=vasm6502_std
|
||||
VASMFLAGS=-Fbin -c02
|
||||
UTILS=utils.o
|
||||
|
||||
TESTS=test_bus test_emulation test_stepping test_assemble test_interrupt test_debug
|
||||
TESTS=test_bus test_emulation test_stepping test_assemble test_interrupt test_debug test_device_serial
|
||||
TESTROMS:=$(addsuffix .rom,$(basename $(wildcard *.s)))
|
||||
|
||||
all : $(TESTS) $(TESTROMS)
|
||||
@ -28,6 +28,9 @@ test_interrupt: test_interrupt.o $(UTILS) $(RK6502LIB)
|
||||
test_debug: test_debug.o $(UTILS) $(RK6502LIB)
|
||||
$(CC) -o $@ $(LDFLAGS) $< $(UTILS) $(RK6502LIB)
|
||||
|
||||
test_device_serial: test_device_serial.o $(UTILS) $(RK6502LIB)
|
||||
$(CC) -o $@ $(LDFLAGS) $< $(UTILS) $(RK6502LIB)
|
||||
|
||||
%.rom : %.s
|
||||
$(VASM) $(VASMFLAGS) -o $@ $<
|
||||
|
||||
|
66
test/test_device_serial.c
Normal file
66
test/test_device_serial.c
Normal file
@ -0,0 +1,66 @@
|
||||
#include <atf-c.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utlist.h>
|
||||
|
||||
#include "rk65c02.h"
|
||||
#include "bus.h"
|
||||
#include "utils.h"
|
||||
#include "device_serial.h"
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(device_serial_init);
|
||||
ATF_TC_BODY(device_serial_init, tc)
|
||||
{
|
||||
bus_t b;
|
||||
device_mapping_t *dm;
|
||||
device_t *d, *d_ser;
|
||||
|
||||
b = bus_init_with_default_devs();
|
||||
|
||||
bus_device_add(&b, device_serial_init(), 0xE000);
|
||||
|
||||
bus_device_dump(&b);
|
||||
|
||||
LL_FOREACH(b.dm_head, dm) {
|
||||
d = dm->dev;
|
||||
|
||||
if (dm->addr == 0xE000)
|
||||
d_ser = d;
|
||||
}
|
||||
|
||||
ATF_CHECK(strcmp("Serial", d_ser->name) == 0);
|
||||
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(device_serial_write1);
|
||||
ATF_TC_BODY(device_serial_write1, tc)
|
||||
{
|
||||
bus_t b;
|
||||
rk65c02emu_t e;
|
||||
|
||||
b = bus_init_with_default_devs();
|
||||
|
||||
bus_device_add(&b, device_serial_init(), 0xE000);
|
||||
bus_device_dump(&b);
|
||||
|
||||
e = rk65c02_init(&b);
|
||||
|
||||
ATF_REQUIRE(rom_start(&e, "test_device_serial_write1.rom", tc));
|
||||
|
||||
// start thread reading from txpipe
|
||||
|
||||
/* clean up serial etc. */
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
ATF_TP_ADD_TC(tp, device_serial_init);
|
||||
ATF_TP_ADD_TC(tp, device_serial_write1);
|
||||
|
||||
return (atf_no_error());
|
||||
}
|
||||
|
6
test/test_device_serial_write1.s
Normal file
6
test/test_device_serial_write1.s
Normal file
@ -0,0 +1,6 @@
|
||||
start: lda #0x61
|
||||
sta 0xE000
|
||||
lda #0x0A
|
||||
sta 0xE000
|
||||
stp
|
||||
|
Loading…
Reference in New Issue
Block a user