Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 953bc1ef in mainline


Ignore:
Timestamp:
2010-04-29T08:34:29Z (11 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master
Children:
cfe7716
Parents:
5af21c5
Message:

introduced an 'interrupt_enable' syscall as a temporary solution for enabling/disabling interrupts

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ddi/ddi.h

    r5af21c5 r953bc1ef  
    5656extern unative_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg);
    5757extern unative_t sys_preempt_control(int enable);
     58extern unative_t sys_interrupt_enable(int irq, int enable);
    5859
    5960/*
     
    6263extern int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size);
    6364
     65
    6466#endif
    6567
  • kernel/generic/include/syscall/syscall.h

    r5af21c5 r953bc1ef  
    8181        SYS_IOSPACE_ENABLE,
    8282        SYS_PREEMPT_CONTROL,
     83        SYS_INTERRUPT_ENABLE,
    8384       
    8485        SYS_SYSINFO_VALID,
  • kernel/generic/src/ddi/ddi.c

    r5af21c5 r953bc1ef  
    287287}
    288288
     289/** Disable or enable specified interrupts.
     290 *
     291 * @param irq the interrupt to be enabled/disabled.
     292 * @param enable if true enable the interrupt, disable otherwise.
     293 *
     294 * @retutn Zero on success, error code otherwise.
     295 */
     296unative_t sys_interrupt_enable(int irq, int enable)
     297{       
     298        cap_t task_cap = cap_get(TASK);
     299        if (!(task_cap & CAP_PREEMPT_CONTROL) || !(task_cap & CAP_IRQ_REG))
     300                return EPERM;
     301               
     302        if (irq < 0 || irq > 16) {
     303                return EINVAL;
     304        }
     305       
     306        uint16_t irq_mask = (uint16_t)(1 << irq);
     307        if (enable) {
     308                trap_virtual_enable_irqs(irq_mask);
     309        } else {
     310                trap_virtual_disable_irqs(irq_mask);
     311        }
     312       
     313        return 0;       
     314}
     315
    289316/** @}
    290317 */
  • kernel/generic/src/syscall/syscall.c

    r5af21c5 r953bc1ef  
    151151        (syshandler_t) sys_iospace_enable,
    152152        (syshandler_t) sys_preempt_control,
     153        (syshandler_t) sys_interrupt_enable,
    153154       
    154155        /* Sysinfo syscalls */
  • uspace/app/trace/syscalls.c

    r5af21c5 r953bc1ef  
    7474    [SYS_IOSPACE_ENABLE] = { "iospace_enable",          1,      V_ERRNO },
    7575    [SYS_PREEMPT_CONTROL] = { "preempt_control",        1,      V_ERRNO },
     76        [SYS_INTERRUPT_ENABLE] = { "interrupt_enable",  2,      V_ERRNO },
    7677
    7778    [SYS_SYSINFO_VALID] = { "sysinfo_valid",            2,      V_HASH },
  • uspace/lib/libc/generic/ddi.c

    r5af21c5 r953bc1ef  
    105105}
    106106
     107/** Enable/disable interrupt.
     108 *
     109 * @param irq the interrupt.
     110 * @param enable 1 - enable interrupt, 0 - disable interrupt.
     111 *
     112 * @return Zero on success, negative error code otherwise.
     113 */
     114int interrupt_enable(int irq, int enable)
     115{
     116        return __SYSCALL2(SYS_INTERRUPT_ENABLE, (sysarg_t) irq, (sysarg_t) enable);
     117}
     118
    107119/** Enable PIO for specified I/O range.
    108120 *
  • uspace/lib/libc/include/ddi.h

    r5af21c5 r953bc1ef  
    4343extern int preemption_control(int);
    4444extern int pio_enable(void *, size_t, void **);
     45extern int interrupt_enable(int, int);
    4546
    4647#endif
Note: See TracChangeset for help on using the changeset viewer.