Project

General

Profile

Revision 259

deleting rtc_macros.h

View differences:

proj/include/rtc_macros.h
3 3

  
4 4
#include <lcom/lcf.h>
5 5

  
6
// RTC IRQ Line
7 6

  
8
#define KBC_IRQ   8  /* @brief KBC IRQ Line */
9 7

  
10
// RTC Ports
11

  
12
#define RTC_ADDR_REG        0x70
13
#define RTC_DATA_REG        0x71
14

  
15
// RTC Registers (Byte)
16

  
17
#define RTC_SEC             0
18
#define RTC_SEC_ALARM       1
19
#define RTC_MIN             2
20
#define RTC_MIN_ALARM       3
21
#define RTC_HOUR            4
22
#define RTC_HOUR_ALARM      5
23
#define RTC_WEEK_DAY        6
24
#define RTC_MONTH_DAY       7
25
#define RTC_MONTH           8
26
#define RTC_YEAR            9
27
#define RTC_REG_A           10
28
#define RTC_REG_B           11
29
#define RTC_REG_C           12
30
#define RTC_REG_D           13
31

  
32
// Register A
33

  
34
#define RS0     BIT(0)  /** @brief Rate selector */
35
#define RS1     BIT(1)  /** @brief Rate selector */
36
#define RS2     BIT(2)  /** @brief Rate selector */
37
#define RS3     BIT(3)  /** @brief Rate selector */
38
#define UIP     BIT(7)  /** @brief Update in progress */
39

  
40
// Register B
41

  
42
#define DSE             BIT(0)  /** @brief Enable Daylight Saving Time */
43
#define HOUR_FORM       BIT(1)  /** @brief Set to 1 for 24h format (0-23), 0 to 12h format (1-12) */
44
#define DM              BIT(2)  /** @brief Set to 1 if registers are in binary, 0 if in BCD */
45
#define SQWE            BIT(3)  /** @brief Enable square wave generation */
46
#define UIE             BIT(4)  /** @brief Enable Update interrupts */
47
#define AIE             BIT(5)  /** @brief Enable alarm interrupts */
48
#define PIE             BIT(6)  /** @brief Enable periodic interrupts */
49
#define SET             BIT(7)  /** @brief Set to 1 to inhibit updates of time/date registers */
50

  
51
// Register C
52

  
53
#define UF      BIT(4)  /** @brief Update Interrupt Pending */
54
#define AF      BIT(5)  /** @brief Alarm Interrupt Pending */
55
#define PF      BIT(6)  /** @brief Periodic Interrupt Pending */
56
#define IRQF    BIT(7)  /** @brief IRQ Line Active */
57

  
58
// Register D
59

  
60
#define VRT     BIT(7)  /** @brief Valid RAM/time - If set to 0 RTC reading aren't valid */
61

  
62 8
#endif /* end of include guard: RTC_MACROS_H_INCLUDED */
proj/src/rtc.c
6 6
#include "utils.h"
7 7
#include "errors.h"
8 8

  
9
// RTC IRQ Line
10

  
11
#define KBC_IRQ   8  /* @brief KBC IRQ Line */
12

  
13
// RTC Ports
14

  
15
#define RTC_ADDR_REG        0x70
16
#define RTC_DATA_REG        0x71
17

  
18
// RTC Registers (Byte)
19

  
20
#define RTC_SEC             0
21
#define RTC_SEC_ALARM       1
22
#define RTC_MIN             2
23
#define RTC_MIN_ALARM       3
24
#define RTC_HOUR            4
25
#define RTC_HOUR_ALARM      5
26
#define RTC_WEEK_DAY        6
27
#define RTC_MONTH_DAY       7
28
#define RTC_MONTH           8
29
#define RTC_YEAR            9
30
#define RTC_REG_A           10
31
#define RTC_REG_B           11
32
#define RTC_REG_C           12
33
#define RTC_REG_D           13
34

  
35
// Register A
36

  
37
#define RS0     BIT(0)  /** @brief Rate selector */
38
#define RS1     BIT(1)  /** @brief Rate selector */
39
#define RS2     BIT(2)  /** @brief Rate selector */
40
#define RS3     BIT(3)  /** @brief Rate selector */
41
#define UIP     BIT(7)  /** @brief Update in progress */
42

  
43
// Register B
44

  
45
#define DSE             BIT(0)  /** @brief Enable Daylight Saving Time */
46
#define HOUR_FORM       BIT(1)  /** @brief Set to 1 for 24h format (0-23), 0 to 12h format (1-12) */
47
#define DM              BIT(2)  /** @brief Set to 1 if registers are in binary, 0 if in BCD */
48
#define SQWE            BIT(3)  /** @brief Enable square wave generation */
49
#define UIE             BIT(4)  /** @brief Enable Update interrupts */
50
#define AIE             BIT(5)  /** @brief Enable alarm interrupts */
51
#define PIE             BIT(6)  /** @brief Enable periodic interrupts */
52
#define SET             BIT(7)  /** @brief Set to 1 to inhibit updates of time/date registers */
53

  
54
// Register C
55

  
56
#define UF      BIT(4)  /** @brief Update Interrupt Pending */
57
#define AF      BIT(5)  /** @brief Alarm Interrupt Pending */
58
#define PF      BIT(6)  /** @brief Periodic Interrupt Pending */
59
#define IRQF    BIT(7)  /** @brief IRQ Line Active */
60

  
61
// Register D
62

  
63
#define VRT     BIT(7)  /** @brief Valid RAM/time - If set to 0 RTC reading aren't valid */
64

  
9 65
int (subscribe_rtc_interrupt)(uint8_t interrupt_bit, int *interrupt_id) {
10 66
    if (interrupt_id == NULL) return NULL_PTR;
11 67
    *interrupt_id = interrupt_bit;

Also available in: Unified diff