Skip to content

Commit 0acf254

Browse files
committed
To correct wrong type.
1 parent 6125e5f commit 0acf254

File tree

14 files changed

+49
-45
lines changed

14 files changed

+49
-45
lines changed

include/at_rtos.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ static inline void os_thread_idle_callback_register(const pThread_entryFunc_t lo
233233
*
234234
* @return The value of thread unique id.
235235
*/
236-
static inline os_thread_id_t os_thread_idle_id_probe(void)
236+
static inline os_thread_id_t *os_thread_idle_id_probe(void)
237237
{
238-
extern os_thread_id_t _impl_idle_thread_id_get(void);
238+
extern os_thread_id_t *_impl_idle_thread_id_get(void);
239239
return _impl_idle_thread_id_get();
240240
}
241241

@@ -909,7 +909,7 @@ typedef struct {
909909
i32p_t (*thread_user_data_set)(os_thread_id_t, void *);
910910
void *(*thread_user_data_get)(os_thread_id_t);
911911
void (*thread_idle_fn_register)(const pThread_entryFunc_t);
912-
os_thread_id_t (*thread_idle_id_probe)(void);
912+
os_thread_id_t *(*thread_idle_id_probe)(void);
913913
u32_t (*thread_stack_free_size_probe)(os_thread_id_t);
914914

915915
os_timer_id_t (*timer_init)(pTimer_callbackFunc_t, void *, const char_t *);

include/k_linker.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ _b_t list_iterator_next_condition(list_iterator_t *pIterator, list_node_t **ppOu
9292
list_node_t *list_iterator_next(list_iterator_t *pIterator);
9393
void linker_list_transaction_common(linker_t *pLinker, list_t *pToList, list_direction_t direction);
9494
void linker_list_transaction_specific(linker_t *pLinker, list_t *pToList, pLinkerSpecificConditionFunc_t pConditionFunc);
95-
void os_memcpy(void *dst, const void *src, _u32_t cnt);
96-
void os_memset(void *dst, _u8_t val, _u32_t cnt);
97-
_i32_t os_memcmp(const void *dst, const void *src, _u32_t cnt);
98-
_u32_t os_strlen(const _uchar_t *str);
95+
void k_memcpy(void *dst, const void *src, _u32_t cnt);
96+
void k_memset(void *dst, _u8_t val, _u32_t cnt);
97+
_i32_t k_memcmp(const void *dst, const void *src, _u32_t cnt);
98+
_u32_t k_strlen(const _uchar_t *str);
9999

100100
#endif /* _K_LINKER_H_ */

source/k_linker.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @param src The pointer of the source.
1414
* @param cnt The opereation specific length.
1515
*/
16-
void os_memcpy(void *dst, const void *src, _u32_t cnt)
16+
void k_memcpy(void *dst, const void *src, _u32_t cnt)
1717
{
1818
_uchar_t *d = (_uchar_t *)dst;
1919
const _uchar_t *s = (const _uchar_t *)src;
@@ -29,7 +29,7 @@ void os_memcpy(void *dst, const void *src, _u32_t cnt)
2929
* @param val The character value.
3030
* @param cnt The opereation specific length.
3131
*/
32-
void os_memset(void *dst, _u8_t val, _u32_t cnt)
32+
void k_memset(void *dst, _u8_t val, _u32_t cnt)
3333
{
3434
_uchar_t *d = (_uchar_t *)dst;
3535
while (cnt--) {
@@ -46,7 +46,7 @@ void os_memset(void *dst, _u8_t val, _u32_t cnt)
4646
*
4747
* @return The value 0 indicates the both strings are same, otherwise is different
4848
*/
49-
_i32_t os_memcmp(const void *dst, const void *src, _u32_t cnt)
49+
_i32_t k_memcmp(const void *dst, const void *src, _u32_t cnt)
5050
{
5151
const _uchar_t *d = (const _uchar_t *)dst, *s = (const _uchar_t *)src;
5252
int r = 0;
@@ -62,7 +62,7 @@ _i32_t os_memcmp(const void *dst, const void *src, _u32_t cnt)
6262
*
6363
* @return The value of the string length
6464
*/
65-
_u32_t os_strlen(const _uchar_t *str)
65+
_u32_t k_strlen(const _uchar_t *str)
6666
{
6767
_u32_t len = 0u;
6868
while (*str++ != '\0') {
@@ -354,7 +354,7 @@ _b_t list_iterator_init(list_iterator_t *pIterator, list_t *pList)
354354
return false;
355355
}
356356

357-
os_memset((_char_t *)pIterator, 0x0u, sizeof(list_iterator_t));
357+
k_memset((_char_t *)pIterator, 0x0u, sizeof(list_iterator_t));
358358
if (!pList->pHead) {
359359
return false;
360360
}

source/k_thread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void _impl_kthread_idle_user_callback_register(const pThread_entryFunc_t fn)
136136
/**
137137
* @brief Get the idle thread id.
138138
*/
139-
os_thread_id_t _impl_idle_thread_id_get(void)
139+
os_thread_id_t *_impl_idle_thread_id_get(void)
140140
{
141-
return idle_th;
141+
return &idle_th;
142142
}

source/mem_pool.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void *_mem_take(pool_context_t *pCurPool)
6262
}
6363

6464
pMemTake = (void *)((_u32_t)((i * pCurPool->elementLength) + (_u32_t)pCurPool->pMemAddress));
65-
os_memset((_char_t *)pMemTake, 0x0u, pCurPool->elementLength);
65+
k_memset((_char_t *)pMemTake, 0x0u, pCurPool->elementLength);
6666
pCurPool->elementFreeBits &= ~B(i);
6767
break;
6868

@@ -92,7 +92,7 @@ static bool _mem_release(pool_context_t *pCurPool, void *pUserMem)
9292

9393
pMemTake = (void *)((_u32_t)((i * pCurPool->elementLength) + (_u32_t)pCurPool->pMemAddress));
9494
if (pMemTake == pUserMem) {
95-
os_memset((_char_t *)pMemTake, 0x0u, pCurPool->elementLength);
95+
k_memset((_char_t *)pMemTake, 0x0u, pCurPool->elementLength);
9696
pCurPool->elementFreeBits |= B(i);
9797
break;
9898
}
@@ -148,7 +148,7 @@ static _u32_t _pool_init_privilege_routine(arguments_t *pArgs)
148148
if (_pool_context_isInit(pCurPool)) {
149149
continue;
150150
}
151-
os_memset((_char_t *)pCurPool, 0x0u, sizeof(pool_context_t));
151+
k_memset((_char_t *)pCurPool, 0x0u, sizeof(pool_context_t));
152152
pCurPool->head.cs = CS_INITED;
153153
pCurPool->head.pName = pName;
154154

source/msg_queue.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static void _message_send(queue_context_t *pCurQueue, const _u8_t *pUserBuffer,
5656
_u8_t *pInBuffer = NULL;
5757

5858
pInBuffer = (_u8_t *)((_u32_t)((pCurQueue->leftPosition * pCurQueue->elementLength) + (_u32_t)pCurQueue->pQueueBufferAddress));
59-
os_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
60-
os_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
59+
k_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
60+
k_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
6161

6262
// Calculate the next left position
6363
// Receive empty: right + 1 == left
@@ -85,8 +85,8 @@ static void _message_send_front(queue_context_t *pCurQueue, const _u8_t *pUserBu
8585
pCurQueue->cacheSize++;
8686

8787
pInBuffer = (_u8_t *)((_u32_t)((pCurQueue->rightPosition * pCurQueue->elementLength) + (_u32_t)pCurQueue->pQueueBufferAddress));
88-
os_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
89-
os_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
88+
k_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
89+
k_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
9090
}
9191

9292
/**
@@ -101,8 +101,8 @@ static void _message_receive(queue_context_t *pCurQueue, const _u8_t *pUserBuffe
101101
_u8_t *pOutBuffer = NULL;
102102

103103
pOutBuffer = (_u8_t *)((pCurQueue->rightPosition * pCurQueue->elementLength) + (_u32_t)pCurQueue->pQueueBufferAddress);
104-
os_memset((_char_t *)pUserBuffer, 0x0u, userSize);
105-
os_memcpy((_char_t *)pUserBuffer, (const _char_t *)pOutBuffer, userSize);
104+
k_memset((_char_t *)pUserBuffer, 0x0u, userSize);
105+
k_memcpy((_char_t *)pUserBuffer, (const _char_t *)pOutBuffer, userSize);
106106

107107
// Calculate the next right position
108108
// Receive empty: right + 1 == left
@@ -130,8 +130,8 @@ static void _message_receive_behind(queue_context_t *pCurQueue, const _u8_t *pUs
130130
pCurQueue->cacheSize--;
131131

132132
pInBuffer = (_u8_t *)((_u32_t)((pCurQueue->leftPosition * pCurQueue->elementLength) + (_u32_t)pCurQueue->pQueueBufferAddress));
133-
os_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
134-
os_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
133+
k_memset((_char_t *)pInBuffer, 0x0u, pCurQueue->elementLength);
134+
k_memcpy((_char_t *)pInBuffer, (const _char_t *)pUserBuffer, userSize);
135135
}
136136

137137
/**
@@ -194,7 +194,7 @@ static _u32_t _queue_init_privilege_routine(arguments_t *pArgs)
194194
continue;
195195
}
196196

197-
os_memset((_char_t *)pCurQueue, 0x0u, sizeof(queue_context_t));
197+
k_memset((_char_t *)pCurQueue, 0x0u, sizeof(queue_context_t));
198198
pCurQueue->head.cs = CS_INITED;
199199
pCurQueue->head.pName = pName;
200200

source/msg_subscribe.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static _u32_t _publish_init_privilege_routine(arguments_t *pArgs)
121121
continue;
122122
}
123123

124-
os_memset((_char_t *)pCurPublish, 0x0u, sizeof(publish_context_t));
124+
k_memset((_char_t *)pCurPublish, 0x0u, sizeof(publish_context_t));
125125
pCurPublish->head.cs = CS_INITED;
126126
pCurPublish->head.pName = pName;
127127

@@ -156,7 +156,7 @@ static _u32_t _publish_data_submit_privilege_routine(arguments_t *pArgs)
156156
list_iterator_init(&it, pList);
157157
while (list_iterator_next_condition(&it, (void *)&pNotify)) {
158158
pNotify->updated++;
159-
os_memcpy((_u8_t *)pNotify->pData, (const _u8_t *)pPublishData, MINI_AB(publishSize, pNotify->len));
159+
k_memcpy((_u8_t *)pNotify->pData, (const _u8_t *)pPublishData, MINI_AB(publishSize, pNotify->len));
160160
if ((!pNotify->muted) && (pNotify->fn)) {
161161
need = true;
162162
pNotify->fn((void *)&pNotify->linker.node);
@@ -206,7 +206,7 @@ static _u32_t _subscribe_init_privilege_routine(arguments_t *pArgs)
206206
continue;
207207
}
208208

209-
os_memset((_char_t *)pCurSubscribe, 0x0u, sizeof(subscribe_context_t));
209+
k_memset((_char_t *)pCurSubscribe, 0x0u, sizeof(subscribe_context_t));
210210
pCurSubscribe->head.cs = CS_INITED;
211211
pCurSubscribe->head.pName = pName;
212212

@@ -288,7 +288,7 @@ static _u32_t _subscribe_apply_data_privilege_routine(arguments_t *pArgs)
288288

289289
if (pCurSub->accepted < pCurSub->notify.updated) {
290290
*pDataLen = MINI_AB(*pDataLen, pCurSub->notify.len);
291-
os_memcpy(pDataBuffer, pCurSub->notify.pData, *pDataLen);
291+
k_memcpy(pDataBuffer, pCurSub->notify.pData, *pDataLen);
292292
pCurSub->accepted = pCurSub->notify.updated;
293293

294294
EXIT_CRITICAL_SECTION();

source/port/k_port_common.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
**/
7+
#include "type_def.h"
78
#include "./port/k_port.h"
89
#include "./clock/k_clock_tick.h"
910
#include "k_linker.h"
@@ -94,7 +95,7 @@ _u32_t port_stack_frame_init(void (*pEntryFn)(void *), _u32_t *pAddress, _u32_t
9495
{
9596
extern void _impl_thread_entry(void (*pEntryFn)(void *), void *pArg);
9697

97-
os_memset((_uchar_t *)pAddress, STACT_UNUSED_DATA, size);
98+
k_memset((_uchar_t *)pAddress, STACT_UNUSED_DATA, size);
9899

99100
_u32_t psp_frame = (_u32_t)pAddress + size - sizeof(stack_snapshot_t);
100101

@@ -133,9 +134,9 @@ _u32_t port_stack_frame_init(void (*pEntryFn)(void *), _u32_t *pAddress, _u32_t
133134

134135
#if (__FPU_PRESENT)
135136
#if (THREAD_PSP_WITH_PRIVILEGED)
136-
((stack_snapshot_t *)psp_frame)->CONTROL = Bs(1); /* PSP with privileged */
137+
((stack_snapshot_t *)psp_frame)->CONTROL = B(1); /* PSP with privileged */
137138
#else
138-
((stack_snapshot_t *)psp_frame)->CONTROL = Bs(1) & Bs(0); /* PSP with Unprivileged */
139+
((stack_snapshot_t *)psp_frame)->CONTROL = Bs(0, 1); /* PSP with Unprivileged */
139140
#endif
140141

141142
((stack_snapshot_t *)psp_frame)->EXC_RETURN = 0xFFFFFFFDu; /* EXC_RETURN */

source/sched_kernel.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ static void _schedule_exit(_u32_t ms)
162162
thread_context_t *pDelThread = (thread_context_t *)CONTAINEROF(pCurTask, thread_context_t, task);
163163

164164
_schedule_transfer_toNullList((linker_t *)&pCurTask->linker);
165-
os_memset((_char_t *)pDelThread->pStackAddr, STACT_UNUSED_DATA, pDelThread->stackSize);
166-
os_memset((_char_t *)pDelThread, 0x0u, sizeof(thread_context_t));
165+
k_memset((_char_t *)pDelThread->pStackAddr, STACT_UNUSED_DATA, pDelThread->stackSize);
166+
k_memset((_char_t *)pDelThread, 0x0u, sizeof(thread_context_t));
167167
}
168168

169-
os_memset(pExit, 0x0, sizeof(struct call_exit));
169+
k_memset(pExit, 0x0, sizeof(struct call_exit));
170170
pCurTask->exec.entry.result = PC_EOR;
171171
}
172172

@@ -582,7 +582,10 @@ void _impl_kernel_schedule_unlock(void)
582582
g_kernel_rsc.sch_lock_nest_cnt--;
583583
if (g_kernel_rsc.sch_lock_nest_cnt <= 0) {
584584
g_kernel_rsc.sch_lock_nest_cnt = 0;
585-
kernel_thread_schedule_request();
585+
586+
if (g_kernel_rsc.run) {
587+
kernel_thread_schedule_request();
588+
}
586589
}
587590
}
588591
}

source/sched_thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static _u32_t _thread_init_privilege_routine(arguments_t *pArgs)
7070
continue;
7171
}
7272

73-
os_memset((_char_t *)pCurThread, 0x0u, sizeof(thread_context_t));
73+
k_memset((_char_t *)pCurThread, 0x0u, sizeof(thread_context_t));
7474
pCurThread->head.cs = CS_INITED;
7575
pCurThread->head.pName = pName;
7676

0 commit comments

Comments
 (0)