Changeset e86b8f0 in mainline for uspace/lib/nic
- Timestamp:
- 2012-01-21T12:50:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77a69ea, 86c71de
- Parents:
- 3fe58d3c
- Location:
- uspace/lib/nic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/include/nic.h
r3fe58d3c re86b8f0 44 44 #include <ops/nic.h> 45 45 46 #define DEVICE_CATEGORY_NIC "nic" 47 46 48 struct nic; 47 49 typedef struct nic nic_t; … … 204 206 /* Functions called in add_device */ 205 207 extern int nic_connect_to_services(nic_t *); 206 extern int nic_register_as_ddf_fun(nic_t *, ddf_dev_ops_t *);207 208 extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *); 208 209 extern void nic_set_specific(nic_t *, void *); … … 225 226 extern ddf_dev_t *nic_get_ddf_dev(nic_t *); 226 227 extern ddf_fun_t *nic_get_ddf_fun(nic_t *); 228 extern void nic_set_ddf_fun(nic_t *, ddf_fun_t *); 227 229 extern nic_t *nic_get_from_ddf_dev(ddf_dev_t *); 228 230 extern nic_t *nic_get_from_ddf_fun(ddf_fun_t *); -
uspace/lib/nic/include/nic_driver.h
r3fe58d3c re86b8f0 50 50 #include "nic_rx_control.h" 51 51 #include "nic_wol_virtues.h" 52 53 #define DEVICE_CATEGORY_NIC "nic"54 52 55 53 struct sw_poll_info { -
uspace/lib/nic/src/nic_driver.c
r3fe58d3c re86b8f0 812 812 813 813 /** 814 * Creates an exposed DDF function for the device, named "port0".815 * Device options are set as this function's options. The function is bound816 * (see ddf_fun_bind) and then registered to the DEVICE_CATEGORY_NIC class.817 * Note: this function should be called only from add_device handler, therefore818 * we don't need to use locks.819 *820 * @param nic_data The NIC structure821 * @param ops Device options for the DDF function.822 */823 int nic_register_as_ddf_fun(nic_t *nic_data, ddf_dev_ops_t *ops)824 {825 int rc;826 assert(nic_data);827 828 nic_data->fun = ddf_fun_create(nic_data->dev, fun_exposed, "port0");829 if (nic_data->fun == NULL)830 return ENOMEM;831 832 nic_data->fun->ops = ops;833 nic_data->fun->driver_data = nic_data;834 835 rc = ddf_fun_bind(nic_data->fun);836 if (rc != EOK) {837 ddf_fun_destroy(nic_data->fun);838 return rc;839 }840 841 rc = ddf_fun_add_to_category(nic_data->fun, DEVICE_CATEGORY_NIC);842 if (rc != EOK) {843 ddf_fun_destroy(nic_data->fun);844 return rc;845 }846 847 return EOK;848 }849 850 /**851 814 * Set information about current HW filtering. 852 815 * 1 ... Only those frames we want to receive are passed through HW … … 1063 1026 { 1064 1027 return nic_data->fun; 1028 } 1029 1030 /** 1031 * @param nic_data 1032 * @param fun 1033 */ 1034 void nic_set_ddf_fun(nic_t *nic_data, ddf_fun_t *fun) 1035 { 1036 nic_data->fun = fun; 1065 1037 } 1066 1038
Note:
See TracChangeset
for help on using the changeset viewer.