/** * Change the mode of the current partition (the partition being executed) */ pok_ret_t pok_partition_set_mode_current (const pok_partition_mode_t mode) { #ifdef POK_NEEDS_ERROR_HANDLING if ((POK_SCHED_CURRENT_THREAD != POK_CURRENT_PARTITION.thread_main) && (POK_SCHED_CURRENT_THREAD != POK_CURRENT_PARTITION.thread_error)) #else if (POK_SCHED_CURRENT_THREAD != POK_CURRENT_PARTITION.thread_main) #endif { return POK_ERRNO_THREAD; } /* * Here, we check which thread call this function. * In fact, only two threads can change the partition mode : the init thread * and the error thread. If ANY other thread try to change the partition * mode, this is an error ! */ return (pok_partition_set_mode (POK_SCHED_CURRENT_PARTITION, mode)); }
void pok_partition_error (uint8_t partition, uint32_t error) { switch (partition) { case 0: { switch (error) { case POK_ERROR_KIND_PARTITION_CONFIGURATION: { pok_partition_set_mode (0, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_INIT: { pok_partition_set_mode (0, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_HANDLER: { pok_partition_set_mode (0, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_SCHEDULING: { pok_partition_set_mode (0, POK_PARTITION_MODE_INIT_WARM); break; } } break; } case 1: { switch (error) { case POK_ERROR_KIND_PARTITION_CONFIGURATION: { pok_partition_set_mode (1, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_INIT: { pok_partition_set_mode (1, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_HANDLER: { pok_partition_set_mode (1, POK_PARTITION_MODE_INIT_WARM); break; } case POK_ERROR_KIND_PARTITION_SCHEDULING: { pok_partition_set_mode (1, POK_PARTITION_MODE_INIT_WARM); break; } } break; } } }