drivers: modem: gsm: Define tx_lock timeout at the top

The tx_lock timeout is closely related to GSM_CMD_AT_TIMEOUT
& GSM_CMD_SETUP_TIMEOUT, and should be longer than both of
them, otherwise the gsm_ppp_stop might fail to lock the tx.

Define the timeout at the top of the driver and added a comment
to make it clear for the user.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2022-02-20 16:29:54 +08:00 committed by Carles Cufí
commit a5394e865a

View file

@ -30,6 +30,10 @@ LOG_MODULE_REGISTER(modem_gsm, CONFIG_MODEM_LOG_LEVEL);
#define GSM_CMD_READ_BUF 128
#define GSM_CMD_AT_TIMEOUT K_SECONDS(2)
#define GSM_CMD_SETUP_TIMEOUT K_SECONDS(6)
/* GSM_CMD_LOCK_TIMEOUT should be longer than GSM_CMD_AT_TIMEOUT & GSM_CMD_SETUP_TIMEOUT,
* otherwise the gsm_ppp_stop might fail to lock tx.
*/
#define GSM_CMD_LOCK_TIMEOUT K_SECONDS(10)
#define GSM_RX_STACK_SIZE CONFIG_MODEM_GSM_RX_STACK_SIZE
#define GSM_WORKQ_STACK_SIZE CONFIG_MODEM_GSM_WORKQ_STACK_SIZE
#define GSM_RECV_MAX_BUF 30
@ -1054,8 +1058,7 @@ void gsm_ppp_stop(const struct device *dev)
}
}
if (modem_cmd_handler_tx_lock(&gsm->context.cmd_handler,
K_SECONDS(10))) {
if (modem_cmd_handler_tx_lock(&gsm->context.cmd_handler, GSM_CMD_LOCK_TIMEOUT)) {
LOG_WRN("Failed locking modem cmds!");
}