Changeset 869d936 in mainline for uspace/lib
- Timestamp:
- 2014-07-18T08:11:34Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e5424e9
- Parents:
- fc6abbe
- Location:
- uspace/lib
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rfc6abbe r869d936 109 109 generic/iplink.c \ 110 110 generic/iplink_srv.c \ 111 generic/irc.c \ 111 112 generic/ieee_double.c \ 112 113 generic/power_of_ten.c \ -
uspace/lib/c/include/ipc/irc.h
rfc6abbe r869d936 33 33 */ 34 34 35 #ifndef LIBC_I RC_H_36 #define LIBC_I RC_H_35 #ifndef LIBC_IPC_IRC_H_ 36 #define LIBC_IPC_IRC_H_ 37 37 38 38 #include <ipc/common.h> -
uspace/lib/nic/include/nic.h
rfc6abbe r869d936 216 216 217 217 /* Functions called in add_device */ 218 extern int nic_connect_to_services(nic_t *);219 218 extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *); 220 219 extern void nic_set_specific(nic_t *, void *); … … 245 244 extern void nic_received_frame(nic_t *, nic_frame_t *); 246 245 extern void nic_received_frame_list(nic_t *, nic_frame_list_t *); 247 extern void nic_disable_interrupt(nic_t *, int);248 extern void nic_enable_interrupt(nic_t *, int);249 246 extern nic_poll_mode_t nic_query_poll_mode(nic_t *, struct timeval *); 250 247 -
uspace/lib/nic/include/nic_driver.h
rfc6abbe r869d936 80 80 /** Client callback session */ 81 81 async_sess_t *client_session; 82 /** Phone to APIC or i8259 */83 async_sess_t *irc_session;84 82 /** Current polling mode of the NIC */ 85 83 nic_poll_mode_t poll_mode; -
uspace/lib/nic/src/nic_driver.c
rfc6abbe r869d936 42 42 #include <stdio.h> 43 43 #include <str_error.h> 44 #include <ipc/services.h>45 #include <ipc/ns.h>46 #include <ipc/irc.h>47 44 #include <sysinfo.h> 48 45 #include <as.h> … … 378 375 } 379 376 380 381 /**382 * Enable interrupts for this driver.383 *384 * @param nic_data385 * @param irq The IRQ number for this device386 */387 void nic_enable_interrupt(nic_t *nic_data, int irq)388 {389 async_exch_t *exch = async_exchange_begin(nic_data->irc_session);390 async_msg_1(exch, IRC_ENABLE_INTERRUPT, irq);391 async_exchange_end(exch);392 }393 394 /**395 * Disable interrupts for this driver.396 *397 * @param nic_data398 * @param irq The IRQ number for this device399 */400 void nic_disable_interrupt(nic_t *nic_data, int irq)401 {402 async_exch_t *exch = async_exchange_begin(nic_data->irc_session);403 async_msg_1(exch, IRC_CLEAR_INTERRUPT, irq);404 async_exchange_end(exch);405 }406 407 377 /** Get the polling mode information from the device 408 378 * … … 420 390 return nic_data->poll_mode; 421 391 }; 422 423 /**424 * Connect to IRC service. This function should be called only from425 * the add_device handler, thus no locking is required.426 *427 * @param nic_data428 *429 * @return EOK If connection was successful.430 * @return EINVAL If the IRC service cannot be determined.431 * @return EREFUSED If IRC service cannot be connected.432 */433 int nic_connect_to_services(nic_t *nic_data)434 {435 /* IRC service */436 sysarg_t apic;437 sysarg_t i8259;438 services_t irc_service = -1;439 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) ||440 ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)))441 irc_service = SERVICE_IRC;442 else443 return EINVAL;444 445 nic_data->irc_session = service_connect_blocking(EXCHANGE_SERIALIZE,446 irc_service, 0, 0);447 if (nic_data->irc_session == NULL)448 return errno;449 450 return EOK;451 }452 392 453 393 /** Inform the NICF about poll mode … … 668 608 nic_data->state = NIC_STATE_STOPPED; 669 609 nic_data->client_session = NULL; 670 nic_data->irc_session = NULL;671 610 nic_data->poll_mode = NIC_POLL_IMMEDIATE; 672 611 nic_data->default_poll_mode = NIC_POLL_IMMEDIATE;
Note:
See TracChangeset
for help on using the changeset viewer.