alphanum.c 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * arch/sh64/kernel/alpanum.c
  3. *
  4. * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
  5. *
  6. * May be copied or modified under the terms of the GNU General Public
  7. * License. See linux/COPYING for more information.
  8. *
  9. * Machine-independent functions for handling 8-digit alphanumeric display
  10. * (e.g. Agilent HDSP-253x)
  11. */
  12. #include <linux/config.h>
  13. #include <linux/stddef.h>
  14. #include <linux/sched.h>
  15. void mach_alphanum(int pos, unsigned char val);
  16. void mach_led(int pos, int val);
  17. void print_seg(char *file, int line)
  18. {
  19. int i;
  20. unsigned int nibble;
  21. for (i = 0; i < 5; i++) {
  22. mach_alphanum(i, file[i]);
  23. }
  24. for (i = 0; i < 3; i++) {
  25. nibble = ((line >> (i * 4)) & 0xf);
  26. mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
  27. }
  28. }
  29. void print_seg_num(unsigned num)
  30. {
  31. int i;
  32. unsigned int nibble;
  33. for (i = 0; i < 8; i++) {
  34. nibble = ((num >> (i * 4)) & 0xf);
  35. mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
  36. }
  37. }