Changeset 215


Ignore:
Timestamp:
Nov 4, 2010, 11:37:55 AM (9 years ago)
Author:
mulligan
Message:

More on implementation of interrupts. Need to add a queue for
interrupts that occur `at the same time' to be executed once interrupts
with higher priority have finished.

Location:
Deliverables/D4.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/ASMInterpret.ml

    r214 r215  
    1515            | `P3 of byte
    1616            | `SerialBuff of [ `Eight of byte | `Nine of BitVectors.bit * byte ]];;
     17
     18type interrupt =
     19  Timer0
     20| Timer1
     21| External0
     22| External1
    1723
    1824let string_of_line =
     
    122128  timer0: word;
    123129  timer1: word;
    124   timer2: word  (* can be missing *)
     130  timer2: word;  (* can be missing *)
     131
     132  esi_running: bool;
     133  t0i_running: bool;
     134  t1i_running: bool;
     135  e0i_running: bool;
     136  e1i_running: bool;
     137
     138  interrupt_queue: interrupt list;
    125139}
    126140
     
    262276  expected_out_time = `None;
    263277
    264   io = debug_continuation (* a real assert false: unprepared for i/o *)
     278  io = debug_continuation; (* a real assert false: unprepared for i/o *)
     279
     280  esi_running = false;
     281  t0i_running = false;
     282  t1i_running = false;
     283  e0i_running = false;
     284  e1i_running = false;
     285
     286  interrupt_queue = [];
    265287}
    266288
     
    14901512        (* Check priorities of interrupts *)
    14911513        (false,false,false,false) ->
     1514          (* Standard priority, so just do regular polling sequence *)
    14921515          let status = external0_interrupt status ex0 in
    14931516          let status = timer0_interrupt status et0 in
     
    14961519          let status = external_serial_interrupt status es in
    14971520            status
    1498          (* DPM: todo --- need to add flags to status to signal an interrupt
    1499                  is currently active *)
    1500       | _ -> assert false
     1521      | (true,false,false,false) ->
     1522          if status.t1i_running then
     1523            (* Timer1 interrupt is currently running, and cannot be interrupted *)
     1524            status
     1525          else
     1526            (* Standard priority, so just do regular polling sequence *)
     1527            let status = external0_interrupt status ex0 in
     1528            let status = timer0_interrupt status et0 in
     1529            let status = external1_interrupt status ex1 in
     1530            let status = timer1_interrupt status et1 in
     1531            let status = external_serial_interrupt status es in
     1532              status
     1533      | (false,true,false,false) ->
     1534          if status.e1i_running then
     1535            (* External1 interrupt is currently running, and cannot be interrupted *)
     1536            status
     1537          else
     1538            (* Standard priority, so just do regular polling sequence *)
     1539            let status = external0_interrupt status ex0 in
     1540            let status = timer0_interrupt status et0 in
     1541            let status = external1_interrupt status ex1 in
     1542            let status = timer1_interrupt status et1 in
     1543            let status = external_serial_interrupt status es in
     1544              status
     1545      | (false,false,true,false) ->
     1546          if status.t0i_running then
     1547            (* Timer0 interrupt is currently running, and cannot be interrupted *)
     1548            status
     1549          else
     1550            (* Standard priority, so just do regular polling sequence *)
     1551            let status = external0_interrupt status ex0 in
     1552            let status = timer0_interrupt status et0 in
     1553            let status = external1_interrupt status ex1 in
     1554            let status = timer1_interrupt status et1 in
     1555            let status = external_serial_interrupt status es in
     1556              status
     1557      | (false,false,false,true) ->
     1558          if status.e0i_running then
     1559            (* External0 interrupt is currently running, and cannot be interrupted *)
     1560            status
     1561          else
     1562            (* Standard priority, so just do regular polling sequence *)
     1563            let status = external0_interrupt status ex0 in
     1564            let status = timer0_interrupt status et0 in
     1565            let status = external1_interrupt status ex1 in
     1566            let status = timer1_interrupt status et1 in
     1567            let status = external_serial_interrupt status es in
     1568              status
     1569      | (true,true,false,false) ->
     1570          if status.t1i_running && status.e1i_running then
     1571            (* Cannot have two interrupts with same priority running together *)
     1572            assert false
     1573          else if status.t1i_running || status.e1i_running then
     1574            status
     1575          else
     1576            (* Standard priority, so just do regular polling sequence *)
     1577            let status = external0_interrupt status ex0 in
     1578            let status = timer0_interrupt status et0 in
     1579            let status = external1_interrupt status ex1 in
     1580            let status = timer1_interrupt status et1 in
     1581            let status = external_serial_interrupt status es in
     1582              status
    15011583    else
    15021584      status
  • Deliverables/D4.1/ASMInterpret.mli

    r213 r215  
    1111                             ]
    1212            ];;
     13
     14type interrupt =
     15  Timer0
     16| Timer1
     17| External0
     18| External1
     19;;
    1320
    1421val string_of_line: line -> string;;
     
    8895  timer0: word;
    8996  timer1: word;
    90   timer2: word  (* can be missing *)
     97  timer2: word;  (* can be missing *)
     98
     99  esi_running: bool;
     100  t0i_running: bool;
     101  t1i_running: bool;
     102  e0i_running: bool;
     103  e1i_running: bool;
     104
     105  interrupt_queue: interrupt list;
    91106}
    92107
Note: See TracChangeset for help on using the changeset viewer.