comparison src/cs/drivers/drv_app/pwr/pwr_process.c @ 145:246f4a7dd92b

src/cs/drivers/drv_app/pwr: import from MV100 source
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 Oct 2016 05:59:14 +0000
parents
children c93a236e0d50
comparison
equal deleted inserted replaced
144:fd8227e3047d 145:246f4a7dd92b
1 /*****************************************************************************/
2 /* */
3 /* Name pwr_process.c */
4 /* */
5 /* Function this file contains the pwr_process function, used to */
6 /* handle messages received in the SPI task mailbox. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------ */
12 /* */
13 /* Author Candice Bazanegue */
14 /* */
15 /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved */
16 /*****************************************************************************/
17
18 #include "rv_defined_swe.h" // for RVM_PWR_SWE
19
20 #ifdef RVM_PWR_SWE
21
22 #include "abb.h"
23 #include "rvm_use_id_list.h"
24 #include "rvf_api.h"
25 #include "pwr_messages_i.h"
26 #include "spi_env.h"
27
28
29 /*******************************************************************************
30 ** Function pwr_process
31 **
32 ** Description It is called by the spi task core.
33 ** Messages can be related to ABB interrupt handling, or
34 ** battery charge management.
35 **
36 *******************************************************************************/
37 void pwr_process(T_RV_HDR * msg_ptr)
38 {
39 void *ptr = NULL;
40
41 if (msg_ptr != NULL)
42 {
43 switch (msg_ptr->msg_id)
44 {
45 case PWR_SPI_INFO_BATTERY_EVT:
46 {
47 /* Battery voltage and charger current */
48 if (SPI_GBL_INFO_PTR->is_adc_on == FALSE)
49 {
50 /* start the channels conversion */
51 ABB_Write_Register_on_page(PAGE0, VBATREG, 0x0000);
52 }
53
54 /* Callback function */
55 if(((T_RV_HDR *)msg_ptr)->callback_func != NULL)
56 {
57 ((T_RV_HDR *)msg_ptr)->callback_func(ptr);
58 }
59
60 rvf_free_buf ((void *) msg_ptr);
61
62 break;
63 }
64
65 default:
66 {
67 /* Unknow message has been received */
68 rvf_send_trace("PWR_task : Received an unknown message",38, NULL_PARAM ,
69 RV_TRACE_LEVEL_DEBUG_HIGH, PWR_USE_ID);
70
71 rvf_free_buf ((void *) msg_ptr);
72
73 break;
74 }
75 } // end of switch
76 } // end of if
77 return;
78 }
79
80 #endif /* #ifdef RVM_PWR_SWE */
81
82
83