FreeCalypso > hg > freecalypso-sw
changeset 157:e48ea5875df7
gsm-fw: SPI task code compiles and links
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 17 Nov 2013 09:17:06 +0000 |
parents | eba29cb0526c |
children | 97b671efff9c |
files | gsm-fw/bsp/abb+spi/Makefile gsm-fw/bsp/abb+spi/spi_api.c gsm-fw/bsp/abb+spi/spi_drv.c gsm-fw/bsp/abb+spi/spi_env.c gsm-fw/bsp/abb+spi/spi_process.c gsm-fw/bsp/abb+spi/spi_task.c |
diffstat | 6 files changed, 97 insertions(+), 109 deletions(-) [+] |
line wrap: on
line diff
--- a/gsm-fw/bsp/abb+spi/Makefile Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/Makefile Sun Nov 17 09:17:06 2013 +0000 @@ -2,7 +2,7 @@ CFLAGS= -O2 -fno-builtin -mthumb-interwork -mthumb LD= arm-elf-ld -OBJS= abb.o +OBJS= abb.o spi_api.o spi_drv.o spi_env.o spi_process.o spi_task.o HDRS= abb.h abb_core_inth.h abb_inline.h abb_inth.h spi_api.h spi_drv.h \ spi_env.h spi_pool_size.h spi_process.h spi_task.h
--- a/gsm-fw/bsp/abb+spi/spi_api.c Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/spi_api.c Sun Nov 17 09:17:06 2013 +0000 @@ -1,4 +1,4 @@ -/********************************************************************************* +/******************************************************************************* * * File Name: spi_api.c * @@ -12,21 +12,21 @@ * * Author: * -*********************************************************************************/ +*******************************************************************************/ -#include "rvf/rvf_api.h" -#include "spi/spi_api.h" -#include "spi/spi_env.h" -#include "spi/spi_process.h" -#include "rvm/rvm_use_id_list.h" +#include "../../riviera/rvf/rvf_api.h" +#include "spi_api.h" +#include "spi_env.h" +#include "spi_process.h" +#include "../../riviera/rvm/rvm_use_id_list.h" -/********************************************************************************/ -/* */ -/* Function Name: spi_abb_read */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: spi_abb_read */ +/* */ +/******************************************************************************/ T_RV_RET spi_abb_read(UINT16 page, UINT16 address, CALLBACK_FUNC_U16 CallBack) { T_SPI_READ *msgPtr; @@ -75,11 +75,11 @@ -/********************************************************************************/ -/* */ -/* Function Name: spi_abb_write */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: spi_abb_write */ +/* */ +/******************************************************************************/ T_RV_RET spi_abb_write(UINT16 page, UINT16 address, UINT16 data) { T_SPI_WRITE *msgPtr; @@ -125,11 +125,11 @@ -/********************************************************************************/ -/* */ -/* Function Name: spi_abb_conf_ADC */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: spi_abb_conf_ADC */ +/* */ +/******************************************************************************/ T_RV_RET spi_abb_conf_ADC(UINT16 channels, UINT16 itval) { T_SPI_ABB_CONF_ADC *msgPtr; @@ -176,11 +176,11 @@ -/********************************************************************************/ -/* */ -/* Function Name: spi_abb_read_ADC */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: spi_abb_read_ADC */ +/* */ +/******************************************************************************/ T_RV_RET spi_abb_read_ADC(UINT16 *Buff, CALLBACK_FUNC_NO_PARAM CallBack) { T_SPI_ABB_READ_ADC *msgPtr; @@ -224,4 +224,3 @@ return (RV_OK); } -
--- a/gsm-fw/bsp/abb+spi/spi_drv.c Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/spi_drv.c Sun Nov 17 09:17:06 2013 +0000 @@ -39,7 +39,7 @@ /* */ /**********************************************************************************/ -#include "spi/spi_drv.h" +#include "spi_drv.h" @@ -74,6 +74,3 @@ SPI_CLK_DISABLE #endif } - - -
--- a/gsm-fw/bsp/abb+spi/spi_env.c Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/spi_env.c Sun Nov 17 09:17:06 2013 +0000 @@ -16,15 +16,15 @@ /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved*/ /****************************************************************************/ -#include "spi/spi_env.h" -#include "rv/general.h" -#include "rvm/rvm_gen.h" -#include "rvm/rvm_priorities.h" -#include "rvm/rvm_use_id_list.h" +#include "spi_env.h" +#include "../../riviera/rv/general.h" +#include "../../riviera/rvm/rvm_gen.h" +#include "../../riviera/rvm/rvm_priorities.h" +#include "../../riviera/rvm/rvm_use_id_list.h" #include <string.h> //extern T_RV_RET spi_core(void); -#include "spi/spi_task.h" +#include "spi_task.h" /* global pointer to the error function */ @@ -223,6 +223,3 @@ /* free all memory buffer previously allocated */ return RV_OK; } - - -
--- a/gsm-fw/bsp/abb+spi/spi_process.c Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/spi_process.c Sun Nov 17 09:17:06 2013 +0000 @@ -17,11 +17,11 @@ /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved */ /*****************************************************************************/ -#include "rvf/rvf_api.h" -#include "spi/spi_api.h" -#include "rvm/rvm_use_id_list.h" -#include "spi/spi_process.h" -#include "rv/rv_defined_swe.h" // for RVM_PWR_SWE +#include "../../riviera/rvf/rvf_api.h" +#include "spi_api.h" +#include "../../riviera/rvm/rvm_use_id_list.h" +#include "spi_process.h" +#include "../../riviera/rv/rv_defined_swe.h" // for RVM_PWR_SWE @@ -160,5 +160,3 @@ } // end of if (msg_ptr != NULL) return 0; } - -
--- a/gsm-fw/bsp/abb+spi/spi_task.c Sun Nov 17 08:15:19 2013 +0000 +++ b/gsm-fw/bsp/abb+spi/spi_task.c Sun Nov 17 09:17:06 2013 +0000 @@ -1,39 +1,35 @@ /*****************************************************************************/ /* */ -/* Name spi_task.c */ +/* Name spi_task.c */ /* */ -/* Function this file contains the main SPI function: spi_core. */ -/* It contains the body of the SPI task. */ -/* It will initialize the SPI and then wait for messages */ -/* or functions calls. */ +/* Function this file contains the main SPI function: spi_core. */ +/* It contains the body of the SPI task. */ +/* It will initialize the SPI and then wait for messages */ +/* or functions calls. */ /* */ -/* Version 0.1 */ -/* Author Candice Bazanegue */ -/* */ -/* Date Modification */ -/* ------------------------------------ */ -/* 20/08/2000 Create */ -/* 01/09/2003 Modfication */ -/* Author Pascal Puel */ -/* */ +/* Version 0.1 */ +/* Author Candice Bazanegue */ +/* */ +/* Date Modification */ +/* ------------------------------------ */ +/* 20/08/2000 Create */ +/* 01/09/2003 Modfication */ +/* Author Pascal Puel */ +/* */ /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved */ /*****************************************************************************/ -#ifndef _WINDOWS - #include "chipset.cfg" - #if (CHIPSET == 12) - #include "inth/sys_inth.h" - #else - #include "inth/iq.h" // for IQ_Unmask() - #endif +#include "../iq.h" + +#if 0 // FreeCalypso #include "power/power.h" // for Switch_ON() #endif -#include "rv/rv_defined_swe.h" // for RVM_PWR_SWE -#include "rvm/rvm_use_id_list.h" -#include "spi/spi_env.h" -#include "spi/spi_process.h" -#include "spi/spi_task.h" +#include "../../riviera/rv/rv_defined_swe.h" // for RVM_PWR_SWE +#include "../../riviera/rvm/rvm_use_id_list.h" +#include "spi_env.h" +#include "spi_process.h" +#include "spi_task.h" #ifdef RVM_PWR_SWE #include "pwr/pwr_liion_cha.h" @@ -53,13 +49,14 @@ *******************************************************************************/ T_RV_RET spi_core(void) { - BOOLEAN error_occured = FALSE; - T_RV_HDR * msg_ptr; + BOOLEAN error_occured = FALSE; + T_RV_HDR * msg_ptr; - rvf_send_trace("SPI_task: Initialization", 24, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); + rvf_send_trace("SPI_task: Initialization", 24, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); SPI_GBL_INFO_PTR->SpiTaskReady = TRUE; -#ifndef _WINDOWS +#if 0 // FreeCalypso: deferring until L1 integration /* Unmask External Interrupt once the SPI task is started */ #if (CHIPSET == 12) // Unmask ABB ext interrupt @@ -68,59 +65,59 @@ // Unmask external (ABB) interrupt IQ_Unmask(IQ_EXT); #endif - // Get the switch on cause from ABB. - Set_Switch_ON_Cause(); + // Get the switch on cause from ABB. + Set_Switch_ON_Cause(); #endif - /* loop to process messages */ - while (error_occured == FALSE) + /* loop to process messages */ + while (error_occured == FALSE) + { + /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */ + UINT16 received_event = rvf_wait (0xffff, 0); + + /* If an event related to mailbox 0 is received, then */ + if (received_event & RVF_TASK_MBOX_0_EVT_MASK) { - /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */ - UINT16 received_event = rvf_wait (0xffff, 0); - - /* If an event related to mailbox 0 is received, then */ - if (received_event & RVF_TASK_MBOX_0_EVT_MASK) - { - /* Read the message in the driver mailbox and delegate action..*/ - msg_ptr = (T_RV_HDR *) rvf_read_mbox(SPI_MAILBOX); + /* Read the message in the driver mailbox and delegate action..*/ + msg_ptr = (T_RV_HDR *) rvf_read_mbox(SPI_MAILBOX); #ifdef RVM_PWR_SWE - if(spi_process(msg_ptr)) - { - pwr_process(msg_ptr); - } + if(spi_process(msg_ptr)) + { + pwr_process(msg_ptr); + } #else - spi_process(msg_ptr); - #endif - } + spi_process(msg_ptr); + #endif + } #ifdef RVM_PWR_SWE - /* Timers */ + /* Timers */ if (received_event & SPI_TIMER0_WAIT_EVENT) { pwr_bat_test_timer_process(); } - if (received_event & SPI_TIMER1_WAIT_EVENT) - /* timer used to detect the end of the CI charge */ + if (received_event & SPI_TIMER1_WAIT_EVENT) + /* timer used to detect the end of the CI charge */ { pwr_CI_charge_timer_process(); } if (received_event & SPI_TIMER2_WAIT_EVENT) - /* timer used to detect the end of the CV charge */ - { + /* timer used to detect the end of the CV charge */ + { pwr_CV_charge_timer_process(); } - if (received_event & SPI_TIMER3_WAIT_EVENT) - /* timer used to check the battery discharge level */ - { + if (received_event & SPI_TIMER3_WAIT_EVENT) + /* timer used to check the battery discharge level */ + { pwr_discharge_timer_process(); } - #endif - } // end of while - return RV_OK; + #endif + } // end of while + return RV_OK; }