[9968efb] | 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> |
---|
[ee306fd] | 13 | #include <libchip/icm7170.h> |
---|
[9968efb] | 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 | |
---|
[308e18c] | 33 | boolean dmv177_icm7170_probe(int minor); |
---|
| 34 | |
---|
[9968efb] | 35 | rtc_tbl RTC_Table[] = { |
---|
| 36 | { |
---|
| 37 | "/dev/rtc0", /* sDeviceName */ |
---|
[ee306fd] | 38 | RTC_ICM7170, /* deviceType */ |
---|
| 39 | &icm7170_fns, /* pDeviceFns */ |
---|
[308e18c] | 40 | dmv177_icm7170_probe, /* deviceProbe */ |
---|
[91af3e4] | 41 | (void *) ICM7170_AT_1_MHZ, /* pDeviceParams */ |
---|
[9968efb] | 42 | DMV170_RTC_ADDRESS, /* ulCtrlPort1 */ |
---|
[52a2cd91] | 43 | 0, /* ulDataPort */ |
---|
[91af3e4] | 44 | icm7170_get_register_8, /* getRegister */ |
---|
| 45 | icm7170_set_register_8, /* setRegister */ |
---|
[9968efb] | 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 | |
---|
[445f8cc] | 55 | size_t RTC_Count = NUM_RTCS; |
---|
[9968efb] | 56 | |
---|
| 57 | rtems_device_minor_number RTC_Minor; |
---|
[308e18c] | 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 | { |
---|
[ed9e449] | 66 | volatile uint16_t *card_resource_reg; |
---|
| 67 | uint16_t v; |
---|
[308e18c] | 68 | |
---|
[ed9e449] | 69 | card_resource_reg = (volatile uint16_t*) DMV170_CARD_RESORCE_REG; |
---|
[308e18c] | 70 | |
---|
[c23118b] | 71 | v = *card_resource_reg & DMV170_RTC_INST_MASK; |
---|
| 72 | |
---|
| 73 | if ( v == DMV170_RTC_INSTALLED ) |
---|
[308e18c] | 74 | return TRUE; |
---|
| 75 | |
---|
| 76 | return FALSE; |
---|
| 77 | } |
---|