Changeset e5424e9 in mainline for uspace/lib/c/generic/irc.c
- Timestamp:
- 2014-07-18T08:50:36Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ebc9c2c
- Parents:
- 869d936
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/irc.c
r869d936 re5424e9 39 39 #include <irc.h> 40 40 #include <ns.h> 41 #include <sysinfo.h> 41 42 42 43 static async_sess_t *irc_sess; 43 44 /** Enable interrupt.45 *46 * @param irq IRQ number47 */48 void irc_enable_interrupt(int irq)49 {50 async_exch_t *exch = async_exchange_begin(irc_sess);51 async_msg_1(exch, IRC_ENABLE_INTERRUPT, irq);52 async_exchange_end(exch);53 }54 55 /** Disable interrupt.56 *57 * @param irq IRQ number58 */59 void irc_disable_interrupt(int irq)60 {61 async_exch_t *exch = async_exchange_begin(irc_sess);62 async_msg_1(exch, IRC_CLEAR_INTERRUPT, irq);63 async_exchange_end(exch);64 }65 44 66 45 /** Connect to IRC service. … … 68 47 * @return EOK on success, EIO on failure 69 48 */ 70 int irc_init(void)49 static int irc_init(void) 71 50 { 51 sysarg_t apic; 52 sysarg_t i8259; 53 72 54 assert(irc_sess == NULL); 73 55 74 irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, SERVICE_IRC, 75 0, 0); 56 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 57 || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) { 58 irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 59 SERVICE_IRC, 0, 0); 60 } 61 76 62 if (irc_sess == NULL) 77 63 return EIO; … … 80 66 } 81 67 68 /** Enable interrupt. 69 * 70 * @param irq IRQ number 71 */ 72 int irc_enable_interrupt(int irq) 73 { 74 int rc; 75 76 if (irc_sess == NULL) { 77 rc = irc_init(); 78 if (rc != EOK) 79 return rc; 80 } 81 82 async_exch_t *exch = async_exchange_begin(irc_sess); 83 rc = async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq); 84 async_exchange_end(exch); 85 86 return rc; 87 } 88 89 90 /** Disable interrupt. 91 * 92 * @param irq IRQ number 93 */ 94 int irc_disable_interrupt(int irq) 95 { 96 int rc; 97 98 if (irc_sess == NULL) { 99 rc = irc_init(); 100 if (rc != EOK) 101 return rc; 102 } 103 104 async_exch_t *exch = async_exchange_begin(irc_sess); 105 rc = async_req_1_0(exch, IRC_CLEAR_INTERRUPT, irq); 106 async_exchange_end(exch); 107 108 return rc; 109 } 110 82 111 /** @} 83 112 */
Note:
See TracChangeset
for help on using the changeset viewer.