blob: 086438feb8124c32cfe77fe0fae23f62ccceaf23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*****************************************************************************
(c) Cambridge Silicon Radio Limited 2010
All rights reserved and confidential information of CSR
Refer to LICENSE.txt included with this source for details
on the license terms.
*****************************************************************************/
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/freezer.h>
#include <linux/semaphore.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include "csr_framework_ext.h"
#include "csr_panic.h"
/*----------------------------------------------------------------------------*
* NAME
* CsrMutexCreate
*
* DESCRIPTION
* Create a mutex and return a handle to the created mutex.
*
* RETURNS
* Possible values:
* CSR_RESULT_SUCCESS in case of success
* CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources
* CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid
*
*----------------------------------------------------------------------------*/
CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle)
{
if (mutexHandle == NULL)
{
return CSR_FE_RESULT_INVALID_POINTER;
}
sema_init(mutexHandle, 1);
return CSR_RESULT_SUCCESS;
}
/*----------------------------------------------------------------------------*
* NAME
* CsrMutexDestroy
*
* DESCRIPTION
* Destroy the previously created mutex.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrMutexDestroy(CsrMutexHandle *mutexHandle)
{
}
/*----------------------------------------------------------------------------*
* NAME
* CsrThreadSleep
*
* DESCRIPTION
* Sleep for a given period.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrThreadSleep(u16 sleepTimeInMs)
{
unsigned long t;
/* Convert t in ms to jiffies and round up */
t = ((sleepTimeInMs * HZ) + 999) / 1000;
schedule_timeout_uninterruptible(t);
}
EXPORT_SYMBOL_GPL(CsrThreadSleep);
|