📄 pmce.c
字号:
/*************************************************************************//* *//* Copyright Mentor Graphics Corporation 2002 *//* All Rights Reserved. *//* *//* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS *//* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS *//* SUBJECT TO LICENSE TERMS. *//* *//*************************************************************************//*************************************************************************//* *//* FILE NAME VERSION *//* *//* pmce.c Nucleus PLUS 1.14 *//* *//* COMPONENT *//* *//* PM - Partition Memory Management *//* *//* DESCRIPTION *//* *//* This file contains the error checking routines for the functions *//* in the Partition component. This permits easy removal of error *//* checking logic when it is not needed. *//* *//* DATA STRUCTURES *//* *//* None *//* *//* FUNCTIONS *//* *//* PMCE_Create_Partition_Pool Create a Partition Pool *//* PMCE_Delete_Partition_Pool Delete a Partition Pool *//* PMCE_Allocate_Partition Allocate a partition from a *//* pool *//* PMCE_Deallocate_Partition Deallocate a partition from *//* a pool *//* *//* DEPENDENCIES *//* *//* cs_extr.h Common Service functions *//* tc_extr.h Thread Control functions *//* pm_extr.h Partition functions *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Changed name original error *//* checking file and changed *//* function interfaces, resulting *//* in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* 04-17-1996 updated to version 1.2 *//* 03-24-1998 Released version 1.3 *//* 04-17-2002 Released version 1.13m *//* 11-07-2002 Released version 1.14 *//*************************************************************************/#define NU_SOURCE_FILE#include "cs_extr.h" /* Common service functions */#include "tc_extr.h" /* Thread control functions */#include "pm_extr.h" /* Partition functions *//*************************************************************************//* *//* FUNCTION *//* *//* PMCE_Create_Partition_Pool *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the create partition pool function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* PMC_Create_Partition_Pool Actual create partition pool *//* function *//* *//* INPUTS *//* *//* pool_ptr Partition pool control block *//* pointer *//* name Partition pool name *//* start_address Starting address of the pool *//* pool_size Number of bytes in the pool *//* partition_size Number of bytes in each *//* partition of the pool *//* suspend_type Suspension type *//* *//* OUTPUTS *//* *//* NU_INVALID_POOL Pool control block pointer *//* is NULL *//* NU_INVALID_MEMORY Pool starting address is NULL*//* NU_INVALID_SIZE Partition size is 0 or it is *//* larger than the pool area *//* NU_INVALID_SUSPEND Suspension selection is not *//* valid *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Modified function interface, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/STATUS PMCE_Create_Partition_Pool(NU_PARTITION_POOL *pool_ptr, CHAR *name, VOID *start_address, UNSIGNED pool_size, UNSIGNED partition_size, OPTION suspend_type){PM_PCB *pool; /* Pool control block ptr */STATUS status; /* Completion status */UNSIGNED size; /* Adjusted size of partition*/ /* Move input pool pointer into internal pointer. */ pool = (PM_PCB *) pool_ptr; /* Adjust the partition size to something that is evenly divisible by the number of bytes in an UNSIGNED data type. */ size = ((partition_size + sizeof(UNSIGNED) - 1)/sizeof(UNSIGNED)) * sizeof(UNSIGNED); /* Check for a NULL partition pool control block pointer or a control block that is already created. */ if ((pool == NU_NULL) || (pool -> pm_id == PM_PARTITION_ID)) /* Invalid partition pool control block pointer. */ status = NU_INVALID_POOL; else if (start_address == NU_NULL) /* Invalid memory pointer. */ status = NU_INVALID_MEMORY; else if ((size == 0) || ((size + PM_OVERHEAD) > pool_size)) /* Pool could not even accommodate one partition. */ status = NU_INVALID_SIZE; else if ((suspend_type != NU_FIFO) && (suspend_type != NU_PRIORITY)) /* Invalid suspension type. */ status = NU_INVALID_SUSPEND; else /* Call the actual service to create the partition pool. */ status = PMC_Create_Partition_Pool(pool_ptr, name, start_address, pool_size, partition_size, suspend_type); /* Return completion status. */ return(status);}/*************************************************************************//* *//* FUNCTION *//* *//* PMCE_Delete_Partition_Pool *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the delete partition pool function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* PMC_Delete_Partition_Pool Actual function to delete a *//* partition pool *//* *//* INPUTS *//* *//* pool_ptr Partition pool control block *//* pointer *//* *//* OUTPUTS *//* *//* NU_INVALID_POOL Indicates the supplied pool *//* pointer is invalid *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Modified function interface, *//* resulting in version 1.1 *//* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -