POK(kernelpart)
cons.c
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 #if defined (POK_NEEDS_CONSOLE) || defined (POK_NEEDS_DEBUG) || defined (POK_NEEDS_INSTRUMENTATION) || defined (POK_NEEDS_COVERAGE_INFOS)
18 
19 #include <arch.h>
20 #include <errno.h>
21 #include <core/cons.h>
22 
23 
24 
25 print_char_fn_t pok_print_char_fn = NULL;
26 print_attr_fn_t pok_print_attr_fn = NULL;
27 
28 
29 
30 void pok_print_char (const char c)
31 {
32  if (pok_print_char_fn != NULL)
33  {
34  return (pok_print_char_fn(c));
35  }
36 }
37 
38 void pok_print_attr (uint8_t attr)
39 {
40  if (pok_print_attr_fn != NULL)
41  {
42  pok_print_attr_fn(attr);
43  }
44 }
45 
46 int pok_write (const char *s, size_t length)
47 {
48  size_t i;
49 
50  for (i = 0; i < length; i++)
51  {
52  pok_print_char (*s++);
53  }
54 
55  return (i);
56 }
57 
58 int pok_print_init (print_char_fn_t print_char_fn,
59  print_attr_fn_t print_attr_fn)
60 {
61  pok_print_char_fn = print_char_fn;
62  pok_print_attr_fn = print_attr_fn;
63 
64  return (POK_ERRNO_OK);
65 }
66 
67 #endif /* POK_NEEDS_CONSOLE, POK_NEEDS_DEBUG */