1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 /**************************************************************************/
12 /**************************************************************************/
13 /**                                                                       */
14 /** Thread-Metric Component                                               */
15 /**                                                                       */
16 /**   Porting Layer (Must be completed with RTOS specifics)               */
17 /**                                                                       */
18 /**************************************************************************/
19 /**************************************************************************/
20 
21 
22 /* Include necessary files.  */
23 
24 #include    "tm_api.h"
25 
26 
27 /* This function called from main performs basic RTOS initialization,
28    calls the test initialization function, and then starts the RTOS function.  */
tm_initialize(void (* test_initialization_function)(void))29 void  tm_initialize(void (*test_initialization_function)(void))
30 {
31 
32 }
33 
34 
35 /* This function takes a thread ID and priority and attempts to create the
36    file in the underlying RTOS.  Valid priorities range from 1 through 31,
37    where 1 is the highest priority and 31 is the lowest. If successful,
38    the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned.   */
tm_thread_create(int thread_id,int priority,void (* entry_function)(void))39 int  tm_thread_create(int thread_id, int priority, void (*entry_function)(void))
40 {
41 
42 }
43 
44 
45 /* This function resumes the specified thread.  If successful, the function should
46    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_thread_resume(int thread_id)47 int  tm_thread_resume(int thread_id)
48 {
49 
50 }
51 
52 
53 /* This function suspends the specified thread.  If successful, the function should
54    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_thread_suspend(int thread_id)55 int  tm_thread_suspend(int thread_id)
56 {
57 
58 }
59 
60 
61 /* This function relinquishes to other ready threads at the same
62    priority.  */
tm_thread_relinquish(void)63 void tm_thread_relinquish(void)
64 {
65 
66 }
67 
68 
69 /* This function suspends the specified thread for the specified number
70    of seconds.  If successful, the function should return TM_SUCCESS.
71    Otherwise, TM_ERROR should be returned.  */
tm_thread_sleep(int seconds)72 void tm_thread_sleep(int seconds)
73 {
74 
75 }
76 
77 
78 /* This function creates the specified queue.  If successful, the function should
79    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_queue_create(int queue_id)80 int  tm_queue_create(int queue_id)
81 {
82 
83 }
84 
85 
86 /* This function sends a 16-byte message to the specified queue.  If successful,
87    the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_queue_send(int queue_id,unsigned long * message_ptr)88 int  tm_queue_send(int queue_id, unsigned long *message_ptr)
89 {
90 
91 }
92 
93 
94 /* This function receives a 16-byte message from the specified queue.  If successful,
95    the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_queue_receive(int queue_id,unsigned long * message_ptr)96 int  tm_queue_receive(int queue_id, unsigned long *message_ptr)
97 {
98 
99 }
100 
101 
102 /* This function creates the specified semaphore.  If successful, the function should
103    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_semaphore_create(int semaphore_id)104 int  tm_semaphore_create(int semaphore_id)
105 {
106 
107 }
108 
109 
110 /* This function gets the specified semaphore.  If successful, the function should
111    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_semaphore_get(int semaphore_id)112 int  tm_semaphore_get(int semaphore_id)
113 {
114 
115 }
116 
117 
118 /* This function puts the specified semaphore.  If successful, the function should
119    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_semaphore_put(int semaphore_id)120 int  tm_semaphore_put(int semaphore_id)
121 {
122 
123 }
124 
125 
126 /* This function creates the specified memory pool that can support one or more
127    allocations of 128 bytes.  If successful, the function should
128    return TM_SUCCESS. Otherwise, TM_ERROR should be returned.  */
tm_memory_pool_create(int pool_id)129 int  tm_memory_pool_create(int pool_id)
130 {
131 
132 }
133 
134 
135 /* This function allocates a 128 byte block from the specified memory pool.
136    If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR
137    should be returned.  */
tm_memory_pool_allocate(int pool_id,unsigned char ** memory_ptr)138 int  tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr)
139 {
140 
141 }
142 
143 
144 /* This function releases a previously allocated 128 byte block from the specified
145    memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR
146    should be returned.  */
tm_memory_pool_deallocate(int pool_id,unsigned char * memory_ptr)147 int  tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr)
148 {
149 
150 }
151 
152 
153