commit
0daed4872f
|
@ -54,7 +54,6 @@ Modification:
|
|||
extern x_base cpu2_boot_flag;
|
||||
extern void entry(void);
|
||||
extern void SecondaryCpuCStart(void);
|
||||
extern void ShutdownCpu(void);
|
||||
extern int IoConfigInit(void);
|
||||
extern int HwSpiInit(void);
|
||||
extern int HwI2cInit(void);
|
||||
|
@ -187,25 +186,3 @@ void HwCpuReset(void)
|
|||
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
|
||||
reboot, HwCpuReset, reset machine );
|
||||
static void (*pre_shutdown_action)(void *);
|
||||
static void *pre_shutdown_action_arg;
|
||||
|
||||
void SetPreShutdownAction(void (*func)(void *), void *arg)
|
||||
{
|
||||
pre_shutdown_action = func;
|
||||
pre_shutdown_action_arg = arg;
|
||||
}
|
||||
|
||||
void CmdShutdown()
|
||||
{
|
||||
#ifdef FS_VFS
|
||||
SyncOpenedFiles();
|
||||
#endif
|
||||
if (pre_shutdown_action != NULL)
|
||||
pre_shutdown_action(pre_shutdown_action_arg);
|
||||
|
||||
ShutdownCpu();
|
||||
}
|
||||
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),
|
||||
shutdown,CmdShutdown,shutdown machine);
|
||||
|
|
|
@ -39,7 +39,7 @@ extern void ShowMemory(void);
|
|||
extern long ShowSem(void);
|
||||
extern long ShowEvent(void);
|
||||
extern long ShowMutex(void);
|
||||
//extern long ShowMemPool(void);
|
||||
//extern long ShowGatherMem(void);
|
||||
extern long ShowMsgQueue(void);
|
||||
//extern long showdevice(void);
|
||||
extern long ShowTimer(void);
|
||||
|
@ -75,7 +75,7 @@ uintptr_t KsPrintInfo(uint32_t knum,uintptr_t *param, uint8_t num )
|
|||
#endif
|
||||
break;
|
||||
case 6:
|
||||
//ShowMemPool();
|
||||
//ShowGatherMem();
|
||||
break;
|
||||
case 7:
|
||||
#ifdef KERNEL_MESSAGEQUEUE
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <xiuos.h>
|
||||
#include <string.h>
|
||||
|
||||
extern long ShowMemPool(void);
|
||||
extern long ShowGatherMem(void);
|
||||
extern void ShowMemory(void);
|
||||
extern void ShowBuddy(void);
|
||||
/**************************single gatherblock test sample***********************************/
|
||||
|
@ -93,7 +93,7 @@ int SingleGatherblockTest(char * parameter)
|
|||
if(0 == strncmp("static", parameter, strlen("static"))){
|
||||
KPrintf("test static create gatherblock.\n");
|
||||
InitMemGather(&gm, "mp_s", &mempool[0], sizeof(mempool), 80);
|
||||
ShowMemPool();
|
||||
ShowGatherMem();
|
||||
}
|
||||
|
||||
if(0 == strncmp("dynamic", parameter, strlen("dynamic"))){
|
||||
|
@ -105,7 +105,7 @@ int SingleGatherblockTest(char * parameter)
|
|||
return -1;
|
||||
}
|
||||
|
||||
ShowMemPool();
|
||||
ShowGatherMem();
|
||||
}
|
||||
/* create task1, alloc memory blocks */
|
||||
tid1 = KTaskCreate("task1", Task1GmAlloc, parameter,
|
||||
|
@ -204,7 +204,7 @@ int MultipleGatherblockTest(void)
|
|||
KPrintf("create m_gm_d2 failed.");
|
||||
CHECK(0);
|
||||
}
|
||||
ShowMemPool();
|
||||
ShowGatherMem();
|
||||
|
||||
/* create task1, alloc memory blocks */
|
||||
m_tid1 = KTaskCreate("task1_m", Task1AllocEntry, NONE,
|
||||
|
@ -443,7 +443,7 @@ int RandomAllocFreeTest(void *parameter)
|
|||
if(0 == strncmp("static", parameter, strlen("static"))){
|
||||
KPrintf("test static create gatherblock-%s.\n",parameter);
|
||||
InitMemGather(&random_static_gm, "ran_mp_s", &dynamic_mempool[0], sizeof(dynamic_mempool), 80);
|
||||
ShowMemPool();
|
||||
ShowGatherMem();
|
||||
}else{
|
||||
KPrintf("test dynamic create gatherblock.\n");
|
||||
random_dynamic_gm = CreateMemGather("ran_mp_d",40,80);
|
||||
|
@ -451,7 +451,7 @@ int RandomAllocFreeTest(void *parameter)
|
|||
KPrintf("%s: allocate failure.\n",__func__);
|
||||
return -1;
|
||||
}
|
||||
ShowMemPool();
|
||||
ShowGatherMem();
|
||||
}
|
||||
/* create task1, alloc memory blocks */
|
||||
random_tid1 = KTaskCreate("r_task1", RandomTask1GmAlloc, parameter,
|
||||
|
|
|
@ -88,21 +88,25 @@ int TestMain(int argc, char*argv[])
|
|||
break;
|
||||
case MEM:
|
||||
#ifdef KERNEL_TEST_MEM
|
||||
if (argc > 2)
|
||||
TestMem(argc-2,&argv[2]);
|
||||
#endif
|
||||
break;
|
||||
case TIMER:
|
||||
#ifdef KERNEL_TEST_TIMER
|
||||
if (argc > 2)
|
||||
TestTmr(argc-2,&argv[2]);
|
||||
#endif
|
||||
break;
|
||||
case GATHERBLOCK:
|
||||
#ifdef KERNEL_TEST_MEM
|
||||
if (argc > 2)
|
||||
TestGatherblock(&argv[2]);
|
||||
#endif
|
||||
break;
|
||||
case SCHED:
|
||||
#ifdef KERNEL_TEST_SCHED
|
||||
if (argc > 2)
|
||||
TestTaskReadyAndSched(argc-2, &argv[2]);
|
||||
#endif
|
||||
break;
|
||||
|
@ -112,6 +116,7 @@ int TestMain(int argc, char*argv[])
|
|||
#endif
|
||||
case REALTIME:
|
||||
#ifdef KERNEL_TEST_REALTIME
|
||||
if (argc > 2)
|
||||
TestRealtime(argc-2, &argv[2]);
|
||||
#endif
|
||||
default:
|
||||
|
|
|
@ -66,7 +66,7 @@ struct DynamicAllocNode
|
|||
*/
|
||||
struct DynamicFreeNode
|
||||
{
|
||||
uint32 size; /* the size of dynamicAllocNode */
|
||||
x_size_t size; /* the size of dynamicAllocNode */
|
||||
uint32 prev_adj_size; /* the size of the previous adjacent node, (dynamic alloc node or dynamic free node */
|
||||
|
||||
struct DynamicFreeNode *next;
|
||||
|
@ -341,7 +341,7 @@ static void* BigMemMalloc(struct DynamicBuddyMemory *dynamic_buddy, x_size_t siz
|
|||
};
|
||||
|
||||
/* get the best-fit freeNode */
|
||||
if (node) {
|
||||
if (node && (node->size > allocsize)) {
|
||||
struct DynamicFreeNode *remainder;
|
||||
struct DynamicFreeNode *next;
|
||||
x_size_t remaining;
|
||||
|
|
Loading…
Reference in New Issue