Changeset 3cee687 in libbsdport


Ignore:
Timestamp:
Jun 30, 2010, 2:44:46 PM (9 years ago)
Author:
Till Straumann <strauman@…>
Branches:
master
Children:
e5d5352
Parents:
b284b10
Message:

2010-06-30 Till Straumann <Till.Straumann@…>

  • libbsdport/bus.h: PPC's inlines from libcpu/io.h still have un-intuitive argument types (e.g., unsigned instead of uint32_t). Added additional 'iotype' arg to BUS_SPACE_DECL macro (ppc only) so that we can cast to the correct type as expected by libcpu/io.h. Hopefully that doesn't bring us into C99 alias hell.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsd_eth_drivers/libbsdport/bus.h

    rb284b10 r3cee687  
    8787
    8888
    89 #define BUS_SPACE_DECL(type, width, nwidth, op) \
     89#define BUS_SPACE_DECL(type, iotype, width, nwidth, op) \
    9090static inline type \
    9191bus_space_read_##nwidth(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) \
     
    9494        if ( !BUS_SPACE_ALWAYS_MEM && bus_space_io == t ) { \
    9595                /* this is a macro setting the second argument */ \
    96                 v = in_##op((volatile type *)(_IO_BASE+h+o)); \
     96                v = in_##op((volatile iotype *)(_IO_BASE+h+o)); \
    9797        } else { \
    98                 v = in_##op((volatile type *)(h+o)); \
     98                v = in_##op((volatile iotype *)(h+o)); \
    9999        } \
    100100        return v; \
     
    105105{ \
    106106        if ( !BUS_SPACE_ALWAYS_MEM && bus_space_io == t ) { \
    107                 out_##op((volatile type *)(_IO_BASE+h+o), v); \
     107                out_##op((volatile iotype *)(_IO_BASE+h+o), v); \
    108108        } else { \
    109                 out_##op((volatile type *)(h+o), v); \
     109                out_##op((volatile iotype *)(h+o), v); \
    110110        }\
    111111}
    112112
    113 BUS_SPACE_DECL(u_int32_t, long, 4, le32)
    114 BUS_SPACE_DECL(u_int16_t, word, 2, le16)
    115 BUS_SPACE_DECL(u_int8_t,  byte, 1, 8)
     113BUS_SPACE_DECL(u_int32_t, unsigned,       long, 4, le32)
     114BUS_SPACE_DECL(u_int16_t, unsigned short, word, 2, le16)
     115BUS_SPACE_DECL(u_int8_t,  unsigned char,  byte, 1, 8)
    116116
    117117#undef BUS_SPACE_ALWAYS_MEM
Note: See TracChangeset for help on using the changeset viewer.