annotate gsm-fw/bsp/abb+spi/spi_task.c @ 945:86ff6d0b0a97

loadtools: fc-compalram trivial utility added
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 02 Nov 2015 17:36:02 +0000
parents d8594785527c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*****************************************************************************/
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 /* */
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
3 /* Name spi_task.c */
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 /* */
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
5 /* Function this file contains the main SPI function: spi_core. */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
6 /* It contains the body of the SPI task. */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
7 /* It will initialize the SPI and then wait for messages */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
8 /* or functions calls. */
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 /* */
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
10 /* Version 0.1 */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
11 /* Author Candice Bazanegue */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
12 /* */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
13 /* Date Modification */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
14 /* ------------------------------------ */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
15 /* 20/08/2000 Create */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
16 /* 01/09/2003 Modfication */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
17 /* Author Pascal Puel */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
18 /* */
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 /*****************************************************************************/
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
592
d8594785527c gsm-fw/bsp/abb+spi/spi_task.c: unmask ABB interrupt when L1 is present
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 589
diff changeset
22 #include "../../include/config.h"
d8594785527c gsm-fw/bsp/abb+spi/spi_task.c: unmask ABB interrupt when L1 is present
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 589
diff changeset
23
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
24 #include "../iq.h"
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
25
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
26 #if 0 // FreeCalypso
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 #include "power/power.h" // for Switch_ON()
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
30 #include "../../riviera/rv/rv_defined_swe.h" // for RVM_PWR_SWE
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
31 #include "../../riviera/rvm/rvm_use_id_list.h"
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
32 #include "spi_env.h"
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
33 #include "spi_process.h"
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
34 #include "spi_task.h"
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 #ifdef RVM_PWR_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 #include "pwr/pwr_liion_cha.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 #include "pwr/pwr_disch.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 #include "pwr/pwr_process.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 #include "pwr/pwr_env.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 /*******************************************************************************
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 ** Function spi_core
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 **
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 ** Description Core of the spi task, which initiliazes the spi SWE and
589
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
49 ** waits for messages.
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 **
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 *******************************************************************************/
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 T_RV_RET spi_core(void)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 {
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
54 BOOLEAN error_occured = FALSE;
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
55 T_RV_HDR * msg_ptr;
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
57 rvf_send_trace("SPI_task: Initialization", 24, NULL_PARAM,
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
58 RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID);
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 SPI_GBL_INFO_PTR->SpiTaskReady = TRUE;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60
592
d8594785527c gsm-fw/bsp/abb+spi/spi_task.c: unmask ABB interrupt when L1 is present
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 589
diff changeset
61 #if CONFIG_INCLUDE_L1
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 /* Unmask External Interrupt once the SPI task is started */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 #if (CHIPSET == 12)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 // Unmask ABB ext interrupt
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 F_INTH_ENABLE_ONE_IT(C_INTH_ABB_IRQ_IT);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 #else
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 // Unmask external (ABB) interrupt
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 IQ_Unmask(IQ_EXT);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 #endif
592
d8594785527c gsm-fw/bsp/abb+spi/spi_task.c: unmask ABB interrupt when L1 is present
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 589
diff changeset
70 #endif
d8594785527c gsm-fw/bsp/abb+spi/spi_task.c: unmask ABB interrupt when L1 is present
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 589
diff changeset
71 #if 0 // FreeCalypso: deferring until UI integration
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
72 // Get the switch on cause from ABB.
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
73 Set_Switch_ON_Cause();
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
76 /* loop to process messages */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
77 while (error_occured == FALSE)
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
78 {
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
79 /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
80 UINT16 received_event = rvf_wait (0xffff, 0);
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
81
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
82 /* If an event related to mailbox 0 is received, then */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
83 if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 {
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
85 /* Read the message in the driver mailbox and delegate action..*/
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
86 msg_ptr = (T_RV_HDR *) rvf_read_mbox(SPI_MAILBOX);
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 #ifdef RVM_PWR_SWE
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
89 if(spi_process(msg_ptr))
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
90 {
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
91 pwr_process(msg_ptr);
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
92 }
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 #else
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
94 spi_process(msg_ptr);
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
95 #endif
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
96 }
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 #ifdef RVM_PWR_SWE
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
99 /* Timers */
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 if (received_event & SPI_TIMER0_WAIT_EVENT)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 pwr_bat_test_timer_process();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
105 if (received_event & SPI_TIMER1_WAIT_EVENT)
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
106 /* timer used to detect the end of the CI charge */
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 pwr_CI_charge_timer_process();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 if (received_event & SPI_TIMER2_WAIT_EVENT)
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
112 /* timer used to detect the end of the CV charge */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
113 {
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 pwr_CV_charge_timer_process();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
117 if (received_event & SPI_TIMER3_WAIT_EVENT)
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
118 /* timer used to check the battery discharge level */
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
119 {
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 pwr_discharge_timer_process();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 }
157
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
122 #endif
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
123 } // end of while
e48ea5875df7 gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
124 return RV_OK;
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128
589
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
129 /*******************************************************************************
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 * Function : spi_adc_on
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 *
589
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
132 * Description : Put the variable is_adc_on of the T_SPI_GBL_INFO structure
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
133 * to TRUE.
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
134 * This variable is used for the battery management.
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 * This function is called by the CST entity.
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 *
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 * Parameters : None
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 *
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 * Return : None
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 *
589
54459b912ef0 gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 157
diff changeset
141 *******************************************************************************/
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 void spi_adc_on (void)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 SPI_GBL_INFO_PTR->is_adc_on = TRUE;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 rvf_send_trace("SPI: ADC are on",15,
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 NULL_PARAM,
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 RV_TRACE_LEVEL_DEBUG_LOW,
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 SPI_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 }