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 *****************************************************************************/ 12 #include <linux/types.h> 13 #include "csr_time.h" 14 15 /* An identifier issued by the scheduler. */ 16 typedef u32 CsrSchedIdentifier; 17 18 /* A task identifier */ 19 typedef u16 CsrSchedTaskId; 20 21 /* A queue identifier */ 22 typedef u16 CsrSchedQid; 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 31 /* Time constants. */ 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) 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 */ 45 typedef u16 CsrSchedBgint; 46 #define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF) 47 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 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. 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, 74 u16 mi, 75 void *mv, 76 u32 line, 77 const char *file); 78 #define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) 79 #else 80 void CsrSchedMessagePut(CsrSchedQid q, 81 u16 mi, 82 void *mv); 83 #endif 84 85 #endif 86