# Question about disabling interrupts in the demo\_gpio program

**URL:** <https://forums.sifive.com/t/question-about-disabling-interrupts-in-the-demo-gpio-program/397>\
**Category:** Freedom E300\
**Created:** [March 10, 2017, 1:57am UTC](https://forums.sifive.com/t/question-about-disabling-interrupts-in-the-demo-gpio-program/397 "2017-03-10T01:57:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![neo\_ar](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/neo_ar/32/792_2.png) [@neo\_ar](https://forums.sifive.com/u/neo_ar)\
**Post date:** [March 10, 2017, 1:57am UTC](https://forums.sifive.com/t/question-about-disabling-interrupts-in-the-demo-gpio-program/397/1 "2017-03-10T01:57:38Z")

</div>

reset\_demo begins with the following:

```
  // Disable the machine & timer interrupts until setup is done.

  clear_csr(mie, MIP_MEIP);
  clear_csr(mie, MIP_MTIP);

```

I understand what clear\_csr is doing, and that MIP\_MEIP and MIP\_MTIP are being used in place of having symbols defined for MIE\_MEIE and MIE\_MTIE as the locations in the registers are identical.

Why do we disable the machine and timer interrupts vs just disabling interrupts globally with the MIE bit in mstatus? My understanding is that by turning off MEIE and MTIE bits in mie we are leaving the possibility for software interrupts to still be handled (MSIE). Is there a specific reason why we would want that behaviour, or am I misunderstanding the relationship between mie/mstatus/the plic?

Here is the episode from my show where we encountered this question:

---

<div class="post-metadata">

**Author:** ![mwachs5](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mwachs5/32/13_2.png) [@mwachs5](https://forums.sifive.com/u/mwachs5)\
**Post date:** [March 10, 2017, 5:42am UTC](https://forums.sifive.com/t/question-about-disabling-interrupts-in-the-demo-gpio-program/397/2 "2017-03-10T05:42:17Z")

</div>

Good question! Those lines of code don’t make a lot of sense anymore. They are left over from an earlier version of the code, which allowed “reset\_demo()” to be called from other functions (we simplified the demo before we released it).

And, you’re right that the same could be achieved by just disabling interrupts globally. There is no special desire to keep the MSIP interrupt enabled, we just know in this demo we never enabled it.
