Compare commits
No commits in common. "9ad69d3e3caebbe629afeefc1bbce1e8d0874c9a" and "2156d824c51ec02e92782ef1e681a0bc52ee5918" have entirely different histories.
9ad69d3e3c
...
2156d824c5
|
@ -14,7 +14,7 @@ func main() {
|
|||
}
|
||||
defer dbg.Close()
|
||||
|
||||
mem := memory.New(dbg, 128*1024)
|
||||
mem := memory.New(dbg, 4*1024)
|
||||
|
||||
if err := UI(mem); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
const (
|
||||
portDev = "/dev/ttyUSB0"
|
||||
portSpeed = 1_382_400 // 1.3Mbps
|
||||
portSpeed = 115_200
|
||||
maxAddr = 1 << 17
|
||||
pingResponse = 0xEA
|
||||
readTimeout = 2 * time.Second
|
||||
|
@ -26,7 +26,7 @@ type Serial struct {
|
|||
|
||||
func Open() (*Serial, error) {
|
||||
mode := &serial.Mode{
|
||||
BaudRate: portSpeed,
|
||||
BaudRate: 115_200,
|
||||
}
|
||||
port, err := serial.Open(portDev, mode)
|
||||
if err != nil {
|
||||
|
@ -38,7 +38,6 @@ func Open() (*Serial, error) {
|
|||
port.Close()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
port.SetReadTimeout(readTimeout)
|
||||
if _, err := io.ReadFull(port, packet[:1]); err != nil {
|
||||
port.Close()
|
||||
|
@ -81,7 +80,7 @@ func encode(cmd int, addr int, data byte) [4]byte {
|
|||
func (d *Serial) readSlow(bs []byte, off int64) (int, error) {
|
||||
d.portMu.Lock()
|
||||
defer d.portMu.Unlock()
|
||||
if off+int64(len(bs)) > maxAddr {
|
||||
if off+int64(len(bs)) >= maxAddr {
|
||||
return 0, errors.New("OOB read")
|
||||
}
|
||||
for i := range bs {
|
||||
|
@ -101,7 +100,7 @@ func (d *Serial) readSlow(bs []byte, off int64) (int, error) {
|
|||
func (d *Serial) readBurst(bs []byte, off int64) (int, error) {
|
||||
d.portMu.Lock()
|
||||
defer d.portMu.Unlock()
|
||||
if off+int64(len(bs)) > maxAddr {
|
||||
if off+int64(len(bs)) >= maxAddr {
|
||||
return 0, errors.New("OOB read")
|
||||
}
|
||||
for i := 0; i < len(bs); i += 255 {
|
||||
|
@ -126,7 +125,7 @@ func (d *Serial) ReadAt(bs []byte, off int64) (int, error) {
|
|||
func (d *Serial) WriteAt(bs []byte, off int64) (int, error) {
|
||||
d.portMu.Lock()
|
||||
defer d.portMu.Unlock()
|
||||
if off+int64(len(bs)) > maxAddr {
|
||||
if off+int64(len(bs)) >= maxAddr {
|
||||
return 0, errors.New("OOB write")
|
||||
}
|
||||
for i, v := range bs {
|
||||
|
|
|
@ -82,8 +82,8 @@ func (m debugger) readFullMemory() tea.Cmd {
|
|||
|
||||
func (m debugger) readFullMemoryCmds() []tea.Cmd {
|
||||
var ret []tea.Cmd
|
||||
for i := 0; i < m.mem.Len(); i += 32 * 1024 {
|
||||
ret = append(ret, m.readMemory(i, 32*1024))
|
||||
for i := 0; i < m.mem.Len(); i += 128 {
|
||||
ret = append(ret, m.readMemory(i, 128))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ module mkTop(Top);
|
|||
|
||||
////////////
|
||||
// Debugging
|
||||
let debugger <- mkUARTDebugger(25_000_000, 1_382_400, mem.debugger);
|
||||
let debugger <- mkUARTDebugger(25_000_000, 115_200, mem.debugger);
|
||||
let blinky <- mkBlinky(25_000_000);
|
||||
|
||||
////////////
|
||||
|
|
Loading…
Reference in New Issue