About the Document
Contents
Table Index
Figure Index
1 Introduction
2 OpenCPU Platform
2.1. System Architecture
2.2. Open Resources
2.2.1. Processor
2.2.2. Memory Scheme
2.3. Interfaces
2.3.1. Serial Interfaces
2.3.2. GPIO
2.3.3. EINT
2.3.4. PWM
2.3.5. ADC
2.3.6. IIC
2.3.7. SPI
2.3.8. Power Key
2.4. Development Environment
2.4.1. SDK
2.4.2. Editor
2.4.3. Compiler & Compiling
2.4.3.1. Complier
2.4.3.2. Compiling
2.4.3.3. Compiling Output
2.4.4. Download
2.4.5. How to Program
2.4.5.1. Program Composition
2.4.5.2. Program Framework
2.4.5.3. Makefile
2.4.5.4. How to Add .c File
2.4.5.5. How to Add Directory
3 Basic Data Types
3.1. Required Header
3.2. Base Data Type
4 System Configuration
4.1. Configuration for Tasks
4.2. Configuration for GPIO
4.3. Configuration for Customizations
4.3.1. Power Key Config
4.3.2. GPIO for External Watchdog
4.3.3. Debug Port Working Mode Config
5 API Functions
5.1. System API
5.1.1. Usage
5.1.1.1. Receive Message
5.1.1.2. Send Message.
5.1.1.3. Mutex
5.1.1.4. Semaphore
5.1.1.5. Event
5.1.2. API Functions
5.1.2.1. Ql_Reset
5.1.2.2. Ql_Sleep
5.1.2.3. Ql_GetUID
5.1.2.4. Ql_GetCoreVer
5.1.2.5. Ql_GetSDKVer
5.1.2.6. Ql_GetMsSincePwrOn
5.1.2.7. Ql_OS_GetMessage
5.1.2.8. Ql_OS_SendMessage
5.1.2.9. Ql_OS_CreateMutex
5.1.2.10. Ql_OS_TakeMutex
5.1.2.11. Ql_OS_GiveMutex
5.1.2.12. Ql_OS_CreateSemaphore
5.1.2.13. Ql_OS_TakeSemaphore
5.1.2.14. Ql_OS_CreateEvent
5.1.2.15. Ql_OS_WaitEvent
5.1.2.16. Ql_OS_SetEvent
5.1.2.17. Ql_OS_GiveSemaphore
5.1.2.18. Ql_SetLastErrorCode
5.1.2.19. Ql_GetLastErrorCode
5.1.2.20. Ql_OS_GetCurrenTaskLeftStackSize
5.1.2.21. Ql_OS_GetActiveTaskId
5.1.3. Possible Error Code
5.1.4. Example
5.2. Time API
5.2.1. Usage
5.2.2. API Functions
5.2.2.1. Ql_SetLocalTime
5.2.2.2. Ql_GetLocalTime
5.2.2.3. Ql_Mktime
5.2.2.4. Ql_MKTime2CalendarTime
5.2.3. Example
5.3. Timer API
5.3.1. Usage
5.3.2. API Functions
5.3.2.1. Ql_Timer_Register
5.3.2.2. Ql_Timer_RegisterFast
5.3.2.3. Ql_Timer_Start
5.3.2.4. Ql_Timer_Stop
5.3.3. Example
5.4. Power Management API
5.4.1. Usage
5.4.1.1. Power on/off
5.4.1.2. Sleep Mode
5.4.2. API Functions
5.4.2.1. Ql_PowerDown
5.4.2.2. Ql_LockPower
5.4.2.3. Ql_PwrKey_Register
5.4.2.4. Ql_SleepEnable
5.4.2.5. Ql_SleepDisable
5.4.3. Example
5.5. Memory API
5.5.1. Usage
5.5.2. API Functions
5.5.2.1. Ql_MEM_Alloc
5.5.2.2. Ql_MEM_Free
5.5.3. Example
5.6. File System API
5.6.1. Usage
5.6.2. API Functions
5.6.2.1. Ql_FS_Open
5.6.2.2. Ql_FS_OpenRAMFile
5.6.2.3. Ql_FS_Read
5.6.2.4. Ql_FS_Write
5.6.2.5. Ql_FS_Seek
5.6.2.6. Ql_FS_GetFilePosition
5.6.2.7. Ql_FS_Truncate
5.6.2.8. Ql_FS_Flush
5.6.2.9. Ql_FS_Close
5.6.2.10. Ql_FS_GetSize
5.6.2.11. Ql_FS_Delete
5.6.2.12. Ql_FS_Check
5.6.2.13. Ql_FS_Rename
5.6.2.14. Ql_FS_CreateDir
5.6.2.15. Ql_FS_DeleteDir
5.6.2.16. Ql_FS_CheckDir
5.6.2.17. Ql_FS_FindFirst
5.6.2.18. Ql_FS_FindNext
5.6.2.19. Ql_FS_FindClose
5.6.2.20. Ql_FS_XDelete
5.6.2.21. Ql_FS_XMove
5.6.2.22. Ql_FS_ GetFreeSpace
5.6.2.23. Ql_FS_GetTotalSpace
5.6.2.24. Ql_FS_Format
5.6.3. Example
5.7. Hardware Interface API
5.7.1. UART
5.7.1.1. UART Overview
5.7.1.2. UART Usage
5.7.1.3. API Functions
5.7.1.4. Ql_UART_Register
5.7.1.5. Ql_UART_Open
5.7.1.6. Ql_UART_OpenEx
5.7.1.7. Ql_UART_Write
5.7.1.8. Ql_UART_Read
5.7.1.9. Ql_UART_SetDCBConfig
5.7.1.10. Ql_UART_GetDCBConfig
5.7.1.11. Ql_UART_ClrRxBuffer
5.7.1.12. Ql_UART_ClrTxBuffer
5.7.1.13. Ql_UART_GetPinStatus
5.7.1.14. Ql_UART_SetPinStatus
5.7.1.15. Ql_UART_SendEscap
5.7.1.16. Ql_UART_Close
5.7.1.17. Example
5.7.2. GPIO
5.7.2.1. GPIO Overview
5.7.2.2. GPIO List
5.7.2.3. GPIO Initial Configuration
5.7.2.4. GPIO Usage
5.7.2.5. API Functions
5.7.2.6. Ql_GPIO_Init
5.7.2.7. Ql_GPIO_GetLevel
5.7.2.8. Ql_GPIO_SetLevel
5.7.2.9. Ql_GPIO_GetDirection
5.7.2.10. Ql_GPIO_SetDirection
5.7.2.11. Ql_GPIO_GetPullSelection
5.7.2.12. Ql_GPIO_SetPullSelection
5.7.2.13. Ql_GPIO_Uninit
5.7.2.14. Example
5.7.3. EINT
5.7.3.1. EINT Overview
5.7.3.2. EINT Usage
5.7.3.3. API Functions
5.7.3.4. Ql_EINT_Register
5.7.3.5. Ql_EINT_RegisterFast
5.7.3.6. Ql_EINT_Init
5.7.3.7. Ql_EINT_Uninit
5.7.3.8. Ql_EINT_GetLevel
5.7.3.9. Ql_EINT_Mask
5.7.3.10. Ql_EINT_Unmask
5.7.3.11. Example
5.7.4. PWM
5.7.4.1. PWM Overview
5.7.4.2. PWM Usage
5.7.4.3. API Functions
5.7.4.4. Ql_PWM_Init
5.7.4.5. Ql_PWM_Uninit
5.7.4.6. Ql_PWM_Output
5.7.4.7. Example
5.7.5. ADC
5.7.5.1. ADC Overview
5.7.5.2. ADC Usage
5.7.5.3. API Functions
5.7.5.4. Ql_ADC_Register
5.7.5.5. Ql_ADC_Init
5.7.5.6. Ql_ADC_Sampling
5.7.5.7. Example
5.7.6. IIC
5.7.6.1. IIC Overview
5.7.6.2. IIC Usage
5.7.6.3. API Functions
5.7.6.4. Ql_IIC_Init
5.7.6.5. Ql_IIC_Config
5.7.6.6. Ql_IIC_Write
5.7.6.7. Ql_IIC_Read
5.7.6.8. Ql_IIC_WriteRead
5.7.6.9. Ql_IIC_Uninit
5.7.6.10. Example
5.7.7. SPI
5.7.7.1. SPI Overview
5.7.7.2. SPI Usage
5.7.7.3. API Functions
5.7.7.4. Ql_SPI_Init
5.7.7.5. Ql_SPI_Config
5.7.7.6. Ql_SPI_Write
5.7.7.7. Ql_SPI_Read
5.7.7.8. Ql_SPI_WriteRead
5.7.7.9. Ql_SPI_Uninit
5.7.7.10. Example
5.8. GPRS API
5.8.1. Overview
5.8.2. Usage
5.8.3. API Functions
5.8.3.1. Ql_GPRS_Register
5.8.3.2. Callback_GPRS_Actived
5.8.3.3. CallBack_GPRS_Deactived
5.8.3.4. Ql_GPRS_Config
5.8.3.5. Ql_GPRS_Activate
5.8.3.6. Ql_GPRS_ActivateEx
5.8.3.7. Ql_GPRS_Deactivate
5.8.3.8. Ql_GPRS_DeactivateEx
5.8.3.9. Ql_GPRS_GetLocalIPAddress
5.8.3.10. Ql_GPRS_GetDNSAddress
5.8.3.11. Ql_GPRS_SetDNS Address
5.9. Socket API
5.9.1. Overview
5.9.2. Usage
5.9.2.1. TCP Client Socket Usage
5.9.2.2. TCP Server Socket Usage
5.9.2.3. UDP Service Socket Usage
5.9.3. API Functions
5.9.3.1. Ql_SOC_Register
5.9.3.2. Callback_Socket_Connect
5.9.3.3. Callback_Socket_Close
5.9.3.4. Callback_Socket_Accept
5.9.3.5. Callback_Socket_Read
5.9.3.6. Callback_Socket_Write
5.9.3.7. Ql_SOC_Create
5.9.3.8. Ql_SOC_Close
5.9.3.9. Ql_SOC_Connect
5.9.3.10. Ql_SOC_ConnectEx
5.9.3.11. Ql_SOC_Send
5.9.3.12. Ql_SOC_Recv
5.9.3.13. Ql_SOC_GetAckNumber
5.9.3.14. Ql_SOC_SendTo
5.9.3.15. Ql_SOC_RecvFrom
5.9.3.16. Ql_SOC_Bind
5.9.3.17. Ql_SOC_Listen
5.9.3.18. Ql_SOC_Accept
5.9.3.19. Ql_IpHelper _GetIPByHostName
5.9.3.20. Ql_IpHelper_ConvertIpAddr
5.9.4. Possible Error Codes
5.9.5. Example
5.10. Watchdog API
5.11. FOTA API
5.11.1. Usage
5.11.2. API Functions
5.11.2.1. Ql_FOTA _Init
5.11.2.2. Ql_FOTA_WriteData
5.11.2.3. Ql_FOTA_ReadData
5.11.2.4. Ql_FOTA_Finish
5.11.2.5. Ql_FOTA_Update
5.11.3. Example
5.12. Debug API
5.12.1. Usage
5.12.2. API Functions
5.12.2.1. Ql_Debug_Trace
5.13. RIL API
5.13.1. AT API
5.13.1.1. Ql_RIL_SendATCmd
5.13.2. Telephony API
5.13.2.1. RIL_Telephony_Dial
5.13.2.2. RIL_Telephony_Answer
5.13.2.3. RIL_Telephony_Hangup
5.13.3. SMS API
5.13.3.1. RIL_SMS_ReadSMS_Text
5.13.3.2. RIL_SMS_ReadSMS_PDU
5.13.3.3. RIL_SMS_SendSMS_Text
5.13.3.4. RIL_SMS_SendSMS_PDU
5.13.3.5. RIL_SMS_DeleteSMS
5.13.4. SIM Card and Network Related API
5.13.4.1. RIL_NW_GetSIMCardState
5.13.4.2. RIL_NW_GetGSMState
5.13.4.3. RIL_NW_GetGPRSState
5.13.4.4. RIL_NW_GetSignalQuality
5.13.4.5. RIL_NW_SetGPRSContext
5.13.4.6. RIL_NW_SetAPN
5.13.5. GSM location API
5.13.5.1. RIL_GetLocation
5.13.6. Secure data API
5.13.6.1. Ql_SecureData_Store
5.13.6.2. Ql_SecureData_Read
5.13.7. System API
5.13.7.1. RIL_QuerySysInitStatus
5.13.7.2. RIL_GetPowerSupply
6 Appendix
6.1. Reference