Description: fix task and memory reference

Reviewed-by: wanghancai
This commit is contained in:
likailong 2021-01-07 16:50:47 +08:00
parent 626f7131c5
commit 9e7168d83d
5 changed files with 14 additions and 11 deletions

View File

@ -36,7 +36,7 @@ if (ohos_kernel_type == "liteos_m") {
include_dirs = [
"//base/hiviewdfx/interfaces/kits/hilog_lite",
"//kernel/liteos_m/components/cmsis",
"//kernel/liteos_m/kal/cmsis",
]
public_deps = [

View File

@ -31,7 +31,11 @@ if (ohos_kernel_type == "liteos_m") {
public_configs = [ ":samgr_adapter_public" ]
cflags = [ "-Wall" ]
include_dirs = [ "//kernel/liteos_m/kal" ]
include_dirs = [
"//kernel/liteos_m/kal/",
"//kernel/liteos_m/kal/cmsis",
"//kernel/liteos_m/kal/posix/include/malloc.h",
]
}
}

View File

@ -13,14 +13,14 @@
* limitations under the License.
*/
#include "memory_adapter.h"
#include <los_memory.h>
#include <malloc.h>
void *SAMGR_Malloc(uint32 size)
{
if (size == 0) {
return NULL;
}
return LOS_MemAlloc(m_aucSysMem0, (UINT32)size);
return malloc(size);
}
void SAMGR_Free(void *buffer)
@ -28,5 +28,5 @@ void SAMGR_Free(void *buffer)
if (buffer == NULL) {
return;
}
(void)LOS_MemFree(m_aucSysMem0, buffer);
(void)free(buffer);
}

View File

@ -14,7 +14,6 @@
*/
#include "thread_adapter.h"
#include "common.h"
#include <los_task.h>
#include <cmsis_os.h>
extern void *osThreadGetArgument(void);
@ -29,7 +28,7 @@ void MUTEX_Lock(MutexId mutex)
if (mutex == NULL) {
return;
}
osMutexAcquire(mutex, LOS_WAIT_FOREVER);
osMutexAcquire(mutex, osWaitForever);
}
void MUTEX_Unlock(MutexId mutex)
@ -42,12 +41,12 @@ void MUTEX_Unlock(MutexId mutex)
void MUTEX_GlobalLock(void)
{
LOS_TaskLock();
osKernelLock();
}
void MUTEX_GlobalUnlock(void)
{
LOS_TaskUnlock();
osKernelUnlock();
}
ThreadId THREAD_Create(Runnable run, void *argv, const ThreadAttr *attr)

View File

@ -39,7 +39,7 @@ if (ohos_kernel_type == "liteos_m") {
include_dirs = [
"//base/hiviewdfx/interfaces/kits/hilog_lite",
"//kernel/liteos_m/components/cmsis",
"//kernel/liteos_m/kal/cmsis",
]
}
}