changeset 166:13af69b6a3dc

ETM core compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 19 Nov 2013 05:07:24 +0000
parents 9dbf3248a197
children df335d255ac4
files gsm-fw/services/etm/Makefile gsm-fw/services/etm/etm_env.c gsm-fw/services/etm/etm_task.c gsm-fw/services/etm/etm_tmcore.c gsm-fw/services/etm/etm_trace.c
diffstat 5 files changed, 117 insertions(+), 105 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/services/etm/Makefile	Tue Nov 19 04:23:29 2013 +0000
+++ b/gsm-fw/services/etm/Makefile	Tue Nov 19 05:07:24 2013 +0000
@@ -2,7 +2,7 @@
 CFLAGS=	-O2 -fno-builtin -mthumb-interwork -mthumb
 LD=	arm-elf-ld
 
-OBJS=	etm_api.o
+OBJS=	etm_api.o etm_env.o etm_task.o etm_tmcore.o etm_trace.o
 
 HDRS=	etm.h etm_api.h etm_at.h etm_audio_err.h etm_config.h etm_env.h \
 	etm_messages_i.h etm_misc.h etm_pool_size.h etm_trace.h etm_version.h
--- a/gsm-fw/services/etm/etm_env.c	Tue Nov 19 04:23:29 2013 +0000
+++ b/gsm-fw/services/etm/etm_env.c	Tue Nov 19 05:07:24 2013 +0000
@@ -16,12 +16,12 @@
  * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved
  *********************************************************************************/
 
-
-#include "etm/etm_env.h"
+#include "etm_config.h"
+#include "etm_env.h"
 
-#include "rvm/rvm_priorities.h"
-#include "rvm/rvm_use_id_list.h"
-#include "rv/rv_defined_swe.h"
+#include "../../riviera/rvm/rvm_priorities.h"
+#include "../../riviera/rvm/rvm_use_id_list.h"
+#include "../../riviera/rv/rv_defined_swe.h"
 
 #include <string.h>
 /******************************************************************************
@@ -57,41 +57,41 @@
 T_RVM_RETURN etm_get_info(T_RVM_INFO_SWE *swe_info)
 {
     /* SWE info */
-	swe_info->swe_type = RVM_SWE_TYPE_4;
+    swe_info->swe_type = RVM_SWE_TYPE_4;
     swe_info->type_info.type4.swe_use_id = ETM_USE_ID;
 
     memcpy(swe_info->type_info.type4.swe_name, "ETM", sizeof("ETM"));
-	swe_info->type_info.type4.stack_size = ETM_STACK_SIZE;
-	swe_info->type_info.type4.priority   = RVM_ETM_TASK_PRIORITY;
+    swe_info->type_info.type4.stack_size = ETM_STACK_SIZE;
+    swe_info->type_info.type4.priority   = RVM_ETM_TASK_PRIORITY;
 
-	/* Set the return path */
-	swe_info->type_info.type4.return_path.callback_func	= NULL;
-	swe_info->type_info.type4.return_path.addr_id	    = 0;
+    /* Set the return path */
+    swe_info->type_info.type4.return_path.callback_func	= NULL;
+    swe_info->type_info.type4.return_path.addr_id	    = 0;
 
-	/* memory bank info */
-	swe_info->type_info.type4.nb_mem_bank = 1;
-	
-	memcpy (swe_info->type_info.type4.mem_bank[0].bank_name, "ETM_PRIM", 9);
-	swe_info->type_info.type4.mem_bank[0].initial_params.size          = ETM_MB_PRIM_SIZE;
-	swe_info->type_info.type4.mem_bank[0].initial_params.watermark     = ETM_MB_PRIM_WATERMARK;
+    /* memory bank info */
+    swe_info->type_info.type4.nb_mem_bank = 1;
 
-	/* linked SWE info */
+    memcpy (swe_info->type_info.type4.mem_bank[0].bank_name, "ETM_PRIM", 9);
+    swe_info->type_info.type4.mem_bank[0].initial_params.size          = ETM_MB_PRIM_SIZE;
+    swe_info->type_info.type4.mem_bank[0].initial_params.watermark     = ETM_MB_PRIM_WATERMARK;
+
+    /* linked SWE info */
     /* this SWE requires the ATP SWE to run */
-#ifdef RVM_ATP_SWE
+#if ETM_ATP_SUPPORT
     swe_info->type_info.type4.nb_linked_swe = 1;
     swe_info->type_info.type4.linked_swe_id[0] = ATP_USE_ID;
 #else
-	 swe_info->type_info.type4.nb_linked_swe = 0;
+    swe_info->type_info.type4.nb_linked_swe = 0;
 #endif
 
-	/* generic functions */
-	swe_info->type_info.type4.set_info = etm_set_info;
-	swe_info->type_info.type4.init     = etm_init;
-	swe_info->type_info.type4.core     = etm_start;
-	swe_info->type_info.type4.stop     = etm_stop;
-	swe_info->type_info.type4.kill     = etm_kill;
+    /* generic functions */
+    swe_info->type_info.type4.set_info = etm_set_info;
+    swe_info->type_info.type4.init     = etm_init;
+    swe_info->type_info.type4.core     = etm_start;
+    swe_info->type_info.type4.stop     = etm_stop;
+    swe_info->type_info.type4.kill     = etm_kill;
 
-	return RVM_OK;
+    return RVM_OK;
 }
 
 
@@ -99,12 +99,12 @@
 * Function	  : etm_set_info
 *
 * Description : This function is called by the RV manager to inform  
-*				the driver SWE about task_id, mb_id and error function.
+*		the driver SWE about task_id, mb_id and error function.
 *
 * Parameters  : - T_RVF_ADDR_ID  addr_id: unique path to the SWE.
-*					 - T_RV_RETURN ReturnPath[], array of return path for linked SWE
-*					 - T_RVF_MB_ID mbId[]: array of memory bank ids.
-*					 - callback function to call in case of unrecoverable error.
+*		- T_RV_RETURN ReturnPath[], array of return path for linked SWE
+*		- T_RVF_MB_ID mbId[]: array of memory bank ids.
+*		- callback function to call in case of unrecoverable error.
 *
 * Return      : T_RVM_RETURN
 * 
@@ -116,36 +116,35 @@
 T_RVM_RETURN etm_set_info (T_RVF_ADDR_ID	addr_id, 
                            T_RV_RETURN		return_path[], 
                            T_RVF_MB_ID		bk_id[],
-                           T_RVM_RETURN	(*rvm_error_ft)(T_RVM_NAME			swe_name, 
-                                                        T_RVM_RETURN		error_cause, 
-                                                        T_RVM_ERROR_TYPE	error_type, 
-                                                        T_RVM_STRING		error_msg))
+                           T_RVM_RETURN	(*rvm_error_ft)(T_RVM_NAME	swe_name, 
+                                                        T_RVM_RETURN	error_cause, 
+                                                        T_RVM_ERROR_TYPE error_type, 
+                                                        T_RVM_STRING	error_msg))
 {
-	/* Create instance gathering all the variable used by EXPL instance */
-	if (rvf_get_buf(bk_id[0], 
-					sizeof(T_ETM_ENV_CTRL_BLK),
-					(T_RVF_BUFFER**)&etm_env_ctrl_blk) != RVF_GREEN)
-	{
-		/* The environemnt will cancel the ETM instance creation. */
-		return RVM_MEMORY_ERR;
-	}
-
+    /* Create instance gathering all the variable used by EXPL instance */
+    if (rvf_get_buf(bk_id[0], 
+		    sizeof(T_ETM_ENV_CTRL_BLK),
+		    (T_RVF_BUFFER**)&etm_env_ctrl_blk) != RVF_GREEN)
+    {
+	/* The environemnt will cancel the ETM instance creation. */
+	return RVM_MEMORY_ERR;
+    }
 
-	/* Store the pointer to the error function */
-	etm_env_ctrl_blk->error_ft = rvm_error_ft ;
-	/* Store the mem bank id. */
-	etm_env_ctrl_blk->prim_id = bk_id[0];
-   /* Store the addr id */
-	etm_env_ctrl_blk->addr_id = addr_id;
+    /* Store the pointer to the error function */
+    etm_env_ctrl_blk->error_ft = rvm_error_ft ;
+    /* Store the mem bank id. */
+    etm_env_ctrl_blk->prim_id = bk_id[0];
+    /* Store the addr id */
+    etm_env_ctrl_blk->addr_id = addr_id;
 
-	/*
-	 * Task ID (task_id) and Memory bank ID (mb_id) can be retrieved later 
-	 * using rvf_get_taskid and rvf_get_mb_id functions.
-	 */
+    /*
+     * Task ID (task_id) and Memory bank ID (mb_id) can be retrieved later 
+     * using rvf_get_taskid and rvf_get_mb_id functions.
+     */
 
-	/* return_path of linked SWE -> not used */
+    /* return_path of linked SWE -> not used */
 
-	return RVM_OK;
+    return RVM_OK;
 }
 
 
@@ -153,7 +152,7 @@
 * Function	  : etm_init
 *
 * Description : This function is called by the RV manager to initialize the 
-*				etm SWE before creating the task and calling etm_start. 
+*		etm SWE before creating the task and calling etm_start. 
 *
 * Parameters  : None
 *
@@ -174,7 +173,7 @@
 * Function	  : etm_start
 *
 * Description : This function is called by the RV manager to start the etm
-*				SWE, it is the body of the task.
+*		SWE, it is the body of the task.
 *
 * Parameters  : None
 *
@@ -188,7 +187,7 @@
 T_RVM_RETURN etm_start(void)
 {
     etm_task();
-	return RV_OK;
+    return RV_OK;
 }
 
 
@@ -201,7 +200,7 @@
 *
 * Return      : T_RVM_RETURN
 * 
-* History	  : 0.1 								
+* History	  : 0.1
 *
 ******************************************************************************/
 
@@ -214,7 +213,7 @@
 * Function	  : etm_kill
 *
 * Description : This function is called by the RV manager to kill the etm 
-*				SWE, after the etm_stop function has been called.
+*		SWE, after the etm_stop function has been called.
 *
 * Parameters  : None
 *
--- a/gsm-fw/services/etm/etm_task.c	Tue Nov 19 04:23:29 2013 +0000
+++ b/gsm-fw/services/etm/etm_task.c	Tue Nov 19 05:07:24 2013 +0000
@@ -20,23 +20,26 @@
  *********************************************************************************/
 
 
-#include "etm/etm.h"
-#include "etm/etm_api.h"
-#include "etm/etm_messages_i.h"
-#include "etm/etm_trace.h"
-#include "etm/etm_env.h"
+#include "etm.h"
+#include "etm_config.h"
+#include "etm_api.h"
+#include "etm_messages_i.h"
+#include "etm_trace.h"
+#include "etm_env.h"
 
+#if ETM_AUDIO_SUPPORT
 #include "audio/audio_api.h"
+#endif
 
-#include "rv/rv_general.h"
-#include "rvf/rvf_api.h"
-#include "rvt/rvt_gen.h"
-#include "rvf/rvf_target.h" 
-#include "rv/rv_defined_swe.h"
+#include "../../riviera/rv/rv_general.h"
+#include "../../riviera/rvf/rvf_api.h"
+#include "../../riviera/rvt/rvt_gen.h"
+#include "../../riviera/rvf/rvf_target.h" 
+#include "../../riviera/rv/rv_defined_swe.h"
 
 #include <string.h>
 
-#ifdef RVM_LCC_SWE
+#if ETM_LCC_SUPPORT
     #include "lcc/lcc_api.h"
     #include "lcc/lcc_cfg_i.h"
     #include "lcc/lcc.h"
@@ -58,7 +61,7 @@
 {	
     char                swe_name[ETM_NAME_MAX_LEN];
     int                 mid;
-	int                 task_id;
+    int                 task_id;
     T_RVF_ADDR_ID       addr_id;    // Unique mailbox (ID) of the SWE which will
                                     //receive the message
     ETM_CALLBACK_FUNC	rx_callback_func;
@@ -75,7 +78,7 @@
  *****************************************************************************/
 
 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk;
-#ifdef RVM_LCC_SWE
+#if ETM_LCC_SUPPORT
 extern T_PWR_CTRL_BLOCK *pwr_ctrl;
 #endif
 
@@ -83,10 +86,12 @@
 int etm_forward_packet(int mid, T_RV_HDR *msg);
 void etm_error_packet_send(int mid, int error);
 void etm_receive(unsigned char *inbuf, unsigned short size);
-int etm_ffs_pkt_receive(uint8 *data, int size);
 
+#if ETM_ATP_SUPPORT
 extern int etm_at_atp_message(void *msg);
-#ifdef RVM_LCC_SWE
+#endif
+
+#if ETM_LCC_SUPPORT
 extern int etm_pwr_ul(void *msg);
 extern int etm_pwr_dl(T_ETM_PKT *pkt, uint8 *buf, int insize);
 #endif
@@ -98,10 +103,12 @@
 T_RV_RET etm_task(void)
 {  
     extern int etm_core_init(void);
-    extern int etm_audio_init(void);
-#ifdef RVM_LCC_SWE
-    extern int etm_pwr_init(void);
-#endif
+    #if ETM_AUDIO_SUPPORT
+	extern int etm_audio_init(void);
+    #endif
+    #if ETM_LCC_SUPPORT
+	extern int etm_pwr_init(void);
+    #endif
 
     T_RV_HDR  *msg = NULL;
     T_ETM_PKT *pkt = NULL; 
@@ -114,8 +121,10 @@
     /* Entity registration to ETM */
     /* This should be in the individual SWE init. function*/
     status = etm_core_init();
+#if ETM_AUDIO_SUPPORT
     status = etm_audio_init();
-#ifdef RVM_LCC_SWE
+#endif
+#if ETM_LCC_SUPPORT
     status = etm_pwr_init();
 #endif
 
@@ -285,11 +294,11 @@
     if (mb_status == RVF_RED) {
 		tr_etm(TgTrFatal, "ETM: _malloc: Error to get memory");
         return NULL;
-	}
+    }
     /* The flag is yellow, there will soon be not enough memory anymore. */
-	else if (mb_status == RVF_YELLOW) {
-		tr_etm(TgTrFatal, "ETM: _malloc: Getting short on memory");
-	}
+    else if (mb_status == RVF_YELLOW) {
+	tr_etm(TgTrFatal, "ETM: _malloc: Getting short on memory");
+    }
 
     tr_etm(TgTrEtmLow,"ETM: _malloc: size(%d) at addr(0x%x)", size, addr);
     return addr;
--- a/gsm-fw/services/etm/etm_tmcore.c	Tue Nov 19 04:23:29 2013 +0000
+++ b/gsm-fw/services/etm/etm_tmcore.c	Tue Nov 19 05:07:24 2013 +0000
@@ -20,17 +20,18 @@
  * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved
  *********************************************************************************/
 
-#include "rv/rv_defined_swe.h"
-#include "rv/rv_general.h"
+#include "../../riviera/rv/rv_defined_swe.h"
+#include "../../riviera/rv/rv_general.h"
 
-#include "etm/etm.h"
-#include "etm/etm_api.h"
-#include "etm/etm_trace.h"
-#include "etm/etm_version.h"
+#include "etm.h"
+#include "etm_config.h"
+#include "etm_api.h"
+#include "etm_trace.h"
+#include "etm_version.h"
 
-#include "abb/abb.h"
+#include "../../bsp/abb+spi/abb.h"
+#include "../../bsp/abb+spi/spi_drv.h"
 
-#include "spi/spi_drv.h"
 extern void tr_etm_init(unsigned int mask);
 
 // Version of the ETM CORE module
@@ -93,7 +94,6 @@
    uint16 *mem16;
    uint32 *mem32;
    uint32 addr, tmp;
-   static unsigned char test_buf[64];
 
    param = unitsize = *buf & 0x3;
    if (unitsize == 0)
@@ -186,7 +186,6 @@
 
 int etm_codec_write(T_ETM_PKT *pkt, uint8 *buf)
 {
-    extern void ABB_Write_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id, SYS_UWORD16 value);
     uint16  page, reg, data;
     int result, reg_data;
 
@@ -216,11 +215,10 @@
 
 int etm_codec_read(T_ETM_PKT *pkt, uint8 *buf)
 {
-    extern SYS_UWORD16 ABB_Read_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id);
-    volatile uint16 value;
+    uint16 value;
     uint16 page, reg;
     int result, reg_data;
-  
+
     reg_data = *buf;
     if ((result = etm_pkt_put8(pkt, reg_data)) < 0)
         return result;
@@ -293,7 +291,7 @@
 		// Apparently works it only if we read this register?
     i = *(volatile uint16*) 0xfffff802;
     *(volatile uint16*) 0xfffff802 = 0x0001;  // Load timer
-    
+
     return ETM_OK;
 }
 
@@ -354,13 +352,17 @@
     extern uint16 etm_task_revision;
     int error, fid, ffs_tm_version;
     volatile int revision = 0;
+#if 0
     T_VERSION *l1s_version;
+#endif
 
     fid = etm_get32(buf);
 
     tr_etm(TgTrCore, "ETM CORE: _version: fid(0x%x)", fid);
 
+#if 0
     l1s_version = (T_VERSION*) l1s_get_version(); 
+#endif
 
     switch (fid) {
 // Code Versions related to ETM modules 
@@ -392,6 +394,7 @@
 // Code Versions related to L1, see in l1_defty.h 
 // Get the version on this way "revision = l1s.version.dsp_code_version;" 
 // doesn't work because of struct aligment -> compile flag -mw !!!!
+#if 0
     case SW_DSP_CODE_VERSION:
         revision = ((T_VERSION*) l1s_version)->dsp_code_version;
         error = etm_pkt_put32(pkt, revision);
@@ -416,6 +419,7 @@
         revision = ((T_VERSION*) l1s_version)->mcu_tm_version;
         error = etm_pkt_put32(pkt, revision);
         break;
+#endif
     default:
         error = ETM_NOSYS;
     }
@@ -488,7 +492,7 @@
     etm_pkt_put8(pkt, fid);
    
     switch (fid) {
-#ifdef RVM_ATP_SWE
+#if ETM_ATP_SUPPORT
     case 0x60: // old 'G'
         error = etm_at(pkt, (char *) buf);
         break;
--- a/gsm-fw/services/etm/etm_trace.c	Tue Nov 19 04:23:29 2013 +0000
+++ b/gsm-fw/services/etm/etm_trace.c	Tue Nov 19 05:07:24 2013 +0000
@@ -17,11 +17,11 @@
  *********************************************************************************/
 
 
-#include "etm/etm_trace.h"
-#include "etm/etm_env.h"
+#include "etm_trace.h"
+#include "etm_env.h"
 
-#include "rvf/rvf_api.h"
-#include "rvm/rvm_use_id_list.h"
+#include "../../riviera/rvf/rvf_api.h"
+#include "../../riviera/rvm/rvm_use_id_list.h"
 
 #include <string.h>
 #include <stdio.h>