Changeset 85be731 in mainline


Ignore:
Timestamp:
2018-05-23T21:04:16Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9af56b6
Parents:
e3887ce
Message:

Add PIO register accessors for both endianities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ddi.h

    re3887ce r85be731  
    4040#include <stdint.h>
    4141#include <sys/time.h>
     42#include <byteorder.h>
    4243#include <abi/ddi/irq.h>
    4344#include <device/hw_res.h>
     
    8687extern uint64_t pio_read_64(const ioport64_t *);
    8788
     89static inline void pio_write_le16(ioport16_t *reg, uint16_t val)
     90{
     91        pio_write_16(reg, host2uint16_t_le(val));
     92}
     93static inline void pio_write_be16(ioport16_t *reg, uint16_t val)
     94{
     95        pio_write_16(reg, host2uint16_t_be(val));
     96}
     97static inline void pio_write_le32(ioport32_t *reg, uint32_t val)
     98{
     99        pio_write_32(reg, host2uint32_t_le(val));
     100}
     101static inline void pio_write_be32(ioport32_t *reg, uint32_t val)
     102{
     103        pio_write_32(reg, host2uint32_t_be(val));
     104}
     105static inline void pio_write_le64(ioport64_t *reg, uint64_t val)
     106{
     107        pio_write_64(reg, host2uint64_t_le(val));
     108}
     109static inline void pio_write_be64(ioport64_t *reg, uint64_t val)
     110{
     111        pio_write_64(reg, host2uint64_t_be(val));
     112}
     113
     114static inline uint16_t pio_read_le16(const ioport16_t *reg)
     115{
     116        return uint16_t_le2host(pio_read_16(reg));
     117}
     118static inline uint16_t pio_read_be16(const ioport16_t *reg)
     119{
     120        return uint16_t_be2host(pio_read_16(reg));
     121}
     122static inline uint32_t pio_read_le32(const ioport32_t *reg)
     123{
     124        return uint32_t_le2host(pio_read_32(reg));
     125}
     126static inline uint32_t pio_read_be32(const ioport32_t *reg)
     127{
     128        return uint32_t_be2host(pio_read_32(reg));
     129}
     130static inline uint64_t pio_read_le64(const ioport64_t *reg)
     131{
     132        return uint64_t_le2host(pio_read_64(reg));
     133}
     134static inline uint64_t pio_read_be64(const ioport64_t *reg)
     135{
     136        return uint64_t_be2host(pio_read_64(reg));
     137}
     138
    88139static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask,
    89140    useconds_t delay)
Note: See TracChangeset for help on using the changeset viewer.