1 //
2 // Copyright (c) 2010-2018 Antmicro
3 // Copyright (c) 2011-2015 Realtime Embedded
4 //
5 // This file is licensed under the MIT License.
6 // Full license text is available in 'licenses/MIT.txt'.
7 //
8 using System;
9 using Antmicro.Renode.Peripherals.Bus;
10 using Antmicro.Renode.Core;
11 using Antmicro.Renode.Logging;
12 
13 namespace Antmicro.Renode.Peripherals.MTD
14 {
15     [AllowedTranslations(AllowedTranslation.ByteToDoubleWord)]
16     public class FSLNAND : IDoubleWordPeripheral, IKnownSize
17     {
FSLNAND()18         public FSLNAND()
19         {
20             IRQ = new GPIO();
21         }
22 
23         public long Size
24         {
25             get
26             {
27                 return 0x10000;
28             }
29         }
30 
31         public GPIO IRQ { get; private set; }
32 
ReadDoubleWord(long offset)33         public uint ReadDoubleWord(long offset)
34         {
35             if(offset == 0x3F38)
36             {
37                 return 0xFFFFFFFF;
38             }
39             this.LogUnhandledRead(offset);
40             return 0;
41         }
42 
WriteDoubleWord(long offset, uint value)43         public void WriteDoubleWord(long offset, uint value)
44         {
45             if(offset == 0x3F04)
46             {
47                 IRQ.Set();
48             }
49             else if(offset == 0x3F38)
50             {
51                 IRQ.Unset();
52             }
53             else
54             {
55                 this.LogUnhandledWrite(offset, value);
56             }
57         }
58 
Reset()59         public void Reset()
60         {
61         }
62 
63     }
64 }
65 
66