Unison Help

- Unison Kernel
- Pthreads
- pthread_create()
- pthread_exit()
- pthread_self()
- pthread_equal()
- pthread_join()
- pthread_detach()
- pthread_setschedparam()
- pthread_getschedparam()
- pthread_attr_init()
- pthread_attr_destroy()
- pthread_attr_setstackaddr()
- pthread_attr_getstackaddr()
- pthread_attr_setstacksize()
- pthread_attr_getstacksize()
- pthread_attr_setschedparam()
- pthread_attr_getschedparam()
- pthread_attr_setdetachstate()
- pthread_attr_getdetachstate()
- pthread_stackinfo()
- pthread_setprio()
- pthread_getprio()
- sched_get_priority_max()
- sched_get_priority_min()
- sched_yield()
- Pthread Cancellation
- Mutex
- Semaphores
- Message Queues
- Conditional Variables
- Barriers
- Timers
- Clocks
- Memory Allocation
- Rendezvous
- Interrupts
- Directory Services
- Miscellaneous
- Pthreads
- Unison I/O Library
- Unison STDIO Library
- STDIO Library Calls
- clearerr()
- dprintf()
- fclose()
- fdopen()
- feof()
- ferror()
- fileno()
- fflush()
- fgetc()
- fgetpos()
- fgets()
- fopen()
- fprintf()
- fputc()
- fputs()
- fread()
- freopen()
- fscanf()
- fseek()
- fseeko()
- fsetpos()
- ftell()
- ftello()
- fwrite()
- getc()
- getc_unlocked()
- getchar()
- getchar_unlocked()
- getdelim()
- getline()
- gets()
- get_stderr_ptr()
- get_stdin_ptr()
- get_stdout_ptr()
- noperprintf()
- perprintf()
- perror()
- posix_compat()
- printf()
- putc()
- putc_unlocked()
- putchar()
- putchar_unlocked()
- puts()
- remove()
- rewind()
- scanf()
- setbuf()
- setvbuf()
- snprintf()
- sprintf()
- sscanf()
- stderr_init()
- stderr_close()
- stdin_init()
- stdin_close()
- stdout_init()
- stdout_close()
- vdprintf()
- vscanf()
- vsscanf()
- vfscanf()
- vprintf()
- vsnprintf()
- vsprintf()
- vfprintf()
- ungetc()
- Do-nothing Stubs
- STDIO Library Calls
- Unison LIBC Library
- Unison I/O Servers
- Graphics, Camera, Video, Audio
- Network Protocols
- TCP and UDP Server - tcpd
- DHCP Client Service - dhcp client
- DHCP Server - dhcpd
- Telnet Server - telnetd
- Tiny FTP Server - tftpd
- Point to Point - pppd
- Network Translation - NAT with PAT
- Firewall
- Tiny HTTP Server - thttpd
- Tiny HTTP Server with TLS
- POP3 Server
- Simple Mail Transfer Protocol Services (SMTP)
- Bootp Protocol
- File Transfer Protocol Server (FTP)
- File Transfer Client Services
- RPC / XDR
- DNS Client
- HTTP/HTTPS Client
- REST Client
- AutoIP Service - autoip client
- mDNS server - mdnsd
- SNTP Client
- SNMP Agent - Snmpd server
- SSL/TLS library
- SSH server
- IP security
- Power Control
- Serial I/O
- System Services
- Universal Serial Bus (USB)
- Wireless
- Remedy Tools for Unison
1.10.2.2.pool_destroy() #
NAME
pool_create, pool_destroy, pool_alloc, pool_free – memory allocation
SYNOPSIS
#include <sys.h>
- int pool_create( int poolno,
- unsigned long startaddr , unsigned long endaddr );
- int pool_destroy( int poolno );
- void *pool_alloc( int poolno , size_t size );
- int pool_free( int poolno , void *buf );
pool_alloc() and pool_free() are callable from an ISR.
DESCRIPTION
Memory pools are used to perform allocation of dynamic byte sized chunks of memory from specific memory regions. The pool calls to allocate and free memory, map onto the calls generally used at the application level – malloc() and free().
Microcontrollers and microprocessors often have memory ranges that provide different levels of performance. The combination of the use of the kalloc() and malloc() functions and their mappings onto the pool routines can ensure that certain high performance regions are used for high performance operations. For example, an internal fast memory region could be used for OS allocation (ie kalloc() ) and an external memory could be used for a graphics frame buffer.
Memory pools are used for dynamic allocation of variable size buffers. Up to 8 memory pools may be created. Valid poolno values are 0 through 7 inclusive.
A memory pool is created with a call to pool_create(). startaddr and endaddr indicated the pool limits. It is up to the caller to provide a contiguous block of memory for the memory pool. poolno is a handle which will be used to access the pool. Memory pool poolno can be destroyed with a call to pool_destroy. pool_alloc returns a pointer to a dynamically allocated block of size bytes from memory pool poolno. pool_free returns the block of memory, allocated with a call to pool_alloc, to memory pool poolno.
RETURN VALUES
pool_create() and pool_destroy() return 0 if sucessfull. If they fail, they set errno and return -1.
pool_alloc() returns 0 on failure and a pointer to the allocated buffer if successfull.
ERRORS
pool_create() will set the following errors:
- EINVAL
- poolno is not in the range 0 to 7 or is already in use.
pool_destroy() will set the following errors:
- EINVAL
- poolno is not in the range 0 to 7 or has outstanding memory allocated.