Changeset 953bc1ef in mainline for kernel/generic/src/ddi/ddi.c


Ignore:
Timestamp:
2010-04-29T08:34:29Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cfe7716
Parents:
5af21c5
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 */
Note: See TracChangeset for help on using the changeset viewer.