Skip to content

Commit d097905

Browse files
committed
include: Update SDK headers
Signed-off-by: Ajay Bhargav <[email protected]>
1 parent 5e0180b commit d097905

File tree

11 files changed

+524
-64
lines changed

11 files changed

+524
-64
lines changed

include/hw/spi.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ int spi_hw_transfer(int port, const unsigned char *wrbuf, unsigned char *rdbuf,
104104
*/
105105
int spi_hw_free(int port);
106106

107+
#if defined(SOC_RDA8910) || defined(_DOXYGEN_)
108+
/**
109+
* Control SPI HW CS line.
110+
*
111+
* This function can be used to control chip select line of
112+
* SPI controller (which is not mapped as GPIO) when HW SPI
113+
* is used.
114+
*
115+
* @note This function is only available on platforms with RDA8910 SoC.
116+
*
117+
* @param port [in] SPI Port Number (@ref spiport_e)
118+
* @param level [in] chip select level (0 - low, 1 - high)
119+
* @return 0 on success, negative on error
120+
*/
121+
int spi_hw_cscontrol(int port, int level);
122+
#endif
123+
107124
#ifdef __cplusplus
108125
}
109126
#endif

include/lib.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ enum loglevel_e {
3535
extern "C" {
3636
#endif
3737

38+
#ifndef _DOXYGEN_
39+
#ifndef TRUE
40+
#define TRUE 1
41+
#endif
42+
43+
#ifndef FALSE
44+
#define FALSE 0
45+
#endif
46+
47+
#ifndef NULL
48+
#define NULL ((void *)0)
49+
#endif
50+
#endif
51+
3852
/**
3953
* Unsolicited response handler callback
4054
* @param urc_code URC code

include/modem.h

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ enum mderror_e
3434
MD_ERR_NOTALLOWED = -6, /**< Operation not allowed */
3535
};
3636

37+
/**
38+
* Cell info type
39+
*/
40+
enum mdcelltype_e {
41+
MD_CELLTYPE_GSM, /**< GSM */
42+
MD_CELLTYPE_LTE, /**< LTE */
43+
};
44+
3745
/**
3846
* SMS Status
3947
*/
@@ -75,22 +83,24 @@ struct md_smsinfo_t
7583
*/
7684
struct __cellinfo_t
7785
{
78-
uint16_t mcc; /**< Mobile Country code */
79-
uint16_t mnc; /**< Mobile Network code */
80-
uint32_t lac; /**< Location Area code */
81-
uint32_t cellid; /**< Cell ID */
82-
uint16_t bcch; /**< Absolute Radio Frequency Channel Number of Broadcast Control Channel BCCH */
83-
uint16_t bsic; /**< Base station identity code */
84-
int dbm; /**< Receive signal level in dBm unit */
85-
int16_t c1; /**< C1 value */
86-
int16_t c2; /** C2 value */
86+
uint16_t mcc; /**< Mobile Country code */
87+
uint16_t mnc; /**< Mobile Network code */
88+
uint32_t lac; /**< Location Area code */
89+
uint32_t cellid; /**< Cell ID */
90+
uint16_t bcch_pcid; /**< For LTE this represents PCID (Physical Cell Identity);
91+
For GSM, Absolute Radio Frequency Channel Number of Broadcast Control Channel BCCH */
92+
uint16_t bsic; /**< For LTE this value is 0; For GSM, Base station identity code */
93+
int signal; /**< For LTE, RSRP value; For GSM, RSSI value */
94+
int16_t c1_rsrq; /**< For LTE, RSRQ Value; For GSM, C1 value */
95+
int16_t c2_srxlev; /**< For LTE, SRXLEV Value; For GSM, C2 value */
8796
};
8897

8998
/**
9099
* Serving and Neighboring cell information
91100
*/
92101
struct md_cellinfo_t
93102
{
103+
int cell_type; /**< Cell type @ref mdcelltype_e */
94104
struct __cellinfo_t cell; /**< Serving Cell information */
95105
int ncell_count; /**< Number of valid neighboring cell available in ncell */
96106
struct __cellinfo_t ncell[6]; /**< Neighboring cell information */
@@ -257,6 +267,14 @@ int md_nvm_store(int index, const void *data, int len);
257267
*/
258268
int md_nvm_read(int index, void *data, int len);
259269

270+
/**
271+
* Read network synced time provided by Network service provider
272+
*
273+
* @param datetime [out] datetime structure to be filled
274+
* @return success length of actual data is returned, error otherwise (@ref mderror_e)
275+
*/
276+
int md_get_networktime(struct tm *datetime);
277+
260278
#ifdef __cplusplus
261279
}
262280
#endif

include/net/sockets.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ int socket_request(int type);
142142
*/
143143
int socket_setopt(int id, struct sockopt_t *opts);
144144

145+
/**
146+
* Clear socket options/configuration
147+
* @note socket must be closed before clearing else -EINVAL will be returned
148+
* @param id [in] Socket ID
149+
* @return 0 on success, negative value on error
150+
*/
151+
int socket_clearopt(int id);
152+
145153
/**
146154
* Open a socket. socket options must be configured before calling this function.
147155
* This is a non blocking function, connection status will be returned via status callback
@@ -177,6 +185,7 @@ int socket_getstatus(int id);
177185

178186
/**
179187
* Set user data associated with socket
188+
* @ref sockopt_t::arg
180189
* @param id [in] Socket ID
181190
* @param arg [in] User data pointer
182191
* @return 0 on success, negative value on error
@@ -190,6 +199,38 @@ int socket_setuserdata(int id, void *arg);
190199
*/
191200
void *socket_getuserdata(int id);
192201

202+
/**
203+
* Set server IP
204+
* @param id [in] Socket ID
205+
* @param ip [in] Server IP or domain name
206+
* @return 0 on success, negative value on error
207+
*/
208+
int socket_setserverip(int id, const char *ip);
209+
210+
/**
211+
* Set server port
212+
* @param id [in] Socket ID
213+
* @param port [in] server port
214+
* @return 0 on success, negative value on error
215+
*/
216+
int socket_setserverport(int id, uint16_t port);
217+
218+
/**
219+
* Enable or disable auto connect
220+
* @param id [in] Socket ID
221+
* @param enable [in] 1 - Enable, 0 - Disable
222+
* @return 0 on success, negative value on error
223+
*/
224+
int socket_setautoconnect(int id, int enable);
225+
226+
/**
227+
* Set socket callbacks
228+
* @param id [in] Socket ID
229+
* @param cb [in] Callbacks, Can be null to disable callbacks
230+
* @return 0 on success, negative value on error
231+
*/
232+
int socket_setcallback(int id, struct socket_callback_t *cb);
233+
193234
/**
194235
* Release socket. If socket is not closed it will be closed first.
195236
* @param id [in] Socket ID
@@ -214,6 +255,14 @@ int ssl_socket_request(int ssl_version, struct ssl_certs_t *certs);
214255
*/
215256
int ssl_socket_setopt(int id, struct ssl_sockopt_t *opts);
216257

258+
/**
259+
* Clear SSL socket configuration
260+
* @note socket must be closed before calling this function
261+
* @param id [in] Socket ID
262+
* @return 0 on success, negative value on error
263+
*/
264+
int ssl_socket_clearopt(int id);
265+
217266
/**
218267
* Open SSL socket connection
219268
* @param id [in] Socket ID

include/os_api.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
#include <stdint.h>
1010

11+
#ifdef __cplusplus
12+
extern "C"
13+
{
14+
#endif
15+
1116
/**
1217
* Main Task ID
1318
*/
@@ -52,10 +57,6 @@ struct osmsg_t {
5257
int source_taskid; /**< Filled automatically by os_get_message() */
5358
};
5459

55-
#ifdef __cplusplus
56-
extern "C" {
57-
#endif
58-
5960
/**
6061
* Reset System
6162
*/
@@ -211,7 +212,7 @@ uint32_t os_get_currtaskid(void);
211212
*/
212213
int os_create_task(os_taskfn_f fn, void *arg, int suspend);
213214

214-
#if defined(PLATFORM_BC20) || defined(_DOXYGEN_)
215+
#if defined(SOC_RDA8910) || defined(PLATFORM_BC20) || defined(_DOXYGEN_)
215216
/**
216217
* Create a new OS task, with extended parameters
217218
* @note only available on NBIoT Platforms
@@ -230,6 +231,18 @@ int os_create_taskex(os_taskfn_f fn, uint32_t stack, void *arg, int suspend);
230231
* @return 0 on success, negative value on error
231232
*/
232233
int os_task_delete(int taskid);
234+
235+
/**
236+
* Get OS tick/uptime in milliseconds
237+
* @return tick counter in milliseconds
238+
*/
239+
uint64_t os_get_tickms(void);
240+
241+
/**
242+
* Get OS tick/uptime in microseconds
243+
* @return tick counter in microseonds
244+
*/
245+
uint64_t os_get_tickus(void);
233246
#endif
234247

235248
/**
@@ -240,16 +253,16 @@ int os_task_delete(int taskid);
240253
int os_start_task(int taskid);
241254

242255
/**
243-
* Disable IRQs
256+
* Enter critical section
244257
* @return IRQ flags
245258
*/
246-
unsigned int disable_irqs(void);
259+
uint32_t os_enter_critical(void);
247260

248261
/**
249-
* Enable IRQs
250-
* @param flags [in] IRQ flags from disable_irqs()
262+
* Exit critical section
263+
* @param flags [in] IRQ flags from os_enter_critical()
251264
*/
252-
void enable_irqs(unsigned int flags);
265+
void os_exit_critical(uint32_t flags);
253266

254267
#ifdef __cplusplus
255268
}

include/plat/def_adc.h

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,47 @@ enum adcch_e
2929
ADC_CH1, /**< ADC channel 1 - Pin 16 */
3030
ADC_CH2, /**< ADC channel 2 - Pin 28 */
3131
ADC_CH3, /**< ADC channel 3 - Pin 29 */
32-
#else
32+
#elif defined(PLATFORM_MC60)
3333
ADC_CH0, /**< ADC channel 0 - Pin 6 */
3434
ADC_CH1, /**< ADC channel 1 - Pin 47 */
3535
ADC_CH2, /**< ADC channel 2 - Pin 28 */
3636
ADC_CH3, /**< ADC channel 3 - Pin 29 */
37+
#else /* RDA8910 */
38+
/**
39+
* ADC Channel 0
40+
* Module | Pin
41+
* ------------
42+
* EC600 | 19
43+
* EC200 | 45
44+
* N58 | 89
45+
* N716 | 31
46+
*/
47+
ADC_CH0,
48+
/**
49+
* ADC Channel 1
50+
* Module | Pin
51+
* ------------
52+
* EC600 | 20
53+
* EC200 | 44
54+
* N58 | 88
55+
* N716 | 30
56+
*/
57+
ADC_CH1,
58+
/**
59+
* ADC Channel 2
60+
* Module | Pin
61+
* ------------
62+
* EC600 | 113
63+
* EC200 | 43
64+
*/
65+
ADC_CH2,
66+
/**
67+
* ADC Channel 3
68+
* Module | Pin
69+
* ------------
70+
* EC600 | 114
71+
*/
72+
ADC_CH3,
3773
#endif
3874
};
3975

0 commit comments

Comments
 (0)