Changeset 2a37b9f in mainline for uspace/drv/platform/mac/mac.c


Ignore:
Timestamp:
2014-08-28T19:54:48Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f2a9be
Parents:
0ddb84b
Message:

Reorganize platform drivers.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/mac/mac.c

    r0ddb84b r2a37b9f  
    4242#include <stdio.h>
    4343
    44 #define NAME  "rootmac"
     44#define NAME  "mac"
    4545
    4646typedef struct {
    4747        hw_resource_list_t hw_resources;
    48 } rootmac_fun_t;
     48} mac_fun_t;
    4949
    5050static hw_resource_t pci_conf_regs[] = {
     
    6969};
    7070
    71 static rootmac_fun_t pci_data = {
     71static mac_fun_t pci_data = {
    7272        .hw_resources = {
    7373                2,
     
    7676};
    7777
    78 static ddf_dev_ops_t rootmac_fun_ops;
     78static ddf_dev_ops_t mac_fun_ops;
    7979
    8080/** Obtain function soft-state from DDF function node */
    81 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)
     81static mac_fun_t *mac_fun(ddf_fun_t *fnode)
    8282{
    8383        return ddf_fun_data_get(fnode);
    8484}
    8585
    86 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,
    87     const char *str_match_id, rootmac_fun_t *fun_proto)
     86static bool mac_add_fun(ddf_dev_t *dev, const char *name,
     87    const char *str_match_id, mac_fun_t *fun_proto)
    8888{
    8989        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     
    9797                goto failure;
    9898       
    99         rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t));
     99        mac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(mac_fun_t));
    100100        *fun = *fun_proto;
    101101       
     
    106106       
    107107        /* Set provided operations to the device. */
    108         ddf_fun_set_ops(fnode, &rootmac_fun_ops);
     108        ddf_fun_set_ops(fnode, &mac_fun_ops);
    109109       
    110110        /* Register function. */
     
    133133 *
    134134 */
    135 static int rootmac_dev_add(ddf_dev_t *dev)
     135static int mac_dev_add(ddf_dev_t *dev)
    136136{
    137137#if 0
    138138        /* Register functions */
    139         if (!rootmac_add_fun(dev, "pci0", "intel_pci", &pci_data))
     139        if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data))
    140140                ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
    141141#else
    142142        (void)pci_data;
    143         (void)rootmac_add_fun;
     143        (void)mac_add_fun;
    144144#endif
    145145       
     
    148148
    149149/** The root device driver's standard operations. */
    150 static driver_ops_t rootmac_ops = {
    151         .dev_add = &rootmac_dev_add
     150static driver_ops_t mac_ops = {
     151        .dev_add = &mac_dev_add
    152152};
    153153
    154154/** The root device driver structure. */
    155 static driver_t rootmac_driver = {
     155static driver_t mac_driver = {
    156156        .name = NAME,
    157         .driver_ops = &rootmac_ops
     157        .driver_ops = &mac_ops
    158158};
    159159
    160 static hw_resource_list_t *rootmac_get_resources(ddf_fun_t *fnode)
     160static hw_resource_list_t *mac_get_resources(ddf_fun_t *fnode)
    161161{
    162         rootmac_fun_t *fun = rootmac_fun(fnode);
     162        mac_fun_t *fun = mac_fun(fnode);
    163163        assert(fun != NULL);
    164164       
     
    166166}
    167167
    168 static bool rootmac_enable_interrupt(ddf_fun_t *fun)
     168static bool mac_enable_interrupt(ddf_fun_t *fun)
    169169{
    170170        /* TODO */
     
    174174
    175175static hw_res_ops_t fun_hw_res_ops = {
    176         .get_resource_list = &rootmac_get_resources,
    177         .enable_interrupt = &rootmac_enable_interrupt
     176        .get_resource_list = &mac_get_resources,
     177        .enable_interrupt = &mac_enable_interrupt
    178178};
    179179
     
    182182        printf("%s: HelenOS Mac platform driver\n", NAME);
    183183        ddf_log_init(NAME);
    184         rootmac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    185         return ddf_driver_main(&rootmac_driver);
     184        mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
     185        return ddf_driver_main(&mac_driver);
    186186}
    187187
Note: See TracChangeset for help on using the changeset viewer.