alphanum.c 923 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * arch/sh64/kernel/alphanum.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/stddef.h>
  13. #include <linux/sched.h>
  14. void mach_alphanum(int pos, unsigned char val);
  15. void mach_led(int pos, int val);
  16. void print_seg(char *file, int line)
  17. {
  18. int i;
  19. unsigned int nibble;
  20. for (i = 0; i < 5; i++) {
  21. mach_alphanum(i, file[i]);
  22. }
  23. for (i = 0; i < 3; i++) {
  24. nibble = ((line >> (i * 4)) & 0xf);
  25. mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
  26. }
  27. }
  28. void print_seg_num(unsigned num)
  29. {
  30. int i;
  31. unsigned int nibble;
  32. for (i = 0; i < 8; i++) {
  33. nibble = ((num >> (i * 4)) & 0xf);
  34. mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
  35. }
  36. }