Changeset 03362fbd in mainline for uspace/lib/c/generic/device


Ignore:
Timestamp:
2013-02-09T23:14:45Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
22dfd38
Parents:
b5d2e57 (diff), 005b765 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Conflict resulting from bool.h → stdbool.h move and ddf structs turning opaque.
Fails to boot to shell console.

Location:
uspace/lib/c/generic/device
Files:
2 added
1 moved

Legend:

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

    rb5d2e57 r03362fbd  
    11/*
    2  * Copyright (c) 2007 Michal Kebrt
    3  * Copyright (c) 2009 Vineeth Pillai
     2 * Copyright (c) 2012 Maurizio Lombardi
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup arm32gxemul GXemul
    31  *  @brief GXemul machine specific parts.
    32  *  @ingroup arm32
     29 /** @addtogroup libc
    3330 * @{
    3431 */
    3532/** @file
    36  *  @brief GXemul peripheries drivers declarations.
    3733 */
    3834
    39 #ifndef KERN_arm32_testarm_H_
    40 #define KERN_arm32_testarm_H_
     35#include <ipc/dev_iface.h>
     36#include <device/clock_dev.h>
     37#include <errno.h>
     38#include <async.h>
     39#include <time.h>
    4140
    42 #include <arch/machine_func.h>
     41/** Read the current time from the device
     42 *
     43 * @param sess     Session of the device
     44 * @param t        The current time that will be read from the device
     45 *
     46 * @return         EOK on success or a negative error code
     47 */
     48int
     49clock_dev_time_get(async_sess_t *sess, struct tm *t)
     50{
     51        aid_t req;
     52        int ret;
    4353
    44 /** Size of GXemul IRQ number range (starting from 0) */
    45 #define GXEMUL_IRQ_COUNT        32
    46 #define GXEMUL_KBD_IRQ          2
    47 #define GXEMUL_TIMER_IRQ        4
     54        async_exch_t *exch = async_exchange_begin(sess);
    4855
    49 /** Timer frequency */
    50 #define GXEMUL_TIMER_FREQ  100
     56        req = async_send_1(exch, DEV_IFACE_ID(CLOCK_DEV_IFACE),
     57            CLOCK_DEV_TIME_GET, NULL);
     58        ret = async_data_read_start(exch, t, sizeof(*t));
    5159
    52 #define GXEMUL_KBD_ADDRESS   0x10000000
    53 #define GXEMUL_MP_ADDRESS    0x11000000
    54 #define GXEMUL_FB_ADDRESS    0x12000000
    55 #define GXEMUL_RTC_ADDRESS   0x15000000
    56 #define GXEMUL_IRQC_ADDRESS  0x16000000
     60        async_exchange_end(exch);
    5761
    58 extern void *gxemul_kbd;
    59 extern void *gxemul_rtc;
    60 extern void *gxemul_irqc;
     62        sysarg_t rc;
     63        if (ret != EOK) {
     64                async_forget(req);
     65                return ret;
     66        }
    6167
    62 #define GXEMUL_HALT_OFFSET        0x010
    63 #define GXEMUL_RTC_FREQ_OFFSET    0x100
    64 #define GXEMUL_MP_MEMSIZE_OFFSET  0x090
    65 #define GXEMUL_RTC_ACK_OFFSET     0x110
     68        async_wait_for(req, &rc);
     69        return (int)rc;
     70}
    6671
    67 extern void gxemul_init(void);
    68 extern void gxemul_output_init(void);
    69 extern void gxemul_input_init(void);
    70 extern void gxemul_timer_irq_start(void);
    71 extern void gxemul_cpu_halt(void);
    72 extern void gxemul_irq_exception(unsigned int, istate_t *);
    73 extern void gxemul_get_memory_extents(uintptr_t *, size_t *);
    74 extern void gxemul_frame_init(void);
    75 extern size_t gxemul_get_irq_count(void);
    76 extern const char *gxemul_get_platform_name(void);
     72/** Set the current time
     73 *
     74 * @param sess   Session of the device
     75 * @param t      The current time that will be written to the device
     76 *
     77 * @return       EOK on success or a negative error code
     78 */
     79int
     80clock_dev_time_set(async_sess_t *sess, struct tm *t)
     81{
     82        aid_t req;
     83        int ret;
    7784
    78 extern struct arm_machine_ops gxemul_machine_ops;
     85        async_exch_t *exch = async_exchange_begin(sess);
    7986
    80 #endif
     87        req = async_send_1(exch, DEV_IFACE_ID(CLOCK_DEV_IFACE),
     88            CLOCK_DEV_TIME_SET, NULL);
     89        ret = async_data_write_start(exch, t, sizeof(*t));
     90
     91        async_exchange_end(exch);
     92
     93        sysarg_t rc;
     94        if (ret != EOK) {
     95                async_forget(req);
     96                return ret;
     97        }
     98
     99        async_wait_for(req, &rc);
     100        return (int)rc;
     101}
    81102
    82103/** @}
    83104 */
     105
Note: See TracChangeset for help on using the changeset viewer.