Changes in uspace/lib/c/generic/irc.c [9a2eb14:f9b2cb4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/irc.c
r9a2eb14 rf9b2cb4c 35 35 #include <assert.h> 36 36 #include <errno.h> 37 #include <fibril_synch.h>38 37 #include <ipc/irc.h> 39 38 #include <ipc/services.h> 40 39 #include <irc.h> 41 #include <loc.h> 42 #include <stdlib.h> 40 #include <ns.h> 43 41 #include <sysinfo.h> 44 42 … … 51 49 static int irc_init(void) 52 50 { 53 category_id_t irc_cat; 54 service_id_t *svcs; 55 size_t count; 56 int rc; 51 assert(irc_sess == NULL); 57 52 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); 80 54 81 55 if (irc_sess == NULL) … … 86 60 87 61 /** Enable interrupt. 88 *89 * Allow interrupt delivery.90 62 * 91 63 * @param irq IRQ number … … 108 80 } 109 81 82 110 83 /** Disable interrupt. 111 *112 * Disallow interrupt delivery.113 84 * 114 85 * @param irq IRQ number 115 86 */ 116 87 int 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 that136 * another interrupt can be delivered.137 *138 * @param irq IRQ number139 */140 int irc_clear_interrupt(int irq)141 88 { 142 89 int rc;
Note:
See TracChangeset
for help on using the changeset viewer.