Changes in uspace/lib/c/generic/ddi.c [b5c2f56:fbcdeb8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ddi.c
rb5c2f56 rfbcdeb8 34 34 35 35 #include <assert.h> 36 #include <atomic.h>37 36 #include <unistd.h> 38 #include <stdio.h>39 37 #include <errno.h> 40 38 #include <sys/types.h> … … 48 46 #include <libarch/config.h> 49 47 #include "private/libc.h" 50 51 48 52 49 /** Return unique device number. … … 123 120 * 124 121 */ 125 static int iospace_enable(task_id_t id, void *ioaddr, size_tsize)122 int iospace_enable(task_id_t id, void *ioaddr, unsigned long size) 126 123 { 127 const ddi_ioarg_t arg = {128 .task_id = id,129 .ioaddr = ioaddr,130 .size = size131 };124 ddi_ioarg_t arg; 125 126 arg.task_id = id; 127 arg.ioaddr = ioaddr; 128 arg.size = size; 132 129 133 130 return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg); … … 139 136 * @param size Size of the I/O region. 140 137 * @param virt Virtual address for application's 141 * PIO operations. Can be NULL for PMIO.138 * PIO operations. 142 139 * 143 140 * @return EOK on success. … … 149 146 #ifdef IO_SPACE_BOUNDARY 150 147 if (pio_addr < IO_SPACE_BOUNDARY) { 151 if (virt) 152 *virt = pio_addr; 148 *virt = pio_addr; 153 149 return iospace_enable(task_get_id(), pio_addr, size); 154 150 } 155 #else156 (void) iospace_enable;157 151 #endif 158 if (!virt) 159 return EINVAL; 160 152 161 153 void *phys_frame = 162 154 (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE); … … 172 164 *virt = virt_page + offset; 173 165 return EOK; 174 }175 176 void 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 182 void 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 188 void 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 194 uint8_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 201 uint16_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 208 uint32_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 166 } 214 167
Note:
See TracChangeset
for help on using the changeset viewer.