view src/cs/layer1/cfile/l1_small_asm.S @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents 4e78acac3d88
children
line wrap: on
line source

/*
 * 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	BIG_SMALL_SLEEP	0x05
#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
	beq	Small_sleep_ok
	cmp	r1,#BIG_SMALL_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