Lösung des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __IO_H__
  2. #define __IO_H__
  3. /******************************************************************************
  4. * *
  5. * License Agreement *
  6. * *
  7. * Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
  8. * All rights reserved. *
  9. * *
  10. * Permission is hereby granted, free of charge, to any person obtaining a *
  11. * copy of this software and associated documentation files (the "Software"), *
  12. * to deal in the Software without restriction, including without limitation *
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  14. * and/or sell copies of the Software, and to permit persons to whom the *
  15. * Software is furnished to do so, subject to the following conditions: *
  16. * *
  17. * The above copyright notice and this permission notice shall be included in *
  18. * all copies or substantial portions of the Software. *
  19. * *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  23. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
  25. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
  26. * DEALINGS IN THE SOFTWARE. *
  27. * *
  28. * This agreement shall be governed in all respects by the laws of the State *
  29. * of California and by the laws of the United States of America. *
  30. * *
  31. * Altera does not recommend, suggest or require that this reference design *
  32. * file be used in conjunction or combination with any other product. *
  33. ******************************************************************************/
  34. /* IO Header file for Nios II Toolchain */
  35. #include "alt_types.h"
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif /* __cplusplus */
  40. #ifndef SYSTEM_BUS_WIDTH
  41. #define SYSTEM_BUS_WIDTH 32
  42. #endif
  43. /* Dynamic bus access functions */
  44. #define __IO_CALC_ADDRESS_DYNAMIC(BASE, OFFSET) \
  45. ((void *)(((alt_u8*)BASE) + (OFFSET)))
  46. #define IORD_32DIRECT(BASE, OFFSET) \
  47. __builtin_ldwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
  48. #define IORD_16DIRECT(BASE, OFFSET) \
  49. __builtin_ldhuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
  50. #define IORD_8DIRECT(BASE, OFFSET) \
  51. __builtin_ldbuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
  52. #define IOWR_32DIRECT(BASE, OFFSET, DATA) \
  53. __builtin_stwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
  54. #define IOWR_16DIRECT(BASE, OFFSET, DATA) \
  55. __builtin_sthio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
  56. #define IOWR_8DIRECT(BASE, OFFSET, DATA) \
  57. __builtin_stbio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
  58. /* Native bus access functions */
  59. #define __IO_CALC_ADDRESS_NATIVE(BASE, REGNUM) \
  60. ((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8))))
  61. #define IORD(BASE, REGNUM) \
  62. __builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))
  63. #define IOWR(BASE, REGNUM, DATA) \
  64. __builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA))
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif /* __IO_H__ */