comparison src/cs/drivers/drv_app/r2d/r2d_task.c @ 217:6541e43f88e5

R2D display on/off control implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 24 Apr 2021 23:38:18 +0000
parents 777698cf6583
children 4221c724c664
comparison
equal deleted inserted replaced
216:777698cf6583 217:6541e43f88e5
1 /** 1 /**
2 2
3 @file: r2d_task.c 3 @file: r2d_task.c
4 4
5 @author Christophe Favergeon 5 @author Christophe Favergeon
6 6
7 @version 0.5 7 @version 0.5
8 8
9 Purpose: Refresh task for R2D. It is calling the LCD dependent refresh subroutine 9 Purpose: Refresh task for R2D. It is calling the LCD dependent refresh subroutine
10 10
11 */ 11 */
12 12
13 /* 13 /*
14 14
15 Date Modification 15 Date Modification
16 ------------------------------------ 16 ------------------------------------
17 06/02/2001 Create 17 06/02/2001 Create
18 10/18/2001 Version 0.5 for first integration with Riviera database 18 10/18/2001 Version 0.5 for first integration with Riviera database
19 19
20 20
21 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved 21 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
22 */ 22 */
23
24
25 23
26 24
27 #include "rv/general.h" 25 #include "rv/general.h"
28 #include "rvf/rvf_api.h" 26 #include "rvf/rvf_api.h"
29 #include "rvm/rvm_api.h" 27 #include "rvm/rvm_api.h"
36 34
37 extern void r2d_refresh(void); 35 extern void r2d_refresh(void);
38 36
39 extern INT16 r2d_g_refresh_disabled; 37 extern INT16 r2d_g_refresh_disabled;
40 38
39 extern void r2d_process_onoff_message(T_R2D_EVT *msg);
40
41 /* FreeCalypso addition */ 41 /* FreeCalypso addition */
42 int r2d_is_running; 42 int r2d_is_running;
43 43
44 /******************************************************************************* 44 /*******************************************************************************
45 ** Function r2d_core 45 ** Function r2d_core
48 ** 48 **
49 *******************************************************************************/ 49 *******************************************************************************/
50 T_RVM_RETURN r2d_core(void) 50 T_RVM_RETURN r2d_core(void)
51 { 51 {
52 BOOLEAN error_occured = FALSE; 52 BOOLEAN error_occured = FALSE;
53 // T_R2D_EVT * msg_ptr_rx, * msg_ptr_tx; 53 T_R2D_EVT *msg;
54 54
55 //r2d_start(); 55 //r2d_start();
56 56
57 rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM, 57 rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM,
58 RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID); 58 RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
68 { 68 {
69 UINT16 received_event; 69 UINT16 received_event;
70 //rvf_send_trace("WAIT EVENT",strlen("WAIT EVENT"), NULL_PARAM, 70 //rvf_send_trace("WAIT EVENT",strlen("WAIT EVENT"), NULL_PARAM,
71 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX ); 71 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
72 /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */ 72 /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
73 received_event = rvf_wait ( EVENT_MASK(RVF_APPL_EVT_0), 0); 73 received_event = rvf_wait(EVENT_MASK(RVF_APPL_EVT_0) |
74 RVF_TASK_MBOX_0_EVT_MASK, 0);
74 75
75 //rvf_send_trace("EVENT RECEIVED",strlen("EVENT RECEIVED"), NULL_PARAM, 76 //rvf_send_trace("EVENT RECEIVED",strlen("EVENT RECEIVED"), NULL_PARAM,
76 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX ); 77 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
77 78
78 /* If an event related to mailbox 0 is received, then */ 79 /* Check for mailbox events */
79 if (received_event & EVENT_MASK(RVF_APPL_EVT_0) ) 80 if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
81 {
82 /* Read the message in the driver mailbox and delegate action..*/
83 msg = (T_R2D_EVT *) rvf_read_mbox(RVF_TASK_MBOX_0);
84 if (msg) {
85 if (msg->os_hdr.msg_id == R2D_MESSAGE_ONOFF)
86 r2d_process_onoff_message(msg);
87 rvf_free_buf ((void *) msg);
88 }
89 }
90 /* Check for refresh trigger events */
91 if (received_event & EVENT_MASK(RVF_APPL_EVT_0))
80 { 92 {
81 //rvf_send_trace("GOOD EVENT",strlen("GOOD EVENT"), NULL_PARAM, 93 //rvf_send_trace("GOOD EVENT",strlen("GOOD EVENT"), NULL_PARAM,
82 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX ); 94 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
83 95
84 r2d_g_event_was_sent=FALSE; 96 r2d_g_event_was_sent=FALSE;
85 if (r2d_g_refresh_disabled==0) 97 if (r2d_g_refresh_disabled==0)
86 r2d_refresh(); 98 r2d_refresh();
87 rvf_delay(RVF_MS_TO_TICKS(R2D_REFRESH_PERIOD)); 99 rvf_delay(RVF_MS_TO_TICKS(R2D_REFRESH_PERIOD));
88 } 100 }
89
90 } 101 }
91 102
92 return RVM_OK; 103 return RVM_OK;
93 } 104 }