Changes between Initial Version and Version 1 of Ticket #59
- Timestamp:
- Nov 16, 2010, 11:46:39 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #59 – Description
initial v1 6 6 #!c 7 7 8 struct irq_source_ep_s 8 enum irq_ep_type_e 9 9 { 10 /** link to device which may generate irq */ 11 struct device_s *dev; 12 /** list of sink ep which can recieve the irq signal */ 13 ep_list_root_t links; 14 15 CLIST list_entry; 10 IRQ_EP_SOURCE, 11 IRQ_EP_SINK, 12 IRQ_EP_MIXED 16 13 }; 17 14 18 struct irq_ sink_ep_s15 struct irq_ep_s 19 16 { 20 /** link to device which can handle irq */ 21 struct device_s *dev; 22 /** list of source ep which can relay this irq */ 23 ep_list_root_t links; 17 /** endpoint type, may only be usefull for checking */ 18 enum irq_ep_type_e type; 24 19 25 CLIST list_entry; 20 /** source ep: link to device which may raise irq, 21 sink ep: link to device which can handle irq */ 22 struct device_s *dev; 23 24 /** source ep: list of sink ep which can recieve the irq signal, 25 sink ep: list of source ep which can relay this irq */ 26 ep_list_root_t links; 27 28 CLIST list_entry; 26 29 }; 27 30 … … 44 47 processor in hardware and we need a way to pass the value back to 45 48 icu handler from processor handler. */ 46 #define IRQ_EVENT(n) struct irq_ sink_ep_s (*n)(struct irq_source_ep_s *src, \49 #define IRQ_EVENT(n) struct irq_ep_s (*n)(struct irq_ep_s *src, \ 47 50 intptr_t *id) 48 51 … … 52 55 irq ack function for *icu devs* only 53 56 */ 54 #define IRQ_ACK(n) void (*n)(struct irq_ source_ep_s *src, \57 #define IRQ_ACK(n) void (*n)(struct irq_ep_s *src, \ 55 58 intptr_t id) 56 59 … … 61 64 62 65 /** 63 @return true if irq were generated by this device66 @return true if irq were handled 64 67 */ 65 bool_t irq_ process(struct irq_source_ep_s *src, intptr_t id)68 bool_t irq_src_process(struct irq_ep_s *src, intptr_t id) 66 69 { 67 /* FIXME may use a non-recursive implementation */70 assert(src->type != IRQ_EP_SINK); 68 71 69 72 /* process irq and get next sink */ 70 73 intptr_t next_id = id; 71 struct irq_sink_ep_s *sink = src->dev->irq_event(src, &next_id); 74 struct irq_ep_s *sink = src->dev->irq_event(src, &next_id); 75 76 assert(sink->type != IRQ_EP_SOURCE); 72 77 73 78 if (sink == NULL) 74 79 return next_id == 0; /* not an icu device */ 75 80 76 bool_t done = 0; 77 78 /* for all source connected to icu sink, process */ 79 FOREACH(sink->links) 80 done |= irq_process(next_src, next_id); 81 bool_t done = irq_sink_process(sink, next_id); 81 82 82 83 /* for icu devs only */ … … 86 87 } 87 88 89 bool_t irq_sink_process(struct irq_ep_s *sink, intptr_t id) 90 { 91 bool_t done = 0; 92 93 assert(sink->type != IRQ_EP_SOURCE); 94 95 /* for all source connected to icu sink, process */ 96 FOREACH(src, sink->links) 97 done |= irq_src_process(src, id); 98 99 return done; 100 } 88 101 89 102 /********** cpu irq handling code */ 90 103 91 static irq_ source_ep_s cpu_irq_sources[CPU_LINES_COUNT];104 static irq_ep_s cpu_irq_lines[CPU_LINES_COUNT]; 92 105 93 106 CPU_INTERRUPT_HANDLER(irq_handler) 94 107 { 95 irq_ process(cpu_irq_sources + irq, irq);108 irq_sink_process(cpu_irq_lines + irq, irq); 96 109 /* may check for lost irqs here */ 97 110 }