| 111 | A MWMR communication channel is a memory buffer handled as a software FIFO that can have several producers and several consumers. Each channel is protected by an implicit lock for exclusive access. Any MWMR transaction |
| 112 | can be decomposed in five memory access: |
| 113 | 1. get the lock protecting the MWMR (READ access). |
| 114 | 1. test the status of the MWMR (READ access). |
| 115 | 1. transfer a burst of data between a local buffer and the MWMR (READ/WRITE access). |
| 116 | 1. update the status of the MWMR (WRITE access). |
| 117 | 1. release the lock (WRITE access). |
| 118 | |
| 119 | Any data transfer to or from a MWMR channel mut be an integer number of items. The item width is an |
| 120 | intrinsic property of the channel. It is defined as a number of bytes, and it defines the channel ''width''. |
| 121 | The channel ''depth'' is a number of items, and defines the total channel capacity. |
| 122 | For performances reasons the channel ''width'' itself must be a multiple of 4 bytes. |
| 123 | {{{ |
| 124 | My_Channel = Mwmr( 'channel_name', width, depth ) |
| 125 | }}} |
| 126 | In the mapping section of the DSX/L program, the 4 following software objects must be placed : |
| 127 | 1. ''desc'' : read only informations regarding the communication channel |
| 128 | 1. ''status'' : channel state (number of stored items, read & write pointers) |
| 129 | 1. ''buffer'' : channel buffer containing the data |
| 130 | 1. ''lock'' : lock protecting exclusive access |
| 131 | |
110 | | === C4) Synchronization lock definition === |
111 | | |
112 | | === C5) Signal definition === |
113 | | |
114 | | === C6) Task instanciation === |
| 134 | The synchronization barriers can be used when the synchronization through the data availability in |
| 135 | the MWMR communication channels in not enough. The set of tasks that are linked to a given barrier |
| 136 | is defined when the the tasks are intanciated. Exclusive access to the barrier is protected by an implicit lock. |
| 137 | {{{ |
| 138 | My_Barrier = Barrier( 'barrier_name' ) |
| 139 | }}} |
| 140 | In the mapping section of the DSX/L program, the 3 following software objects must be placed : |
| 141 | 1. ''desc'' : read only informations regarding the synchronization barrier |
| 142 | 1. ''status'' : barrier state |
| 143 | 1. ''lock'' : lock protecting exclusive access |
| 144 | |
| 145 | === C4) Memspace definition |
| 146 | |
| 147 | Direct communication through shared memory buffers is supported by DSX, but there is no protection mechanism, and the synchronization is the programmer responsability. |
| 148 | A shared memory space is defined by two parameters : ''memspace_name'' is the name, and ''size'' defines |
| 149 | the number of bytes to be reserved. |
| 150 | {{{ |
| 151 | My_Shared_Buffer = Memspave( ''memspace_name', size ) |
| 152 | }}} |
| 153 | In the mapping section of the DSX/L program, the 2 following software objects must be placed : |
| 154 | 1. ''desc'' : read only informations regarding the memspace |
| 155 | 1. ''mem'' : the shared memory buffer |
| 156 | |
| 157 | === C5) lock definition === |
| 158 | |
| 159 | A lock is a variable that can be used to protect exclusive access to a shared resource such as a shared |
| 160 | memory space. It is implemented as a spinlock : the ''srl_lock_lock()'' funtion returns only when the lock |
| 161 | has been obtained. |
| 162 | {{{ |
| 163 | My_Lock = Lock( 'lock_name' ) |
| 164 | }}} |
| 165 | In the mapping section of the DSX/L program, the lock can be explicitely placed in the memory space. |
| 166 | |
| 167 | === C6) Signal definition === |
| 168 | |
| 169 | The DSX signals are used to signal a special event that is not synchronized with the data. The signal is transmitted |
| 170 | to all registered tasks. The tasks are interrupted to execute the corresponding signal handler. Signals are mainlly |
| 171 | used to implement soft real time constraints, a task can receive a signal, but cannot send a signal. |
| 172 | {{{ |
| 173 | My_signal = Signal( 'signal_name' ) |
| 174 | }}} |
| 175 | There is nothing to place in the mapping section. |
| 176 | |
| 177 | === C7) Task instanciation === |
| 178 | |
| 179 | A task is an instance of a task model. The constructor arguments are the task name ''task_name'', the task model |
| 180 | ''Task_Model'' (created by the TaskModel() function), a list of resources (MWMR channels, synchronization barriers, |
| 181 | locks or memspaces), and the list of the signals that can be received by the task . DSX performs type checking between the port name and the associated resource. |
| 182 | {{{ |
| 183 | My_Task = Task( 'task_name', |
| 184 | Task_Model , |
| 185 | { 'port_name' : My_Channel, 'barrier_name' : My_Barrier, ... } , |
| 186 | { 'signal_name : My_signal, ... } ) |
| 187 | }}} |
| 188 | In the mapping section of the DSX/L program, 4 software objects must be placed : |
| 189 | 1. ''desc'' : read-only informations associated to the task |
| 190 | 1. ''status'' : state of the task |
| 191 | 1. ''stack'' : execution stack |
| 192 | 1. ''run'' : processor running the task |
| 193 | |
| 194 | A task that has real time constraints must be instanciated by a special constructor. |
| 195 | There is two extra arguments : ''cond_activate'' is the signal definig the activation condition, and ''cond_deadline'' |
| 196 | is the signal defining the dead_line condition. |
| 197 | {{{ |
| 198 | My_RT_Task = RtTask( 'task_name', |
| 199 | Task_Model , |
| 200 | { 'port_name' : My_Channel, 'barrier_name' : My_Barrier, ... } , |
| 201 | { 'signal_name : My_signal, ... } , |
| 202 | cond_activate , |
| 203 | cond_deadline ) |
| 204 | }}} |
| 205 | |