Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 6b329749 in mainline


Ignore:
Timestamp:
2012-03-30T13:24:02Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
0b8a3e7
Parents:
a31ca11f
Message:

RTC: add a fibril mutex to synchronize the access to the real time clock and
initialize it in the rtc_dev_add function.

File:
1 edited

Legend:

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

    ra31ca11f r6b329749  
    4242#include <ddf/log.h>
    4343#include <ops/clock.h>
     44#include <fibril_synch.h>
    4445
    4546#define NAME "RTC"
     
    8081        /** DDF function node */
    8182        ddf_fun_t *fun;
     83        /** The fibril mutex for synchronizing the access to the device */
     84        fibril_mutex_t mutex;
    8285} rtc_t;
    8386
     
    117120rtc_dev_add(ddf_dev_t *dev)
    118121{
     122        rtc_t *rtc;
     123
     124        ddf_msg(LVL_DEBUG, "rtc_dev_add %s (handle = %d)",
     125            dev->name, (int) dev->handle);
     126
     127        rtc = ddf_dev_data_alloc(dev, sizeof(rtc_t));
     128        if (!rtc)
     129                return ENOMEM;
     130
     131        rtc->dev = dev;
     132        fibril_mutex_initialize(&rtc->mutex);
     133
    119134        return EOK;
    120135}
Note: See TracChangeset for help on using the changeset viewer.