Changeset e86b8f0 in mainline for uspace/lib/nic


Ignore:
Timestamp:
2012-01-21T12:50:28Z (14 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.

Location:
uspace/lib/nic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/include/nic.h

    r3fe58d3c re86b8f0  
    4444#include <ops/nic.h>
    4545
     46#define DEVICE_CATEGORY_NIC "nic"
     47
    4648struct nic;
    4749typedef struct nic nic_t;
     
    204206/* Functions called in add_device */
    205207extern int nic_connect_to_services(nic_t *);
    206 extern int nic_register_as_ddf_fun(nic_t *, ddf_dev_ops_t *);
    207208extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *);
    208209extern void nic_set_specific(nic_t *, void *);
     
    225226extern ddf_dev_t *nic_get_ddf_dev(nic_t *);
    226227extern ddf_fun_t *nic_get_ddf_fun(nic_t *);
     228extern void nic_set_ddf_fun(nic_t *, ddf_fun_t *);
    227229extern nic_t *nic_get_from_ddf_dev(ddf_dev_t *);
    228230extern nic_t *nic_get_from_ddf_fun(ddf_fun_t *);
  • uspace/lib/nic/include/nic_driver.h

    r3fe58d3c re86b8f0  
    5050#include "nic_rx_control.h"
    5151#include "nic_wol_virtues.h"
    52 
    53 #define DEVICE_CATEGORY_NIC "nic"
    5452
    5553struct sw_poll_info {
  • 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.