/* * @brief Open the specified channel for communication * - Send the OPEN_CONN command to the modem * - Return the operation status * * @param ch_ctx : The channel context to consider * * @return 0 when OK, error value otherwise */ int dlp_ctrl_open_channel(struct dlp_channel *ch_ctx) { int ret = 0; unsigned char param1 = PARAM1(ch_ctx->tx.pdu_size); unsigned char param2 = PARAM2(ch_ctx->tx.pdu_size); struct dlp_ctrl_context *ctrl_ctx = DLP_CTRL_CTX; /* Send the OPEN_CONN command */ ret = dlp_ctrl_cmd_send(ch_ctx, DLP_CMD_OPEN_CONN, DLP_CMD_ACK, DLP_CH_STATE_OPENING, DLP_CH_STATE_NONE, param1, param2, 0); /* Channel correctly opened ? */ if (ret == 0) { unsigned long flags; spin_lock_irqsave(&ctrl_ctx->open_lock, flags); dlp_ctrl_set_channel_state(ch_ctx->hsi_channel, DLP_CH_STATE_OPENED); spin_unlock_irqrestore(&ctrl_ctx->open_lock, flags); /* Check if we have any waiting OPEN_CONN */ ret = dlp_ctrl_send_ack_nack(ch_ctx); } return ret; }
void CommandDump(CmdReq_t *reqp, CmdParameters_t * paramp) { #ifdef COMMAND_DUMP CmdParameters_t *cmdparamp = paramp; printk("subcmd: %4x, flag: %d\n", reqp->subcmd, reqp->flag); if(cmdparamp) { printk("param1: %2x, param2: %2x, param3: %2x, param4: %2x\n", PARAM1(cmdparamp), \ PARAM2(cmdparamp), PARAM3(cmdparamp), PARAM4(cmdparamp)); } #endif }
/* * @brief Send the NOP command * * @param ch_ctx : The channel context to consider * * @return 0 when OK, error value otherwise */ int dlp_ctrl_send_nop(struct dlp_channel *ch_ctx) { int ret; unsigned char param1, param2, param3; param1 = PARAM1(DLP_NOP_CMD_CHECKSUM); param2 = PARAM2(DLP_NOP_CMD_CHECKSUM); param3 = PARAM3(DLP_NOP_CMD_CHECKSUM); /* Send the NOP command */ ret = dlp_ctrl_cmd_send(ch_ctx, DLP_CMD_NOP, DLP_CMD_NONE, DLP_CH_STATE_NONE, DLP_CH_STATE_NONE, param1, param2, param3); return ret; }