io-shark.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * linux/arch/arm/lib/io-shark.c
  3. *
  4. * by Alexander Schulz
  5. *
  6. * derived from:
  7. * linux/arch/arm/lib/io-ebsa.S
  8. * Copyright (C) 1995, 1996 Russell King
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <asm/io.h>
  16. void print_warning(void)
  17. {
  18. printk(KERN_WARNING "ins?/outs? not implemented on this architecture\n");
  19. }
  20. void insl(unsigned int port, void *to, int len)
  21. {
  22. print_warning();
  23. }
  24. void insb(unsigned int port, void *to, int len)
  25. {
  26. print_warning();
  27. }
  28. void outsl(unsigned int port, const void *from, int len)
  29. {
  30. print_warning();
  31. }
  32. void outsb(unsigned int port, const void *from, int len)
  33. {
  34. print_warning();
  35. }
  36. /* these should be in assembler again */
  37. /*
  38. * Purpose: read a block of data from a hardware register to memory.
  39. * Proto : insw(int from_port, void *to, int len_in_words);
  40. * Proto : inswb(int from_port, void *to, int len_in_bytes);
  41. * Notes : increment to
  42. */
  43. void insw(unsigned int port, void *to, int len)
  44. {
  45. int i;
  46. for (i = 0; i < len; i++)
  47. ((unsigned short *) to)[i] = inw(port);
  48. }
  49. void inswb(unsigned int port, void *to, int len)
  50. {
  51. insw(port, to, len >> 2);
  52. }
  53. /*
  54. * Purpose: write a block of data from memory to a hardware register.
  55. * Proto : outsw(int to_reg, void *from, int len_in_words);
  56. * Proto : outswb(int to_reg, void *from, int len_in_bytes);
  57. * Notes : increments from
  58. */
  59. void outsw(unsigned int port, const void *from, int len)
  60. {
  61. int i;
  62. for (i = 0; i < len; i++)
  63. outw(((unsigned short *) from)[i], port);
  64. }
  65. void outswb(unsigned int port, const void *from, int len)
  66. {
  67. outsw(port, from, len >> 2);
  68. }