Commit Graph
620 Commits
Author SHA1 Message Date
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
logicog 803e2caaa8 Merge pull request #17 from logicog/stp
STP: initial work
2025-09-08 22:27:43 +02:00
logicog 95d7901d00 Add STP control commands
Adds
	stp on
	stp off
control commands.
2025-09-08 22:25:38 +02:00
logicog 9ad5fcb43e Add STP handling
Adds a timeer for calling the STP state machine which currently sends out
CNF (HELLO) packages.

Identifies incoming STP packets and calls the stp_in() routine to handle these.
2025-09-08 22:22:57 +02:00
logicog 571bfef810 Add reading of RSTP-CNF packets and send own CNF packets
This reads RSTP configuration packages and updates the
state information about the believed Root-bridge. New
RSTP packages are sent with the updated information.
2025-09-08 22:22:57 +02:00
logicog 44298f2b71 Add MSTP port state registers for STP
Each register holds the STP port state for one Forwarding ID (FID),
of which there 16 can be used by the RTL8372. The mapping between
FID and VLAN is done in the VLAN table. This allows the SoC
to maintain 16 different MSTP states.

In the register 2 bits per port are used to designate the following
(R)STP states
00 disable, 01 blocking, 10 learning, 11 forwarding
The STP listening state is not available.
2025-09-08 22:22:57 +02:00
logicog 844fe16dc3 Merge pull request #16 from vDorst/cmd_gpio
Refactor GPIO defines and add cmd `regget`, `regset`, `gpio`.
2025-09-08 22:19:30 +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
logicog 13bdcb0050 Merge pull request #15 from vDorst/doc_SWTG024AS_v2.0_unmanaged
Docs: Add SWTG024AS-v2.0-unmanaged version
2025-09-08 07:22:15 +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
René van Dorst 845a7f79bd fix link typo 2025-09-07 23:36:42 +02:00
René van Dorst f364f61c65 docs: Update SWTG024AS with the right gpio numbering.
See #16 with new gpio information, commands etc.

Added GPIO table and notes.
Also found some LEDs but need more investigation how to control them.
2025-09-07 23:32:58 +02:00
René van Dorst 7a2e568fcc Make a helper isnumber(), replace all same patterns. 2025-09-07 17:22:13 +02:00
René van Dorst bde8454449 isletter(): optimized version
Less instructions and jumps.
Saves 39 bytes.

```patch
1634,1651c1621,1628
<       mov     r7,a
<       mov     r6,a
< ;     cmd_parser.c:63: return (l >= 'a' && l <= 'z') || (l >= 'A' && l <= 'Z');
<       cjne    r7,#0x61,00326$
< 00326$:
<       mov     _parse_vlan_sloc0_1_0,c
<       jc      00153$
<       mov     a,r7
<       add     a,#0xff - 0x7a
<       mov     _parse_vlan_sloc0_1_0,c
<       jnc     00149$
< 00153$:
<       cjne    r6,#0x41,00329$
< 00329$:
<       mov     _parse_vlan_sloc0_1_0,c
<       jc      00132$
<       mov     a,r6
<       add     a,#0xff - 0x5a
---
> ;     cmd_parser.c:66: l |= 0x20;
> ;     cmd_parser.c:67: l -= 'A';
>       orl     a,#0x20
> ;     cmd_parser.c:68: return (l <= ('Z'-'A'));
>       add     a,#0xbf
>       add     a,#0xff - 0x19
>       cpl     c
> ;     cmd_parser.c:245: if (cmd_words_b[2] > 0 && isletter(cmd_buffer[cmd_words_b[2]])) {
1653,1654c1630
<       jc      00132$
< 00149$:
---
>       jnc     00132$
```
2025-09-07 17:04:46 +02:00
René van Dorst 54ab915557 cmd: reg{get,set}: more small refactor
Refactor some value checking.
Simplified hexvalue to addr.
Updated some comments.
Remove extra debug prints and EOL after the command.
2025-09-07 16:52:51 +02:00
René van Dorst 4cad857ad5 fix: cmd: regset: need add offset when we have less then 8 hex numbers 2025-09-07 16:33:01 +02:00
René van Dorst 1b578405c0 Remove unused and not related to GPIO define 2025-09-07 14:56:13 +02:00
René van Dorst 074c89cf27 cmd: convert reg to regget and regset.
We want to stick close to the origonal commands.
See: https://github.com/up-n-atom/SWTG118AS?tab=readme-ov-file#commands
2025-09-07 14:50:50 +02:00
René van Dorst 7e729c626c cmd: add reg read and write.
like:
* `reg w 04`
* `reg w 04 00023678`
2025-09-07 01:03:15 +02:00
René van Dorst e0864f811f cmd: move gpio status to a function print_gpio_status() 2025-09-06 17:05:16 +02:00
René van Dorst 74b8280d80 gpio: SOC only has 64 gpio not 96.
Remove BANK_A
Rename BANK_B to GPIO_00_31
Rename BACK_C to GPIO_32_63

Added also _INPUT, _DIRECTIOn registers
2025-09-06 17:04:25 +02:00
René van Dorst f812970ca0 docs: SWTG024AS_v2.0 document power rails. 2025-09-06 12:41:13 +02:00
René van Dorst e6d90f7a8a docs: SWTG024AS reword/reformat was parts 2025-09-06 12:13:53 +02:00
René van Dorst 0d63b08f89 Docs: Add SWTG024AS-v2.0-unmanaged version
Pinout Spreedsheet, photos and wiki about my findings.

GPIO number may be has endian problem.
2025-09-06 10:23:09 +02:00
René van Dorst 8e9cababfb gpio: show also bit changes vs last gpio cmd 2025-09-05 00:10:18 +02:00
René van Dorst f481d1fbe4 add cmd gpio 2025-09-04 23:49:17 +02:00
logicog 8b91646b83 Merge pull request #14 from logicog/smaller_image
Fix issues with smaller image size
2025-09-04 22:59:05 +02:00
logicog b85d57b32b Demagic memory locations 2025-09-04 22:23:02 +02:00
logicog 2669262240 Demagic memory locations 2025-09-04 21:04:57 +02:00
logicog 395f05c27d Remove unnecessary variable 2025-09-04 21:04:42 +02:00
logicog e72585865c Merge pull request #11 from logicog/smaller_image
Smaller image
2025-09-04 20:57:59 +02:00
logicog 5635ad835e Add support for ip, gw and netmask commands 2025-09-03 20:32:57 +02:00
logicog e5146e0857 Use 512kB image size for now 2025-09-03 20:32:30 +02:00
logicog 8765a9ba17 Fix int arguments for file-size and location of added data 2025-09-03 20:32:04 +02:00
logicog fa62eecb97 Merge pull request #9 from vDorst/feat_phy_modify
add phy_modify()
2025-09-03 06:33:03 +02:00
René van Dorst 71eba81421 Add rtlplaygroud.mem also exclude the file in .gitignore.
See PR #10 about mem usage
2025-09-02 22:25:07 +02:00
René van Dorst 001c52ef39 Use phy_modify().
This saves 210 bytes.
2025-09-02 22:23:02 +02:00
René van Dorst c5995a4184 Add: phy_modify() to modify phy_registers.
Makes it easier to modify set/clear bit in a phy register.
Simulair like Linux PHY-core: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/phy/phy-core.c#n551
2025-09-02 22:23:02 +02:00
René van Dorst 5316ae9495 Merge pull request #8 from vDorst/feat_gitignore
Add .gitignore
2025-09-02 20:21:11 +00:00
René van Dorst 7bc3d2cf49 Add .gitignore 2025-09-02 10:32:40 +02:00
logicog 3392b588b2 Merge pull request #6 from vDorst/sfr16
Combine two sfr-pairs into a single sfr16 define, so make it less error prone to use and optimize better.
2025-09-01 18:10:06 +02:00
René van Dorst bcf4ae316c fix SFR_DATA_U16: must use sfr a6a7 not sfr a4a5! 2025-09-01 16:47:57 +02:00