This package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1390 provides a device driver for the wallclock device in the Dallas DS1390 Serial Real-Time Clock chips. The driver can also be used with any other chips that provide the same interface to the clock hardware.
The package will usually be loaded into the configuration automatically whenever selecting a target which contains a compatible chip. By default it will provide the standard eCos wallclock device, although another implementation such as software emulation may be selected if desired. The only other configuration options related to this package allow users to change the compiler flags. If the application does not actually use the wallclock device, directly or indirectly, then the code should get removed automatically at link-time to ensure that the application does not suffer any unnecessary overheads.
This wallclock device driver package implements the standard
functionality required by the generic wallclock support
CYGPKG_IO_WALLCLOCK. The functionality is not
normally accessed directly. Instead it is used by the C library time
package to implement standard calls such as time
and gmtime. The eCos C library also provides a
non-standard function cyg_libc_time_settime for
changing the current wallclock setting. In addition RedBoot provides
a date command which interacts with the wallclock
device.
The DS1390 driver uses the SPI driver API defined by the
package CYGPKG_IO_SPI. A suitable SPI device driver
must be available for the target. The platform HAL must
provide a cyg_spi_device structure
cyg_spi_wallclock_ds1390. The platform HAL should
initialize this structure and any associated SPI driver specific
struture with the correct phase, polarity and chip select parameters
for this device.
In addition the DS1390 device driver package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1390 should be included in the CDL target entry so that it gets loaded automatically whenever eCos is configured for that target.
In addition to the standard wallclock API calls, this driver exports a number of additional functions to permit direct access to additional features of the device. A header, cyg/io/wallclock/ds1390.h is available to define this API.
Read and return a single 8-bit register from the DS1390, addr should be in the range 0x00 to 0x0F.
Write a single 8-bit register to the DS1390, addr should be in the range 0x00 to 0x0F and val in the range 0x00 to 0xFF.
Write the DS1390 control register with the content of val.
Read and return the value of the DS1390 control register.
Write the DS1390 status register with the content of val.
Read and return the value of the DS1390 control register.
Write the DS1390 trickle-charge register with the content of val.
Read and return the value of the DS1390 trickle-charge register.
Set the DS1390 alarm to trigger when the wallclock time matches the value of secs. The DS1390 alarm will match only up to days of the month, so the alarm cannot be set more than one month in the future. This function only initializes the DS1390 to generate the alarm interrupt; it is the responsibility of the caller to attach an ISR to the appropriate vector and unmask it in the interrupt controller.