mirror of
https://github.com/openharmony/drivers_liteos.git
synced 2026-07-19 18:54:12 -04:00
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
@@ -293,7 +293,7 @@ int FrameBufferFunc(void)
|
||||
|
||||
[Kernel subsystem](https://gitee.com/openharmony/docs/blob/HEAD/en/readme/kernel.md)
|
||||
|
||||
**drivers\_liteos**
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
|
||||
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/HEAD/README.md)
|
||||
|
||||
|
||||
+12
-12
@@ -48,7 +48,7 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int fb\_register\(int display, int plane\);
|
||||
|
||||
**函数功能:**加载framebuffer驱动,注册设备节点/dev/fb0;若成功则返回0, 否则返回相应的错误码。
|
||||
**函数功能:** 加载framebuffer驱动,注册设备节点/dev/fb0;若成功则返回0, 否则返回相应的错误码。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
@@ -79,7 +79,7 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int fb\_unregister\(int display\);
|
||||
|
||||
**函数功能:**卸载framebuffer驱动;若成功则返回0, 否则返回相应的错误码。
|
||||
**函数功能:** 卸载framebuffer驱动;若成功则返回0, 否则返回相应的错误码。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
@@ -105,7 +105,7 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int up\_fbinitialize\(int display\);
|
||||
|
||||
**函数功能:**初始化framebuffer驱动,这个接口需要用户通过调用fb\_register注册设备节点来实现,以提供framebuffer硬件驱动功能;若成功则返回0,否则返回相应的错误码。
|
||||
**函数功能:** 初始化framebuffer驱动,这个接口需要用户通过调用fb\_register注册设备节点来实现,以提供framebuffer硬件驱动功能;若成功则返回0,否则返回相应的错误码。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
@@ -131,7 +131,7 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
void up\_fbuninitialize\(int display\);
|
||||
|
||||
**函数功能:**卸载framebuffer硬件驱动,这个接口需要用户通过调用fb\_unregister注销设备节点来实现;无返回值。
|
||||
**函数功能:** 卸载framebuffer硬件驱动,这个接口需要用户通过调用fb\_unregister注销设备节点来实现;无返回值。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
@@ -157,7 +157,7 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
struct fb\_vtable\_s \*up\_fbgetvplane\(int display, int vplane\);
|
||||
|
||||
**函数功能:**获取framebuffer硬件驱动的句柄,这个接口需要用户实现;若成功则返回有效指针,否则返回NULL。
|
||||
**函数功能:** 获取framebuffer硬件驱动的句柄,这个接口需要用户实现;若成功则返回有效指针,否则返回NULL。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
@@ -188,9 +188,9 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int pse\_ran\_dev\_register\(void\);
|
||||
|
||||
**函数功能:**初始化软随机设备驱动,注册设备节点/dev/random;若成功则返回0, 否则返回相应的错误码。
|
||||
**函数功能:** 初始化软随机设备驱动,注册设备节点/dev/random;若成功则返回0, 否则返回相应的错误码。
|
||||
|
||||
**参数说明:**无
|
||||
**参数说明:** 无
|
||||
|
||||
|
||||
- ran\_dev\_register
|
||||
@@ -199,9 +199,9 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int ran\_dev\_register\(void\);
|
||||
|
||||
**函数功能:**初始化硬随机设备驱动,注册设备节点/dev/urandom;若成功则返回0, 否则返回相应的错误码。
|
||||
**函数功能:** 初始化硬随机设备驱动,注册设备节点/dev/urandom;若成功则返回0, 否则返回相应的错误码。
|
||||
|
||||
**参数说明:**无
|
||||
**参数说明:** 无
|
||||
|
||||
|
||||
- mem\_dev\_register
|
||||
@@ -210,9 +210,9 @@ video源码实现在third\_party/NuttX下面:video/fb.c和video/fb.h。
|
||||
|
||||
int mem\_dev\_register\(void\);
|
||||
|
||||
**函数功能:**初始化mem驱动,注册设备节点/dev/mem;若成功则返回0,否则返回相应的错误码。
|
||||
**函数功能:** 初始化mem驱动,注册设备节点/dev/mem;若成功则返回0,否则返回相应的错误码。
|
||||
|
||||
**参数说明:**无
|
||||
**参数说明:** 无
|
||||
|
||||
|
||||
### 使用说明<a name="section129654513264"></a>
|
||||
@@ -293,7 +293,7 @@ int FrameBufferFunc(void)
|
||||
|
||||
[内核子系统](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
|
||||
|
||||
**drivers\_liteos**
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/HEAD/README_zh.md)
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "los_memory.h"
|
||||
#include "los_task_pri.h"
|
||||
#include "los_process_pri.h"
|
||||
#include "los_task_pri.h"
|
||||
#include "los_mux.h"
|
||||
#include "los_mp.h"
|
||||
#include "los_typedef.h"
|
||||
@@ -285,7 +284,7 @@ static int AppendArrayItem(char **pool, int poolLen, const char *path)
|
||||
}
|
||||
|
||||
if (i == MAX_PATH_NUMBER) {
|
||||
HWLOG_ERR("Too many pathes");
|
||||
HWLOG_ERR("Too many paths");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -482,15 +481,15 @@ static int HiviewHieventWriteLogException(char *str, const int strlen)
|
||||
if (leftBufLen > EVENT_INFO_PACK_BUF_LEN) {
|
||||
tempchr = strptr[EVENT_INFO_PACK_BUF_LEN - 1];
|
||||
strptr[EVENT_INFO_PACK_BUF_LEN - 1] = '\0';
|
||||
LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 1,
|
||||
strptr, EVENT_INFO_PACK_BUF_LEN);
|
||||
(void)LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 1,
|
||||
strptr, EVENT_INFO_PACK_BUF_LEN);
|
||||
leftBufLen -= (EVENT_INFO_PACK_BUF_LEN - 1);
|
||||
strptr += (EVENT_INFO_PACK_BUF_LEN - 1);
|
||||
strptr[0] = tempchr;
|
||||
sentcnt++;
|
||||
} else {
|
||||
LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 0,
|
||||
strptr, leftBufLen);
|
||||
(void)LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 0,
|
||||
strptr, leftBufLen);
|
||||
sentcnt++;
|
||||
break;
|
||||
}
|
||||
@@ -548,6 +547,6 @@ void HiviewHieventFlush(void)
|
||||
{
|
||||
// magic number 0x7BBE69BD for notify hiview to flush hievent file
|
||||
struct HiviewHievent *hievent = HiviewHieventCreate(0x7BBE69BD);
|
||||
HiviewHieventReport(hievent);
|
||||
(void)HiviewHieventReport(hievent);
|
||||
HiviewHieventDestroy(hievent);
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ static int WaitAgentResponse(struct SmcEventData *eventData)
|
||||
int AgentProcessWork(const TcNsSmcCmd *smcCmd, unsigned int agentId)
|
||||
{
|
||||
struct SmcEventData *eventData = NULL;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (smcCmd == NULL) {
|
||||
tloge("smcCmd is null\n");
|
||||
@@ -1071,7 +1071,7 @@ static int DefTeeAgentRun(struct TeeAgentKernelOps *agentInstance)
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
/* 2. Creat thread to run agent */
|
||||
/* 2. Create thread to run agent */
|
||||
ret = sprintf_s(agentName, OS_TCB_NAME_LEN, "agent_%s", agentInstance->agentName);
|
||||
if (ret == -1) {
|
||||
goto OUT;
|
||||
|
||||
@@ -157,6 +157,7 @@ lastCmdId:%u, count:%d, agent call count:%d, timeTotal:%lld us returned, remaine
|
||||
monitor->timeTotal, g_cmdMonitorListSize);
|
||||
list_del(&monitor->list);
|
||||
free(monitor);
|
||||
monitor = NULL;
|
||||
continue;
|
||||
}
|
||||
/* not return, we need to check */
|
||||
@@ -185,7 +186,7 @@ lastCmdId:%u, agent call count:%d, timeDif:%lld ms and report\n",
|
||||
WakeupTcSiq();
|
||||
}
|
||||
} else if (timeDif > 1 * MSEC_PER_SEC) {
|
||||
tloge("[CmdMonitorTick] pid=%d, pName=%s, tid=%d,\
|
||||
tloge("[CmdMonitorTick] pid=%d, pName=%s, tid=%d, \
|
||||
lastCmdId=%u, agent call count:%d, timeDif=%lld ms\n",
|
||||
monitor->pid, monitor->pName, monitor->tid,
|
||||
monitor->lastCmdId, monitor->agentCallCount,
|
||||
@@ -215,7 +216,7 @@ static struct CmdMonitor *InitMonitorLocked(void)
|
||||
|
||||
newItem = calloc(1, sizeof(*newItem));
|
||||
if (ZERO_OR_NULL_PTR((unsigned long)(uintptr_t)newItem)) {
|
||||
tloge("[CmdMonitorTick]calloc faild\n");
|
||||
tloge("[CmdMonitorTick]calloc failed\n");
|
||||
return NULL;
|
||||
}
|
||||
newItem->sendTime = CurrentKernelTime();
|
||||
@@ -229,10 +230,12 @@ static struct CmdMonitor *InitMonitorLocked(void)
|
||||
LosProcessCB *runProcess = OS_PCB_FROM_PID(newItem->pid);
|
||||
if (strncpy_s(newItem->pName, TASK_COMM_LEN, runProcess->processName, OS_PCB_NAME_LEN) != EOK) {
|
||||
free(newItem);
|
||||
newItem = NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (strncpy_s(newItem->tName, TASK_COMM_LEN, OsCurrTaskGet()->taskName, OS_TCB_NAME_LEN) != EOK) {
|
||||
free(newItem);
|
||||
newItem = NULL;
|
||||
return NULL;
|
||||
}
|
||||
INIT_LIST_HEAD(&newItem->list);
|
||||
|
||||
@@ -526,7 +526,7 @@ static int AllocForRefMem(AllocParams *paramsIn,
|
||||
return ret;
|
||||
}
|
||||
operation->params[index].memref.buffer = 0;
|
||||
/* find kernel addr refered to user addr */
|
||||
/* find kernel addr referred to user addr */
|
||||
mutex_lock(&devFile->sharedMemLock);
|
||||
list_for_each_entry(sharedMem, &devFile->sharedMemList, head) {
|
||||
if (sharedMem->userAddr ==
|
||||
@@ -1383,7 +1383,7 @@ static void ResetSessionId(TcNsClientContext *clientContext,
|
||||
int needReset;
|
||||
|
||||
clientContext->sessionId = smcCmd->contextId;
|
||||
// if teeRet error except TEEC_PENDING,but contextId is seted,need to reset to 0.
|
||||
// if teeRet error except TEEC_PENDING, but contextId is set, need to reset to 0.
|
||||
needReset = global &&
|
||||
clientContext->cmdId == GLOBAL_CMD_ID_OPEN_SESSION &&
|
||||
teeRet != 0 && TEEC_PENDING != teeRet;
|
||||
|
||||
@@ -73,7 +73,7 @@ static void MailboxShowStatus(void)
|
||||
mutex_lock(&g_mbLock);
|
||||
for (i = 0; i < MAILBOX_PAGE_MAX; i++) {
|
||||
if (g_mZone.pages[i].count) {
|
||||
pr_info("page[%02d], order=%02d, count=%d\n", i, g_mZone.pages[i].order, g_mZone.pages[i].count);
|
||||
pr_info("page[%02d], order=%02u, count=%u\n", i, g_mZone.pages[i].order, g_mZone.pages[i].count);
|
||||
used += (1UL << (uint32_t)g_mZone.pages[i].order);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ TcNsSharedMem *TcMemAllocate(size_t len)
|
||||
|
||||
addr = LOS_VMalloc(len);
|
||||
if (addr == NULL) {
|
||||
tloge("alloc maibox failed\n");
|
||||
tloge("alloc mailbox failed\n");
|
||||
free(sharedMem);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
@@ -704,10 +704,6 @@ static uint32_t SendSmcCmd(uint32_t cmd, paddr_t cmdAddr,
|
||||
register uint32_t r1 asm("r1") = cmdAddr;
|
||||
register uint32_t r2 asm("r2") = cmdType;
|
||||
register uint32_t r3 asm("r3") = 0;
|
||||
(void)r0;
|
||||
(void)r1;
|
||||
(void)r2;
|
||||
(void)r3;
|
||||
do {
|
||||
__asm__ volatile(
|
||||
".ifnc %0, r0;.err;.endif;\n"
|
||||
@@ -742,7 +738,7 @@ int RawSmcSend(uint32_t cmd, paddr_t cmdAddr,
|
||||
|
||||
void SiqDump(paddr_t mode)
|
||||
{
|
||||
RawSmcSend(TSP_REE_SIQ, mode, 0, false);
|
||||
(void)RawSmcSend(TSP_REE_SIQ, mode, 0, false);
|
||||
DoCmdNeedArchivelog();
|
||||
}
|
||||
|
||||
@@ -952,7 +948,11 @@ static void ShadowWorkFunc(struct work_struct *work)
|
||||
*targetArg = sWork->target;
|
||||
|
||||
char shadowName[OS_TCB_NAME_LEN] = {0};
|
||||
sprintf_s(shadowName, OS_TCB_NAME_LEN, "shadow_th/%lu", g_shadowThreadId++);
|
||||
int ret = sprintf_s(shadowName, OS_TCB_NAME_LEN, "shadow_th/%lu", g_shadowThreadId++);
|
||||
if (ret < 0) {
|
||||
free(targetArg);
|
||||
return;
|
||||
}
|
||||
shadowThread = KthreadRun(ShadowThreadFn, targetArg, sizeof(uint64_t), shadowName);
|
||||
if (IS_ERR_OR_NULL(shadowThread)) {
|
||||
free(targetArg);
|
||||
@@ -1012,7 +1012,7 @@ void FiqShadowWorkFunc(uint64_t target)
|
||||
{
|
||||
SmcCmdRetT secret = { SMC_EXIT_MAX, 0, target };
|
||||
|
||||
SmpSmcSend(TSP_REQUEST, SMC_OPS_START_FIQSHD, GetCurrentPid(),
|
||||
(void)SmpSmcSend(TSP_REQUEST, SMC_OPS_START_FIQSHD, GetCurrentPid(),
|
||||
&secret, false);
|
||||
return;
|
||||
}
|
||||
@@ -1426,7 +1426,7 @@ int TcNsSmcWithNoNr(TcNsSmcCmd *cmd)
|
||||
|
||||
static void SmcWorkNoWait(uint32_t type)
|
||||
{
|
||||
RawSmcSend(TSP_REQUEST, g_cmdPhys, type, true);
|
||||
(void)RawSmcSend(TSP_REQUEST, g_cmdPhys, type, true);
|
||||
}
|
||||
|
||||
static void SmcWorkSetCmdBuffer(struct work_struct *work)
|
||||
|
||||
@@ -679,20 +679,21 @@ void DelServiceFromDev(TcNsDevFile *dev, TcNsService *service)
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < SERVICES_MAX_COUNT; i++) {
|
||||
if (dev->services[i] == service) {
|
||||
tlogd("dev->serviceRef[%u] = %u\n", i, dev->serviceRef[i]);
|
||||
if (dev->serviceRef[i] == 0) {
|
||||
tloge("Caution! No service to be deleted!\n");
|
||||
break;
|
||||
}
|
||||
dev->serviceRef[i]--;
|
||||
if (!dev->serviceRef[i]) {
|
||||
tlogd("del service %u from %u\n", i, dev->devFileId);
|
||||
dev->services[i] = NULL;
|
||||
PutServiceStruct(service);
|
||||
}
|
||||
if (dev->services[i] != service) {
|
||||
continue;
|
||||
}
|
||||
tlogd("dev->serviceRef[%u] = %u\n", i, dev->serviceRef[i]);
|
||||
if (dev->serviceRef[i] == 0) {
|
||||
tloge("Caution! No service to be deleted!\n");
|
||||
break;
|
||||
}
|
||||
dev->serviceRef[i]--;
|
||||
if (!dev->serviceRef[i]) {
|
||||
tlogd("del service %u from %u\n", i, dev->devFileId);
|
||||
dev->services[i] = NULL;
|
||||
PutServiceStruct(service);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ static TeecResult TeekCheckMemRef(TeecRegisteredmemoryReference memref,
|
||||
}
|
||||
|
||||
/*
|
||||
* This function checks a operation is valid or not.
|
||||
* This function checks an operation is valid or not.
|
||||
*/
|
||||
TeecResult TeekCheckOperation(const TeecOperation *operation)
|
||||
{
|
||||
|
||||
@@ -150,23 +150,25 @@ static DECLARE_WORK(tc_notify_work, TcNotifyFn);
|
||||
static struct workqueue_struct *g_tzSpiWq = NULL;
|
||||
#endif
|
||||
|
||||
static void WalkCallback(struct NotifyContextTimer *tcNotifyDataTimer, struct TcNsCallback *callbackFuncT)
|
||||
{
|
||||
if (tcNotifyDataTimer->property.timerClass == TIMER_RTC) {
|
||||
tlogd("start to call callback func\n");
|
||||
callbackFuncT->callbackFunc((void *)(&(tcNotifyDataTimer->property)));
|
||||
tlogd("end to call callback func\n");
|
||||
} else if (tcNotifyDataTimer->property.timerClass == TIMER_GENERIC) {
|
||||
tlogd("timer60 no callback func\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void WalkCallbackList(struct NotifyContextTimer *tcNotifyDataTimer)
|
||||
{
|
||||
struct TcNsCallback *callbackFuncT = NULL;
|
||||
|
||||
mutex_lock(&g_taCallbackFuncList.callbackListLock);
|
||||
list_for_each_entry(callbackFuncT,
|
||||
&g_taCallbackFuncList.callbackList, head) {
|
||||
if (memcmp(callbackFuncT->uuid, tcNotifyDataTimer->uuid,
|
||||
UUID_SIZE) == 0) {
|
||||
if (tcNotifyDataTimer->property.timerClass == TIMER_RTC) {
|
||||
tlogd("start to call callback func\n");
|
||||
callbackFuncT->callbackFunc(
|
||||
(void *)(&(tcNotifyDataTimer->property)));
|
||||
tlogd("end to call callback func\n");
|
||||
} else if (tcNotifyDataTimer->property.timerClass == TIMER_GENERIC) {
|
||||
tlogd("timer60 no callback func\n");
|
||||
}
|
||||
list_for_each_entry(callbackFuncT, &g_taCallbackFuncList.callbackList, head) {
|
||||
if (memcmp(callbackFuncT->uuid, tcNotifyDataTimer->uuid, UUID_SIZE) == 0) {
|
||||
WalkCallback(tcNotifyDataTimer, callbackFuncT);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&g_taCallbackFuncList.callbackListLock);
|
||||
|
||||
@@ -72,7 +72,7 @@ static int GetTeeMemInfoCmd(void)
|
||||
ret = SendDumpMem(0, mem);
|
||||
mutex_lock(&g_meminfoLock);
|
||||
sret = memcpy_s((void *)&g_teeMeminfo, sizeof(g_teeMeminfo), mem, sizeof(*mem));
|
||||
if (sret != 0) {
|
||||
if (sret != EOK) {
|
||||
tloge("sret=%d\n", sret);
|
||||
}
|
||||
mutex_unlock(&g_meminfoLock);
|
||||
@@ -224,7 +224,7 @@ static void TzHelp(const char *param)
|
||||
static ssize_t TzDbgOptWrite(struct file *filp,
|
||||
const char __user *ubuf, size_t cnt)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
char buf[128] = {0}; /* 128, size of copy from ubuf */
|
||||
char *value = NULL;
|
||||
char *p = NULL;
|
||||
uint32_t i = 0;
|
||||
|
||||
Reference in New Issue
Block a user