FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/services/etm/etm_task.c @ 166:13af69b6a3dc
ETM core compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 19 Nov 2013 05:07:24 +0000 |
parents | d78219c43fbf |
children |
comparison
equal
deleted
inserted
replaced
165:9dbf3248a197 | 166:13af69b6a3dc |
---|---|
18 * | 18 * |
19 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved | 19 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved |
20 *********************************************************************************/ | 20 *********************************************************************************/ |
21 | 21 |
22 | 22 |
23 #include "etm/etm.h" | 23 #include "etm.h" |
24 #include "etm/etm_api.h" | 24 #include "etm_config.h" |
25 #include "etm/etm_messages_i.h" | 25 #include "etm_api.h" |
26 #include "etm/etm_trace.h" | 26 #include "etm_messages_i.h" |
27 #include "etm/etm_env.h" | 27 #include "etm_trace.h" |
28 | 28 #include "etm_env.h" |
29 | |
30 #if ETM_AUDIO_SUPPORT | |
29 #include "audio/audio_api.h" | 31 #include "audio/audio_api.h" |
30 | 32 #endif |
31 #include "rv/rv_general.h" | 33 |
32 #include "rvf/rvf_api.h" | 34 #include "../../riviera/rv/rv_general.h" |
33 #include "rvt/rvt_gen.h" | 35 #include "../../riviera/rvf/rvf_api.h" |
34 #include "rvf/rvf_target.h" | 36 #include "../../riviera/rvt/rvt_gen.h" |
35 #include "rv/rv_defined_swe.h" | 37 #include "../../riviera/rvf/rvf_target.h" |
38 #include "../../riviera/rv/rv_defined_swe.h" | |
36 | 39 |
37 #include <string.h> | 40 #include <string.h> |
38 | 41 |
39 #ifdef RVM_LCC_SWE | 42 #if ETM_LCC_SUPPORT |
40 #include "lcc/lcc_api.h" | 43 #include "lcc/lcc_api.h" |
41 #include "lcc/lcc_cfg_i.h" | 44 #include "lcc/lcc_cfg_i.h" |
42 #include "lcc/lcc.h" | 45 #include "lcc/lcc.h" |
43 #include "lcc/lcc_env.h" | 46 #include "lcc/lcc_env.h" |
44 #include "lcc/lcc_trace.h" | 47 #include "lcc/lcc_trace.h" |
56 | 59 |
57 typedef struct | 60 typedef struct |
58 { | 61 { |
59 char swe_name[ETM_NAME_MAX_LEN]; | 62 char swe_name[ETM_NAME_MAX_LEN]; |
60 int mid; | 63 int mid; |
61 int task_id; | 64 int task_id; |
62 T_RVF_ADDR_ID addr_id; // Unique mailbox (ID) of the SWE which will | 65 T_RVF_ADDR_ID addr_id; // Unique mailbox (ID) of the SWE which will |
63 //receive the message | 66 //receive the message |
64 ETM_CALLBACK_FUNC rx_callback_func; | 67 ETM_CALLBACK_FUNC rx_callback_func; |
65 } T_ETM_USER_DB; | 68 } T_ETM_USER_DB; |
66 | 69 |
73 /****************************************************************************** | 76 /****************************************************************************** |
74 * Prototypes | 77 * Prototypes |
75 *****************************************************************************/ | 78 *****************************************************************************/ |
76 | 79 |
77 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk; | 80 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk; |
78 #ifdef RVM_LCC_SWE | 81 #if ETM_LCC_SUPPORT |
79 extern T_PWR_CTRL_BLOCK *pwr_ctrl; | 82 extern T_PWR_CTRL_BLOCK *pwr_ctrl; |
80 #endif | 83 #endif |
81 | 84 |
82 int etm_database_manager(T_RV_HDR *msg_p); | 85 int etm_database_manager(T_RV_HDR *msg_p); |
83 int etm_forward_packet(int mid, T_RV_HDR *msg); | 86 int etm_forward_packet(int mid, T_RV_HDR *msg); |
84 void etm_error_packet_send(int mid, int error); | 87 void etm_error_packet_send(int mid, int error); |
85 void etm_receive(unsigned char *inbuf, unsigned short size); | 88 void etm_receive(unsigned char *inbuf, unsigned short size); |
86 int etm_ffs_pkt_receive(uint8 *data, int size); | 89 |
87 | 90 #if ETM_ATP_SUPPORT |
88 extern int etm_at_atp_message(void *msg); | 91 extern int etm_at_atp_message(void *msg); |
89 #ifdef RVM_LCC_SWE | 92 #endif |
93 | |
94 #if ETM_LCC_SUPPORT | |
90 extern int etm_pwr_ul(void *msg); | 95 extern int etm_pwr_ul(void *msg); |
91 extern int etm_pwr_dl(T_ETM_PKT *pkt, uint8 *buf, int insize); | 96 extern int etm_pwr_dl(T_ETM_PKT *pkt, uint8 *buf, int insize); |
92 #endif | 97 #endif |
93 | 98 |
94 /****************************************************************************** | 99 /****************************************************************************** |
96 *****************************************************************************/ | 101 *****************************************************************************/ |
97 | 102 |
98 T_RV_RET etm_task(void) | 103 T_RV_RET etm_task(void) |
99 { | 104 { |
100 extern int etm_core_init(void); | 105 extern int etm_core_init(void); |
101 extern int etm_audio_init(void); | 106 #if ETM_AUDIO_SUPPORT |
102 #ifdef RVM_LCC_SWE | 107 extern int etm_audio_init(void); |
103 extern int etm_pwr_init(void); | 108 #endif |
104 #endif | 109 #if ETM_LCC_SUPPORT |
110 extern int etm_pwr_init(void); | |
111 #endif | |
105 | 112 |
106 T_RV_HDR *msg = NULL; | 113 T_RV_HDR *msg = NULL; |
107 T_ETM_PKT *pkt = NULL; | 114 T_ETM_PKT *pkt = NULL; |
108 UINT32 start_time = 0; | 115 UINT32 start_time = 0; |
109 UINT32 end_time = 0; | 116 UINT32 end_time = 0; |
112 int status = RV_OK, buf_size; | 119 int status = RV_OK, buf_size; |
113 | 120 |
114 /* Entity registration to ETM */ | 121 /* Entity registration to ETM */ |
115 /* This should be in the individual SWE init. function*/ | 122 /* This should be in the individual SWE init. function*/ |
116 status = etm_core_init(); | 123 status = etm_core_init(); |
124 #if ETM_AUDIO_SUPPORT | |
117 status = etm_audio_init(); | 125 status = etm_audio_init(); |
118 #ifdef RVM_LCC_SWE | 126 #endif |
127 #if ETM_LCC_SUPPORT | |
119 status = etm_pwr_init(); | 128 status = etm_pwr_init(); |
120 #endif | 129 #endif |
121 | 130 |
122 while (1) | 131 while (1) |
123 { | 132 { |
283 /* The flag returned by rvf_get_buf is red, there is not enough | 292 /* The flag returned by rvf_get_buf is red, there is not enough |
284 * memory to allocate the buffer. */ | 293 * memory to allocate the buffer. */ |
285 if (mb_status == RVF_RED) { | 294 if (mb_status == RVF_RED) { |
286 tr_etm(TgTrFatal, "ETM: _malloc: Error to get memory"); | 295 tr_etm(TgTrFatal, "ETM: _malloc: Error to get memory"); |
287 return NULL; | 296 return NULL; |
288 } | 297 } |
289 /* The flag is yellow, there will soon be not enough memory anymore. */ | 298 /* The flag is yellow, there will soon be not enough memory anymore. */ |
290 else if (mb_status == RVF_YELLOW) { | 299 else if (mb_status == RVF_YELLOW) { |
291 tr_etm(TgTrFatal, "ETM: _malloc: Getting short on memory"); | 300 tr_etm(TgTrFatal, "ETM: _malloc: Getting short on memory"); |
292 } | 301 } |
293 | 302 |
294 tr_etm(TgTrEtmLow,"ETM: _malloc: size(%d) at addr(0x%x)", size, addr); | 303 tr_etm(TgTrEtmLow,"ETM: _malloc: size(%d) at addr(0x%x)", size, addr); |
295 return addr; | 304 return addr; |
296 } | 305 } |
297 | 306 |