Changeset e5424e9 in mainline
- 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
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/e1k/e1k.c
r869d936 re5424e9 1756 1756 e1000_enable_interrupts(e1000); 1757 1757 1758 irc_enable_interrupt(e1000->irq); 1758 int rc = irc_enable_interrupt(e1000->irq); 1759 if (rc != EOK) { 1760 e1000_disable_interrupts(e1000); 1761 fibril_mutex_unlock(&e1000->ctrl_lock); 1762 fibril_mutex_unlock(&e1000->tx_lock); 1763 fibril_mutex_unlock(&e1000->rx_lock); 1764 return rc; 1765 } 1759 1766 1760 1767 e1000_clear_rx_ring(e1000); … … 2375 2382 printf("%s: HelenOS E1000 network adapter driver\n", NAME); 2376 2383 2377 if (irc_init() != EOK) {2378 printf("%s: Failed connecting IRC service\n", NAME);2379 return 1;2380 }2381 2382 2384 if (nic_driver_init(NAME) != EOK) 2383 2385 return 1; -
uspace/drv/nic/ne2k/ne2k.c
r869d936 re5424e9 257 257 if (!ne2k->up) { 258 258 int rc = ne2k_up(ne2k); 259 if (rc != EOK) 260 return rc; 261 262 rc = irc_enable_interrupt(ne2k->irq); 259 263 if (rc != EOK) { 264 ne2k_down(ne2k); 260 265 return rc; 261 266 } 262 263 irc_enable_interrupt(ne2k->irq);264 267 } 265 268 return EOK; … … 270 273 ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data); 271 274 272 irc_disable_interrupt(ne2k->irq);275 (void) irc_disable_interrupt(ne2k->irq); 273 276 ne2k->receive_configuration = RCR_AB | RCR_AM; 274 277 ne2k_down(ne2k); … … 440 443 printf("%s: HelenOS NE 2000 network adapter driver\n", NAME); 441 444 442 if (irc_init() != EOK) {443 printf("%s: Failed connecting IRC service\n", NAME);444 return 1;445 }446 447 445 nic_driver_init(NAME); 448 446 nic_driver_implement(&ne2k_driver_ops, &ne2k_dev_ops, &ne2k_nic_iface); -
uspace/drv/nic/rtl8139/driver.c
r869d936 re5424e9 956 956 rtl8139->int_mask = RTL_DEFAULT_INTERRUPTS; 957 957 rtl8139_hw_int_enable(rtl8139); 958 irc_enable_interrupt(rtl8139->irq); 958 959 int rc = irc_enable_interrupt(rtl8139->irq); 960 if (rc != EOK) { 961 rtl8139_on_stopped(nic_data); 962 return rc; 963 } 959 964 960 965 ddf_msg(LVL_DEBUG, "Device activated, interrupt %d registered", rtl8139->irq); … … 2170 2175 printf("%s: HelenOS RTL8139 network adapter driver\n", NAME); 2171 2176 2172 if (irc_init() != EOK) {2173 printf("%s: Failed connecting IRC service\n", NAME);2174 return 1;2175 }2176 2177 2177 int rc = nic_driver_init(NAME); 2178 2178 if (rc != EOK) -
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 */ -
uspace/lib/c/include/irc.h
r869d936 re5424e9 36 36 #define LIBC_IRC_H_ 37 37 38 extern int irc_init(void); 39 extern void irc_enable_interrupt(int); 40 extern void irc_disable_interrupt(int); 38 extern int irc_enable_interrupt(int); 39 extern int irc_disable_interrupt(int); 41 40 42 41 #endif
Note:
See TracChangeset
for help on using the changeset viewer.