Ignore:
File:
1 edited

Legend:

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

    rbf9cb2f r8cd680c  
    8787}
    8888
     89/** Unmap a piece of physical memory to task.
     90 *
     91 * Caller of this function must have the CAP_MEM_MANAGER capability.
     92 *
     93 * @param virt Virtual address from the phys-mapped region.
     94 *
     95 * @return EOK on success.
     96 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability.
     97 *
     98 */
     99int physmem_unmap(void *virt)
     100{
     101        return __SYSCALL1(SYS_PHYSMEM_UNMAP, (sysarg_t) virt);
     102}
     103
    89104/** Lock a piece physical memory for DMA transfers.
    90105 *
     
    179194       
    180195        return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
     196}
     197
     198/** Disable I/O space range to task.
     199 *
     200 * Caller of this function must have the IO_MEM_MANAGER capability.
     201 *
     202 * @param id     Task ID.
     203 * @param ioaddr Starting address of the I/O range.
     204 * @param size   Size of the range.
     205 *
     206 * @return EOK on success
     207 * @return EPERM if the caller lacks the CAP_IO_MANAGER capability
     208 * @return ENOENT if there is no task with specified ID
     209 *
     210 */
     211static int iospace_disable(task_id_t id, void *ioaddr, size_t size)
     212{
     213        const ddi_ioarg_t arg = {
     214                .task_id = id,
     215                .ioaddr = ioaddr,
     216                .size = size
     217        };
     218       
     219        return __SYSCALL1(SYS_IOSPACE_DISABLE, (sysarg_t) &arg);
    181220}
    182221
     
    273312}
    274313
     314/** Disable PIO for specified I/O range.
     315 *
     316 * @param virt     I/O start address.
     317 * @param size     Size of the I/O region.
     318 *
     319 * @return EOK on success.
     320 * @return Negative error code on failure.
     321 *
     322 */
     323int pio_disable(void *virt, size_t size)
     324{
     325#ifdef IO_SPACE_BOUNDARY
     326        if (virt < IO_SPACE_BOUNDARY)
     327                return iospace_disable(task_get_id(), virt, size);
     328#else
     329        (void) iospace_disable;
     330#endif
     331        return physmem_unmap(virt);
     332}
     333
    275334void pio_write_8(ioport8_t *reg, uint8_t val)
    276335{
     
    312371}
    313372
    314 /** Register IRQ notification.
    315  *
    316  * @param inr    IRQ number.
    317  * @param devno  Device number of the device generating inr.
    318  * @param method Use this method for notifying me.
    319  * @param ucode  Top-half pseudocode handler.
    320  *
    321  * @return Value returned by the kernel.
    322  *
    323  */
    324 int irq_register(int inr, int devno, int method, const irq_code_t *ucode)
    325 {
    326         return __SYSCALL4(SYS_IRQ_REGISTER, inr, devno, method,
    327             (sysarg_t) ucode);
    328 }
    329 
    330 /** Unregister IRQ notification.
    331  *
    332  * @param inr   IRQ number.
    333  * @param devno Device number of the device generating inr.
    334  *
    335  * @return Value returned by the kernel.
    336  *
    337  */
    338 int irq_unregister(int inr, int devno)
    339 {
    340         return __SYSCALL2(SYS_IRQ_UNREGISTER, inr, devno);
    341 }
    342 
    343373/** @}
    344374 */
Note: See TracChangeset for help on using the changeset viewer.