]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - psdk_cust/pdk_k2g_1_0_1_0_eng/packages/ti/board/diag/common/AM335x/diag_osal.c
PASDK-258:Update PDK eng to 1.0.1.1. Using build number to differentiate PDK eng...
[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_0_eng / packages / ti / board / diag / common / AM335x / diag_osal.c
1 /**
2  *   @file  GPIO_osal.c
3  *
4  *   @brief
5  *      This is the OS abstraction layer and is used by the GPIO application.
6  *
7  *  \par
8  */
10 /*
11  * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  *
17  * Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  *
20  * Redistributions in binary form must reproduce the above copyright
21  * notice, this list of conditions and the following disclaimer in the
22  * documentation and/or other materials provided with the
23  * distribution.
24  *
25  * Neither the name of Texas Instruments Incorporated nor the names of
26  * its contributors may be used to endorse or promote products derived
27  * from this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  */
43 #ifndef COMMON_OSAL_PROTOTYPE
44 #define COMMON_OSAL_PROTOTYPE
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <stdint.h>
49 #include <ti/drv/uart/src/UART_osal.h>
50 //#include <ti/drv/spi/SPI_osal.h>
52 #define OSAL_OK 0
53 /**********************************************************************
54  ************************** Local Definitions *************************
55  **********************************************************************/
58 /**********************************************************************
59  ************************** Global Variables **************************
60  **********************************************************************/
62 /**********************************************************************
63  **************************** OSAL Functions **************************
64  **********************************************************************/
67 /**
68  *  @b Description
69  *  @n
70  *      The function is used to create a critical section.
71  *
72  *    *  @param[in]  count
73  *      Semaphore count value
74  *
75  *    *  @param[in]  params
76  *
77  *  @retval
78  *      Semaphore Handle created
79  */
80 //void* SemOSAL_create(unsigned int count,SemOSAL_Params *params)
81 //{
82 //      return (void *) -1;
83 //}
85 /**
86  *  @b Description
87  *  @n
88  *      The function is used to delete a critical section.
89  *
90  *  @param[in]  semHandle
91  *      Semaphore handle to be deleted
92  *
93  *  @retval
94  *      Not Applicable
95  */
96 int SemOSAL_delete(void* handle)
97 {
98         return 0;
99 }
102 /*!
103  *  @brief  Initialize params structure to default values.
104  *
105  *  The default parameters are:
106  *   - mode: SemOSAL_Mode_COUNTING
107  *   - name: NULL
108  *
109  *  @param params  Pointer to the instance configuration parameters.
110  */
111 //void SemOSAL_Params_init(SemOSAL_Params *params)
112 //{
113 //}
115 /*!
116  *  @brief  Function to pend (wait) on a semaphore.
117  *
118  *  @param  handle  A SemOSAL_Handle returned from ::SemOSAL_create
119  *
120  *  @param  timeout Timeout (in milliseconds) to wait for the semaphore to
121  *                  be posted (signalled).
122  *
123  *  @return Status of the functions
124  *    - OSAL_OK: Obtain the semaphore
125  *    - OSAL_TIMEOUT: Timed out. Semaphore was not obtained.
126  */
127 int SemOSAL_pend(void* handle,unsigned int timeout)
129     return (OSAL_OK);
132 /*!
133  *  @brief  Function to post (signal) a semaphore.
134  *
135  *  @param  handle  A SemOSAL_Handle returned from ::SemOSAL_create
136  *
137  *  @return Status of the functions
138  *    - OSAL_OK: Released the semaphore
139  */
140 int SemOSAL_post(void* semHandle)
142     return (OSAL_OK);
145 /*!
146  *  @brief  Function to disable interrupts to enter a critical region
147  *
148  *  TODO more details
149  *
150  *  @return todo key
151  */
152 int HwiOSAL_enterCritical()
154    return(0);
157 /*!
158  *  @brief  Function to restore interrupts to exit a critical region
159  *
160  *  TODO more details
161  *
162  *  @param  key
163  */
164 void HwiOSAL_exitCritical(int key)
168 /*!
169  *  @brief  Function to deregister a interrupt
170  *
171  *  TODO more detail
172  *
173  *  @param  hwiPtr
174  *
175  *  @return
176  */
178 int HwiOSAL_deregisterInterrupt(void* hwiPtr)
180     return (OSAL_OK);
184 /*!
185  *  @brief  Function to register an interrupt
186  *
187  *  TODO more detail
188  *
189  *  @param  interruptNum
190  *
191  *  @param  eventID
192  *
193  *  @param  entry entry function of the hardware interrupt
194  *
195  *  @param  arg  argument passed into hte entry function
196  *
197  *  @param  priority
198  *
199  *  @return
200  */
201 #if 0
202 void* HwiOSAL_registerInterrupt(int intNum,
203                                     int eventID,
204                                     HwiOSAL_EntryFxn entry,
205                                     void* arg,
206                                     unsigned char priority)
208         return (void *) -1;
210 #endif
211 /**
212  *  @b Description
213  *  @n
214  *      The function is used to disable specific hardware interrupt.
215  *
216  *  @param[in]  intrNum  number of hardware interrupt which should be disabled.
217  *
218  *  @retval
219  *      Not Applicable
220  */
221 void HwiOSAL_disableInterrupt(unsigned int intrNum)
225 /**
226  *  @b Description
227  *  @n
228  *      The function is used to enable specific hardware interrupt.
229  *
230  *  @param[in]  intrNum  number of hardware interrupt which should be enabled.
231  *
232  *  @retval
233  *      Not Applicable
234  */
235 void HwiOSAL_enableInterrupt(unsigned int intrNum)
240 /*!
241  *  @brief  Debug log function with 1 parameters
242  *
243  *  TODO more detail
244  *
245  *  @param  format "printf" format string
246  *  @param  p1 first parameter to format string
247  */
248 void UART_log1(const char *format, unsigned int p1)
253 /*!
254  *  @brief  Debug log function with 2 parameters
255  *
256  *  TODO more detail
257  *
258  *  @param  format "printf" format string
259  *  @param  p1 first parameter to format string
260  *  @param  p2 second parameter to format string
261  */
262 void UART_log2(const char *format, unsigned int p1, unsigned int p2)
266 /*!
267  *  @brief  Debug log function with 3 parameters
268  *
269  *  TODO more detail
270  *
271  *  @param  format "printf" format string
272  *  @param  p1 first parameter to format string
273  *  @param  p2 second parameter to format string
274  *  @param  p3 third parameter to format string
275  */
276 void UART_log3(const char *format, unsigned int p1, unsigned int p2, unsigned int p3)
281 /**
282  *  @b Description
283  *  @n
284  *      The function is used to create a critical section.
285  *
286  *    *  @param[in]  count
287  *      Semaphore count value
288  *
289  *    *  @param[in]  params
290  *
291  *  @retval
292  *      Semaphore Handle created
293  */
295 /*
296  *  ======== SemaphoreP_create ========
297  */
298 SemaphoreP_Handle SemaphoreP_create(uint32_t count,
299                                     SemaphoreP_Params *params)
301     return NULL;
304 /**
305  *  @b Description
306  *  @n
307  *      The function is used to delete a critical section.
308  *
309  *  @param[in]  semHandle
310  *      Semaphore handle to be deleted
311  *
312  *  @retval
313  *      Not Applicable
314  */
315 /*
316  *  ======== SemaphoreP_delete ========
317  */
318 SemaphoreP_Status SemaphoreP_delete(SemaphoreP_Handle handle)
320     return (SemaphoreP_OK);
324 /*!
325  *  @brief  Initialize params structure to default values.
326  *
327  *  The default parameters are:
328  *   - mode: SemOSAL_Mode_COUNTING
329  *   - name: NULL
330  *
331  *  @param params  Pointer to the instance configuration parameters.
332  */
334 /*
335  *  ======== SemaphoreP_Params_init ========
336  */
337 void SemaphoreP_Params_init(SemaphoreP_Params *params)
341 /*!
342  *  @brief  Function to pend (wait) on a semaphore.
343  *
344  *  @param  handle  A SemOSAL_Handle returned from ::SemOSAL_create
345  *
346  *  @param  timeout Timeout (in milliseconds) to wait for the semaphore to
347  *                  be posted (signalled).
348  *
349  *  @return Status of the functions
350  *    - OSAL_OK: Obtain the semaphore
351  *    - OSAL_TIMEOUT: Timed out. Semaphore was not obtained.
352  */
353 /*
354  *  ======== SemaphoreP_pend ========
355  */
356 SemaphoreP_Status SemaphoreP_pend(SemaphoreP_Handle handle, uint32_t timeout)
358     return (SemaphoreP_OK);
361 /*!
362  *  @brief  Function to post (signal) a semaphore.
363  *
364  *  @param  handle  A SemOSAL_Handle returned from ::SemOSAL_create
365  *
366  *  @return Status of the functions
367  *    - OSAL_OK: Released the semaphore
368  */
369 /*
370  *  ======== SemaphoreP_post ========
371  */
372 SemaphoreP_Status SemaphoreP_post(SemaphoreP_Handle handle)
374     return (SemaphoreP_OK);
377 /*!
378  *  @brief  Function to disable interrupts to enter a critical region
379  *
380  *  TODO more details
381  *
382  *  @return todo key
383  */
384 /*
385  *  ======== HwiP_disable ========
386  */
387 uintptr_t HwiP_disable(void)
389     return 0;
392 /*!
393  *  @brief  Function to restore interrupts to exit a critical region
394  *
395  *  TODO more details
396  *
397  *  @param  key
398  */
399 /*
400  *  ======== HwiP_restore ========
401  */
402 void HwiP_restore(uintptr_t key)
406 /*!
407  *  @brief  Function to deregister a interrupt
408  *
409  *  TODO more detail
410  *
411  *  @param  hwiPtr
412  *
413  *  @return
414  */
416 /*
417  *  ======== HwiP_delete ========
418  */
419 HwiP_Status HwiP_delete(HwiP_Handle handle)
421     return (HwiP_OK);
424 /**
425  *  @b Description
426  *  @n
427  *      The function is used to disable specific hardware interrupt.
428  *
429  *  @param[in]  intrNum  number of hardware interrupt which should be disabled.
430  *
431  *  @retval
432  *      Not Applicable
433  */
434 /*
435  *  ======== HwiP_disableInterrupt ========
436  */
437 void HwiP_disableInterrupt(int32_t interruptNum)
441 /**
442  *  @b Description
443  *  @n
444  *      The function is used to enable specific hardware interrupt.
445  *
446  *  @param[in]  intrNum  number of hardware interrupt which should be enabled.
447  *
448  *  @retval
449  *      Not Applicable
450  */
451 /*
452  *  ======== HwiP_enableInterrupt ========
453  */
454 void HwiP_enableInterrupt(int32_t interruptNum)
458 void HwiP_Params_init(HwiP_Params *params)
462 HwiP_Handle HwiP_create(int32_t interruptNum, HwiP_Fxn hwiFxn,
463                         HwiP_Params *params)
465     return (void *) -1;
468 void _DebugP_assert(int32_t expression, const char *file, int32_t line)
470   if (expression)
471      while (1);
473 #endif  /* COMMON_OSAL_PROTOTYPE */