Skip to content

Commit df8d849

Browse files
committed
Update Logicrom SDK files
Signed-off-by: Ajay Bhargav <[email protected]>
1 parent 7a6f6bb commit df8d849

23 files changed

+237
-75
lines changed

cores/logicrom/logicromsdk/include/circbuf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ int circbuf_delete(int handle);
2828
* Store one byte to circular buffer
2929
* @param handle [in] Handle to circular buffer
3030
* @param data [in] Data byte
31-
* @return 0 on succes, -1 on error
31+
* @return 0 on success, -1 on error
3232
*/
3333
int circbuf_push_byte(int handle, unsigned char data);
3434

3535
/**
36-
* Store bufferd data to circular buffer
36+
* Store buffered data to circular buffer
3737
* @param handle [in] Handle to circular buffer
3838
* @param data [in] input data buffer
3939
* @param len [in] Length of data in buffer
@@ -87,13 +87,13 @@ int circbuf_isempty(int handle);
8787

8888
/**
8989
* Get available bytes in buffer
90-
* @param handle [in] Handle to cirular buffer
90+
* @param handle [in] Handle to circular buffer
9191
* @return number of bytes available or negative value on error
9292
*/
9393
int circbuf_getcount(int handle);
9494

9595
/**
96-
* Clear and reset curcular buffer
96+
* Clear and reset circular buffer
9797
* @param handle [in] Handle to circular buffer
9898
* @return Always returns 0
9999
*/

cores/logicrom/logicromsdk/include/command.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* Maximum number of allowed arguments
12-
* including commmand
12+
* including command
1313
*/
1414
#define CMD_MAX_ARGS 16
1515

cores/logicrom/logicromsdk/include/filter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
22
* @file filter.h
3-
* @author Ajay Bhargav
43
* @brief Filter library to use with ADC
5-
*
64
*/
75

86
#ifndef INC_FILTER_H_

cores/logicrom/logicromsdk/include/gpslib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct gpsdata_t {
9494
double lng; /**< Longitude in degree */
9595
float altitude; /**< Altitude value in meters */
9696
double odom; /**< Odometer value in meteres */
97-
float hdop,pdop; /**< Hdop and Pdop values */
97+
float hdop,pdop; /**< HDOP and PDOP values */
9898
};
9999

100100
/**

cores/logicrom/logicromsdk/include/hw/bluetooth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int bt_device_init(int mode, const char *name, int use_btcli);
8484

8585
/**
8686
* Turn on/off bluetooth hardware. Bluetooth is enabled by default when device is initialized.
87-
* @param on_off [in] TRUE (1) to turn on or FLASE (0) to turn off
87+
* @param on_off [in] TRUE (1) to turn on or FALSE (0) to turn off
8888
* @return For return value see @ref bterr_e
8989
*/
9090
int bt_device_power(int on_off);

cores/logicrom/logicromsdk/include/hw/gpio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int gpio_setdir(int handle, int dir);
100100
* GPIO driver provide slow trigger option without debounce support to check and confirm
101101
* active trigger. On active trigger, callback function is called with state of gpio.
102102
* Triggers are only possible on gpio configured as inputs.
103-
* If input level changes after first transition is detected and deounce time,
103+
* If input level changes after first transition is detected and debounce time,
104104
* internal debounce timer is reset for resampling of IO state.
105105
* @param handle Handle to gpio object returned by @ref gpio_request
106106
* @param fn Callback function of type @ref gpio_callback_f

cores/logicrom/logicromsdk/include/hw/imu_sensor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @file imu_sensor.h
33
* @author Ajay Bhargav
4-
* @brief IMU Sensor fuson library
4+
* @brief IMU Sensor fusion library
55
*
66
*/
77

@@ -73,7 +73,7 @@ typedef void (*imu_eventcb_f)(int event);
7373
/**
7474
* @brief IMU configuration structure
7575
*
76-
* accleration threshold values provided are in unit of g
76+
* acceleration threshold values provided are in unit of g
7777
* e.g. a value of 0.5 is 0.5g = 9.8 x 0.5 = 4.9m/s2
7878
*
7979
* when configuration is not provided, below are the default threshold values
@@ -90,10 +90,10 @@ struct imuconf_t {
9090
float static_threshold; /**< acceleration value below which sensor is considered static */
9191
float motion_detect_threshold; /**< acceleration greater than or equal to this generates motion active event */
9292
float harsh_accel_threshold; /**< acceleration threshold for harsh acceleration */
93-
float harsh_break_threshold; /**< deacceleration threshold for harsh breaking event */
93+
float harsh_break_threshold; /**< deceleration threshold for harsh breaking event */
9494
float harsh_turn_threshold; /**< acceleration threshold while turning */
9595
float tilt_angle; /**< Tilt threshold angle in degree */
96-
float alpha_coff; /**< Alpha cofficient, currently not used */
96+
float alpha_coff; /**< Alpha coefficient, currently not used */
9797
int sample_ms; /**< Data sample rate in miliseconds. lower the better, 20ms is optimal. */
9898
};
9999

@@ -250,7 +250,7 @@ int imu_get_linearaccel(float *ax, float *ay, float *az);
250250

251251
/**
252252
* @brief Get acceleration magnitude without gravity component with direction
253-
* posivity value represents acceleration and negative value represent
253+
* positivity value represents acceleration and negative value represent
254254
* deceleration.
255255
*
256256
* @param force Value of force magnitude in unit of g

cores/logicrom/logicromsdk/include/modem.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern "C"
1515
#endif
1616

1717
/**
18-
* Maximum recvieve SMS size
18+
* Maximum receieve SMS size
1919
*/
2020
#define SMS_RECV_MAX_SZ 160
2121
#define PH_NUM_MAX_SZ 21
@@ -26,7 +26,7 @@ extern "C"
2626
enum mderror_e
2727
{
2828
MD_SUCCESS = 0, /**< success */
29-
MD_ERR_FAILED = -1, /**< faiure, unknown cause */
29+
MD_ERR_FAILED = -1, /**< failure, unknown cause */
3030
MD_ERR_TIMEOUT = -2, /**< operation timeout */
3131
MD_ERR_BUSY = -3, /**< modem busy */
3232
MD_ERR_INVALID_PARAM = -4, /**< Invalid parameter */
@@ -138,7 +138,7 @@ int md_sms_delete(int index, int mode);
138138
* Set modem CFUN state
139139
*
140140
* @param cfun [in] CFUN value to set
141-
* @param rst [in] reset after setting cfun value
141+
* @param rst [in] reset after setting CFUN value
142142
* @return 0 on success, error otherwise (@ref mderror_e)
143143
*/
144144
int md_cfun_set(int cfun, int rst);
@@ -152,7 +152,7 @@ int md_cfun_get(void);
152152
/**
153153
* Initiate a call
154154
* This is a non-blocking call, If operation is success
155-
* Call status will be retured as URC response.
155+
* Call status will be returned as URC response.
156156
*
157157
* @param phonenum [in] Number to call
158158
* @return 0 on success, error otherwise (@ref mderror_e)

cores/logicrom/logicromsdk/include/net/sockets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int socket_request(int type);
137137
/**
138138
* Set socket options
139139
* @param id [in] Socket ID
140-
* @param opts [in] socket option sturcture see @ref sockopt_t
140+
* @param opts [in] socket option structure see @ref sockopt_t
141141
* @return 0 on success, negative value on error
142142
*/
143143
int socket_setopt(int id, struct sockopt_t *opts);

cores/logicrom/logicromsdk/include/os_api.h

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ extern "C"
2222
* @name ev_flags
2323
* Event flags
2424
*/
25-
#define EVENT_OP_AND 0 /** All event flags are required */
26-
#define EVENT_OP_OR 1 /** Not all event flags are required */
25+
#define EVENT_OP_AND 0 /**< All event flags are required */
26+
#define EVENT_OP_OR 1 /**< Not all event flags are required */
2727

28-
/**
29-
* @name ev_wait
30-
*/
31-
#define EVENT_WAIT_SUSPEND 0xFFFFFFFF /** Suspend task until requested flags are set */
32-
#define EVENT_NO_WAIT 0 /** Do not wait */
28+
#define OS_WAIT_FOREVER (-1U) /**< Wait indefinitely */
3329

3430
/**
3531
* Sleep Type
@@ -54,7 +50,7 @@ struct osmsg_t {
5450
uint32_t message; /**< Message ID */
5551
uint32_t param1; /**< First parameter */
5652
uint32_t param2; /**< Second parameter */
57-
int source_taskid; /**< Filled automatically by os_get_message() */
53+
int source_taskid; /**< Filled automatically by @ref os_message_get() */
5854
};
5955

6056
/**
@@ -82,7 +78,7 @@ void sys_setsleep_timeout(uint32_t ms);
8278
/**
8379
* Enter sleep mode
8480
* @note only available on NBIoT Platforms
85-
* @param type [in] Type of sleep @a sleeptype_e
81+
* @param type [in] Type of sleep @ref sleeptype_e
8682
*/
8783
void sys_setsleep(int type);
8884
#endif
@@ -91,105 +87,111 @@ void sys_setsleep(int type);
9187
* Task sleep API
9288
* @param ms [in] time in milliseconds
9389
*/
94-
void os_sleep(unsigned int ms);
90+
void os_task_sleep(unsigned int ms);
9591

9692
/**
9793
* Get message from task external queue
9894
* @param msg [in] Pointer to OS message structure @ref osmsg_t
9995
* @return 0 on success, negative value on error
10096
*/
101-
int os_get_message(struct osmsg_t *msg);
97+
int os_message_get(struct osmsg_t *msg);
10298

10399
/**
104100
* Send message to a task external queue, Maximum number of messages are 30
105-
* OS will raise an assert if more than 30 messages are sent to task queue.
101+
* @note on GSM Platform, an assert is raised if more than 30 messages are sent to task queue.
106102
* @param dest_taskid [in] Destination task id
107103
* @param message [in] Message ID
108104
* @param param1 [in] Parameter 1
109105
* @param param2 [in] Parameter 2
110106
* @return 0 on success, negative value on error
111107
*/
112-
int os_send_message(int dest_taskid, uint32_t message, uint32_t param1, uint32_t param2);
108+
int os_message_send(int dest_taskid, uint32_t message, uint32_t param1, uint32_t param2);
113109

114110
/**
115111
* Create a mutex
116112
* Mutex created once cannot be destroyed.
117-
* @param name [in] Name for mutex (cannot be null)
118113
* @return Mutex ID
119114
*/
120-
uint32_t os_create_mutex(const char *name);
115+
uint32_t os_mutex_create(void);
121116

122117
/**
123118
* Take a mutex. If mutex is not available, Task will be suspended until mutex is available.
124-
* @param mutex [in] Mutex ID created by os_create_mutex()
119+
* @param mutex [in] Mutex ID created by @ref os_mutex_create()
120+
* @return 0 on success, negative value on error
121+
*/
122+
int os_mutex_take(uint32_t mutex);
123+
124+
/**
125+
* Try to take a mutex. This API is similar to @ref os_mutex_take() with a optional timeout
126+
* @param mutex [in] Mutex ID created by @ref os_mutex_create()
127+
* @param timeout [in] duration in ms to wait, @ref OS_WAIT_FOREVER for indefinite wait, 0 to return immediately
125128
* @return 0 on success, negative value on error
126129
*/
127-
int os_take_mutex(uint32_t mutex);
130+
int os_mutex_trytake(uint32_t mutex, uint32_t timeout);
128131

129132
/**
130133
* Release a mutex. Once a mutex is released, OS does not yield on waiting task. Task switch happens when executing task is suspended
131134
* by sleep or waiting on external queue message.
132-
* @param mutex [in] Mutex ID created by os_create_mutex()
135+
* @param mutex [in] Mutex ID created by @ref os_mutex_create()
133136
* @return 0 on success, negative value on error
134137
*/
135-
int os_give_mutex(uint32_t mutex);
138+
int os_mutex_give(uint32_t mutex);
136139

137140
/**
138141
* Create a semaphore
139-
* @param name [in] Name of semaphore (cannot be null), for debugging only.
140142
* @param val [in] Initial value of semaphore
141143
* @return Semaphore ID
142144
*/
143-
uint32_t os_create_semaphore(const char *name, int val);
145+
uint32_t os_semaphore_create(int val);
144146

145147
/**
146148
* Take a semaphore. When semaphore is not available and wait is requested, task will be suspended until semaphore is available
147-
* @param sem [in] Semaphore ID created by os_create_semaphore()
148-
* @param wait [in] TRUE if wait for semaphore to be available, FALSE to return immediately
149+
* @param sem [in] Semaphore ID created by @ref os_semaphore_create()
150+
* @param timeout [in] duration in ms to timeout, @ref OS_WAIT_FOREVER for indefinite timeout, 0 to return immediately\n
151+
* On GSM platforms, when timeout is non zero API blocks until semaphore is acquired
149152
* @return 0 on success, negative value on error
150153
*/
151-
int os_take_semaphore(uint32_t sem, int wait);
154+
int os_semaphore_take(uint32_t sem, int timeout);
152155

153156
/**
154157
* Give a semaphore.
155-
* @param sem [in] Semaphore ID created by os_create_semaphore()
158+
* @param sem [in] Semaphore ID created by @ref os_semaphore_create()
156159
* @return 0 on success, negative value on error
157160
*/
158-
int os_give_semaphore(uint32_t sem);
161+
int os_semaphore_give(uint32_t sem);
159162

160163
/**
161164
* Create event group. Event group has 32 flags represented by each bit of a 32-bit word.
162-
* @param name [in] Name of event group (cannot be null).
163165
* @return event group ID
164166
*/
165-
uint32_t os_create_eventgroup(const char *name);
167+
uint32_t os_eventgroup_create(void);
166168

167169
/**
168170
* Set event in event group
169171
* @param egid [in] Event group ID
170172
* @param event_flags [in] Event flags to set. Each bit represents an event flags
171173
* @return
172174
*/
173-
int os_eg_setevent(uint32_t egid, uint32_t event_flags);
175+
int os_eventgroup_setevent(uint32_t egid, uint32_t event_flags);
174176

175177
/**
176178
* Wait for event flag to set
177179
* @param egid [in] Event group id
178-
* @param event_flags [in] Requeted flags
180+
* @param event_flags [in] Requested flags
179181
* @return 0 on success, negative value on error
180182
*/
181-
int os_eg_waitevent(uint32_t egid, uint32_t event_flags);
183+
int os_eventgroup_waitevent(uint32_t egid, uint32_t event_flags);
182184

183185
/**
184186
* Extended function for event flag wait
185187
* @param egid [in] Event group ID
186188
* @param req_flags [in] Requested flags
187189
* @param op [in] Operation type ev_flags
188190
* @param out_flags [out] Actual event flags available
189-
* @param timeout [in] Timeout in milliseconds or one of the ev_wait flags
191+
* @param timeout [in] Timeout in milliseconds or @ref OS_WAIT_FOREVER to wait until an event is raised
190192
* @return 0 on success, negative value on error
191193
*/
192-
int os_eg_waiteventex(uint32_t egid, uint32_t req_flags, int op, uint32_t *out_flags, uint32_t timeout);
194+
int os_eventgroup_waiteventex(uint32_t egid, uint32_t req_flags, int op, uint32_t *out_flags, uint32_t timeout);
193195

194196
/**
195197
* Get available stack size of running task
@@ -201,7 +203,7 @@ uint32_t os_task_getavailstack(void);
201203
* Get task id of running task
202204
* @return Returns task id
203205
*/
204-
uint32_t os_get_currtaskid(void);
206+
uint32_t os_task_getid(void);
205207

206208
/**
207209
* Create a new OS task, Maximum 10 tasks can be created
@@ -210,7 +212,7 @@ uint32_t os_get_currtaskid(void);
210212
* @param suspend [in] TRUE will suspend the task on creation, FALSE otherwise. Suspended task can be started later by calling os_start_task()
211213
* @return On success task ID is returned, -1 on error.
212214
*/
213-
int os_create_task(os_taskfn_f fn, void *arg, int suspend);
215+
int os_task_create(os_taskfn_f fn, void *arg, int suspend);
214216

215217
#if defined(SOC_RDA8910) || defined(PLATFORM_BC20) || defined(_DOXYGEN_)
216218
/**
@@ -222,10 +224,10 @@ int os_create_task(os_taskfn_f fn, void *arg, int suspend);
222224
* @param suspend [in] TRUE will suspend the task on creation, FALSE otherwise. Suspended task can be started later by calling os_start_task()
223225
* @return On success task ID is returned, -1 on error.
224226
*/
225-
int os_create_taskex(os_taskfn_f fn, uint32_t stack, void *arg, int suspend);
227+
int os_task_create_ex(os_taskfn_f fn, uint32_t stack, void *arg, int suspend);
226228

227229
/**
228-
* Start a task created by os_create_task()/os_create_taskex()
230+
* Start a task created by @ref os_task_create() /@ref os_task_create_ex()
229231
* @note only available on NBIoT Platforms
230232
* @param taskid [in] Task ID
231233
* @return 0 on success, negative value on error
@@ -240,17 +242,17 @@ uint64_t os_get_tickms(void);
240242

241243
/**
242244
* Get OS tick/uptime in microseconds
243-
* @return tick counter in microseonds
245+
* @return tick counter in microseconds
244246
*/
245247
uint64_t os_get_tickus(void);
246248
#endif
247249

248250
/**
249-
* Start a task created by os_create_task()
251+
* Start a task created by @ref os_task_create()
250252
* @param taskid [in] Task ID
251253
* @return 0 on success, negative value on error
252254
*/
253-
int os_start_task(int taskid);
255+
int os_task_start(int taskid);
254256

255257
/**
256258
* Enter critical section
@@ -260,7 +262,7 @@ uint32_t os_enter_critical(void);
260262

261263
/**
262264
* Exit critical section
263-
* @param flags [in] IRQ flags from os_enter_critical()
265+
* @param flags [in] IRQ flags from @ref os_enter_critical()
264266
*/
265267
void os_exit_critical(uint32_t flags);
266268

0 commit comments

Comments
 (0)