Changeset 437 for soft/giet_vm/giet_drivers/tim_driver.h
- Timestamp:
- Nov 3, 2014, 10:53:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/tim_driver.h
r295 r437 1 /////////////////////////////////////////////////////////////////////////////////// 1 ////////////////////////////////////////////////////////////////////////////////////// 2 2 // File : tim_driver.h 3 3 // Date : 01/11/2013 … … 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 // The tim_driver.c and tim_driver.h files are part ot the GIET-VM nano-kernel. 8 // This driver supports the SoCLib vci_multi_timer component. 9 // 10 // It can exist several multi_timers in the architecture (at most one per cluster), 11 // and each one can contain several timers (called channels). 12 // 13 // There is two types of timers: 14 // - "system" timers : one per processor, used for context switch. 15 // local_id in [0, NB_PROCS_MAX-1], 16 // - "user" timers : requested by the task in the mapping_info data structure. 17 // For each user timer, the timer_id is stored in the context of the task. 18 // The global index is cluster_xy * (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id 19 // 20 // The NB_PROCS_MAX and NB_TIM_CHANNELS values must be defined in hard_config.h file. 21 // 22 // The virtual base address of the segment associated to a channel is: 23 // SEG_TIM_BASE + cluster_xy * PERI_CLUSTER_INCREMENT + TIMER_SPAN * timer_id 24 // 25 // The SEG_TIM_BASE and PERI_CLUSTER_INCREMENT must be defined in hard_config.h. 26 ///////////////////////////////////////////////////////////////////////////////////// 7 27 8 28 #ifndef _GIET_TIM_DRIVER_H_ … … 10 30 11 31 /////////////////////////////////////////////////////////////////////////////////// 12 // TIMER (vci_multi_timer)registers offsets32 // registers offsets 13 33 /////////////////////////////////////////////////////////////////////////////////// 14 34 … … 24 44 25 45 /////////////////////////////////////////////////////////////////////////////////// 26 // Timer access functions and global variables46 // access functions 27 47 /////////////////////////////////////////////////////////////////////////////////// 28 48 29 extern void _timer_start( unsigned int cluster_xy, 30 unsigned int local_id, 31 unsigned int period ); 49 /////////////////////////////////////////////////////////////////////////////////// 50 // This function activates a timer in the vci_timer external peripheral. 51 // - channel : Timer channel global index 52 // - period : interrupt period (cycles) 53 /////////////////////////////////////////////////////////////////////////////////// 54 extern int _timer_start( unsigned int channel, 55 unsigned int period ); 32 56 33 extern void _timer_stop( unsigned int cluster_xy, 34 unsigned int local_id ); 57 /////////////////////////////////////////////////////////////////////////////////// 58 // This function desactivates a timer in the vci_timer external component. 59 /////////////////////////////////////////////////////////////////////////////////// 60 extern int _timer_stop( unsigned int channel ); 35 61 36 extern void _timer_reset_irq( unsigned int cluster_xy, 37 unsigned int local_id ); 62 /////////////////////////////////////////////////////////////////////////////////// 63 // This function resets the timer counter. To do so, it read the period, 64 // and re-write it in the timer register, what causes the count to restart. 65 /////////////////////////////////////////////////////////////////////////////////// 66 extern int _timer_reset_cpt( unsigned int channel ); 38 67 39 extern void _timer_reset_cpt( unsigned int cluster_xy, 40 unsigned int local_id); 41 68 /////////////////////////////////////////////////////////////////////////////////// 69 // This Interrupt Service Routine handles the IRQs generated by the "user" timers. 70 // It can be a HWI or a PTI. 71 // The channel argument is the user timer global index. 72 // The ISR acknowledges the IRQ, registers the event in the proper entry 73 // of the _user_timer_event[] array, and a log message is displayed on TTY0. 74 /////////////////////////////////////////////////////////////////////////////////// 42 75 extern void _timer_isr( unsigned int irq_type, 43 76 unsigned int irq_id, 44 77 unsigned int channel ); 45 78 46 ///////////////////////////////////////////////////////////////////////////////////47 79 48 80 #endif
Note: See TracChangeset
for help on using the changeset viewer.