Changeset e86b8f0 in mainline for uspace/lib/nic/src/nic_driver.c


Ignore:
Timestamp:
2012-01-21T12:50:28Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77a69ea, 86c71de
Parents:
3fe58d3c
Message:

Create DDF functions manually.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_driver.c

    r3fe58d3c re86b8f0  
    812812
    813813/**
    814  * Creates an exposed DDF function for the device, named "port0".
    815  * Device options are set as this function's options. The function is bound
    816  * (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, therefore
    818  * we don't need to use locks.
    819  *
    820  * @param nic_data      The NIC structure
    821  * @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 /**
    851814 * Set information about current HW filtering.
    852815 *  1 ...       Only those frames we want to receive are passed through HW
     
    10631026{
    10641027        return nic_data->fun;
     1028}
     1029
     1030/**
     1031 * @param nic_data
     1032 * @param fun
     1033 */
     1034void nic_set_ddf_fun(nic_t *nic_data, ddf_fun_t *fun)
     1035{
     1036        nic_data->fun = fun;
    10651037}
    10661038
Note: See TracChangeset for help on using the changeset viewer.