FreeCalypso > hg > fc-tourmaline
view src/cs/drivers/drv_app/buzzer/pwt.c @ 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 | a72feaed133a |
children |
line wrap: on
line source
/* * This C module is a FreeCalypso addition: it implements hw driver functions * for Calypso buzzer output in PWT mode. */ #include "main/sys_types.h" #include "pwt.h" #include "fc-target.h" #define ASIC_CONF_REG (*(volatile SYS_UWORD16 *) 0xFFFEF008) #define PWT_MODE_MASK 0x0020 #define PWT_FRC_REG (*(volatile SYS_UWORD8 *) 0xFFFE8800) #define PWT_VCR_REG (*(volatile SYS_UWORD8 *) 0xFFFE8801) #define PWT_GCR_REG (*(volatile SYS_UWORD8 *) 0xFFFE8802) /* flag tells L1 to suppress deep sleep */ SYS_BOOL PWT_tone_is_on; void PWT_block_on(void) { #ifdef TARGET_HAS_BUZZER ASIC_CONF_REG |= PWT_MODE_MASK; PWT_GCR_REG = 0x01; #endif } void PWT_block_off(void) { #ifdef TARGET_HAS_BUZZER ASIC_CONF_REG &= ~PWT_MODE_MASK; PWT_GCR_REG = 0; #endif } void PWT_play_tone(SYS_UWORD8 note, SYS_UWORD8 volume) { #ifdef TARGET_HAS_BUZZER PWT_FRC_REG = note; PWT_VCR_REG = (volume << 1) | 1; PWT_tone_is_on = 1; #endif } void PWT_stop_tone(void) { #ifdef TARGET_HAS_BUZZER PWT_VCR_REG = 0; PWT_tone_is_on = 0; #endif }