io.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * linux/arch/sh/kernel/io.c
  3. *
  4. * Copyright (C) 2000 Stuart Menefy
  5. *
  6. * Provide real functions which expand to whatever the header file defined.
  7. * Also definitions of machine independent IO functions.
  8. */
  9. #include <asm/io.h>
  10. #include <linux/module.h>
  11. /*
  12. * Copy data from IO memory space to "real" memory space.
  13. * This needs to be optimized.
  14. */
  15. void memcpy_fromio(void * to, unsigned long from, unsigned long count)
  16. {
  17. char *p = to;
  18. while (count) {
  19. count--;
  20. *p = readb(from);
  21. p++;
  22. from++;
  23. }
  24. }
  25. /*
  26. * Copy data from "real" memory space to IO memory space.
  27. * This needs to be optimized.
  28. */
  29. void memcpy_toio(unsigned long to, const void * from, unsigned long count)
  30. {
  31. const char *p = from;
  32. while (count) {
  33. count--;
  34. writeb(*p, to);
  35. p++;
  36. to++;
  37. }
  38. }
  39. /*
  40. * "memset" on IO memory space.
  41. * This needs to be optimized.
  42. */
  43. void memset_io(unsigned long dst, int c, unsigned long count)
  44. {
  45. while (count) {
  46. count--;
  47. writeb(c, dst);
  48. dst++;
  49. }
  50. }
  51. EXPORT_SYMBOL(memcpy_fromio);
  52. EXPORT_SYMBOL(memcpy_toio);
  53. EXPORT_SYMBOL(memset_io);