palm-client: check for an SB-LoRa module with HsCardAttrGet before bus access; shorter Node-screen errors
This commit is contained in:
1 parent
f877fdddb1
commit
4c66088eff
6 files changed
+75
-10
No files matched your search
+2
-1
@@ -26,7 +26,7 @@
|
||||
- [x] USB link from the dev Mac: pilot-link (desrod @6d696653 + `tools/pilot-link-darwin-usb-open-retry.patch`) lists the Visor's databases
|
||||
- [x] `make install` puts VisorMesh on the Visor; app launches and shows the main form on the Visor Neo
|
||||
- [ ] Emulator: CloudpilotEmu with a Palm OS 3.5 ROM (the Visor isn't emulated); optionally POSE + a Visor Neo ROM in a Windows VM
|
||||
- [ ] Original Handspring SDK headers (Springboard `HsCard*` APIs; the PalmOne `HsExt.h` lacks them), needed for module-ROM work only
|
||||
- [x] Original Handspring SDK headers (Springboard `HsCard*` APIs; the PalmOne `HsExt.h` lacks them). The calls used are declared in `src/hs_card.h`; the SDK itself isn't in the repo (Handspring EULA)
|
||||
- [x] Bus SPI routines and SC16IS740 driver (`sb_spi.c`, `transport_sb.c`); host-tested against a simulated carrier, not on hardware
|
||||
- [x] Companion protocol: framing, builders (DEVICE_QUERY, APP_START, GET_CONTACTS, SYNC_NEXT_MESSAGE), parsers (SELF_INFO, contacts, v3 contact/channel messages); host tests from real captures + MeshCore layouts
|
||||
- [x] USB bench link: app (`HsUd`) → Visor USB cradle → `tools/visor_bridge.py` → FTDI → XIAO D6/D7. Query radio shows `Reply 0x000D, 82 bytes` on the Visor
|
||||
@@ -79,3 +79,4 @@
|
||||
- Verified on the Neo: two-line compose field (scrolls, redraws after the on-screen keyboard), Unicode symbols/emoji smiley, line breaks in messages, beep for DMs/mentions, "new" divider. Segments: 1 = 7.8 KB, 2 = 27.1 KB (the next big feature should go in a third segment); tools/check_sections.py guards the rules on every build.
|
||||
- 2026-11-02: Verified on the Neo against a PhillyMesh repeater: login, admin console (Read settings, typed CLI commands, Status 0x87 and Telemetry 0x8B decoded), contact detail with signal history, Add Contact, Reset Path. Segments: 9.1 / 27.7 / 12.4 KB. Upstream issues written up in docs/upstream-issues.md (none filed yet).
|
||||
- 2026-11-02: SB-LoRa transport written ahead of the boards: bus-SPI bit-bang over CS0/CS1 (`sb_spi.c`), SC16IS740 setup for 115200 8N1, burst FIFO access, sleep, and a "Slot" link on the Node screen (`transport_sb.c`). `tests/test_sblora.c` checks it against a simulated carrier (latches, inverter, SC16IS740). Unknowns for bring-up: whether connector A0 is CPU A1 (the probe tries both mappings via the scratch register), the hard-coded csSlot0 base 0x28000000 (no Handspring SDK for HsCardAttrGet), and RX overruns while the app isn't polling (no IRQ handler yet). Segments: 9.6 / 27.7 / 13.1 KB.
|
||||
- 2026-11-02: Slot with an empty slot reset the Visor (bus error at csSlot0), and since Slot was saved and Home auto-connects, every launch reset it. Slot is no longer restored at launch, and Connect now checks `HsCardAttrGet(hsCardAttrHwInstalled)` and takes the chip-select base and size from the OS before any bus access. Verified on the Neo: empty slot gives "No module in the slot." with no reset. Node-screen errors shortened to its 22-character labels.
|
||||
@@ -58,17 +58,17 @@ void AppSavePrefs(void)
|
||||
void AppErrorText(Err err, Char *out)
|
||||
{
|
||||
if (err == vmErrNoReply)
|
||||
StrCopy(out, "No reply from the radio.");
|
||||
StrCopy(out, "No reply from radio.");
|
||||
else if (err == vmErrRadio)
|
||||
StrCopy(out, "The radio returned an error.");
|
||||
StrCopy(out, "Radio returned error.");
|
||||
else if (err == vmErrBadReply)
|
||||
StrCopy(out, "Unexpected reply from the radio.");
|
||||
StrCopy(out, "Bad reply from radio.");
|
||||
else if (err == vmErrTooLong)
|
||||
StrCopy(out, "Message too long.");
|
||||
else if (err == serErrNotOpen)
|
||||
StrCopy(out, "Not connected.");
|
||||
else if (err == vmErrNoModule)
|
||||
StrCopy(out, "No SB-LoRa module in the slot.");
|
||||
StrCopy(out, "No module in the slot.");
|
||||
else if (err == vmErrLoginFailed)
|
||||
StrCopy(out, "Login refused: wrong password?");
|
||||
else
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* The few Handspring Springboard card calls VisorMesh uses, declared from the
|
||||
* Handspring SDK's HsExt.h (not vendored: it's under Handspring's EULA).
|
||||
* Calls go through sysTrapOEMDispatch with a 16-bit selector pushed on the
|
||||
* stack, which the dispatcher pops ("unpopped" in HsExt.h).
|
||||
*/
|
||||
#ifndef VM_HS_CARD_H
|
||||
#define VM_HS_CARD_H
|
||||
|
||||
#include <PalmOS.h>
|
||||
|
||||
#define hsFtrCreator 'hsEx' /* present on Handspring devices */
|
||||
#define hsFtrIDVersion 0
|
||||
|
||||
#define hsCardSlot 1 /* the Springboard slot; 0 is built-in */
|
||||
|
||||
/* HsCardAttrEnum values */
|
||||
#define hsCardAttrHwInstalled 1 /* UInt8: module present and out of reset */
|
||||
#define hsCardAttrCsBase 3 /* UInt32: csSlot0 address */
|
||||
#define hsCardAttrCsSize 4 /* UInt32: size of each chip select */
|
||||
|
||||
#define hsSelCardAttrGet 0x6
|
||||
|
||||
/* Two levels so table/vector/selector are macro-expanded before _Str. */
|
||||
#define VM_HS_CALL(table, vector, selector) \
|
||||
__attribute__ ((__callseq__ ( \
|
||||
"move.w #" _Str(selector) ",-(%%sp); " \
|
||||
"trap #" _Str(table) "; dc.w " _Str(vector))))
|
||||
#define VM_HS_SEL_TRAP(trapNum, selector) VM_HS_CALL(sysDispatchTrapNum, trapNum, selector)
|
||||
|
||||
Err HsCardAttrGet(UInt16 cardNo, UInt16 attr, void *valueP)
|
||||
VM_HS_SEL_TRAP(sysTrapOEMDispatch, hsSelCardAttrGet);
|
||||
|
||||
#endif
|
||||
@@ -86,6 +86,12 @@ static Boolean ScratchOk(void)
|
||||
return SbReadReg(SB_SPR) == 0xAA;
|
||||
}
|
||||
|
||||
void SbSetBase(UInt32 cs0, UInt32 csSize)
|
||||
{
|
||||
gCs0 = cs0;
|
||||
gCs1 = cs0 + csSize;
|
||||
}
|
||||
|
||||
Boolean SbProbe(void)
|
||||
{
|
||||
UInt8 shift;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
/*
|
||||
* csSlot0 base and the default 16 MB chip-select size (Springboard Dev Guide
|
||||
* §2.1). The guide says to ask HsCardAttrGet(hsCardAttrCsBase) instead; that
|
||||
* needs the Handspring SDK headers, which this tree doesn't have yet.
|
||||
* §2.1). Used until SbSetBase(); on the Visor, transport_sb.c passes what
|
||||
* HsCardAttrGet reports.
|
||||
*/
|
||||
#define SB_CS0_BASE 0x28000000UL
|
||||
#define SB_CS_SIZE 0x01000000UL
|
||||
@@ -49,6 +49,9 @@
|
||||
*/
|
||||
Boolean SbProbe(void) VM_SECT3;
|
||||
|
||||
/* csSlot0's address and the size of each chip select; csSlot1 follows csSlot0. */
|
||||
void SbSetBase(UInt32 cs0, UInt32 csSize) VM_SECT3;
|
||||
|
||||
/* 115200 8N1 (14.7456 MHz crystal, DLL = 8), FIFOs on, interrupts off. */
|
||||
void SbUartInit(void) VM_SECT3;
|
||||
|
||||
|
||||
@@ -2,22 +2,43 @@
|
||||
* Transport over the SB-LoRa Springboard module (sb_spi.c). Polled: the
|
||||
* SC16IS740's 64-byte RX FIFO fills in about 5.5 ms at 115200, so bytes that
|
||||
* arrive while the app isn't inside TransportRecv can be lost. An interrupt
|
||||
* handler on the slot IRQ* (wired to the chip's IRQ) would fix that; it needs
|
||||
* the Handspring card API.
|
||||
* handler on the slot IRQ* (wired to the chip's IRQ) would fix that, through
|
||||
* hsCardAttrIntHandler (not done yet).
|
||||
*/
|
||||
#include <PalmOS.h>
|
||||
#include "transport.h"
|
||||
#include "sb_spi.h"
|
||||
#include "hs_card.h"
|
||||
|
||||
#define SB_SEND_TICKS 200 /* give up if the TX FIFO doesn't drain for 2 s */
|
||||
|
||||
static Boolean gOpen = false;
|
||||
|
||||
/*
|
||||
* Asks the OS whether a module is in the slot and where its chip selects
|
||||
* are. A bus read with the slot empty is a bus error, which resets the Visor.
|
||||
*/
|
||||
static Boolean ModulePresent(void)
|
||||
{
|
||||
UInt32 version, base, size;
|
||||
UInt8 installed = 0;
|
||||
|
||||
if (FtrGet(hsFtrCreator, hsFtrIDVersion, &version) != errNone)
|
||||
return false; /* not a Handspring device: no slot */
|
||||
if (HsCardAttrGet(hsCardSlot, hsCardAttrHwInstalled, &installed) != errNone || !installed)
|
||||
return false;
|
||||
if (HsCardAttrGet(hsCardSlot, hsCardAttrCsBase, &base) != errNone ||
|
||||
HsCardAttrGet(hsCardSlot, hsCardAttrCsSize, &size) != errNone)
|
||||
return false;
|
||||
SbSetBase(base, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
Err SbTransportOpen(void)
|
||||
{
|
||||
if (gOpen)
|
||||
return errNone;
|
||||
if (!SbProbe())
|
||||
if (!ModulePresent() || !SbProbe())
|
||||
return vmErrNoModule;
|
||||
SbUartInit();
|
||||
gOpen = true;
|
||||
|
||||
Reference in new issue
Block a user