old mode 100644new mode 100755.. | .. |
---|
23 | 23 | #include "ipc_compat.h" |
---|
24 | 24 | #endif |
---|
25 | 25 | |
---|
26 | | -/* |
---|
27 | | - * ENUMERATION |
---|
28 | | - ****************************************************************************** |
---|
29 | | - */ |
---|
30 | | - |
---|
31 | | -enum ipc_host_desc_status { |
---|
32 | | - /// Descriptor is IDLE |
---|
33 | | - IPC_HOST_DESC_IDLE = 0, |
---|
34 | | - /// Data can be forwarded |
---|
35 | | - IPC_HOST_DESC_FORWARD, |
---|
36 | | - /// Data has to be kept in UMAC memory |
---|
37 | | - IPC_HOST_DESC_KEEP, |
---|
38 | | - /// Delete stored packet |
---|
39 | | - IPC_HOST_DESC_DELETE, |
---|
40 | | - /// Update Frame Length status |
---|
41 | | - IPC_HOST_DESC_LEN_UPDATE, |
---|
42 | | -}; |
---|
43 | | - |
---|
44 | 26 | /** |
---|
45 | 27 | ****************************************************************************** |
---|
46 | 28 | * @brief This structure is used to initialize the MAC SW |
---|
.. | .. |
---|
182 | 164 | |
---|
183 | 165 | extern const int nx_txdesc_cnt[]; |
---|
184 | 166 | extern const int nx_txuser_cnt[]; |
---|
185 | | - |
---|
186 | | -/** |
---|
187 | | - ****************************************************************************** |
---|
188 | | - * @brief Returns the full/not full status of the queue the index of which is |
---|
189 | | - * passed as parameter. |
---|
190 | | - * |
---|
191 | | - * @param[in] env Pointer to the IPC host environment |
---|
192 | | - * @param[in] queue_idx Index of the queue to be checked |
---|
193 | | - * |
---|
194 | | - * @return true if the queue is full, false otherwise |
---|
195 | | - * |
---|
196 | | - ****************************************************************************** |
---|
197 | | - */ |
---|
198 | | -static __INLINE bool ipc_host_queue_full(struct ipc_host_env_tag *env, |
---|
199 | | - const int queue_idx) |
---|
200 | | -{ |
---|
201 | | - return (env->txdesc_free_idx[queue_idx] == |
---|
202 | | - (env->txdesc_used_idx[queue_idx] + nx_txdesc_cnt[queue_idx])); |
---|
203 | | -} |
---|
204 | | - |
---|
205 | | -/** |
---|
206 | | - ****************************************************************************** |
---|
207 | | - * @brief Initialize the IPC running on the Application CPU. |
---|
208 | | - * |
---|
209 | | - * This function: |
---|
210 | | - * - initializes the IPC software environments |
---|
211 | | - * - enables the interrupts in the IPC block |
---|
212 | | - * |
---|
213 | | - * @param[in] env Pointer to the IPC host environment |
---|
214 | | - * |
---|
215 | | - * @warning Since this function resets the IPC Shared memory, it must be called |
---|
216 | | - * before the LMAC FW is launched because LMAC sets some init values in IPC |
---|
217 | | - * Shared memory at boot. |
---|
218 | | - * |
---|
219 | | - ****************************************************************************** |
---|
220 | | - */ |
---|
221 | | -void ipc_host_init(struct ipc_host_env_tag *env, |
---|
222 | | - struct ipc_host_cb_tag *cb, |
---|
223 | | - struct ipc_shared_env_tag *shared_env_ptr, |
---|
224 | | - void *pthis); |
---|
225 | | - |
---|
226 | | -/** @addtogroup IPC_TX |
---|
227 | | - * @{ |
---|
228 | | - */ |
---|
229 | | - |
---|
230 | | -/** |
---|
231 | | - ****************************************************************************** |
---|
232 | | - * @brief Retrieve a new free Tx descriptor (host side). |
---|
233 | | - * |
---|
234 | | - * This function returns a pointer to the next Tx descriptor available from the |
---|
235 | | - * queue queue_idx to the host driver. The driver will have to fill it with the |
---|
236 | | - * appropriate endianness and to send it to the |
---|
237 | | - * emb side with ipc_host_txdesc_push(). |
---|
238 | | - * |
---|
239 | | - * This function should only be called once until ipc_host_txdesc_push() is called. |
---|
240 | | - * |
---|
241 | | - * This function will return NULL if the queue is full. |
---|
242 | | - * |
---|
243 | | - * @param[in] env Pointer to the IPC host environment |
---|
244 | | - * @param[in] queue_idx Queue index. The index can be inferred from the |
---|
245 | | - * user priority of the incoming packet. |
---|
246 | | - * @param[in] user_pos User position. If MU-MIMO is not used, this value |
---|
247 | | - * shall be 0. |
---|
248 | | - * @return Pointer to the next Tx descriptor free. This can |
---|
249 | | - * point to the host memory or to shared memory, |
---|
250 | | - * depending on IPC implementation. |
---|
251 | | - * |
---|
252 | | - ****************************************************************************** |
---|
253 | | - */ |
---|
254 | | -volatile struct txdesc_host *ipc_host_txdesc_get(struct ipc_host_env_tag *env, |
---|
255 | | - const int queue_idx, |
---|
256 | | - const int user_pos); |
---|
257 | | - |
---|
258 | | - |
---|
259 | | -/** |
---|
260 | | - ****************************************************************************** |
---|
261 | | - * @brief Push a filled Tx descriptor (host side). |
---|
262 | | - * |
---|
263 | | - * This function sets the next Tx descriptor available by the host side: |
---|
264 | | - * - as used for the host side |
---|
265 | | - * - as available for the emb side. |
---|
266 | | - * The Tx descriptor must be correctly filled before calling this function. |
---|
267 | | - * |
---|
268 | | - * This function may trigger an IRQ to the emb CPU depending on the interrupt |
---|
269 | | - * mitigation policy and on the push count. |
---|
270 | | - * |
---|
271 | | - * @param[in] env Pointer to the IPC host environment |
---|
272 | | - * @param[in] queue_idx Queue index. Same value than ipc_host_txdesc_get() |
---|
273 | | - * @param[in] user_pos User position. If MU-MIMO is not used, this value |
---|
274 | | - * shall be 0. |
---|
275 | | - * @param[in] host_id Parameter indicated by the IPC at TX confirmation, |
---|
276 | | - * that allows the driver finding the buffer |
---|
277 | | - * |
---|
278 | | - ****************************************************************************** |
---|
279 | | - */ |
---|
280 | | -void ipc_host_txdesc_push(struct ipc_host_env_tag *env, const int queue_idx, |
---|
281 | | - const int user_pos, void *host_id); |
---|
282 | | - |
---|
283 | | - |
---|
284 | | -/** |
---|
285 | | - ****************************************************************************** |
---|
286 | | - * @brief Check if there are TX frames pending in the TX queues. |
---|
287 | | - * |
---|
288 | | - * @param[in] env Pointer to the IPC host environment |
---|
289 | | - * |
---|
290 | | - * @return true if there are frames pending, false otherwise. |
---|
291 | | - * |
---|
292 | | - ****************************************************************************** |
---|
293 | | - */ |
---|
294 | | -bool ipc_host_tx_frames_pending(struct ipc_host_env_tag *env); |
---|
295 | | - |
---|
296 | | -/** |
---|
297 | | - ****************************************************************************** |
---|
298 | | - * @brief Get and flush a packet from the IPC queue passed as parameter. |
---|
299 | | - * |
---|
300 | | - * @param[in] env Pointer to the IPC host environment |
---|
301 | | - * @param[in] queue_idx Index of the queue to flush |
---|
302 | | - * @param[in] user_pos User position to flush |
---|
303 | | - * |
---|
304 | | - * @return The flushed hostid if there is one, 0 otherwise. |
---|
305 | | - * |
---|
306 | | - ****************************************************************************** |
---|
307 | | - */ |
---|
308 | | -void *ipc_host_tx_flush(struct ipc_host_env_tag *env, const int queue_idx, |
---|
309 | | - const int user_pos); |
---|
310 | | - |
---|
311 | | -/// @} IPC_TX |
---|
312 | | - |
---|
313 | | -/** @addtogroup IPC_RX |
---|
314 | | - * @{ |
---|
315 | | - */ |
---|
316 | | -void ipc_host_patt_addr_push(struct ipc_host_env_tag *env, uint32_t addr); |
---|
317 | | - |
---|
318 | | -/** |
---|
319 | | - ****************************************************************************** |
---|
320 | | - * @brief Push a pre-allocated buffer descriptor for Rx packet (host side) |
---|
321 | | - * |
---|
322 | | - * This function should be called by the host IRQ handler to supply the |
---|
323 | | - * embedded side with new empty buffer. |
---|
324 | | - * |
---|
325 | | - * @param[in] env Pointer to the IPC host environment |
---|
326 | | - * @param[in] hostid Packet ID used by the host (skbuff pointer on Linux) |
---|
327 | | - * @param[in] hostbuf Pointer to the start of the buffer payload in the |
---|
328 | | - * host memory (this may be inferred from the skbuff?) |
---|
329 | | - * The length of this buffer should be predefined |
---|
330 | | - * between host and emb statically (constant needed?). |
---|
331 | | - * |
---|
332 | | - ****************************************************************************** |
---|
333 | | - */ |
---|
334 | | -int ipc_host_rxbuf_push(struct ipc_host_env_tag *env, |
---|
335 | | -#ifdef CONFIG_RWNX_FULLMAC |
---|
336 | | - uint32_t hostid, |
---|
337 | | -#endif |
---|
338 | | - uint32_t hostbuf); |
---|
339 | | - |
---|
340 | | -/** |
---|
341 | | - ****************************************************************************** |
---|
342 | | - * @brief Push a pre-allocated Descriptor |
---|
343 | | - * |
---|
344 | | - * This function should be called by the host IRQ handler to supply the |
---|
345 | | - * embedded side with new empty buffer. |
---|
346 | | - * |
---|
347 | | - * @param[in] env Pointer to the IPC host environment |
---|
348 | | - * @param[in] hostid Address of packet for host |
---|
349 | | - * @param[in] hostbuf Pointer to the start of the buffer payload in the |
---|
350 | | - * host memory. The length of this buffer should be |
---|
351 | | - * predefined between host and emb statically. |
---|
352 | | - * |
---|
353 | | - ****************************************************************************** |
---|
354 | | - */ |
---|
355 | | -int ipc_host_rxdesc_push(struct ipc_host_env_tag *env, void *hostid, |
---|
356 | | - uint32_t hostbuf); |
---|
357 | | - |
---|
358 | | -/** |
---|
359 | | - ****************************************************************************** |
---|
360 | | - * @brief Push a pre-allocated radar event buffer descriptor |
---|
361 | | - * |
---|
362 | | - * This function is called at Init time to initialize all radar event buffers. |
---|
363 | | - * Then each time embedded send a radar event, this function is used to push |
---|
364 | | - * back the same buffer once it has been handled. |
---|
365 | | - * |
---|
366 | | - * @param[in] env Pointer to the IPC host environment |
---|
367 | | - * @param[in] hostid Address of packet for host |
---|
368 | | - * @param[in] hostbuf Pointer to the start of the buffer payload in the |
---|
369 | | - * host memory. The length of this buffer should be |
---|
370 | | - * predefined between host and emb statically. |
---|
371 | | - * |
---|
372 | | - ****************************************************************************** |
---|
373 | | - */ |
---|
374 | | -int ipc_host_radarbuf_push(struct ipc_host_env_tag *env, void *hostid, |
---|
375 | | - uint32_t hostbuf); |
---|
376 | | - |
---|
377 | | -/** |
---|
378 | | - ****************************************************************************** |
---|
379 | | - * @brief Push a pre-allocated unsupported rx vector buffer descriptor |
---|
380 | | - * |
---|
381 | | - * This function is called at Init time to initialize all unsupported rx vector |
---|
382 | | - * buffers. Then each time the embedded sends a unsupported rx vector, this |
---|
383 | | - * function is used to push a new unsupported rx vector buffer. |
---|
384 | | - * |
---|
385 | | - * @param[in] env Pointer to the IPC host environment |
---|
386 | | - * @param[in] hostid Address of packet for host |
---|
387 | | - * @param[in] hostbuf Pointer to the start of the buffer payload in the |
---|
388 | | - * host memory. The length of this buffer should be |
---|
389 | | - * predefined between host and emb statically. |
---|
390 | | - * |
---|
391 | | - ****************************************************************************** |
---|
392 | | - */ |
---|
393 | | -int ipc_host_unsup_rx_vec_buf_push(struct ipc_host_env_tag *env, void *hostid, |
---|
394 | | - uint32_t hostbuf); |
---|
395 | | - |
---|
396 | | -/** |
---|
397 | | - ****************************************************************************** |
---|
398 | | - * @brief Push a pre-allocated buffer descriptor for IPC MSGs (host side) |
---|
399 | | - * |
---|
400 | | - * This function is called at Init time to initialize all Emb2App messages |
---|
401 | | - * buffers. Then each time embedded send a IPC message, this function is used |
---|
402 | | - * to push back the same buffer once it has been handled. |
---|
403 | | - * |
---|
404 | | - * @param[in] env Pointer to the IPC host environment |
---|
405 | | - * @param[in] hostid Address of buffer for host |
---|
406 | | - * @param[in] hostbuf Address of buffer for embedded |
---|
407 | | - * The length of this buffer should be predefined |
---|
408 | | - * between host and emb statically. |
---|
409 | | - * |
---|
410 | | - ****************************************************************************** |
---|
411 | | - */ |
---|
412 | | -int ipc_host_msgbuf_push(struct ipc_host_env_tag *env, void *hostid, |
---|
413 | | - uint32_t hostbuf); |
---|
414 | | - |
---|
415 | | -/** |
---|
416 | | - ****************************************************************************** |
---|
417 | | - * @brief Push a pre-allocated buffer descriptor for Debug messages (host side) |
---|
418 | | - * |
---|
419 | | - * This function is called at Init time to initialize all debug messages. |
---|
420 | | - * Then each time embedded send a debug message, this function is used to push |
---|
421 | | - * back the same buffer once it has been handled. |
---|
422 | | - * |
---|
423 | | - * @param[in] env Pointer to the IPC host environment |
---|
424 | | - * @param[in] hostid Address of buffer for host |
---|
425 | | - * @param[in] hostbuf Address of buffer for embedded |
---|
426 | | - * The length of this buffer should be predefined |
---|
427 | | - * between host and emb statically. |
---|
428 | | - * |
---|
429 | | - ****************************************************************************** |
---|
430 | | - */ |
---|
431 | | -int ipc_host_dbgbuf_push(struct ipc_host_env_tag *env, void *hostid, |
---|
432 | | - uint32_t hostbuf); |
---|
433 | | - |
---|
434 | | -/** |
---|
435 | | - ****************************************************************************** |
---|
436 | | - * @brief Push the pre-allocated logic analyzer and debug information buffer |
---|
437 | | - * |
---|
438 | | - * @param[in] env Pointer to the IPC host environment |
---|
439 | | - * @param[in] infobuf Address of buffer for embedded |
---|
440 | | - * The length of this buffer should be predefined |
---|
441 | | - * between host and emb statically. |
---|
442 | | - * |
---|
443 | | - ****************************************************************************** |
---|
444 | | - */ |
---|
445 | | -void ipc_host_dbginfobuf_push(struct ipc_host_env_tag *env, uint32_t infobuf); |
---|
446 | | - |
---|
447 | | -/// @} IPC_RX |
---|
448 | | - |
---|
449 | | - |
---|
450 | | - |
---|
451 | | -/** @addtogroup IPC_MISC |
---|
452 | | - * @{ |
---|
453 | | - */ |
---|
454 | | - |
---|
455 | | -/** |
---|
456 | | - ****************************************************************************** |
---|
457 | | - * @brief Handle all IPC interrupts on the host side. |
---|
458 | | - * |
---|
459 | | - * The following interrupts should be handled: |
---|
460 | | - * Tx confirmation, Rx buffer requests, Rx packet ready and kernel messages |
---|
461 | | - * |
---|
462 | | - * @param[in] env Pointer to the IPC host environment |
---|
463 | | - * |
---|
464 | | - ****************************************************************************** |
---|
465 | | - */ |
---|
466 | | -void ipc_host_irq(struct ipc_host_env_tag *env, uint32_t status); |
---|
467 | | - |
---|
468 | | -/** |
---|
469 | | - ****************************************************************************** |
---|
470 | | - * @brief Send a message to the embedded side |
---|
471 | | - * |
---|
472 | | - * @param[in] env Pointer to the IPC host environment |
---|
473 | | - * @param[in] msg_buf Pointer to the message buffer |
---|
474 | | - * @param[in] msg_len Length of the message to be transmitted |
---|
475 | | - * |
---|
476 | | - * @return Non-null value on failure |
---|
477 | | - * |
---|
478 | | - ****************************************************************************** |
---|
479 | | - */ |
---|
480 | | -int ipc_host_msg_push(struct ipc_host_env_tag *env, void *msg_buf, uint16_t len); |
---|
481 | | - |
---|
482 | | -/** |
---|
483 | | - ****************************************************************************** |
---|
484 | | - * @brief Enable IPC interrupts |
---|
485 | | - * |
---|
486 | | - * @param[in] env Global ipc_host environment pointer |
---|
487 | | - * @param[in] value Bitfield of the interrupts to enable |
---|
488 | | - * |
---|
489 | | - * @warning After calling this function, IPC interrupts can be triggered at any |
---|
490 | | - * time. Potentially, an interrupt could happen even before returning from the |
---|
491 | | - * function if there is a request pending from the embedded side. |
---|
492 | | - * |
---|
493 | | - ****************************************************************************** |
---|
494 | | - */ |
---|
495 | | -void ipc_host_enable_irq(struct ipc_host_env_tag *env, uint32_t value); |
---|
496 | | -void ipc_host_disable_irq(struct ipc_host_env_tag *env, uint32_t value); |
---|
497 | | - |
---|
498 | | -uint32_t ipc_host_get_status(struct ipc_host_env_tag *env); |
---|
499 | | -uint32_t ipc_host_get_rawstatus(struct ipc_host_env_tag *env); |
---|
500 | | - |
---|
501 | | -/// @} IPC_MISC |
---|
502 | | - |
---|
503 | 167 | |
---|
504 | 168 | #endif // _IPC_HOST_H_ |
---|