NDAS system abstracted layer (NDAS SAL)
The platform/system/OS neutral primitive APIs.
1. No dependency to any specific platform or OS
The NDAS core functions doesn't use any specific libary of any platform. Even it has no dependency to the stardard C library. the whole NDAS core are written with the NDAS SAL APIs.
2. Funtionalities of NDAS SAL APIs
Memory
- sal_alloc - Allocate the memory from the platform.
- sal_free - Return the memory will not be used by NDAS core.
Thread
- sal_thread_create - Create a thread from the platform.
Synchronization
- sal_mutex_create - Create a mutex or spin-lock from the platform
- sal_mutex_take - Take the mutex or spin-lock
- sal_mutex_give - Give back the mutex or spin-lock
- sal_mutex_destroy - Return the mutex to the platform
- sal_semaphore_create - Create a semaphore from the platform
- sal_semaphore_take - Down the semaphore.
- sal_semaphore_give - Up the semaphore.
- sal_semaphore_destroy - Return the semaphore to the platform
Time
- sal_tick - Get the system time by the system time unit.
- sal_msleep - Sleep the given milli-second.
Network
- sal_netdev_open - Open a network interface to communicate with NDAS core.
- sal_netdev_close - Close the network interface will not be used.
- sal_netdev_register_proto - Hook the handler if a packet comes to the interface.
- sal_netdev_unregister_proto - Unhook the handler
- sal_net_alloc_platform_buf - Get the system network packet to load the NDAS network packet.
- sal_net_free_platform_buf - Return the packet memory that will not be used.
- sal_ether_send - Send out the packet through the network interface.
- sal_sock_create - Open a socket to communicate to the NetDisk.
- sal_sock_destroy - Close the socket.
String/Binary
sal_strcpy, sal_strcat, sal_memcpy, sal_memset funtions should be implemented.
Because the NDAS core doens't have the dependency, these functions (which can be optimized by the platform specific implementation) should be implemented for each platform.
These functions of the linux version are implemented using the FreeBSD source code under BSD style license.
Debugging
- sal_debug_print - print the messages by debugging build of NDAS core. (optional)
- sal_error_print - print the messages by production build and debugging build of NDAS core.
