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