comparison src/cs/drivers/drv_app/pwr/pwr_process.c @ 0:b6a5e36de839

src/cs: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:39:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b6a5e36de839
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/rv_defined_swe.h" // for RVM_PWR_SWE
19
20 #ifdef RVM_PWR_SWE
21
22 #include "abb/abb.h"
23 #include "rvm/rvm_use_id_list.h"
24 #include "rvf/rvf_api.h"
25 #include "pwr/pwr_messages_i.h"
26 #include "spi/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