Changeset 83a2f43 in mainline for uspace/drv


Ignore:
Timestamp:
2011-02-15T19:43:50Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
af6b5157
Parents:
34588a80
Message:

Rename bunch of stuff so that it starts with 'ddf_'.

Location:
uspace/drv
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/isa/isa.c

    r34588a80 r83a2f43  
    6868
    6969typedef struct isa_fun {
    70         function_t *fnode;
     70        ddf_fun_t *fnode;
    7171        hw_resource_list_t hw_resources;
    7272} isa_fun_t;
    7373
    74 static hw_resource_list_t *isa_get_fun_resources(function_t *fnode)
     74static hw_resource_list_t *isa_get_fun_resources(ddf_fun_t *fnode)
    7575{
    7676        isa_fun_t *fun = ISA_FUN(fnode);
     
    8080}
    8181
    82 static bool isa_enable_fun_interrupt(function_t *fnode)
     82static bool isa_enable_fun_interrupt(ddf_fun_t *fnode)
    8383{
    8484        // TODO
     
    9292};
    9393
    94 static device_ops_t isa_fun_ops;
    95 
    96 static int isa_add_device(device_t *dev);
     94static ddf_dev_ops_t isa_fun_ops;
     95
     96static int isa_add_device(ddf_dev_t *dev);
    9797
    9898/** The isa device driver's standard operations */
     
    107107};
    108108
    109 static isa_fun_t *isa_fun_create(device_t *dev, const char *name)
     109static isa_fun_t *isa_fun_create(ddf_dev_t *dev, const char *name)
    110110{
    111111        isa_fun_t *fun = calloc(1, sizeof(isa_fun_t));
     
    113113                return NULL;
    114114
    115         function_t *fnode = ddf_fun_create(dev, fun_inner, name);
     115        ddf_fun_t *fnode = ddf_fun_create(dev, fun_inner, name);
    116116        if (fnode == NULL) {
    117117                free(fun);
     
    388388}
    389389
    390 static char *isa_fun_read_info(char *fun_conf, device_t *dev)
     390static char *isa_fun_read_info(char *fun_conf, ddf_dev_t *dev)
    391391{
    392392        char *line;
     
    447447}
    448448
    449 static void fun_conf_parse(char *conf, device_t *dev)
     449static void fun_conf_parse(char *conf, ddf_dev_t *dev)
    450450{
    451451        while (conf != NULL && *conf != '\0') {
     
    454454}
    455455
    456 static void isa_functions_add(device_t *dev)
     456static void isa_functions_add(ddf_dev_t *dev)
    457457{
    458458        char *fun_conf;
     
    465465}
    466466
    467 static int isa_add_device(device_t *dev)
     467static int isa_add_device(ddf_dev_t *dev)
    468468{
    469469        printf(NAME ": isa_add_device, device handle = %d\n",
     
    473473        printf(NAME ": adding a 'ctl' function\n");
    474474
    475         function_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
     475        ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
    476476        if (ctl == NULL) {
    477477                printf(NAME ": Error creating control function.\n");
     
    500500        printf(NAME ": HelenOS ISA bus driver\n");
    501501        isa_init();
    502         return driver_main(&isa_driver);
     502        return ddf_driver_main(&isa_driver);
    503503}
    504504
  • uspace/drv/ns8250/ns8250.c

    r34588a80 r83a2f43  
    9494typedef struct ns8250 {
    9595        /** DDF device node */
    96         device_t *dev;
     96        ddf_dev_t *dev;
    9797        /** DDF function node */
    98         function_t *fun;
     98        ddf_fun_t *fun;
    9999        /** Is there any client conntected to the device? */
    100100        bool client_connected;
     
    189189 *                      error number otherwise.
    190190 */
    191 static int ns8250_read(function_t *fun, char *buf, size_t count)
     191static int ns8250_read(ddf_fun_t *fun, char *buf, size_t count)
    192192{
    193193        ns8250_t *ns = NS8250(fun);
     
    223223 * @return              Zero on success
    224224 */
    225 static int ns8250_write(function_t *fun, char *buf, size_t count)
     225static int ns8250_write(ddf_fun_t *fun, char *buf, size_t count)
    226226{
    227227        ns8250_t *ns = NS8250(fun);
     
    234234}
    235235
    236 static device_ops_t ns8250_dev_ops;
     236static ddf_dev_ops_t ns8250_dev_ops;
    237237
    238238/** The character interface's callbacks. */
     
    242242};
    243243
    244 static int ns8250_add_device(device_t *dev);
     244static int ns8250_add_device(ddf_dev_t *dev);
    245245
    246246/** The serial port device driver's standard operations. */
     
    675675 * @param dev           The serial port device.
    676676 */
    677 static inline void ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid,
     677static inline void ns8250_interrupt_handler(ddf_dev_t *dev, ipc_callid_t iid,
    678678    ipc_call_t *icall)
    679679{
     
    706706 * @param dev           The serial port device.
    707707 */
    708 static int ns8250_add_device(device_t *dev)
     708static int ns8250_add_device(ddf_dev_t *dev)
    709709{
    710710        ns8250_t *ns = NULL;
    711         function_t *fun = NULL;
     711        ddf_fun_t *fun = NULL;
    712712        bool need_cleanup = false;
    713713        int rc;
     
    777777        ns->fun = fun;
    778778       
    779         add_function_to_class(fun, "serial");
     779        ddf_fun_add_to_class(fun, "serial");
    780780       
    781781        printf(NAME ": the %s device has been successfully initialized.\n",
     
    800800 * @param dev           The device.
    801801 */
    802 static int ns8250_open(function_t *fun)
     802static int ns8250_open(ddf_fun_t *fun)
    803803{
    804804        ns8250_t *data = (ns8250_t *) fun->dev->driver_data;
     
    824824 * @param dev           The device.
    825825 */
    826 static void ns8250_close(function_t *fun)
     826static void ns8250_close(ddf_fun_t *fun)
    827827{
    828828        ns8250_t *data = (ns8250_t *) fun->dev->driver_data;
     
    848848 */
    849849static void
    850 ns8250_get_props(device_t *dev, unsigned int *baud_rate, unsigned int *parity,
     850ns8250_get_props(ddf_dev_t *dev, unsigned int *baud_rate, unsigned int *parity,
    851851    unsigned int *word_length, unsigned int* stop_bits)
    852852{
     
    875875 * @param stop_bits     The number of stop bits to be used.
    876876 */
    877 static int ns8250_set_props(device_t *dev, unsigned int baud_rate,
     877static int ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
    878878    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
    879879{
     
    902902 * Configure the parameters of the serial communication.
    903903 */
    904 static void ns8250_default_handler(function_t *fun, ipc_callid_t callid,
     904static void ns8250_default_handler(ddf_fun_t *fun, ipc_callid_t callid,
    905905    ipc_call_t *call)
    906906{
     
    950950        printf(NAME ": HelenOS serial port driver\n");
    951951        ns8250_init();
    952         return driver_main(&ns8250_driver);
     952        return ddf_driver_main(&ns8250_driver);
    953953}
    954954
  • uspace/drv/pciintel/pci.c

    r34588a80 r83a2f43  
    7272#define PCI_BUS_FROM_FUN(fun) ((fun)->busptr)
    7373
    74 static hw_resource_list_t *pciintel_get_resources(function_t *fnode)
     74static hw_resource_list_t *pciintel_get_resources(ddf_fun_t *fnode)
    7575{
    7676        pci_fun_t *fun = PCI_FUN(fnode);
     
    8181}
    8282
    83 static bool pciintel_enable_interrupt(function_t *fnode)
     83static bool pciintel_enable_interrupt(ddf_fun_t *fnode)
    8484{
    8585        /* TODO */
     
    9393};
    9494
    95 static device_ops_t pci_fun_ops;
    96 
    97 static int pci_add_device(device_t *);
     95static ddf_dev_ops_t pci_fun_ops;
     96
     97static int pci_add_device(ddf_dev_t *);
    9898
    9999/** PCI bus driver standard operations */
     
    367367void pci_bus_scan(pci_bus_t *bus, int bus_num)
    368368{
    369         function_t *fnode;
     369        ddf_fun_t *fnode;
    370370        pci_fun_t *fun;
    371371       
     
    459459}
    460460
    461 static int pci_add_device(device_t *dnode)
     461static int pci_add_device(ddf_dev_t *dnode)
    462462{
    463463        pci_bus_t *bus = NULL;
    464         function_t *ctl = NULL;
     464        ddf_fun_t *ctl = NULL;
    465465        bool got_res = false;
    466466        int rc;
     
    633633        printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
    634634        pciintel_init();
    635         return driver_main(&pci_driver);
     635        return ddf_driver_main(&pci_driver);
    636636}
    637637
  • uspace/drv/pciintel/pci.h

    r34588a80 r83a2f43  
    4747typedef struct pciintel_bus {
    4848        /** DDF device node */
    49         device_t *dnode;
     49        ddf_dev_t *dnode;
    5050        uint32_t conf_io_addr;
    5151        void *conf_data_port;
     
    5656typedef struct pci_fun_data {
    5757        pci_bus_t *busptr;
    58         function_t *fnode;
     58        ddf_fun_t *fnode;
    5959
    6060        int bus;
  • uspace/drv/root/root.c

    r34588a80 r83a2f43  
    6565#define VIRTUAL_FUN_MATCH_SCORE 100
    6666
    67 static int root_add_device(device_t *dev);
     67static int root_add_device(ddf_dev_t *dev);
    6868
    6969/** The root device driver's standard operations. */
     
    8383 * @return      EOK on success or negative error code
    8484 */
    85 static int add_virtual_root_fun(device_t *dev)
     85static int add_virtual_root_fun(ddf_dev_t *dev)
    8686{
    8787        const char *name = VIRTUAL_FUN_NAME;
    88         function_t *fun;
     88        ddf_fun_t *fun;
    8989        int rc;
    9090
     
    123123 * @return      EOK on success or negative error code
    124124 */
    125 static int add_platform_fun(device_t *dev)
     125static int add_platform_fun(ddf_dev_t *dev)
    126126{
    127127        char *match_id;
     
    130130
    131131        const char *name = PLATFORM_FUN_NAME;
    132         function_t *fun;
     132        ddf_fun_t *fun;
    133133        int rc;
    134134
     
    189189 *                      of HW and pseudo devices).
    190190 */
    191 static int root_add_device(device_t *dev)
     191static int root_add_device(ddf_dev_t *dev)
    192192{
    193193        printf(NAME ": root_add_device, device handle=%" PRIun "\n",
     
    212212{
    213213        printf(NAME ": HelenOS root device driver\n");
    214         return driver_main(&root_driver);
     214        return ddf_driver_main(&root_driver);
    215215}
    216216
  • uspace/drv/rootpc/rootpc.c

    r34588a80 r83a2f43  
    6262} rootpc_fun_t;
    6363
    64 static int rootpc_add_device(device_t *dev);
     64static int rootpc_add_device(ddf_dev_t *dev);
    6565static void root_pc_init(void);
    6666
     
    9292};
    9393
    94 static hw_resource_list_t *rootpc_get_resources(function_t *fnode)
     94static hw_resource_list_t *rootpc_get_resources(ddf_fun_t *fnode)
    9595{
    9696        rootpc_fun_t *fun = ROOTPC_FUN(fnode);
     
    100100}
    101101
    102 static bool rootpc_enable_interrupt(function_t *fun)
     102static bool rootpc_enable_interrupt(ddf_fun_t *fun)
    103103{
    104104        /* TODO */
     
    113113
    114114/* Initialized in root_pc_init() function. */
    115 static device_ops_t rootpc_fun_ops;
     115static ddf_dev_ops_t rootpc_fun_ops;
    116116
    117117static bool
    118 rootpc_add_fun(device_t *dev, const char *name, const char *str_match_id,
     118rootpc_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
    119119    rootpc_fun_t *fun)
    120120{
    121121        printf(NAME ": adding new function '%s'.\n", name);
    122122       
    123         function_t *fnode = NULL;
     123        ddf_fun_t *fnode = NULL;
    124124        match_id_t *match_id = NULL;
    125125       
     
    164164}
    165165
    166 static bool rootpc_add_functions(device_t *dev)
     166static bool rootpc_add_functions(ddf_dev_t *dev)
    167167{
    168168        return rootpc_add_fun(dev, "pci0", "intel_pci", &pci_data);
     
    175175 * @return              Zero on success, negative error number otherwise.
    176176 */
    177 static int rootpc_add_device(device_t *dev)
     177static int rootpc_add_device(ddf_dev_t *dev)
    178178{
    179179        printf(NAME ": rootpc_add_device, device handle = %d\n",
     
    197197        printf(NAME ": HelenOS PC platform driver\n");
    198198        root_pc_init();
    199         return driver_main(&rootpc_driver);
     199        return ddf_driver_main(&rootpc_driver);
    200200}
    201201
  • uspace/drv/rootvirt/rootvirt.c

    r34588a80 r83a2f43  
    6161};
    6262
    63 static int rootvirt_add_device(device_t *dev);
     63static int rootvirt_add_device(ddf_dev_t *dev);
    6464
    6565static driver_ops_t rootvirt_ops = {
     
    7878 * @return              EOK on success or negative error code.
    7979 */
    80 static int rootvirt_add_fun(device_t *vdev, virtual_function_t *vfun)
     80static int rootvirt_add_fun(ddf_dev_t *vdev, virtual_function_t *vfun)
    8181{
    82         function_t *fun;
     82        ddf_fun_t *fun;
    8383        int rc;
    8484
     
    112112}
    113113
    114 static int rootvirt_add_device(device_t *dev)
     114static int rootvirt_add_device(ddf_dev_t *dev)
    115115{
    116116        static int instances = 0;
     
    142142{
    143143        printf(NAME ": HelenOS virtual devices root driver\n");
    144         return driver_main(&rootvirt_driver);
     144        return ddf_driver_main(&rootvirt_driver);
    145145}
    146146
  • uspace/drv/test1/char.c

    r34588a80 r83a2f43  
    3737#include "test1.h"
    3838
    39 static int impl_char_read(function_t *fun, char *buf, size_t count) {
     39static int impl_char_read(ddf_fun_t *fun, char *buf, size_t count) {
    4040        memset(buf, 0, count);
    4141        return count;
    4242}
    4343
    44 static int imp_char_write(function_t *fun, char *buf, size_t count) {
     44static int imp_char_write(ddf_fun_t *fun, char *buf, size_t count) {
    4545        return count;
    4646}
     
    5151};
    5252
    53 device_ops_t char_device_ops = {
     53ddf_dev_ops_t char_device_ops = {
    5454        .interfaces[CHAR_DEV_IFACE] = &char_dev_ops
    5555};
  • uspace/drv/test1/test1.c

    r34588a80 r83a2f43  
    3636#include "test1.h"
    3737
    38 static int test1_add_device(device_t *dev);
     38static int test1_add_device(ddf_dev_t *dev);
    3939
    4040static driver_ops_t driver_ops = {
     
    5555 * @param score Device match score.
    5656 */
    57 static int register_fun_verbose(device_t *parent, const char *message,
     57static int register_fun_verbose(ddf_dev_t *parent, const char *message,
    5858    const char *name, const char *match_id, int match_score)
    5959{
    60         function_t *fun;
     60        ddf_fun_t *fun;
    6161        int rc;
    6262
     
    105105 * @return Error code reporting success of the operation.
    106106 */
    107 static int test1_add_device(device_t *dev)
     107static int test1_add_device(ddf_dev_t *dev)
    108108{
    109         function_t *fun_a;
     109        ddf_fun_t *fun_a;
    110110        int rc;
    111111
     
    125125        }
    126126
    127         add_function_to_class(fun_a, "virtual");
     127        ddf_fun_add_to_class(fun_a, "virtual");
    128128
    129129        if (str_cmp(dev->name, "null") == 0) {
    130130                fun_a->ops = &char_device_ops;
    131                 add_function_to_class(fun_a, "virt-null");
     131                ddf_fun_add_to_class(fun_a, "virt-null");
    132132        } else if (str_cmp(dev->name, "test1") == 0) {
    133133                (void) register_fun_verbose(dev, "cloning myself ;-)", "clone",
     
    146146{
    147147        printf(NAME ": HelenOS test1 virtual device driver\n");
    148         return driver_main(&test1_driver);
     148        return ddf_driver_main(&test1_driver);
    149149}
    150150
  • uspace/drv/test1/test1.h

    r34588a80 r83a2f43  
    3636#define NAME "test1"
    3737
    38 extern device_ops_t char_device_ops;
     38extern ddf_dev_ops_t char_device_ops;
    3939
    4040#endif
  • uspace/drv/test2/test2.c

    r34588a80 r83a2f43  
    3838#define NAME "test2"
    3939
    40 static int test2_add_device(device_t *dev);
     40static int test2_add_device(ddf_dev_t *dev);
    4141
    4242static driver_ops_t driver_ops = {
     
    5757 * @param score Device match score.
    5858 */
    59 static int register_fun_verbose(device_t *parent, const char *message,
     59static int register_fun_verbose(ddf_dev_t *parent, const char *message,
    6060    const char *name, const char *match_id, int match_score)
    6161{
    62         function_t *fun;
     62        ddf_fun_t *fun;
    6363        int rc;
    6464
     
    9292/** Add child devices after some sleep.
    9393 *
    94  * @param arg Parent device structure (device_t *).
     94 * @param arg Parent device structure (ddf_dev_t *).
    9595 * @return Always EOK.
    9696 */
    9797static int postponed_birth(void *arg)
    9898{
    99         device_t *dev = (device_t *) arg;
    100         function_t *fun_a;
     99        ddf_dev_t *dev = (ddf_dev_t *) arg;
     100        ddf_fun_t *fun_a;
    101101        int rc;
    102102
     
    120120        }
    121121
    122         add_function_to_class(fun_a, "virtual");
     122        ddf_fun_add_to_class(fun_a, "virtual");
    123123
    124124        return EOK;
    125125}
    126126
    127 static int test2_add_device(device_t *dev)
     127static int test2_add_device(ddf_dev_t *dev)
    128128{
    129129        printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n",
     
    148148{
    149149        printf(NAME ": HelenOS test2 virtual device driver\n");
    150         return driver_main(&test2_driver);
     150        return ddf_driver_main(&test2_driver);
    151151}
    152152
Note: See TracChangeset for help on using the changeset viewer.