Changeset 2a37b9f in mainline for uspace/drv/platform/amdm37x/main.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/amdm37x/main.c

    r0ddb84b r2a37b9f  
    4545#include "amdm37x.h"
    4646
    47 #define NAME  "rootamdm37x"
     47#define NAME  "amdm37x"
    4848
    4949typedef struct {
     
    5151        match_id_t match_id;
    5252        hw_resource_list_t hw_resources;
    53 } rootamdm37x_fun_t;
     53} amdm37x_fun_t;
    5454
    5555/* See amdm37x TRM page 3316 for these values */
     
    130130};
    131131
    132 static const rootamdm37x_fun_t amdm37x_funcs[] = {
     132static const amdm37x_fun_t amdm37x_funcs[] = {
    133133{
    134134        .name = "ohci",
     
    149149
    150150
    151 static hw_resource_list_t *rootamdm37x_get_resources(ddf_fun_t *fnode);
    152 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun);
     151static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode);
     152static bool amdm37x_enable_interrupt(ddf_fun_t *fun);
    153153
    154154static hw_res_ops_t fun_hw_res_ops = {
    155         .get_resource_list = &rootamdm37x_get_resources,
    156         .enable_interrupt = &rootamdm37x_enable_interrupt,
    157 };
    158 
    159 static ddf_dev_ops_t rootamdm37x_fun_ops = {
     155        .get_resource_list = &amdm37x_get_resources,
     156        .enable_interrupt = &amdm37x_enable_interrupt,
     157};
     158
     159static ddf_dev_ops_t amdm37x_fun_ops = {
    160160        .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops
    161161};
    162162
    163 static int rootamdm37x_add_fun(ddf_dev_t *dev, const rootamdm37x_fun_t *fun)
     163static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
    164164{
    165165        assert(dev);
     
    182182       
    183183        /* Alloc needed data */
    184         rootamdm37x_fun_t *rf =
    185             ddf_fun_data_alloc(fnode, sizeof(rootamdm37x_fun_t));
     184        amdm37x_fun_t *rf =
     185            ddf_fun_data_alloc(fnode, sizeof(amdm37x_fun_t));
    186186        if (!rf) {
    187187                ddf_fun_destroy(fnode);
     
    191191
    192192        /* Set provided operations to the device. */
    193         ddf_fun_set_ops(fnode, &rootamdm37x_fun_ops);
     193        ddf_fun_set_ops(fnode, &amdm37x_fun_ops);
    194194       
    195195        /* Register function. */
     
    212212 *
    213213 */
    214 static int rootamdm37x_dev_add(ddf_dev_t *dev)
     214static int amdm37x_dev_add(ddf_dev_t *dev)
    215215{
    216216        assert(dev);
     
    240240        /* Register functions */
    241241        for (unsigned i = 0; i < ARRAY_SIZE(amdm37x_funcs); ++i) {
    242                 if (rootamdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)
     242                if (amdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)
    243243                        ddf_msg(LVL_ERROR, "Failed to add %s function for "
    244244                            "BeagleBoard-xM platform.", amdm37x_funcs[i].name);
     
    248248
    249249/** The root device driver's standard operations. */
    250 static driver_ops_t rootamdm37x_ops = {
    251         .dev_add = &rootamdm37x_dev_add
     250static driver_ops_t amdm37x_ops = {
     251        .dev_add = &amdm37x_dev_add
    252252};
    253253
    254254/** The root device driver structure. */
    255 static driver_t rootamdm37x_driver = {
     255static driver_t amdm37x_driver = {
    256256        .name = NAME,
    257         .driver_ops = &rootamdm37x_ops
    258 };
    259 
    260 static hw_resource_list_t * rootamdm37x_get_resources(ddf_fun_t *fnode)
    261 {
    262         rootamdm37x_fun_t *fun = ddf_fun_data_get(fnode);
     257        .driver_ops = &amdm37x_ops
     258};
     259
     260static hw_resource_list_t * amdm37x_get_resources(ddf_fun_t *fnode)
     261{
     262        amdm37x_fun_t *fun = ddf_fun_data_get(fnode);
    263263        assert(fun != NULL);
    264264        return &fun->hw_resources;
    265265}
    266266
    267 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun)
     267static bool amdm37x_enable_interrupt(ddf_fun_t *fun)
    268268{
    269269        //TODO: Implement
     
    275275        printf("%s: HelenOS AM/DM37x(OMAP37x) platform driver\n", NAME);
    276276        ddf_log_init(NAME);
    277         return ddf_driver_main(&rootamdm37x_driver);
     277        return ddf_driver_main(&amdm37x_driver);
    278278}
    279279
Note: See TracChangeset for help on using the changeset viewer.