port1.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. MSP430 Emulator
  3. Copyright (C) 2020 Rudolf Geosits (rgeosits@live.esu.edu)
  4. "MSP430 Emulator" is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. "MSP430 Emulator" is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef _PORT_1_
  16. #define _PORT_1_
  17. #include "../cpu/registers.h"
  18. #include "../utilities.h"
  19. struct Port_1 {
  20. // Peripheral register pointers
  21. // Port 1 = r/w = = reset? =
  22. uint8_t *_IN; /* r - */
  23. uint8_t *_OUT; /* r/w unchanged */
  24. uint8_t *_DIR; /* r/w PUC reset */
  25. uint8_t *_IFG; /* r/w PUC reset */
  26. uint8_t *_IES; /* r/w unchanged */
  27. uint8_t *_IE; /* r/w PUC reset */
  28. uint8_t *_SEL; /* r/w PUC reset */
  29. uint8_t *_SEL2; /* r/w PUC reset */
  30. uint8_t *_REN; /* r/w PUC reset */
  31. // Peripherals activation flags (for emulator)
  32. bool DIR_0, OUT_0, IFG_0, IE_0, SEL_0, SEL2_0, REN_0;
  33. bool DIR_1, OUT_1, IFG_1, IE_1, SEL_1, SEL2_1, REN_1;
  34. bool DIR_2, OUT_2, IFG_2, IE_2, SEL_2, SEL2_2, REN_2;
  35. bool DIR_3, OUT_3, IFG_3, IE_3, SEL_3, SEL2_3, REN_3;
  36. bool DIR_4, OUT_4, IFG_4, IE_4, SEL_4, SEL2_4, REN_4;
  37. bool DIR_5, OUT_5, IFG_5, IE_5, SEL_5, SEL2_5, REN_5;
  38. bool DIR_6, OUT_6, IFG_6, IE_6, SEL_6, SEL2_6, REN_6;
  39. bool DIR_7, OUT_7, IFG_7, IE_7, SEL_7, SEL2_7, REN_7;
  40. // Pin flags
  41. uint8_t PIN0F, PIN1F, PIN2F, PIN3F, PIN4F, PIN5F, PIN6F, PIN7F;
  42. };
  43. void setup_port_1(Emulator *emu);
  44. void handle_port_1(Emulator *emu);
  45. #endif