MT2523 API Reference  LinkIt SDK v4
atci.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef ATCI_H
36 #define ATCI_H
37 #include "stdint.h"
38 #include "hal_uart.h"
39 
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
259 #define ATCI_UART_TX_FIFO_BUFFER_SIZE (1024)
260 
261 
273 typedef enum {
277 } atci_status_t;
278 
282 typedef enum {
289 
293 typedef enum {
294 
301 
313 typedef struct {
314  uint8_t response_buf[ATCI_UART_TX_FIFO_BUFFER_SIZE];
315  uint16_t response_len;
316  uint32_t response_flag;
319 
321 typedef struct {
322  char *string_ptr;
323  uint32_t string_len;
324  uint32_t name_len;
325  uint32_t parse_pos;
326  atci_cmd_mode_t mode;
329 
355 typedef struct {
356  char *command_head;
358  uint32_t hash_value1;
359  uint32_t hash_value2;
362 
364 typedef struct {
366  uint32_t item_table_size;
369 
392 extern atci_status_t atci_register_handler(atci_cmd_hdlr_item_t *table, int32_t hdlr_number);
393 
400 
401 
420 extern atci_status_t atci_init(uint16_t port);
421 
422 
427 extern void atci_processing(void);
428 
432 #ifdef __cplusplus
433 }
434 #endif
435 
436 
437 #endif
atci_cmd_hdlr_item_t * item_table
For more information, please refer to atci_cmd_hdlr_item_t.
Definition: atci.h:365
This structure defines AT command handler table structure.
Definition: atci.h:364
Auto append "\r\n" at the begining and end of the response string.
Definition: atci.h:297
This structure defines AT command handler structure.
Definition: atci.h:355
uint32_t response_flag
For more information, please refer to atci_response_flag_t.
Definition: atci.h:316
uint32_t hash_value2
Use hash value 2 in the AT command string to accelerate search for the command handler.
Definition: atci.h:359
Test mode command, such as "AT+CMD=?".
Definition: atci.h:286
atci_status_t
This enum defines the ATCI status types.
Definition: atci.h:273
atci_cmd_mode_t
This enum defines the input CMD mode.
Definition: atci.h:282
atci_status_t(* at_cmd_hdlr_fp)(atci_parse_cmd_param_t *parse_cmd)
This defines the callback function prototype.
Definition: atci.h:346
Execute mode command, such as "AT+CMD=<op>".
Definition: atci.h:285
This structure defines the response structure.
Definition: atci.h:313
This structure defines AT command handler input structure.
Definition: atci.h:321
uint32_t name_len
AT command name length.
Definition: atci.h:324
atci_status_t atci_register_handler(atci_cmd_hdlr_item_t *table, int32_t hdlr_number)
This function registers the AT command handler.
void atci_processing(void)
This function parses the input command to find the corresponding command handler and handle the respo...
Failed to register the AT command handler table.
Definition: atci.h:274
#define ATCI_UART_TX_FIFO_BUFFER_SIZE
This macro defines the data length of the AT command response.
Definition: atci.h:259
uint16_t response_len
The actual data length of response_buf.
Definition: atci.h:315
Auto append "OK\r\n" at the end of the response string.
Definition: atci.h:298
No error occurred during the function call.
Definition: atci.h:276
Active mode command, such as "AT+CMD".
Definition: atci.h:284
atci_status_t atci_send_response(atci_response_t *response)
This function sends the AT command response data or the URC data.
uint32_t string_len
The response data buffer.
Definition: atci.h:323
An error occurred during the function call.
Definition: atci.h:275
at_cmd_hdlr_fp command_hdlr
The command handler, please refer to at_cmd_hdlr_fp.
Definition: atci.h:357
atci_response_flag_t
This enum defines the bit type of the auto append operation used in response_flag of the atci_respons...
Definition: atci.h:293
uint32_t hash_value1
Use hash value 1 in the AT command string to accelerate search for the command handler.
Definition: atci.h:358
The input command doesn&#39;t belong to any of the four types.
Definition: atci.h:287
char * command_head
AT command string.
Definition: atci.h:356
Auto append "ERROR\r\n" at the end of the response string.
Definition: atci.h:299
uint32_t parse_pos
The length after detecting the AT command mode.
Definition: atci.h:325
Auto append "\r\n" at the end of the response string.
Definition: atci.h:295
The URC notification flag.
Definition: atci.h:296
Read mode command, such as "AT+CMD?".
Definition: atci.h:283
uint32_t item_table_size
The command item size in the item table.
Definition: atci.h:366
atci_cmd_mode_t mode
For more information, please refer to atci_cmd_mode_t.
Definition: atci.h:326
atci_status_t atci_init(uint16_t port)
This function initializes the ATCI module.
char * string_ptr
The input data buffer.
Definition: atci.h:322