Changeset c47f1b6 in mainline


Ignore:
Timestamp:
2012-03-31T11:37:04Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
557b7b3
Parents:
9d5003e0
Message:

RTC: read the I/O address assigned to the device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    r9d5003e0 rc47f1b6  
    5555        /** The fibril mutex for synchronizing the access to the device */
    5656        fibril_mutex_t mutex;
     57        /** The base I/O address of the device registers */
     58        uint32_t io_addr;
    5759} rtc_t;
    5860
     
    7678static driver_ops_t rtc_ops = {
    7779        .dev_add = rtc_dev_add,
    78         .dev_remove = NULL,
     80        .dev_remove = NULL, /* XXX */
    7981};
    8082
     
    9799        ddf_log_init(NAME, LVL_ERROR);
    98100
    99         rtc_dev_ops.open = NULL;
    100         rtc_dev_ops.close = NULL;
     101        rtc_dev_ops.open = NULL; /* XXX */
     102        rtc_dev_ops.close = NULL; /* XXX */
    101103
    102104        rtc_dev_ops.interfaces[CLOCK_DEV_IFACE] = &rtc_clock_dev_ops;
    103         rtc_dev_ops.default_handler = NULL;
     105        rtc_dev_ops.default_handler = NULL; /* XXX */
    104106}
    105107
     
    113115rtc_dev_initialize(rtc_t *rtc)
    114116{
     117        /* XXX Do cleanup in case of failure */
    115118        int rc;
     119        size_t i;
     120        hw_resource_t *res;
     121        bool ioport = false;
    116122
    117123        ddf_msg(LVL_DEBUG, "rtc_dev_initialize %s", rtc->dev->name);
     
    138144        }
    139145
     146        for (i = 0; i < hw_resources.count; ++i) {
     147                res = &hw_resources.resources[i];
     148
     149                if (res->type == IO_RANGE) {
     150                        rtc->io_addr = res->res.io_range.address;
     151                        ioport = true;
     152                        ddf_msg(LVL_NOTE, "Device %s was assigned I/O address \
     153                            0x%x", rtc->dev->name, rtc->io_addr);
     154                }
     155        }
     156
     157        if (!ioport) {
     158                /* No I/O address assigned to this device */
     159                ddf_msg(LVL_ERROR, "Missing HW resource for device %s",
     160                    rtc->dev->name);
     161                return ENOENT;
     162        }
     163
     164        hw_res_clean_resource_list(&hw_resources);
     165
    140166        return EOK;
    141167}
Note: See TracChangeset for help on using the changeset viewer.