port1.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. uint8_t EXT_EN; // External applied, high Z if false
  32. uint8_t EXT_DIR; // External direction
  33. float EXT_VOLT[8]; // External voltage
  34. // Peripherals activation flags (for emulator)
  35. bool DIR_0, OUT_0, IFG_0, IE_0, SEL_0, SEL2_0, REN_0;
  36. bool DIR_1, OUT_1, IFG_1, IE_1, SEL_1, SEL2_1, REN_1;
  37. bool DIR_2, OUT_2, IFG_2, IE_2, SEL_2, SEL2_2, REN_2;
  38. bool DIR_3, OUT_3, IFG_3, IE_3, SEL_3, SEL2_3, REN_3;
  39. bool DIR_4, OUT_4, IFG_4, IE_4, SEL_4, SEL2_4, REN_4;
  40. bool DIR_5, OUT_5, IFG_5, IE_5, SEL_5, SEL2_5, REN_5;
  41. bool DIR_6, OUT_6, IFG_6, IE_6, SEL_6, SEL2_6, REN_6;
  42. bool DIR_7, OUT_7, IFG_7, IE_7, SEL_7, SEL2_7, REN_7;
  43. // Pin flags
  44. uint8_t PIN0F, PIN1F, PIN2F, PIN3F, PIN4F, PIN5F, PIN6F, PIN7F;
  45. };
  46. void setup_port_1(Emulator *emu);
  47. void handle_port_1(Emulator *emu);
  48. #endif