e2a.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * arch/ppc64/lib/e2a.c
  3. *
  4. * EBCDIC to ASCII conversion
  5. *
  6. * This function moved here from arch/ppc64/kernel/viopath.c
  7. *
  8. * (C) Copyright 2000-2004 IBM Corporation
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of the
  13. * License, or (at your option) anyu later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. #include <linux/module.h>
  26. unsigned char e2a(unsigned char x)
  27. {
  28. switch (x) {
  29. case 0xF0:
  30. return '0';
  31. case 0xF1:
  32. return '1';
  33. case 0xF2:
  34. return '2';
  35. case 0xF3:
  36. return '3';
  37. case 0xF4:
  38. return '4';
  39. case 0xF5:
  40. return '5';
  41. case 0xF6:
  42. return '6';
  43. case 0xF7:
  44. return '7';
  45. case 0xF8:
  46. return '8';
  47. case 0xF9:
  48. return '9';
  49. case 0xC1:
  50. return 'A';
  51. case 0xC2:
  52. return 'B';
  53. case 0xC3:
  54. return 'C';
  55. case 0xC4:
  56. return 'D';
  57. case 0xC5:
  58. return 'E';
  59. case 0xC6:
  60. return 'F';
  61. case 0xC7:
  62. return 'G';
  63. case 0xC8:
  64. return 'H';
  65. case 0xC9:
  66. return 'I';
  67. case 0xD1:
  68. return 'J';
  69. case 0xD2:
  70. return 'K';
  71. case 0xD3:
  72. return 'L';
  73. case 0xD4:
  74. return 'M';
  75. case 0xD5:
  76. return 'N';
  77. case 0xD6:
  78. return 'O';
  79. case 0xD7:
  80. return 'P';
  81. case 0xD8:
  82. return 'Q';
  83. case 0xD9:
  84. return 'R';
  85. case 0xE2:
  86. return 'S';
  87. case 0xE3:
  88. return 'T';
  89. case 0xE4:
  90. return 'U';
  91. case 0xE5:
  92. return 'V';
  93. case 0xE6:
  94. return 'W';
  95. case 0xE7:
  96. return 'X';
  97. case 0xE8:
  98. return 'Y';
  99. case 0xE9:
  100. return 'Z';
  101. }
  102. return ' ';
  103. }
  104. EXPORT_SYMBOL(e2a);