1 | /* |
---|
2 | * This file contains the RTC driver table for the DY-4 DMV177. |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * $Id$ |
---|
8 | */ |
---|
9 | |
---|
10 | #include <bsp.h> |
---|
11 | |
---|
12 | #include <libchip/rtc.h> |
---|
13 | #include <libchip/icm7170.h> |
---|
14 | |
---|
15 | /* |
---|
16 | * Configuration specific probe routines |
---|
17 | * |
---|
18 | * NOTE: There are no DMV177 specific configuration routines. These |
---|
19 | * routines could be written to dynamically determine what type |
---|
20 | * of real-time clock is on this board. This would be useful for |
---|
21 | * a BSP supporting multiple board models. |
---|
22 | */ |
---|
23 | |
---|
24 | /* NONE CURRENTLY PROVIDED */ |
---|
25 | |
---|
26 | /* |
---|
27 | * The following table configures the RTC drivers used in this BSP. |
---|
28 | * |
---|
29 | * The first entry which, when probed, is available, will be named /dev/rtc, |
---|
30 | * all others being given the name indicated. |
---|
31 | */ |
---|
32 | |
---|
33 | boolean dmv177_icm7170_probe(int minor); |
---|
34 | |
---|
35 | rtc_tbl RTC_Table[] = { |
---|
36 | { |
---|
37 | "/dev/rtc0", /* sDeviceName */ |
---|
38 | RTC_ICM7170, /* deviceType */ |
---|
39 | &icm7170_fns, /* pDeviceFns */ |
---|
40 | dmv177_icm7170_probe, /* deviceProbe */ |
---|
41 | (void *) ICM7170_AT_1_MHZ, /* pDeviceParams */ |
---|
42 | DMV170_RTC_ADDRESS, /* ulCtrlPort1 */ |
---|
43 | 0, /* ulDataPort */ |
---|
44 | icm7170_get_register_8, /* getRegister */ |
---|
45 | icm7170_set_register_8, /* setRegister */ |
---|
46 | } |
---|
47 | }; |
---|
48 | |
---|
49 | /* |
---|
50 | * Declare some information used by the RTC driver |
---|
51 | */ |
---|
52 | |
---|
53 | #define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl)) |
---|
54 | |
---|
55 | unsigned long RTC_Count = NUM_RTCS; |
---|
56 | |
---|
57 | rtems_device_minor_number RTC_Minor; |
---|
58 | |
---|
59 | /* |
---|
60 | * Hopefully, by checking the card resource register, this BSP |
---|
61 | * will be able to operate on the DMV171, DMV176, or DMV177. |
---|
62 | */ |
---|
63 | |
---|
64 | boolean dmv177_icm7170_probe(int minor) |
---|
65 | { |
---|
66 | volatile uint16_t *card_resource_reg; |
---|
67 | uint16_t v; |
---|
68 | |
---|
69 | card_resource_reg = (volatile uint16_t*) DMV170_CARD_RESORCE_REG; |
---|
70 | |
---|
71 | v = *card_resource_reg & DMV170_RTC_INST_MASK; |
---|
72 | |
---|
73 | if ( v == DMV170_RTC_INSTALLED ) |
---|
74 | return TRUE; |
---|
75 | |
---|
76 | return FALSE; |
---|
77 | } |
---|