FreeCalypso > hg > freecalypso-sw
changeset 571:8d6062f4e7e4
L1: l1_small.c reworked for FreeCalypso
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 10 Aug 2014 19:51:26 +0000 |
parents | 962f0d3a4e7e |
children | 0169f1e64341 |
files | gsm-fw/L1/cfile/Makefile gsm-fw/L1/cfile/l1_small_asm.S gsm-fw/L1/cfile/l1_small_defs.c |
diffstat | 3 files changed, 158 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gsm-fw/L1/cfile/Makefile Sun Aug 10 19:24:56 2014 +0000 +++ b/gsm-fw/L1/cfile/Makefile Sun Aug 10 19:51:26 2014 +0000 @@ -3,12 +3,14 @@ -I../tm_include -I../tm_cust0 -I../cust0 -I../tpudrv \ -DMOVE_IN_INTERNAL_RAM CFLAGS= -O2 -fno-builtin -mthumb-interwork +ASFLAGS=-mthumb-interwork LD= arm-elf-ld INTSED= ../intram.sed IOBJS= l1_api_hisr.o l1_cmplx_intram.o l1_ctl.o l1_drive.o l1_func.o \ - l1_mfmgr.o l1_sync_intram.o -XOBJS= l1_afunc.o l1_async.o l1_cmplx.o l1_init.o l1_pwmgr.o l1_sync.o + l1_mfmgr.o l1_small_asm.o l1_sync_intram.o +XOBJS= l1_afunc.o l1_async.o l1_cmplx.o l1_init.o l1_pwmgr.o l1_small_defs.o \ + l1_sync.o all: ${IOBJS} ${XOBJS}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/cfile/l1_small_asm.S Sun Aug 10 19:51:26 2014 +0000 @@ -0,0 +1,64 @@ +/* + * Assembly code extracted out of TI's l1_small.c + * + * This code is correct ONLY for CHIPSET 10 or 11 as currently used + * by FreeCalypso; see TI's original code for what changes would be + * needed to support other CHIPSETs. + */ + + .text + .code 32 + +/*-------------------------------------------------------*/ +/* _GSM_Small_Sleep */ +/* (formerly INT_Small_Sleep) */ +/*-------------------------------------------------------*/ +/* */ +/* Description: small sleep */ +/* ------------ */ +/* Called by TCT_Schedule main loop of Nucleus */ +/*-------------------------------------------------------*/ + +#define SMALL_SLEEP 0x01 +#define ALL_SLEEP 0x04 +#define PWR_MNGT 0x01 + + .globl _GSM_Small_Sleep +_GSM_Small_Sleep: + + ldr r0,Switch + ldr r0,[r0] + ldrb r1,[r0] + cmp r1,#PWR_MNGT + bne TCT_Schedule_Loop + + ldr r0,Mode + ldr r0,[r0] + ldrb r1,[r0] + cmp r1,#SMALL_SLEEP + beq Small_sleep_ok + cmp r1,#ALL_SLEEP + bne TCT_Schedule_Loop + +Small_sleep_ok: + +// ***************************************************** +//reset the DEEP_SLEEP bit 12 of CNTL_ARM_CLK register +// (Cf BUG_1278) + + ldr r0,addrCLKM @ pick up CNTL_ARM_CLK register address + ldrh r1,[r0] @ take the current value of the register + orr r1,r1,#0x1000 @ reset the bit + strh r1,[r0] @ store the result + + ldr r0,addrCLKM @ pick up CLKM clock register address + ldrh r1,[r0] @ take the current value of the register + bic r1,r1,#1 @ disable ARM clock + strh r1,[r0] + + B TCT_Schedule_Loop @ Return to TCT_Schedule main loop + +addrCLKM: .word 0xfffffd00 @ CLKM clock register address + +Mode: .word mode_authorized +Switch: .word switch_PWR_MNGT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/cfile/l1_small_defs.c Sun Aug 10 19:51:26 2014 +0000 @@ -0,0 +1,90 @@ +/* + * TI's original code had an l1_small.c module, containing the GSM small + * sleep function implemented in assembly (TI assembler syntax embedded + * in the C module via an individual asm() for each line, very poor style) + * and C definitions for two helper variables. In FreeCalypso we are + * moving the small sleep assembly code into a proper assembly module; + * this C module contains just the helper variable definitions. + */ + +#include "config.h" +#include "l1_confg.h" +#include "l1_macro.h" + +#if (CODE_VERSION == SIMULATION) + #include <string.h> + #include "l1_types.h" + #include "sys_types.h" + #include "l1_const.h" + #include "l1_time.h" + #if TESTMODE + #include "l1tm_defty.h" + #endif + #if (AUDIO_TASK == 1) + #include "l1audio_const.h" + #include "l1audio_cust.h" + #include "l1audio_defty.h" + #endif + #if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" + #endif + #if (L1_MP3 == 1) + #include "l1mp3_defty.h" + #endif + #if (L1_MIDI == 1) + #include "l1midi_defty.h" + #endif + #if (L1_AAC == 1) + #include "l1aac_defty.h" + #endif + #include "l1_defty.h" + #include "l1_varex.h" + #include "cust_os.h" + #include "l1_msgty.h" + + #include <stdio.h> + #include "sim_cfg.h" + #include "sim_cons.h" + #include "sim_def.h" + #include "sim_var.h" + +#else + #include <string.h> + + #include "l1_types.h" + #include "sys_types.h" + #include "l1_const.h" + #include "l1_time.h" + + #if TESTMODE + #include "l1tm_defty.h" + #endif + #if (AUDIO_TASK == 1) + #include "l1audio_const.h" + #include "l1audio_cust.h" + #include "l1audio_defty.h" + #endif + #if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" + #endif + #if (L1_MP3 == 1) + #include "l1mp3_defty.h" + #endif + #if (L1_MIDI == 1) + #include "l1midi_defty.h" + #endif + #if (L1_AAC == 1) + #include "l1aac_defty.h" + #endif + #include "l1_defty.h" + #include "l1_varex.h" + #include "../../gpf/inc/cust_os.h" + #include "l1_msgty.h" + #include "tpudrv.h" + +#endif + +UWORD8 *mode_authorized = &(l1s.pw_mgr.mode_authorized); +UWORD8 *switch_PWR_MNGT = &(l1_config.pwr_mngt);