![]() |
![]() |
This is the sample OS Adaptation layer which is used by the MCBSP driver. The OSAL layer can be ported in either of the following manners to a native OS: More...
#include <string.h>#include <ti/drv/mcbsp/mcbsp_drv.h>Defines | |
| #define | Mcbsp_osalCreateSem() Osal_mcbspCreateSem() |
| The macro is used by the MCBSP driver to create a semaphore for each MCBSP socket opened in blocking mode. Semaphores created should *initially* be created with a count of 0 i.e. unavailable. | |
| #define | Mcbsp_osalDeleteSem(X) Osal_mcbspDeleteSem(X) |
| The macro is used by the MCBSP driver to delete a previously created semaphore. This is called when a MCBSP socket opened in blocking mode is being closed. | |
| #define | Mcbsp_osalPendSem(X) Osal_mcbspPendSem(X) |
| The macro is used by the MCBSP driver to pend on a semaphore This is called when an application tries to receive data on a blocking socket when there is no data available. Since all semaphores are initially created to be unavailable; this will cause the application to block. | |
| #define | Mcbsp_osalPostSem(X) Osal_mcbspPostSem(X) |
| The macro is used by the MCBSP driver to post the semaphore The driver posts the semaphore once data is received on a specific socket. | |
| #define | Mcbsp_osalMalloc(X) Osal_mcbspMalloc(X) |
| The macro is used by the MCBSP driver to allocate memory The MCBSP driver uses this macro to allocate memory for its internal driver structures. This is invoked during the driver initialization and startup process. | |
| #define | Mcbsp_osalFree(X, Y) Osal_mcbspFree(X, Y) |
| The macro is used by the MCBSP driver to free a previously allocated block of memory. | |
| #define | Mcbsp_osalDataBufferMalloc(X) Osal_mcbspDataBufferMalloc(X) |
| The macro is used by the MCBSP driver to allocate memory for the data buffers in Driver Managed Configuration. All data buffers should allocated should be in the global address space. This macro is invoked during the data path. | |
| #define | Mcbsp_osalDataBufferFree(X, Y) Osal_mcbspDataBufferFree(X, Y) |
| The macro is used by the MCBSP driver to free a previously allocated block data buffer. This macro is used to clean up previously allocated data buffers and is invoked during the data path. | |
| #define | Mcbsp_osalLog Osal_mcbspLog |
| The macro is used by the MCBSP driver to log various messages. | |
| #define | Mcbsp_osalEnterMultipleCoreCriticalSection Osal_mcbspEnterMultipleCoreCriticalSection |
| The macro is used by the MCBSP Driver to protect its shared resources access from MULTIPLE CORES. This is required if the MCBSP Driver API's are being invoked from multiple cores. If this is not the case then these macros can be defined to be NOP. | |
| #define | Mcbsp_osalExitMultipleCoreCriticalSection Osal_mcbspExitMultipleCoreCriticalSection |
| The macro is used by the MCBSP driver to end the protection of its internal shared "resources" from MULTIPLE CORE access. | |
| #define | Mcbsp_osalEnterSingleCoreCriticalSection Osal_mcbspEnterSingleCoreCriticalSection |
| The macro is used by the MCBSP driver to protect its internal shared resources from SINGLE CORE MULTIPLE CONTEXT (thread or ISR) access. If all the MCBSP Driver APIs are being called from threads then this API could use semaphores. However if the MCBSP driver API's are being called from both ISR & Thread context then the critical section here would need to disable/enable interrupts. | |
| #define | Mcbsp_osalExitSingleCoreCriticalSection Osal_mcbspExitSingleCoreCriticalSection |
| The macro is used to denote the end of the protection of the internal shared resource from SINGLE CORE MULTIPLE CONTEXT access. | |
| #define | Mcbsp_osalBeginMemAccess Osal_mcbspBeginMemAccess |
| The macro is used by the MCBSP driver to indicate that a block of memory is about to be accessed. If the memory block is cached then this indicates that the application would need to ensure that the cache is updated with the data from the actual memory. | |
| #define | Mcbsp_osalEndMemAccess Osal_mcbspEndMemAccess |
| The macro is used by the MCBSP driver to indicate that the block of memory has finished being accessed. If the memory block is cached then the application would need to ensure that the contents of the cache are updated immediately to the actual memory. | |
| #define | Mcbsp_osalQueueEmpty Osal_mcbspQueueEmpty |
| The macro is used by the MCBSP driver to test for an empty queue. | |
| #define | Mcbsp_osalQueueGet Osal_mcbspQueueGet |
| The macro is used by the MCBSP driver to get an element from the front of queue. The function removes the element from the front of queue and returns a pointer to it. | |
| #define | Mcbsp_osalQueuePut Osal_mcbspQueuePut |
| The macro is used by the MCBSP driver to put an element at the end of queue. | |
| #define | Mcbsp_osalWaitNBitClocks Osal_mcbspWaitNBitClocks |
| The macro is used by the MCBSP driver to wait 'n' bit clocks to ensure proper synchronization internally. | |
This is the sample OS Adaptation layer which is used by the MCBSP driver. The OSAL layer can be ported in either of the following manners to a native OS:
Approach 1:
Use Prebuilt Libraries
Approach 2:
Rebuilt Library
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.