Commit Graph
100 Commits
Author SHA1 Message Date
René van Dorst fc53003022 Merge pull request #116 from logicog/speed_fixes
Fix Speed Setting using Auton-Neg
2026-02-08 18:26:43 +00:00
René van Dorst d4ed753715 Merge pull request #117 from logicog/uuid_mac
Generate a random stable locally administered addresses (LAA) MAC address based on the SoC's UUID + LOT number.
2026-02-08 14:58:36 +00:00
René van Dorst dbb8fe1249 Merge pull request #104 from diijkstra/i2c_gpio
Advanced I2C SFP pins definition
2026-02-01 20:48:34 +00:00
René van Dorst 2a5f1de8f7 Merge pull request #105 from logicog/mgmt_vlan
Add support for pin switch management features to a VLAN.
2026-01-29 19:31:32 +00:00
René van Dorst 1d94e99612 Demagic 0x7, 0x3e to PHY_MMD_AN, PHY_EEE_ADV2 2026-01-26 23:00:29 +01:00
René van Dorst a134335308 Demagic PHY_MMD31, 0xa432 to PHY_MMD31, PHY_MMD31_PHYCR2 2026-01-26 22:58:57 +01:00
René van Dorst 6495310ba9 Demagic PHY_MMD31, 0xa434 to PHY_MMD31, PHY_MMD31_PHYSR 2026-01-26 22:48:04 +01:00
René van Dorst 5962c3a8a6 Demagic PHY_MMD31, 0xa414 to PHY_MMD31, PHY_MMD31_GANLPAR 2026-01-26 22:45:44 +01:00
René van Dorst a6e452e638 Demagic PHY_MMD_AN, 33 to PHY_MMD_AN, PHY_ANEG_MGBASE_ADV 2026-01-26 22:42:54 +01:00
René van Dorst 7f4c276285 Demagic PHY_MMD_AN, 0x00 to PHY_MMD_AN, PHY_ANEG_CTRL 2026-01-26 22:41:49 +01:00
René van Dorst f9fdc6b81d Demagic PHY_MMD_AN, 0x13 to PHY_MMD_AN, PHY_ANEG_LP_ABILITY 2026-01-26 22:39:16 +01:00
René van Dorst d9185b3505 Demagic PHY_MMD31, 0xa400 to PHY_MMD31, PHY_MMD31_FEDCR 2026-01-26 22:37:16 +01:00
René van Dorst 3d7ef55ced Demagic PHY_MMD31, 0xa412 to PHY_MMD31, PHY_MMD31_GBCR 2026-01-26 22:35:03 +01:00
René van Dorst 44779404df Demagic PHY_MMD_AN, 0x20 to PHY_MMD_AN, PHY_ANEG_MGBASE_CTRL 2026-01-26 22:31:44 +01:00
René van Dorst 1997d7379b Demagic PHY_MMD_AN, 0x10 to PHY_MMD_AN, PHY_ANEG_ADV 2026-01-26 22:28:33 +01:00
René van Dorst c61fb6d2fe Forgot to replace so machine.isRTL8373 to machine_detected.isRTL8373 2026-01-26 20:39:42 +01:00
René van Dorst c11099b9ec Rename PHY_SDS_CTRL and RTL8224_DEV_ID to PHY_MMD30.
So demagic the `phy_(, 0x1e, )` to `phy_(, PHY_MMD30, )`.
Use `rg -tc phy | rg -i 0x1e` to find to most locations.
2026-01-25 23:44:03 +01:00
René van Dorst 13d0781455 Rename PHY_MMD_CTRL to PHY_MMD31.
So demagic the `phy_(, 0x1f, )` to `phy_(, PHY_MMD31, )`.
2026-01-25 23:38:04 +01:00
René van Dorst fc327810ed Add more comments about the SDS-settings for RTL8224.
Remove the unused array `rtl8224_cb`.
Rename `rtl8224_ca` to `rtl8224_sds0_setttings`.
2026-01-25 20:24:40 +01:00
René van Dorst b7b4594406 N-type SOC need to swap some Serdes lines to make it work.
Without this fix N-type SOC devices like RTL8372N, RTL8383N and also the
4-port PHY RTL8224N, don't have a functional Serdes. Although the SOC
sees a link, there is no packet flow on both SFP-port nor RTL8224 ports.

Added helper functions to read/write to the RTL8224.
RTL8224 has the same register layout so we can use the same register
defines as for the main SOC.
2026-01-25 17:22:51 +01:00
René van Dorst aa750d8ff1 Detect SOC type and use detected SOC type to init the hardware.
Detect the SOC type and variant. RTL8372 vs RTL8373 and also is it as
non-N/N variant of the SOC.
Even if the machine profile is wrong the hardware will be initilised on
the detected type.
2026-01-25 16:55:43 +01:00
René van Dorst 2cdeda3bc9 Merge pull request #87 from feelfree69/patch-1
Move SW version print after flash initialization
2026-01-20 18:55:27 +00:00
René van Dorst 13e9dbbc7b Merge pull request #68 from logicog/dhcp
Add a DHCP client implementation and validate BANKS code size.
2026-01-18 11:08:17 +00:00
René van Dorst e74c4f148a version: Also show the hardware profile. 2026-01-17 21:02:25 +01:00
René van Dorst e54313eded Merge pull request #83 from logicog/l2
Add support for L2 entry display and deletion in the web interface
2026-01-17 16:00:37 +00:00
René van Dorst 46864ca9a7 SWGT024_V2_0: Fix .phys_to_log_port, sfp-ports have to be swapped.
On SWGT024_V2_0, the SFP ports are arranged differently.
The port mapping should also reflect this.
2026-01-15 19:46:04 +01:00
René van Dorst 00b42db5da Merge pull request #78 from logicog/nic_demagic
MIB Counter fixes and Detailed Display
2026-01-15 18:45:38 +00:00
René van Dorst 030772f1ef Merge pull request #75 from vDorst/fix_serial_timer1
Fix: Serial Timer1: GATE bit should be off.
2026-01-13 19:10:22 +00:00
René van Dorst 4ce8adf954 Merge pull request #80 from logicog/fix_rldp_register
Fix typo in register address for RLDP Leds
2026-01-13 19:09:58 +00:00
René van Dorst f43bb4eac4 Fix: Serial Timer1: GATE bit should be off.
Fixes PR#66, commit c5c6b97 and 4e8eb6d.

The GATE-bit should not be used. Timer1 must always be activated to
generate the baudrate clock for serial 0.
2026-01-10 11:01:17 +01:00
René van Dorst c5c6b97ad1 installer: SERIAL: Use Timer1 instead of Timer2
Same as in the main code.

Use Timer1 as baudrate generator.
Timer1 can be programmed to have the same accuracy and deviation as
Timer2, up to 115200 at F_SYS = 125 Mhz. See comment
setup_serial_timer1() comment for valid baudrates and settings.
Timer1 is used in 8-bit auto-reload mode.

Only differance is that the serial is transmit only and poll-based so no
interrupts are used to transmit data.
2026-01-09 07:52:35 +01:00
René van Dorst 229fad3809 Merge pull request #73 from logicog/dio
Enable Flash Dual I/O command by default.
Speed up data transfers up to 2x.
2026-01-08 21:52:52 +00:00
René van Dorst 7d04ea1980 doc: mods: Add note about command BBh.
All the listed parts, support `BBh` command.
2026-01-08 21:45:58 +01:00
René van Dorst 34d6024eeb DOCS: Add modification page and flash replacement.
Document modifications like flash replacement.
2026-01-08 21:35:40 +01:00
René van Dorst d52aeca609 Merge pull request #74 from logicog/dbg
Convert unconditional prints to debug prints in httpd
2026-01-08 20:12:21 +00:00
René van Dorst 745c170f0a Flash: fix: Don't use READ 0x03 flash command.
In commit 884bc18, `Fast Read 0x0b` was exchanged for `Read 0x03` command.
This was done because I did not see the difference between the commands
and the extra dummycycles looks like wasted time. But I overlooked that
many flash devices, the `Read 0x03` command can't run at the maximum
SPI-clock speed, but only half or less of the maximum SPI-clock speed.
This can cause in-transit data corruption while reading the device.

So change it back to `Fast Read 0x0b` command, so the SPI device is used
within the device specification.
2026-01-06 19:45:33 +01:00
René van Dorst 5b4b0efb16 installer: remove unused sys_tick timer code. 2026-01-05 21:46:05 +01:00
René van Dorst b818a94202 SERIAL: Wrong use of TI-flag causes IRQ-storm.
TI-interrupt flag is used in the code, this is only
fine when SERIAL-interrupt is not enabled/used but
when is it used, it generates an interrupt which is
not handled, so it keeps generating interrupts and
trashing the performance and caused starvation on
lower priority interrupts like TIMER 2.

Use an extra flag to signal to the code that the
TX-buffer is empty.
2026-01-04 14:16:28 +01:00
René van Dorst bbd4656810 SERIAL: Use Timer1 instead of Timer2
Use Timer1 as baudrate generator.
Timer1 can be programmed to have the same accuracy and deviation as
Timer2, up to 115200 at F_SYS = 125 Mhz. See comment
setup_serial_timer1() comment for valid baudrates and settings.
Timer1 is used in 8-bit auto-reload mode.

Timer2 16-bit auto-reload can now be used for other tasks like SYS_TICK.
2026-01-04 14:15:30 +01:00
René van Dorst 8b061d5fb9 SYS_TICK: Use Timer2 instead of Timer0.
Downside of Timer0 is, we have to manually reload
the timer value. Timer2 can do that automaticly.
This saves a lot of time in the interrupt-handler
of the Timer.

Currently Timer2 is used for baudrate-generation
but in a separete commit this is moved to Timer1.
2026-01-04 14:14:52 +01:00
René van Dorst 5ed4d7afc7 Merge pull request #67 from logicog/docs
Update Readme
2025-12-29 21:05:05 +00:00
René van Dorst 9ff114d234 SYSTICK: Fix writing value to TMR0 registers.
A `%` modulo operator was used instead of a
`&` and-operator, to split a 16 bit value into two
8 bit values.
This causes that the SYSTICKs were 0.1% too fast.

Replace the manual split with a sfr16 type, so the
compiler does the split for us.
2025-12-26 10:07:13 +01:00
René van Dorst 0abe83e3e5 sfr: add 16 bit SFR for the timer0.
So we don't have to manual split 16-bit value into
for bytes.
Let the compiler do the work.
2025-12-26 10:07:11 +01:00
René van Dorst 2a7b8f9838 Merge pull request #59 from logicog/timer_fixes
Fix internal timer tick counter for housekeeping.
Because of the high F_CPU and low SYS_TICK.
Timer0 can easy overflow.
Now this is known and fixed.
2025-12-25 09:54:58 +00:00
René van Dorst a8227f1855 Merge pull request #54 from logicog/speeds
Add a Port Speed and MTU configuration Web-Page
2025-12-25 09:11:31 +00:00
René van Dorst 3ef7e45649 SWGT024_V2_0: Fix port mapping. Port 2 & 3 were swapped. 2025-12-23 14:30:27 +01:00
René van Dorst 053c16b84e SWTG024AS: Document Slave Interface 2025-12-22 14:32:23 +01:00
René van Dorst 4e9fb19e05 SWTG024AS: more small changes 2025-12-20 20:36:41 +01:00
René van Dorst 0a0e1856ae SWTG024AS: Link to photo 2025-12-20 14:50:25 +01:00
René van Dorst cedd81cf00 SWTG024AS: Fix and use unit KiB, add missing managed flag. 2025-12-20 14:44:38 +01:00
René van Dorst bf00f9aa2c Merge pull request #57 from ranma/baudrate-rounding
Add rounding to baud rate calculation
2025-12-20 11:55:42 +00:00
René van Dorst 0779222194 SWTG024AS: Add Sodola SL-SWTG124AS-D
Info from #55.
2025-12-19 21:07:11 +01:00
René van Dorst 44ce073869 SWTG024AS: Add port overview, rename SDS to SerDes 2025-12-19 21:03:47 +01:00
René van Dorst 12595f806a Merge pull request #50 from logicog/sfp_readings
Show SFP + DOM info while hovering over the port.
2025-12-17 06:50:41 +00:00
René van Dorst 9c4d49bc8c Merge pull request #49 from logicog/igmp
Add basic IGMP support.
2025-12-15 06:45:20 +00:00
René van Dorst 677e01fa18 Merge pull request #39 from logicog/sfp_work
Put all the device information in one struct `machine`.
So all the device information is defined in one place.
Also easier to add new devices.
Show device name also on website.
Fix SFP status information, some devices have a different SFP layout.
Reworks GPIO handling
Able to set manual port speed, duplex for the RJ45 ports.
2025-12-14 11:53:23 +00:00
René van Dorst 0197c9b6cf Fixed to make SWGT024 V2.0 work 2025-12-14 11:49:38 +01:00
René van Dorst 11d2c843e5 Fixed to make SWGT024 V2.0 work 2025-12-13 22:22:40 +01:00
René van Dorst fccafe8059 Merge pull request #43 from logicog/lags
feature LAGs support.
2025-12-07 09:12:21 +00:00
René van Dorst 1c78d32493 Merge pull request #36 from logicog/config
System settings and configuration management
2025-12-01 19:22:03 +00:00
René van Dorst f59be9cf2b Added software version + git short hash string to firmware.
The Makefile has the version number and generates a version.h which
has VERSION_SW define that looks like "v<VERSION>-g<GIT_SHORT_HASH>".

Software version shows at boot in the serial console.
And shown with command: `version`.

It can also be requested via `information.json`.
```
{
    "ip_address": "192.168.10.247",
    "ip_gateway": "192.168.10.1",
    "ip_netmask": "255.255.255.0",
    "mac_address": "1c:2a:a3:23:00:02",
    "sw_ver": "v0.1.0-gd48235f",
    "hw_ver": "SWGT024-V2.0"
}
```
2025-11-26 23:08:23 +01:00
René van Dorst d48235f652 Merge pull request #37 from logicog/sfp_demagic
De-Magic I2C configuration for SFP-EEPROM reads
2025-11-03 21:07:15 +00:00
René van Dorst aa406e1d98 html: firmware selection: limit extension only to .bin
This makes it quicker to select firmware image from the output directory.

You can still select at File type "All Files" if the extention is diffrent.
2025-10-30 21:30:37 +01:00
René van Dorst 1d6f0a2163 Merge pull request #33 from logicog/mirror
Mirror
2025-10-30 20:03:22 +00:00
René van Dorst 7d94f3d328 Improve JSON response.
Remove all the extra spaces from the json.
Also simplify the generation of the json.
Codespace is cheap so duplicated strings is not an issue.
But generating strings from different parts is more expensive in clock cycles.

Add a helper funcion `bool_to_html()` to generate bool value for html output.
2025-10-28 21:10:26 +01:00
René van Dorst d0b6a73bf2 Merge pull request #30 from logicog/crc16
CRC-16 Calculation and verification
2025-10-26 21:59:50 +00:00
René van Dorst 9929fcc169 Merge pull request #31 from logicog/eee_status
Eee status display
2025-10-22 09:12:02 +02:00
René van Dorst adc4bfc9a0 Merge pull request #29 from logicog/constseg
Fix bug in usage of CONST segment in banked code. Use #pragma constseg
2025-10-15 18:34:54 +00:00
René van Dorst 58c21a1986 Merge pull request #28 from logicog/eee
Support EEE via CLI
2025-10-11 18:34:39 +00:00
René van Dorst 17fdbf39f0 Add docs: 2M-PCB23-V3.1-managed 2025-10-11 00:11:38 +02:00
René van Dorst 0f48a773d9 Merge pull request #26 from logicog/navbar
Navbar
2025-10-10 18:02:04 +00:00
René van Dorst e5ee4594ef installer: fix left over typo SFR_FLASH_DUMMYCICLES 2025-10-09 20:03:08 +02:00
René van Dorst 928cf1cf58 http: upload: make sure we don't cross flash page boundaries.
This causes the address pointer to wrap back to the front of the page.
Which results in that the beginnen of the page can have data for the next page.
2025-10-07 21:19:36 +02:00
René van Dorst a59f92a648 Also use struct flash_region in flash_read_security(), flash_sector_erase(). 2025-10-05 16:53:46 +02:00
René van Dorst 52fa41760c Don't pass the first 16-bit argument via xdata.
Calling confention already uses the DPTR registers as the first two byte arguments.
So adds a lot of code to put the 16-bit value on xdata, still passes the 16-bit xdata ptr in DPTR registers, then read the xdata value.
So it doesn't save any sram bytes.
2025-10-05 16:22:23 +02:00
René van Dorst 1bec5cdf8a Add basic config.txt 2025-10-05 16:18:39 +02:00
René van Dorst 884bc18a61 Remove flash_read_bulk(), refactor website and execute_config().
flash_read_bulk() is kind of a printf function. But did not work as well.
flash_read_bulk() was used in the http generation so this needed to be changed as well.

For the website we decided that we are going to use CSR(Client Side Rendering).
So every HTML and JS files are now static.
Variables are fetched via json calls and output is render on the client side.
Also usefull for the future when we want a REST like API.

execute_config() was also using flash_read_bulk().
This have been replaced with flash_read_bulk() and parsing the flash_buf buffer.
2025-10-05 15:47:14 +02:00
René van Dorst 7a87b79871 Convert flash_addr to struct flash_region.
flash_region storage flash address and length, which a operation is needed.
2025-10-05 15:36:08 +02:00
René van Dorst 815e47d5cc doc: SWTG024AS: Fix component notation and fix SPIMEM signal typo. 2025-09-27 19:30:30 +02:00
René van Dorst de1c707f74 tools/fileadder: fix compiler warnings
fileadder.c: In function ‘main’:
fileadder.c:220:16: warning: unused variable ‘len’ [-Wunused-variable]
  220 |         size_t len = 0;
      |                ^~~
fileadder.c:219:16: warning: unused variable ‘line’ [-Wunused-variable]
  219 |         char * line = NULL;
      |                ^~~~
2025-09-27 17:00:54 +02:00
René van Dorst 373d723d47 build: tools: also declutter sourcecode 2025-09-27 16:52:50 +02:00
René van Dorst 2676dbd0d6 build: install: also declutter sourcecode 2025-09-27 12:52:35 +02:00
René van Dorst 432d9d77de build: uip: also declutter sourcecode 2025-09-27 12:52:31 +02:00
René van Dorst 0ac4792dde build: httpd: also declutter sourcecode 2025-09-27 12:52:24 +02:00
René van Dorst 60b854550d build: don't clutter the sources with build artifacts.
Tell sdcc to place it artifacts in "output/" folder.
2025-09-27 12:51:58 +02:00
René van Dorst 9f488415a8 Remove rtlplayground.mem 2025-09-27 12:21:19 +02:00
René van Dorst 2e52bcac8e Merge pull request #20 from logicog/installer
WIP: Add initial installer code
2025-09-26 17:39:46 +00:00
René van Dorst 9c41ada27f docs: SWTG024AS more IO found 2025-09-19 22:09:41 +02:00
René van Dorst 6e2b06fc27 docs: SWTG024AS: More led information found 2025-09-18 23:12:28 +02:00
René van Dorst 2eb1416ada httpd: fix print ip-address, added missing shift. 2025-09-11 07:47:33 +02:00
René van Dorst f148bdad20 port: fix REG_SET() compiler warning.
Compiler
rtl837x_port.c:466: warning 116: right shifting more than size of object changed to zero

provided value is a uint16. So shifting it more then 16 cause this error.
Solution: cast the value to uint32_t.
2025-09-11 07:36:01 +02:00
René van Dorst 8ff124af30 httpd: fix itoa_html() does not print the middle zero.
when the input is 100.
the first zero is not printed because t = 0 and skip printing.
So the output is "10" instead of "100".
2025-09-11 07:34:18 +02:00
René van Dorst 94ae1472c3 httpd: optimize sfr_data_to_html()
This also fixes a compiler warning.
page_impl.c: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
2025-09-11 07:34:16 +02:00
René van Dorst 24f588effd httpd: Also don't byte_to_html() and itoa_html() to save 1.5kbytes.
Also fixed compiler "warning page_impl.c:47: warning 126: unreachable code".
But I think it was a false-positive.
2025-09-11 07:32:25 +02:00
René van Dorst 18f1fb5f1a http: don't inline char_to_html(), save 1k of flash 2025-09-10 16:07:59 +02:00
René van Dorst e2afa9a61c Merge pull request #18 from vDorst/doc_SWTG024AS_v2.0_unmanaged_p2
fix: doc: SWTG024AS managed version can´t use RX-LOS.
2025-09-08 18:20:43 +00:00
René van Dorst 455d2e28d6 fix: isletter(), make everything lowercase. 2025-09-08 18:54:48 +02:00
René van Dorst b2f3d44f2b fix: doc: SWTG024AS managed version can´t use RX-LOS.
Added the serial header pinout.
Correction: Powerled is Systemled.
2025-09-08 18:45:20 +02:00
René van Dorst 7f9147918a docs: SWTG024AS: remove old spreadsheet, rotate images 180° so silkscreen text is correct. 2025-09-07 23:57:04 +02:00
René van Dorst 588dbf6f83 Update SWTG024AS.md 2025-09-07 21:44:15 +00:00