代码拉取完成,页面将自动刷新
同步操作将从 yocop/csi_pangu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
*/
/******************************************************************************
* @file lib.c
* @brief source file for the lib
* @version V1.0
* @date 02. June 2017
* @vendor csky
* @chip pangu
******************************************************************************/
#include <stdint.h>
#include <stdarg.h>
#include <stdio.h>
#include "csi_core.h"
#include "soc.h"
#include <sys_freq.h>
extern uint32_t csi_coret_get_load(void);
extern uint32_t csi_coret_get_value(void);
extern int32_t drv_get_cpu_id(void);
static void _500udelay(void)
{
uint32_t load = csi_coret_get_load();
uint32_t start = csi_coret_get_value();
uint32_t cur;
uint32_t cnt = (drv_get_cur_cpu_freq() / 1000 / 2);
while (1) {
cur = csi_coret_get_value();
if (start > cur) {
if (start - cur >= cnt) {
return;
}
} else {
if (load - cur + start > cnt) {
return;
}
}
}
}
void mdelay(uint32_t ms)
{
while (ms--) {
_500udelay();
_500udelay();
}
}
static void _10udelay(void)
{
uint32_t load = csi_coret_get_load();
uint32_t start = csi_coret_get_value();
uint32_t cnt = (drv_get_sys_freq() / 1000 / 100);
while (1) {
uint32_t cur = csi_coret_get_value();
if (start > cur) {
if (start - cur >= cnt) {
return;
}
} else {
if (load - cur + start > cnt) {
return;
}
}
}
}
void udelay(uint32_t us)
{
us = (us / 10);
if (us == 0) {
return;
}
while (us--) {
_10udelay();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。