fci_oal.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*****************************************************************************
  2. Copyright(c) 2013 FCI Inc. All Rights Reserved
  3. File name : fci_oal.c
  4. Description : source of OS adaptation layer
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. History :
  17. ----------------------------------------------------------------------
  18. *******************************************************************************/
  19. #include <linux/kernel.h>
  20. #include <linux/delay.h>
  21. #include <linux/uaccess.h>
  22. #include <linux/mutex.h>
  23. #include "fci_types.h"
  24. static struct mutex isdbt_lock;
  25. void print_log(HANDLE handle, s8 *fmt, ...)
  26. {
  27. va_list ap;
  28. char str[256];
  29. memset(&str[0], 0, sizeof(str));
  30. va_start(ap, fmt);
  31. vsprintf(str, fmt, ap);
  32. printk(KERN_ERR"%s", str);
  33. va_end(ap);
  34. }
  35. void msWait(s32 ms)
  36. {
  37. mdelay(ms);
  38. }
  39. /* Write your own mutual exclusion method */
  40. void OAL_CREATE_SEMAPHORE(void)
  41. {
  42. mutex_init(&isdbt_lock);
  43. }
  44. void OAL_DELETE_SEMAPHORE(void)
  45. {
  46. mutex_destroy(&isdbt_lock);
  47. }
  48. void OAL_OBTAIN_SEMAPHORE(void)
  49. {
  50. mutex_lock(&isdbt_lock);
  51. }
  52. void OAL_RELEASE_SEMAPHORE(void)
  53. {
  54. mutex_unlock(&isdbt_lock);
  55. }