annotate gsm-fw/bsp/rtc/rtc_task.c @ 418:a9bf3e92a30c

tfc139: clean exit on success
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 17 Jun 2014 20:59:59 +0000
parents 98be4841eeb7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
159
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /**
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * @file rtc_task.c
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 *
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * Coding of the main RTC function : rtc_core
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * This function loop in the process message function for waiting messages.
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 *
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * @author Laurent Sollier (l-sollier@ti.com)
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 * @version 0.1
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 */
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10
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 * History:
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 *
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 * Date Author Modification
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 * ------------------------------------
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 * 10/24/2001 L Sollier Create
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 *
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 *
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 * (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 */
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
161
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
22 #include "rtc_env.h"
159
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
161
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
24 #include "../../riviera/rv/rv_general.h"
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
25 #include "../../riviera/rvf/rvf_api.h"
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
26 #include "../../riviera/rvm/rvm_use_id_list.h"
159
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 #define RTC_MAILBOX_USED RVF_TASK_MBOX_0
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 /* External declaration until Riviera 1.6 is available*/
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 extern UINT8 rtc_handle_msg(T_RV_HDR* msg_p);
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 /**
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 * @name Functions implementation
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 *
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 /*@{*/
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 /**
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 * function: rtc_core
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 */
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 T_RV_RET rtc_core(void)
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 {
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 BOOLEAN error_occured = FALSE;
161
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
47 T_RV_HDR * msg_ptr;
159
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 UINT16 received_event;
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 rvf_send_trace("RTC: Initialization", 19, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, RTC_USE_ID );
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 /* loop to process messages */
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 while (error_occured == FALSE)
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 {
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 /* Wait for the necessary events. */
161
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
56 received_event = rvf_wait ( 0xffff,0);
159
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 {
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 /* Read the message */
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 msg_ptr = (T_RV_HDR *) rvf_read_mbox(RTC_MAILBOX_USED);
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 rtc_handle_msg(msg_ptr);
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
3c42e6e5fc04 gsm-fw/bsp/rtc: initial import from Leonardo TCS211 semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 return RV_OK;
161
98be4841eeb7 gsm-fw: RTC code hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 159
diff changeset
68 }