📄 gfdfilesys.c
字号:
/* Dynamic memory pool pointer is invalid, indicate in
completion status. */
status = NU_INVALID_POOL;
else if (pool -> dm_id != DM_DYNAMIC_ID)
/* Dynamic memory 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 ((size == 0) ||
(size > (pool -> dm_pool_size - (2 * DM_OVERHEAD))))
/* Return the invalid size error. */
status = NU_INVALID_SIZE;
else if ((suspend))//lmq && (TCCE_Suspend_Error()))
/* Suspension from an non-task thread. */
status = NU_INVALID_SUSPEND;
else
/* Parameters are valid, call actual function. */
status = DMC_Allocate_Memory(pool_ptr, return_pointer, size, suspend);
/* Return the completion status. */
return(status);
}
//pc_memory.c
//fal.c
STATUS DMCE_Deallocate_Memory(VOID *memory)
{
DMC_Deallocate_Memory(memory);
}
//apputil.c
//lowl.c
/************************************************************************************************************************************/
/* PARTITION MEMORY */
/************************************************************************************************************************************/
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);
}
//pc_memory.c
//STATUS PMCE_Delete_Partition_Pool(NU_PARTITION_POOL *pool_ptr)
//{
//}
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);
}
//pc_memory.c
//ramdisk.c
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))//lmq && (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);
}
//ramdisk.c
/*************************************************************************************************************************************
* FUNCTION *
* *
* UTL_Zero *
* *
* DESCRIPTION *
* *
* This function clears an area of memory to all zeros. *
**************************************************************************************************************************************/
VOID UTL_Zero(VOID *ptr, UINT32 size)
{
UINT8 *byteStartP;
UINT8 *byteEndP;
UNSIGNED *wordStartP;
UNSIGNED *wordEndP;
UINT8 clearByte = 0; /* causes most compilers to place these */
UNSIGNED clearWord = 0; /* variables in a register only once */
wordStartP = (UNSIGNED*)(((UNSIGNED)(ptr)) + sizeof(UNSIGNED) - 1);
wordStartP = (UNSIGNED*)(((UNSIGNED)(wordStartP)) / sizeof(UNSIGNED));
wordStartP = (UNSIGNED*)(((UNSIGNED)(wordStartP)) * sizeof(UNSIGNED));
byteStartP = (UINT8 *)ptr;
byteEndP = (UINT8 *)(wordStartP);
/* Clear leading unaligned bytes */
while(byteStartP < byteEndP)
{
*byteStartP = clearByte;
++byteStartP;
}
wordEndP = (UNSIGNED *)((((UNSIGNED)(ptr)) + size) / sizeof(UNSIGNED));
wordEndP = (UNSIGNED *)(((UNSIGNED)(wordEndP)) * sizeof(UNSIGNED));
/* Clear the aligned bytes as entire words */
while(wordStartP < wordEndP)
{
*wordStartP = clearWord;
++wordStartP;
}
/* Clear trailing unaligned bytes */
byteStartP = (UINT8 *)(wordEndP);
byteEndP = (UINT8 *)(((CHAR HUGE *) ptr) + size);
while(byteStartP < byteEndP)
{
*byteStartP = clearByte;
++byteStartP;
}
}
//imf.c
VOID NETI_Exit(INT n)
{
UNUSED_PARAMETER(n);
for(;;)
{
NU_Sleep(TICKS_PER_SECOND);
}
}
CHAR *RLC_Release_Information(VOID)
{
CHAR *ptr;
/* Setup pointer to release string. */
ptr = (CHAR *) &RLD_Release_String[0];
/* Return a pointer to the release information string. */
return(ptr);
}
CHAR *LIC_License_Information(VOID)
{
CHAR *ptr;
/* Setup pointer to license string. */
ptr = (CHAR *) &LID_License_String[0];
/* Return a pointer to the license information string. */
return(ptr);
}
VOID ERI_Initialize(VOID)
{
/* Clear the system error code flag. */
ERD_Error_Code = 0;
#ifdef NU_ERROR_STRING
/* Make the error string null. */
ERD_Error_String[0] = 0;
#endif
}
VOID HII_Initialize(VOID)
{
/* Initialize the history enable flag to false. */
HID_History_Enable = NU_FALSE;
/* Initialize the starting indices to the first entry. */
HID_Write_Index = 0;
HID_Read_Index = 0;
/* Initialize the entry counter to 0. */
HID_Entry_Count = 0;
/* Initialize the history protection structure. */
HID_History_Protect.tc_tcb_pointer = NU_NULL;
}
VOID TCI_Initialize(VOID)
{
int i; /* Working index variable */
/* Initialize the created task list to NU_NULL. */
TCD_Created_Tasks_List = NU_NULL;
/* Initialize the total number of created tasks to 0. */
TCD_Total_Tasks = 0;
/* Initialize the array of ready task lists. */
for (i = 0; i < TC_PRIORITIES; i++)
TCD_Priority_List[i] = 0;
/* Initialize the bit maps that represent that at least one task is
ready at the same priority level. */
TCD_Priority_Groups = 0;
for (i = 0; i < TC_MAX_GROUPS; i++)
TCD_Sub_Priority_Groups[i] = 0;
/* Initialize the highest priority flag. */
TCD_Highest_Priority = TC_PRIORITIES;
/* Initialize pointers to the task to execute, HISR to execute,
and current thread of execution. */
TCD_Execute_Task = NU_NULL;
TCD_Execute_HISR = NU_NULL;
TCD_Current_Thread = NU_NULL;
/* Initialize the created HISRs list to NU_NULL. */
TCD_Created_HISRs_List = NU_NULL;
/* Initialize the total number of created HISRs to 0. */
TCD_Total_HISRs = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -