Changeset 0ab362c in mainline for uspace/lib/c/generic/ddi.c


Ignore:
Timestamp:
2012-11-22T14:36:04Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e32720ff
Parents:
1f7753a (diff), 0f2c80a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge support for BeagleBoard-xM (armv7).

Most of the changes outside arm arch are pio_* stuff (addition of pio_trace capability, header consolidation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ddi.c

    r1f7753a r0ab362c  
    3434
    3535#include <assert.h>
     36#include <atomic.h>
    3637#include <unistd.h>
     38#include <stdio.h>
    3739#include <errno.h>
    3840#include <sys/types.h>
     
    4749#include "private/libc.h"
    4850
     51
    4952/** Return unique device number.
    5053 *
     
    120123 *
    121124 */
    122 int iospace_enable(task_id_t id, void *ioaddr, unsigned long size)
    123 {
    124         ddi_ioarg_t arg;
    125        
    126         arg.task_id = id;
    127         arg.ioaddr = ioaddr;
    128         arg.size = size;
     125static int iospace_enable(task_id_t id, void *ioaddr, size_t size)
     126{
     127        const ddi_ioarg_t arg = {
     128                .task_id = id,
     129                .ioaddr = ioaddr,
     130                .size = size
     131        };
    129132       
    130133        return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
     
    136139 * @param size     Size of the I/O region.
    137140 * @param virt     Virtual address for application's
    138  *                 PIO operations.
     141 *                 PIO operations. Can be NULL for PMIO.
    139142 *
    140143 * @return EOK on success.
     
    146149#ifdef IO_SPACE_BOUNDARY
    147150        if (pio_addr < IO_SPACE_BOUNDARY) {
    148                 *virt = pio_addr;
     151                if (virt)
     152                        *virt = pio_addr;
    149153                return iospace_enable(task_get_id(), pio_addr, size);
    150154        }
     155#else
     156        (void) iospace_enable;
    151157#endif
    152        
     158        if (!virt)
     159                return EINVAL;
     160
    153161        void *phys_frame =
    154162            (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE);
     
    166174}
    167175
     176void pio_write_8(ioport8_t *reg, uint8_t val)
     177{
     178        pio_trace_log(reg, val, true);
     179        arch_pio_write_8(reg, val);
     180}
     181
     182void pio_write_16(ioport16_t *reg, uint16_t val)
     183{
     184        pio_trace_log(reg, val, true);
     185        arch_pio_write_16(reg, val);
     186}
     187
     188void pio_write_32(ioport32_t *reg, uint32_t val)
     189{
     190        pio_trace_log(reg, val, true);
     191        arch_pio_write_32(reg, val);
     192}
     193
     194uint8_t pio_read_8(const ioport8_t *reg)
     195{
     196        const uint8_t val = arch_pio_read_8(reg);
     197        pio_trace_log(reg, val, false);
     198        return val;
     199}
     200
     201uint16_t pio_read_16(const ioport16_t *reg)
     202{
     203        const uint16_t val = arch_pio_read_16(reg);
     204        pio_trace_log(reg, val, false);
     205        return val;
     206}
     207
     208uint32_t pio_read_32(const ioport32_t *reg)
     209{
     210        const uint32_t val = arch_pio_read_32(reg);
     211        pio_trace_log(reg, val, false);
     212        return val;
     213}
     214
    168215/** Register IRQ notification.
    169216 *
Note: See TracChangeset for help on using the changeset viewer.