⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmce.c

📁 test file nucleus source
💻 C
📖 第 1 页 / 共 2 页
字号:
/*      03-18-1994      Verified version 1.1                             *//*                                                                       *//*************************************************************************/STATUS  PMCE_Delete_Partition_Pool(NU_PARTITION_POOL *pool_ptr){PM_PCB         *pool;                       /* Pool control block ptr    */STATUS          status;                     /* Completion status         */    /* Move input pool pointer into internal pointer.  */    pool =  (PM_PCB *) pool_ptr;    /* Determine if the partition pool pointer is valid.  */    if ((pool) && (pool -> pm_id == PM_PARTITION_ID))            /* Partition pool pointer is valid, call function to delete it.  */        status =  PMC_Delete_Partition_Pool(pool_ptr);            else            /* Partition pool pointer is invalid, indicate in completion status. */        status =  NU_INVALID_POOL;            /* Return completion status.  */    return(status);}/*************************************************************************//*                                                                       *//* FUNCTION                                                              *//*                                                                       *//*      PMCE_Allocate_Partition                                          *//*                                                                       *//* DESCRIPTION                                                           *//*                                                                       *//*      This function performs error checking on the parameters supplied *//*      to the allocate partition function.                              *//*                                                                       *//* CALLED BY                                                             *//*                                                                       *//*      Application                                                      *//*                                                                       *//* CALLS                                                                 *//*                                                                       *//*      PMC_Allocate_Partition              Actual partition allocate    *//*                                            function                   *//*      TCCE_Suspend_Error                  Check for a task suspension  *//*                                            error                      *//*                                                                       *//* INPUTS                                                                *//*                                                                       *//*      pool_ptr                            Memory partition pool pointer*//*      return_pointer                      Pointer to the destination   *//*                                            memory pointer             *//*      suspend                             Suspension option if full    *//*                                                                       *//* OUTPUTS                                                               *//*                                                                       *//*      NU_INVALID_POOL                     Indicates the pool pointer   *//*                                            is invalid                 *//*      NU_INVALID_POINTER                  Indicates the return pointer *//*                                            is NULL                    *//*      NU_INVALID_SUSPEND                  Indicates the suspension 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                         *//*                                                                       *//*      03-18-1994      Verified version 1.1                             *//*                                                                       *//*************************************************************************/STATUS  PMCE_Allocate_Partition(NU_PARTITION_POOL *pool_ptr,                              VOID **return_pointer, UNSIGNED suspend){PM_PCB         *pool;                       /* Pool control block ptr    */STATUS          status;                     /* Completion status         */    /* Move input pool pointer into internal pointer.  */    pool =  (PM_PCB *) pool_ptr;    /* Determine if partition pool pointer is invalid.  */    if (pool == NU_NULL)            /* Partition pool pointer is invalid, indicate in completion status. */        status =  NU_INVALID_POOL;    else if (pool -> pm_id != PM_PARTITION_ID)            /* Partition pool pointer is invalid, indicate in completion status. */        status =  NU_INVALID_POOL;    else if (return_pointer == NU_NULL)        /* Return pointer is invalid.  */        status =  NU_INVALID_POINTER;            else if ((suspend) && (TCCE_Suspend_Error()))            /* Suspension from a non-task thread.  */        status =  NU_INVALID_SUSPEND;    else             /* Parameters are valid, call actual function.  */        status =  PMC_Allocate_Partition(pool_ptr, return_pointer, suspend);    /* Return the completion status.  */    return(status);}/*************************************************************************//*                                                                       *//* FUNCTION                                                              *//*                                                                       *//*      PMCE_Deallocate_Partition                                        *//*                                                                       *//* DESCRIPTION                                                           *//*                                                                       *//*      This function performs error checking on the parameters supplied *//*      to the deallocate partition function.                            *//*                                                                       *//* CALLED BY                                                             *//*                                                                       *//*      Application                                                      *//*                                                                       *//* CALLS                                                                 *//*                                                                       *//*      PMC_Deallocate_Partition            Deallocate a partition       *//*                                                                       *//* INPUTS                                                                *//*                                                                       *//*      partition                           Pointer to partition memory  *//*                                                                       *//* OUTPUTS                                                               *//*                                                                       *//*      NU_INVALID_POINTER                  Indicates the supplied       *//*                                            partition pointer is NULL, *//*                                            or otherwise invalid.      *//*      NU_SUCCESS                                                       *//*                                                                       *//* 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_Deallocate_Partition(VOID *partition){PM_PCB         *pool;                       /* Pool pointer              */PM_HEADER      *header_ptr;                 /* Pointer to partition hdr  */STATUS          status;                     /* Completion status         */    /* Pickup the associated pool's pointer.  It is inside the header of       each partition.  */    header_ptr =  (PM_HEADER *) (((BYTE_PTR) partition) - PM_OVERHEAD);            /* Determine if the pointer(s) are NULL.  */    if ((header_ptr == NU_NULL) || (partition == NU_NULL))            /* Partition pointer is invalid.  */        status =  NU_INVALID_POINTER;    /* Determine if partition pool pointer is invalid.  */    else if ((pool =  header_ptr -> pm_partition_pool) == NU_NULL)            /* Partition pointer is invalid, indicate in completion status.  */        status =  NU_INVALID_POINTER;    else if (pool -> pm_id != PM_PARTITION_ID)            /* Partition pool pointer is invalid, indicate in completion status. */        status =  NU_INVALID_POINTER;            else if (header_ptr -> pm_next_available)            /* Partition is still linked on the available list- must not be           allocated.  */        status =  NU_INVALID_POINTER;    else             /* Parameters are valid, call actual function.  */        status =  PMC_Deallocate_Partition(partition);    /* Return the completion status.  */    return(status);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -