[RTEMS Project] #4828: Macro defined but magic number used instead

RTEMS trac trac at rtems.org
Fri Jan 27 16:09:22 UTC 2023


#4828: Macro defined but magic number used instead
----------------------------+--------------------
  Reporter:  Daniel Páscoa  |      Owner:  (none)
      Type:  defect         |     Status:  new
  Priority:  normal         |  Milestone:
 Component:  admin          |    Version:
  Severity:  normal         |   Keywords:
Blocked By:                 |   Blocking:
----------------------------+--------------------
 **Description:**
 Each register has a dedicated SHIFT macro, however, it is not utilized in
 subsequent macro definitions where the shift operation is performed. To
 improve consistency and maintainability, consider incorporating the
 defined shift macro in the subsequent macro definitions instead of using
 hardcoded shift values.

 **Additional Notes:**
 These findings are related to the fact that a bunch of macros like
 AHBSTAT_AHBS_HMASTER_SHIFT are defined and then are not used right in the
 next few lines.

 #define AHBSTAT_AHBS_HMASTER_SHIFT 3
 #define AHBSTAT_AHBS_HMASTER_MASK 0x78U
 #define AHBSTAT_AHBS_HMASTER_GET( _reg ) \
   ( ( ( _reg ) >> 3 ) & 0xfU )
 #define AHBSTAT_AHBS_HMASTER( _val ) ( ( _val ) << 3 )

 As stated, in every one of these files, “This file is part of the RTEMS
 quality process and was automatically generated". There are YAML files
 where these registers are defined and the Waf build system generates the
 header files automatically with the current configuration.



 This ticket was raised as an outcome of the Independent SW Verification
 and Validation (ISVV) for ESA-promoted RTEMS SMP Qualification Data Packs
 (https://rtems-qual.io.esa.int). Original ISVV reference for this issue is
 RTEMS-SMP-CODE-VER-013.

 **File list:**
 bsps\include\grlib\ahbstat-regs.h
 bsps\include\grlib\ahbtrace-regs.h
 bsps\include\grlib\apbuart-regs.h
 bsps\include\grlib\dsu4-regs.h
 bsps\include\grlib\ftmctrl-regs.h
 bsps\include\grlib\gptimer-regs.h
 bsps\include\grlib\gr1553b-regs.h
 bsps\include\grlib\gr740thsens-regs.h
 bsps\include\grlib\grcan-regs.h
 bsps\include\grlib\grclkgate-regs.h
 bsps\include\grlib\grethgbit-regs.h
 bsps\include\grlib\grgpio-regs.h
 bsps\include\grlib\grgprbank-regs.h
 bsps\include\grlib\grgpreg-regs.h
 bsps\include\grlib\griommu-regs.h
 bsps\include\grlib\grpci2-regs.h
 bsps\include\grlib\grspw2-regs.h
 bsps\include\grlib\grspwrouter-regs.h
 bsps\include\grlib\irqamp-regs.h
 bsps\include\grlib\l4stat-regs.h
 bsps\include\grlib\memscrub-regs.h
 bsps\include\grlib\l2cache-regs.h
 bsps\include\grlib\mmctrl-regs.h
 bsps\include\grlib\spictrl-regs.h
 bsps\include\grlib\spwpnp-regs.h
 bsps\include\grlib\spwrmap-regs.h

--
Ticket URL: <http://devel.rtems.org/ticket/4828>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list