FreeCalypso > hg > fc-tourmaline
view src/cs/services/buzm/buzm_api.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 | 8dfdf88d632f |
children |
line wrap: on
line source
/* * The implementation of our external API functions lives here. */ #include "buzm/buzm_api.h" #include "buzm/buzm_env.h" #include "buzm/buzm_messages_i.h" #include "rv/rv_general.h" #include "rvf/rvf_api.h" #include "rvm/rvm_use_id_list.h" #include "ffs/ffs_api.h" T_RV_RET buzm_play_melody(const char *pathname, UINT8 volume, BOOL loop) { struct buzm_start_msg *msg; T_FFS_FD fd; if (!buzm_env) return RV_NOT_READY; if (volume < BUZM_VOLUME_MIN || volume > BUZM_VOLUME_MAX) return RV_INVALID_PARAMETER; fd = ffs_open(pathname, FFS_O_RDONLY); if (fd <= 0) return RV_INVALID_PARAMETER; if (rvf_get_buf(buzm_env->prim_id, sizeof(struct buzm_start_msg), (T_RVF_BUFFER **)&msg) == RVF_RED) { rvf_send_trace( "rvf_get_buf() failed in buzm_play_melody()", 42, NULL_PARAM, RV_TRACE_LEVEL_ERROR, BUZM_USE_ID); ffs_close(fd); return RV_MEMORY_ERR; } msg->hdr.msg_id = BUZM_START_REQ; msg->hdr.src_addr_id = buzm_env->addr_id; msg->hdr.dest_addr_id = buzm_env->addr_id; msg->hdr.callback_func = NULL; msg->fd = fd; msg->volume = volume; msg->loop = loop; if (rvf_send_msg(buzm_env->addr_id, msg) != RV_OK) { rvf_send_trace("buzm_play_melody(): Send failed!", 32, NULL_PARAM, RV_TRACE_LEVEL_ERROR, BUZM_USE_ID); rvf_free_buf(msg); ffs_close(fd); return RV_INTERNAL_ERR; } return RV_OK; } T_RV_RET buzm_stop_melody(void) { struct buzm_stop_msg *msg; if (!buzm_env) return RV_NOT_READY; if (rvf_get_buf(buzm_env->prim_id, sizeof(struct buzm_stop_msg), (T_RVF_BUFFER **)&msg) == RVF_RED) { rvf_send_trace( "rvf_get_buf() failed in buzm_stop_melody()", 42, NULL_PARAM, RV_TRACE_LEVEL_ERROR, BUZM_USE_ID); return RV_MEMORY_ERR; } msg->hdr.msg_id = BUZM_STOP_REQ; msg->hdr.src_addr_id = buzm_env->addr_id; msg->hdr.dest_addr_id = buzm_env->addr_id; msg->hdr.callback_func = NULL; if (rvf_send_msg(buzm_env->addr_id, msg) != RV_OK) { rvf_send_trace("buzm_stop_melody(): Send failed!", 32, NULL_PARAM, RV_TRACE_LEVEL_ERROR, BUZM_USE_ID); rvf_free_buf(msg); return RV_INTERNAL_ERR; } return RV_OK; }