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

Changeset 2703b824 in mainline


Ignore:
Timestamp:
2012-04-15T22:36:04Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
709476f4
Parents:
f6af126
Message:

rtc: add support to the clock_dev_time_set() operation

Location:
uspace/lib/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/clock_dev.c

    rf6af126 r2703b824  
    7575}
    7676
     77/** Set the current time
     78 *
     79 * @param sess   Session of the device
     80 * @param t      The current time that will be written to the device
     81 *
     82 * @return       EOK on success or a negative error code
     83 */
     84int
     85clock_dev_time_set(async_sess_t *sess, struct tm *t)
     86{
     87        ipc_call_t answer;
     88        aid_t req;
     89        int ret;
     90
     91        async_exch_t *exch = async_exchange_begin(sess);
     92
     93        req = async_send_1(exch, DEV_IFACE_ID(CLOCK_DEV_IFACE),
     94            CLOCK_DEV_TIME_SET, &answer);
     95        ret = async_data_write_start(exch, t, sizeof(*t));
     96
     97        async_exchange_end(exch);
     98
     99        sysarg_t rc;
     100        if (ret != EOK) {
     101                async_wait_for(req, &rc);
     102                if (rc == EOK)
     103                        return ret;
     104        }
     105
     106        async_wait_for(req, &rc);
     107        if ((int) rc != EOK)
     108                return ret;
     109
     110        return (int) IPC_GET_ARG1(answer);
     111}
     112
    77113/** @}
    78114 */
  • uspace/lib/c/include/device/clock_dev.h

    rf6af126 r2703b824  
    4545
    4646extern int clock_dev_time_get(async_sess_t *, struct tm *);
     47extern int clock_dev_time_set(async_sess_t *, struct tm *);
    4748
    4849#endif
Note: See TracChangeset for help on using the changeset viewer.