comparison src/cs/services/mks/mks_task.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /**
2 * @file mks_task.c
3 *
4 * Coding of the main MKS function : mks_core
5 * This function loop in the process message function for waiting messages.
6 *
7 * @author Laurent Sollier (l-sollier@ti.com)
8 * @version 0.1
9 */
10
11 /*
12 * History:
13 *
14 * Date Author Modification
15 * ----------------------------------------
16 * 11/19/2001 L Sollier Create
17 *
18 *
19 * (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
20 */
21
22 #include "mks/mks_env.h"
23 #include "mks/mks_i.h"
24
25 #include "rv/rv_general.h"
26 #include "rvf/rvf_api.h"
27 #include "rvm/rvm_use_id_list.h"
28
29
30 /* External declaration until Riviera 1.6 is available*/
31 extern T_RV_RET mks_handle_msg(T_RV_HDR* msg_p);
32 extern T_RV_RET mks_handle_timer(UINT8 timer_num);
33
34
35
36 /**
37 * @name Functions implementation
38 *
39 */
40 /*@{*/
41
42 /**
43 * function: mks_core
44 */
45 T_RV_RET mks_core(void)
46 {
47 BOOLEAN error_occured = FALSE;
48 T_RV_HDR* msg_p;
49 UINT16 received_event;
50
51 MKS_SEND_TRACE("MKS: Initialization", RV_TRACE_LEVEL_DEBUG_HIGH );
52
53 /* Initialize SWE */
54 mks_initialize_swe();
55
56 /* loop to process messages */
57 while (error_occured == FALSE)
58 {
59 /* Wait for the necessary events. */
60 received_event = rvf_wait ( 0xffff,0);
61
62 if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
63 {
64 /* Read the message */
65 msg_p = (T_RV_HDR*) rvf_read_mbox( MKS_MAILBOX_USED);
66
67 mks_handle_msg(msg_p);
68 }
69
70 if (received_event & RVF_TIMER_0_EVT_MASK)
71 {
72 mks_handle_timer(RVF_TIMER_0);
73 }
74
75 if (received_event & RVF_TIMER_1_EVT_MASK)
76 {
77 mks_handle_timer(RVF_TIMER_1);
78 }
79 if (received_event & RVF_TIMER_2_EVT_MASK)
80 {
81 mks_handle_timer(RVF_TIMER_2);
82 }
83 if (received_event & RVF_TIMER_3_EVT_MASK)
84 {
85 mks_handle_timer(RVF_TIMER_3);
86 }
87
88 }
89
90 return RV_OK;
91 }