Ignore:
File:
1 edited

Legend:

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

    r9a2eb14 rf9b2cb4c  
    3535#include <assert.h>
    3636#include <errno.h>
    37 #include <fibril_synch.h>
    3837#include <ipc/irc.h>
    3938#include <ipc/services.h>
    4039#include <irc.h>
    41 #include <loc.h>
    42 #include <stdlib.h>
     40#include <ns.h>
    4341#include <sysinfo.h>
    4442
     
    5149static int irc_init(void)
    5250{
    53         category_id_t irc_cat;
    54         service_id_t *svcs;
    55         size_t count;
    56         int rc;
     51        assert(irc_sess == NULL);
    5752
    58         assert(irc_sess == NULL);
    59         rc = loc_category_get_id("irc", &irc_cat, IPC_FLAG_BLOCKING);
    60         if (rc != EOK)
    61                 return EIO;
    62 
    63         while (true) {
    64                 rc = loc_category_get_svcs(irc_cat, &svcs, &count);
    65                 if (rc != EOK)
    66                         return EIO;
    67 
    68                 if (count > 0)
    69                         break;
    70 
    71                 free(svcs);
    72 
    73                 // XXX This is just a temporary hack
    74                 fibril_usleep(500 * 1000);
    75         }
    76 
    77         irc_sess = loc_service_connect(svcs[0], INTERFACE_IRC,
    78             IPC_FLAG_BLOCKING);
    79         free(svcs);
     53        irc_sess = service_connect_blocking(SERVICE_IRC, INTERFACE_IRC, 0);
    8054
    8155        if (irc_sess == NULL)
     
    8660
    8761/** Enable interrupt.
    88  *
    89  * Allow interrupt delivery.
    9062 *
    9163 * @param irq   IRQ number
     
    10880}
    10981
     82
    11083/** Disable interrupt.
    111  *
    112  * Disallow interrupt delivery.
    11384 *
    11485 * @param irq   IRQ number
    11586 */
    11687int irc_disable_interrupt(int irq)
    117 {
    118         int rc;
    119 
    120         if (irc_sess == NULL) {
    121                 rc = irc_init();
    122                 if (rc != EOK)
    123                         return rc;
    124         }
    125 
    126         async_exch_t *exch = async_exchange_begin(irc_sess);
    127         rc = async_req_1_0(exch, IRC_DISABLE_INTERRUPT, irq);
    128         async_exchange_end(exch);
    129 
    130         return rc;
    131 }
    132 
    133 /** Clear interrupt.
    134  *
    135  * Clear/acknowledge interrupt in interrupt controller so that
    136  * another interrupt can be delivered.
    137  *
    138  * @param irq   IRQ number
    139  */
    140 int irc_clear_interrupt(int irq)
    14188{
    14289        int rc;
Note: See TracChangeset for help on using the changeset viewer.