FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/bsp/rtc/rtc_functions.c @ 160:dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
| author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> | 
|---|---|
| date | Sun, 17 Nov 2013 22:52:52 +0000 | 
| parents | 3c42e6e5fc04 | 
| children | 98be4841eeb7 | 
| rev | line source | 
|---|---|
| 160 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 1 /******************************************************************************/ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 2 /* rtc_functions.c : contains low level function for the rtc */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 3 /* */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 4 /* */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 5 /* Author: Laurent Sollier */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 6 /* */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 7 /* version: 1.0 */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 8 /* */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 9 /* Date: 03/20/01 */ | 
| 
dbfc9ff4e8d2
gsm-fw: starting to compile RTC code
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: 
159diff
changeset | 10 /******************************************************************************/ | 
| 159 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 11 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 12 #ifndef _WINDOWS | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 13 #include "l1sw.cfg" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 14 #include "chipset.cfg" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 15 #endif | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 16 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 17 #include <string.h> /* needed for memset */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 18 #include "nucleus.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 19 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 20 #include "rtc/rtc_messages_i.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 21 #include "rtc/rtc_api.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 22 #include "rtc/rtc_i.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 23 #include "rtc/board/rtc_config.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 24 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 25 #include "rvm/rvm_use_id_list.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 26 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 27 #include "memif/mem.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 28 #include "inth/iq.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 29 #include "ulpd/ulpd.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 30 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 31 #if (CHIPSET == 12) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 32 #include "inth/sys_inth.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 33 #else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 34 #include "inth/inth.h" | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 35 #endif | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 36 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 37 /* ----- Macro ----- */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 38 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 39 /* RTC_STOP */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 40 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 41 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 42 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 43 /* Functionality : Stop the RTC (STOP_RTC is cleared) */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 44 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 45 #define RTC_STOP (* (volatile UINT8 *) RTC_CTRL_REG &= ~RTC_START_RTC) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 46 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 47 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 48 /* RTC_START */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 49 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 50 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 51 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 52 /* Functionality : Start the RTC */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 53 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 54 #define RTC_START (* (volatile UINT8 *) RTC_CTRL_REG |= RTC_START_RTC) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 55 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 56 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 57 /* RTC_SET_32_CNT */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 58 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 59 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 60 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 61 /* Functionality : Set the SET_32_COUNTER bit */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 62 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 63 #define RTC_SET_32_CNT (* (volatile UINT8 *) RTC_CTRL_REG |= RTC_SET_32_COUNTER) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 64 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 65 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 66 /* RTC_RESET_32_CNT */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 67 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 68 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 69 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 70 /* Functionality : Reset the SET_32_COUNTER bit */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 71 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 72 #define RTC_RESET_32_CNT (* (volatile UINT8 *) RTC_CTRL_REG &= ~RTC_SET_32_COUNTER) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 73 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 74 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 75 /* RTC_SET_TEST_MODE */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 76 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 77 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 78 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 79 /* Functionality : Set the TEST_MODE bit */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 80 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 81 #define RTC_SET_TEST_MODE (* (volatile UINT8 *) RTC_CTRL_REG |= RTC_TEST_MODE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 82 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 83 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 84 /* RTC_ENABLE_IT_ALARM */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 85 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 86 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 87 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 88 /* Functionality : Enable the IT_ALARM */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 89 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 90 #define RTC_ENABLE_IT_ALARM (* (volatile UINT8 *) RTC_INTERRUPTS_REG |= RTC_IT_ALARM) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 91 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 92 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 93 /* RTC_DISABLE_IT_ALARM */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 94 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 95 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 96 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 97 /* Functionality : Disable the IT_ALARM */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 98 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 99 #define RTC_DISABLE_IT_ALARM (* (volatile UINT8 *) RTC_INTERRUPTS_REG &= ~RTC_IT_ALARM) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 100 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 101 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 102 /* RTC_ENABLE_IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 103 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 104 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 105 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 106 /* Functionality : Enable the IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 107 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 108 #define RTC_ENABLE_IT_TIMER (* (volatile UINT8 *) RTC_INTERRUPTS_REG |= RTC_IT_TIMER) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 109 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 110 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 111 /* RTC_DISABLE_IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 112 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 113 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 114 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 115 /* Functionality : Disable the IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 116 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 117 #define RTC_DISABLE_IT_TIMER (* (volatile UINT8 *) RTC_INTERRUPTS_REG &= ~RTC_IT_TIMER) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 118 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 119 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 120 /* RTC_SET_EVENT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 121 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 122 /* Parameters : event to enable or disable */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 123 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 124 /* Functionality : Set the event for the IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 125 /* Enable or disable IT */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 126 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 127 #define RTC_SET_EVENT_TIMER(x) (* (volatile UINT8 *) RTC_INTERRUPTS_REG = (* (volatile UINT8 *) RTC_INTERRUPTS_REG & 0xfffc) | (x)) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 128 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 129 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 130 /* RTC_TEST_BUSY */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 131 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 132 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 133 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 134 /* Functionality : Return the RTC state busy signal */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 135 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 136 #define RTC_TEST_BUSY ((* (volatile UINT8 *) RTC_STATUS_REG) & RTC_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 137 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 138 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 139 /* RTC_RUN_STATE */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 140 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 141 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 142 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 143 /* Functionality : Return the RTC run state */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 144 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 145 #define RTC_RUN_STATE ((* (volatile UINT8 *) RTC_STATUS_REG) & RTC_RUN) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 146 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 147 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 148 /* RTC_FREE_AL_ITLINE */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 149 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 150 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 151 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 152 /* Functionality : free it AL line */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 153 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 154 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 155 #define RTC_FREE_AL_ITLINE ((* (volatile UINT8 *) RTC_STATUS_REG) |= RTC_ALARM) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 156 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 157 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 158 /* RTC_FREE_POWER_UP */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 159 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 160 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 161 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 162 /* Functionality : clear reset event */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 163 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 164 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 165 #define RTC_FREE_POWER_UP ((* (volatile UINT8 *) RTC_STATUS_REG) |= RTC_POWER_UP) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 166 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 167 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 168 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 169 /* RTC_GET_EVENT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 170 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 171 /* Parameters : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 172 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 173 /* Functionality : Get the event status for the IT_TIMER */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 174 /*-------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 175 #define RTC_GET_EVENT_TIMER ((* (volatile UINT8 *) RTC_STATUS_REG & 0x3c)) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 176 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 177 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 178 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 179 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 180 /* ----- Global variables ----- */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 181 static T_RTC_DATE_TIME rtc_date_time_alarm = {0}; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 182 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 183 static T_RV_RETURN rtc_return_path = {RVF_INVALID_ADDR_ID, NULL}; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 184 static T_RTC_ALARM* rtc_msg_alarm_event = NULL; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 185 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 186 extern T_RTC_ENV_CTRL_BLK* rtc_env_ctrl_blk; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 187 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 188 /* Number of 32 Khz clock */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 189 static UINT32 rtc_nb_32khz = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 190 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 191 /* Number of high frequency clock */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 192 static UINT32 rtc_nb_hf = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 193 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 194 static NU_HISR hisr; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 195 char hisrStack[512]; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 196 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 197 // UINT16 toto = 0; tmp | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 198 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 199 void HisrEntryFunc(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 200 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 201 if (rtc_msg_alarm_event) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 202 rvf_send_msg(rtc_env_ctrl_blk->addr_id, rtc_msg_alarm_event); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 203 //char comp[15]; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 204 /* sprintf(comp,"%d",toto); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 205 LCDG_WriteString( 4, 0, " "); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 206 LCDG_WriteString( 3, 0, (char*) comp); //tmp */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 207 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 208 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 209 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 210 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 211 /* conv_bin DCB => B */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 212 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 213 /* Parameters : value to be convert */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 214 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 215 /* Functionality : BCD et binary conversion function */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 216 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 217 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 218 static UINT8 conv_bin(UINT8 value) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 219 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 220 return (10*(value>>4) + ( value & 0x0f)); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 221 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 222 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 223 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 224 /* conv_bcd B => DCB */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 225 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 226 /* Parameters : value to be convert */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 227 /* Return : none */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 228 /* Functionality : Binary to BCD conversion function */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 229 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 230 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 231 static UINT8 conv_bcd(UINT8 value) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 232 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 233 return ((value%10) | ( (value/10) <<4)); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 234 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 235 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 236 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 237 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 238 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 239 /* format_date_available */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 240 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 241 /* Parameters : T_RTC_DATE_TIME structure */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 242 /* Return : TRUE if format is available */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 243 /* FALSE else */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 244 /* Functionality : test if date and time format is available */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 245 /*---------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 246 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 247 BOOL format_date_available(T_RTC_DATE_TIME date_time) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 248 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 249 UINT8 m; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 250 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 251 if (date_time.second < 0 || date_time.second > 59) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 252 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 253 if (date_time.minute < 0 || date_time.minute > 59) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 254 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 255 if (date_time.mode_12_hour == FALSE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 256 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 257 if (date_time.hour < 0 || date_time.hour > 23) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 258 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 259 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 260 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 261 if (date_time.hour < 1 || date_time.hour > 12) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 262 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 263 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 264 if (date_time.month < 1 || date_time.month > 12) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 265 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 266 if (date_time.year < 0 || date_time.year > 99) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 267 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 268 if (date_time.wday < 0 || date_time.wday > 6) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 269 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 270 m = date_time.month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 271 if (m == 1||m == 3||m == 5||m == 7||m == 8||m == 10||m == 12) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 272 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 273 if (date_time.day < 1 || date_time.day > 31) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 274 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 275 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 276 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 277 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 278 if (m == 4||m == 6||m == 9||m == 11) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 279 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 280 if (date_time.day < 1 || date_time.day > 30) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 281 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 282 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 283 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 284 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 285 if (date_time.year%4) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 286 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 287 if (date_time.day < 1 || date_time.day > 28) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 288 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 289 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 290 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 291 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 292 if (date_time.day < 1 || date_time.day > 29) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 293 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 294 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 295 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 296 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 297 return TRUE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 298 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 299 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 300 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 301 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 302 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 303 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 304 * RTC_Initialize | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 305 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 306 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 307 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 308 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 309 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 310 T_RVF_RET RTC_Initialize(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 311 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 312 T_RVF_MB_STATUS mb_status; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 313 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 314 /* Reserve memory for alarm event */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 315 mb_status = rvf_get_buf (rtc_env_ctrl_blk->prim_id, sizeof (T_RTC_ALARM ), (void **) &rtc_msg_alarm_event); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 316 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 317 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 318 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 319 rtc_msg_alarm_event->os_hdr.msg_id = RTC_ALARM_EVT; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 320 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 321 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 322 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 323 rtc_msg_alarm_event = NULL; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 324 return RVF_MEMORY_ERR; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 325 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 326 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 327 rtc_env_ctrl_blk->msg_alarm_event = rtc_msg_alarm_event; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 328 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 329 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 330 /* Start RTC module */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 331 if (RTC_RUN_STATE == 0) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 332 RTC_START; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 333 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 334 /* Enable auto compensation */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 335 //*(volatile UINT8*) RTC_CTRL_REG |= RTC_AUTO_COMP; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 336 /* Disable auto compensation */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 337 *(volatile UINT8*) RTC_CTRL_REG &= ~RTC_AUTO_COMP; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 338 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 339 /* For CHIPSET = 7, 9, 10 or 11, set analog baseband type */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 340 #if (((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11)) && (ANLG_FAM == 1)) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 341 *(volatile UINT8*) RTC_CTRL_REG |= RTC_nDELTA_OMEGA; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 342 #endif | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 343 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 344 /* Activate periodic interrupt every minute*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 345 /* Disable all IT before accessing register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 346 rvf_disable(25); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 347 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 348 /* Enable IRQ9 and IRQ10 */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 349 #if (CHIPSET == 12) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 350 F_INTH_ENABLE_ONE_IT(C_INTH_RTC_TIMER_IT); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 351 F_INTH_ENABLE_ONE_IT(C_INTH_RTC_ALARM_IT); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 352 #else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 353 IQ_Unmask(IQ_RTC_TIMER); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 354 IQ_Unmask(IQ_RTC_ALARM); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 355 #endif | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 356 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 357 while (RTC_TEST_BUSY); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 358 RTC_SET_EVENT_TIMER(RTC_EVERY_MIN); /* Set timer every minute */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 359 RTC_ENABLE_IT_TIMER; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 360 RTC_DISABLE_IT_ALARM; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 361 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 362 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 363 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 364 /* The stack is entirely filled with the pattern 0xFE. */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 365 memset (hisrStack, 0xFE, sizeof(hisrStack)); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 366 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 367 /* Temporary modification: create HISR to diplay compensation value */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 368 NU_Create_HISR(&hisr, "RTC_HISR", HisrEntryFunc, 2, hisrStack, sizeof(hisrStack)); // lowest prty | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 369 /* end temporary modification */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 370 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 371 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 372 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 373 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 374 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 375 * RTC_RtcReset | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 376 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 377 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 378 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 379 BOOL RTC_RtcReset(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 380 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 381 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 382 /* Read POWER UP bit to inform MMI of a possible RTC reset */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 383 if ( ((* (volatile UINT8*) RTC_STATUS_REG) & RTC_POWER_UP) ) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 384 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 385 RTC_FREE_POWER_UP; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 386 return TRUE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 387 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 388 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 389 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 390 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 391 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 392 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 393 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 394 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 395 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 396 * RTC_GetDateTime | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 397 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 398 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 399 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 400 T_RVF_RET RTC_GetDateTime(T_RTC_DATE_TIME* date_time) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 401 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 402 UINT8 sec; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 403 UINT8 min; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 404 UINT8 hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 405 UINT8 day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 406 UINT8 month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 407 UINT8 year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 408 UINT8 wday; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 409 UINT8 hr_reg; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 410 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 411 /* Disable all IT before reading register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 412 rvf_disable(25); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 413 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 414 if (RTC_TEST_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 415 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 416 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 417 return RVF_NOT_READY; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 418 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 419 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 420 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 421 day = * (volatile UINT8 *) RTC_DAYS_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 422 month = * (volatile UINT8 *) RTC_MONTHS_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 423 year = * (volatile UINT8 *) RTC_YEARS_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 424 wday = * (volatile UINT8 *) RTC_WEEK_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 425 sec = * (volatile UINT8 *) RTC_SECONDS_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 426 min = * (volatile UINT8 *) RTC_MINUTES_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 427 hr_reg = * (volatile UINT8 *) RTC_HOURS_REG; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 428 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 429 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 430 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 431 hour = (0x7f & hr_reg); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 432 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 433 date_time->second = conv_bin(sec); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 434 date_time->minute = conv_bin(min); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 435 date_time->hour = conv_bin(hour); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 436 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 437 if ( (* (volatile UINT8 *)RTC_CTRL_REG & RTC_MODE_12_24 ) == 0) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 438 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 439 /* 24 hour mode */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 440 date_time->mode_12_hour = FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 441 date_time->PM_flag = FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 442 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 443 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 444 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 445 /* 12 hour mode */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 446 date_time->mode_12_hour = TRUE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 447 if ((hr_reg & 0x80) == 0) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 448 date_time->PM_flag = FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 449 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 450 date_time->PM_flag = TRUE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 451 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 452 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 453 date_time->day = conv_bin(day); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 454 date_time->month = conv_bin(month); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 455 date_time->year = conv_bin(year); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 456 date_time->wday = conv_bin(wday); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 457 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 458 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 459 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 460 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 461 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 462 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 463 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 464 * RTC_SetDateTime | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 465 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 466 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 467 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 468 T_RVF_RET RTC_SetDateTime(T_RTC_DATE_TIME date_time) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 469 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 470 UINT8 sec; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 471 UINT8 min; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 472 UINT8 hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 473 UINT8 day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 474 UINT8 month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 475 UINT8 year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 476 UINT8 wday; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 477 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 478 /* testing parameter range validity */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 479 if (!format_date_available(date_time)) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 480 return RVF_INVALID_PARAMETER; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 481 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 482 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 483 sec = conv_bcd(date_time.second); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 484 min = conv_bcd(date_time.minute); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 485 if (date_time.mode_12_hour == FALSE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 486 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 487 * (volatile UINT8 *)RTC_CTRL_REG &= ~RTC_MODE_12_24; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 488 hour = conv_bcd(date_time.hour); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 489 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 490 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 491 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 492 * (volatile UINT8 *)RTC_CTRL_REG |= RTC_MODE_12_24; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 493 hour = conv_bcd(date_time.hour); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 494 if (date_time.PM_flag != FALSE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 495 hour |= (0x80); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 496 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 497 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 498 day = conv_bcd(date_time.day); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 499 month = conv_bcd(date_time.month); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 500 year = conv_bcd(date_time.year); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 501 wday = conv_bcd(date_time.wday); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 502 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 503 /* Disable all IT before reading register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 504 rvf_disable(25); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 505 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 506 if (RTC_TEST_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 507 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 508 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 509 return RVF_NOT_READY; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 510 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 511 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 512 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 513 * (volatile UINT8 *) RTC_DAYS_REG = day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 514 * (volatile UINT8 *) RTC_MONTHS_REG = month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 515 * (volatile UINT8 *) RTC_YEARS_REG = year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 516 * (volatile UINT8 *) RTC_WEEK_REG = wday; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 517 * (volatile UINT8 *) RTC_SECONDS_REG = sec; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 518 * (volatile UINT8 *) RTC_MINUTES_REG = min; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 519 * (volatile UINT8 *) RTC_HOURS_REG = hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 520 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 521 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 522 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 523 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 524 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 525 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 526 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 527 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 528 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 529 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 530 * RTC_GetAlarm | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 531 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 532 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 533 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 534 T_RVF_RET RTC_GetAlarm(T_RTC_DATE_TIME* date_time) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 535 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 536 date_time->second = rtc_date_time_alarm.second; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 537 date_time->minute = rtc_date_time_alarm.minute; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 538 date_time->hour = rtc_date_time_alarm.hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 539 date_time->day = rtc_date_time_alarm.day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 540 date_time->month = rtc_date_time_alarm.month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 541 date_time->year = rtc_date_time_alarm.year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 542 date_time->wday = rtc_date_time_alarm.wday; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 543 date_time->mode_12_hour = rtc_date_time_alarm.mode_12_hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 544 date_time->PM_flag = rtc_date_time_alarm.PM_flag; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 545 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 546 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 547 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 548 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 549 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 550 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 551 * RTC_SetAlarm | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 552 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 553 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 554 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 555 T_RVF_RET RTC_SetAlarm(T_RTC_DATE_TIME date_time, T_RV_RETURN return_path) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 556 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 557 UINT8 sec; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 558 UINT8 min; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 559 UINT8 hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 560 UINT8 day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 561 UINT8 month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 562 UINT8 year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 563 UINT8 wday; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 564 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 565 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 566 /* testing parameter range validity */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 567 if (!format_date_available(date_time)) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 568 return RVF_INVALID_PARAMETER; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 569 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 570 sec = conv_bcd(date_time.second); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 571 min = conv_bcd(date_time.minute); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 572 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 573 if (date_time.mode_12_hour == FALSE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 574 hour = conv_bcd(date_time.hour); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 575 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 576 hour = conv_bcd(date_time.hour) | (date_time.PM_flag << 7); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 577 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 578 day = conv_bcd(date_time.day); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 579 month = conv_bcd(date_time.month); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 580 year = conv_bcd(date_time.year); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 581 wday = conv_bcd(date_time.wday); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 582 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 583 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 584 /* Disable all IT before reading register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 585 rvf_disable(25); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 586 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 587 if (RTC_TEST_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 588 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 589 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 590 return RVF_NOT_READY; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 591 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 592 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 593 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 594 *(volatile UINT8*) RTC_ALARM_DAYS_REG = day; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 595 *(volatile UINT8*) RTC_ALARM_MONTHS_REG = month; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 596 *(volatile UINT8*) RTC_ALARM_YEARS_REG = year; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 597 *(volatile UINT8*) RTC_ALARM_SECONDS_REG = sec; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 598 *(volatile UINT8*) RTC_ALARM_MINUTES_REG = min; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 599 *(volatile UINT8*) RTC_ALARM_HOURS_REG = hour; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 600 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 601 /* Enable alarm*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 602 RTC_ENABLE_IT_ALARM; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 603 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 604 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 605 /* Save callback */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 606 rtc_return_path.callback_func = return_path.callback_func; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 607 rtc_return_path.addr_id = return_path.addr_id; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 608 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 609 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 610 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 611 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 612 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 613 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 614 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 615 * RTC_UnsetAlarm | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 616 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 617 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 618 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 619 T_RVF_RET RTC_UnsetAlarm(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 620 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 621 /* Disable all IT before reading register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 622 rvf_disable(25); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 623 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 624 if (RTC_TEST_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 625 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 626 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 627 return RVF_NOT_READY; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 628 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 629 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 630 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 631 /* Disable alarm*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 632 RTC_DISABLE_IT_ALARM; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 633 rvf_enable(); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 634 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 635 return RVF_OK; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 636 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 637 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 638 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 639 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 640 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 641 * RTC_Rounding30s | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 642 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 643 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 644 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 645 void RTC_Rounding30s(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 646 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 647 *(UINT8*) RTC_CTRL_REG |= RTC_ROUND_30S; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 648 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 649 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 650 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 651 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 652 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 653 * RTC_Set12HourMode | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 654 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 655 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 656 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 657 void RTC_Set12HourMode(BOOL Mode12Hour) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 658 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 659 if ( Mode12Hour == FALSE) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 660 * (volatile UINT8*) RTC_CTRL_REG &= 0xf7; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 661 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 662 * (volatile UINT8*) RTC_CTRL_REG |= 0x08; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 663 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 664 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 665 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 666 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 667 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 668 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 669 * RTC_Is12HourMode | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 670 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 671 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 672 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 673 BOOL RTC_Is12HourMode(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 674 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 675 if ( (*(volatile UINT8*) RTC_CTRL_REG & RTC_MODE_12_24) ) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 676 return TRUE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 677 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 678 return FALSE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 679 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 680 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 681 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 682 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 683 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 684 * RTC_ItTimerHandle | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 685 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 686 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 687 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 688 void RTC_ItTimerHandle(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 689 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 690 static double compensation = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 691 static UINT8 nb_sample = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 692 double delta; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 693 UINT16 value = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 694 INT16 tmp_value = 0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 695 UINT8 cmp[15]; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 696 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 697 /* Evaluate average on one hour max */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 698 if ( nb_sample < 60) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 699 nb_sample++; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 700 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 701 /* perform calculation of auto compensation each minute and evaluate an | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 702 average on one hour */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 703 /* Number of 32 kHz clock lost in one second */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 704 /* Accurate operation is : delta = CLK_32 - rtc_nb_32khz*CLK_PLL/g_nb_hf */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 705 /* with CLK_32 = 32768 Hz and CLK_PLL depend on chipset */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 706 delta = RTC_CLOCK_32K - rtc_nb_32khz*RTC_CLOCK_HF/rtc_nb_hf; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 707 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 708 /* Number of 32 kHz clock lost in one hour */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 709 delta *= 3600.0; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 710 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 711 /* Average of the compensation to load */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 712 compensation = (compensation*(nb_sample-1) + delta)/nb_sample; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 713 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 714 if (compensation >= 0x7FFF) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 715 tmp_value = 0x7FFE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 716 else if (compensation <= -0x7FFF) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 717 tmp_value = -0x7FFE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 718 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 719 tmp_value = (INT16) compensation; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 720 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 721 if (tmp_value > 0) /* if 32 Khz clock is slow */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 722 value = tmp_value; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 723 if (tmp_value < 0) /* if 32 Khz clock is fast */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 724 value = 0xFFFF + tmp_value + 1; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 725 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 726 /* Set value in compensation register */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 727 if (!RTC_TEST_BUSY) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 728 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 729 *(volatile UINT8*) RTC_COMP_MSB_REG = (UINT8) (value >> 8); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 730 *(volatile UINT8*) RTC_COMP_LSB_REG = (UINT8) (value & 0xFF); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 731 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 732 /*toto = value; tmp*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 733 /*NU_Activate_HISR(&hisr); tmp*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 734 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 735 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 736 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 737 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 738 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 739 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 740 * RTC_ItAlarmHandle | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 741 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 742 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 743 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 744 void RTC_ItAlarmHandle(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 745 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 746 /* Sending alarm event */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 747 /* Post alarm event in RTC mailbox */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 748 NU_Activate_HISR(&hisr); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 749 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 750 /*if (rtc_msg_alarm_event) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 751 rvf_send_msg(rtc_env_ctrl_blk->task_id, rtc_env_ctrl_blk->mbox_id, rtc_msg_alarm_event);*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 752 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 753 /* Free alarm IT line */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 754 RTC_FREE_AL_ITLINE; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 755 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 756 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 757 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 758 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 759 * RTC_GaugingHandler | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 760 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 761 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 762 void RTC_GaugingHandler(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 763 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 764 /* Number of 32 Khz clock at the end of the gauging */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 765 rtc_nb_32khz = ((*(volatile UINT16 *)ULDP_COUNTER_32_MSB_REG) * 0x10000) + | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 766 (*(volatile UINT16 *)ULDP_COUNTER_32_LSB_REG); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 767 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 768 /* Number of high frequency clock at the end of the gauging */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 769 /* To convert in nbr of 13 Mhz clocks (5*13=65Mhz) */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 770 rtc_nb_hf = ( ((*(volatile UINT16 *)ULDP_COUNTER_HI_FREQ_MSB_REG) * 0x10000) + | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 771 (*(volatile UINT16 *)ULDP_COUNTER_HI_FREQ_LSB_REG) ); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 772 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 773 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 774 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 775 /******************************************************************************* | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 776 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 777 * RTC_ProcessAlarmEvent | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 778 * | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 779 ******************************************************************************/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 780 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 781 void RTC_ProcessAlarmEvent(void) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 782 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 783 T_RVF_MB_STATUS mb_status; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 784 T_RTC_ALARM* msg_alarm; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 785 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 786 /* Call MMI */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 787 if (rtc_return_path.callback_func != NULL) | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 788 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 789 rtc_return_path.callback_func(NULL); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 790 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 791 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 792 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 793 /* Reserve memory for alarm event */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 794 mb_status = rvf_get_buf (rtc_env_ctrl_blk->prim_id, sizeof (T_RTC_ALARM ), (void **) &msg_alarm); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 795 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 796 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 797 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 798 msg_alarm->os_hdr.msg_id = RTC_ALARM_EVT; | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 799 /* Send event in the mailbox */ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 800 rvf_send_msg(rtc_return_path.addr_id, msg_alarm); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 801 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 802 else | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 803 { | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 804 rvf_send_trace("Memory allocation error",23, NULL_PARAM, RV_TRACE_LEVEL_ERROR, RTC_USE_ID ); | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 805 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 806 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 807 } | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 808 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 809 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 810 | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 811 /*---------------------------------------------------------------------------------------*/ | 
| 
3c42e6e5fc04
gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
 Michael Spacefalcon <msokolov@ivan.Harhan.ORG> parents: diff
changeset | 812 | 
