mmio.pp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {
  2. Copyright (c) 1998-2022 by the Free Pascal development team
  3. Memory mapped IO helpers
  4. This program 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 2 of the License, or
  7. (at your option) any later version.
  8. This program 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, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit mmio;
  18. interface
  19. procedure DUMMY(Count: DWord);
  20. procedure PUT32(Address: DWord; Value: DWord); inline;
  21. function GET32(Address: DWord) : DWord; inline;
  22. implementation
  23. procedure DUMMY(Count: DWord);
  24. var
  25. i : DWord;
  26. begin
  27. for i := 0 to Count do
  28. begin
  29. asm
  30. nop
  31. end;
  32. end;
  33. end;
  34. procedure PUT32(Address: DWord; Value: DWord); inline;
  35. VAR
  36. p: ^DWord;
  37. begin
  38. p := POINTER (Address);
  39. p^ := Value;
  40. end;
  41. function GET32(Address: DWord) : DWord; inline;
  42. VAR
  43. p: ^DWord;
  44. begin
  45. p := POINTER (Address);
  46. GET32 := p^;
  47. end;
  48. procedure PUT64(Address: QWord; Value: QWord); inline;
  49. VAR
  50. p: ^QWord;
  51. begin
  52. p := POINTER (Address);
  53. p^ := Value;
  54. end;
  55. function GET64(Address: QWord) : QWord; inline;
  56. VAR
  57. p: ^QWord;
  58. begin
  59. p := POINTER (Address);
  60. GET64 := p^;
  61. end;
  62. end.