Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * arch/sh64/kernel/alphanum.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/stddef.h> |
| 13 | #include <linux/sched.h> |
| 14 | |
| 15 | void mach_alphanum(int pos, unsigned char val); |
| 16 | void mach_led(int pos, int val); |
| 17 | |
| 18 | void print_seg(char *file, int line) |
| 19 | { |
| 20 | int i; |
| 21 | unsigned int nibble; |
| 22 | |
| 23 | for (i = 0; i < 5; i++) { |
| 24 | mach_alphanum(i, file[i]); |
| 25 | } |
| 26 | |
| 27 | for (i = 0; i < 3; i++) { |
| 28 | nibble = ((line >> (i * 4)) & 0xf); |
| 29 | mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48)); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | void print_seg_num(unsigned num) |
| 34 | { |
| 35 | int i; |
| 36 | unsigned int nibble; |
| 37 | |
| 38 | for (i = 0; i < 8; i++) { |
| 39 | nibble = ((num >> (i * 4)) & 0xf); |
| 40 | |
| 41 | mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48)); |
| 42 | } |
| 43 | } |
| 44 | |