更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
smp.h 文件参考

浏览源代码.

结构体

struct  SmpOps
 

类型定义

typedef VOID(* ArchCpuStartFunc) (VOID *arg)
 

函数

VOID HalArchCpuOn (UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg)
 

类型定义说明

◆ ArchCpuStartFunc

typedef VOID(* ArchCpuStartFunc) (VOID *arg)

在文件 smp.h47 行定义.

函数说明

◆ HalArchCpuOn()

VOID HalArchCpuOn ( UINT32  cpuNum,
ArchCpuStartFunc  func,
struct SmpOps ops,
VOID *  arg 
)

在文件 smp.c53 行定义.

54{
55 struct OsCpuInit *cpuInit = &g_cpuInit[cpuNum - 1];
56 UINTPTR startEntry = (UINTPTR)&reset_vector - KERNEL_VMM_BASE + SYS_MEM_BASE;
57 INT32 ret;
58
59 cpuInit->cpuStart = func;
60 cpuInit->arg = arg;
61 cpuInit->initFlag = 0;
62
63 DCacheFlushRange((UINTPTR)cpuInit, (UINTPTR)cpuInit + sizeof(struct OsCpuInit));
64
65 LOS_ASSERT(ops != NULL);
66
67
68 ret = ops->SmpCpuOn(cpuNum, startEntry);
69 if (ret < 0) {
70 PRINT_ERR("cpu start failed, cpu num: %u, ret: %d\n", cpuNum, ret);
71 return;
72 }
73
74 while (!LOS_AtomicRead(&cpuInit->initFlag)) {
75 WFE;
76 }
77}
STATIC INLINE INT32 LOS_AtomicRead(const Atomic *v)
Atomic read. | 读取32bit原子数据
Definition: los_atomic.h:123
VOID DCacheFlushRange(UINT32 start, UINT32 end)
Definition: los_hw.c:170
signed int INT32
Definition: los_typedef.h:60
unsigned long UINTPTR
Definition: los_typedef.h:68
VOID reset_vector(VOID)
STATIC struct OsCpuInit g_cpuInit[CORE_NUM - 1]
Definition: smp.c:51
Definition: smp.c:45
Atomic initFlag
Definition: smp.c:48
VOID * arg
Definition: smp.c:47
ArchCpuStartFunc cpuStart
Definition: smp.c:46
INT32(* SmpCpuOn)(UINT32 cpuNum, UINTPTR startEntry)
Definition: smp.h:44
函数调用图:
这是这个函数的调用关系图: