FreeCalypso > hg > tcs211-l1-reconst
annotate chipsetsw/services/lls/lls_functions.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
rev | line source |
---|---|
0
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * @file lls_functions.c |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * Implementation of LLS functions. |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * @author Laurent Sollier (l-sollier@ti.com) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * @version 0.1 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 /* |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 * History: |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 * Date Author Modification |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 * ---------------------------------------- |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 * 03/12/2002 L Sollier Create |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 * (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #ifndef _WINDOWS |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 #include "l1sw.cfg" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 #include "chipset.cfg" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 #endif |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #include "lls/lls_i.h" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #include "lls/lls_api.h" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 #include "spi/spi_api.h" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 #include "rvf/rvf_api.h" |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 /* Number of available equipment's */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #define NUMBER_OF_EQUIPMENT 3 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 /* Parameters for each EQUIPMENT */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 typedef struct |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 T_LLS_EQUIPMENT equipment_sort; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 UINT16 page; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 UINT16 address; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 UINT8 bit; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 } T_EQUIPMENT_PARAM; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 /* Table of parameters for all the equipment's */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 typedef T_EQUIPMENT_PARAM T_EQUIPMENT_PARAM_TABLE[NUMBER_OF_EQUIPMENT]; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 /* Definition of the parameters for the equipment */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 #if (ANLG_FAM == 2) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 static T_EQUIPMENT_PARAM_TABLE equipment_param_table = |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 { {LLS_LED_A, PAGE1, AUXLED, 0}, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 {LLS_BACKLIGHT, PAGE1, AUXLED, 1}, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 {LLS_PRECHARGE_LED, PAGE0, BCICTL2, 5} |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 }; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 #else |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 static T_EQUIPMENT_PARAM_TABLE equipment_param_table = {0}; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 #endif |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 /* Save of the action to perform */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 typedef struct |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 T_LLS_EQUIPMENT equipment_index; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 UINT8 action; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 } T_ACTION; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 static T_ACTION action_to_perform = {0}; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 /* Mutex used to protect perform only one action simultaneously */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 static T_RVF_MUTEX mutex; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 * @name Functions implementation |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 * |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 /*@{*/ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 * function: lls_initialize |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 T_RV_RET lls_initialize(void) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 T_RV_RET ret = RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 UINT8 i; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 /* Mutex initialization */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 ret = rvf_initialize_mutex(&mutex); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 if (ret != RVF_OK) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 return RV_INTERNAL_ERR; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 /* Initialisation of the equipment at SWITCH_OFF */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 for (i = 0; i < NUMBER_OF_EQUIPMENT; i++) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 ret = lls_switch_off(equipment_param_table[i].equipment_sort); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 if (ret != RV_OK) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 return RV_INTERNAL_ERR; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 return RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 * function: lls_kill_service |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 T_RV_RET lls_kill_service(void) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 T_RV_RET ret = RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 ret = rvf_delete_mutex(&mutex); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 if (ret != RVF_OK) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 return RV_INTERNAL_ERR; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 return ret; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 * function: lls_callback_equipment_status |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 void lls_callback_equipment_status(UINT16* equipment_status) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 T_RV_RET ret = RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 UINT16 new_equipment_status = *equipment_status; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 LLS_SEND_TRACE_PARAM("LLS: Received equipment status", (UINT32) new_equipment_status, RV_TRACE_LEVEL_DEBUG_LOW); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 if (action_to_perform.action == SWITCH_ON) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 new_equipment_status |= 1 << equipment_param_table[action_to_perform.equipment_index].bit; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 else |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 new_equipment_status &= ~(1 << equipment_param_table[action_to_perform.equipment_index].bit); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 LLS_SEND_TRACE_PARAM("LLS: New equipment status", (UINT32) new_equipment_status, RV_TRACE_LEVEL_DEBUG_LOW); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 ret = spi_abb_write(equipment_param_table[action_to_perform.equipment_index].page, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 equipment_param_table[action_to_perform.equipment_index].address, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 new_equipment_status); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 if (ret != RV_OK) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 LLS_SEND_TRACE("LLS: Error on SPI read", RV_TRACE_LEVEL_ERROR); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 rvf_unlock_mutex(&mutex); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 * function: lls_manage_equipment |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 T_RV_RET lls_manage_equipment(UINT8 equipment_index, UINT8 action) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 T_RV_RET ret = RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 /* Lock mutex until response from SPI is received */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 rvf_lock_mutex(&mutex); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 /* Save action to do */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 action_to_perform.equipment_index = equipment_index; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 action_to_perform.action = action; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 ret = spi_abb_read(equipment_param_table[equipment_index].page, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 equipment_param_table[equipment_index].address, |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 lls_callback_equipment_status); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 if (ret != RV_OK) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 LLS_SEND_TRACE("LLS: Error on SPI read", RV_TRACE_LEVEL_ERROR); |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 return ret; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 /** |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 * function: lls_search_index |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 */ |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 T_RV_RET lls_search_index(T_LLS_EQUIPMENT equipment, UINT8* equipment_index) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 T_RV_RET ret = RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 UINT8 i; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 for (i = 0; i < NUMBER_OF_EQUIPMENT; i++) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 if (equipment == equipment_param_table[i].equipment_sort) |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 { |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 *equipment_index = i; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 return RV_OK; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 return RV_INVALID_PARAMETER; |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 } |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 |
509db1a7b7b8
initial import: leo2moko-r1
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 /*@}*/ |