Ignore:
Timestamp:
2012-04-15T22:36: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:
709476f4
Parents:
f6af126
Message:

rtc: add support to the clock_dev_time_set() operation

File:
1 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 */
Note: See TracChangeset for help on using the changeset viewer.