1 //
2 // Copyright (c) 2010-2018 Antmicro
3 //
4 // This file is licensed under the MIT License.
5 // Full license text is available in 'licenses/MIT.txt'.
6 //
7 using System;
8 
9 namespace Antmicro.Renode.Peripherals.Wireless.CC2538
10 {
11     internal enum InterruptRegister
12     {
13         IrqFlag0,
14         IrqFlag1
15     }
16 
17     // It turned out that irq registers are placed in memory in different ordering than mask registers
18     internal static class InterruptRegisterHelper
19     {
GetValueRegister(int index)20         public static InterruptRegister GetValueRegister(int index)
21         {
22             switch(index)
23             {
24             case 0:
25                 return InterruptRegister.IrqFlag1;
26             case 1:
27                 return InterruptRegister.IrqFlag0;
28             default:
29                 throw new ArgumentException("Expected index 0 or 1");
30             }
31         }
32 
GetMaskRegister(int index)33         public static InterruptRegister GetMaskRegister(int index)
34         {
35             switch(index)
36             {
37             case 0:
38                 return InterruptRegister.IrqFlag0;
39             case 1:
40                 return InterruptRegister.IrqFlag1;
41             default:
42                 throw new ArgumentException("Expected index 0 or 1");
43             }
44         }
45     }
46 }
47