source: rtems/c/src/lib/libbsp/arm/nds/rtc/rtc.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 * RTEMS for Nintendo DS realtime clock driver.
3 *
4 * Copyright (c) 2008 by Cedric Gestes <ctaf42@gmail.com>
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution or at
8 *
9 * http://www.rtems.org/license/LICENSE
10 */
11
12#include <rtems.h>
13#include <libchip/rtc.h>
14#include <bsp.h>
15#include <nds.h>
16
17rtems_device_minor_number RTC_Minor;
18size_t RTC_Count = 1;
19
20/*
21 * probe for a rtc. we always claim to have one.
22 */
23
24bool
25nds_rtc_probe (int minor)
26{
27  return true;
28}
29
30/*
31 * initialize the nds rtc.
32 */
33
34void
35nds_rtc_init (int minor)
36{
37  /* nothing to do here (already done in the arm7 main) */
38  printk ("[+] rtc started\n");
39}
40
41/*
42 * read current time from nds real-time clock chip and convert it
43 * to the rtems_time_of_day structure.
44 */
45
46int
47nds_rtc_get_time (int minor, rtems_time_of_day * time)
48{
49  time->year = 2000 + IPC->time.rtc.year;
50  time->month = IPC->time.rtc.month;
51  time->day = IPC->time.rtc.day;
52  time->hour = IPC->time.rtc.hours;
53  time->minute = IPC->time.rtc.minutes;
54  time->second = IPC->time.rtc.seconds;
55  time->ticks = 0;
56
57  return 0;
58}
59
60/*
61 * set time to the arm7 nds rtc.
62 * NOTE: this is not supported.
63 */
64
65int
66nds_rtc_set_time (int minor, const rtems_time_of_day * time)
67{
68  return -1;
69}
70
71/*
72 * driver function table.
73 */
74
75rtc_fns nds_rtc_fns = {
76  nds_rtc_init,
77  nds_rtc_get_time,
78  nds_rtc_set_time
79};
80
81/*
82 * the following table configures the RTC drivers used in this BSP
83 */
84
85rtc_tbl RTC_Table[] = {
86  {
87   "/dev/rtc",                  /* sDeviceName */
88   RTC_CUSTOM,                  /* deviceType */
89   &nds_rtc_fns,                /* pDeviceFns */
90   nds_rtc_probe,               /* deviceProbe */
91   NULL,                        /* pDeviceParams */
92   0,                           /* ulCtrlPort1 */
93   0,                           /* ulDataPort */
94   NULL,                        /* getRegister */
95   NULL                         /* setRegister */
96   }
97};
Note: See TracBrowser for help on using the repository browser.