Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033 #ifndef _TOMP_QMSS_H_
00034 #define _TOMP_QMSS_H_
00035
00036 #include <stdbool.h>
00037 #include <stdint.h>
00038
00039
00040 #include <ti/drv/qmss/qmss_drv.h>
00041
00042 #include "tomp_defs.h"
00043 #include "tomp_log.h"
00044
00045 typedef Qmss_QueueHnd tomp_queue_t;
00046 typedef void* tomp_event_t;
00047
00049 typedef struct
00050 {
00051 tomp_queue_t implicitTaskQ;
00052 tomp_queue_t exitQ;
00053 tomp_queue_t freeDescriptorQ;
00054 uint32_t numExplicitTaskQ;
00055 tomp_queue_t explicitTaskQ[TOMP_DEVICE_NUM_CORES];
00056 } tomp_Queues;
00057
00058
00059 extern tomp_Queues tomp_queues;
00060 extern Qmss_MemRegInfo tomp_qmssMemRegInfo;
00061
00062
00063 bool tomp_initGlobalNRT (bool memRegionInitialized);
00064 void tomp_exitGlobalNRT (void);
00065 bool tomp_initLocalNRT (void);
00066
00067 tomp_queue_t tomp_queueOpen (int32_t qid);
00068
00069
00076 static inline tomp_event_t tomp_eventAlloc(void)
00077 {
00078
00079
00080 return (tomp_event_t)QMSS_DESC_PTR(
00081 Qmss_queuePop(tomp_queues.freeDescriptorQ));
00082 }
00083
00084
00094 static inline tomp_event_t tomp_eventAllocChecked(size_t size,
00095 const char *file, int line)
00096 {
00097 #if defined (TOMP_CHECK_LEVEL) && (TOMP_CHECK_LEVEL > 0)
00098 if (size > TOMP_EVENT_BUF_SIZE)
00099 tomp_logError(tomp_ErrorKind_EM_ALLOC_SIZE, file, line);
00100 #endif
00101
00102 tomp_event_t event = tomp_eventAlloc();
00103 if (!event)
00104 tomp_logError(tomp_ErrorKind_NULL_PTR, file, line);
00105
00106 return event;
00107 }
00108
00109
00115 static inline void tomp_eventFree(tomp_event_t event)
00116 {
00117 Qmss_queuePushDesc (tomp_queues.freeDescriptorQ, event);
00118 return;
00119 }
00120
00121
00128 static inline void tomp_eventPush(tomp_queue_t qHnd, tomp_event_t event)
00129 {
00130 Qmss_queuePushDesc (qHnd, event);
00131 }
00132
00133
00140 static inline void tomp_eventPushToHead(tomp_queue_t qHnd, tomp_event_t event)
00141 {
00142 Qmss_queuePush(qHnd, event, 0, TOMP_EVENT_BUF_SIZE, Qmss_Location_HEAD);
00143 return;
00144 }
00145
00146
00153 static inline tomp_event_t tomp_eventPop(tomp_queue_t qHnd)
00154 {
00155
00156
00157 return (tomp_event_t)QMSS_DESC_PTR(Qmss_queuePop(qHnd));
00158 }
00159
00160
00166 static inline void* tomp_event_pointer(tomp_event_t event)
00167 {
00168 return event;
00169 }
00170
00171 #endif