blob: c1a79f4476362d0699dfe7e5130b4ff8b2953fbb [file] [log] [blame]
hong.liucd370792025-05-28 06:29:19 -07001/**
2* @file : gsw_at_interface.h
3* @brief : atCmd and cpu
4* @date : 2022-12-09
5* @author : qinzhijiao6791
6* @version : v1.0
7* @copyright Copyright(C) 2022,Gosuncnwelink
8*/
9#ifndef __GSW_AT_INTERFACE__H__
10#define __GSW_AT_INTERFACE__H__
11
12/*********************************************************************************************/
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16#include <unistd.h>
17#include <pthread.h>
18#include <stddef.h>
19#include "gsw_hal_errcode.h"
20
21#define GSW_AT_SUCCESS GSW_HAL_SUCCESS
22#define GSW_AT_ERROR GSW_HAL_NORMAL_FAIL
23
24typedef enum{
25 soc_max=0,
26 cpu0,
27 cpu1,
28 cpu2,
29 cpu3,
30 gpu0,
31 gpu1,
32 dramc,
33 mmsys,
34 md_5g,
35 md_4g,
36 md_3g,
37 soc_dram_ntc,
38 pa_5g,
39 pa_4g,
40 rf_ntc,
41 pmic,
42 pmic_vcore,
43 pmic_vpro,
44 pmic_vgpu=19,
45 }ZONE_NUM;
46
47/**
48 * @brief at_callback
49 * @param [in] input whole atcmd
50 * @param [in] out_max_size atcmd result maxlenth
51 * @param [out] output atcmd result
52 * @retval
53 */
54typedef void(*LYNQ_AT_CALLBACK)(char input[],char output[],int out_max_size);
55
56/**
57 * @brief register at api, E02 and E06 unused
58 * @param [in] atcmd register part atcmd
59 * @param [in] func at_callback
60 * @retval 0: success
61 * @retval other: failed
62 */
63int gsw_reg_atcmd(const char *atcmd,LYNQ_AT_CALLBACK func);
64
65/**
66 * @brief at_init and modem-temp_init, E02 and E06 unused
67 * @param
68 * @retval 0: success
69 * @retval other: failed
70 */
71int gsw_sdk_at_init(void);
72
73/**
74 * @brief get modem temperture, E02 and E06 unused
hong.liud2417072025-06-27 07:10:37 -070075 * @details support thread safe
hong.liucd370792025-05-28 06:29:19 -070076 * @param [in] num ZONE_NUM
77 * @param [out] temp ZONE_NUM_TEMP
78 * @retval 0: LYNQ_THM_OK
79 * @retval -1: THM_OPEN_ERROR
80 * @retval -2: THM_READ_ERROR
81 * @retval -3: THM_ACCESS_ERROR
82 * @retval -4: ERROR_DEVICE
83 */
84int gsw_get_modem_temperture(ZONE_NUM num,int *temp);
85
86/**
87 * @brief sent AT Command and wait result
88 * @param [in] atcmd: at command
89 * @param [out] resp: at result
90 * @param [in] resp_len: length of result
91 * @param [in] timeout_ms: wait timeout millisecond
92 * @retval 0: success
93 * @retval other: failed
94 */
95int gsw_at_cmd_send(const char* atcmd, char* resp, uint32_t resp_len, int64_t timeout_ms);
96
97#endif //__GSW_AT_INTERFACE__H_