Changeset b04b76c6 in rtems


Ignore:
Timestamp:
06/07/16 19:36:48 (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
bf021daf
Parents:
18e29faf
git-author:
Sebastian Huber <sebastian.huber@…> (06/07/16 19:36:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/08/16 13:48:03)
Message:

score: Simplify priority bit map implementation

The priority bit map can deal with a maximum of 256 priority values
ranging from 0 to 255. Consistently use an unsigned int for
computation, due to the usual integer promotion rules.

Make Priority_bit_map_Word definition architecture-independent and
define it to uint16_t. This was already the case for all architectures
except PowerPC. Adjust the PowerPC bitmap support accordingly.

Location:
cpukit/score
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/arm/rtems/score/types.h

    r18e29faf rb04b76c6  
    4141typedef uintptr_t CPU_Uint32ptr;
    4242
    43 typedef uint16_t         Priority_bit_map_Word;
    44 
    4543/** @} */
    4644
  • cpukit/score/cpu/bfin/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 /** This defines the type for a priority bit map entry. */
    38 typedef uint16_t Priority_bit_map_Word;
    39 
    4037/** This defines the return type for an ISR entry point. */
    4138typedef void blackfin_isr;
  • cpukit/score/cpu/epiphany/rtems/score/cpu.h

    r18e29faf rb04b76c6  
    700700
    701701#ifndef ASM
    702 typedef uint16_t Priority_bit_map_Word;
    703702
    704703typedef struct {
  • cpukit/score/cpu/epiphany/rtems/score/types.h

    r18e29faf rb04b76c6  
    5454typedef uintptr_t CPU_Uint32ptr;
    5555
    56 typedef uint16_t Priority_bit_map_Word;
    5756typedef void epiphany_isr;
    5857typedef void ( *epiphany_isr_entry )( void );
  • cpukit/score/cpu/i386/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 typedef uint16_t Priority_bit_map_Word;
    3837typedef void i386_isr;
    3938typedef i386_isr ( *i386_isr_entry )( void );
  • cpukit/score/cpu/lm32/rtems/score/types.h

    r18e29faf rb04b76c6  
    3838typedef uintptr_t CPU_Uint32ptr;
    3939
    40 /** This defines the type for a priority bit map entry. */
    41 typedef uint16_t Priority_bit_map_Word;
    42 
    4340#ifdef __cplusplus
    4441}
  • cpukit/score/cpu/m32c/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef unsigned long CPU_Uint32ptr;
    3636
    37 /** This defines the type for a priority bit map entry. */
    38 typedef uint16_t Priority_bit_map_Word;
    39 
    4037/** This defines the return type for an ISR entry point. */
    4138typedef void m32c_isr;
  • cpukit/score/cpu/m68k/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 typedef uint16_t     Priority_bit_map_Word;
    38 
    3937#ifdef __cplusplus
    4038}
  • cpukit/score/cpu/mips/rtems/score/types.h

    r18e29faf rb04b76c6  
    4444typedef uintptr_t CPU_Uint32ptr;
    4545
    46 typedef uint16_t     Priority_bit_map_Word;
    4746typedef void mips_isr;
    4847typedef void ( *mips_isr_entry )( void );
  • cpukit/score/cpu/moxie/rtems/score/types.h

    r18e29faf rb04b76c6  
    3939typedef uintptr_t CPU_Uint32ptr;
    4040
    41 typedef uint16_t     Priority_bit_map_Word;
    4241typedef void moxie_isr;
    4342typedef void ( *moxie_isr_entry )( void );
  • cpukit/score/cpu/nios2/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 typedef uint16_t Priority_bit_map_Word;
    3837typedef void nios2_isr;
    3938typedef void ( *nios2_isr_entry )( void );
  • cpukit/score/cpu/no_cpu/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 /** This defines the type for a priority bit map entry. */
    38 typedef uint16_t Priority_bit_map_Word;
    39 
    4037#ifdef __cplusplus
    4138}
  • cpukit/score/cpu/or1k/rtems/score/cpu.h

    r18e29faf rb04b76c6  
    688688#ifndef ASM
    689689typedef uint32_t CPU_Counter_ticks;
    690 typedef uint16_t Priority_bit_map_Word;
    691690
    692691typedef struct {
  • cpukit/score/cpu/or1k/rtems/score/types.h

    r18e29faf rb04b76c6  
    4040typedef uintptr_t CPU_Uint32ptr;
    4141
    42 typedef uint16_t Priority_bit_map_Word;
    4342typedef void or1k_isr;
    4443typedef void ( *or1k_isr_entry )( void );
  • cpukit/score/cpu/powerpc/rtems/score/cpu.h

    r18e29faf rb04b76c6  
    982982    __asm__ volatile ("cntlzw %0, %1" : "=r" ((_output)), "=r" ((_value)) : \
    983983                  "1" ((_value))); \
     984    (_output) = (_output) - 16; \
    984985  }
    985986
     
    993994
    994995#define _CPU_Priority_Mask( _bit_number ) \
    995   ( 0x80000000 >> (_bit_number) )
     996  ( 0x8000u >> (_bit_number) )
    996997
    997998/*
  • cpukit/score/cpu/powerpc/rtems/score/types.h

    r18e29faf rb04b76c6  
    5252typedef uintptr_t CPU_Uint32ptr;
    5353
    54 typedef uint32_t     Priority_bit_map_Word;
    5554typedef void ppc_isr;
    5655
  • cpukit/score/cpu/sh/rtems/score/types.h

    r18e29faf rb04b76c6  
    4545typedef uintptr_t CPU_Uint32ptr;
    4646
    47 typedef uint16_t     Priority_bit_map_Word;
    48 
    4947typedef void sh_isr;
    5048typedef void ( *sh_isr_entry )( void );
  • cpukit/score/cpu/sparc/rtems/score/types.h

    r18e29faf rb04b76c6  
    3232
    3333/**
    34  * @brief Priority bit map type.
    35  *
    36  * On the SPARC, there is no bitscan instruction and no penalty associated
    37  * for using 16-bit variables.  With no overriding architectural factors,
    38  * just using a uint16_t.
    39  */
    40 typedef uint16_t Priority_bit_map_Word;
    41 
    42 /**
    4334 * @brief SPARC ISR handler return type.
    4435 *
  • cpukit/score/cpu/sparc64/rtems/score/types.h

    r18e29faf rb04b76c6  
    3434typedef uintptr_t CPU_Uint32ptr;
    3535
    36 typedef uint16_t         Priority_bit_map_Word;
    3736typedef void sparc_isr;
    3837typedef void ( *sparc_isr_entry )( void );
  • cpukit/score/cpu/v850/rtems/score/types.h

    r18e29faf rb04b76c6  
    3535typedef uintptr_t CPU_Uint32ptr;
    3636
    37 /** This defines the type for a priority bit map entry. */
    38 typedef uint16_t Priority_bit_map_Word;
    39 
    4037#ifdef __cplusplus
    4138}
  • cpukit/score/include/rtems/score/prioritybitmap.h

    r18e29faf rb04b76c6  
    3333/**@{*/
    3434
    35 /*
    36  *  The definition of the Priority_bit_map_Word type is CPU dependent.
    37  *
    38  */
     35typedef uint16_t Priority_bit_map_Word;
    3936
    4037typedef struct {
  • cpukit/score/include/rtems/score/prioritybitmapimpl.h

    r18e29faf rb04b76c6  
    2121
    2222#include <rtems/score/prioritybitmap.h>
    23 #include <rtems/score/priority.h>
    2423
    2524#include <string.h>
     
    6665#define _Bitfield_Find_first_bit( _value, _bit_number ) \
    6766  { \
    68     register uint32_t   __value = (uint32_t) (_value); \
    69     register const unsigned char *__p = _Bitfield_Leading_zeros; \
     67    unsigned int __value = (_value); \
     68    const unsigned char *__p = _Bitfield_Leading_zeros; \
    7069    \
    7170    if ( __value < 0x100 ) \
     
    109108 */
    110109
    111 RTEMS_INLINE_ROUTINE Priority_bit_map_Word   _Priority_Major (
    112   Priority_Control the_priority
    113 )
    114 {
    115   return (Priority_bit_map_Word)( the_priority / 16 );
     110RTEMS_INLINE_ROUTINE unsigned int _Priority_Major( unsigned int the_priority )
     111{
     112  return the_priority / 16;
    116113}
    117114
     
    120117 */
    121118
    122 RTEMS_INLINE_ROUTINE Priority_bit_map_Word   _Priority_Minor (
    123   Priority_Control the_priority
    124 )
    125 {
    126   return (Priority_bit_map_Word)( the_priority % 16 );
     119RTEMS_INLINE_ROUTINE unsigned int _Priority_Minor( unsigned int the_priority )
     120{
     121  return the_priority % 16;
    127122}
    128123
     
    135130
    136131RTEMS_INLINE_ROUTINE Priority_bit_map_Word   _Priority_Mask (
    137   uint32_t  bit_number
     132  unsigned int bit_number
    138133)
    139134{
    140135  return (Priority_bit_map_Word)(0x8000u >> bit_number);
    141 }
    142 
    143 /**
    144  * This function returns the mask bit inverted.
    145  */
    146 
    147 RTEMS_INLINE_ROUTINE Priority_bit_map_Word   _Priority_Mask_invert (
    148   uint32_t   mask
    149 )
    150 {
    151   return (Priority_bit_map_Word)(~mask);
    152136}
    153137
     
    158142 */
    159143
    160 RTEMS_INLINE_ROUTINE uint32_t   _Priority_Bits_index (
    161   uint32_t  bit_number
     144RTEMS_INLINE_ROUTINE unsigned int _Priority_Bits_index(
     145  unsigned int bit_number
    162146)
    163147{
     
    197181}
    198182
    199 RTEMS_INLINE_ROUTINE Priority_Control _Priority_bit_map_Get_highest(
     183RTEMS_INLINE_ROUTINE unsigned int _Priority_bit_map_Get_highest(
    200184  const Priority_bit_map_Control *bit_map
    201185)
    202186{
    203   Priority_bit_map_Word minor;
    204   Priority_bit_map_Word major;
     187  unsigned int minor;
     188  unsigned int major;
    205189
    206190  /* Avoid problems with some inline ASM statements */
    207   Priority_bit_map_Word tmp;
     191  unsigned int tmp;
    208192
    209193  tmp = bit_map->major_bit_map;
     
    227211  Priority_bit_map_Control     *bit_map,
    228212  Priority_bit_map_Information *bit_map_info,
    229   Priority_Control              new_priority
    230 )
    231 {
    232   Priority_bit_map_Word major;
    233   Priority_bit_map_Word minor;
     213  unsigned int                  new_priority
     214)
     215{
     216  unsigned int major;
     217  unsigned int minor;
    234218  Priority_bit_map_Word mask;
    235219
     
    241225  mask = _Priority_Mask( major );
    242226  bit_map_info->ready_major = mask;
    243   /* Add _Priority_Mask_invert to non-generic bitfield then change this code. */
    244   bit_map_info->block_major = (Priority_bit_map_Word)(~((uint32_t)mask));
     227  bit_map_info->block_major = (Priority_bit_map_Word) ~mask;
    245228
    246229  mask = _Priority_Mask( minor );
    247230  bit_map_info->ready_minor = mask;
    248   /* Add _Priority_Mask_invert to non-generic bitfield then change this code. */
    249   bit_map_info->block_minor = (Priority_bit_map_Word)(~((uint32_t)mask));
     231  bit_map_info->block_minor = (Priority_bit_map_Word) ~mask;
    250232}
    251233
Note: See TracChangeset for help on using the changeset viewer.