[Oberon] FPGA - nRF24L01 `RPI Net' server
Jörg
joerg.straube at iaeth.ch
Tue May 22 13:25:09 CEST 2018
Hi
Yes, SYSTEM.PUT initializes 4 bytes with one instruction.
memset can be seen as a functional replacement of SYSTEM.PUT().
Although it's not directly comparable, as memset() is a procedure,
SYSTEM.PUT is basically one instruction.
The "memset" procedure is optimized to efficiently initialize LARGER blocks
of memory.
In this case (as Header is "only" 8 bytes) "memset" is quite an overkill:
See yourself the implementation of memset:
https://svnweb.freebsd.org/base/stable/10/lib/libc/string/memset.c?revision=
256281&view=markup
I'm not the C guru, but my try to translate SYSTEM.PUT(SYSTEM.ADR(rx), 0);
is (&rx)* = 0;
br
Jörg
-----Original Message-----
From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of Tomas
Kral
Sent: Tuesday, May 22, 2018 8:29 AM
To: oberon at lists.inf.ethz.ch
Subject: Re: [Oberon] FPGA - nRF24L01 `RPI Net' server
> SYSTEM.PUT(SYSTEM.ADR(rx), 0);
Sets four consecutive bytes to 0, i.e.
rx.hd.valid := 0; rx.hd.dadr := 0; rx.hd.sadr := 0; rx.hd.typ := 0;
???
On RPI I try for an equivalent by:
memset(&rx, 0, HDR_SIZE); rcvdc = 0;
--
Tomas Kral <thomas.kral at email.cz>
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon
More information about the Oberon
mailing list