Name

CYGPKG_DEVICES_WALLCLOCK_INTERSIL_ISL12028 — eCos Support for the Intersil ISL12028 Real-Time Clock

Description

This package CYGPKG_DEVICES_WALLCLOCK_INTERSIL_ISL12028 provides a device driver for the wallclock device in the Intersil ISL12028 Real-Time Clock chips. These combine a real-time clock, alarm functionality, and a bank of EEPROM in a single package. 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.

Functionality

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 driver does not provide direct access to any of the other functionality provided by the chip. Instead if an application wishes to access the alarms or the EEPROM memory then it can do so itself, via the generic I²C API. However any such application code does need to synchronize with the wallclock driver to prevent concurrent accesses to the device. The driver exports a mutex lock to allow for this:

#include <cyg/io/wallclock/isl12028.h>

extern cyg_drv_mutex_t cyg_isl12028_lock;

The mutex should be locked via cyg_drv_mutex_lock to prevent the wallclock driver from accessing the chip, and then unlocked via cyg_drv_mutex_unlock when the driver can safely access the chip again.

The wallclock package is initialized by a static constructor with a priority immediately after CYG_INIT_DEV_WALLCLOCK. Applications should not call any wallclock-related functions before that constructor has run.

Porting

The ISL12028 is accessed via an I²C serial bus, and the driver assumes the presence of the generic I²C support package CYGPKG_IO_I2C and a suitable hardware driver. In addition it requires that some other package, typically the platform HAL, exports a cyg_i2c_device structure cyg_i2c_wallclock_isl12028. The ISL12028 device driver package CYGPKG_DEVICES_WALLCLOCK_INTERSIL_ISL12028 can then be included in the CDL target entry so that it gets loaded automatically whenever eCos is configured for that target.