RTEMS  5.1
Data Structures | Macros | Variables
rtc.c File Reference
#include <libchip/rtc.h>
#include <assert.h>
#include <rtems/score/todimpl.h>
#include <sys/filio.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <bsp/i2cdrv.h>

Data Structures

struct  ds1339_time_t
 
struct  m41st87_time_t
 

Macros

#define ALTERA_CYCLONE_V_RTC_NUMBER   2
 
#define DS1339_I2C_ADDRESS   (0xD0 >> 1) /* 7-bit addressing! */
 
#define DS1339_I2C_BUS_DEVICE   "/dev/i2c0"
 
#define DS1339_ADDR_TIME   0x00
 
#define DS1339_ADDR_CTRL   0x0E
 
#define DS1339_CTRL_EOSC   0x80
 
#define DS1339_CTRL_BBSQI   0x20
 
#define DS1339_CTRL_RS2   0x10
 
#define DS1339_CTRL_RS1   0x08
 
#define DS1339_CTRL_INTCN   0x04
 
#define DS1339_CTRL_A2IE   0x02
 
#define DS1339_CTRL_A1IE   0x01
 
#define DS1339_CTRL_DEFAULT   (0x00)
 
#define DS1339_ADDR_STATUS   0x0F
 
#define DS1339_STATUS_OSF   0x80
 
#define DS1339_STATUS_A2F   0x02
 
#define DS1339_STATUS_A1F   0x01
 
#define DS1339_STATUS_CLEAR   (0x00)
 
#define DS1339_ADDR_TRICKLE_CHARGE   0x10
 
#define DS1339_HOURS_12_24_FLAG   0x40
 
#define DS1339_HOURS_AM_PM_FLAG_OR_20_HOURS   0x20
 
#define DS1339_HOURS_10_HOURS   0x10
 
#define DS1339_MONTH_CENTURY   0x80
 
#define DS1339_MAX_WRITE_SIZE   (sizeof(ds1339_time_t) + 1)
 
#define M41ST87_I2C_ADDRESS   (0xD0 >> 1) /* 7-bit addressing! */
 
#define M41ST87_I2C_BUS_DEVICE   "/dev/i2c0"
 
#define M41ST87_ADDR_TIME   0x00
 
#define M41ST87_ADDR_CTRL   0x08
 
#define M41ST87_CTRL_OUT   0x80
 
#define M41ST87_CTRL_FT   0x40
 
#define M41ST87_CTRL_S   0x20
 
#define M41ST87_CTRL_CAL   0x1F
 
#define M41ST87_ADDR_ALARM_HOUR   0x0C
 
#define M41ST87_BIT_HT   0x40
 
#define M41ST87_ADDR_FLAGS   0x0F
 
#define M41ST87_FLAG_WDF   0x80
 
#define M41ST87_FLAG_AF   0x40
 
#define M41ST87_FLAG_BL   0x10
 
#define M41ST87_FLAG_OF   0x04
 
#define M41ST87_FLAG_TB1   0x02
 
#define M41ST87_FLAG_TB2   0x01
 
#define M41ST87_ADDR_USER_RAM   0x20
 
#define M41ST87_BIT_ST   0x80
 
#define M41ST87_BIT_OFIE   0x80
 
#define M41ST87_BIT_CB1   0x80
 
#define M41ST87_BIT_CB0   0x40
 
#define M41ST87_BIT_TR   0x80
 
#define M41ST87_BIT_THS   0x40
 
#define M41ST87_BIT_CLRPW1   0x20
 
#define M41ST87_BIT_CLRPW0   0x10
 
#define M41ST87_BIT_32KE   0x08
 
#define M41ST87_BIT_PFOD   0x80
 
#define M41ST87_MAX_WRITE_SIZE   (sizeof(m41st87_time_t) + 1)
 

Variables

const rtc_fns altera_cyclone_v_ds1339_ops
 
const rtc_fns altera_cyclone_v_m41st87_ops
 
size_t RTC_Count = ALTERA_CYCLONE_V_RTC_NUMBER
 
rtc_tbl RTC_Table [ALTERA_CYCLONE_V_RTC_NUMBER]
 

Variable Documentation

◆ altera_cyclone_v_ds1339_ops

const rtc_fns altera_cyclone_v_ds1339_ops
Initial value:
=
{
.deviceInitialize = altera_cyclone_v_ds1339_initialize,
.deviceGetTime = altera_cyclone_v_ds1339_get_time,
.deviceSetTime = altera_cyclone_v_ds1339_set_time
}

◆ altera_cyclone_v_m41st87_ops

const rtc_fns altera_cyclone_v_m41st87_ops
Initial value:
=
{
.deviceInitialize = altera_cyclone_v_m41st87_initialize,
.deviceGetTime = altera_cyclone_v_m41st87_get_time,
.deviceSetTime = altera_cyclone_v_m41st87_set_time
}

◆ RTC_Table

rtc_tbl RTC_Table[ALTERA_CYCLONE_V_RTC_NUMBER]
Initial value:
=
{
{
.sDeviceName = "/dev/rtc",
.deviceType = RTC_CUSTOM,
.pDeviceFns = &altera_cyclone_v_ds1339_ops,
.deviceProbe = altera_cyclone_v_ds1339_probe,
.pDeviceParams = NULL,
.ulCtrlPort1 = 0,
.ulDataPort = 0,
.getRegister = NULL,
.setRegister = NULL
},
{
.sDeviceName = "/dev/rtc",
.deviceType = RTC_CUSTOM,
.pDeviceFns = &altera_cyclone_v_m41st87_ops,
.deviceProbe = altera_cyclone_v_m41st87_probe,
.pDeviceParams = NULL,
.ulCtrlPort1 = 0,
.ulDataPort = 0,
.getRegister = NULL,
.setRegister = NULL
}
}
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77