Skip to content

Commit 752985b

Browse files
committed
Merge branch 'master' into lynx-compile
2 parents 8a34c47 + 6a2f5ea commit 752985b

File tree

210 files changed

+5137
-13558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+5137
-13558
lines changed

.github/workflows/build-fujinet-pc.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ jobs:
4747
runner: ubuntu-24.04
4848
target: ubuntu-24.04-amd64
4949
default-shell: bash
50-
- name: macOS 13
51-
target: macos-13
52-
runner: macos-13
50+
- name: macOS 15 ARM
51+
target: macos-15-arm64
52+
runner: macos-15
5353
default-shell: bash
54-
- name: macOS 14
55-
target: macos-14
54+
- name: macOS 15 Intel
55+
target: macos-15-x64
56+
runner: macos-15-intel
57+
default-shell: bash
58+
- name: macOS 14 ARM
59+
target: macos-14-arm64
5660
runner: macos-14
5761
default-shell: bash
5862
- name: Windows

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ fujinet_releases/*
5858
*~
5959
*.orig
6060
*.rej
61+
*.lst
6162

6263
# espressif managed components
6364
managed_components

coding-standard.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class FormatError(Enum):
4646
IllegalTabs = auto()
4747
CodingStandardViolation = auto()
4848

49+
class TabsOk(Enum):
50+
Nope = auto() # Calling it "None" seems confusing
51+
Leading = auto()
52+
AllTabs = auto()
53+
4954
ErrorStrings = {
5055
FormatError.TrailingWhitespace: "Trailing whitespace",
5156
FormatError.IllegalTabs: "Tab characters",
@@ -65,6 +70,8 @@ def build_argparser():
6570
group = parser.add_mutually_exclusive_group()
6671
group.add_argument("--fix", action="store_true", help="rewrite improperly formatted files")
6772
group.add_argument("--show", action="store_true", help="print reformatted file on stdout")
73+
group.add_argument("-l", "--list", action="store_true",
74+
help="only print filenames of improperly formatted files")
6875
return parser
6976

7077
class ClangFormatter:
@@ -140,9 +147,11 @@ def __init__(self, path, contents=None):
140147
if contents is None:
141148
raise ValueError("Contents not provided")
142149

143-
self.allowLeadingTab = False
150+
self.allowTabs = TabsOk.Nope
144151
if self.isMakefile:
145-
self.allowLeadingTab = True
152+
self.allowTabs = TabsOk.Leading
153+
elif self.isAssembly:
154+
self.allowTabs = TabsOk.AllTabs
146155

147156
return
148157

@@ -153,7 +162,7 @@ def splitLeadingTab(self, line):
153162
"""
154163
prefix = ""
155164
suffix = line
156-
if self.allowLeadingTab:
165+
if self.allowTabs == TabsOk.Leading:
157166
if line and line[0] == '\t':
158167
prefix = line[:1]
159168
suffix = line[1:]
@@ -177,7 +186,7 @@ def fixupWhitespace(self):
177186
lines = []
178187
for line in self.contents:
179188
line = line.rstrip()
180-
if "\t" in line:
189+
if self.allowTabs != TabsOk.AllTabs and "\t" in line:
181190
prefix, suffix = self.splitLeadingTab(line)
182191
while "\t" in suffix:
183192
column = suffix.index("\t")
@@ -243,9 +252,6 @@ def checkFormatting(self, repo):
243252
else:
244253
formatted = self.fixupWhitespace()
245254

246-
elif self.isMakefile:
247-
formatted = self.fixupWhitespace()
248-
249255
else:
250256
formatted = self.fixupWhitespace()
251257

@@ -268,7 +274,7 @@ def classifyErrors(self):
268274
trailingStart = len(line.rstrip())
269275
line = line[:trailingStart]
270276
prefix, suffix = self.splitLeadingTab(line)
271-
if "\t" in suffix:
277+
if self.allowTabs != TabsOk.AllTabs and "\t" in suffix:
272278
errors.add(FormatError.IllegalTabs)
273279
break
274280

@@ -308,7 +314,8 @@ def displayErrors(self, errs, formatted):
308314

309315
@property
310316
def isClang(self):
311-
return self.path.suffix in ClangFormatter.TYPES
317+
#return self.path.suffix in ClangFormatter.TYPES
318+
return False
312319

313320
@property
314321
def isMakefile(self):
@@ -317,6 +324,12 @@ def isMakefile(self):
317324
return True
318325
return False
319326

327+
@property
328+
def isAssembly(self):
329+
if self.path.suffix in [".asm", ".s"]:
330+
return True
331+
return False
332+
320333
@property
321334
def isPython(self):
322335
if self.path.suffix == ".py" or self.contents[0].startswith("#!/usr/bin/env python"):
@@ -444,6 +457,7 @@ def main():
444457

445458
doFix = False
446459
doShow = False
460+
doList = False
447461

448462
script_mode = os.path.basename(sys.argv[0])
449463
if script_mode == "pre-commit":
@@ -455,6 +469,7 @@ def main():
455469
else:
456470
doFix = args.fix
457471
doShow = args.show
472+
doList = args.list
458473
to_check = args.file
459474

460475
if doShow and len(to_check) > 1:
@@ -470,7 +485,9 @@ def main():
470485

471486
if TextFile.pathIsText(path):
472487
tfile = TextFile(path, repo.getContents(path))
473-
if doShow:
488+
if doList:
489+
print(tfile.path)
490+
elif doShow:
474491
tfile.show()
475492
elif doFix:
476493
tfile.update()

fujinet_pc.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ set(SOURCES src/main.cpp
238238
lib/network-protocol/SMB.h lib/network-protocol/SMB.cpp
239239
lib/network-protocol/SSH.h lib/network-protocol/SSH.cpp
240240
lib/network-protocol/SD.h lib/network-protocol/SD.cpp
241-
lib/fuji/fujiCmd.h
242241
lib/fuji/fujiHost.h lib/fuji/fujiHost.cpp
243242
lib/fuji/fujiDisk.h lib/fuji/fujiDisk.cpp
244243
lib/bus/bus.h
@@ -247,7 +246,7 @@ set(SOURCES src/main.cpp
247246
lib/device/printer.h
248247
lib/device/modem.h
249248
lib/device/cassette.h
250-
lib/device/fuji.h
249+
lib/device/fujiDevice.h
251250
lib/device/network.h
252251
lib/device/udpstream.h
253252
lib/device/siocpm.h
@@ -276,7 +275,7 @@ if(FUJINET_TARGET STREQUAL "ATARI")
276275
lib/device/sio/printer.h lib/device/sio/printer.cpp
277276
lib/device/sio/printerlist.h lib/device/sio/printerlist.cpp
278277
lib/device/sio/cassette.h lib/device/sio/cassette.cpp
279-
lib/device/sio/fuji.h lib/device/sio/fuji.cpp
278+
lib/device/sio/sioFuji.h lib/device/sio/sioFuji.cpp
280279
lib/device/sio/network.h lib/device/sio/network.cpp
281280
lib/device/sio/udpstream.h lib/device/sio/udpstream.cpp
282281
lib/device/sio/voice.h lib/device/sio/voice.cpp
@@ -336,7 +335,7 @@ if(FUJINET_TARGET STREQUAL "APPLE")
336335
lib/device/iwm/printer.h lib/device/iwm/printer.cpp
337336
lib/device/iwm/printerlist.h lib/device/iwm/printerlist.cpp
338337
lib/device/iwm/modem.h lib/device/iwm/modem.cpp
339-
lib/device/iwm/fuji.h lib/device/iwm/fuji.cpp
338+
lib/device/iwm/iwmFuji.h lib/device/iwm/iwmFuji.cpp
340339
lib/device/iwm/network.h lib/device/iwm/network.cpp
341340
lib/device/iwm/clock.h lib/device/iwm/clock.cpp
342341
lib/device/iwm/cpm.h lib/device/iwm/cpm.cpp
@@ -368,7 +367,7 @@ if(FUJINET_TARGET STREQUAL "COCO")
368367
lib/media/drivewire/mediaTypeMRM.h lib/media/drivewire/mediaTypeMRM.cpp
369368
lib/media/drivewire/mediaTypeVDK.h lib/media/drivewire/mediaTypeVDK.cpp
370369

371-
lib/device/drivewire/fuji.h lib/device/drivewire/fuji.cpp
370+
lib/device/drivewire/drivewireFuji.h lib/device/drivewire/drivewireFuji.cpp
372371
lib/device/drivewire/network.h lib/device/drivewire/network.cpp
373372
lib/device/drivewire/dload.h lib/device/drivewire/dload.cpp
374373
lib/device/drivewire/disk.h lib/device/drivewire/disk.cpp

include/fujiCommandID.h

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#ifndef FUJI_COMMANDS_H
2+
#define FUJI_COMMANDS_H
3+
4+
/*
5+
* Fuji Device Command Definitions
6+
*/
7+
8+
enum fujiCommandID_t {
9+
FUJICMD_RESET = 0xFF,
10+
FUJICMD_SPECIAL_QUERY = 0xFF,
11+
FUJICMD_GET_SSID = 0xFE,
12+
FUJICMD_PASSWORD = 0xFE,
13+
FUJICMD_SCAN_NETWORKS = 0xFD,
14+
FUJICMD_USERNAME = 0xFD,
15+
FUJICMD_GET_SCAN_RESULT = 0xFC,
16+
FUJICMD_JSON = 0xFC,
17+
FUJICMD_SET_SSID = 0xFB,
18+
FUJICMD_GET_WIFISTATUS = 0xFA,
19+
FUJICMD_MOUNT_HOST = 0xF9,
20+
FUJICMD_MOUNT_IMAGE = 0xF8,
21+
FUJICMD_OPEN_DIRECTORY = 0xF7,
22+
FUJICMD_READ_DIR_ENTRY = 0xF6,
23+
FUJICMD_CLOSE_DIRECTORY = 0xF5,
24+
FUJICMD_READ_HOST_SLOTS = 0xF4,
25+
FUJICMD_WRITE_HOST_SLOTS = 0xF3,
26+
FUJICMD_READ_DEVICE_SLOTS = 0xF2,
27+
FUJICMD_WRITE_DEVICE_SLOTS = 0xF1,
28+
FUJICMD_ENABLE_UDPSTREAM = 0xF0,
29+
FUJICMD_SET_BAUDRATE = 0xEB,
30+
FUJICMD_GET_WIFI_ENABLED = 0xEA,
31+
FUJICMD_UNMOUNT_IMAGE = 0xE9,
32+
FUJICMD_GET_ADAPTERCONFIG = 0xE8,
33+
FUJICMD_NEW_DISK = 0xE7,
34+
FUJICMD_UNMOUNT_HOST = 0xE6,
35+
FUJICMD_GET_DIRECTORY_POSITION = 0xE5,
36+
FUJICMD_SET_DIRECTORY_POSITION = 0xE4,
37+
FUJICMD_SET_HSIO_INDEX = 0xE3,
38+
FUJICMD_SET_DEVICE_FULLPATH = 0xE2,
39+
FUJICMD_SET_HOST_PREFIX = 0xE1,
40+
FUJICMD_GET_HOST_PREFIX = 0xE0,
41+
FUJICMD_SET_SIO_EXTERNAL_CLOCK = 0xDF,
42+
FUJICMD_WRITE_APPKEY = 0xDE,
43+
FUJICMD_READ_APPKEY = 0xDD,
44+
FUJICMD_OPEN_APPKEY = 0xDC,
45+
FUJICMD_CLOSE_APPKEY = 0xDB,
46+
FUJICMD_GET_DEVICE_FULLPATH = 0xDA,
47+
FUJICMD_CONFIG_BOOT = 0xD9,
48+
FUJICMD_COPY_FILE = 0xD8,
49+
FUJICMD_MOUNT_ALL = 0xD7,
50+
FUJICMD_HRS232_WRITE = 0xD7,
51+
FUJICMD_SET_BOOT_MODE = 0xD6,
52+
FUJICMD_ENABLE_DEVICE = 0xD5,
53+
FUJICMD_DISABLE_DEVICE = 0xD4,
54+
FUJICMD_RANDOM_NUMBER = 0xD3,
55+
FUJICMD_HRS232_STATUS = 0xD3,
56+
FUJICMD_GET_TIME = 0xD2,
57+
FUJICMD_HRS232_READ = 0xD2,
58+
FUJICMD_DEVICE_ENABLE_STATUS = 0xD1,
59+
FUJICMD_BASE64_ENCODE_INPUT = 0xD0,
60+
FUJICMD_HRS232_PUT = 0xD0,
61+
FUJICMD_BASE64_ENCODE_COMPUTE = 0xCF,
62+
FUJICMD_BASE64_ENCODE_LENGTH = 0xCE,
63+
FUJICMD_BASE64_ENCODE_OUTPUT = 0xCD,
64+
FUJICMD_BASE64_DECODE_INPUT = 0xCC,
65+
FUJICMD_BASE64_DECODE_COMPUTE = 0xCB,
66+
FUJICMD_BASE64_DECODE_LENGTH = 0xCA,
67+
FUJICMD_BASE64_DECODE_OUTPUT = 0xC9,
68+
FUJICMD_HASH_INPUT = 0xC8,
69+
FUJICMD_HASH_COMPUTE = 0xC7,
70+
FUJICMD_HASH_LENGTH = 0xC6,
71+
FUJICMD_HASH_OUTPUT = 0xC5,
72+
FUJICMD_GET_ADAPTERCONFIG_EXTENDED = 0xC4,
73+
FUJICMD_HASH_COMPUTE_NO_CLEAR = 0xC3,
74+
FUJICMD_HASH_CLEAR = 0xC2,
75+
FUJICMD_GET_HEAP = 0xC1,
76+
FUJICMD_QRCODE_OUTPUT = 0xBF,
77+
FUJICMD_QRCODE_LENGTH = 0xBE,
78+
FUJICMD_QRCODE_ENCODE = 0xBD,
79+
FUJICMD_QRCODE_INPUT = 0xBC,
80+
FUJICMD_GET_DEVICE8_FULLPATH = 0xA7,
81+
FUJICMD_GET_DEVICE7_FULLPATH = 0xA6,
82+
FUJICMD_GET_DEVICE6_FULLPATH = 0xA5,
83+
FUJICMD_GET_DEVICE5_FULLPATH = 0xA4,
84+
FUJICMD_GET_DEVICE4_FULLPATH = 0xA3,
85+
FUJICMD_GET_DEVICE3_FULLPATH = 0xA2,
86+
FUJICMD_HRS232_FORMAT_MEDIUM = 0xA2,
87+
FUJICMD_GET_DEVICE2_FULLPATH = 0xA1,
88+
FUJICMD_HRS232_FORMAT = 0xA1,
89+
FUJICMD_GET_DEVICE1_FULLPATH = 0xA0,
90+
FUJICMD_GETTZTIME = 0x9A,
91+
FUJICMD_SETTZ = 0x99,
92+
FUJICMD_GETTIME = 0x93,
93+
FUJICMD_JSON_QUERY = 0x81,
94+
FUJICMD_JSON_PARSE = 0x80,
95+
FUJICMD_GET_REMOTE = 0x72, // r
96+
FUJICMD_CLOSE_CLIENT = 0x63, // c
97+
FUJICMD_TIMER = 0x5A, // Z
98+
FUJICMD_STREAM = 0x58, // X
99+
FUJICMD_WRITE = 0x57, // W
100+
FUJICMD_TRANSLATION = 0x54, // T
101+
FUJICMD_STATUS = 0x53, // S
102+
FUJICMD_READ = 0x52, // R
103+
FUJICMD_QUERY = 0x51, // Q
104+
FUJICMD_PUT = 0x50, // P
105+
FUJICMD_PARSE = 0x50, // P
106+
FUJICMD_AUTOANSWER = 0x4F, // O
107+
FUJICMD_PERCOM_WRITE = 0x4F, // O
108+
FUJICMD_OPEN = 0x4F, // O
109+
FUJICMD_BAUDRATELOCK = 0x4E, // N
110+
FUJICMD_PERCOM_READ = 0x4E, // N
111+
FUJICMD_UNLISTEN = 0x4D, // M
112+
FUJICMD_LISTEN = 0x4C, // L
113+
FUJICMD_GET_ERROR = 0x45, // E
114+
FUJICMD_SET_DESTINATION = 0x44, // D
115+
FUJICMD_SET_DUMP = 0x44, // D
116+
FUJICMD_CLOSE = 0x43, // C
117+
FUJICMD_CONFIGURE = 0x42, // B
118+
FUJICMD_CONTROL = 0x41, // A
119+
FUJICMD_TYPE3_POLL = 0x40, // @
120+
FUJICMD_TYPE1_POLL = 0x3F,
121+
FUJICMD_HSIO_INDEX = 0x3F, // ?
122+
FUJICMD_GETCWD = 0x30, // 0
123+
FUJICMD_CHDIR = 0x2C, // ,
124+
FUJICMD_RMDIR = 0x2B, // +
125+
FUJICMD_MKDIR = 0x2A, // *
126+
FUJICMD_TELL = 0x26, // &
127+
FUJICMD_LOAD_HANDLER = 0x26, // &
128+
FUJICMD_SEEK = 0x25, // %
129+
FUJICMD_UNLOCK = 0x24, // $
130+
FUJICMD_LOCK = 0x23, // #
131+
FUJICMD_FORMAT_MEDIUM = 0x22, // "
132+
FUJICMD_DELETE = 0x21, // !
133+
FUJICMD_LOAD_RELOCATOR = 0x21, // !
134+
FUJICMD_FORMAT = 0x21, // !
135+
FUJICMD_RENAME = 0x20,
136+
FUJICMD_NAK = 0x15, // ASCII NAK
137+
FUJICMD_ACK = 0x06, // ASCII ACK
138+
FUJICMD_SEND_ERROR = 0x02,
139+
FUJICMD_SEND_RESPONSE = 0x01,
140+
FUJICMD_DEVICE_READY = 0x00,
141+
};
142+
143+
#endif /* FUJI_COMMANDS_H */

lib/FileSystem/fnFsLittleFS.cpp

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ bool FileSystemLittleFS::start()
223223
// strlcpy(_basepath, "/flash", sizeof(_basepath));
224224

225225
esp_vfs_littlefs_conf_t conf = {
226-
.base_path = "",
227-
.partition_label = "storage",
228-
.format_if_mount_failed = false,
229-
.dont_mount = false
226+
.base_path = "",
227+
.partition_label = "storage",
228+
.format_if_mount_failed = false,
229+
.dont_mount = false
230230
};
231231

232232
esp_err_t e = esp_vfs_littlefs_register(&conf);
@@ -236,7 +236,7 @@ bool FileSystemLittleFS::start()
236236
#ifdef DEBUG
237237
Debug_printv("Failed to mount LittleFS partition, err = %d\r\n", e);
238238
#endif
239-
_started = false;
239+
//_started = false;
240240
}
241241
else
242242
{
@@ -254,4 +254,34 @@ bool FileSystemLittleFS::start()
254254
return _started;
255255
}
256256

257+
258+
bool FileSystemLittleFS::stop()
259+
{
260+
if(!_started)
261+
return true;
262+
263+
esp_err_t e = esp_vfs_littlefs_unregister("storage");
264+
265+
if (e != ESP_OK)
266+
{
267+
#ifdef DEBUG
268+
Debug_printv("Failed to unmount LittleFS partition, err = %d\r\n", e);
269+
#endif
270+
}
271+
else
272+
{
273+
_started = false;
274+
#ifdef DEBUG
275+
Debug_println("LittleFS unmounted.");
276+
/*
277+
size_t total = 0, used = 0;
278+
esp_littlefs_info(NULL, &total, &used);
279+
Debug_printv(" partition size: %u, used: %u, free: %u\r\n", total, used, total-used);
280+
*/
281+
#endif
282+
}
283+
284+
return !_started;
285+
}
286+
257287
#endif // FLASH_LITTLEFS

0 commit comments

Comments
 (0)