summaryrefslogtreecommitdiff
path: root/arch/sh64/kernel/alphanum.c
blob: d1619d95fbaaf564558844b6d00608bef7857aae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * arch/sh64/kernel/alphanum.c
 *
 * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
 *
 * May be copied or modified under the terms of the GNU General Public
 * License.  See linux/COPYING for more information.
 *
 * Machine-independent functions for handling 8-digit alphanumeric display
 * (e.g. Agilent HDSP-253x)
 */
#include <linux/stddef.h>
#include <linux/sched.h>

void mach_alphanum(int pos, unsigned char val);

void print_seg(char *file, int line)
{
	int i;
	unsigned int nibble;

	for (i = 0; i < 5; i++) {
		mach_alphanum(i, file[i]);
	}

	for (i = 0; i < 3; i++) {
		nibble = ((line >> (i * 4)) & 0xf);
		mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
	}
}

void print_seg_num(unsigned num)
{
	int i;
	unsigned int nibble;

	for (i = 0; i < 8; i++) {
		nibble = ((num >> (i * 4)) & 0xf);

		mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
	}
}