3 /*****************************************************************************
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
8 Refer to LICENSE.txt included with this source for details
11 *****************************************************************************/
12 #include <linux/types.h>
15 /* An identifier issued by the scheduler. */
16 typedef u32 CsrSchedIdentifier;
18 /* A task identifier */
19 typedef u16 CsrSchedTaskId;
21 /* A queue identifier */
22 typedef u16 CsrSchedQid;
24 /* A message identifier */
25 typedef CsrSchedIdentifier CsrSchedMsgId;
27 /* A timer event identifier */
28 typedef CsrSchedIdentifier CsrSchedTid;
29 #define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0)
32 #define CSR_SCHED_TIME_MAX (0xFFFFFFFF)
33 #define CSR_SCHED_MILLISECOND (1000)
34 #define CSR_SCHED_SECOND (1000 * CSR_SCHED_MILLISECOND)
35 #define CSR_SCHED_MINUTE (60 * CSR_SCHED_SECOND)
37 /* Queue and primitive that identifies the environment */
38 #define CSR_SCHED_TASK_ID 0xFFFF
39 #define CSR_SCHED_PRIM (CSR_SCHED_TASK_ID)
40 #define CSR_SCHED_EXCLUDED_MODULE_QUEUE 0xFFFF
43 * Background interrupt definitions
45 typedef u16 CsrSchedBgint;
46 #define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF)
48 /*----------------------------------------------------------------------------*
53 * Sends a message consisting of the integer "mi" and the void * pointer
54 * "mv" to the message queue "q".
56 * "mi" and "mv" are neither inspected nor changed by the scheduler - the
57 * task that owns "q" is expected to make sense of the values. "mv" may
61 * If "mv" is not null then it will typically be a chunk of kmalloc()ed
62 * memory, though there is no need for it to be so. Tasks should normally
63 * obey the convention that when a message built with kmalloc()ed memory
64 * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the
65 * scheduler - and eventually to the recipient task. I.e., the receiver of
66 * the message will be expected to kfree() the message storage.
71 *----------------------------------------------------------------------------*/
72 #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
73 void CsrSchedMessagePutStringLog(CsrSchedQid q,
78 #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__)
80 void CsrSchedMessagePut(CsrSchedQid q,