Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | #ifndef CSR_SCHED_H__ |
2 | #define CSR_SCHED_H__ | |
3 | /***************************************************************************** | |
4 | ||
5 | (c) Cambridge Silicon Radio Limited 2010 | |
6 | All rights reserved and confidential information of CSR | |
7 | ||
8 | Refer to LICENSE.txt included with this source for details | |
9 | on the license terms. | |
10 | ||
11 | *****************************************************************************/ | |
980b5a2b | 12 | #include <linux/types.h> |
635d2b00 GKH |
13 | #include "csr_time.h" |
14 | ||
635d2b00 | 15 | /* An identifier issued by the scheduler. */ |
26a6b2e1 | 16 | typedef u32 CsrSchedIdentifier; |
635d2b00 GKH |
17 | |
18 | /* A task identifier */ | |
8c87f69a | 19 | typedef u16 CsrSchedTaskId; |
635d2b00 GKH |
20 | |
21 | /* A queue identifier */ | |
8c87f69a | 22 | typedef u16 CsrSchedQid; |
635d2b00 GKH |
23 | |
24 | /* A message identifier */ | |
25 | typedef CsrSchedIdentifier CsrSchedMsgId; | |
26 | ||
27 | /* A timer event identifier */ | |
28 | typedef CsrSchedIdentifier CsrSchedTid; | |
29 | #define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0) | |
30 | ||
635d2b00 | 31 | /* Time constants. */ |
aad3d31f DN |
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) | |
635d2b00 GKH |
36 | |
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 | |
41 | ||
42 | /* | |
43 | * Background interrupt definitions | |
44 | */ | |
8c87f69a | 45 | typedef u16 CsrSchedBgint; |
635d2b00 GKH |
46 | #define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF) |
47 | ||
635d2b00 GKH |
48 | /*----------------------------------------------------------------------------* |
49 | * NAME | |
50 | * CsrSchedMessagePut | |
51 | * | |
52 | * DESCRIPTION | |
53 | * Sends a message consisting of the integer "mi" and the void * pointer | |
54 | * "mv" to the message queue "q". | |
55 | * | |
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 | |
58 | * be null. | |
59 | * | |
60 | * NOTE | |
786eeeb3 | 61 | * If "mv" is not null then it will typically be a chunk of kmalloc()ed |
635d2b00 | 62 | * memory, though there is no need for it to be so. Tasks should normally |
786eeeb3 | 63 | * obey the convention that when a message built with kmalloc()ed memory |
635d2b00 GKH |
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 | |
55a27055 | 66 | * the message will be expected to kfree() the message storage. |
635d2b00 GKH |
67 | * |
68 | * RETURNS | |
69 | * void. | |
70 | * | |
71 | *----------------------------------------------------------------------------*/ | |
72 | #if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) | |
73 | void CsrSchedMessagePutStringLog(CsrSchedQid q, | |
8c87f69a | 74 | u16 mi, |
635d2b00 | 75 | void *mv, |
26a6b2e1 | 76 | u32 line, |
c781b96b | 77 | const char *file); |
635d2b00 GKH |
78 | #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) |
79 | #else | |
80 | void CsrSchedMessagePut(CsrSchedQid q, | |
8c87f69a | 81 | u16 mi, |
635d2b00 GKH |
82 | void *mv); |
83 | #endif | |
84 | ||
635d2b00 | 85 | #endif |