annotate gsm-fw/bsp/abb+spi/abb_inth.c @ 665:39bacc7d5c49

gsm-fw: starting to compile comlib
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 05:42:46 +0000
parents 6fd70825db76
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
588
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
1 /******************************************************************************/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
2 /* TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
3 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
4 /* Property of Texas Instruments -- For Unrestricted Internal Use Only */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
5 /* Unauthorized reproduction and/or distribution is strictly prohibited. This*/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
6 /* product is protected under copyright law and trade secret law as an*/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
7 /* unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All*/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
8 /* rights reserved. */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
9 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
10 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
11 /* Filename : abb_inth.c */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
12 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
13 /* Description : Functions to manage the ABB device interrupt. */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
14 /* The Serial Port Interface is used to connect the TI */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
15 /* Analog BaseBand (ABB). */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
16 /* It is assumed that the ABB is connected as the SPI */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
17 /* device 0, and ABB interrupt is mapped as external IT. */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
18 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
19 /* Author : Pascal PUEL */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
20 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
21 /* Version number : 1.2 */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
22 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
23 /* Date and time : 07/02/03 */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
24 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
25 /* Previous delta : Creation */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
26 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
27 /******************************************************************************/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
28 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
29 /* 17/12/03 */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
30 /* The original abb_inth.c has been splitted between the actual abb_inth.c */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
31 /* located in drv_apps directory and abb_inth_core.c located in drv_core */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
32 /* directory. */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
33 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
34 /******************************************************************************/
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
36 #include "../../include/config.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
37 #include "../../include/sys_types.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
38 #include "../../riviera/rv/general.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
39 #include "../../nucleus/nucleus.h" // for NUCLEUS functions and types
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
41 #include "../../L1/include/l1_confg.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
42 #include "../../L1/include/l1_macro.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
43
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 #include <string.h>
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
45 #include "abb_inth.h"
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
47 #include "../../riviera/rv/rv_defined_swe.h" // for RVM_PWR_SWE
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 #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
50 #include "sys_inth.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 #else
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
52 #include "../iq.h"
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
55 #include "../../gpf/inc/cust_os.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
56 #include "../../L1/include/l1_signa.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
57 #include "abb.h"
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 #if defined (OP_WCP)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 #include "ffs/ffs.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 #include "ffs/board/ffspcm.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
64 #include "../../riviera/rvm/rvm_use_id_list.h" // for SPI_USE_ID
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
65 #include "spi_env.h"
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
66 #include "spi_process.h" // for ABB_EXT_IRQ_EVT
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
67 #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
68 #include "kpd/kpd_power_api.h" // for kpd_power_key_pressed()
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 #include "power/power.h"
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
70 #endif
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 #ifdef RVM_LCC_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 #include "lcc/lcc_api.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 #include "lcc/lcc_cfg_i.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 #include "lcc/lcc.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 #include "lcc/lcc_env.h"
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 #endif
588
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
78 /******************************************************************************/
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
79 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
80 /* Function Name: spi_abb_read_int_reg_callback */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
81 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
82 /* Purpose: Callback function */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
83 /* Called when an external interrupt has occured and the */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
84 /* ABB interrupt register has been read. */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
85 /* */
1c0033c2fe33 gsm-fw/bsp/abb+spi/abb*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 148
diff changeset
86 /******************************************************************************/
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 void spi_abb_read_int_reg_callback(SYS_UWORD16 *read_value)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 SYS_UWORD16 loop_count;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 SYS_UWORD16 status_value;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 xSignalHeaderRec *adc_msg;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 volatile SYS_UWORD8 i;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 #ifdef RVM_LCC_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 struct pwr_adc_ind_s *addr;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 extern T_PWR_CTRL_BLOCK *pwr_ctrl;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
99 /*
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
100 * FreeCalypso: the following logic, which makes sense for complete
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
101 * phones but not for Openmoko-style modems, has not been integrated
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
102 * yet.
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
103 */
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
104 #if 0
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 // check all the possible causes of the ABB IT
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 if (*read_value & PUSHOFF_IT_STS)
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 /* Push Button from ON to OFF */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 if (SPI_GBL_INFO_PTR->is_gsm_on == TRUE)
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 NU_Sleep(SHORT_OFF_KEY_PRESSED);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 // WCP Patch
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 #if (OP_WCP == 1)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 // Backup of GSM FFS is remotely handled by MPU-S
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 // we trigger the backup upon each ON->OFF transition
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 ffs_backup ();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 #else
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 /* Since this callback function is called from the SPI task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 it can't be interrupted by another task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 so we can directly access the SPI through the low-level driver */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 status_value = (ABB_Read_Status() & ONREFLT);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 #elif (ANLG_FAM == 3)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 status_value = (ABB_Read_Register_on_page(PAGE1, VRPCCFG) & PWOND);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 if (status_value == PWR_OFF_KEY_PRESSED)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 /* Inform keypad that key ON/OFF has been pressed */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 kpd_power_key_pressed();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 loop_count = 0;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 /* Wait loop for Power-OFF */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 while ((loop_count < OFF_LOOP_COUNT) &&
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 (status_value == PWR_OFF_KEY_PRESSED))
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 NU_Sleep(SHORT_OFF_KEY_PRESSED);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 status_value = (ABB_Read_Status() & ONREFLT);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 #elif (ANLG_FAM == 3)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 status_value = (ABB_Read_Register_on_page(PAGE1, VRPCCFG) & PWOND);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 loop_count++;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 if (status_value == PWR_OFF_KEY_PRESSED) /* Power-OFF request detected */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 rvf_send_trace("IQ EXT: Power Off request",25, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
151
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 Power_OFF_Button();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 #endif //WCP
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 else /* GSM OFF */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 rvf_send_trace("IQ EXT: Power On request",24, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
160
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 Power_ON_Button();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 else if (*read_value & REMOT_IT_STS)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 rvf_send_trace("IQ EXT: Power Off remote request",32, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
168
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 /* 'Remote Power' from ON to OFF */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 Power_OFF_Remote();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 }
591
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
172 #else
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
173 /* dummy to satisfy C */
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
174 if (0)
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
175 ;
6fd70825db76 gsm-fw/bsp/abb+spi: abb_inth.c compiles with L1 enabled
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 588
diff changeset
176 #endif
148
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 else if (*read_value & ADCEND_IT_STS)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 rvf_send_trace("IQ EXT: ADC End",15, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
181
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 /* ADC end of conversion */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 ABB_Read_ADC(&SPI_GBL_INFO_PTR->adc_result[0]);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 adc_msg = os_alloc_sig(sizeof(T_CST_ADC_RESULT));
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 if(adc_msg != NULL)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 adc_msg->SignalCode = CST_ADC_RESULT;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 for(i=0;i<MADC_NUMBER_OF_MEAS;i++)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 ((T_CST_ADC_RESULT *)(adc_msg->SigP))->adc_result[i] = SPI_GBL_INFO_PTR->adc_result[i];
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 os_send_sig(adc_msg, RRM1_QUEUE);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 #ifdef RVM_LCC_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 // Send ADC measurement to PWR (LCC) task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 // NOTE that memory is allocated externally in the PWR task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_adc_ind_s), (void *)&addr) == RVF_RED) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 rvf_send_trace("rvf_get_buf failed",18, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 /* Unmask External interrupt */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 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
201 // rvf_dump_mem();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 return;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 addr->header.msg_id = PWR_ADC_IND;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 addr->header.src_addr_id = SPI_GBL_INFO_PTR->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 addr->header.dest_addr_id = pwr_ctrl->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 addr->header.callback_func = NULL;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 // FIXME: memcpy from SPI_GBL_INFO_PTR->adc_result - make sure it has not been de-allocated
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 memcpy(addr->data, SPI_GBL_INFO_PTR->adc_result, 8*2);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 addr->data[9] = ABB_Read_Status();; // Read & assign ITSTATREG status so we save the polling in PWR task!!
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 if (rvf_send_msg(pwr_ctrl->addr_id, addr) != RV_OK) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 rvf_send_trace("SPI FATAL: Send failed!",23, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 #if (defined(RVM_PWR_SWE) || defined(RVM_LCC_SWE))
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 else if (*read_value & CHARGER_IT_STS)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 /* Charger plug IN or OUT */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223 status_value = ABB_Read_Status();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 #elif (ANLG_FAM == 3)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 status_value = ABB_Read_Register_on_page(PAGE1, VRPCCFG);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227 if (status_value & CHGPRES)
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 rvf_send_trace("IQ EXT: Charger Plug",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
230 #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
231 PWR_Charger_Plug(); /* charger plugged IN */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 #ifdef RVM_LCC_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 // Forward charger plug indication to PWR (LCC) task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 // NOTE that memory is allocated externally in the PWR task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 rvf_send_trace("rvf_get_buf failed#1",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 rvf_dump_mem();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 addr->header.msg_id = PWR_CHARGER_PLUGGED_IND;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 addr->header.src_addr_id = SPI_GBL_INFO_PTR->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 addr->header.dest_addr_id = pwr_ctrl->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 addr->header.callback_func = NULL;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244 if (rvf_send_msg(pwr_ctrl->addr_id, addr) != RV_OK) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 rvf_send_trace("SPI FATAL: Send failed!",23, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 else
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 rvf_send_trace("IQ EXT: Charger Unplug",22, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, 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
252
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 #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
254 PWR_Charger_Unplug(); /* charger plugged OUT */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 #ifdef RVM_LCC_SWE
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 // Forward charger unplug indication to PWR (LCC) task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 // NOTE that memory is allocated externally in the PWR task
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 rvf_send_trace("rvf_get_buf failed#2",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 rvf_dump_mem();
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 addr->header.msg_id = PWR_CHARGER_UNPLUGGED_IND;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 addr->header.src_addr_id = SPI_GBL_INFO_PTR->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 addr->header.dest_addr_id = pwr_ctrl->addr_id;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 addr->header.callback_func = NULL;
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 if (rvf_send_msg(pwr_ctrl->addr_id, addr) != RV_OK) {
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 rvf_send_trace("SPI FATAL: Send failed!",23, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272 }
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 #endif /* RVM_PWR_SWE || RVM_LCC_SWE */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 /* Unmask External interrupt */
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 #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
278 // 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
279 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
280 #else
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 // 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
282 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
283 #endif
63750f70796d gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 }