/trunk/kernel/genarch/src/kbd/z8530.c |
---|
40,6 → 40,7 |
#include <genarch/kbd/scanc_sun.h> |
#include <arch/drivers/z8530.h> |
#include <ddi/irq.h> |
#include <ipc/irq.h> |
#include <arch/interrupt.h> |
#include <arch/drivers/kbd.h> |
#include <arch/drivers/fhc.h> |
58,8 → 59,6 |
*/ |
#define IGNORE_CODE 0x7f /* all keys up */ |
bool z8530_belongs_to_kernel = true; |
static z8530_t z8530; /**< z8530 device structure. */ |
static irq_t z8530_irq; /**< z8530's IRQ. */ |
72,18 → 71,14 |
.read = z8530_key_read |
}; |
void z8530_wait(void); |
/** Initialize keyboard and service interrupts using kernel routine */ |
/** Initialize keyboard and service interrupts using kernel routine. */ |
void z8530_grab(void) |
{ |
z8530_belongs_to_kernel = true; |
} |
/** Resume the former interrupt vector */ |
/** Resume the former IPC notification behavior. */ |
void z8530_release(void) |
{ |
z8530_belongs_to_kernel = false; |
} |
/** Initialize z8530. */ |
133,10 → 128,6 |
z8530_poll(); |
} |
/** Wait until the controller reads its data. */ |
void z8530_wait(void) { |
} |
/* Called from getc(). */ |
void z8530_resume(chardev_t *d) |
{ |
194,15 → 185,15 |
{ |
/* |
* So far, we know we got this interrupt through the FHC. |
* Since we don't have enough information about the FHC and |
* because the interrupt looks like level sensitive, |
* Since we don't have enough documentation about the FHC |
* and because the interrupt looks like level sensitive, |
* we cannot handle it by scheduling one of the level |
* interrupt traps. Process the interrupt directly. |
*/ |
if (z8530_belongs_to_kernel) |
if (irq->notif_cfg.answerbox) |
ipc_irq_send_notif(irq); |
else |
z8530_interrupt(); |
else |
ipc_irq_send_notif(0); |
fhc_clear_interrupt(central_fhc, irq->inr); |
} |
/trunk/kernel/generic/include/ddi/irq.h |
---|
36,10 → 36,9 |
#define KERN_IRQ_H_ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <adt/list.h> |
#include <ipc/ipc.h> |
#include <ipc/irq.h> |
#include <atomic.h> |
#include <synch/spinlock.h> |
typedef enum { |
52,8 → 51,6 |
IRQ_TRIGGER_EDGE |
} irq_trigger_t; |
typedef struct irq irq_t; |
typedef void (* irq_handler_t)(irq_t *irq, void *arg, ...); |
/** Structure representing one device IRQ. |
87,15 → 84,8 |
/** Argument for the handler. */ |
void *arg; |
/** Answerbox of the task that wanted to be notified. */ |
answerbox_t *notif_answerbox; |
/** Pseudo-code to be performed by the top-half |
* before a notification is sent. */ |
irq_code_t *code; |
/** Method of the notification. */ |
unative_t method; |
/** Counter of IRQ notifications. */ |
atomic_t counter; |
/** Notification configuration structure. */ |
ipc_notif_cfg_t notif_cfg; |
}; |
extern void irq_init(count_t inrs, count_t chains); |
/trunk/kernel/generic/include/typedefs.h |
---|
97,6 → 97,8 |
typedef signed int inr_t; |
typedef signed int devno_t; |
typedef struct irq irq_t; |
typedef struct ipc_notif_cfg ipc_notif_cfg_t; |
#endif |
/trunk/kernel/generic/include/ipc/sysipc.h |
---|
38,6 → 38,7 |
#include <ipc/ipc.h> |
#include <ipc/irq.h> |
#include <arch/types.h> |
#include <typedefs.h> |
unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, |
unative_t arg1, ipc_data_t *data); |
53,8 → 54,8 |
unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid, |
unative_t method, unative_t arg1); |
unative_t sys_ipc_hangup(int phoneid); |
unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode); |
unative_t sys_ipc_unregister_irq(int irq); |
unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode); |
unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno); |
#endif |
/trunk/kernel/generic/include/ipc/ipc.h |
---|
155,8 → 155,7 |
#ifdef KERNEL |
#include <synch/mutex.h> |
#include <synch/condvar.h> |
#include <synch/waitq.h> |
#include <adt/list.h> |
#define IPC_MAX_PHONES 16 |
/trunk/kernel/generic/include/ipc/irq.h |
---|
38,12 → 38,9 |
/** Maximum length of IPC IRQ program */ |
#define IRQ_MAX_PROG_SIZE 10 |
/** Reserved 'virtual' messages for kernel notifications */ |
#define IPC_IRQ_RESERVED_VIRTUAL 10 |
#define VIRT_INR_KLOG -2 |
#define VIRT_INR_KBDRESTART -3 |
#define IPC_IRQ_KLOG (-1) |
#define IPC_IRQ_KBDRESTART (-2) |
typedef enum { |
CMD_MEM_READ_1 = 0, |
CMD_MEM_READ_2, |
75,13 → 72,26 |
#ifdef KERNEL |
#include <ipc/ipc.h> |
#include <typedefs.h> |
#include <arch/types.h> |
extern void ipc_irq_make_table(int irqcount); |
extern int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode); |
extern void ipc_irq_send_notif(int irq); |
extern void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3); |
extern void ipc_irq_unregister(answerbox_t *box, int irq); |
extern void irq_ipc_bind_arch(unative_t irq); |
/** IPC notification config structure. |
* |
* Primarily, this structure is encapsulated in the irq_t structure. |
* It is protected by irq_t::lock. |
*/ |
struct ipc_notif_cfg { |
answerbox_t *answerbox; /**< Answerbox for notifications. */ |
unative_t method; /**< Method to be used for the notification. */ |
irq_code_t *code; /**< Top-half pseudocode. */ |
count_t counter; /**< Counter. */ |
}; |
extern int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, |
irq_code_t *ucode); |
extern void ipc_irq_send_notif(irq_t *irq); |
extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3); |
extern void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno); |
extern void ipc_irq_cleanup(answerbox_t *box); |
#endif |
/trunk/kernel/generic/src/ddi/irq.c |
---|
71,7 → 71,6 |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <atomic.h> |
#include <arch.h> |
#define KEY_INR 0 |
146,10 → 145,10 |
irq->claim = NULL; |
irq->handler = NULL; |
irq->arg = NULL; |
irq->notif_answerbox = NULL; |
irq->code = NULL; |
irq->method = 0; |
atomic_set(&irq->counter, 0); |
irq->notif_cfg.answerbox = NULL; |
irq->notif_cfg.code = NULL; |
irq->notif_cfg.method = 0; |
irq->notif_cfg.counter = 0; |
} |
/** Register IRQ for device. |
/trunk/kernel/generic/src/console/cmd.c |
---|
802,7 → 802,8 |
printf("The kernel will now relinquish the console.\n"); |
printf("Use userspace controls to redraw the screen.\n"); |
arch_release_console(); |
ipc_irq_send_msg(IPC_IRQ_KBDRESTART, 0, 0, 0); |
/* TODO: send some vitual IRQ */ |
ipc_irq_send_msg(NULL, 0, 0, 0); |
return 1; |
} |
/trunk/kernel/generic/src/console/klog.c |
---|
36,10 → 36,12 |
#include <sysinfo/sysinfo.h> |
#include <console/klog.h> |
#include <print.h> |
#include <ddi/device.h> |
#include <ddi/irq.h> |
#include <ipc/irq.h> |
/* Order of frame to be allocated for klog communication */ |
#define KLOG_ORDER 0 |
#define KLOG_ORDER 0 |
static char *klog; |
static int klogsize; |
47,6 → 49,10 |
SPINLOCK_INITIALIZE(klog_lock); |
static irq_t klog_irq; |
static irq_ownership_t klog_claim(void); |
/** Initialize kernel logging facility |
* |
* Allocate pages that are to be shared with uspace for console data. |
63,13 → 69,34 |
panic("Cannot allocate page for klog"); |
klog = (char *)PA2KA(faddr); |
devno_t devno = device_assign_devno(); |
sysinfo_set_item_val("klog.faddr", NULL, (unative_t)faddr); |
sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER); |
sysinfo_set_item_val("klog.devno", NULL, devno); |
sysinfo_set_item_val("klog.inr", NULL, VIRT_INR_KLOG); |
irq_initialize(&klog_irq); |
klog_irq.devno = devno; |
klog_irq.inr = VIRT_INR_KLOG; |
klog_irq.claim = klog_claim; |
irq_register(&klog_irq); |
klogsize = PAGE_SIZE << KLOG_ORDER; |
klogpos = 0; |
} |
/** Allways refuse IRQ ownership. |
* |
* This is not a real IRQ, so we always decline. |
* |
* @return Always returns IRQ_DECLINE. |
*/ |
irq_ownership_t klog_claim(void) |
{ |
return IRQ_DECLINE; |
} |
static void klog_vprintf(const char *fmt, va_list args) |
{ |
int ret; |
84,7 → 111,7 |
if (ret >= klogsize) |
goto out; |
} |
ipc_irq_send_msg(IPC_IRQ_KLOG, klogpos, ret, 0); |
ipc_irq_send_msg(&klog_irq, klogpos, ret, 0); |
klogpos += ret; |
if (klogpos >= klogsize) |
klogpos = 0; |
/trunk/kernel/generic/src/ipc/sysipc.c |
---|
565,31 → 565,35 |
return (unative_t)call; |
} |
/** Connect irq handler to task */ |
unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode) |
/** Connect irq handler to task. |
* |
* @param inr IRQ number. |
* @param devno Device number. |
* @param method Method to be associated with the notification. |
* @param ucode Uspace pointer to the top-half pseudocode. |
* |
* @return EPERM or a return code returned by ipc_irq_register(). |
*/ |
unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) |
{ |
if (!(cap_get(TASK) & CAP_IRQ_REG)) |
return EPERM; |
if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL) |
return (unative_t) ELIMIT; |
irq_ipc_bind_arch(irq); |
return ipc_irq_register(&TASK->answerbox, irq, ucode); |
return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode); |
} |
/* Disconnect irq handler from task */ |
unative_t sys_ipc_unregister_irq(int irq) |
/** Disconnect irq handler from task. |
* |
* @param inr IRQ number. |
* @param devno Device number. |
*/ |
unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno) |
{ |
if (!(cap_get(TASK) & CAP_IRQ_REG)) |
return EPERM; |
if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL) |
return (unative_t) ELIMIT; |
ipc_irq_unregister(&TASK->answerbox, inr, devno); |
ipc_irq_unregister(&TASK->answerbox, irq); |
return 0; |
} |
/trunk/kernel/generic/src/ipc/ipc.c |
---|
440,14 → 440,10 |
} |
/** Initilize ipc subsystem */ |
/** Initilize IPC subsystem */ |
void ipc_init(void) |
{ |
ipc_call_slab = slab_cache_create("ipc_call", |
sizeof(call_t), |
0, |
NULL, NULL, 0); |
ipc_irq_make_table(IRQ_COUNT); |
ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL, NULL, 0); |
} |
/trunk/kernel/generic/src/ipc/irq.c |
---|
1,5 → 1,6 |
/* |
* Copyright (C) 2006 Ondrej Palkovsky |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
39,10 → 40,10 |
* (read/write port/memory, add information to notification ipc message). |
* |
* The structure of a notification message is as follows: |
* - METHOD: interrupt number |
* - METHOD: method as registered by the SYS_IPC_REGISTER_IRQ syscall |
* - ARG1: payload modified by a 'top-half' handler |
* - ARG2: payload |
* - ARG3: payload |
* - ARG2: payload modified by a 'top-half' handler |
* - ARG3: payload modified by a 'top-half' handler |
* - in_phone_hash: interrupt counter (may be needed to assure correct order |
* in multithreaded drivers) |
*/ |
50,26 → 51,18 |
#include <arch.h> |
#include <mm/slab.h> |
#include <errno.h> |
#include <ddi/irq.h> |
#include <ipc/ipc.h> |
#include <ipc/irq.h> |
#include <atomic.h> |
#include <syscall/copy.h> |
#include <console/console.h> |
#include <print.h> |
typedef struct { |
SPINLOCK_DECLARE(lock); |
answerbox_t *box; |
irq_code_t *code; |
atomic_t counter; |
} ipc_irq_t; |
static ipc_irq_t *irq_conns = NULL; |
static int irq_conns_size; |
/* Execute code associated with IRQ notification */ |
/** Execute code associated with IRQ notification. |
* |
* @param call Notification call. |
* @param code Top-half pseudocode. |
*/ |
static void code_execute(call_t *call, irq_code_t *code) |
{ |
int i; |
168,33 → 161,49 |
return code; |
} |
/** Unregister task from irq */ |
void ipc_irq_unregister(answerbox_t *box, int irq) |
/** Unregister task from IRQ notification. |
* |
* @param box Answerbox associated with the notification. |
* @param inr IRQ numbe. |
* @param devno Device number. |
*/ |
void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno) |
{ |
ipl_t ipl; |
int mq = irq + IPC_IRQ_RESERVED_VIRTUAL; |
irq_t *irq; |
ipl = interrupts_disable(); |
spinlock_lock(&irq_conns[mq].lock); |
if (irq_conns[mq].box == box) { |
irq_conns[mq].box = NULL; |
code_free(irq_conns[mq].code); |
irq_conns[mq].code = NULL; |
irq = irq_find_and_lock(inr, devno); |
if (irq) { |
if (irq->notif_cfg.answerbox == box) { |
code_free(irq->notif_cfg.code); |
irq->notif_cfg.code = NULL; |
irq->notif_cfg.answerbox = NULL; |
irq->notif_cfg.method = 0; |
irq->notif_cfg.counter = 0; |
spinlock_unlock(&irq->lock); |
} |
} |
spinlock_unlock(&irq_conns[mq].lock); |
interrupts_restore(ipl); |
} |
/** Register an answerbox as a receiving end of interrupts notifications */ |
int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode) |
/** Register an answerbox as a receiving end for IRQ notifications. |
* |
* @param box Receiving answerbox. |
* @param inr IRQ number. |
* @param devno Device number. |
* @param method Method to be associated with the notification. |
* @param ucode Uspace pointer to top-half pseudocode. |
* |
* @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success. |
*/ |
int |
ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) |
{ |
ipl_t ipl; |
irq_code_t *code; |
int mq = irq + IPC_IRQ_RESERVED_VIRTUAL; |
irq_t *irq; |
ASSERT(irq_conns); |
if (ucode) { |
code = code_from_uspace(ucode); |
if (!code) |
203,135 → 212,107 |
code = NULL; |
ipl = interrupts_disable(); |
spinlock_lock(&irq_conns[mq].lock); |
if (irq_conns[mq].box) { |
spinlock_unlock(&irq_conns[mq].lock); |
irq = irq_find_and_lock(inr, devno); |
if (!irq) { |
interrupts_restore(ipl); |
code_free(code); |
return ENOENT; |
} |
if (irq->notif_cfg.answerbox) { |
spinlock_unlock(&irq->lock); |
interrupts_restore(ipl); |
code_free(code); |
return EEXISTS; |
} |
irq_conns[mq].box = box; |
irq_conns[mq].code = code; |
atomic_set(&irq_conns[mq].counter, 0); |
spinlock_unlock(&irq_conns[mq].lock); |
irq->notif_cfg.answerbox = box; |
irq->notif_cfg.method = method; |
irq->notif_cfg.code = code; |
irq->notif_cfg.counter = 0; |
spinlock_unlock(&irq->lock); |
interrupts_restore(ipl); |
return 0; |
} |
/** Add call to proper answerbox queue |
/** Add call to proper answerbox queue. |
* |
* Assume irq_conns[mq].lock is locked */ |
static void send_call(int mq, call_t *call) |
* Assume irq->lock is locked. |
* |
*/ |
static void send_call(irq_t *irq, call_t *call) |
{ |
spinlock_lock(&irq_conns[mq].box->irq_lock); |
list_append(&call->link, &irq_conns[mq].box->irq_notifs); |
spinlock_unlock(&irq_conns[mq].box->irq_lock); |
spinlock_lock(&irq->notif_cfg.answerbox->irq_lock); |
list_append(&call->link, &irq->notif_cfg.answerbox->irq_notifs); |
spinlock_unlock(&irq->notif_cfg.answerbox->irq_lock); |
waitq_wakeup(&irq_conns[mq].box->wq, 0); |
waitq_wakeup(&irq->notif_cfg.answerbox->wq, WAKEUP_FIRST); |
} |
/** Send notification message |
* |
*/ |
void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3) |
void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3) |
{ |
call_t *call; |
int mq = irq + IPC_IRQ_RESERVED_VIRTUAL; |
spinlock_lock(&irq_conns[mq].lock); |
spinlock_lock(&irq->lock); |
if (irq_conns[mq].box) { |
if (irq->notif_cfg.answerbox) { |
call = ipc_call_alloc(FRAME_ATOMIC); |
if (!call) { |
spinlock_unlock(&irq_conns[mq].lock); |
spinlock_unlock(&irq->lock); |
return; |
} |
call->flags |= IPC_CALL_NOTIF; |
IPC_SET_METHOD(call->data, irq); |
IPC_SET_METHOD(call->data, irq->notif_cfg.method); |
IPC_SET_ARG1(call->data, a1); |
IPC_SET_ARG2(call->data, a2); |
IPC_SET_ARG3(call->data, a3); |
/* Put a counter to the message */ |
call->private = atomic_preinc(&irq_conns[mq].counter); |
call->private = ++irq->notif_cfg.counter; |
send_call(mq, call); |
send_call(irq, call); |
} |
spinlock_unlock(&irq_conns[mq].lock); |
spinlock_unlock(&irq->lock); |
} |
/** Notify task that an irq had occurred. |
* |
* We expect interrupts to be disabled |
* We expect interrupts to be disabled and the irq->lock already held. |
*/ |
void ipc_irq_send_notif(int irq) |
void ipc_irq_send_notif(irq_t *irq) |
{ |
call_t *call; |
int mq = irq + IPC_IRQ_RESERVED_VIRTUAL; |
ASSERT(irq_conns); |
spinlock_lock(&irq_conns[mq].lock); |
ASSERT(irq); |
if (irq_conns[mq].box) { |
if (irq->notif_cfg.answerbox) { |
call = ipc_call_alloc(FRAME_ATOMIC); |
if (!call) { |
spinlock_unlock(&irq_conns[mq].lock); |
return; |
} |
call->flags |= IPC_CALL_NOTIF; |
/* Put a counter to the message */ |
call->private = atomic_preinc(&irq_conns[mq].counter); |
call->private = ++irq->notif_cfg.counter; |
/* Set up args */ |
IPC_SET_METHOD(call->data, irq); |
IPC_SET_METHOD(call->data, irq->notif_cfg.method); |
/* Execute code to handle irq */ |
code_execute(call, irq_conns[mq].code); |
code_execute(call, irq->notif_cfg.code); |
send_call(mq, call); |
send_call(irq, call); |
} |
spinlock_unlock(&irq_conns[mq].lock); |
} |
/** Initialize table of interrupt handlers |
/** Disconnect all IRQ notifications from an answerbox. |
* |
* @param irqcount Count of required hardware IRQs to be supported |
* @param box Answerbox for which we want to carry out the cleanup. |
*/ |
void ipc_irq_make_table(int irqcount) |
{ |
int i; |
irqcount += IPC_IRQ_RESERVED_VIRTUAL; |
irq_conns_size = irqcount; |
irq_conns = malloc(irqcount * (sizeof(*irq_conns)), 0); |
for (i=0; i < irqcount; i++) { |
spinlock_initialize(&irq_conns[i].lock, "irq_ipc_lock"); |
irq_conns[i].box = NULL; |
irq_conns[i].code = NULL; |
} |
} |
/** Disconnect all irq's notifications |
* |
* @todo It may be better to do some linked list, so that |
* we wouldn't need to go through whole array every cleanup |
*/ |
void ipc_irq_cleanup(answerbox_t *box) |
{ |
int i; |
ipl_t ipl; |
for (i=0; i < irq_conns_size; i++) { |
ipl = interrupts_disable(); |
spinlock_lock(&irq_conns[i].lock); |
if (irq_conns[i].box == box) |
irq_conns[i].box = NULL; |
spinlock_unlock(&irq_conns[i].lock); |
interrupts_restore(ipl); |
} |
/* TODO */ |
} |
/** @} |
/trunk/kernel/arch/sparc64/src/trap/interrupt.c |
---|
39,7 → 39,6 |
#include <typedefs.h> |
#include <arch/types.h> |
#include <debug.h> |
#include <ipc/sysipc.h> |
#include <arch/asm.h> |
#include <arch/barrier.h> |
#include <print.h> |
48,12 → 47,6 |
#include <config.h> |
#include <synch/spinlock.h> |
/* |
* To be removed once we get rid of the dependency in ipc_irq_bind_arch(). |
*/ |
#include <arch/drivers/kbd.h> |
#include <genarch/kbd/z8530.h> |
/** Register Interrupt Level Handler. |
* |
* @param n Interrupt Level (1 - 15). |
67,15 → 60,6 |
exc_register(n - 1, name, f); |
} |
/* Reregister irq to be IPC-ready */ |
void irq_ipc_bind_arch(unative_t irq) |
{ |
#ifdef CONFIG_Z8530 |
if (kbd_type == KBD_Z8530) |
z8530_belongs_to_kernel = false; |
#endif |
} |
/** Process hardware interrupt. |
* |
* @param n Ignored. |
/trunk/uspace/klog/klog.c |
---|
40,6 → 40,7 |
#include <ipc/services.h> |
#include <as.h> |
#include <kernel/ipc/irq.h> |
#include <sysinfo.h> |
/* Pointer to klog area */ |
static char *klog; |
72,7 → 73,9 |
} |
klog = mapping; |
if (ipc_register_irq(IPC_IRQ_KLOG, NULL)) { |
int inr = sysinfo_value("klog.inr"); |
int devno = sysinfo_value("klog.devno"); |
if (ipc_register_irq(inr, devno, 0, NULL)) { |
printf("Error registering for klog service.\n"); |
return 0; |
} |
/trunk/uspace/kbd/arch/sparc64/src/kbd.c |
---|
58,7 → 58,7 |
int kbd_arch_init(void) |
{ |
z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual") + 6; |
ipc_register_irq(sysinfo_value("kbd.irq"), &z8530_kbd); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &z8530_kbd); |
return 0; |
} |
/trunk/uspace/libc/include/ipc/ipc.h |
---|
83,8 → 83,8 |
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone); |
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2); |
extern int ipc_hangup(int phoneid); |
extern int ipc_register_irq(int irq, irq_code_t *code); |
extern int ipc_unregister_irq(int irq); |
extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code); |
extern int ipc_unregister_irq(int inr, int devno); |
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1); |
#endif |
/trunk/uspace/libc/generic/ipc.c |
---|
449,14 → 449,30 |
return __SYSCALL1(SYS_IPC_HANGUP, phoneid); |
} |
int ipc_register_irq(int irq, irq_code_t *ucode) |
/** Register IRQ notification. |
* |
* @param inr IRQ number. |
* @param devno Device number of the device generating inr. |
* @param method Use this method for notifying me. |
* @param ucode Top-half pseudocode handler. |
* |
* @return Value returned by the kernel. |
*/ |
int ipc_register_irq(int inr, int devno, int method, irq_code_t *ucode) |
{ |
return __SYSCALL2(SYS_IPC_REGISTER_IRQ, irq, (sysarg_t) ucode); |
return __SYSCALL4(SYS_IPC_REGISTER_IRQ, inr, devno, method, (sysarg_t) ucode); |
} |
int ipc_unregister_irq(int irq) |
/** Unregister IRQ notification. |
* |
* @param inr IRQ number. |
* @param devno Device number of the device generating inr. |
* |
* @return Value returned by the kernel. |
*/ |
int ipc_unregister_irq(int inr, int devno) |
{ |
return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq); |
return __SYSCALL2(SYS_IPC_UNREGISTER_IRQ, inr, devno); |
} |
int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1) |
/trunk/uspace/libc/generic/async.c |
---|
636,7 → 636,7 |
amsg_t *msg; |
if (in_interrupt_handler) { |
printf("Cannot send asynchronou request in interrupt handler.\n"); |
printf("Cannot send asynchronous request in interrupt handler.\n"); |
_exit(1); |
} |
662,7 → 662,7 |
amsg_t *msg; |
if (in_interrupt_handler) { |
printf("Cannot send asynchronou request in interrupt handler.\n"); |
printf("Cannot send asynchronous request in interrupt handler.\n"); |
_exit(1); |
} |