POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/middleware/portinit.c
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 #if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
00018 #include <types.h>
00019 #include <core/debug.h>
00020 #include <core/error.h>
00021 #include <middleware/port.h>
00022 
00023 extern pok_port_t pok_ports[POK_CONFIG_NB_PORTS];
00024 
00025 void pok_port_init (void)
00026 {
00027    uint8_t i;
00028 
00029 #ifdef POK_NEEDS_PARTITIONS
00030 #if defined (POK_NEEDS_DEBUG) || defined (POK_NEEDS_ERROR_HANDLING)
00031    for (i = 0 ; i < POK_CONFIG_NB_PORTS ; i++)
00032    {
00033       if ((((uint8_t[]) POK_CONFIG_PARTITIONS_PORTS)[i]) >= POK_CONFIG_NB_PARTITIONS)
00034       {
00035 #ifdef POK_NEEDS_DEBUG
00036          printf ("Invalid configuration, port %d owned by an unknown partition\n", i);
00037 #endif
00038 #ifdef POK_NEEDS_ERROR_HANDLING
00039          pok_kernel_error (POK_ERROR_KIND_KERNEL_CONFIG);
00040 #endif
00041       }
00042    }
00043 #endif
00044 #endif
00045 
00046    for (i = 0 ; i < POK_CONFIG_NB_PORTS ; i++)
00047    {
00048       pok_ports[i].size    = 0;
00049       pok_ports[i].off_b   = 0;
00050       pok_ports[i].off_e   = 0;
00051       pok_ports[i].empty   = TRUE;
00052       pok_ports[i].full    = FALSE;
00053       pok_ports[i].index   = 0;
00054       pok_ports[i].ready   = FALSE;
00055       pok_ports[i].kind    = POK_PORT_KIND_INVALID;
00056       pok_ports[i].last_receive = 0;
00057       pok_ports[i].must_be_flushed = FALSE;
00058    }
00059 }
00060 
00061 #endif