POK(kernelpart)
portinit.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_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
18 #include <types.h>
19 #include <core/debug.h>
20 #include <core/error.h>
21 #include <middleware/port.h>
22 
23 extern pok_port_t pok_ports[POK_CONFIG_NB_PORTS];
24 
25 void pok_port_init (void)
26 {
27  uint8_t i;
28 
29 #ifdef POK_NEEDS_PARTITIONS
30 #if defined (POK_NEEDS_DEBUG) || defined (POK_NEEDS_ERROR_HANDLING)
31  for (i = 0 ; i < POK_CONFIG_NB_PORTS ; i++)
32  {
33  if ((((uint8_t[]) POK_CONFIG_PARTITIONS_PORTS)[i]) >= POK_CONFIG_NB_PARTITIONS)
34  {
35 #ifdef POK_NEEDS_DEBUG
36  printf ("Invalid configuration, port %d owned by an unknown partition\n", i);
37 #endif
38 #ifdef POK_NEEDS_ERROR_HANDLING
39  pok_kernel_error (POK_ERROR_KIND_KERNEL_CONFIG);
40 #endif
41  }
42  }
43 #endif
44 #endif
45 
46  for (i = 0 ; i < POK_CONFIG_NB_PORTS ; i++)
47  {
48  pok_ports[i].size = 0;
49  pok_ports[i].off_b = 0;
50  pok_ports[i].off_e = 0;
51  pok_ports[i].empty = TRUE;
52  pok_ports[i].full = FALSE;
53  pok_ports[i].index = 0;
54  pok_ports[i].ready = FALSE;
55  pok_ports[i].kind = POK_PORT_KIND_INVALID;
56  pok_ports[i].last_receive = 0;
57  pok_ports[i].must_be_flushed = FALSE;
58  }
59 }
60 
61 #endif