Exemple #1
0
static void test_task1(void * pParam)
{
	RAW_U8* addr;

        while(1) {
		
		if(RAW_SUCCESS == raw_byte_allocate(&byte_pool, (void**)&addr, 16)) {
		
			count ++;

			__put_char("ok1 ", 4);
		}else {

			__put_char("error1 ", 7);
		}

		raw_sleep(20);
 
		if(RAW_SUCCESS == raw_byte_allocate(&byte_pool, (void**)&addr, 30)) {
		
			count ++;

			__put_char("ok2 ", 4);
		}else {

			__put_char("error2 ", 7);
		}

		raw_sleep(20);
               }
}
Exemple #2
0
void test_byte(void * pParam)
{
	RAW_U16 ret;

	RAW_U32 i = 0;

	raw_byte_pool_create(&byte_mem_pool_test, (RAW_U8 *)"byte", byte_mem_pool, 1024 * 1024);

	while (1) {
		
		i++;
		ret = raw_byte_allocate(&byte_mem_pool_test, (RAW_VOID **)&aa, 2022);

		if (ret == RAW_NO_MEMORY) {
			vc_port_printf("RAW_NO_MEMORY\n");
			RAW_ASSERT(0);
		}

		ret = raw_byte_allocate(&byte_mem_pool_test, (RAW_VOID **)&bb, 2000);

		if (ret == RAW_NO_MEMORY) {
			vc_port_printf("RAW_NO_MEMORY\n");
			RAW_ASSERT(0);
		}


		raw_byte_release(&byte_mem_pool_test, bb);
		vc_port_printf("allocate byte %d\n", i);

	}

  

}