Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc/gnrc_netif_hdr_print: printout timestamp if enabled #19589

Merged
merged 1 commit into from
May 15, 2023

Conversation

chudov
Copy link
Contributor

@chudov chudov commented May 12, 2023

Contribution description

The gnrc_netif_hdr depending on presence of the gnrc_netif_timestamp module may contain the packet reception timestamp. This PR adds printing of the timestamp in the gnrc_netif_hdr_print.

Testing procedure

The tests\gnrc_netif is used for testing.

  1. The gnrc_netif_timestamp module is not used.
    The PKTDUMP printout shall not have timestamp information
    ~~ SNIP 1 - size: 24 byte, type: NETTYPE_NETIF (-1)<\n>
    if_pid: 7 rssi: -32714 lqi: 1<\n>
    flags: 0x0<\n>

  2. The gnrc_netif_timestamp module is used.
    The PKTDUMP printout shall have timestamp information
    ~~ SNIP 1 - size: 32 byte, type: NETTYPE_NETIF (-1)<\n>
    if_pid: 7 rssi: 12 timestamp: 2147483648 lqi: 6<\n>
    flags: 0x0<\n>

The test was performed on derfmega256 and nrf52840dongle boards.

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework labels May 12, 2023
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 12, 2023
@@ -24,6 +24,10 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr)

printf("if_pid: %u ", (unsigned) hdr->if_pid);
printf("rssi: %d ", (signed) hdr->rssi);
#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP)
/* Only last 32 bits are printed due to printf from avg-libc doesn't support 64-bit values */
printf(" timestamp: %" PRIu32" ", (uint32_t) hdr->timestamp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

Suggested change
printf(" timestamp: %" PRIu32" ", (uint32_t) hdr->timestamp);
if (hdr->flags & GNRC_NETIF_HDR_FLAGS_TIMESTAMP) {
printf(" timestamp: %" PRIu32".%09" PRIu32" ", hdr->timestamp / NS_PER_SEC, hdr->timestamp % NS_PER_SEC);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way of printing the value make sense, thank you.
Regarding the flag - I would prefer to print the value independend from the flag. As this print is in any case for testing purposes, it make sense to check how the value changes even if the flag is not set.

@chudov chudov force-pushed the gnrc/gnrc_netif_hdr_print_timestamp branch 2 times, most recently from 3f12c2f to 569f528 Compare May 15, 2023 09:34
@chudov chudov force-pushed the gnrc/gnrc_netif_hdr_print_timestamp branch from 569f528 to b260744 Compare May 15, 2023 09:40
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 15, 2023
@riot-ci
Copy link

riot-ci commented May 15, 2023

Murdock results

✔️ PASSED

516df5c gnrc/gnrc_netif_hdr_print: printout timestamp if enabled

Success Failures Total Runtime
6931 0 6931 09m:13s

Artifacts

@chudov chudov force-pushed the gnrc/gnrc_netif_hdr_print_timestamp branch from b260744 to 61a1bbe Compare May 15, 2023 09:57
Signed-off-by: chudov <chudov@gmail.com>
@chudov chudov force-pushed the gnrc/gnrc_netif_hdr_print_timestamp branch from 61a1bbe to 516df5c Compare May 15, 2023 10:53
@benpicco
Copy link
Contributor

bors merge

bors bot added a commit that referenced this pull request May 15, 2023
18056: pkg/cmsis: use unique package for CMSIS headers, DSP and NN modules r=benpicco a=aabadie



19571: cpu/stm32/periph_adc: fixes and improvements for L4 support r=benpicco a=gschorcht

### Contribution description

This PR provides the following fixes and improvements for the `periph_adc` implementation for STM32L4.
- Support STM32L496AG added.
- Instead of defining the number of ADC devices for each MCU model, the number of ADC devices is determined from ADCx definitions in CMSIS header.
- MCU specific register/value defines are valid for all L4 MCUs, model based conditional compilation is removed.
- The ADC clock disable function is fixed using a counter. The counter is incremented in `prep` and decremented in `done`. The ADC clock is disabled if the counter becomes 0.
- For boards that have not connected the V_REF+ pin to an external reference voltage, the VREFBUF peripheral can be used as V_REF+ (if supported) by setting `VREFBUF_ENABLE=1`.
- The ASCR register is available and has to be set for all STM32L471xx, STM32L475xx, STM32L476xx, STM32L485xx and STM32L486xx MCUs. Instead of using the CPU model for conditional compilation, the CPU line is used to support all MCU of that lines.
- Setting of SQR1 is fixed. Setting the SQR1 did only work before because the `ADC_SRQ_L` is set to 0 for a sequence length of 1.
- Setting the `ADC_CCR_CKMODE` did only work for the reset state. It is now cleared before it is set. Instead of using the `ADC_CCR_CKMODE_x` bits to set the mode, the mode defines are used.
 - Support for V_REFINT as ADC channel added.

### Testing procedure



19589: gnrc/gnrc_netif_hdr_print: printout timestamp if enabled r=benpicco a=chudov



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: chudov <chudov@gmail.com>
@bors
Copy link
Contributor

bors bot commented May 15, 2023

Build failed (retrying...):

bors bot added a commit that referenced this pull request May 15, 2023
19589: gnrc/gnrc_netif_hdr_print: printout timestamp if enabled r=benpicco a=chudov



Co-authored-by: chudov <chudov@gmail.com>
@aabadie
Copy link
Contributor

aabadie commented May 15, 2023

bors cancel
bors merge

@bors
Copy link
Contributor

bors bot commented May 15, 2023

Canceled.

@bors
Copy link
Contributor

bors bot commented May 15, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 2b97b76 into RIOT-OS:master May 15, 2023
@chudov chudov deleted the gnrc/gnrc_netif_hdr_print_timestamp branch May 16, 2023 10:41
@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants