Changes between Initial Version and Version 1 of Ticket #59


Ignore:
Timestamp:
Nov 16, 2010, 11:46:39 AM (14 years ago)
Author:
becoulet
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #59 – Description

    initial v1  
    66#!c
    77
    8 struct irq_source_ep_s
     8enum irq_ep_type_e
    99{
    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
    1613};
    1714
    18 struct irq_sink_ep_s
     15struct irq_ep_s
    1916{
    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;
    2419
    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;
    2629};
    2730
     
    4447   processor in hardware and we need a way to pass the value back to
    4548   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, \
    4750                                               intptr_t *id)
    4851
     
    5255   irq ack function for *icu devs* only
    5356*/
    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,      \
    5558                             intptr_t id)
    5659
     
    6164
    6265/**
    63    @return true if irq were generated by this device
     66   @return true if irq were handled
    6467 */
    65 bool_t irq_process(struct irq_source_ep_s *src, intptr_t id)
     68bool_t irq_src_process(struct irq_ep_s *src, intptr_t id)
    6669{
    67   /* FIXME may use a non-recursive implementation */
     70  assert(src->type != IRQ_EP_SINK);
    6871
    6972  /* process irq and get next sink */
    7073  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);
    7277
    7378  if (sink == NULL)
    7479    return next_id == 0;                /* not an icu device */
    7580
    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);
    8182
    8283  /* for icu devs only */
     
    8687}
    8788
     89bool_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}
    88101
    89102/********** cpu irq handling code */
    90103
    91 static irq_source_ep_s cpu_irq_sources[CPU_LINES_COUNT];
     104static irq_ep_s cpu_irq_lines[CPU_LINES_COUNT];
    92105
    93106CPU_INTERRUPT_HANDLER(irq_handler)
    94107{
    95   irq_process(cpu_irq_sources + irq, irq);
     108  irq_sink_process(cpu_irq_lines + irq, irq);
    96109  /* may check for lost irqs here */
    97110}