Changeset 101 for trunk/kernel/kern/core.c
- Timestamp:
- Jun 29, 2017, 4:44:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/core.c
r68 r101 57 57 core->thread_idle = NULL; 58 58 core->fpu_owner = NULL; 59 core->rand_last = hal_ time_stamp() & 0xFFF;59 core->rand_last = hal_get_cycles() & 0xFFF; 60 60 61 61 sched_init( core ); … … 66 66 { 67 67 uint32_t value = ((core->rand_last * CONFIG_RDNG_PARAM_A) + 68 CONFIG_RDNG_PARAM_C) ^ (hal_ time_stamp() & 0xFFF);68 CONFIG_RDNG_PARAM_C) ^ (hal_get_cycles() & 0xFFF); 69 69 core->rand_last = value; 70 70 return value; 71 }72 73 ////////////////////////////////////////////////74 inline uint64_t core_get_cycles( core_t * core )75 {76 uint32_t elapsed;77 uint64_t cycles;78 uint32_t time_stamp = core->time_stamp;79 uint32_t time_now = hal_time_stamp();80 81 // compute number of elapsed cycles, taking into account 32 bits register wrap82 if(time_now < time_stamp) elapsed = (0xFFFFFFFF - time_stamp) + time_now;83 else elapsed = (time_now - time_stamp);84 85 cycles = core->cycles + elapsed;86 87 // update core time88 core->time_stamp = time_now;89 core->cycles = cycles;90 hal_wbflush();91 92 return cycles;93 71 } 94 72 … … 98 76 uint32_t * tm_us ) 99 77 { 100 // uint64_t cycles = core_get_cycles( core);78 uint64_t cycles = hal_get_cycles(); 101 79 102 // TODO ces deux ligne ne compilent pas : "undefined referenc to __udivdi3" 103 104 // *tm_ms = (cycles / CONFIG_CYCLES_PER_MS); 105 // *tm_us = (cycles % CONFIG_CYCLES_PER_MS) / (CONFIG_CYCLES_PER_MS / 1000000); 106 107 printk("\n[PANIC] in %s : not implemented yet\n", __FUNCTION__ ); 80 *tm_s = (cycles / CONFIG_CYCLES_PER_MS); 81 *tm_us = (cycles % CONFIG_CYCLES_PER_MS) / (CONFIG_CYCLES_PER_MS / 1000000); 108 82 } 109 83 … … 115 89 uint64_t cycles = core->cycles; 116 90 uint32_t time_stamp = core->time_stamp; 117 uint32_t time_now = hal_ time_stamp();91 uint32_t time_now = hal_get_cycles(); 118 92 119 93 // compute number of elapsed cycles taking into account 32 bits register wrap
Note: See TracChangeset
for help on using the changeset viewer.