mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-17 09:38:55 +00:00
v1.0.3
This commit is contained in:
@@ -69,6 +69,8 @@ static const short __spm[13] =
|
||||
ALIGN(4) static const char *days = "Sun Mon Tue Wed Thu Fri Sat ";
|
||||
ALIGN(4) static const char *months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
|
||||
|
||||
extern uint64_t aic_get_time_us(void);
|
||||
|
||||
static int __isleap(int year)
|
||||
{
|
||||
/* every fourth year is a leap year except for century years that are
|
||||
@@ -618,8 +620,15 @@ RTM_EXPORT(clock_getres);
|
||||
int clock_gettime(clockid_t clockid, struct timespec *tp)
|
||||
{
|
||||
#ifndef RT_USING_RTC
|
||||
RTC_LOG_WARNING
|
||||
return -1;
|
||||
uint64_t us = 0;
|
||||
rt_base_t level;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
us = aic_get_time_us();
|
||||
tp->tv_sec = us / (1000*1000);
|
||||
tp->tv_nsec = (us % (1000*1000))*1000;
|
||||
rt_hw_interrupt_enable(level);
|
||||
return 0;
|
||||
#else
|
||||
int ret = 0;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt
|
||||
if (phdr[index].p_vaddr > vend_addr + 16)
|
||||
{
|
||||
/* There should not be too much padding in the object files. */
|
||||
LOG_W("warning: too much padding before segment %d", index);
|
||||
LOG_D("warning: too much padding before segment %d", index);
|
||||
}
|
||||
|
||||
vend_addr = phdr[index].p_vaddr + phdr[index].p_memsz;
|
||||
@@ -94,6 +94,7 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt
|
||||
module->nref = 0;
|
||||
|
||||
/* allocate module space */
|
||||
module_size = ALIGN_UP(module_size, CACHE_LINE_SIZE);
|
||||
module->mem_space = rt_malloc_align(module_size, CACHE_LINE_SIZE);
|
||||
if (module->mem_space == RT_NULL)
|
||||
{
|
||||
@@ -311,6 +312,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
|
||||
module->vstart_addr = 0;
|
||||
|
||||
/* allocate module space */
|
||||
module_size = ALIGN_UP(module_size, CACHE_LINE_SIZE);
|
||||
module->mem_space = rt_malloc_align(module_size, CACHE_LINE_SIZE);
|
||||
if (module->mem_space == RT_NULL)
|
||||
{
|
||||
|
||||
@@ -146,6 +146,7 @@ static void _dlmodule_thread_entry(void* parameter)
|
||||
{
|
||||
int argc = 0;
|
||||
char *argv[RT_MODULE_ARG_MAX];
|
||||
int ret = 0;
|
||||
|
||||
struct rt_dlmodule *module = (struct rt_dlmodule*)parameter;
|
||||
|
||||
@@ -168,10 +169,11 @@ static void _dlmodule_thread_entry(void* parameter)
|
||||
module->cmd_line);
|
||||
|
||||
if (module->entry_addr)
|
||||
module->entry_addr(argc, argv);
|
||||
ret = module->entry_addr(argc, argv);
|
||||
|
||||
__exit:
|
||||
_dlmodule_exit();
|
||||
if (ret != RT_DLMODULE_DEAMON)
|
||||
_dlmodule_exit();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -505,6 +507,8 @@ struct rt_dlmodule* dlmodule_load(const char* filename)
|
||||
/* increase module reference count */
|
||||
module->nref ++;
|
||||
|
||||
LOG_I("Module: load %s to 0x%lx succeed.", filename, module->mem_space);
|
||||
|
||||
/* deal with cache */
|
||||
#ifdef RT_USING_CACHE
|
||||
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, module->mem_space, module->mem_size);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#define RT_DLMODULE_STAT_CLOSING 0x02
|
||||
#define RT_DLMODULE_STAT_CLOSED 0x03
|
||||
|
||||
#define RT_DLMODULE_DEAMON 0xDEA305
|
||||
|
||||
struct rt_dlmodule;
|
||||
typedef void* rt_addr_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user