BSP and Device Driver Development Guide
The rtc_initialize
routine is responsible for initializing the
RTC chip so it can be used. The shared libchip implementation of this
driver supports multiple RTCs and bases its initialization order on
the order the chips are defined in the RTC_Table
. Each chip
defined in the table may or may not be present on this particular board.
It is the responsibility of the deviceProbe
to indicate the
presence of a particular RTC chip. The first RTC found to be present
is considered the preferred RTC.
In the shared libchip based implementation of the driver, the following actions are performed:
rtems_device_driver rtc_initialize( rtems_device_major_number major, rtems_device_minor_number minor_arg, void *arg ) { for each RTC configured in RTC_Table if the deviceProbe for this RTC indicates it is present set RTC_Minor to this device set RTC_Present to TRUE break out of this loop if RTC_Present is not TRUE return RTEMS_INVALID_NUMBER to indicate that no RTC is present register this minor number as the "/dev/rtc" perform the deviceInitialize routine for the preferred RTC chip for RTCs past this one in the RTC_Table if the deviceProbe for this RTC indicates it is present perform the deviceInitialize routine for this RTC chip register the configured name for this RTC }
The deviceProbe
routine returns TRUE if the device
configured by this entry in the RTC_Table
is present.
This configuration scheme allows one to support multiple versions
of the same board with a single BSP. For example, if the first
generation of a board had Vendor A's RTC chip and the second
generation had Vendor B's RTC chip, RTC_Table could contain
information for both. The deviceProbe
configured
for Vendor A's RTC chip would need to return TRUE if the
board was a first generation one. The deviceProbe
routines are very board dependent and must be provided by
the BSP.
BSP and Device Driver Development Guide
Copyright © 1988-2003 OAR Corporation