Changeset 669 for trunk/kernel/kern/core.c
- Timestamp:
- Nov 19, 2020, 11:44:34 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/core.c
r657 r669 26 26 #include <hal_kernel_types.h> 27 27 #include <hal_special.h> 28 #include <errno.h>29 28 #include <printk.h> 30 29 #include <thread.h> 31 30 #include <chdev.h> 31 #include <alarm.h> 32 32 #include <dev_pic.h> 33 33 #include <rpc.h> 34 34 #include <cluster.h> 35 35 #include <kmem.h> 36 #include <dqdt.h>37 36 #include <core.h> 38 37 … … 52 51 core->rand_last = hal_time_stamp() & 0xFFF; 53 52 54 // initialize scheduler53 // initialize the scheduler 55 54 sched_init( core ); 55 56 // initialise the alarms lock 57 busylock_init( &core->alarms_lock , LOCK_CORE_ALARMS ); 58 59 // initialise the alarms list 60 list_root_init( &core->alarms_root ); 56 61 } 62 63 /////////////////////////////////////// 64 void core_check_alarms( core_t * core ) 65 { 66 alarm_handler_t * handler; 67 68 // get pointer on root of alarms list 69 list_entry_t * root = &core->alarms_root; 70 71 // does nothing if list is empty 72 if( list_is_empty( root ) ) return; 73 74 // get pointer on first alarm when list non empty 75 alarm_t * alarm = LIST_FIRST( root , alarm_t , list ); 76 77 // get first alarm date 78 cycle_t alarm_date = alarm->date; 79 80 // get current date 81 cycle_t current_date = hal_get_cycles(); 82 83 if( current_date >= alarm_date ) 84 { 85 // get pointer on registered alarm handler 86 handler = (alarm_handler_t *)alarm->func_ptr; 87 88 // call alarm handler 89 handler( alarm->args_xp ); 90 } 91 } // end core_check_alarms() 57 92 58 93 ////////////////////// … … 73 108 } 74 109 75 assert( false , "core not found" ); 110 assert( __FUNCTION__, false , "core not found" ); 111 112 return 0; 76 113 } 77 114 … … 104 141 // handle scheduler 105 142 if( (ticks % CONFIG_SCHED_TICKS_PER_QUANTUM) == 0 ) sched_yield( "TICK"); 143 144 // handle alarms 145 core_check_alarms( core ); 106 146 } 107 147
Note: See TracChangeset
for help on using the changeset viewer.