swarm_ide.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright (C) 2001 Broadcom Corporation
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  17.  */
  18. #ifndef _SWARM_IDE_H
  19. #define _SWARM_IDE_H
  20. #include <asm/sibyte/sb1250_int.h>
  21. #define SWARM_IDE_BASE        (0xb00b0000-mips_io_port_base)
  22. #define SWARM_IDE_REG(pcaddr) (SWARM_IDE_BASE + ((pcaddr)<<5))
  23. #define SWARM_IDE_INT         (K_INT_GPIO_4)
  24. extern ide_ideproc_t swarm_ideproc;
  25. #define swarm_outb(val,port)
  26. do {
  27. *(volatile u8 *)(mips_io_port_base + (port)) = val;
  28. } while(0)
  29. #define swarm_outw(val,port)
  30. do {
  31. *(volatile u16 *)(mips_io_port_base + (port)) = val;
  32. } while(0)
  33. #define swarm_outl(val,port)
  34. do {
  35. *(volatile u32 *)(mips_io_port_base + (port)) = val;
  36. } while(0)
  37. static inline unsigned char swarm_inb(unsigned long port)
  38. {
  39. return (*(volatile u8 *)(mips_io_port_base + port));
  40. }
  41. static inline unsigned short swarm_inw(unsigned long port)
  42. {
  43. return (*(volatile u16 *)(mips_io_port_base + port));
  44. }
  45. static inline unsigned int swarm_inl(unsigned long port)
  46. {
  47. return (*(volatile u32 *)(mips_io_port_base + port));
  48. }
  49. static inline void swarm_outsb(unsigned long port, void *addr, unsigned int count)
  50. {
  51. while (count--) {
  52. swarm_outb(*(u8 *)addr, port);
  53. addr++;
  54. }
  55. }
  56. static inline void swarm_insb(unsigned long port, void *addr, unsigned int count)
  57. {
  58. while (count--) {
  59. *(u8 *)addr = swarm_inb(port);
  60. addr++;
  61. }
  62. }
  63. static inline void swarm_outsw(unsigned long port, void *addr, unsigned int count)
  64. {
  65. while (count--) {
  66. swarm_outw(*(u16 *)addr, port);
  67. addr += 2;
  68. }
  69. }
  70. static inline void swarm_insw(unsigned long port, void *addr, unsigned int count)
  71. {
  72. while (count--) {
  73. *(u16 *)addr = swarm_inw(port);
  74. addr += 2;
  75. }
  76. }
  77. static inline void swarm_outsl(unsigned long port, void *addr, unsigned int count)
  78. {
  79. while (count--) {
  80. swarm_outl(*(u32 *)addr, port);
  81. addr += 4;
  82. }
  83. }
  84. static inline void swarm_insl(unsigned long port, void *addr, unsigned int count)
  85. {
  86. while (count--) {
  87. *(u32 *)addr = swarm_inl(port);
  88. addr += 4;
  89. }
  90. }
  91. #endif