├── .gitignore ├── .gitmodules ├── .vscode ├── c_cpp_properties.json └── tasks.json ├── FW └── MC60CAR01A12.zip ├── Makefile ├── README.md ├── SDK ├── include │ ├── nema_pro.h │ ├── ql_adc.h │ ├── ql_ble.h │ ├── ql_clock.h │ ├── ql_common.h │ ├── ql_eint.h │ ├── ql_error.h │ ├── ql_fota.h │ ├── ql_fs.h │ ├── ql_gnss.h │ ├── ql_gpio.h │ ├── ql_gprs.h │ ├── ql_iic.h │ ├── ql_memory.h │ ├── ql_power.h │ ├── ql_pwm.h │ ├── ql_socket.h │ ├── ql_spi.h │ ├── ql_stdlib.h │ ├── ql_system.h │ ├── ql_time.h │ ├── ql_timer.h │ ├── ql_trace.h │ ├── ql_type.h │ ├── ql_uart.h │ └── ql_wtd.h ├── libs │ ├── app_image_bin.cfg │ └── gcc │ │ ├── app_start.lib │ │ └── linkscript.ld ├── make │ ├── GFH_Generator.exe │ └── header.dat └── ril │ ├── inc │ ├── lib_ril_sms.h │ ├── ril.h │ ├── ril_alarm.h │ ├── ril_audio.h │ ├── ril_ble.h │ ├── ril_ble_client.h │ ├── ril_bluetooth.h │ ├── ril_dtmf.h │ ├── ril_ftp.h │ ├── ril_gps.h │ ├── ril_http.h │ ├── ril_location.h │ ├── ril_location2.h │ ├── ril_network.h │ ├── ril_ntp.h │ ├── ril_sim.h │ ├── ril_sms.h │ ├── ril_system.h │ ├── ril_telephony.h │ └── ril_util.h │ └── src │ ├── Ril_dtmf.c │ ├── ril_alarm.c │ ├── ril_atResponse.c │ ├── ril_audio.c │ ├── ril_ble.c │ ├── ril_ble_clinet.c │ ├── ril_bluetooth.c │ ├── ril_custom.c │ ├── ril_ftp.c │ ├── ril_gps.c │ ├── ril_http.c │ ├── ril_init.c │ ├── ril_location.c │ ├── ril_location2.c │ ├── ril_network.c │ ├── ril_ntp.c │ ├── ril_sim.c │ ├── ril_sms.c │ ├── ril_system.c │ ├── ril_telephony.c │ ├── ril_urc.c │ └── ril_util.c ├── img ├── introduction.png └── vscode.png └── make.exe /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | dl/ 3 | docs/ 4 | build/ 5 | __tools/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src"] 2 | path = src 3 | url = https://github.com/ngohaibac/Quectel_MC60_OpenCPU 4 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "arm-none-eabi-gcc", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "${workspaceFolder}/src/", 8 | "${workspaceFolder}/SDK/include", 9 | "${workspaceFolder}/SDK/ril/inc", 10 | "${workspaceFolder}/src/fota/inc", 11 | "${workspaceFolder}/src/config", 12 | "C:\\Program Files (x86)\\CodeSourcery\\Sourcery_CodeBench_Lite_for_ARM_EABI\\arm-none-eabi\\include" 13 | ], 14 | "defines": [ 15 | "__CUSTOMER_CODE__" 16 | ], 17 | "intelliSenseMode": "gcc-x64", 18 | "compilerPath": "C:\\Program Files (x86)\\CodeSourcery\\Sourcery_CodeBench_Lite_for_ARM_EABI\\bin\\arm-none-eabi-gcc", 19 | "cStandard": "c11", 20 | "cppStandard": "c++17" 21 | } 22 | ], 23 | "version": 4 24 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build the MC60 Project", 6 | "type": "shell", 7 | "command": "make ", 8 | "args": [ 9 | "" 10 | ], 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "problemMatcher": [ 16 | "$gcc" 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /FW/MC60CAR01A12.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/FW/MC60CAR01A12.zip -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Configure GCC installation path, and GCC version. 3 | # To execute "arm-none-eabi-gcc -v" in command line can get the current gcc version 4 | #------------------------------------------------------------------------------- 5 | GCC_INSTALL_PATH=C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI 6 | GCC_VERSION=4.7.2 7 | 8 | C_PREDEF=-D __CUSTOMER_CODE__ 9 | 10 | #------------------------------------------------------------------------------- 11 | # Configure version and out target 12 | #------------------------------------------------------------------------------- 13 | PLATFORM = APPGS3MD 14 | MEMORY = M32 15 | VERSION = A01 16 | TARGET = $(strip $(PLATFORM))$(strip $(MEMORY))$(strip $(VERSION)) 17 | 18 | #------------------------------------------------------------------------------- 19 | # Configure the include directories 20 | #------------------------------------------------------------------------------- 21 | INCS = -I $(ENV_INC) 22 | INCS += -I ./ \ 23 | -I SDK/include \ 24 | -I SDK/ril/inc \ 25 | -I src/config \ 26 | -I src/fota/inc \ 27 | 28 | #------------------------------------------------------------------------------- 29 | # Configure source code dirctories 30 | #------------------------------------------------------------------------------- 31 | SRC_DIRS=src\ \ 32 | src\config \ 33 | src\fota\src \ 34 | SDK\ril\src \ 35 | 36 | #------------------------------------------------------------------------------- 37 | # Configure source code files to compile in the source code directories 38 | #------------------------------------------------------------------------------- 39 | # custom source 40 | SRC_CUS=$(wildcard src/*.c) 41 | SRC_SYS=$(wildcard src/config/*.c) 42 | SRC_FOTA=$(wildcard src/fota/src/*.c) 43 | SRC_SYS_RIL=$(wildcard SDK/ril/src/*.c) 44 | 45 | OBJS=\ 46 | $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRC_SYS)) \ 47 | $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRC_SYS_RIL)) \ 48 | $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRC_CUS)) \ 49 | $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRC_FOTA)) \ 50 | 51 | #------------------------------------------------------------------------------- 52 | # Configure user reference library 53 | #------------------------------------------------------------------------------- 54 | USERLIB=SDK/libs/gcc/app_start.lib 55 | 56 | #------------------------------------------------------------------------------- 57 | # Configure environment path 58 | #------------------------------------------------------------------------------- 59 | BIN_DIR=build 60 | OBJ_DIR=$(BIN_DIR)\obj 61 | BUILDLOG=$(BIN_DIR)/build.log 62 | ENV_PATH=$(strip $(GCC_INSTALL_PATH))/bin 63 | ENV_INC='$(strip $(GCC_INSTALL_PATH))/arm-none-eabi/include' 64 | ENV_LIB_EABI='$(strip $(GCC_INSTALL_PATH))/arm-none-eabi/lib/thumb' 65 | ENV_LIB_GCC='$(strip $(GCC_INSTALL_PATH))/lib/gcc/arm-none-eabi/$(GCC_VERSION)/thumb' 66 | 67 | #------------------------------------------------------------------------------- 68 | # Configure compiling utilities 69 | #------------------------------------------------------------------------------- 70 | CC='$(ENV_PATH)/arm-none-eabi-gcc.exe' 71 | LD='$(ENV_PATH)/arm-none-eabi-ld.exe' 72 | OBJCOPY='$(ENV_PATH)/arm-none-eabi-objcopy.exe' 73 | RM='$(ENV_PATH)/cs-rm.exe' 74 | MAKE=make.exe 75 | HEADGEN=SDK/make/GFH_Generator.exe 76 | #------------------------------------------------------------------------------- 77 | # Configure standard reference library 78 | #------------------------------------------------------------------------------- 79 | STDLIB=$(ENV_LIB_EABI)/libm.a $(ENV_LIB_EABI)/libc.a $(ENV_LIB_EABI)/libcs3.a $(ENV_LIB_GCC)/libgcc.a 80 | 81 | #------------------------------------------------------------------------------- 82 | # Configure compiling options 83 | #------------------------------------------------------------------------------- 84 | SFLAGS=-c -mlong-calls -march=armv5te -mlittle-endian -mthumb-interwork -mfpu=vfp -mfloat-abi=soft -Wall -Wstrict-prototypes -Os 85 | CFLAGS=-c -mlong-calls -march=armv5te -mlittle-endian -mthumb-interwork -mfpu=vfp -mfloat-abi=soft -Wall -Wstrict-prototypes -std=c99 -Os \ 86 | -ffunction-sections -pipe -ftracer -fivopts 87 | 88 | C_DEF=-D MT6252 -D __OCPU_COMPILER_GCC__ 89 | LDFLAGS=-Rbuild -X --gc-sections -T SDK/libs/gcc/linkscript.ld -nostartfiles 90 | OBJCOPYFLAGS= 91 | 92 | .PHONY: all 93 | all: new 94 | 95 | #------------------------------------------------------------------------------- 96 | # Definition for compiling procedure 97 | #------------------------------------------------------------------------------- 98 | new: CreateDir $(BIN_DIR)/$(TARGET).bin 99 | $(HEADGEN) $(BIN_DIR)/$(TARGET).bin 100 | @if not exist $(BIN_DIR)/app_image_bin.cfg (copy SDK\libs\app_image_bin.cfg $(BIN_DIR)/app_image_bin.cfg) 101 | 102 | $(BIN_DIR)/$(TARGET).bin: $(BIN_DIR)/$(TARGET).elf 103 | @$(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@ 104 | @echo ---------------------------------------------------- 105 | @echo - GCC Compiling Finished Sucessfully. 106 | @echo - The target image is in the '$(BIN_DIR)' directory. 107 | @echo ---------------------------------------------------- 108 | 109 | $(BIN_DIR)/$(TARGET).elf: $(OBJS) 110 | $(LD) $(LDFLAGS) -Map $(BIN_DIR)/$(TARGET).map -o $@ $(OBJS) $(USERLIB) $(STDLIB) 111 | 112 | $(OBJ_DIR)/%.o: %.S 113 | @echo - Building $@ 114 | $(CC) $(C_DEF) $(SFLAGS) -o $@ $< 115 | 116 | $(OBJ_DIR)/%.o: %.c 117 | # $(warning <-- Start to CC, C_PREDEF=$(C_PREDEF) -->) 118 | @echo - Building $@ 119 | $(CC) $(C_DEF) $(C_PREDEF) $(CFLAGS) $(INCS) -o $@ $< 120 | 121 | CreateDir: 122 | @$(RM) -f $(BIN_DIR)/$(TARGET).bin 123 | @if not exist $(BIN_DIR) (md $(BIN_DIR)) 124 | @if not exist $(OBJ_DIR) (md $(OBJ_DIR)) 125 | @for /d %%y in ($(SRC_DIRS)) do \ 126 | @if not exist $(OBJ_DIR)/%%y ( \ 127 | (@echo creating directory $(OBJ_DIR)\%%y) & \ 128 | (md $ $(OBJ_DIR)\%%y)) 129 | 130 | clean: 131 | $(RM) -f $(OBJS) $(BUILDLOG) \ 132 | $(BIN_DIR)/$(TARGET).map \ 133 | $(BIN_DIR)/$(TARGET).bin \ 134 | $(BIN_DIR)/$(TARGET).elf 135 | rmdir /s /q $(BIN_DIR) 136 | 137 | @echo ------------------- 138 | @echo clean finished. 139 | @echo ------------------- 140 | 141 | .PHONY: all clean CreateDir -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | As VSCode is the most popular SDK for developer and original SDK from Quectel is not VSCode friendly, so I write this repository to produce better VSCode intergration for MC60 OpenCPU development. 4 | 5 | Following things are improved compared to official SDK: 6 | - SDK folder: remove all tools, example folder that not needed for normal development 7 | - Makefile: make clear Makefile script to include src files located at `src` folder. 8 | - C language intelliSenseMode is configured 9 | 10 | ![MC60 SDK](img/vscode.png) 11 | 12 | Advantage of OpenCPU approach is that: you can write application firmware just inside MC60 Module, instead of using external MCU, so total solution cost is reduced. 13 | 14 | ![OpenCPU introduction](img/introduction.png) 15 | 16 | For MC60 Example Code, pls refer to [Quectel_MC60_OpenCPU](https://github.com/ngohaibac/Quectel_MC60_OpenCPU) repo. 17 | 18 | Current MC60 SDK: [MC60_OpenCPU_GS3_SDK_V1.7](http://www.quectel.com/ProductDownload/MC60_OpenCPU_GS3_SDK_V1.7.zip). 19 | 20 | TODO: 21 | - Add VSCode action context 22 | - Add burning script just inside VSCode 23 | 24 | ## MC60 Useful Information 25 | 26 | Officially Quectel provides following documents, tools for MC60 OpenCPU development: 27 | 28 | [MC60 Product info](https://www.quectel.com/product/MC60.htm): includes product specification, however you can't download documents without having registered account. 29 | 30 | [MC60 Documents and Tools](https://www.quectel.com/ProductDownload/MC60.html): included all needed documents like Software documents (AT Commands, and app notes), hardware documents (Reference design, footprint, ... ) 31 | 32 | [MC60 OpenCPU SDK](https://www.quectel.com/ProductDownload/MC60_OpenCPU_SDK.html): OpenCPU documents, GCC compiler, SDK 33 | 34 | You can read my blog post for more [Quectel IoT Modules Overview](https://bacnh.com/quectel-iot-product-overview/) 35 | 36 | ## Resource information 37 | 38 | Processor: 32-bit ARM7EJ-STM RISC 260MHz. 39 | 40 | MC60-OpenCPU (OC: MC60CA-04-STD) module builds in 4MB flash and 4MB RAM. 41 | - User App Code Space: 320KB space available for image bin. 42 | - RAM Space: 100KB static memory and 500KB dynamic memory. 43 | - User File System Space: 120KB available. 44 | 45 | ## Prepare 46 | 47 | I assump that VSCode is already installed in your machine. 48 | 49 | 1. Install [GCC Compiler](http://www.quectel.com/ProductDownload/GCC_Compiler_Setup.zip) with Administrator role and Windows 7 compability mode. 50 | 2. Flash the base FW: MC60CAR01A12 at [FW](/FW) folder 51 | 3. InstallMicrosoft [Visual C++ 2010 Redistributable Package (x86)](https://www.microsoft.com/en-us/download/details.aspx?id=5555) for image generation tool `GFH_Generator` to work. 52 | 53 | ## Usage 54 | 55 | Clone this repo and its submodule and open with VSCode. Another method, you can just download the [zip file](https://github.com/ngohaibac/Quectel_MC60_VSCode_SDK/archive/MC60.zip) 56 | 57 | ``` 58 | $ git clone --recursive https://github.com/ngohaibac/Quectel_MC60_VSCode_SDK.git 59 | $ cd Quectel_MC60_VSCode_SDK 60 | $ code . 61 | ``` 62 | 63 | Folder structure: 64 | ``` 65 | ├───.vscode 66 | ├───FW <-- Base firmware folder 67 | ├───img 68 | ├───SDK <-- SDK folder 69 | │ ├───include <-- SDK include header files 70 | │ ├───libs <-- Precompiled GCC library 71 | │ │ └───gcc 72 | │ ├───make <-- FW pkg generation tool 73 | │ └───ril <-- RIL src, can adjust to fit your need 74 | │ ├───inc 75 | │ └───src 76 | └───src 77 | ├───config 78 | └───fota 79 | ├───inc 80 | └───src 81 | ``` 82 | 83 | All development should be done inside `src` folder. 84 | In the `cmd` terminal, you can just type `make` to build the images. 85 | - To build fw: type `make` or select Terminal-->Run build task... (Ctr+Shift+B) 86 | - To clean fw: `make clean` 87 | 88 | *Note*: for this demo purpose, I just create submodule src that point to MC60 Example repository. You are free to link with your own src repository to build your application. 89 | 90 | ## How to upgrade SDK 91 | 92 | Copy over folder `include`, `libs` and `ril` from Quectel SDK to this repo SDK folder. 93 | 94 | ## Technical support and copyright 95 | 96 | I don't intend to create this repository to take over technical support from Quectel Wireless Solution. Thus, for particular technical support of MC60, pls goto respective Quectel FAE or Quectel forums. 97 | 98 | All SDK files and documents are belong to Quectel Wireless Solution copyright. 99 | 100 | *Note*: If you are working with MC60-E, pls goto branch MC60-E. 101 | -------------------------------------------------------------------------------- /SDK/include/nema_pro.h: -------------------------------------------------------------------------------- 1 | #ifndef __NMEA_PRO_H__ 2 | #define __NMEA_PRO_H__ 3 | 4 | #include "ql_type.h" 5 | #include "ql_stdlib.h" 6 | #define MAX_I2C_BUF_SIZE 255 7 | #define MAX_NMEA_LEN 255 8 | #define IIC_DEV_ADDR 0x20 9 | 10 | 11 | #define MSG_ID_IIC_READ_INDICATION 0x1011 12 | #define MSG_ID_OUTPUT_INDICATION 0x1012 13 | 14 | #define TIMERID1 100 15 | #define INTERVAL500MS 500 16 | #define INTERVAL5MS 5 17 | #define NMEA_TX_MAX 2048 18 | 19 | 20 | 21 | 22 | typedef enum 23 | { 24 | RXS_DAT_HBD, // receive HBD data 25 | RXS_PRM_HBD2, // receive HBD preamble 2 26 | RXS_PRM_HBD3, // receive HBD preamble 3 27 | RXS_DAT, // receive NMEA data 28 | RXS_DAT_DBG, // receive DBG data 29 | RXS_ETX, // End-of-packet 30 | } RX_SYNC_STATE_T; 31 | 32 | typedef struct 33 | { 34 | s16 inst_id; // 1 - NMEA, 2 - DBG, 3 - HBD 35 | s16 dat_idx; 36 | s16 dat_siz; 37 | }st_queue; 38 | 39 | extern u8 rd_buf[MAX_I2C_BUF_SIZE+1]; 40 | extern u8 tx_buf[NMEA_TX_MAX]; 41 | extern s32 tx_data_len; 42 | extern s32 tx_size; 43 | 44 | bool iop_init_pcrx( void ); 45 | void iop_pcrx_nmea( u8 data ); 46 | void iop_get_inst(s16 idx, s16 size, void *data); 47 | bool iop_inst_avail(s16 *inst_id, s16 *dat_idx, s16 *dat_siz) ; 48 | bool iop_init_pcrx( void ) ; 49 | 50 | void get_nmea(void); 51 | void extract_nmea(void); 52 | bool read_gps_I2C_buffer(void); 53 | s32 IIC_ReadBytes(u32 chnnlNo,u8 slaveAddr,u8 *buf,u32 len) ; 54 | s32 IIC_WriteBytyes(u32 chnnlNo,u8 slaveAddr,u8 *pdata,u32 len); 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /SDK/include/ql_adc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_adc.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module defines the information, and APIs related to the ADC function. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __QL_ADC_H__ 34 | #define __QL_ADC_H__ 35 | 36 | typedef enum 37 | { 38 | PIN_ADC0, 39 | PIN_ADC_MAX = 2 40 | }Enum_ADCPin; 41 | 42 | /***************************************************************** 43 | * Function: Ql_ADC_Register 44 | * 45 | * Description: 46 | * This function registers an ADC with the ADC pin name, 47 | * callback function and the customized parameter. 48 | * 49 | * Parameters: 50 | * adcPin: 51 | * ADC pin name, one value of Enum_ADCPin. 52 | * 53 | * callback_adc: 54 | * callback function, which will be invoked when the ADC result comes out. 55 | * 56 | * customParam: 57 | * A customized parameter, which can be used in the ADC interrupt handler. 58 | * It may be NULL if no customized parameter needs to be passed in. 59 | * 60 | * adcValue: 61 | * the average voltage value for the specified sampling times. 62 | * The range is 0~2800mV. Please also see "Ql_ADC_Init". 63 | * Return: 64 | * QL_RET_OK, this function succeeds. 65 | * QL_RET_ERR_NOSUPPORTPIN, the input IO is invalid. 66 | * other place. For example this IO has been using as GPIO. 67 | * QL_RET_ERR_ADC_ALREADY_REGISTERED, this ADC pin is registered already 68 | *****************************************************************/ 69 | typedef void (*Callback_ADC)(Enum_ADCPin adcPin, u32 adcValue, void *customParam); 70 | s32 Ql_ADC_Register(Enum_ADCPin adcPin, Callback_ADC callback_adc, void *customParam); 71 | 72 | /***************************************************************** 73 | * Function: Ql_ADC_Init 74 | * 75 | * Description: 76 | * This function configures the sampling parameters, 77 | * including sampling count and the interval. 78 | * 79 | * Note: 80 | * The ADC sampling result will be reported in the period of 81 | * (count * interval)(ms). 82 | * For example, if Ql_ADC_Init(PIN_ADC0, 5, 400), then the 83 | * Callback_ADC function will be triggered in (5*400)ms=2s periodically. 84 | * Parameters: 85 | * adcPin: 86 | * ADC pin name, one value of Enum_ADCPin 87 | * 88 | * count: 89 | * Sampling times for each ADC value, the minimum is 5. 90 | * 91 | * interval: 92 | * Interval of each internal sampling, unit is ms. 93 | * the minimum is 200(ms). 94 | * 95 | * For example, if Ql_ADC_Init(PIN_ADC0, 5, 200), then 96 | * |--200ms--->|--200ms--->|--200ms--->|--200ms--->|--200ms--->|... 97 | * Start---->sample1---->sample2---->sample3---->sample4---->sample5. Then report the average value by callback. 98 | * Return: 99 | * QL_RET_OK, this function succeeds. 100 | * QL_RET_ERR_PARAM, parameter is error. 101 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 102 | * QL_RET_ERR_ADC_NOT_REGISTERED, the ADC not registered. 103 | * 104 | *****************************************************************/ 105 | s32 Ql_ADC_Init(Enum_ADCPin adcPin, u32 count, u32 interval); 106 | 107 | /***************************************************************** 108 | * Function: Ql_ADC_Sampling 109 | * 110 | * Description: 111 | * this function switches on/off ADC sample. 112 | * 113 | * Parameters: 114 | * enable: 115 | * sample control, TRUE : start to sample. 116 | * FALSE: stop sampling. 117 | * 118 | * Return: 119 | * QL_RET_OK, this function succeeds. 120 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 121 | * QL_RET_ERR_ADC_NOT_REGISTERED, the ADC not register 122 | * QL_RET_ERR_ADC_SAMPLING_ALREADY,the ADC sampling has been started already 123 | *****************************************************************/ 124 | s32 Ql_ADC_Sampling(Enum_ADCPin adcPin, bool enable); 125 | 126 | #endif //__QL_ADC_H__ 127 | -------------------------------------------------------------------------------- /SDK/include/ql_ble.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | *****************************************************************************/ 4 | /***************************************************************************** 5 | * 6 | * Filename: 7 | * --------- 8 | * ql_ble.h 9 | * 10 | * Project: 11 | * -------- 12 | * OpenCPU 13 | * 14 | * Description: 15 | * ------------ 16 | * 17 | * Author: 18 | * ------- 19 | * ------- 20 | * 21 | *============================================================================ 22 | * HISTORY 23 | *---------------------------------------------------------------------------- 24 | * 25 | ****************************************************************************/ 26 | #ifndef __QL_BLE_H__ 27 | #define __QL_BLE_H__ 28 | #include "ql_type.h" 29 | typedef struct 30 | { 31 | u8 bd_addr[6]; 32 | /* rssi of remote device */ 33 | s32 rssi; 34 | /* length of EIR */ 35 | u8 eir_len; 36 | /* raw EIR data */ 37 | u8 eir[32]; 38 | } st_bcm_gattc_dev; 39 | 40 | typedef void (*CallBack_BLE_Scan_Hdlr)(st_bcm_gattc_dev *dev, u8 num, void *customizePara); 41 | void Ql_BLE_Scan_Register(CallBack_BLE_Scan_Hdlr callback_ble_scan,void * customizePara); 42 | 43 | #endif //__QL_BLE_H__ 44 | -------------------------------------------------------------------------------- /SDK/include/ql_clock.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_clock.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module defines the information, and APIs related to the clock function. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_CLOCK_H__ 36 | #define __QL_CLOCK_H__ 37 | 38 | 39 | typedef enum{ 40 | CLOCKSOURCE_26M= 0, 41 | CLOCKSOURCE_13M, 42 | CLOCKSOURCE_6DOT5M, 43 | CLOCKSOURCE_32K, 44 | END_OF_CLOCKSOURCE 45 | }Enum_ClockSource; 46 | 47 | /***************************************************************** 48 | * Function: Ql_CLK_Init 49 | * 50 | * Description: 51 | * This function Initialization a clock pin. 52 | * 53 | * NOTES: 54 | * The clock can't out immediately after Ql_CLK_Init Initialization 55 | * you must invoke Ql_CLK_Output functinon to control clock on or off 56 | * Parameters: 57 | * pinName: 58 | * Pin name, one value of Enum_PinName. 59 | * Enum_ClockSource: 60 | * source clock , one value of Enum_ClockSource. 61 | * Return: 62 | * QL_RET_OK, this function succeeds. 63 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 64 | * QL_RET_ERR_PINALREADYSUBCRIBE, the pin is in use in 65 | * other place. For example this pin has been using as EINT. 66 | * QL_RET_ERR_NOGPIOMODE, the input pin no clock mode 67 | * QL_RET_ERR_NOSUPPORTSET not support this function 68 | *****************************************************************/ 69 | s32 Ql_CLK_Init(Enum_PinName clkName,Enum_ClockSource clkSrc); 70 | 71 | /***************************************************************** 72 | * Function: Ql_CLK_Uninit 73 | * 74 | * Description: 75 | * This function release a clock pin. 76 | * 77 | * Parameters: 78 | * pinName: 79 | * Pin name, one value of Enum_PinName. 80 | * Return: 81 | * QL_RET_OK, this function succeeds. 82 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 83 | * QL_RET_ERR_BUSSUBBUSY, the PIN not used as clock, 84 | * Maby is used by IIC or SPI,this function can't release it 85 | *****************************************************************/ 86 | s32 Ql_CLK_Uninit(Enum_PinName clkName); 87 | 88 | /***************************************************************** 89 | * Function: Ql_CLK_Output 90 | * 91 | * Description: 92 | * This function control clock on or off 93 | * 94 | * Parameters: 95 | * pinName: 96 | * Pin name, one value of Enum_PinName. 97 | * 98 | * Return: 99 | * QL_RET_OK, this function succeeds. 100 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 101 | * QL_RET_ERR_NORIGHTOPERATE, the PIN not in clock mode or not init, 102 | * QL_RET_ERR_NOSUPPORTCONTROL not support control 103 | *****************************************************************/ 104 | s32 Ql_CLK_Output(Enum_PinName pinName,bool clkOnOff); 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /SDK/include/ql_common.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_common.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module defines the information. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_COMMON_H__ 36 | #define __QL_COMMON_H__ 37 | #include "custom_feature_def.h" 38 | #include "ql_type.h" 39 | #include "ql_gpio.h" 40 | #include "ql_trace.h" 41 | 42 | #define SYS_CONFIG_PWRKEY_DATA_SIZE (2) 43 | #define SYS_CONFIG_EMERGOFF_DATA_SIZE (4) 44 | #define SYS_CONFIG_WATCHDOG_DATA_SIZE (8) 45 | #define SYS_CONFIG_APPENABLE_DATA_SIZE (4) 46 | #define SYS_CONFIG_DEBUGMODE_DATA_SIZE (4) 47 | 48 | typedef enum{ 49 | SYS_CONFIG_PWRKEY_DATA_ID, // For PWRKEY pin setting 50 | SYS_CONFIG_EMERGOFF_DATA_ID, // For EMERG_OFF pin setting 51 | SYS_CONFIG_WATCHDOG_DATA_ID, // For external watchdog setting 52 | SYS_CONFIG_APP_ENABLE_ID, // For application enable setting 53 | SYS_CONFIG_DEBUG_MODE_ID, // For serial debug port (UART2) setting 54 | SYS_CONFIG_END = 0x7FFFFFFF 55 | }Enum_SysCfgId; 56 | 57 | typedef enum{ 58 | APP_DISABLE = 0, 59 | APP_ENABLE = 1 60 | }Enum_AppEnable; 61 | 62 | typedef struct{ 63 | void (*proc_taskEntry)(s32 TaskId); // Task Entrance Procedure 64 | s32 TaskId; 65 | u32 TaskStackSize; // The stack size of subtask. Range from 1K to 10K. 66 | u32 rev1; // Reserved parameter, must be DEFAULT_VALUE1. 67 | u32 rev2; // Reserved parameter, must be DEFAULT_VALUE2. 68 | }ST_TaskConfig; 69 | 70 | typedef struct{ 71 | bool autoPowerOn; // If module automatically power on when pressing POWER_KEY 72 | bool autoPowerOff; // If module automatically power off when pressing POWER_KEY 73 | }ST_PowerKeyCfg; 74 | 75 | typedef struct{ 76 | Enum_PinName pinWtd1; // Specify a pin which connects to the external watchdog 77 | Enum_PinName pinWtd2; // Specify another pin for watchdog if needed 78 | }ST_ExtWatchdogCfg; 79 | 80 | typedef struct{ 81 | s32 appEnable; // Specify the working mode of serial debug port (UART2) 82 | }ST_AppEnable; 83 | 84 | typedef struct{ 85 | Enum_DebugMode dbgPortMode; 86 | }ST_DebugPortCfg; 87 | 88 | /**************************************************************************** 89 | * Customized configuration structure 90 | ***************************************************************************/ 91 | typedef struct{ 92 | Enum_SysCfgId itemId; // Data item ID 93 | u32 size; // Size of one record 94 | void* pValue; // Pointer to config data 95 | }ST_SystemConfig; 96 | 97 | #define QL_TRACE_LOG(PORT,BUF,BUF_LEN,...) \ 98 | Ql_memset((char *)(BUF), 0, BUF_LEN); \ 99 | Ql_sprintf((char *)(BUF),__VA_ARGS__); \ 100 | if (UART_PORT2 == (PORT)) \ 101 | {\ 102 | Ql_Debug_Trace(BUF);\ 103 | } else {\ 104 | Ql_UART_Write((Enum_SerialPort)(PORT), (u8*)(BUF), Ql_strlen((const char *)(BUF)));\ 105 | } 106 | 107 | #endif // __QL_COMMON_H__ 108 | 109 | 110 | #if (defined(TASK_FUNC_DECLARATION) && defined(TASK_ID_DEF)) 111 | #error [ Conflict I ] 112 | #endif 113 | #if (defined(TASK_FUNC_DECLARATION) && defined(TASK_DEFINITION)) 114 | #error [ Conflict II ] 115 | #endif 116 | #if (defined(TASK_DEFINITION) && defined(TASK_ID_DEF)) 117 | #error [ Conflict III ] 118 | #endif 119 | 120 | 121 | #undef TASK_DEFINITION_BEGIN 122 | #undef TASK_ITEM 123 | #undef TASK_DEFINITION_END 124 | 125 | #ifdef GPIO_DEFINITION 126 | #define GPIO_DEFINITION_BEGIN const ST_GPIOConfig GpioConfigTbl[] = { 127 | #define GPIO_ITEM(PINNAME, PINDIRECTION, PINLEVEL, PINPULLSEL) {PINNAME, PINDIRECTION, PINLEVEL, PINPULLSEL}, 128 | #define GPIO_DEFINITION_END {PINNAME_END, 0, 0, 0} }; 129 | #endif 130 | 131 | 132 | #if defined( TASK_DEFINITION) 133 | #define TASK_DEFINITION_BEGIN const ST_TaskConfig TaskConfig[] = { 134 | #define TASK_ITEM(EntryFunc,TaskId,TaskStackSize,P1,P2) {EntryFunc, TaskId, TaskStackSize, P1, P2}, 135 | #define TASK_DEFINITION_END {NULL, 0, 0, 0, 0}}; 136 | #elif defined(TASK_ID_DEF) 137 | #define TASK_DEFINITION_BEGIN typedef enum{ 138 | #define TASK_ITEM(EntryFunc,TaskId,TaskStackSize,P1,P2) TaskId, 139 | #define TASK_DEFINITION_END TaskId_End } Enum_TaskId; 140 | #elif defined(TASK_FUNC_DECLARATION) 141 | #define TASK_DEFINITION_BEGIN 142 | #define TASK_ITEM(EntryFunc,TaskId,TaskStackSize,P1,P2) extern void EntryFunc(s32); 143 | #define TASK_DEFINITION_END 144 | #else 145 | #undef TASK_DEFINITION_BEGIN 146 | #undef TASK_ITEM 147 | #undef TASK_DEFINITION_END 148 | #endif 149 | -------------------------------------------------------------------------------- /SDK/include/ql_eint.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_eint.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * EINT API defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_EINT_H__ 36 | #define __QL_EINT_H__ 37 | 38 | #include "ql_gpio.h" 39 | 40 | 41 | typedef enum{ 42 | EINT_EDGE_TRIGGERED = 0, 43 | EINT_LEVEL_TRIGGERED, 44 | }Enum_EintType; 45 | 46 | 47 | /***************************************************************** 48 | * Description: 49 | * Definition for EINT callback function. 50 | * 51 | * Parameters: 52 | * eintPinName: 53 | * EINT pin name, one value of Enum_PinName, which is registered by 54 | * calling Ql_EINT_Register() or Ql_EINT_RegisterFast(). 55 | * 56 | * pinLevel: 57 | * The EINT level value, one value of Enum_PinLevel. 58 | * 59 | * customParam: 60 | * The customized parameter, which is passed in by calling 61 | * Ql_EINT_Register() or Ql_EINT_RegisterFast(). 62 | *****************************************************************/ 63 | typedef void (*Callback_EINT_Handle)(Enum_PinName eintPinName, Enum_PinLevel pinLevel, void* customParam); 64 | 65 | /***************************************************************** 66 | * Function: Ql_EINT_Register 67 | * 68 | * Description: 69 | * This function registers an EINT I/O, and specifies the 70 | * interrupt handler. 71 | * 72 | * Parameters: 73 | * eintPinName: 74 | * EINT pin name, one value of Enum_PinName that has 75 | * the interrupt function. 76 | * 77 | * callback_eint: 78 | * The interrupt handler, or ISR. 79 | * 80 | * customParam: 81 | * A customized parameter, which can be use in interrupt handler. 82 | * Return: 83 | * QL_RET_OK, this function succeeds. 84 | * QL_RET_ERR_NOSUPPORTPIN, the input IO is invalid. 85 | * QL_RET_ERR_PINALREADYSUBCRIBE, the IO is in use in 86 | * other place. For example this IO has been using as GPIO. 87 | * Ql_RET_ERR_EINT_ALREADY_REGISTERED, this EINT is registered already 88 | *****************************************************************/ 89 | s32 Ql_EINT_Register(Enum_PinName eintPinName, Callback_EINT_Handle callback_eint, void* customParam); 90 | 91 | /***************************************************************** 92 | * Function: Ql_EINT_RegisterFast 93 | * 94 | * Description: 95 | * This function registers an EINT I/O, and specifies the 96 | * interrupt handler. 97 | * The EINT, that is registered by calling this function, 98 | * is a lower-level interrupt. The response for interrupt 99 | * request is timelier. 100 | * 101 | * IMPORTANT NOTES: 102 | * Please don't add any task schedule in the interrupt 103 | * handler.And the interrupt handler cannot consume much 104 | * CPU time. Or it causes system exception or reset. 105 | * 106 | * Parameters: 107 | * eintPinName: 108 | * EINT pin name, one value of Enum_PinName that has 109 | * the interrupt function. 110 | * 111 | * callback_eint: 112 | * The interrupt handler, or ISR. 113 | * 114 | * customParam: 115 | * A customized parameter, which can be use in interrupt handler. 116 | * Return: 117 | * QL_RET_OK, this function succeeds. 118 | * QL_RET_ERR_NOSUPPORTPIN, the input IO is invalid. 119 | * QL_RET_ERR_PINALREADYSUBCRIBE, the IO is in use in 120 | * other place. For example this IO has been using as GPIO. 121 | * Ql_RET_ERR_EINT_ALREADY_REGISTERED, this EINT is registered already 122 | *****************************************************************/ 123 | s32 Ql_EINT_RegisterFast(Enum_PinName eintPinName, Callback_EINT_Handle callback_eint, void* customParam); 124 | 125 | /***************************************************************** 126 | * Function: Ql_EINT_Init 127 | * 128 | * Description: 129 | * Initialize an external interrupt function. 130 | * 131 | * Parameters: 132 | * eintPinName: 133 | * EINT pin name, one value of Enum_PinName that has 134 | * the interrupt function. 135 | * 136 | * eintType: 137 | * Interrupt type, level-triggered or edge-triggered. 138 | * Now, only level-triggered interrupt is supported. 139 | * 140 | * hwDebounce: 141 | * Hardware debounce. Unit in 10ms. 142 | * 143 | * swDebounce: 144 | * Software debounce. Unit in 10ms. The minimum value for 145 | * this parameter is 5, which means the minimum software 146 | * debounce time is 5*10ms=50ms. 147 | * automask: 148 | * mask the Eint after the interrupt happened. 149 | * Return: 150 | * QL_RET_OK, this function succeeds. 151 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 152 | * QL_RET_ERR_PINALREADYSUBCRIBE, the pin is in use in 153 | * other place. For example this pin has been using as GPIO. 154 | * QL_RET_ERR_NOSUPPORTMODE this pin not support EINT mode. 155 | * QL_RET_ERR_NOSUPPORTSET do not support this function 156 | *****************************************************************/ 157 | s32 Ql_EINT_Init(Enum_PinName eintPinName, Enum_EintType eintType, u32 hwDebounce, u32 swDebounce, bool automask); 158 | 159 | /***************************************************************** 160 | * Function: Ql_EINT_Uninit 161 | * 162 | * Description: 163 | * This function releases the specified EINT pin that was 164 | * initialized by calling Ql_EINT_Init() previously. 165 | * After releasing, the pin can be used for other purpose. 166 | * Parameters: 167 | * eintPinName: 168 | * EINT pin name, one value of Enum_PinName that has 169 | * the interrupt function. 170 | * Return: 171 | * QL_RET_OK, this function succeeds. 172 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 173 | * QL_RET_ERR_BUSSUBBUSY, the GPIO not used as GPIO, 174 | * Maby is used by IIC or SPI,this function can't release it 175 | *****************************************************************/ 176 | s32 Ql_EINT_Uninit(Enum_PinName eintPinName); 177 | 178 | /***************************************************************** 179 | * Function: Ql_EINT_GetLevel 180 | * 181 | * Description: 182 | * This function gets the level of the specified EINT pin. 183 | * 184 | * Parameters: 185 | * eintPinName: 186 | * EINT pin name, one value of Enum_PinName that has 187 | * the interrupt function. 188 | * Return: 189 | * The level value of the specified EINT pin, which is 190 | * nonnegative integer. 191 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 192 | *****************************************************************/ 193 | s32 Ql_EINT_GetLevel(Enum_PinName eintPinName); 194 | 195 | /***************************************************************** 196 | * Function: Ql_EINT_Mask 197 | * 198 | * Description: 199 | * This function masks the specified EINT pin. 200 | * 201 | * Parameters: 202 | * eintPinName: 203 | * EINT pin name, one value of Enum_PinName that has 204 | * the interrupt function. 205 | * Return: 206 | * None. 207 | *****************************************************************/ 208 | void Ql_EINT_Mask(Enum_PinName eintPinName); 209 | 210 | /***************************************************************** 211 | * Function: Ql_EINT_Unmask 212 | * 213 | * Description: 214 | * This function unmasks the specified EINT pin. 215 | * 216 | * Parameters: 217 | * eintPinName: 218 | * EINT pin name, one value of Enum_PinName that has 219 | * the interrupt function. 220 | * Return: 221 | * None. 222 | *****************************************************************/ 223 | void Ql_EINT_Unmask(Enum_PinName eintPinName); 224 | 225 | #endif // __QL_EINT_H__ 226 | -------------------------------------------------------------------------------- /SDK/include/ql_error.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_error.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * error code defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_ERROR_H__ 36 | #define __QL_ERROR_H__ 37 | 38 | /**************************************************************************** 39 | * Error Code Definition 40 | ***************************************************************************/ 41 | enum { 42 | QL_RET_OK = 0, 43 | QL_RET_ERR_PARAM = -1, 44 | QL_RET_ERR_PORT_NOT_OPEN = -2, 45 | QL_RET_ERR_TIMER_FULL = -3, 46 | QL_RET_ERR_INVALID_TIMER = -4, 47 | QL_RET_ERR_FATAL = -5, 48 | QL_RET_ERR_INVALID_OP = -6, 49 | QL_RET_ERR_UART_BUSY = -7, 50 | QL_RET_ERR_INVALID_PORT = -8, 51 | QL_RET_ERR_NOMATCHVERSION = -9, 52 | QL_RET_ERR_NOSUPPORTPIN = -10, 53 | QL_RET_ERR_NOSUPPORTMODE = -11, 54 | QL_RET_ERR_NOSUPPORTEINT = -12, 55 | QL_RET_ERR_NOSUPPORTSET = -13, 56 | QL_RET_ERR_NOSUPPORTGET = -14, 57 | QL_RET_ERR_NOSUPPORTCONTROL = -15, 58 | QL_RET_ERR_PINALREADYSUBCRIBE = -16, 59 | QL_RET_ERR_BUSSUBBUSY = -17, 60 | QL_RET_ERR_NOGPIOMODE = -18, 61 | QL_RET_ERR_NORIGHTOPERATE = -19, 62 | QL_RET_ERR_ALREADYUNSUBCRIBE = -20, 63 | QL_RET_ERR_FULLI2CBUS = -21, 64 | QL_RET_ERR_NOTSUPPORTBYHANDLE = -22, 65 | QL_RET_ERR_INVALIDBUSHANDLE = -23, 66 | QL_RET_ERR_NOEXISTOBJEXT = -24, 67 | QL_RET_ERR_OPERATEOBJEXTFAILED = -25, 68 | QL_RET_ERR_OPENOBJEXTFAILED = -26, 69 | QL_RET_ERR_WRITEOBJEXTFAILED = -27, 70 | QL_RET_ERR_READOBJEXTFAILED = -28, 71 | QL_RET_ERR_FLASHFULLOVER = -29, 72 | QL_RET_ERR_FLASHSPACE = -30, 73 | QL_RET_ERR_DRIVE = -31, 74 | QL_RET_ERR_DRIVEFULLOVER = -32, 75 | QL_RET_ERR_INVALIDFLASHID = -33, 76 | QL_RET_ERR_I2CHWFAILED = -34, 77 | QL_RET_ERR_FILEFAILED = -35, 78 | QL_RET_ERR_FILEOPENFAILED = -36, 79 | QL_RET_ERR_FILENAMETOOLENGTH = -37, 80 | QL_RET_ERR_FILEREADFAILED = -38, 81 | QL_RET_ERR_FILEWRITEFAILED = -39, 82 | QL_RET_ERR_FILESEEKFAILED = -40, 83 | QL_RET_ERR_FILENOTFOUND = -41, 84 | QL_RET_ERR_FILENOMORE = -42, 85 | QL_RET_ERR_FILEDISKFULL = -43, 86 | QL_RET_ERR_INVALID_BAUDRATE = -44, 87 | QL_RET_ERR_API_NO_RESPONSE = -45, 88 | QL_RET_ERR_API_INVALID_RESPONSE = -46, 89 | QL_RET_ERR_SMS_EXCEED_LENGTH =-47, 90 | QL_RET_ERR_SMS_NOT_INIT = -48, 91 | QL_RET_ERR_INVALID_TASK_ID = -49, 92 | QL_RET_ERR_NOT_IN_BASIC_MODE = -50, 93 | QL_RET_ERR_INVALID_PARAMETER = -51, 94 | QL_RET_ERR_PATHNOTFOUND = -52, 95 | QL_RET_ERR_GET_MEM = -53, 96 | QL_RET_ERR_GENERAL_FAILURE = -54, 97 | QL_RET_ERR_FILE_EXISTS = -55, 98 | QL_RET_ERR_SMS_INVALID_FORMAT = -56, 99 | QL_RET_ERR_SMS_GET_FORMAT = -57, 100 | QL_RET_ERR_SMS_INVALID_STORAGE = -58, 101 | QL_RET_ERR_SMS_SET_STORAGE = -59, 102 | QL_RET_ERR_SMS_SEND_AT_CMD = -60, 103 | QL_RET_ERR_API_CMD_BUSY = -61, 104 | 105 | /* AUD -70 ~ -100*/ 106 | QL_RET_ERR_MED_BAD_FORMAT = -70, 107 | QL_RET_ERR_MED_BUSY = -71, 108 | QL_RET_ERR_MED_DISC_FULL = -72, 109 | QL_RET_ERR_MED_OPEN_FILE_FAIL = -73, 110 | QL_RET_ERR_MED_BAD_FILE_EXTENSION = -74, 111 | QL_RET_ERR_MED_WRITE_PROTECTION = -75, 112 | QL_RET_ERR_MED_FILE_EXIST = -76, 113 | QL_RET_ERR_MED_UNSUPPORT_FMT_IN_CALLING = -77, 114 | Ql_RET_ERR_AUD_REC_STOP_FAIL = -78, 115 | QL_RET_ERR_MED_DRIVE_NOT_FOUND = -79, 116 | QL_RET_ERR_MED_NO_CARD = -80, 117 | Ql_RET_ERR_MEM_FULL = -81, 118 | QL_ERR_DTMFSTRING_TOO_LONG = -82, 119 | QL_ERR_WDTMF_PS_BUSY = -83, 120 | QL_ERR_DTMF_BUSY = -84, 121 | QL_ERR_DTMF_NO_CALLING =-85, 122 | /* reserve to -100 */ 123 | QL_RET_ERR_MED_UNKNOWN = -100, 124 | 125 | /* File Append */ 126 | QL_RET_ERR_FILE_NO_CARD = -101, 127 | 128 | QL_RET_ERR_FS_FATAL_ERR1 = 190, // File system fatal error type1, which indicates the file system is corrupted and cannot restored. 129 | // If this value is returned by FS-related APIs, devloper should call Ql_Fs_Format(QL_FS_FAT) to format the file system. 130 | // After formatted the file system, all user files will be deleted. 131 | QL_RET_ERR_FS_FATAL_ERR2 = 191, 132 | 133 | /*reserved to -200 */ 134 | QL_RET_ERR_FILE_UNKNOWN = -200, 135 | 136 | Ql_RET_ERR_EINT_USED =-300, 137 | Ql_RET_ERR_EINT_ALREADY_REGISTERED = -301, 138 | QL_RET_ERR_ADC_ALREADY_REGISTERED = -302, 139 | QL_RET_ERR_ADC_NOT_REGISTERED = -303, 140 | QL_RET_ERR_ADC_SAMPLING_ALREADY = -304, 141 | QL_RET_ERR_CHANNEL_OUTRANGE = -305, 142 | QL_RET_ERR_CHANNEL_USED = -306, 143 | QL_RET_ERR_CHANNEL_NOT_FOUND = -307, 144 | QL_RET_ERR_IIC_SLAVE_NOT_FOUND = -308, 145 | QL_RET_ERR_IIC_SAME_SLAVE_ADDRESS = -309, 146 | QL_RET_ERR_IIC_SLAVE_TOO_MANY = -310, 147 | QL_RET_ERR_IIC_NOT_IIC_CONTROLER = -311, 148 | QL_RET_ERR_FULLSPIBUS = -312, 149 | 150 | 151 | Ql_RET_ERR_SIM_NOT_INSERTED =-400, 152 | Ql_RET_ERR_SIM_TYPE_ERROR =-401, 153 | 154 | /* SMS -500 ~ -550*/ 155 | QL_RET_ERR_SMS_ERROR = -500, 156 | QL_RET_ERR_SMS_NOT_INITIAL = -501, 157 | Ql_RET_ERR_SMS_NOT_READY = -502, 158 | QL_RET_ERR_SMS_INVALID_PARAM = -503, 159 | QL_RET_ERR_SMS_OUT_OF_MEMORY = -504, 160 | QL_RET_ERR_SMS_INCORRECT_DATA_LENGTH = -505, 161 | QL_RET_ERR_SMS_PDU_SYNTEX_ERROR = -506, 162 | QL_RET_ERR_SMS_INVALID_MEM_INDEX = -507, 163 | QL_RET_ERR_SMS_CMD_CONFLICT = -508, 164 | QL_RET_ERR_SMS_MSG_EMPTY = -509, 165 | QL_RET_ERR_SMS_INVALID_NUMBER_STRING = -510, 166 | QL_RET_ERR_SMS_INVALID_TEXT_CONTENT = -511, 167 | QL_RET_ERR_SMS_NOT_SUPPORTED = -512, 168 | QL_RET_ERR_SMS_INCORRECT_FORMAT = -513, 169 | QL_RET_ERR_SMS_STORAGE_FULL = -514, 170 | 171 | /* GNSS -551 ~ -599 */ 172 | QL_RET_ERR_GNSS_OPERATION_FAILED = -551, 173 | 174 | /* RIL FTP -600 */ 175 | QL_RET_ERR_RIL_FTP_OPENFAIL = -600, 176 | QL_RET_ERR_RIL_FTP_CLOSEFAIL = -601, 177 | QL_RET_ERR_RIL_FTP_SETPATHFAIL = -602, 178 | QL_RET_ERR_RIL_FTP_SETCFGFAIL = -603, 179 | QL_RET_ERR_RIL_FTP_RENAMEFAIL = -604, 180 | QL_RET_ERR_RIL_FTP_SIZEFAIL = -605, 181 | QL_RET_ERR_RIL_FTP_DELETEFAIL = -606, 182 | QL_RET_ERR_RIL_FTP_MKDIRFAIL = -607, 183 | 184 | Ql_RET_ERR_RAWFLASH_OVERRANGE = -8001, 185 | Ql_RET_ERR_RAWFLASH_UNIITIALIZED = -8002, 186 | Ql_RET_ERR_RAWFLASH_UNKNOW = -8003, 187 | Ql_RET_ERR_RAWFLASH_INVLIDBLOCKID = -8004, 188 | Ql_RET_ERR_RAWFLASH_PARAMETER = -8005, 189 | Ql_RET_ERR_RAWFLASH_ERASEFlASH = -8006, 190 | Ql_RET_ERR_RAWFLASH_WRITEFLASH = -8007, 191 | Ql_RET_ERR_RAWFLASH_READFLASH = -8008, 192 | Ql_RET_ERR_RAWFLASH_MAXLENGATH = -8009, 193 | /* Flash OPT End */ 194 | 195 | Ql_RET_ERR_SYS_NOT_READY = -9998, 196 | Ql_RET_ERR_UNKOWN = -9999, 197 | Ql_RET_NOT_SUPPORT = -10000, 198 | }; 199 | 200 | #endif // End-of QL_ERROR_H 201 | 202 | -------------------------------------------------------------------------------- /SDK/include/ql_fota.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_fota.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * Fota API defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_FOTA_H__ 36 | #define __QL_FOTA_H__ 37 | 38 | #include "ql_type.h" 39 | 40 | typedef struct 41 | { 42 | s16 Q_gpio_pin1; //Watchdog GPIO pin 1, If only use one GPIO,you can set other to -1,it means invalid. 43 | s16 Q_feed_interval1; //gpio1 time interval for feed dog. 44 | s16 Q_gpio_pin2; //Watchdog GPIO pin 2, If only use one GPIO,you can set other to -1,it means invalid. 45 | s16 Q_feed_interval2; //gpio2 time interval for feed dog. 46 | s32 reserved1; //reserve 1 47 | s32 reserved2; //reserve 2 48 | }ST_FotaConfig; 49 | 50 | 51 | /***************************************************************** 52 | * Function: Ql_FOTA_Init 53 | * 54 | * Description: Initialize FOTA related functions. 55 | * It a simple API.Programer only need to pass the 56 | * simple parameters to this API. 57 | * 58 | * Parameters: 59 | * pFotaCfg: Initialize fota config include watch dog. 60 | * Return: 61 | * QL_RET_OK indicates this function successes. 62 | * QL_RET_ERR_PARAM indicates parameter error. 63 | * Ql_RET_NOT_SUPPORT indicates not support this function. 64 | * Ql_RET_ERR_RAWFLASH_UNKNOW indicates unknown error. 65 | *****************************************************************/ 66 | s32 Ql_FOTA_Init(ST_FotaConfig * pFotaCfg); 67 | 68 | 69 | /***************************************************************** 70 | * Function: Ql_FOTA_WriteData 71 | * 72 | * Description: 73 | * FOTA write data API. 74 | * 1. This function is used to write data to spare image pool 75 | * 2. This API only allow sequentially writing mechanism 76 | * 3. Authentication mechanism is executed during writing 77 | * Parameters: 78 | * length: the length of writing (Unit: Bytes).recommend 512 bytes 79 | * buffer: point to the start address of buffer 80 | * Return: 81 | * QL_RET_OK indicates this function successes. 82 | * QL_RET_ERR_PARAM indicates parameter error. 83 | * Ql_RET_NOT_SUPPORT indicates not support this function. 84 | * Ql_RET_ERR_UNKOWN indicates unknown error. 85 | * Ql_RET_ERR_RAWFLASH_OVERRANGE indicates over flash range. 86 | * Ql_RET_ERR_RAWFLASH_UNIITIALIZED indicates uninitialized before write or read flash. 87 | * Ql_RET_ERR_RAWFLASH_UNKNOW indicates unknown error. 88 | * Ql_RET_ERR_RAWFLASH_INVLIDBLOCKID indicates block id invalid. 89 | * Ql_RET_ERR_RAWFLASH_PARAMETER indicates parameter error. 90 | * Ql_RET_ERR_RAWFLASH_ERASEFlASH indicates erase flash failure. 91 | * Ql_RET_ERR_RAWFLASH_WRITEFLASH indicates written flash failure. 92 | * Ql_RET_ERR_RAWFLASH_READFLASH indicates read flash failure. 93 | * Ql_RET_ERR_RAWFLASH_MAXLENGATH indicates the data length too large. 94 | *****************************************************************/ 95 | s32 Ql_FOTA_WriteData(s32 length, s8* buffer); 96 | 97 | /***************************************************************** 98 | * Function: Ql_FOTA_Finish 99 | * 100 | * Description: 101 | * FOTA finalization API. 102 | * 1. compare calculated checksum with image checksum in the header after 103 | * whole image is written 104 | * 2. mark the status to UPDATE_NEEDED 105 | * Parameters: 106 | * None 107 | * Return: 108 | * QL_RET_OK indicates this function successes. 109 | * Ql_RET_NOT_SUPPORT indicates not support this function. 110 | * Ql_RET_ERR_UNKOWN indicates unknown error. 111 | * Ql_RET_ERR_RAWFLASH_OVERRANGE indicates over flash range. 112 | * Ql_RET_ERR_RAWFLASH_UNIITIALIZED indicates uninitialized before write or read flash. 113 | * Ql_RET_ERR_RAWFLASH_UNKNOW indicates unknown error. 114 | * Ql_RET_ERR_RAWFLASH_INVLIDBLOCKID indicates block id invalid. 115 | * Ql_RET_ERR_RAWFLASH_PARAMETER indicates parameter error. 116 | * Ql_RET_ERR_RAWFLASH_ERASEFlASH indicates erase flash failure. 117 | * Ql_RET_ERR_RAWFLASH_WRITEFLASH indicates written flash failure. 118 | * Ql_RET_ERR_RAWFLASH_READFLASH indicates read flash failure. 119 | * Ql_RET_ERR_RAWFLASH_MAXLENGATH indicates the data length too large. 120 | *****************************************************************/ 121 | s32 Ql_FOTA_Finish(void); 122 | 123 | /***************************************************************** 124 | * Function: Ql_FOTA_ReadData 125 | * 126 | * Description: 127 | * This function reads data from the data region which 128 | * Ql_FOTA_WriteData writes to. 129 | * If Developer needs to check the whole data package after 130 | * writing, this API can read back the data. 131 | * Parameters: 132 | * offset: the offset value to the data region 133 | * len: the length to read (Unit: Byte).recommend 512 bytes 134 | * pBuffer: point to the buffer to store read data. 135 | * Return: 136 | * QL_RET_ERR_PARAM, indicates parameter error. 137 | * >0, the real read number of bytes. 138 | *****************************************************************/ 139 | s32 Ql_FOTA_ReadData(u32 offset, u32 len, u8* pBuffer); 140 | 141 | /***************************************************************** 142 | * Function: Ql_Fota_Update 143 | * 144 | * Description: 145 | * Starts FOTA Update. 146 | * Parameters: 147 | * None. 148 | * Return: 149 | * QL_RET_OK indicates this function successes. 150 | * QL_RET_ERR_INVALID_OP indicates invalid operation. 151 | * Ql_RET_NOT_SUPPORT indicates not support this function. 152 | * Ql_RET_ERR_RAWFLASH_PARAMETER indicates parameter error. 153 | * Ql_RET_ERR_RAWFLASH_ERASEFlASH indicates erase flash failure. 154 | * Ql_RET_ERR_RAWFLASH_WRITEFLASH indicates written flash failure. 155 | *****************************************************************/ 156 | s32 Ql_FOTA_Update(void); 157 | 158 | #endif // End-of __QL_FOTA_H__ 159 | -------------------------------------------------------------------------------- /SDK/include/ql_gnss.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2017 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_gnss.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * GNSS APIs defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_GNSS_H__ 36 | #define __QL_GNSS_H__ 37 | #include "ql_common.h" 38 | #include "ql_system.h" 39 | 40 | #define MAX_NMEA_LEN 255 41 | 42 | typedef enum { 43 | NO_NMEA_EN = 0x00000000, 44 | RMC_EN = 0x00000001, 45 | VTG_EN = 0x00000002, 46 | GGA_EN = 0x00000004, 47 | GSA_EN = 0x00000008, 48 | GSV_EN = 0x00000010, 49 | GLL_EN = 0x00000020, 50 | EPE_EN = 0x00000040, 51 | ECEF_EN = 0x00000080, 52 | PZ90_EN = 0x00000100, 53 | VEL_EN = 0x00000200, 54 | GEO_EN = 0x00000400, 55 | JAM_EN = 0x00000800, 56 | RLM_EN = 0x00001000, 57 | 58 | ALL_NMEA_EN = 0xFFFFFFFF 59 | }Enum_NMEAFlag; 60 | 61 | typedef struct 62 | { 63 | double lat; // Latitude 64 | double lon; // Longitude 65 | }st_pos; 66 | 67 | /***************************************************************** 68 | * Function: Ql_GNSS_PowerOn 69 | * 70 | * Description: 71 | * This function is used to power on the GNSS and register the callback function for the 72 | * specified NMEA sentences. 73 | * NMEA callback function used for receiving the NMEA sentences from CORE by parameters 74 | * of nmea_buff and len. 75 | * NOTE: 76 | * The stack size of task calling this function shouldn't less than 2kB. 77 | * This function should be called in pairs with Ql_GNSS_PowerDown. 78 | * 79 | * Parameters: 80 | * [in]nmea_type: 81 | * NMEA types be enabled to output which can multiselect by OR the bit mask. 82 | * For example, RMC_EN | GGA_EN will enable RMC and GGA sentences to output. 83 | * [in]callback_nmea: 84 | * The pointer of the NMEA call back function. 85 | * [in]customizePara: 86 | * Customize parameter, if not use just set to NULL. 87 | * 88 | * Return: 89 | * QL_RET_OK indicates success; 90 | * Ql_RET_ERR_MEM_FULL indicates malloc memory failed. 91 | * QL_RET_ERR_GNSS_OPERATION_FAILED indicates operation failure when power on or power down. 92 | * 93 | *****************************************************************/ 94 | typedef void (*CallBack_NMEA_Hdlr)(u8 *nmea_buff, u16 len, void *customizePara); 95 | s32 Ql_GNSS_PowerOn(Enum_NMEAFlag nmea_type, CallBack_NMEA_Hdlr callback_nmea,void * customizePara); 96 | 97 | /***************************************************************** 98 | * Function: Ql_GNSS_PowerDown 99 | * 100 | * Description: 101 | * This function is used to power down the GNSS. 102 | * NOTE: 103 | * This function should be called in pairs with Ql_GNSS_PowerOn. 104 | * Parameters: 105 | * None. 106 | * Return: 107 | * QL_RET_OK indicates success; 108 | * QL_RET_ERR_GNSS_OPERATION_FAILED indicates operation failure when power on or power down. 109 | * 110 | *****************************************************************/ 111 | s32 Ql_GNSS_PowerDown(void); 112 | 113 | #endif // End-of __QL_GNSS_H__ 114 | 115 | -------------------------------------------------------------------------------- /SDK/include/ql_gpio.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_gpio.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * GPIO API defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_GPIO_H__ 36 | #define __QL_GPIO_H__ 37 | 38 | /**************************************************************************** 39 | * Enumeration for GPIO Pins available. 40 | ***************************************************************************/ 41 | typedef enum{ 42 | PINNAME_NETLIGHT = 0, 43 | PINNAME_DTR, 44 | PINNAME_RI, 45 | PINNAME_DCD, 46 | PINNAME_CTS, 47 | PINNAME_RTS, 48 | PINNAME_PCM_CLK, 49 | PINNAME_PCM_SYNC, 50 | PINNAME_PCM_IN, 51 | PINNAME_PCM_OUT, 52 | PINNAME_SD_CMD, 53 | PINNAME_SD_CLK, 54 | PINNAME_SD_DATA, 55 | PINNAME_SIM2_DATA, 56 | PINNAME_SIM2_RST, 57 | PINNAME_SIM2_CLK, 58 | PINNAME_GPIO0, 59 | PINNAME_GPIO1, 60 | PINNAME_GPIO2, 61 | PINNAME_GPIO3, 62 | PINNAME_GPIO4, 63 | PINNAME_END 64 | }Enum_PinName; 65 | 66 | typedef enum{ 67 | PINDIRECTION_IN = 0, 68 | PINDIRECTION_OUT = 1 69 | }Enum_PinDirection; 70 | 71 | typedef enum{ 72 | PINLEVEL_LOW = 0, 73 | PINLEVEL_HIGH = 1 74 | }Enum_PinLevel; 75 | 76 | typedef enum{ 77 | PINPULLSEL_DISABLE = 0, // Disable pull selection 78 | PINPULLSEL_PULLDOWN = 1, // Pull-down 79 | PINPULLSEL_PULLUP = 2 // Pull-up 80 | }Enum_PinPullSel; 81 | 82 | 83 | /**************************************************************************** 84 | * GPIO Config Items 85 | ***************************************************************************/ 86 | typedef struct{ 87 | Enum_PinName pinName; 88 | Enum_PinDirection pinDirection; 89 | Enum_PinLevel pinLevel; 90 | Enum_PinPullSel pinPullSel; 91 | }ST_GPIOConfig; 92 | 93 | /***************************************************************** 94 | * Function: Ql_GPIO_Init 95 | * 96 | * Description: 97 | * This function enables the GPIO function of the specified pin, 98 | * and initialize the configurations, including direction, 99 | * level and pull selection. 100 | * 101 | * Parameters: 102 | * pinName: 103 | * Pin name, one value of Enum_PinName. 104 | * dir: 105 | * The initial direction of GPIO, one value of Enum_PinDirection. 106 | * level: 107 | * The initial level of GPIO, one value of Enum_PinLevel. 108 | * pullSel: 109 | * Pull selection, one value of Enum_PinPullSel. 110 | * Return: 111 | * QL_RET_OK, this function succeeds. 112 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 113 | * QL_RET_ERR_PINALREADYSUBCRIBE, the GPIO is in use in 114 | * other place. For example this GPIO has been using as EINT. 115 | *****************************************************************/ 116 | s32 Ql_GPIO_Init(Enum_PinName pinName, 117 | Enum_PinDirection dir, 118 | Enum_PinLevel level, 119 | Enum_PinPullSel pullSel 120 | ); 121 | 122 | /***************************************************************** 123 | * Function: Ql_GPIO_SetLevel 124 | * 125 | * Description: 126 | * This function sets the level of the specified GPIO. 127 | * 128 | * Parameters: 129 | * pinName: 130 | * Pin name, one value of Enum_PinName. 131 | * level: 132 | * The initial level of GPIO, one value of Enum_PinLevel. 133 | * Return: 134 | * QL_RET_OK, this function succeeds. 135 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 136 | * QL_RET_ERR_NORIGHTOPERATE, can't operate,Maybe the GPIO not Init 137 | * QL_RET_ERR_NOGPIOMODE, the input GPIO is not GPIO mode 138 | *****************************************************************/ 139 | s32 Ql_GPIO_SetLevel(Enum_PinName pinName, Enum_PinLevel level); 140 | 141 | /***************************************************************** 142 | * Function: Ql_GPIO_GetLevel 143 | * 144 | * Description: 145 | * This function gets the level of the specified GPIO. 146 | * 147 | * Parameters: 148 | * pinName: 149 | * Pin name, one value of Enum_PinName. 150 | * Return: 151 | * The level value of the specified GPIO, which is 152 | * nonnegative integer. 153 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 154 | *****************************************************************/ 155 | s32 Ql_GPIO_GetLevel(Enum_PinName pinName); 156 | 157 | /***************************************************************** 158 | * Function: Ql_GPIO_SetDirection 159 | * 160 | * Description: 161 | * This function sets the direction of the specified GPIO. 162 | * 163 | * Parameters: 164 | * pinName: 165 | * Pin name, one value of Enum_PinName. 166 | * dir: 167 | * The initial direction of GPIO, one value of Enum_PinDirection. 168 | * Return: 169 | * QL_RET_OK indicates this function successes. 170 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 171 | * QL_RET_ERR_NORIGHTOPERATE, can't operate,Maybe the GPIO not Init 172 | * QL_RET_ERR_NOGPIOMODE, the input GPIO is not GPIO mode 173 | *****************************************************************/ 174 | s32 Ql_GPIO_SetDirection(Enum_PinName pinName, Enum_PinDirection dir); 175 | 176 | /***************************************************************** 177 | * Function: Ql_GPIO_GetDirection 178 | * 179 | * Description: 180 | * This function gets the direction of the specified GPIO. 181 | * 182 | * Parameters: 183 | * pinName: 184 | * Pin name, one value of Enum_PinName. 185 | * Return: 186 | * The direction of the specified GPIO, which is 187 | * nonnegative integer.. 188 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 189 | * QL_RET_ERR_NORIGHTOPERATE, can't operate,Maybe the GPIO not Init 190 | * QL_RET_ERR_NOGPIOMODE, the input GPIO is not GPIO mode 191 | *****************************************************************/ 192 | s32 Ql_GPIO_GetDirection(Enum_PinName pinName); 193 | 194 | /***************************************************************** 195 | * Function: Ql_GPIO_SetPullSelection 196 | * 197 | * Description: 198 | * This function sets the pull selection of the specified GPIO. 199 | * 200 | * Parameters: 201 | * pinName: 202 | * Pin name, one value of Enum_PinName. 203 | * Enum_PinPullSel: 204 | * Pull selection, one value of Enum_PinPullSel. 205 | * Return: 206 | * QL_RET_OK indicates this function successes. 207 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 208 | * QL_RET_ERR_NORIGHTOPERATE, can't operate,Maybe the GPIO not Init 209 | * QL_RET_ERR_NOGPIOMODE, the input GPIO is not GPIO mode 210 | *****************************************************************/ 211 | s32 Ql_GPIO_SetPullSelection(Enum_PinName pinName, Enum_PinPullSel pullSel); 212 | 213 | /***************************************************************** 214 | * Function: Ql_GPIO_GetPullSelection 215 | * 216 | * Description: 217 | * This function gets the pull selection of the specified GPIO. 218 | * 219 | * Parameters: 220 | * pinName: 221 | * Pin name, one value of Enum_PinName. 222 | * Enum_PinPullSel: 223 | * Pull selection, one value of Enum_PinPullSel. 224 | * Return: 225 | * The pull selection, which is nonnegative integer. 226 | * if successes return one value of Enum_PinPullSel. 227 | * else return 228 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 229 | * QL_RET_ERR_NORIGHTOPERATE, can't operate,Maybe the GPIO not Init 230 | * QL_RET_ERR_NOGPIOMODE, the input GPIO is not GPIO mode 231 | *****************************************************************/ 232 | s32 Ql_GPIO_GetPullSelection(Enum_PinName pinName); 233 | 234 | /***************************************************************** 235 | * Function: Ql_GPIO_Uninit 236 | * 237 | * Description: 238 | * This function releases the specified GPIO that was 239 | * initialized by calling Ql_GPIO_Init() previously. 240 | * After releasing, the GPIO can be used for other purpose. 241 | * Parameters: 242 | * pinName: 243 | * Pin name, one value of Enum_PinName. 244 | * Return: 245 | * QL_RET_OK, this function succeeds. 246 | * QL_RET_ERR_NOSUPPORTPIN, the input GPIO is invalid. 247 | * QL_RET_ERR_BUSSUBBUSY, the GPIO not used as GPIO, 248 | * Maby is used by IIC or SPI,this function can't release it 249 | *****************************************************************/ 250 | s32 Ql_GPIO_Uninit(Enum_PinName pinName); 251 | 252 | #endif // __QL_GPIO_H__ 253 | -------------------------------------------------------------------------------- /SDK/include/ql_iic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_ii.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * IIC interface APIs defines. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __QL_IIC_H__ 34 | #define __QL_IIC_H__ 35 | 36 | 37 | /***************************************************************** 38 | * Function: Ql_IIC_Init 39 | * 40 | * Description: 41 | * This function initialize the configurations for an IIC channel. 42 | * including the specified pins for IIC, IIC type, and IIC channel No. 43 | * 44 | * Parameters: 45 | * chnnlNo: 46 | * [In] IIC channel No, the range is 0~254 47 | * pinSCL: 48 | * [In] IIC SCL pin. 49 | * pinSDA: 50 | * [In] IIC SDA pin. 51 | * IICtype: 52 | * [In] IIC type,FALSE means simulate IIC, TRUE means hardware IIC. 53 | 54 | * Return: 55 | * QL_RET_OK, this function succeeds. 56 | * QL_RET_ERR_CHANNEL_OUTRANGE, the channel No is out of range. 57 | * QL_RET_ERR_CHANNEL_USED, the channel No is be used. 58 | * QL_RET_ERR_FULLI2CBUS, IIC bus is full. 59 | * QL_RET_ERR_NOSUPPORTPIN, the input pin is invalid. 60 | * QL_RET_ERR_PINALREADYSUBCRIBE, the pin is in use in 61 | * other place. For example this pin has been using as EINT or gpio. 62 | * QL_RET_ERR_I2CHWFAILED, Maybe the hardware have something wrong. 63 | * QL_RET_ERR_PARAM, IICtype error , or the IICtype = 1, 64 | * but the pinSCL and pinSDA pins are not IIC contronller pins 65 | *****************************************************************/ 66 | s32 Ql_IIC_Init(u32 chnnlNo, Enum_PinName pinSCL, Enum_PinName pinSDA, bool IICtype); 67 | 68 | /***************************************************************** 69 | * Function: Ql_IIC_Config 70 | * 71 | * Description: 72 | * This function configuration the IIC interface for one slave. 73 | * 74 | * Parameters: 75 | * chnnlNo: 76 | * [In] IIC channel No, the No is specified by Ql_IIC_Init function 77 | * isHost: 78 | * [In] must be ture, just support host mode. 79 | * slaveAddr: 80 | * [In] slave address. 81 | * IicSpeed: 82 | * [In] just used for hardware IIC,and the parameter can be ignored when using simulation IIC. 83 | * For hardware IIC, It supports fast mode and high speed mode. the speed of fast speed mode 84 | * is less than 400 kbps, and the speed of high speed mode is [400..3400] kbps. 85 | * 86 | * Return: 87 | * QL_RET_OK, this function succeeds. 88 | * QL_RET_ERR_CHANNEL_NOT_FOUND, can't found the IIC channel, make sure it is initialized already. 89 | * QL_RET_ERR_IIC_SAME_SLAVE_ADDRESS,the slave address you want to set is already be set,or the address is be used. 90 | * QL_RET_ERR_PARAM, parameter error. 91 | * QL_RET_ERR_IIC_SLAVE_TOO_MANY, there too many slave in this channel.(one channel at most support 6 slave) 92 | *****************************************************************/ 93 | s32 Ql_IIC_Config(u32 chnnlNo, bool isHost, u8 slaveAddr, u32 IicSpeed); 94 | 95 | 96 | /***************************************************************** 97 | * Function: Ql_IIC_Write 98 | * 99 | * Description: 100 | * This function write data to specified slave through IIC interface. 101 | * 102 | * Parameters: 103 | * chnnlNo: 104 | * [In] IIC channel No, the No is specified by Ql_IIC_Init function. 105 | * slaveAddr: 106 | * [In] slave address. 107 | * pData: 108 | * [In] Setting value to slave 109 | * len: 110 | * [In] Number of bytes to write. 111 | * if IICtype=1 ,1 39 | 40 | 41 | s32 Ql_atoi(const char* s); 42 | double Ql_atof(const char* s); 43 | void* Ql_memset(void* dest, u8 value, u32 size); 44 | void* Ql_memcpy(void* dest, const void* src, u32 size); 45 | s32 Ql_memcmp(const void* dest, const void*src, u32 size); 46 | void* Ql_memmove(void* dest, const void* src, u32 size); 47 | char* Ql_strcpy(char* dest, const char* src); 48 | char* Ql_strncpy(char* dest, const char* src, u32 size); 49 | char* Ql_strcat(char* s1, const char* s2); 50 | char* Ql_strncat(char* s1, const char* s2, u32 size); 51 | s32 Ql_strcmp(const char*s1, const char*s2); 52 | s32 Ql_strncmp(const char* s1, const char* s2, u32 size); 53 | char* Ql_strchr(const char* s1, s32 ch); 54 | u32 Ql_strlen(const char* str); 55 | char* Ql_strstr(const char* s1, const char* s2); 56 | s32 Ql_toupper(s32 c); 57 | s32 Ql_tolower(s32 c); 58 | s32 Ql_isdigit(char c); 59 | extern s32 (*Ql_sprintf)(char *, const char *, ...); 60 | extern s32 (*Ql_snprintf)(char *, u32, const char *, ...); 61 | extern s32 (*Ql_sscanf)(const char*, const char*, ...); 62 | //Lebron add ql_vsprintf 63 | extern s32 (*Ql_vsprintf)(char*, const char*, __gnuc_va_list); 64 | 65 | #endif // __QL_STDLIB_H__ 66 | -------------------------------------------------------------------------------- /SDK/include/ql_time.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_time.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * Time related APIs 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_TIME_H__ 36 | #define __QL_TIME_H__ 37 | #include "ql_type.h" 38 | 39 | typedef struct { 40 | s32 year; 41 | s32 month; 42 | s32 day; 43 | s32 hour; 44 | s32 minute; 45 | s32 second; 46 | s32 timezone; // one digit expresses a quarter of an hour, for example: 22 indicates "+5:30" 47 | }ST_Time; 48 | 49 | /***************************************************************** 50 | * Function: Ql_SetLocalTime 51 | * 52 | * Description: 53 | * Set the current local date and time. 54 | * 55 | * Parameters: 56 | * dateTime: 57 | * [in] Point to the ST_Time object 58 | * Return: 59 | * QL_RET_OK indicates this function is executed successesfully. 60 | * QL_RET_ERR_PARAM, indicates the parameter is error. 61 | * 62 | *****************************************************************/ 63 | s32 Ql_SetLocalTime(ST_Time* dateTime); 64 | 65 | /***************************************************************** 66 | * Function: Ql_GetLocalTime 67 | * 68 | * Description: 69 | * Get the current local date and time. 70 | * 71 | * Parameters: 72 | * dateTime: 73 | * [out] Point to the ST_Time object 74 | * Return: 75 | * if succeed,return the current local date and time 76 | * , NULL means get failure. 77 | *****************************************************************/ 78 | ST_Time* Ql_GetLocalTime(ST_Time* dateTime); 79 | 80 | /***************************************************************** 81 | * Function: Ql_Mktime 82 | * 83 | * Description: 84 | * This function get total seconds elapsed 85 | * since 1970.01.01 00:00:00. 86 | * 87 | * Parameters: 88 | * dateTime: 89 | * [in] Point to the ST_Time object 90 | * Return: 91 | * The total seconds 92 | *--------------- 93 | * Usage: 94 | * ST_Time systime; 95 | * Ql_GetLocalTime(&systime); 96 | * seconds = Ql_Mktime(&systime); 97 | *****************************************************************/ 98 | u64 Ql_Mktime(ST_Time* dateTime); 99 | 100 | /***************************************************************** 101 | * Function: Ql_MKTime2CalendarTime 102 | * 103 | * Description: 104 | * This function convert the seconds elapsed since 105 | * 1970.01.01 00:00:00 to local date and time. 106 | * 107 | * Parameters: 108 | * seconds: 109 | * [in] the seconds elapsed since 110 | * 1970.01.01 00:00:00 111 | * pOutDateTime: 112 | * [out] Point to the ST_Time object 113 | * Return: 114 | * if succeed,return the current local date and time 115 | * , NULL means operation failure. 116 | * 117 | *--------------- 118 | * Usage: 119 | * ST_Time systime; 120 | * systime = Ql_MKTime2CalendarTime(seconds, &systime); 121 | * 122 | *****************************************************************/ 123 | ST_Time* Ql_MKTime2CalendarTime(u64 seconds, ST_Time* pOutDateTime); 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /SDK/include/ql_timer.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_timer.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * Timer related APIs 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_TIMER_H__ 36 | #define __QL_TIMER_H__ 37 | #include "ql_type.h" 38 | 39 | /************************************************************** 40 | * User TIMER ID Definition 41 | **************************************************************/ 42 | #define TIMER_ID_USER_START 0x100 43 | 44 | 45 | 46 | typedef void(*Callback_Timer_OnTimer)(u32 timerId, void* param); 47 | 48 | /***************************************************************** 49 | * Function: Ql_Timer_Register 50 | * 51 | * Description: 52 | * Register stack timer,each task only supports 10 timer. 53 | * 54 | * Parameters: 55 | * timerId: 56 | * [in] The timer id must be bigger than 0xFF.And make sure that the id is 57 | * the only one under opencpu task.Of course, the ID that registered 58 | * by "Ql_Timer_RegisterFast" also cannot be the same with it. 59 | * 60 | * callback_onTimer: 61 | * [out] Notify the application when the time of the timer arrives. 62 | * param: 63 | * [in] Used to pass parameters of customers. 64 | * Return: 65 | * QL_RET_OK indicates register ok; 66 | * QL_RET_ERR_PARAM indicates the param error. 67 | * QL_RET_ERR_INVALID_TIMER indicates that the timer ID is already being used 68 | * or the timer is started or stopped not in the same task with it registered. 69 | * QL_RET_ERR_TIMER_FULL indicates all timers are used up. 70 | * QL_RET_ERR_INVALID_TASK_ID indicates the task invalid. 71 | * Notes: 72 | * If you register a timer Id in an opencpu task, then you can only start or stop 73 | * the timer in the same task.Otherwise,the timer can not be started or stopped. 74 | * 75 | *****************************************************************/ 76 | s32 Ql_Timer_Register(u32 timerId, Callback_Timer_OnTimer callback_onTimer, void* param); 77 | 78 | /***************************************************************** 79 | * Function: Ql_Timer_RegisterFast 80 | * 81 | * Description: 82 | * Register GP timer,only support one timer under opencpu task. 83 | * 84 | * Parameters: 85 | * timerId: 86 | * [in] The timer id must be bigger than 0xFF.And make sure that the id is 87 | * not the same with the ID that registered by "Ql_Timer_Register". 88 | * 89 | * callback_onTimer: 90 | * [out] Notify the application when the time of the timer arrives. 91 | * param: 92 | * [in] Used to pass parameters of customers. 93 | * Return: 94 | * QL_RET_OK indicates register ok; 95 | * QL_RET_ERR_PARAM indicates the param error. 96 | * QL_RET_ERR_INVALID_TIMER indicates that the timer ID is already being used 97 | * or the timer is started or stopped not in the same task with it registered. 98 | * QL_RET_ERR_TIMER_FULL indicates all timers are used up. 99 | * QL_RET_ERR_INVALID_TASK_ID indicates the task invalid. 100 | * Notes: 101 | * If you register a timer Id in an opencpu task, then you can only start or stop 102 | * the timer in the same task.Otherwise,the timer can not be started or stopped. 103 | * 104 | *****************************************************************/ 105 | s32 Ql_Timer_RegisterFast(u32 timerId, Callback_Timer_OnTimer callback_onTimer, void* param); 106 | 107 | /***************************************************************** 108 | * Function: Ql_StartTimer 109 | * 110 | * Description: 111 | * Start up a timer with the specified timer id. 112 | * 113 | * Parameters: 114 | * timerId: 115 | * [in] timer id, bigger than 0xFF,the timer id must be registed. 116 | * interval: 117 | * [in] Set the interval of the timer, unit: ms. 118 | * if you start a stack timer, the interval must be 119 | * greater than or equal to 1ms. 120 | * if you start a GP timer, the interval must be 121 | * an integer multiple of 10ms. 122 | * autoRepeat: 123 | * [in] TRUE indicates that the timer is executed repeatedly. 124 | * FALSE indicates that the timer is executed only once. 125 | * Return: 126 | * QL_RET_OK indicates register ok; 127 | * QL_RET_ERR_PARAM indicates the param error. 128 | * QL_RET_ERR_INVALID_TIMER indicates that the timer ID is already being used 129 | * or the timer is started or stopped not in the same task with it registered. 130 | * QL_RET_ERR_TIMER_FULL indicates all timers are used up. 131 | * QL_RET_ERR_INVALID_TASK_ID indicates the task invalid. 132 | * Notes: 133 | * If you register a timer Id in an opencpu task, then you can only start or stop 134 | * the timer in the same task.Otherwise,the timer can not be started or stopped. 135 | * 136 | *****************************************************************/ 137 | s32 Ql_Timer_Start(u32 timerId, u32 interval, bool autoRepeat); 138 | 139 | /***************************************************************** 140 | * Function: Ql_StopTimer 141 | * 142 | * Description: 143 | * Stop the timer with the specified timer id. 144 | * 145 | * Parameters: 146 | * timerId: 147 | * [in] the timer id. The timer has been started 148 | * by calling Ql_Timer_Start previously. 149 | * Return: 150 | * QL_RET_OK indicates register ok; 151 | * QL_RET_ERR_PARAM indicates the param error. 152 | * QL_RET_ERR_INVALID_TIMER indicates that the timer ID is already being used 153 | * or the timer is started or stopped not in the same task with it registered. 154 | * QL_RET_ERR_TIMER_FULL indicates all timers are used up. 155 | * QL_RET_ERR_INVALID_TASK_ID indicates the task invalid. 156 | * Notes: 157 | * If you register a timer Id in an opencpu task, then you can only start or stop 158 | * the timer in the same task.Otherwise,the timer can not be started or stopped. 159 | * 160 | *****************************************************************/ 161 | s32 Ql_Timer_Stop(u32 timerId); 162 | 163 | #endif // End-of __QL_TIMER_H__ 164 | 165 | -------------------------------------------------------------------------------- /SDK/include/ql_trace.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_trace.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * debug trace API 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_TRACE_H__ 36 | #define __QL_TRACE_H__ 37 | #include "ql_type.h" 38 | 39 | typedef enum { 40 | BASIC_MODE, /* In basic mode, debug messages from application will be 41 | output to debug serial port as text. 42 | */ 43 | ADVANCE_MODE /* Default mode. 44 | In advance mode, debug messages from System and application 45 | will be output to debug serial port in special format. Only 46 | the Catcher Tool can capture and display these debug messages 47 | legibly. 48 | */ 49 | } Enum_DebugMode; 50 | 51 | /***************************************************************** 52 | * Function: Ql_Debug_Trace 53 | * 54 | * Description: 55 | * This function prints formatted output to 56 | * debug serial port. Its function is same to 'sprintf'. 57 | * 58 | * Parameters: 59 | * fmt: 60 | * Pointer to a null-terminated multibyte string 61 | * specifying how to interpret the data. 62 | * The maximum string length is 512 bytes. 63 | * Return: 64 | * Number of characters printed 65 | *****************************************************************/ 66 | extern s32 (*Ql_Debug_Trace)(char* fmt, ...); 67 | 68 | #endif // #end-of __QL_TRACE_H__ 69 | -------------------------------------------------------------------------------- /SDK/include/ql_type.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_type.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * OpenCPU Type Definitions 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | 34 | 35 | #ifndef __QL_TYPE_H__ 36 | #define __QL_TYPE_H__ 37 | 38 | #ifndef FALSE 39 | #define FALSE 0 40 | #endif 41 | 42 | #ifndef TRUE 43 | #define TRUE 1 44 | #endif 45 | 46 | #ifndef NULL 47 | #define NULL ((void *) 0) 48 | #endif 49 | 50 | 51 | /**************************************************************************** 52 | * Type Definitions 53 | ***************************************************************************/ 54 | typedef unsigned char bool; 55 | typedef unsigned char u8; 56 | typedef signed char s8; 57 | typedef unsigned short u16; 58 | typedef short s16; 59 | typedef unsigned int u32; 60 | typedef int s32; 61 | typedef unsigned long long u64; 62 | typedef long long s64; 63 | typedef unsigned int ticks; 64 | 65 | #endif // End-of __QL_TYPE_H__ 66 | -------------------------------------------------------------------------------- /SDK/include/ql_wtd.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ql_wtd.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * watch dog APIs defines. 23 | * 24 | * 25 | * Attention: 26 | * ------------ 27 | * When calling Ql_WTD_Init to start a GPTimer,module can not enter to sleep mode 28 | * 29 | * 30 | * Author: 31 | * ------- 32 | * ------- 33 | * 34 | *============================================================================ 35 | * HISTORY 36 | *---------------------------------------------------------------------------- 37 | * 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef __WATCHDOG_H__ 42 | #define __WATCHDOG_H__ 43 | #include "ql_type.h" 44 | #include "ql_gpio.h" 45 | 46 | 47 | /***************************************************************** 48 | * Function: Ql_WTD_Init 49 | * 50 | * Description: 51 | * This function starts a base H/W timer, which is responsible for feed the external watchdog. And specify the I/O pin and feeding interval. 52 | * Besides, this function may specify the reset mode (H/W reset or S/W reset) when the watchdog overflows. 53 | * H/W reset means the external watchdog chip resets the module. 54 | * 55 | * Parameters: 56 | * resetMode: 57 | * [in] Must be zero, H/W reset. 58 | * wtdPin: 59 | * [in]I/O pin that connects to the WDI pin of external watchdog chip. 60 | * interval: 61 | * [in]the interval for feeding external watchdog.the min value of interval is 200. Unit in ms. 62 | * 63 | * Example: 64 | * Ql_WTD_Init(0,PINNAME_RI,600);// start an external watchdog,set RI to feed dog within 600ms 65 | * 66 | * 67 | * Return: 68 | * QL_RET_OK indicates success in starting watch dog service. 69 | * QL_RET_ERR_PARAM indicates the param invalid. 70 | *****************************************************************/ 71 | s32 Ql_WTD_Init(s32 resetMode, Enum_PinName wtdPin, u32 interval) ; 72 | 73 | 74 | 75 | /***************************************************************** 76 | * Function: Ql_WTD_Start 77 | * 78 | * Description: 79 | * The function starts an internal watchdog. If needed, every task may call this function to start an interval watchdog service. 80 | * Parameters: 81 | * interval: 82 | * [in]the interval for feeding internal watchdog.the min value of interval is 400. Unit in ms. 83 | * 84 | * 85 | * Example: 86 | * Ql_WTD_Start(2000); 87 | * If not call Ql_WTD_Feed within 2000ms ,the module will automatically reset. 88 | * 89 | * Return: 90 | * Success return Watchdog ID 91 | * QL_RET_ERR_PARAM indicates the param invalid. 92 | *****************************************************************/ 93 | s32 Ql_WTD_Start(u32 interval); 94 | 95 | 96 | /***************************************************************** 97 | * Function: Ql_WTD_Feed 98 | * 99 | * Description: 100 | * This function feeds the watchdog that is started by Ql_WTD_Start(). 101 | * Parameters: 102 | * wtdID: 103 | * [in] watchdog ID, which is returned by Ql_WTD_Start(). 104 | * 105 | * Return: 106 | * None 107 | *****************************************************************/ 108 | void Ql_WTD_Feed(s32 wtdID); 109 | 110 | 111 | /***************************************************************** 112 | * Function: Ql_WTD_Stop 113 | * 114 | * Description: 115 | * This function stops a watchdog that is started by Ql_WTD_Start(). 116 | * Parameters: 117 | * wtdID: 118 | * [in]watchdog ID, which is returned by Ql_WTD_Start(). 119 | * 120 | * Return: 121 | * None 122 | *****************************************************************/ 123 | void Ql_WTD_Stop(s32 wtdID); 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /SDK/libs/app_image_bin.cfg: -------------------------------------------------------------------------------- 1 | APPGS3MDM32A01.bin -------------------------------------------------------------------------------- /SDK/libs/gcc/app_start.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/libs/gcc/app_start.lib -------------------------------------------------------------------------------- /SDK/libs/gcc/linkscript.ld: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ROM (rx) : ORIGIN = 0x102DB040, LENGTH = 0x00050000 4 | RAM (rwx) : ORIGIN = 0xf03D2000, LENGTH = 0x00019000 5 | } 6 | 7 | SECTIONS 8 | { 9 | . = 0x102DB040; 10 | .initdata : ALIGN(4) 11 | { 12 | KEEP(*(.initdata)); 13 | } > ROM 14 | text : 15 | { 16 | *(.text) 17 | } > ROM 18 | .rodata : ALIGN(4) 19 | { 20 | *(.rodata) 21 | } > ROM 22 | .data : ALIGN(8) 23 | { 24 | PROVIDE_HIDDEN (__data_load = LOADADDR(.data)); 25 | PROVIDE_HIDDEN (__data_start = .); 26 | *(.data) 27 | . = ALIGN (8); 28 | PROVIDE_HIDDEN (_edata = .); 29 | } > RAM AT > ROM 30 | .bss : ALIGN(8) 31 | { 32 | PROVIDE_HIDDEN (__bss_start__ = .); 33 | *(.bss) 34 | . = ALIGN (8); 35 | PROVIDE_HIDDEN (__bss_end__ = .); 36 | } > RAM 37 | } 38 | -------------------------------------------------------------------------------- /SDK/make/GFH_Generator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/make/GFH_Generator.exe -------------------------------------------------------------------------------- /SDK/make/header.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/make/header.dat -------------------------------------------------------------------------------- /SDK/ril/inc/ril_alarm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2014 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_alarm.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module declares RTC alarm related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_ALARM_H__ 34 | #define __RIL_ALARM_H__ 35 | #include "ql_time.h" 36 | 37 | /***************************************************************** 38 | * Function: RIL_Alarm_Create 39 | * 40 | * Description: 41 | * Set and start the alarm with the specified date and time. 42 | * 43 | * Parameters: 44 | * dateTime: [in] Pointer to the ST_Time 45 | * mode:[in] 46 | * 0: start alarm only one time. 47 | * 1: repeat alarm every day. 48 | * 2: repeat alarm every week. 49 | * 3: repeat alarm every month. 50 | * Return: 51 | * QL_RET_OK indicates this function successes. 52 | * QL_RET_ERR_PARAM indicates parameter error. 53 | * QL_RET_ERR_INVALID_TIMER indicates invalid timer. 54 | *****************************************************************/ 55 | s32 RIL_Alarm_Create(ST_Time* dateTime, u8 mode); 56 | 57 | /***************************************************************** 58 | * Function: RIL_Alarm_Query 59 | * 60 | * Description: 61 | * Query the current setting of the clock alarm. 62 | * 63 | * Parameters: 64 | * dateTime: [out] Pointer to the ST_Time 65 | * Return: 66 | * QL_RET_OK indicates this function successes. 67 | * QL_RET_ERR_PARAM indicates parameter error. 68 | * QL_RET_ERR_INVALID_TIMER indicates invalid timer. 69 | *****************************************************************/ 70 | s32 RIL_Alarm_Query(ST_Time* dateTime); 71 | 72 | /***************************************************************** 73 | * Function: RIL_Alarm_Remove 74 | * 75 | * Description: 76 | * Remove the alarm. 77 | * 78 | * Parameters: 79 | * dateTime: [out] Pointer to the ST_Time 80 | * 81 | * Return: 82 | * QL_RET_OK indicates this function successes. 83 | * QL_RET_ERR_PARAM indicates this function fail. 84 | *****************************************************************/ 85 | s32 RIL_Alarm_Remove(ST_Time* dateTime); 86 | 87 | #endif //__RIL_ALARM_H__ 88 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_ble.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/inc/ril_ble.h -------------------------------------------------------------------------------- /SDK/ril/inc/ril_ble_client.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2015 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_bluetooth.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The API functions defined in this file are used for managing Bluetooth 23 | * devices and services. 24 | * 25 | * Author: 26 | * ------- 27 | * ------- 28 | * Designed by : Stanley YONG 29 | * Coded by : Stanley YONG 30 | * Tested by : 31 | 32 | * 33 | *============================================================================ 34 | * HISTORY 35 | *---------------------------------------------------------------------------- 36 | * 37 | ****************************************************************************/ 38 | #ifndef __RIL_BLE_CLIENT_H__ 39 | #define __RIL_BLE_CLIENT_H__ 40 | 41 | 42 | #ifdef __OCPU_RIL_BLE_SUPPORT__ 43 | 44 | #define BT_OFF (0) 45 | #define BT_ON (1) 46 | #define BT_NAME_LEN 56 /* 18 * 3 + 2 */ 47 | #define BT_ADDR_LEN 13 48 | 49 | #define GAT_REMOVE (0) 50 | #define GAT_ADD (1) 51 | #define GAT_STOP (0) 52 | #define GAT_START (1) 53 | 54 | 55 | #define SERVICE_NUM 5 56 | #define CHAR_NUM 2 57 | #define DESC_NUM 1 58 | #define VALUE_NUM 512*2+1 59 | #define SCAN_NUM 20 60 | 61 | 62 | /* Be device address struct */ 63 | typedef struct 64 | { 65 | u32 lap; /* Lower Address Part 00..23 */ 66 | u8 uap; /* upper Address Part 24..31 */ 67 | u16 nap; /* Non-significant 32..47 */ 68 | } ST_BLE_Addr; 69 | 70 | typedef enum{ 71 | MSG_BLE_WREG_IND, 72 | MSG_BLE_EWREG_IND, 73 | MSG_BLE_RREG_IND, 74 | MSG_BLE_PXP_CONNECT, 75 | MSG_BLE_FMP_CONNECT, 76 | MSG_BLE_CONNECT, 77 | MSG_BLE_DISCONNECT, 78 | MSG_BLE_SCAN, 79 | MSG_BLE_CCON, 80 | MSG_BLE_CSS, 81 | MSG_BLE_CGC, 82 | MSG_BLE_CGD, 83 | MSG_BLE_CRC, 84 | MSG_BLE_CRD, 85 | MSG_BLE_CN, 86 | }Enum_BLEMsg; 87 | 88 | 89 | typedef struct 90 | { 91 | s32 connect_status; 92 | s32 connect_id; 93 | s32 result; 94 | char peer_addr[13]; 95 | } ST_BLE_ConnStatus; 96 | 97 | typedef struct 98 | { 99 | s32 RSSI; 100 | char EIR[256]; 101 | char peer_addr[13]; 102 | } ST_BLE_Scan; 103 | 104 | typedef struct 105 | { 106 | s32 conn_id; 107 | char peer_addr[13]; 108 | u8 service_uuid[33]; 109 | u8 char_uuid[33]; 110 | s32 is_notify; 111 | char value[VALUE_NUM]; 112 | }ST_BLE_Notify; 113 | 114 | 115 | typedef struct 116 | { 117 | u8 is_used; 118 | s32 inst; 119 | u8 desc_uuid[33]; 120 | }ST_BLE_Clie_Desc; 121 | 122 | typedef struct 123 | { 124 | s32 is_used; 125 | s32 char_inst; 126 | u8 char_uuid[33]; 127 | u32 prop; 128 | u32 did; 129 | ST_BLE_Clie_Desc desc_id[DESC_NUM]; 130 | }ST_BLE_Clie_Char; 131 | 132 | typedef struct 133 | { 134 | s32 is_primary; 135 | s32 service_inst; 136 | u8 cid; 137 | u8 is_used; 138 | u8 service_uuid[33]; 139 | ST_BLE_Clie_Char char_id[CHAR_NUM]; 140 | }ST_BLE_Clie_Service; 141 | 142 | typedef struct 143 | { 144 | u8 sid; 145 | char gclient_id[33]; 146 | u8 is_used; 147 | s32 result; 148 | s32 conn_id; 149 | ST_BLE_Scan scan_info; 150 | ST_BLE_ConnStatus conn_status; 151 | ST_BLE_Clie_Service service_id[SERVICE_NUM]; 152 | } ST_BLE_Client; 153 | 154 | typedef void (*CALLBACK_BLE_IND)(s32 event, s32 errCode, void* param1, void* param2); 155 | 156 | /***************************************************************** 157 | * Function: RIL_BLE_Initialize 158 | * 159 | * Description: 160 | * bluetooth initialization after power on ,register callback 161 | * 162 | * Parameters: 163 | * cb: callback to be registered 164 | * 165 | * Return: 166 | * RIL_AT_SUCCESS,send AT successfully. 167 | * RIL_AT_FAILED, send AT failed. 168 | * RIL_AT_TIMEOUT,send AT timeout. 169 | * RIL_AT_BUSY, sending AT. 170 | * RIL_AT_INVALID_PARAM, invalid input parameter. 171 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 172 | *****************************************************************/ 173 | 174 | s32 RIL_BLE_Client_Initialize(CALLBACK_BLE_IND cb); 175 | 176 | 177 | // 2018/4/19 ADD by waner 178 | s32 RIL_BT_Gatcreg(u8 op , ST_BLE_Client* gclie); 179 | s32 RIL_BT_Gatcscan(u8 op , ST_BLE_Client* gclie,u16 scan_timeout,u16 scan_num); 180 | s32 RIL_BT_Gatccon(u8 op , ST_BLE_Client* gclient,char *peer_address); 181 | s32 RIL_BT_Gatcss(ST_BLE_Client* gclie); 182 | s32 RIL_BT_Gatcgc(ST_BLE_Client* gclie); 183 | s32 RIL_BT_Gatcgd(ST_BLE_Client* gclie); 184 | s32 RIL_BT_Gatcrc(ST_BLE_Client* gclie,u8 auth_req); 185 | s32 RIL_BT_Gatcwc(ST_BLE_Client* gclie,u8 write_type,u8 auth_req,u8* char_value); 186 | s32 RIL_BT_Gatcwd(ST_BLE_Client* gclie,u8 write_type,u8 auth_req,u8 *char_value); 187 | s32 RIL_BT_Gatcrd(ST_BLE_Client* gclie,u8 auth_req); 188 | s32 RIL_BT_Gatcrn(u8 op , ST_BLE_Client* gclie); 189 | s32 RIL_BT_Gatcgdt(ST_BLE_Client* gclie); 190 | s32 RIL_BT_Gatcl(ST_BLE_Client* gclie,u8 start); 191 | 192 | #endif 193 | #endif //__RIL_BLE_H__ 194 | 195 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_dtmf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_dtmf.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module defines the information, and APIs related to DTMF. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_DTMF_H__ 34 | #define __RIL_DTMF_H__ 35 | 36 | #include "ql_type.h" 37 | 38 | /*********************************************************************** 39 | * ENUM TYPE DEFINITIONS 40 | ************************************************************************/ 41 | typedef enum 42 | { 43 | RIL_DETThreshold_Min = 1, 44 | RIL_DETThreshold_100MS, // Configure 1400Hz or 2300Hz detection threshold, duration of which is 100ms 45 | RIL_DETThreshold_400MS, // Configure 1400Hz and 2300Hz 400ms detection threshold 46 | RIL_DETThreshold_DTMF, // Configure DTMF detection threshold 47 | RIL_DETThreshold_Max = 5 48 | } Enum_ToneDet_Mode; 49 | 50 | typedef enum 51 | { 52 | RIL_WDTMF_VOLUME0 = 0, // uplink or downlink channel of the volume 53 | RIL_WDTMF_VOLUME1, 54 | RIL_WDTMF_VOLUME2, 55 | RIL_WDTMF_VOLUME3, 56 | RIL_WDTMF_VOLUME4, 57 | RIL_WDTMF_VOLUME5, 58 | RIL_WDTMF_VOLUME6, 59 | RIL_WDTMF_VOLUME7 60 | } Enum_WDTMF_Vomume; 61 | 62 | 63 | /**************************************************** 64 | * DTMF detection function definition 65 | ****************************************************/ 66 | /***************************************************************** 67 | * Function: RIL_ToneDet_Open 68 | * 69 | * Description: 70 | * This function is used to Open DTMF detect. 71 | * 72 | * Parameters: 73 | * cb_ToneDet_hdl: 74 | * [IN] call back function to handle DTMF detected. 75 | * dtmfCode: 76 | * [OUT] detected DTMF tone code corresponding ASSCII. 77 | * timems: 78 | * [OUT] persistence time of the tone, unit is ms. 79 | * only when is 69(1400Hz) or 70(1400Hz) is available, otherwise it will always be -1. 80 | * 81 | * Return: 82 | * RIL_AT_SUCCESS,send AT successfully. 83 | * RIL_AT_FAILED, send AT failed. 84 | * RIL_AT_TIMEOUT,send AT timeout. 85 | * RIL_AT_BUSY, sending AT. 86 | * RIL_AT_INVALID_PARAM, invalid input parameter. 87 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 88 | * and then call Ql_RIL_Initialize to initialize RIL. 89 | *****************************************************************/ 90 | typedef void (* CB_ToneDet)( s32 dtmfCode, s32 timems ); 91 | s32 RIL_ToneDet_Open( CB_ToneDet cb_ToneDet_hdl ); 92 | 93 | /***************************************************************** 94 | * Function: RIL_ToneDet_Close 95 | * 96 | * Description: 97 | * The function is used to close DTMF detect. 98 | * 99 | * Parameters: 100 | * 101 | * Return: 102 | * RIL_AT_SUCCESS,send AT successfully. 103 | * RIL_AT_FAILED, send AT failed. 104 | * RIL_AT_TIMEOUT,send AT timeout. 105 | * RIL_AT_BUSY, sending AT. 106 | * RIL_AT_INVALID_PARAM, invalid input parameter. 107 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 108 | * and then call Ql_RIL_Initialize to initialize RIL. 109 | *****************************************************************/ 110 | s32 RIL_ToneDet_Close( void ); 111 | 112 | /***************************************************************** 113 | * Function: RIL_ToneDet_Set 114 | * 115 | * Description: 116 | * This function is used to set DTMF detection. 117 | * 118 | * Parameters: 119 | * : 120 | * [IN] 2-4, select which threshold to set. 121 | * : 122 | * [IN] prefix pause number. 123 | * : 124 | * [IN] low threshold value. 125 | * : 126 | * [IN] high threshold value. 127 | * 128 | * Return: 129 | * RIL_AT_SUCCESS,send AT successfully. 130 | * RIL_AT_FAILED, send AT failed. 131 | * RIL_AT_TIMEOUT,send AT timeout. 132 | * RIL_AT_BUSY, sending AT. 133 | * RIL_AT_INVALID_PARAM, invalid input parameter. 134 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 135 | * and then call Ql_RIL_Initialize to initialize RIL. 136 | *****************************************************************/ 137 | s32 RIL_ToneDet_Set( Enum_ToneDet_Mode mode, u32 pause, u32 low, u32 high ); 138 | 139 | /***************************************************************** 140 | * Function: RIL_ToneDet_Get 141 | * 142 | * Description: 143 | * This function is used to get settings of DTMF detection. 144 | * 145 | * Parameters: 146 | * : 147 | * [IN] 2-4, select which threshold to get. 148 | * : 149 | * [IN] low threshold value. 150 | * : 151 | * [IN] high threshold value. 152 | * 153 | * Return: 154 | * RIL_AT_SUCCESS,send AT successfully. 155 | * RIL_AT_FAILED, send AT failed. 156 | * RIL_AT_TIMEOUT,send AT timeout. 157 | * RIL_AT_BUSY, sending AT. 158 | * RIL_AT_INVALID_PARAM, invalid input parameter. 159 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 160 | * and then call Ql_RIL_Initialize to initialize RIL. 161 | *****************************************************************/ 162 | s32 RIL_ToneDet_Get( Enum_ToneDet_Mode mode, u32 *low, u32 *high ); 163 | 164 | /**************************************************** 165 | * DTMF send functions definition 166 | ****************************************************/ 167 | /***************************************************************** 168 | * Function: RIL_WDTMF_Send 169 | * 170 | * Description: 171 | * This function is used to play DTMF tone during the call. 172 | * 173 | * Parameters: 174 | * ul_volume: 175 | * [IN] 0-7, uplink channel of the volume. 176 | * dl_volume: 177 | * [IN] 0-7, downlink channel of the volume, recommended to be set as 0. 178 | * dtmfStr: 179 | * [IN] this string consists of DTMF tone strings, Duration of each DTMF tone(unit is ms) and Mute time (unit is ms). 180 | * example: "0A5,50,50,3,100,50"-->0A5 is DTMF tone strings, continuancetime 50ms, mute time 50ms; 181 | * The rest of the three Numbers is the same meaning as before. the total lenth of dtmfStr must be less than 400. 182 | * cb_WDTMF_hdl: 183 | * [IN] callback function for QWDTMF URC handle. 184 | * result: 185 | * [OUT] Indicate status of sending DTMF. 186 | * If is 5, it means sending DTMF successfully; 187 | * If is not 5, it means sending DTMF unsuccessfully; 188 | * 189 | * Return: 190 | * RIL_AT_SUCCESS,send AT successfully. 191 | * RIL_AT_FAILED, send AT failed. 192 | * RIL_AT_TIMEOUT,send AT timeout. 193 | * RIL_AT_BUSY, sending AT. 194 | * RIL_AT_INVALID_PARAM, invalid input parameter. 195 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 196 | * and then call Ql_RIL_Initialize to initialize RIL. 197 | *****************************************************************/ 198 | typedef void (* CB_WDTMF)( s32 result ); 199 | s32 RIL_WDTMF_Send( Enum_WDTMF_Vomume ul_volume, Enum_WDTMF_Vomume dl_volume, u8 *dtmfStr, CB_WDTMF cb_WDTMF_hdl ); 200 | 201 | 202 | #endif //__RIL_DTMF_H__ 203 | 204 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_ftp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_ftp.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file is for OpenCPU RIL sytem definitions and APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_SYSTEM_H__ 34 | #define __RIL_FTP_H__ 35 | 36 | typedef void (*CallBack_Ftp_Upload)(s32 result,s32 size); 37 | typedef void (*CallBack_Ftp_Download)(s32 result,s32 size); 38 | 39 | typedef struct{ 40 | char *prefix; 41 | s32 data; 42 | }ST_AT_ftpParam; 43 | 44 | typedef enum 45 | { 46 | FTP_STATUS_IDLE = 0, //No FTP service. 47 | FTP_STATUS_OPENING, //Opening an FTP service. 48 | FTP_STATUS_OPENED, //The FTP service is opened and idle. 49 | FTP_STATUS_WORKING, //Sending FTP commands to the FTP server and receiving response from the FTP server to start data transfer. 50 | FTP_STATUS_TRANSFER, //Transferring data between the module and the FTP server. 51 | FTP_STATUS_CLOSING, //Closing the FTP service. 52 | FTP_STATUS_CLOSED //The FTP service is closed 53 | 54 | }ENUM_FTP_STATUS; 55 | 56 | s32 RIL_FTP_QFTPOPEN(u8* hostName, u32 port,u8* userName,u8* password, bool mode); 57 | 58 | s32 RIL_FTP_QFTPCLOSE(void); 59 | 60 | s32 RIL_FTP_QFTPPUT(u8* fileName, u32 fileSize, u32 timeOut, CallBack_Ftp_Upload ftpPut_CB); 61 | 62 | s32 RIL_FTP_QFTPGET(u8* fileName, u32 fileSize,CallBack_Ftp_Download ftpGet_CB); 63 | 64 | s32 RIL_FTP_QFTPPATH(u8* pathName); 65 | 66 | s32 RIL_FTP_QFTPCFG(u8 type, u8* value); 67 | 68 | s32 RIL_FTP_QFTPSTAT(s32* state); 69 | 70 | s32 RIL_FTP_QFTPLEN(s32* len); 71 | 72 | s32 RIL_FTP_QFTPRENAME(u8* sourcName, u8* targetName); 73 | 74 | s32 RIL_FTP_QFTPSIZE(u8* fileName, u32* fileSize); 75 | 76 | s32 RIL_FTP_QFTPDELETE(u8* fileName); 77 | 78 | s32 RIL_FTP_QFTPMKDIR(u8* pathName); 79 | 80 | s32 RIL_FTP_QFTPRMDIR(u8* pathName); 81 | 82 | s32 RIL_FTP_QIDEACT(void); 83 | 84 | #endif 85 | 86 | 87 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_gps.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2014 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_gps.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module declares GPS related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_GPS_H__ 34 | #define __RIL_GPS_H__ 35 | 36 | #include "ql_type.h" 37 | 38 | /***************************************************************** 39 | * Function: RIL_GPS_Open 40 | * 41 | * Description: 42 | * Power on/off GPS. 43 | * 44 | * Parameters: op:[in] 45 | * 1: Power on GPS. 46 | * 0: Power off GPS. 47 | * Return: 48 | * QL_RET_OK indicates this function successes. 49 | * QL_RET_ERR_PARAM indicates parameter error. 50 | *****************************************************************/ 51 | s32 RIL_GPS_Open(u8 op); 52 | 53 | /****************************************************************************** 54 | * Function: RIL_GPS_SetRefLoc 55 | * 56 | * Description: 57 | * This function sets the reference location for QuecFastFixOnline. 58 | * 59 | * Parameters: 60 | * : 61 | * [in]double, latitude 62 | * 63 | * [in]double, longitude 64 | * Return: 65 | * RIL_AT_SUCCESS,send AT successfully. 66 | * RIL_AT_FAILED, send AT failed. 67 | * RIL_AT_TIMEOUT,send AT timeout. 68 | * RIL_AT_BUSY, sending AT. 69 | * RIL_AT_INVALID_PARAM, invalid input parameter. 70 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 71 | * and then call Ql_RIL_Initialize to initialize RIL. 72 | ******************************************************************************/ 73 | s32 RIL_GPS_SetRefLoc(double lat, double lon); 74 | 75 | /****************************************************************************** 76 | * Function: RIL_GPS_GetPowerState 77 | * 78 | * Description: 79 | * This function gets the power state of GNSS. 80 | * 81 | * Parameters: 82 | * : 83 | * [out]pointer of s32, address of s32 variable 84 | * Return: 85 | * RIL_AT_SUCCESS,send AT successfully. 86 | * RIL_AT_FAILED, send AT failed. 87 | * RIL_AT_TIMEOUT,send AT timeout. 88 | * RIL_AT_BUSY, sending AT. 89 | * RIL_AT_INVALID_PARAM, invalid input parameter. 90 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 91 | * and then call Ql_RIL_Initialize to initialize RIL. 92 | ******************************************************************************/ 93 | s32 RIL_GPS_GetPowerState(s32 *stat); 94 | 95 | /***************************************************************** 96 | * Function: RIL_GPS_Read 97 | * 98 | * Description: 99 | * Query the navigation information. 100 | * 101 | * Parameters: item : [in] Pointer to the query item 102 | * rdBuff: [out] Pointer to the information buffer 103 | * Return: 104 | * QL_RET_OK indicates this function successes. 105 | * QL_RET_ERR_PARAM indicates parameter error. 106 | *****************************************************************/ 107 | s32 RIL_GPS_Read(u8 *item, u8 *rdBuff); 108 | 109 | /***************************************************************** 110 | * Function: RIL_GPS_CMD_Send 111 | * 112 | * Description: 113 | * This function is used to send NMEA to GPS module. 114 | * 115 | * Parameters: 116 | * : 117 | * [IN] always 0 currently. 118 | * : 119 | * [IN] this string is an NMEA sentence. 120 | * : 121 | * [IN] callback function for QGPSCMD URC handle. 122 | * 123 | * Return: 124 | * RIL_AT_SUCCESS,send AT successfully. 125 | * RIL_AT_FAILED, send AT failed. 126 | * RIL_AT_TIMEOUT,send AT timeout. 127 | * RIL_AT_BUSY, sending AT. 128 | * RIL_AT_INVALID_PARAM, invalid input parameter. 129 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 130 | * and then call Ql_RIL_Initialize to initialize RIL. 131 | *****************************************************************/ 132 | typedef void (* CB_GPSCMD)(char *strURC); 133 | s32 RIL_GPS_CMD_Send(u8 cmdType, u8 *cmdStr, CB_GPSCMD cb_GPSCMD_hdl); 134 | 135 | /***************************************************************** 136 | * Function: RIL_GPS_EPO_Enable 137 | * 138 | * Description: 139 | * This function is used to enable/disable EPO download. 140 | * 141 | * Parameters: 142 | * : [IN] 143 | * 0 - disable. 144 | * 1 - enable. 145 | * 146 | * Return: 147 | * RIL_AT_SUCCESS,send AT successfully. 148 | * RIL_AT_FAILED, send AT failed. 149 | * RIL_AT_TIMEOUT,send AT timeout. 150 | * RIL_AT_BUSY, sending AT. 151 | * RIL_AT_INVALID_PARAM, invalid input parameter. 152 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 153 | * and then call Ql_RIL_Initialize to initialize RIL. 154 | *****************************************************************/ 155 | s32 RIL_GPS_EPO_Enable(u8 status); 156 | 157 | /***************************************************************** 158 | * Function: RIL_GPS_EPO_Aid 159 | * 160 | * Description: 161 | * This function is used to inject EPO data to GPS module. 162 | * 163 | * Parameters: NONE 164 | * Return: 165 | * RIL_AT_SUCCESS,send AT successfully. 166 | * RIL_AT_FAILED, send AT failed. 167 | * RIL_AT_TIMEOUT,send AT timeout. 168 | * RIL_AT_BUSY, sending AT. 169 | * RIL_AT_INVALID_PARAM, invalid input parameter. 170 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 171 | * and then call Ql_RIL_Initialize to initialize RIL. 172 | *****************************************************************/ 173 | s32 RIL_GPS_EPO_Aid(void); 174 | 175 | /***************************************************************** 176 | * Function: RIL_GPS_Read_TimeSync_Status 177 | * 178 | * Description: 179 | * This function is used to read time synchronization status. 180 | * 181 | * Parameters: 182 | * : [OUT] point to the result if readed successfully. 183 | * Return: 184 | * RIL_AT_SUCCESS,send AT successfully. 185 | * RIL_AT_FAILED, send AT failed. 186 | * RIL_AT_TIMEOUT,send AT timeout. 187 | * RIL_AT_BUSY, sending AT. 188 | * RIL_AT_INVALID_PARAM, invalid input parameter. 189 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 190 | * and then call Ql_RIL_Initialize to initialize RIL. 191 | *****************************************************************/ 192 | s32 RIL_GPS_Read_TimeSync_Status(u8 *status); 193 | 194 | /***************************************************************** 195 | * Function: RIL_GPS_EPO_Config_APN 196 | * 197 | * Description: 198 | * This function is used to config the APN of EPO context. 199 | * 200 | * Parameters: 201 | * : [IN] point to the string which indicates the access point name. 202 | * : [IN] point to the string which indicates the user name. 203 | * : [IN] point to the string which indicates the password. 204 | * Return: 205 | * RIL_AT_SUCCESS,send AT successfully. 206 | * RIL_AT_FAILED, send AT failed. 207 | * RIL_AT_TIMEOUT,send AT timeout. 208 | * RIL_AT_BUSY, sending AT. 209 | * RIL_AT_INVALID_PARAM, invalid input parameter. 210 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 211 | * and then call Ql_RIL_Initialize to initialize RIL. 212 | *****************************************************************/ 213 | s32 RIL_GPS_EPO_Config_APN(u8 *apnName, u8 *apnUserId, u8 *apnPasswd); 214 | 215 | #endif //__RIL_GPS_H__ 216 | 217 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_http.h: -------------------------------------------------------------------------------- 1 | #ifndef __RIL_HTTP_H__ 2 | #define __RIL_HTTP_H__ 3 | 4 | typedef enum{ 5 | HTTP_ACTION_IDLE = 0, 6 | HTTP_ACTION_SETRUL, 7 | HTTP_ACTION_GET_REQ, 8 | HTTP_ACTION_POST_REQ, 9 | HTTP_ACTION_READ_RSP, 10 | HTTP_ACTION_DOWNLOAD_FILE 11 | }Enum_HTTP_Ation; 12 | 13 | // 14 | // 15 | // Set http server URL address. 16 | s32 RIL_HTTP_SetServerURL(char* strURL, u16 len); 17 | // 18 | // Send http-get request. 19 | s32 RIL_HTTP_RequestToGet(u32 timeout); 20 | // 21 | // Send http-post request. 22 | s32 RIL_HTTP_RequestToPost(char* strPostMsg, u16 len); 23 | // 24 | // Read response from HTTP server. 25 | s32 RIL_HTTP_ReadResponse(u32 timeout, CB_RIL_RcvDataFrmCore cb_rcvData); 26 | // 27 | // Downlaod the file from http server to a local file. 28 | // The http file is specified by the url when calling RIL_HTTP_SetServerURL(). 29 | typedef void (*CB_HTTP_DwnldFile)(u32 dllSize, u32 cntntLen, s32 errCode); 30 | s32 RIL_HTTP_DownloadFile(char* filePath, u32 size, CB_HTTP_DwnldFile cb); 31 | 32 | #endif //__RIL_HTTP_H__ 33 | 34 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_location.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_location.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_LOCATION_H__ 34 | #define __RIL_LOCATION_H__ 35 | 36 | #include "ql_type.h" 37 | 38 | 39 | // Cell info 40 | typedef struct { 41 | u16 mcc; 42 | u16 mnc; 43 | u32 lac; 44 | s32 cellId; 45 | s16 rssi; 46 | u16 timeAd; 47 | }ST_CellInfo; 48 | 49 | // Location info 50 | typedef struct{ 51 | float longitude; 52 | float latitude; 53 | //u16 reserved; 54 | }ST_LocInfo; 55 | 56 | typedef void(*CB_LocInfo)(s32 result,ST_LocInfo* loc_info); 57 | 58 | s32 RIL_GetLocation(CB_LocInfo cb_loc); 59 | s32 RIL_GetLocation_Ex(ST_LocInfo* locinfo); 60 | s32 RIL_GetLocationByCell(ST_CellInfo* cell, CB_LocInfo cb_loc); 61 | 62 | #endif //__RIL_LOCATION_H__ 63 | 64 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_location2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2014 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_location2.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements QLBS related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_LOCATION2_H__ 34 | #define __RIL_LOCATION2_H__ 35 | 36 | #include "custom_feature_def.h" 37 | #include "ql_type.h" 38 | #ifdef __OCPU_RIL_QLBS_SUPPORT__ 39 | 40 | #define MAX_TOKEN_LENGTH 16+1 41 | #define MAX_SERVER_NAME_LENGTH 128 42 | #define TIME_STRING_LENGTH 20 43 | 44 | 45 | typedef enum 46 | { 47 | ASYNCH_MODE = 0, //>Selection of positioning interface, the default interface is use to QUECTEL server 48 | TIMEOUT, 49 | SERVER_ADDRESS, //>The maximum waiting time for data from server 50 | TOKEN, //>The user-defined address and port for QuecLocator. 51 | TIMEUPDATE, //>the value of identification required for QUECTEL positioning interface 52 | WITHTIME //>the value of identification required for Gaode positioning interface, 53 | }Enum_Qlbs_Cfg_Flag; 54 | 55 | typedef enum 56 | { 57 | SYNC_MODE = 0, //> Synchronous mode 58 | ASYNC_MODE //> Asynchronous mode 59 | 60 | }Enum_Qlbs_Asynch_Mode; 61 | 62 | typedef enum 63 | { 64 | DO_NOT_UPDATE_TIME2RTC = 0, //> Do not update the time to RTC 65 | UPDATE_TIME2RTC //> Update the time to RTC 66 | 67 | }Enum_Qlbs_Update_Mode; 68 | 69 | typedef enum 70 | { 71 | DO_NOT_OUTPUT_TIME = 0, //> Do not output the time 72 | OUTPUT_TIME //> Output the time 73 | 74 | }Enum_Qlbs_Time_Mode; 75 | 76 | typedef struct 77 | { 78 | Enum_Qlbs_Asynch_Mode asynch_mode; 79 | s32 timeout; 80 | u8 server_name[MAX_SERVER_NAME_LENGTH]; 81 | u8 token_value[MAX_TOKEN_LENGTH]; 82 | Enum_Qlbs_Update_Mode update_mode; 83 | Enum_Qlbs_Time_Mode time_mode; 84 | } ST_Qlbs_Cfg_Para; 85 | 86 | typedef struct{ 87 | float longitude; 88 | float latitude; 89 | u8 time[TIME_STRING_LENGTH]; 90 | }ST_Lbs_LocInfo; 91 | 92 | typedef void(*CB_LocInfo)(s32 result,ST_Lbs_LocInfo* loc_info); 93 | 94 | /***************************************************************** 95 | * Function: RIL_QLBS_Cfg 96 | * 97 | * Description: 98 | * This function is used to wifi positioning configure. 99 | * 100 | * Parameters: 101 | * 102 | * Return: 103 | * RIL_AT_SUCCESS,send AT successfully. 104 | * RIL_AT_FAILED, send AT failed. 105 | * RIL_AT_TIMEOUT,send AT timeout. 106 | * RIL_AT_BUSY, sending AT. 107 | * RIL_AT_INVALID_PARAM, invalid input parameter. 108 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 109 | * and then call Ql_RIL_Initialize to initialize RIL. 110 | *****************************************************************/ 111 | s32 RIL_QLBS_Cfg(Enum_Qlbs_Cfg_Flag cfg_flag,ST_Qlbs_Cfg_Para* cfg_para); 112 | 113 | 114 | /***************************************************************** 115 | * Function: RIL_QLBS_Loc 116 | * 117 | * Description: 118 | * This function is used to obtain position. 119 | * 120 | * Parameters: 121 | * 122 | * Return: 123 | * RIL_AT_SUCCESS,send AT successfully. 124 | * RIL_AT_FAILED, send AT failed. 125 | * RIL_AT_TIMEOUT,send AT timeout. 126 | * RIL_AT_BUSY, sending AT. 127 | * RIL_AT_INVALID_PARAM, invalid input parameter. 128 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 129 | * and then call Ql_RIL_Initialize to initialize RIL. 130 | *****************************************************************/ 131 | s32 RIL_QLBS_Loc(CB_LocInfo cb_qlbsloc); 132 | #endif 133 | #endif 134 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_network.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_network.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file declares some API functions, which are related to network, including 23 | * SIM state, GSM/GPRS network state and signal strength, and so forth. 24 | * 25 | * Author: 26 | * ------- 27 | * ------- 28 | * 29 | *============================================================================ 30 | * HISTORY 31 | *---------------------------------------------------------------------------- 32 | * 33 | ****************************************************************************/ 34 | #ifndef __RIL_NETWORK_H__ 35 | #define __RIL_NETWORK_H__ 36 | #include "ql_type.h" 37 | #include "ril_sim.h" 38 | 39 | 40 | /**************************************************************************** 41 | * Definition for network State 42 | ***************************************************************************/ 43 | typedef enum { 44 | NW_STAT_NOT_REGISTERED = 0, // Not register to network 45 | NW_STAT_REGISTERED, // The normal network state 46 | NW_STAT_SEARCHING, // Searching network 47 | NW_STAT_REG_DENIED, // The register request is denied 48 | NW_STAT_UNKNOWN, 49 | NW_STAT_REGISTERED_ROAMING //Registered and Roaming state 50 | }Enum_NetworkState; 51 | 52 | typedef enum { 53 | IP_INITIAL=0, 54 | IP_START, 55 | IP_CONFIG, 56 | IP_IND, 57 | IP_GPRSACT, 58 | IP_STATUS, 59 | TCP_PROCESSING, 60 | UDP_PROCESSING=TCP_PROCESSING, 61 | IP_CLOSE, 62 | CONNECT_OK, 63 | GPRS_CONTEXT_DEACT, 64 | IP_STATUS_END 65 | }Enum_ContextIPState; 66 | 67 | typedef struct{ 68 | int rssi; 69 | int ber; 70 | }ST_CSQ_Reponse; 71 | 72 | 73 | /****************************************************************************** 74 | * Function: RIL_NW_GetGSMState 75 | * 76 | * Description: 77 | * This function gets the GSM network register state. 78 | * 79 | * Parameters: 80 | * stat: 81 | * [out]GSM State. 82 | * Return: 83 | * One value of Enum_NetworkState: network register state code. 84 | * -1 : fail to get the network state. 85 | ******************************************************************************/ 86 | s32 RIL_NW_GetGSMState(s32 *stat); 87 | 88 | /****************************************************************************** 89 | * Function: RIL_NW_GetGPRSState 90 | * 91 | * Description: 92 | * This function gets the GPRS network register state. 93 | * 94 | * Parameters: 95 | * stat: 96 | * [out]GPRS State. 97 | * Return: 98 | * One value of Enum_NetworkState: network register state code. 99 | * -1 : fail to get the network state. 100 | ******************************************************************************/ 101 | s32 RIL_NW_GetGPRSState(s32 *stat); 102 | 103 | /****************************************************************************** 104 | * Function: RIL_NW_GetSignalQuality 105 | * 106 | * Description: 107 | * This function gets the signal quality level and bit error rate. 108 | * 109 | * Parameters: 110 | * rssi: 111 | * [out] Signal quality level, 0~31 or 99. 99 indicates module 112 | * doesn't register to GSM network. 113 | * 114 | * ber: 115 | * [out] The bit error code of signal. 116 | * Return: 117 | * QL_RET_OK indicates success. 118 | * QL_RET_ERR_INVALID_PARAMETER indicates something wrong for input parameters. 119 | ******************************************************************************/ 120 | s32 RIL_NW_GetSignalQuality(u32* rssi, u32* ber); 121 | 122 | /****************************************************************************** 123 | * Function: RIL_NW_SetGPRSContext 124 | * 125 | * Description: 126 | * This function select a context as foreground context 127 | * 128 | * Parameters: 129 | * foregroundContext: 130 | * [IN] Anumeric indicates which context will be set as foreground context.The range is 0-1. 131 | * Return: 132 | * RIL_AT_SUCCESS,send AT successfully. 133 | * RIL_AT_FAILED, send AT failed. 134 | * RIL_AT_TIMEOUT,send AT timeout. 135 | * RIL_AT_BUSY, sending AT. 136 | * RIL_AT_INVALID_PARAM, invalid input parameter. 137 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 138 | * and then call Ql_RIL_Initialize to initialize RIL. 139 | ******************************************************************************/ 140 | s32 RIL_NW_SetGPRSContext(u8 foregroundContext); 141 | 142 | /****************************************************************************** 143 | * Function: RIL_NW_SetAPN 144 | * 145 | * Description: 146 | * This function sets the APN for the current context. 147 | * 148 | * Parameters: 149 | * mode: 150 | * [in] wireless connection mode. 151 | * 0=CSD, not supported. 152 | * 1=GPRS 153 | * apn: 154 | * [in] pointer to the APN name. 155 | * 156 | * userName: 157 | * [in] pointer to the user name. 158 | * 159 | * pw: 160 | * [in] pointer to the password. 161 | * Return: 162 | * RIL_AT_SUCCESS,send AT successfully. 163 | * RIL_AT_FAILED, send AT failed. 164 | * RIL_AT_TIMEOUT,send AT timeout. 165 | * RIL_AT_BUSY, sending AT. 166 | * RIL_AT_INVALID_PARAM, invalid input parameter. 167 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 168 | * and then call Ql_RIL_Initialize to initialize RIL. 169 | ******************************************************************************/ 170 | s32 RIL_NW_SetAPN(u8 mode, char* apn, char* userName, char* pw); 171 | 172 | /****************************************************************************** 173 | * Function: RIL_NW_GetIPStatus 174 | * 175 | * Description: 176 | * This function the status of IP protocol stack. 177 | * 178 | * Parameters: 179 | * None. 180 | * Return: 181 | * RIL_AT_SUCCESS,send AT successfully. 182 | * RIL_AT_FAILED, send AT failed. 183 | * RIL_AT_TIMEOUT,send AT timeout. 184 | * RIL_AT_BUSY, sending AT. 185 | * RIL_AT_INVALID_PARAM, invalid input parameter. 186 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 187 | * and then call Ql_RIL_Initialize to initialize RIL. 188 | ******************************************************************************/ 189 | s32 RIL_NW_GetIPStatus(void); 190 | 191 | /****************************************************************************** 192 | * Function: RIL_NW_OpenPDPContext 193 | * 194 | * Description: 195 | * This function opens/activates the GPRS PDP context. The PDP 196 | * context id is specified by RIL_NW_SetGPRSContext(). 197 | * 198 | * Parameters: 199 | * None. 200 | * Return: 201 | * RIL_AT_SUCCESS,send AT successfully. 202 | * RIL_AT_FAILED, send AT failed. 203 | * RIL_AT_TIMEOUT,send AT timeout. 204 | * RIL_AT_BUSY, sending AT. 205 | * RIL_AT_INVALID_PARAM, invalid input parameter. 206 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 207 | * and then call Ql_RIL_Initialize to initialize RIL. 208 | ******************************************************************************/ 209 | s32 RIL_NW_OpenPDPContext(void); 210 | 211 | /****************************************************************************** 212 | * Function: RIL_NW_ClosePDPContext 213 | * 214 | * Description: 215 | * This function closes/deactivates the GPRS PDP context.The PDP 216 | * context id is specified by RIL_NW_SetGPRSContext(). 217 | * 218 | * Parameters: 219 | * None. 220 | * Return: 221 | * RIL_AT_SUCCESS,send AT successfully. 222 | * RIL_AT_FAILED, send AT failed. 223 | * RIL_AT_TIMEOUT,send AT timeout. 224 | * RIL_AT_BUSY, sending AT. 225 | * RIL_AT_INVALID_PARAM, invalid input parameter. 226 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 227 | * and then call Ql_RIL_Initialize to initialize RIL. 228 | ******************************************************************************/ 229 | s32 RIL_NW_ClosePDPContext(void); 230 | 231 | /****************************************************************************** 232 | * Function: RIL_NW_GetOperator 233 | * 234 | * Description: 235 | * This function gets the network operator that module registered. 236 | * 237 | * Parameters: 238 | * operator: 239 | * [out] a string with max 16 characters, which indicates the 240 | * network operator that module registered. 241 | * Return: 242 | * RIL_AT_SUCCESS,send AT successfully. 243 | * RIL_AT_FAILED, send AT failed. 244 | * RIL_AT_TIMEOUT,send AT timeout. 245 | * RIL_AT_BUSY, sending AT. 246 | * RIL_AT_INVALID_PARAM, invalid input parameter. 247 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 248 | * and then call Ql_RIL_Initialize to initialize RIL. 249 | ******************************************************************************/ 250 | s32 RIL_NW_GetOperator(char* operator); 251 | 252 | #endif // __RIL_NETWORK_H__ 253 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_ntp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2014 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_ntp.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements NTP related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_NTP_H__ 34 | #define __RIL_NTP_H__ 35 | 36 | #include "ql_type.h" 37 | 38 | 39 | /***************************************************************** 40 | * Function: RIL_NTP_START 41 | * 42 | * Description: 43 | * This function is used to synchronize time with NTP server. 44 | * 45 | * Parameters: 46 | * : [IN] point to the string which indicates NTP server address. 47 | * : [IN] the NTP server port. 48 | * : [IN] callback function for NTP URC handle. 49 | * Return: 50 | * RIL_AT_SUCCESS,send AT successfully. 51 | * RIL_AT_FAILED, send AT failed. 52 | * RIL_AT_TIMEOUT,send AT timeout. 53 | * RIL_AT_BUSY, sending AT. 54 | * RIL_AT_INVALID_PARAM, invalid input parameter. 55 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 56 | * and then call Ql_RIL_Initialize to initialize RIL. 57 | *****************************************************************/ 58 | typedef void (* CB_NTPCMD)(char *strURC); 59 | s32 RIL_NTP_START(u8 *server_addr, u16 server_port, CB_NTPCMD cb_NTPCMD_hdl); 60 | 61 | #endif //__RIL_NTP_H__ 62 | 63 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_sim.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_network.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file declares some API functions, which are related to SIM card, including 23 | * SIM state, IMSI and CCID. 24 | * 25 | * Author: 26 | * ------- 27 | * ------- 28 | * 29 | *============================================================================ 30 | * HISTORY 31 | *---------------------------------------------------------------------------- 32 | * 33 | ****************************************************************************/ 34 | #ifndef __RIL_SIM_H__ 35 | #define __RIL_SIM_H__ 36 | #include "ql_type.h" 37 | 38 | 39 | /**************************************************************************** 40 | * Definition for SIM Card State 41 | ***************************************************************************/ 42 | typedef enum { 43 | SIM_STAT_NOT_INSERTED = 0, 44 | SIM_STAT_READY, 45 | SIM_STAT_PIN_REQ, 46 | SIM_STAT_PUK_REQ, 47 | SIM_STAT_PH_PIN_REQ, 48 | SIM_STAT_PH_PUK_REQ, 49 | SIM_STAT_PIN2_REQ, 50 | SIM_STAT_PUK2_REQ, 51 | SIM_STAT_BUSY, 52 | SIM_STAT_NOT_READY, 53 | SIM_STAT_UNSPECIFIED 54 | }Enum_SIMState; 55 | 56 | 57 | /****************************************************************************** 58 | * Function: RIL_SIM_GetSimState 59 | * 60 | * Description: 61 | * This function gets the state of SIM card. 62 | * 63 | * Related AT: 64 | * "AT+CPIN?". 65 | * 66 | * Parameters: 67 | * stat: 68 | * [out]SIM card State code, one value of Enum_SIMState. 69 | * Return: 70 | * RIL_AT_SUCCESS, this function succeeds. 71 | * Or, please see the definition of Enum_ATSndError. 72 | ******************************************************************************/ 73 | s32 RIL_SIM_GetSimState(s32* state); 74 | 75 | /****************************************************************************** 76 | * Function: RIL_SIM_GetIMSI 77 | * 78 | * Description: 79 | * This function gets the state of SIM card. 80 | * 81 | * Related AT: 82 | * "AT+CIMI". 83 | * 84 | * Parameters: 85 | * imsi: 86 | * [out]IMSI number, a string of 15-byte. 87 | * Return: 88 | * RIL_AT_SUCCESS, this function succeeds. 89 | * Or, please see the definition of Enum_ATSndError. 90 | ******************************************************************************/ 91 | s32 RIL_SIM_GetIMSI(char* imsi); 92 | 93 | /****************************************************************************** 94 | * Function: RIL_SIM_GetCCID 95 | * 96 | * Description: 97 | * This function gets the CCID of SIM card. 98 | * 99 | * Related AT: 100 | * "AT+CCID". 101 | * 102 | * Parameters: 103 | * ccid: 104 | * [out] CCID number, a string of 20-byte. 105 | * Return: 106 | * RIL_AT_SUCCESS, this function succeeds. 107 | * Or, please see the definition of Enum_ATSndError. 108 | ******************************************************************************/ 109 | s32 RIL_SIM_GetCCID(char* ccid); 110 | 111 | #endif //__RIL_SIM_H__ 112 | 113 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_system.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_system.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file is for OpenCPU RIL sytem definitions and APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_SYSTEM_H__ 34 | #define __RIL_SYSTEM_H__ 35 | 36 | 37 | 38 | typedef struct 39 | { 40 | s32 capacity; 41 | s32 voltage; 42 | }ST_SysPower; 43 | 44 | /***************************************************************** 45 | * Function: RIL_QuerySysInitStatus 46 | * 47 | * Description: 48 | * Queries the initializing status of module. 49 | * 50 | * Parameters: 51 | * SysInitStatus 52 | * [Out] system init status. 53 | * 0/1/2/3, the init status value, one value of "Enum_SysInitState". 54 | * Please refer to "AT+QINISTAT" in ATC document for the meanings. 55 | * Return: 56 | * RIL_AT_SUCCESS,send AT successfully. 57 | * RIL_AT_FAILED, send AT failed. 58 | * RIL_AT_TIMEOUT,send AT timeout. 59 | * RIL_AT_BUSY, sending AT. 60 | * RIL_AT_INVALID_PARAM, invalid input parameter. 61 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 62 | * and then call Ql_RIL_Initialize to initialize RIL. 63 | *****************************************************************/ 64 | s32 RIL_QuerySysInitStatus(s32* SysInitStatus); 65 | 66 | /***************************************************************** 67 | * Function: RIL_GetPowerSupply 68 | * 69 | * Description: 70 | * This function queries the battery balance, and the battery voltage. 71 | * 72 | * Parameters: 73 | * capacity: 74 | * [out] battery balance, a percent, ranges from 1 to 100. 75 | * 76 | * voltage: 77 | * [out] battery voltage, unit in mV 78 | * Return: 79 | * RIL_AT_SUCCESS,send AT successfully. 80 | * RIL_AT_FAILED, send AT failed. 81 | * RIL_AT_TIMEOUT,send AT timeout. 82 | * RIL_AT_BUSY, sending AT. 83 | * RIL_AT_INVALID_PARAM, invalid input parameter. 84 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 85 | * and then call Ql_RIL_Initialize to initialize RIL. 86 | *****************************************************************/ 87 | s32 RIL_GetPowerSupply(u32* capacity, u32* voltage); 88 | 89 | /***************************************************************** 90 | * Function: Ql_SecureData_Store 91 | * 92 | * Description: 93 | * This function can be used to store some critical user data 94 | * to prevent them from losing. 95 | * 96 | * Note: 97 | * 1. 98 | * OpenCPU has designed 13 blocks of system storage space to 99 | * backup critical user data. Developer may specify the first 100 | * parameter index [1-13] to specify different storage block. 101 | * Among the storage blocks, 1~8 blocks can store 50 bytes for 102 | * each block, 9~12 blocks can store 100 bytes for each block, 103 | * and the 13th block can store 500 bytes. 104 | * 105 | * 2. 106 | * User should not call this API function frequently, which is not 107 | * good for life cycle of flash. 108 | * 109 | * Parameters: 110 | * index: 111 | * [in] the index of the secure data block. The range is: 1~13. 112 | * 113 | * pData: 114 | * [in] The data to be backed up. In 1~8 groups, every group can 115 | * save 50 bytes at most. In 9~12 groups, every group can save 116 | * 100 bytes at most. If index is 13, the user data can save 500 bytes at most. 117 | * 118 | * len: 119 | * [in] The length of the user data. When the index is (1~8), 120 | * then len<=50. When the index is (9~12), then len<=100. 121 | * When the index is 13, then len<=500. 122 | * Return: 123 | * QL_RET_OK, this function succeeds. 124 | * QL_RET_ERR_PARAM, invalid paramter. 125 | * QL_RET_ERR_GET_MEM, the heap memory is no enough. 126 | * ...... 127 | *****************************************************************/ 128 | s32 Ql_SecureData_Store(u8 index , u8* pData, u32 len); 129 | 130 | /***************************************************************** 131 | * Function: Ql_SecureData_Read 132 | * 133 | * Description: 134 | * This functin reads secure data which is previously 135 | * stored by Ql_SecureData_Store. 136 | * Parameters: 137 | * index: 138 | * [in] The index of the secure data block. The range is: 1~13. 139 | * 140 | * len: 141 | * [in] The length of the user data. When the index is (1~8), 142 | * then len<=50. When the index is (9~12), then len<=100. 143 | * When the index is 13, then len<=500. 144 | * Return: 145 | * If this function succeeds, the real read length is returned. 146 | * QL_RET_ERR_PARAM, invalid paramter. 147 | * QL_RET_ERR_GET_MEM, the heap memory is no enough. 148 | * Ql_RET_ERR_UNKOWN, unknown error. 149 | *****************************************************************/ 150 | s32 Ql_SecureData_Read(u8 index, u8* pBuffer, u32 len); 151 | 152 | /***************************************************************** 153 | * Function: RIL_GetIMEI 154 | * 155 | * Description: 156 | * Retrieves the IMEI number of module. 157 | * 158 | * Parameters: 159 | * imei: 160 | * [Out] buffer to store the imei number. The length 161 | * of buffer should be at least 15-byte. 162 | * Return: 163 | * RIL_AT_SUCCESS,send AT successfully. 164 | * RIL_AT_FAILED, send AT failed. 165 | * RIL_AT_TIMEOUT,send AT timeout. 166 | * RIL_AT_BUSY, sending AT. 167 | * RIL_AT_INVALID_PARAM, invalid input parameter. 168 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 169 | * and then call Ql_RIL_Initialize to initialize RIL. 170 | *****************************************************************/ 171 | s32 RIL_GetIMEI(char* imei); 172 | 173 | #endif //__RIL_SYSTEM_H__ 174 | 175 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_telephony.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_telephony.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file is for telephony. All APIs depend on OpenCPU RIL feature. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_TELEPHONY_H__ 34 | #define __RIL_TELEPHONY_H__ 35 | #include "ql_type.h" 36 | 37 | #define PHONE_NUMBER_MAX_LEN 41 38 | typedef struct { 39 | s32 type; 40 | char phoneNumber[PHONE_NUMBER_MAX_LEN]; 41 | }ST_ComingCall; 42 | 43 | typedef struct { 44 | u32 ringCnt; 45 | ST_ComingCall comingCall[6]; 46 | }ST_ComingCallInfo; 47 | 48 | typedef enum { 49 | CALL_STATE_ERROR = -1, 50 | CALL_STATE_OK = 0, 51 | CALL_STATE_BUSY, 52 | CALL_STATE_NO_ANSWER, 53 | CALL_STATE_NO_CARRIER, 54 | CALL_STATE_NO_DIALTONE, 55 | CALL_STATE_END 56 | }Enum_CallState; 57 | 58 | /****************************************************************************** 59 | * Function: RIL_Telephony_Dial 60 | * 61 | * Description: 62 | * This function dials the specified phone number, only support voice call. 63 | * 64 | * Parameters: 65 | * type: 66 | * [In] Must be 0 , just support voice call. 67 | * phoneNumber: 68 | * [In] Phone number, null-terminated string. 69 | * result: 70 | * [Out] Result for dial, one value of Enum_CallState. 71 | * 72 | * Return: 73 | * RIL_AT_SUCCESS,send AT successfully. 74 | * RIL_AT_FAILED, send AT failed. 75 | * RIL_AT_TIMEOUT,send AT timeout. 76 | * RIL_AT_BUSY, sending AT. 77 | * RIL_AT_INVALID_PARAM, invalid input parameter. 78 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 79 | * and then call Ql_RIL_Initialize to initialize RIL. 80 | ******************************************************************************/ 81 | s32 RIL_Telephony_Dial(u8 type, char* phoneNumber, s32* result); 82 | 83 | /****************************************************************************** 84 | * Function: RIL_Telephony_Dial 85 | * 86 | * Description: 87 | * This function answers a coming call. 88 | * 89 | * Parameters: 90 | * result: 91 | * [Out] Delete flag , which is one value of 'Enum_SMSDeleteFlag'. 92 | * 93 | * Return: 94 | * RIL_AT_SUCCESS,send AT successfully. 95 | * RIL_AT_FAILED, send AT failed. 96 | * RIL_AT_TIMEOUT,send AT timeout. 97 | * RIL_AT_BUSY, sending AT. 98 | * RIL_AT_INVALID_PARAM, invalid input parameter. 99 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 100 | * and then call Ql_RIL_Initialize to initialize RIL. 101 | ******************************************************************************/ 102 | s32 RIL_Telephony_Answer(s32 *result); 103 | 104 | /****************************************************************************** 105 | * Function: RIL_Telephony_Dial 106 | * 107 | * Description: 108 | * This function answers a call. 109 | * 110 | * Parameters: 111 | * None 112 | * 113 | * Return: 114 | * RIL_AT_SUCCESS,send AT successfully. 115 | * RIL_AT_FAILED, send AT failed. 116 | * RIL_AT_TIMEOUT,send AT timeout. 117 | * RIL_AT_BUSY, sending AT. 118 | * RIL_AT_INVALID_PARAM, invalid input parameter. 119 | * RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY 120 | * and then call Ql_RIL_Initialize to initialize RIL. 121 | ******************************************************************************/ 122 | s32 RIL_Telephony_Hangup(void); 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /SDK/ril/inc/ril_util.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_tuil.h 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The file is for some useful definitions and APIs in common. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #ifndef __RIL_UTIL_H__ 34 | #define __RIL_UTIL_H__ 35 | #include "ql_type.h" 36 | 37 | typedef enum { 38 | CHAR_0 = '0', 39 | CHAR_9 = '9', 40 | CHAR_A = 'A', 41 | CHAR_F = 'F', 42 | END_OF_STR = '\0' 43 | }Enum_Char; 44 | #define IS_NUMBER(alpha_char) \ 45 | (((alpha_char >= CHAR_0) && (alpha_char <= CHAR_9) ) ? 1 : 0) 46 | 47 | extern s32 Ql_StrPrefixMatch(const char* str, const char *prefix); 48 | extern bool Ql_HexStrToInt(u8 *str, u32 *val); 49 | extern char* Ql_StrToUpper(char* str); 50 | /****************************************************************************** 51 | * Function: Ql_RIL_FindString 52 | * 53 | * Description: 54 | * This function is used to match string within a specified length. 55 | * This function is very much like strstr. 56 | * 57 | * Parameters: 58 | * line: 59 | * [in]The address of the string. 60 | * len: 61 | * [in]The length of the string. 62 | * str: 63 | * [in]The specified item which you want to look for in the string. 64 | * 65 | * Return: 66 | The function returns a pointer to the located string, 67 | or a null pointer if the specified string is not found. 68 | ******************************************************************************/ 69 | extern char* Ql_RIL_FindString(char *line, u32 len,char *str); 70 | 71 | /****************************************************************************** 72 | * Function: Ql_RIL_FindLine 73 | * 74 | * Description: 75 | * This function is used to find the specified character line by line. 76 | * for example,if you want to find "OK", In fact, we think that you are 77 | * looking for OK,OK or OK. 78 | * 79 | * 80 | * Parameters: 81 | * line: 82 | * [in]The address of the string. 83 | * len: 84 | * [in]The length of the string. 85 | * str: 86 | * [in]The specified item which you want to look for in the string. 87 | * 88 | * Return: 89 | The function returns a pointer to the located string, 90 | or a null pointer if the specified string is not found. 91 | ******************************************************************************/ 92 | extern char* Ql_RIL_FindLine(char *line, u32 len,char *str); 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_alarm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_alarm.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_atResponse.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_atResponse.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_ble.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_ble.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_ble_clinet.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_ble_clinet.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_bluetooth.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_bluetooth.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_custom.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_custom.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module has been designed for customer to develop new API functions over RIL. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #include "custom_feature_def.h" 34 | #include "ril.h" 35 | #include "ril_util.h" 36 | #include "ql_stdlib.h" 37 | 38 | 39 | #if defined(__OCPU_RIL_SUPPORT__) 40 | 41 | /***************************************************************** 42 | * Function: Ql_RIL_RcvDataFrmCore 43 | * 44 | * Description: 45 | * This function is used to receive data from the core 46 | * system when programing some AT commands that need to 47 | * response with much data, such as "AT+QHTTPREAD". 48 | * 49 | * This function is implemented in ril_custom.c. Developer 50 | * don't need to call this function. Under mode, this function 51 | * will be invoken when data coming automatically. 52 | * 53 | * The CB_RIL_RcvDataFrmCore is defined for ustomer to define 54 | * the callback function for each AT command. 55 | * Parameters: 56 | * [in]ptrData: 57 | * Pointer to the data to be received. 58 | * 59 | * [in]dataLen: 60 | * The length to be received. 61 | * 62 | * [in]reserved: 63 | * Not used. 64 | * 65 | * Return: 66 | * None. 67 | * 68 | *****************************************************************/ 69 | CB_RIL_RcvDataFrmCore cb_rcvCoreData = NULL; 70 | void Ql_RIL_RcvDataFrmCore(u8* ptrData, u32 dataLen, void* reserved) 71 | { 72 | if (cb_rcvCoreData != NULL) 73 | { 74 | cb_rcvCoreData(ptrData, dataLen, reserved); 75 | } 76 | } 77 | 78 | // 79 | // Customer may add new API functions definition here. 80 | // 81 | // 82 | // 83 | // 84 | // 85 | #endif 86 | 87 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_http.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2015 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_ftp.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements HTTP related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * Created by: Stanley.YONG 24Jun2015 27 | * ------- 28 | * 29 | *============================================================================ 30 | * HISTORY 31 | *---------------------------------------------------------------------------- 32 | * 33 | ****************************************************************************/ 34 | #include "custom_feature_def.h" 35 | #include "ql_type.h" 36 | #include "ql_stdlib.h" 37 | #include "ql_trace.h" 38 | #include "ql_error.h" 39 | #include "ql_common.h" 40 | #include "ql_system.h" 41 | #include "ql_memory.h" 42 | #include "ql_uart.h" 43 | #include "ril.h" 44 | #include "ril_util.h" 45 | #include "ril_network.h" 46 | #include "ril_http.h" 47 | 48 | #ifdef __OCPU_RIL_SUPPORT__ 49 | 50 | #define RIL_HTTP_DEBUG_ENABLE 0 51 | #if RIL_HTTP_DEBUG_ENABLE > 0 52 | #define RIL_HTTP_DEBUG_PORT UART_PORT2 53 | static char DBG_Buffer[100]; 54 | #define RIL_HTTP_DEBUG(BUF,...) QL_TRACE_LOG(RIL_HTTP_DEBUG_PORT,BUF,100,__VA_ARGS__) 55 | #else 56 | #define RIL_HTTP_DEBUG(BUF,...) 57 | #endif 58 | 59 | static Enum_HTTP_Ation m_httpAction = HTTP_ACTION_IDLE; 60 | static s32 ATRsp_QHTTP_Handler(char* line, u32 len, void* param); 61 | 62 | char* http_url_addr = NULL; 63 | u16 http_url_addr_len = 0; 64 | s32 RIL_HTTP_SetServerURL(char* strURL, u16 len) 65 | { 66 | s32 retRes; 67 | s32 errCode = RIL_AT_FAILED; 68 | char strAT[30]; 69 | 70 | if (!strURL) 71 | { 72 | return RIL_AT_INVALID_PARAM; 73 | } 74 | http_url_addr = strURL; 75 | http_url_addr_len = len; 76 | m_httpAction = HTTP_ACTION_SETRUL; 77 | Ql_sprintf(strAT, "AT+QHTTPURL=%d,%d\0", len, 120); 78 | retRes = Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), ATRsp_QHTTP_Handler, &errCode, 0); 79 | if (retRes != RIL_AT_SUCCESS) 80 | { 81 | if (RIL_AT_FAILED == errCode) 82 | { 83 | return retRes; 84 | } else { 85 | return errCode; 86 | } 87 | } 88 | return retRes; 89 | } 90 | 91 | s32 RIL_HTTP_RequestToGet(u32 timeout) 92 | { 93 | s32 retRes; 94 | s32 errCode = RIL_AT_FAILED; 95 | char strAT[30]; 96 | 97 | m_httpAction = HTTP_ACTION_GET_REQ; 98 | Ql_sprintf(strAT, "AT+QHTTPGET=%d\0", timeout); 99 | retRes = Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), ATRsp_QHTTP_Handler, &errCode, 0); 100 | if (retRes != RIL_AT_SUCCESS) 101 | { 102 | if (RIL_AT_FAILED == errCode) 103 | { 104 | return retRes; 105 | } else { 106 | return errCode; 107 | } 108 | } 109 | return retRes; 110 | } 111 | 112 | char* http_post_msg = NULL; 113 | u16 http_post_msg_len = 0; 114 | s32 RIL_HTTP_RequestToPost(char* strPostMsg, u16 len) 115 | { 116 | s32 retRes; 117 | s32 errCode = RIL_AT_FAILED; 118 | char strAT[30]; 119 | 120 | if (!strPostMsg) 121 | { 122 | return RIL_AT_INVALID_PARAM; 123 | } 124 | http_post_msg = strPostMsg; 125 | http_post_msg_len = len; 126 | m_httpAction = HTTP_ACTION_POST_REQ; 127 | Ql_sprintf(strAT, "AT+QHTTPPOST=%d,120,120\0", len); 128 | retRes = Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), ATRsp_QHTTP_Handler, &errCode, 0); 129 | if (retRes != RIL_AT_SUCCESS) 130 | { 131 | if (RIL_AT_FAILED == errCode) 132 | { 133 | return retRes; 134 | } else { 135 | return errCode; 136 | } 137 | } 138 | return retRes; 139 | } 140 | 141 | s32 RIL_HTTP_ReadResponse(u32 timeout, CB_RIL_RcvDataFrmCore cb_rcvData) 142 | { 143 | s32 retRes; 144 | s32 errCode = RIL_AT_FAILED; 145 | char strAT[30]; 146 | extern CB_RIL_RcvDataFrmCore cb_rcvCoreData; 147 | 148 | if (!cb_rcvData) 149 | { 150 | return RIL_AT_INVALID_PARAM; 151 | } 152 | cb_rcvCoreData = cb_rcvData; 153 | m_httpAction = HTTP_ACTION_READ_RSP; 154 | Ql_sprintf(strAT, "AT+QHTTPREAD=%d\0", timeout); 155 | retRes = Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), ATRsp_QHTTP_Handler, &errCode, 0); 156 | if (retRes != RIL_AT_SUCCESS) 157 | { 158 | if (RIL_AT_FAILED == errCode) 159 | { 160 | return retRes; 161 | } else { 162 | return errCode; 163 | } 164 | } 165 | return retRes; 166 | } 167 | 168 | CB_HTTP_DwnldFile callback_http_dwnld = NULL; 169 | s32 RIL_HTTP_DownloadFile(char* filePath, u32 size, CB_HTTP_DwnldFile cb) 170 | { 171 | s32 retRes; 172 | char* strAT = NULL; 173 | 174 | callback_http_dwnld = cb; 175 | m_httpAction = HTTP_ACTION_DOWNLOAD_FILE; 176 | strAT = (char*)Ql_MEM_Alloc(Ql_strlen(filePath) + 20); 177 | Ql_sprintf(strAT, "AT+QHTTPDL=\"%s\",%d\0", filePath, size); 178 | retRes = Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), NULL, NULL, 0); 179 | Ql_MEM_Free(strAT); 180 | return retRes; 181 | } 182 | 183 | static s32 ATRsp_QHTTP_Handler(char* line, u32 len, void* param) 184 | { 185 | char* pHead = NULL; 186 | RIL_HTTP_DEBUG(DBG_Buffer, "RCV:%s, len:%d, m_httpAction:%d\r\n", line, len, m_httpAction); 187 | pHead = Ql_RIL_FindLine(line, len, "CONNECT"); 188 | if (pHead) 189 | { 190 | if (HTTP_ACTION_SETRUL == m_httpAction) 191 | { 192 | Ql_RIL_WriteDataToCore((u8*)http_url_addr, http_url_addr_len); 193 | } 194 | else if (HTTP_ACTION_POST_REQ == m_httpAction) 195 | { 196 | RIL_HTTP_DEBUG(DBG_Buffer, "Post msg:len=%d, msg:%s\r\n", http_post_msg_len, http_post_msg); 197 | Ql_RIL_WriteDataToCore((u8*)http_post_msg, http_post_msg_len); 198 | } 199 | else if (HTTP_ACTION_READ_RSP == m_httpAction) 200 | { 201 | RIL_HTTP_DEBUG(DBG_Buffer, "\r\n"); 202 | } 203 | return RIL_ATRSP_CONTINUE; // wait for OK 204 | } 205 | pHead = Ql_RIL_FindLine(line, len, "OK"); 206 | if (pHead) 207 | { 208 | return RIL_ATRSP_SUCCESS; 209 | } 210 | pHead = Ql_RIL_FindLine(line, len, "ERROR"); 211 | if (pHead) 212 | { 213 | if (param != NULL) 214 | { 215 | *((s32*)param) = RIL_AT_FAILED; 216 | } 217 | return RIL_ATRSP_FAILED; 218 | } 219 | pHead = Ql_RIL_FindString(line, len, "+CME ERROR:"); 220 | if (pHead) 221 | { 222 | if (param != NULL) 223 | { 224 | Ql_sscanf(line, "%*[^: ]: %d[^\r\n]", (s32*)param); 225 | } 226 | return RIL_ATRSP_FAILED; 227 | } 228 | return RIL_ATRSP_CONTINUE; // Just wait for the specified results above 229 | } 230 | 231 | #endif //__OCPU_RIL_SUPPORT__ 232 | 233 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_init.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_init.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * This file is used for customer to inital RIL interface. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #include "custom_feature_def.h" 34 | #include "ril.h" 35 | #include "ql_stdlib.h" 36 | #include "ql_trace.h" 37 | #include "ql_error.h" 38 | #include "ql_system.h" 39 | 40 | #ifdef __OCPU_RIL_SUPPORT__ 41 | 42 | /*********************************************************************** 43 | * Initial commands for RIL. g_InitCmds[] will be used by Ql_RIL_Initialize function. 44 | * Now RIL is implemented based on the following AT commands. 45 | ************************************************************************/ 46 | const char* g_InitCmds[] = { 47 | //"ATE0Q0V1\r", // verbose result codes 48 | "AT+CMEE=1\r", // Extended errors. This item is necessary. 49 | "ATS0=0\r", // No auto-answer. If customer want auto answer the incoming call , must change this string as "ATS0=n\r" (n=1~255). 50 | "AT+CREG=1\r", // GSM registration events . 51 | "AT+CGREG=1\r", // GPRS registration events 52 | "AT+CLIP=1\r", // Display RING number 53 | "AT+COLP=0\r" // no connected line identification 54 | 55 | //...... More customization setting can add here 56 | }; 57 | 58 | u32 RIL_GetInitCmdCnt(void) 59 | { 60 | return NUM_ELEMS(g_InitCmds); 61 | } 62 | 63 | /*********************************************************************** 64 | * Limited commands for RIL. 65 | * Now RIL is implemented based on the opposite functions of the 66 | * following AT commands. 67 | ************************************************************************/ 68 | const char* g_LimitedCmds[] = { 69 | "AT+CMEE=0", 70 | "AT+CLIP", 71 | }; 72 | u32 RIL_GetLimitedCmdCnt(void) 73 | { 74 | return NUM_ELEMS(g_LimitedCmds); 75 | } 76 | 77 | #endif //__OCPU_RIL_SUPPORT__ 78 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_location.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_location.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_location2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_location2.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_network.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_network.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_ntp.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2014 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_ntp.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements NTP related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #include "ril_ntp.h" 34 | #include "ril.h" 35 | #include "ril_util.h" 36 | #include "ql_stdlib.h" 37 | #include "ql_error.h" 38 | #include "ql_trace.h" 39 | 40 | static CB_NTPCMD callback_NTPCMD = NULL; 41 | 42 | void OnURCHandler_NTPCMD(const char* strURC, void* reserved) 43 | { 44 | char urcHead[] = "\r\n+QNTP:\0"; 45 | 46 | if ( NULL != callback_NTPCMD ) 47 | { 48 | if( Ql_StrPrefixMatch(strURC, urcHead) ) 49 | { 50 | callback_NTPCMD(strURC); 51 | } 52 | } 53 | } 54 | 55 | s32 RIL_NTP_START(u8 *server_addr, u16 server_port, CB_NTPCMD cb_NTPCMD_hdl) 56 | { 57 | s32 ret = RIL_AT_FAILED; 58 | char strAT[200]; 59 | 60 | if (server_addr == NULL) 61 | { 62 | return RIL_AT_INVALID_PARAM; 63 | } 64 | 65 | callback_NTPCMD = cb_NTPCMD_hdl; 66 | 67 | Ql_memset( strAT, 0, sizeof(strAT) ); 68 | Ql_sprintf( strAT, "AT+QNTP=\"%s\",%d\r\n", server_addr, server_port); 69 | ret = Ql_RIL_SendATCmd( strAT, Ql_strlen(strAT), NULL, NULL, 0 ) ; 70 | 71 | return ret; 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_sim.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_sim.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_system.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/SDK/ril/src/ril_system.c -------------------------------------------------------------------------------- /SDK/ril/src/ril_telephony.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_sms.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements telephony related APIs. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #include "custom_feature_def.h" 34 | #include "ril.h" 35 | #include "ril_util.h" 36 | #include "ril_telephony.h " 37 | #include "ql_stdlib.h" 38 | 39 | #if defined(__OCPU_RIL_SUPPORT__) 40 | 41 | ST_ComingCallInfo g_comingCall; 42 | 43 | #if defined(__OCPU_RIL_CALL_SUPPORT__) 44 | static s32 Telephony_Dial_AT_handler(char* line, u32 len, void* userdata) 45 | { 46 | char *head = Ql_RIL_FindLine(line, len, "NO DIALTONE"); 47 | if(head) 48 | { 49 | (*(s32* )userdata) = CALL_STATE_NO_DIALTONE; 50 | return RIL_ATRSP_SUCCESS; 51 | } 52 | 53 | head = Ql_RIL_FindLine(line, len, "BUSY"); 54 | if(head) 55 | { 56 | (*(s32* )userdata) = CALL_STATE_BUSY; 57 | return RIL_ATRSP_SUCCESS; 58 | } 59 | 60 | head = Ql_RIL_FindLine(line, len, "NO CARRIER"); 61 | if(head) 62 | { 63 | (*(s32* )userdata) = CALL_STATE_NO_CARRIER; 64 | return RIL_ATRSP_SUCCESS; 65 | } 66 | 67 | head = Ql_RIL_FindLine(line, len, "OK"); 68 | if(head) 69 | { 70 | (*(s32* )userdata) = CALL_STATE_OK; 71 | return RIL_ATRSP_SUCCESS; 72 | } 73 | 74 | head = Ql_RIL_FindLine(line, len, "ERROR"); 75 | if(head) 76 | { 77 | (*(s32* )userdata) = CALL_STATE_ERROR; 78 | return RIL_ATRSP_FAILED; 79 | } 80 | 81 | head = Ql_RIL_FindString(line, len, "+CME ERROR:");//fail 82 | if(head) 83 | { 84 | (*(s32* )userdata) = CALL_STATE_ERROR; 85 | return RIL_ATRSP_FAILED; 86 | } 87 | 88 | return RIL_ATRSP_CONTINUE; //continue wait 89 | } 90 | 91 | s32 RIL_Telephony_Dial(u8 type, char* phoneNumber, s32 *result) 92 | { 93 | char strAT[40]; 94 | if (NULL == phoneNumber) 95 | { 96 | return -1; 97 | } 98 | Ql_memset(strAT, 0x0, sizeof(strAT)); 99 | Ql_sprintf(strAT, "ATD%s;", phoneNumber); 100 | return Ql_RIL_SendATCmd(strAT, Ql_strlen(strAT), Telephony_Dial_AT_handler, (void* )result, 0); 101 | } 102 | 103 | static s32 Telephony_Answer_AT_handler(char* line, u32 len, void* userdata) 104 | { 105 | char *head; 106 | head = Ql_RIL_FindLine(line, len, "OK"); 107 | if(head) 108 | { 109 | (*(s32* )userdata) = CALL_STATE_OK; 110 | return RIL_ATRSP_SUCCESS; 111 | } 112 | 113 | head = Ql_RIL_FindLine(line, len, "NO CARRIER"); 114 | if(head) 115 | { 116 | (*(s32* )userdata) = CALL_STATE_NO_CARRIER; 117 | return RIL_ATRSP_SUCCESS; 118 | } 119 | 120 | head = Ql_RIL_FindLine(line, len, "ERROR"); 121 | if(head) 122 | { 123 | (*(s32* )userdata) = CALL_STATE_ERROR; 124 | return RIL_ATRSP_FAILED; 125 | } 126 | 127 | head = Ql_RIL_FindString(line, len, "+CME ERROR:");//fail 128 | if(head) 129 | { 130 | (*(s32* )userdata) = CALL_STATE_ERROR; 131 | return RIL_ATRSP_FAILED; 132 | } 133 | 134 | return RIL_ATRSP_CONTINUE; //continue wait 135 | } 136 | 137 | s32 RIL_Telephony_Answer(s32 *result) 138 | { 139 | return Ql_RIL_SendATCmd("ATA", 3, Telephony_Answer_AT_handler, result, 0); 140 | } 141 | 142 | s32 RIL_Telephony_Hangup(void) 143 | { 144 | return Ql_RIL_SendATCmd("ATH", 3, NULL, NULL, 0); 145 | } 146 | #endif 147 | #endif 148 | -------------------------------------------------------------------------------- /SDK/ril/src/ril_util.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright Statement: 3 | * -------------------- 4 | * This software is protected by Copyright and the information contained 5 | * herein is confidential. The software may not be copied and the information 6 | * contained herein may not be used or disclosed except with the written 7 | * permission of Quectel Co., Ltd. 2013 8 | * 9 | *****************************************************************************/ 10 | /***************************************************************************** 11 | * 12 | * Filename: 13 | * --------- 14 | * ril_util.c 15 | * 16 | * Project: 17 | * -------- 18 | * OpenCPU 19 | * 20 | * Description: 21 | * ------------ 22 | * The module implements some common API functions. 23 | * 24 | * Author: 25 | * ------- 26 | * ------- 27 | * 28 | *============================================================================ 29 | * HISTORY 30 | *---------------------------------------------------------------------------- 31 | * 32 | ****************************************************************************/ 33 | #include "ril_util.h " 34 | #include "ql_memory.h" 35 | #include "ql_stdlib.h" 36 | 37 | s32 Ql_StrPrefixMatch(const char* str, const char *prefix) 38 | { 39 | for ( ; *str != '\0' && *prefix != '\0' ; str++, prefix++) { 40 | if (*str != *prefix) { 41 | return 0; 42 | } 43 | } 44 | return *prefix == '\0'; 45 | } 46 | 47 | char* Ql_StrToUpper(char* str) 48 | { 49 | char* pCh = str; 50 | if (!str) 51 | { 52 | return NULL; 53 | } 54 | for ( ; *pCh != '\0'; pCh++) 55 | { 56 | if (((*pCh) >= 'a') && ((*pCh) <= 'z')) 57 | { 58 | *pCh = Ql_toupper(*pCh); 59 | } 60 | } 61 | return str; 62 | } 63 | 64 | bool Ql_HexStrToInt(u8* str, u32* val) 65 | { 66 | u16 i = 0; 67 | u32 temp = 0; 68 | 69 | //ASSERT((str != NULL) && (val != NULL)); 70 | if (NULL == str || NULL == val) 71 | { 72 | return FALSE; 73 | } 74 | Ql_StrToUpper((char*)str); 75 | 76 | while (str[i] != '\0') 77 | { 78 | if (IS_NUMBER(str[i])) 79 | { 80 | temp = (temp << 4) + (str[i] - CHAR_0); 81 | } 82 | else if ((str[i] >= CHAR_A) && (str[i] <= CHAR_F)) 83 | { 84 | temp = (temp << 4) + ((str[i] - CHAR_A) + 10); 85 | }else{ 86 | return FALSE; 87 | } 88 | i++; 89 | } 90 | *val = temp; 91 | return TRUE; 92 | } 93 | 94 | /****************************************************************************** 95 | * Function: Ql_RIL_FindString 96 | * 97 | * Description: 98 | * This function is used to match string within a specified length. 99 | * This function is very much like strstr. 100 | * 101 | * Parameters: 102 | * line: 103 | * [in]The address of the string. 104 | * len: 105 | * [in]The length of the string. 106 | * str: 107 | * [in]The specified item which you want to look for in the string. 108 | * 109 | * Return: 110 | The function returns a pointer to the located string, 111 | or a null pointer if the specified string is not found. 112 | ******************************************************************************/ 113 | char* Ql_RIL_FindString(char *line, u32 len,char *str) 114 | { 115 | s32 i; 116 | s32 strlen; 117 | char *p; 118 | 119 | if ((NULL == line) || (NULL == str)) 120 | return NULL; 121 | 122 | strlen = Ql_strlen(str); 123 | if(strlen > len) 124 | { 125 | return NULL; 126 | } 127 | 128 | p = line; 129 | for (i = 0;i < len - strlen + 1; i++) 130 | { 131 | if (0 == Ql_strncmp (p, str, strlen)) 132 | { 133 | return p; 134 | }else{ 135 | p++; 136 | } 137 | } 138 | return NULL; 139 | } 140 | 141 | /****************************************************************************** 142 | * Function: Ql_RIL_FindLine 143 | * 144 | * Description: 145 | * This function is used to find the specified character line by line. 146 | * for example,if you want to find "OK", In fact, we think that you are 147 | * looking for OK,OK,OK or OK. 148 | * 149 | * 150 | * Parameters: 151 | * line: 152 | * [in]The address of the string. 153 | * len: 154 | * [in]The length of the string. 155 | * str: 156 | * [in]The specified item which you want to look for in the string. 157 | * 158 | * Return: 159 | The function returns a pointer to the located string, 160 | or a null pointer if the specified string is not found. 161 | ******************************************************************************/ 162 | char* Ql_RIL_FindLine(char *line, u32 len,char *str) 163 | { 164 | s32 i = 0; 165 | s32 strlen = 0; 166 | char *p = NULL; 167 | char *pStr = NULL; 168 | char *pStr2 = NULL; 169 | char *pStr3 = NULL; 170 | 171 | if ((NULL == line) || (NULL == str)) 172 | return NULL; 173 | 174 | strlen = Ql_strlen (str); 175 | 176 | pStr = Ql_MEM_Alloc(strlen + 4 + 1); 177 | if (NULL == pStr) 178 | return NULL; 179 | 180 | if (len >= strlen + 4)//two \r\n 181 | { 182 | p = line; 183 | Ql_memset(pStr, 0, strlen + 5); 184 | Ql_sprintf(pStr,"\r\n%s\r\n",str); 185 | for (i = 0;i < len - (strlen + 4) + 1; i++) 186 | { 187 | if (0 == Ql_strncmp(p, pStr, strlen + 4)) 188 | { 189 | Ql_MEM_Free(pStr); 190 | return p; 191 | }else{ 192 | p++; 193 | } 194 | } 195 | } 196 | 197 | if (len >= strlen + 2)//two \r or two\n 198 | { 199 | p = line; 200 | 201 | // xx 202 | Ql_memset(pStr, 0, strlen + 5); 203 | Ql_sprintf(pStr,"\r%s\r",str); 204 | 205 | // xx 206 | pStr2 = (char*)Ql_MEM_Alloc(strlen + 5); 207 | Ql_memset(pStr2, 0, strlen + 5); 208 | Ql_sprintf(pStr2,"\n%s\n",str); 209 | 210 | // xx 211 | pStr3 = (char*)Ql_MEM_Alloc(strlen + 5); 212 | Ql_memset(pStr3, 0, strlen + 5); 213 | Ql_sprintf(pStr3,"%s\r\n",str); 214 | 215 | for (i = 0;i < len - (strlen + 2) + 1; i++) 216 | { 217 | if ((0 == Ql_strncmp (p, pStr, strlen + 2)) || 218 | (0 == Ql_strncmp (p, pStr2, strlen + 2)) || 219 | (0 == Ql_strncmp (p, pStr3, strlen + 2))) 220 | { 221 | Ql_MEM_Free(pStr); 222 | Ql_MEM_Free(pStr2); 223 | Ql_MEM_Free(pStr3); 224 | pStr = NULL; 225 | pStr2 = NULL; 226 | pStr3 = NULL; 227 | return p; 228 | }else{ 229 | p++; 230 | } 231 | } 232 | Ql_MEM_Free(pStr2); 233 | Ql_MEM_Free(pStr3); 234 | pStr2 = NULL; 235 | pStr3 = NULL; 236 | } 237 | Ql_MEM_Free(pStr); 238 | pStr = NULL; 239 | 240 | return NULL; 241 | } 242 | 243 | u32 Ql_GenHash(char* strSrc, u32 len) 244 | { 245 | u32 h, v; 246 | u32 i; 247 | for (h = 0, i = 0; i < len; i++) 248 | { 249 | h = (u32)(5527 * h + 7 * strSrc[i]); 250 | v = h & 0x0000ffff; 251 | h ^= v * v; 252 | } 253 | return h; 254 | } 255 | -------------------------------------------------------------------------------- /img/introduction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/img/introduction.png -------------------------------------------------------------------------------- /img/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/img/vscode.png -------------------------------------------------------------------------------- /make.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bacnh85/Quectel_MC60_OpenCPU_VSCode_SDK/8829acbb529753b575441024e8e979dfa9d1f11b/make.exe --------------------------------------------------------------------------------