forked from xuos/xiuos
fix Calculte error
This commit is contained in:
parent
c621db2ca7
commit
8001b07341
|
@ -104,7 +104,7 @@ int PrivTaskDelay(int32_t ms)
|
||||||
#ifndef SEPARATE_COMPILE
|
#ifndef SEPARATE_COMPILE
|
||||||
uint32_t PrivGetTickTime()
|
uint32_t PrivGetTickTime()
|
||||||
{
|
{
|
||||||
return CalculteTimeMsFromTick(CurrentTicksGain());
|
return CalculateTimeMsFromTick(CurrentTicksGain());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*********************fs**************************/
|
/*********************fs**************************/
|
||||||
|
|
|
@ -86,7 +86,7 @@ static int PollWaitTimeout(struct poll_table *pt, int msec)
|
||||||
|
|
||||||
thread = pt->polling_thread;
|
thread = pt->polling_thread;
|
||||||
|
|
||||||
timeout = CalculteTickFromTimeMs(msec);
|
timeout = CalculateTickFromTimeMs(msec);
|
||||||
|
|
||||||
level = CriticalAreaLock();
|
level = CriticalAreaLock();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
x_ticks_t CurrentTicksGain(void);
|
x_ticks_t CurrentTicksGain(void);
|
||||||
void TickAndTaskTimesliceUpdate(void);
|
void TickAndTaskTimesliceUpdate(void);
|
||||||
x_ticks_t CalculteTickFromTimeMs(uint32 ms);
|
x_ticks_t CalculateTickFromTimeMs(uint32 ms);
|
||||||
uint32 CalculteTimeMsFromTick(x_ticks_t ticks);
|
uint32 CalculateTimeMsFromTick(x_ticks_t ticks);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -304,7 +304,7 @@ void *AllocBlockMemGather(GatherMemType gm_handler, int32 msec)
|
||||||
|
|
||||||
/* get descriptor of task */
|
/* get descriptor of task */
|
||||||
task = GetKTaskDescriptor();
|
task = GetKTaskDescriptor();
|
||||||
wait_time = CalculteTickFromTimeMs(msec);
|
wait_time = CalculateTickFromTimeMs(msec);
|
||||||
|
|
||||||
critical_value = CriticalAreaLock();
|
critical_value = CriticalAreaLock();
|
||||||
/* no free gatherblock*/
|
/* no free gatherblock*/
|
||||||
|
|
|
@ -153,7 +153,7 @@ static int32 _EventProcess(struct Event *event, uint32 events, uint32 options, i
|
||||||
task = GetKTaskDescriptor();
|
task = GetKTaskDescriptor();
|
||||||
task->exstatus = EOK;
|
task->exstatus = EOK;
|
||||||
|
|
||||||
timeout = CalculteTickFromTimeMs(msec);
|
timeout = CalculateTickFromTimeMs(msec);
|
||||||
|
|
||||||
lock = CriticalAreaLock();
|
lock = CriticalAreaLock();
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ x_err_t _MdelayKTask(KTaskDescriptorType task, uint32 ms)
|
||||||
return -EINVALED;
|
return -EINVALED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks = CalculteTickFromTimeMs(ms);
|
ticks = CalculateTickFromTimeMs(ms);
|
||||||
|
|
||||||
return _DelayKTask(task, ticks);
|
return _DelayKTask(task, ticks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ static x_err_t _MsgQueueSend(struct MsgQueue *mq,
|
||||||
if(WAITING_FOREVER == msec)
|
if(WAITING_FOREVER == msec)
|
||||||
timeout = WAITING_FOREVER;
|
timeout = WAITING_FOREVER;
|
||||||
else
|
else
|
||||||
timeout = CalculteTickFromTimeMs(msec);
|
timeout = CalculateTickFromTimeMs(msec);
|
||||||
|
|
||||||
lock = CriticalAreaLock();
|
lock = CriticalAreaLock();
|
||||||
if (mq->num_msgs >= mq->max_msgs && timeout == 0) {
|
if (mq->num_msgs >= mq->max_msgs && timeout == 0) {
|
||||||
|
@ -207,7 +207,7 @@ static x_err_t _MsgQueueRecv(struct MsgQueue *mq,
|
||||||
|
|
||||||
tick_delta = 0;
|
tick_delta = 0;
|
||||||
task = GetKTaskDescriptor();
|
task = GetKTaskDescriptor();
|
||||||
timeout = CalculteTickFromTimeMs(msec);
|
timeout = CalculateTickFromTimeMs(msec);
|
||||||
lock = CriticalAreaLock();
|
lock = CriticalAreaLock();
|
||||||
|
|
||||||
if (mq->index == 0 && timeout == 0) {
|
if (mq->index == 0 && timeout == 0) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ static int32 _MutexObtain(struct Mutex *mutex, int32 msec)
|
||||||
NULL_PARAM_CHECK(mutex);
|
NULL_PARAM_CHECK(mutex);
|
||||||
|
|
||||||
task = GetKTaskDescriptor();
|
task = GetKTaskDescriptor();
|
||||||
wait_time = CalculteTickFromTimeMs(msec);
|
wait_time = CalculateTickFromTimeMs(msec);
|
||||||
lock = CriticalAreaLock();
|
lock = CriticalAreaLock();
|
||||||
|
|
||||||
SYS_KDEBUG_LOG(KDBG_IPC,
|
SYS_KDEBUG_LOG(KDBG_IPC,
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int32 _SemaphoreObtain(struct Semaphore *sem, int32 msec)
|
||||||
if(WAITING_FOREVER == msec)
|
if(WAITING_FOREVER == msec)
|
||||||
wait_time = WAITING_FOREVER;
|
wait_time = WAITING_FOREVER;
|
||||||
else
|
else
|
||||||
wait_time = CalculteTickFromTimeMs(msec);
|
wait_time = CalculateTickFromTimeMs(msec);
|
||||||
lock = CriticalAreaLock();
|
lock = CriticalAreaLock();
|
||||||
|
|
||||||
SYS_KDEBUG_LOG(KDBG_IPC, ("obtain semaphore: id %d, value %d, by task %s\n",
|
SYS_KDEBUG_LOG(KDBG_IPC, ("obtain semaphore: id %d, value %d, by task %s\n",
|
||||||
|
|
|
@ -96,7 +96,7 @@ void TickAndTaskTimesliceUpdate(void)
|
||||||
*/
|
*/
|
||||||
#define MIN_TICKS 1
|
#define MIN_TICKS 1
|
||||||
|
|
||||||
x_ticks_t CalculteTickFromTimeMs(uint32 ms)
|
x_ticks_t CalculateTickFromTimeMs(uint32 ms)
|
||||||
{
|
{
|
||||||
uint32 tmp = 0;
|
uint32 tmp = 0;
|
||||||
x_ticks_t ticks = 0;
|
x_ticks_t ticks = 0;
|
||||||
|
@ -121,7 +121,7 @@ x_ticks_t CalculteTickFromTimeMs(uint32 ms)
|
||||||
* @param ticks ticks need to be converted
|
* @param ticks ticks need to be converted
|
||||||
* @return ms
|
* @return ms
|
||||||
*/
|
*/
|
||||||
uint32 CalculteTimeMsFromTick(x_ticks_t ticks)
|
uint32 CalculateTimeMsFromTick(x_ticks_t ticks)
|
||||||
{
|
{
|
||||||
uint32 ms = 0;
|
uint32 ms = 0;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* you cannot use double-clicking the tab to complete the command help,
|
* you cannot use double-clicking the tab to complete the command help,
|
||||||
* and you cannot use the shell timeout lock
|
* and you cannot use the shell timeout lock
|
||||||
*/
|
*/
|
||||||
#define SHELL_GET_TICK() CalculteTimeMsFromTick(CurrentTicksGain())
|
#define SHELL_GET_TICK() CalculateTimeMsFromTick(CurrentTicksGain())
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue