|
38 | 38 | #include "task.h" |
39 | 39 | #include "queue.h" |
40 | 40 |
|
41 | | -#if ( configUSE_CO_ROUTINES == 1 ) |
42 | | - #include "croutine.h" |
43 | | -#endif |
44 | | - |
45 | 41 | /* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified |
46 | 42 | * because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined |
47 | 43 | * for the header files above, but not in this file, in order to generate the |
@@ -2458,293 +2454,6 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) |
2458 | 2454 | } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ |
2459 | 2455 | /*-----------------------------------------------------------*/ |
2460 | 2456 |
|
2461 | | -#if ( configUSE_CO_ROUTINES == 1 ) |
2462 | | - |
2463 | | - BaseType_t xQueueCRSend( QueueHandle_t xQueue, |
2464 | | - const void * pvItemToQueue, |
2465 | | - TickType_t xTicksToWait ) |
2466 | | - { |
2467 | | - BaseType_t xReturn; |
2468 | | - Queue_t * const pxQueue = xQueue; |
2469 | | - |
2470 | | - /* If the queue is already full we may have to block. A critical section |
2471 | | - * is required to prevent an interrupt removing something from the queue |
2472 | | - * between the check to see if the queue is full and blocking on the queue. */ |
2473 | | - portDISABLE_INTERRUPTS(); |
2474 | | - { |
2475 | | - if( prvIsQueueFull( pxQueue ) != pdFALSE ) |
2476 | | - { |
2477 | | - /* The queue is full - do we want to block or just leave without |
2478 | | - * posting? */ |
2479 | | - if( xTicksToWait > ( TickType_t ) 0 ) |
2480 | | - { |
2481 | | - /* As this is called from a coroutine we cannot block directly, but |
2482 | | - * return indicating that we need to block. */ |
2483 | | - vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) ); |
2484 | | - portENABLE_INTERRUPTS(); |
2485 | | - return errQUEUE_BLOCKED; |
2486 | | - } |
2487 | | - else |
2488 | | - { |
2489 | | - portENABLE_INTERRUPTS(); |
2490 | | - return errQUEUE_FULL; |
2491 | | - } |
2492 | | - } |
2493 | | - } |
2494 | | - portENABLE_INTERRUPTS(); |
2495 | | - |
2496 | | - portDISABLE_INTERRUPTS(); |
2497 | | - { |
2498 | | - if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) |
2499 | | - { |
2500 | | - /* There is room in the queue, copy the data into the queue. */ |
2501 | | - prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK ); |
2502 | | - xReturn = pdPASS; |
2503 | | - |
2504 | | - /* Were any co-routines waiting for data to become available? */ |
2505 | | - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) |
2506 | | - { |
2507 | | - /* In this instance the co-routine could be placed directly |
2508 | | - * into the ready list as we are within a critical section. |
2509 | | - * Instead the same pending ready list mechanism is used as if |
2510 | | - * the event were caused from within an interrupt. */ |
2511 | | - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) |
2512 | | - { |
2513 | | - /* The co-routine waiting has a higher priority so record |
2514 | | - * that a yield might be appropriate. */ |
2515 | | - xReturn = errQUEUE_YIELD; |
2516 | | - } |
2517 | | - else |
2518 | | - { |
2519 | | - mtCOVERAGE_TEST_MARKER(); |
2520 | | - } |
2521 | | - } |
2522 | | - else |
2523 | | - { |
2524 | | - mtCOVERAGE_TEST_MARKER(); |
2525 | | - } |
2526 | | - } |
2527 | | - else |
2528 | | - { |
2529 | | - xReturn = errQUEUE_FULL; |
2530 | | - } |
2531 | | - } |
2532 | | - portENABLE_INTERRUPTS(); |
2533 | | - |
2534 | | - return xReturn; |
2535 | | - } |
2536 | | - |
2537 | | -#endif /* configUSE_CO_ROUTINES */ |
2538 | | -/*-----------------------------------------------------------*/ |
2539 | | - |
2540 | | -#if ( configUSE_CO_ROUTINES == 1 ) |
2541 | | - |
2542 | | - BaseType_t xQueueCRReceive( QueueHandle_t xQueue, |
2543 | | - void * pvBuffer, |
2544 | | - TickType_t xTicksToWait ) |
2545 | | - { |
2546 | | - BaseType_t xReturn; |
2547 | | - Queue_t * const pxQueue = xQueue; |
2548 | | - |
2549 | | - /* If the queue is already empty we may have to block. A critical section |
2550 | | - * is required to prevent an interrupt adding something to the queue |
2551 | | - * between the check to see if the queue is empty and blocking on the queue. */ |
2552 | | - portDISABLE_INTERRUPTS(); |
2553 | | - { |
2554 | | - if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) |
2555 | | - { |
2556 | | - /* There are no messages in the queue, do we want to block or just |
2557 | | - * leave with nothing? */ |
2558 | | - if( xTicksToWait > ( TickType_t ) 0 ) |
2559 | | - { |
2560 | | - /* As this is a co-routine we cannot block directly, but return |
2561 | | - * indicating that we need to block. */ |
2562 | | - vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) ); |
2563 | | - portENABLE_INTERRUPTS(); |
2564 | | - return errQUEUE_BLOCKED; |
2565 | | - } |
2566 | | - else |
2567 | | - { |
2568 | | - portENABLE_INTERRUPTS(); |
2569 | | - return errQUEUE_FULL; |
2570 | | - } |
2571 | | - } |
2572 | | - else |
2573 | | - { |
2574 | | - mtCOVERAGE_TEST_MARKER(); |
2575 | | - } |
2576 | | - } |
2577 | | - portENABLE_INTERRUPTS(); |
2578 | | - |
2579 | | - portDISABLE_INTERRUPTS(); |
2580 | | - { |
2581 | | - if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) |
2582 | | - { |
2583 | | - /* Data is available from the queue. */ |
2584 | | - pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; |
2585 | | - |
2586 | | - if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail ) |
2587 | | - { |
2588 | | - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; |
2589 | | - } |
2590 | | - else |
2591 | | - { |
2592 | | - mtCOVERAGE_TEST_MARKER(); |
2593 | | - } |
2594 | | - |
2595 | | - --( pxQueue->uxMessagesWaiting ); |
2596 | | - ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); |
2597 | | - |
2598 | | - xReturn = pdPASS; |
2599 | | - |
2600 | | - /* Were any co-routines waiting for space to become available? */ |
2601 | | - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) |
2602 | | - { |
2603 | | - /* In this instance the co-routine could be placed directly |
2604 | | - * into the ready list as we are within a critical section. |
2605 | | - * Instead the same pending ready list mechanism is used as if |
2606 | | - * the event were caused from within an interrupt. */ |
2607 | | - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) |
2608 | | - { |
2609 | | - xReturn = errQUEUE_YIELD; |
2610 | | - } |
2611 | | - else |
2612 | | - { |
2613 | | - mtCOVERAGE_TEST_MARKER(); |
2614 | | - } |
2615 | | - } |
2616 | | - else |
2617 | | - { |
2618 | | - mtCOVERAGE_TEST_MARKER(); |
2619 | | - } |
2620 | | - } |
2621 | | - else |
2622 | | - { |
2623 | | - xReturn = pdFAIL; |
2624 | | - } |
2625 | | - } |
2626 | | - portENABLE_INTERRUPTS(); |
2627 | | - |
2628 | | - return xReturn; |
2629 | | - } |
2630 | | - |
2631 | | -#endif /* configUSE_CO_ROUTINES */ |
2632 | | -/*-----------------------------------------------------------*/ |
2633 | | - |
2634 | | -#if ( configUSE_CO_ROUTINES == 1 ) |
2635 | | - |
2636 | | - BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, |
2637 | | - const void * pvItemToQueue, |
2638 | | - BaseType_t xCoRoutinePreviouslyWoken ) |
2639 | | - { |
2640 | | - Queue_t * const pxQueue = xQueue; |
2641 | | - |
2642 | | - /* Cannot block within an ISR so if there is no space on the queue then |
2643 | | - * exit without doing anything. */ |
2644 | | - if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) |
2645 | | - { |
2646 | | - prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK ); |
2647 | | - |
2648 | | - /* We only want to wake one co-routine per ISR, so check that a |
2649 | | - * co-routine has not already been woken. */ |
2650 | | - if( xCoRoutinePreviouslyWoken == pdFALSE ) |
2651 | | - { |
2652 | | - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) |
2653 | | - { |
2654 | | - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) |
2655 | | - { |
2656 | | - return pdTRUE; |
2657 | | - } |
2658 | | - else |
2659 | | - { |
2660 | | - mtCOVERAGE_TEST_MARKER(); |
2661 | | - } |
2662 | | - } |
2663 | | - else |
2664 | | - { |
2665 | | - mtCOVERAGE_TEST_MARKER(); |
2666 | | - } |
2667 | | - } |
2668 | | - else |
2669 | | - { |
2670 | | - mtCOVERAGE_TEST_MARKER(); |
2671 | | - } |
2672 | | - } |
2673 | | - else |
2674 | | - { |
2675 | | - mtCOVERAGE_TEST_MARKER(); |
2676 | | - } |
2677 | | - |
2678 | | - return xCoRoutinePreviouslyWoken; |
2679 | | - } |
2680 | | - |
2681 | | -#endif /* configUSE_CO_ROUTINES */ |
2682 | | -/*-----------------------------------------------------------*/ |
2683 | | - |
2684 | | -#if ( configUSE_CO_ROUTINES == 1 ) |
2685 | | - |
2686 | | - BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, |
2687 | | - void * pvBuffer, |
2688 | | - BaseType_t * pxCoRoutineWoken ) |
2689 | | - { |
2690 | | - BaseType_t xReturn; |
2691 | | - Queue_t * const pxQueue = xQueue; |
2692 | | - |
2693 | | - /* We cannot block from an ISR, so check there is data available. If |
2694 | | - * not then just leave without doing anything. */ |
2695 | | - if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) |
2696 | | - { |
2697 | | - /* Copy the data from the queue. */ |
2698 | | - pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; |
2699 | | - |
2700 | | - if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail ) |
2701 | | - { |
2702 | | - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; |
2703 | | - } |
2704 | | - else |
2705 | | - { |
2706 | | - mtCOVERAGE_TEST_MARKER(); |
2707 | | - } |
2708 | | - |
2709 | | - --( pxQueue->uxMessagesWaiting ); |
2710 | | - ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); |
2711 | | - |
2712 | | - if( ( *pxCoRoutineWoken ) == pdFALSE ) |
2713 | | - { |
2714 | | - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) |
2715 | | - { |
2716 | | - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) |
2717 | | - { |
2718 | | - *pxCoRoutineWoken = pdTRUE; |
2719 | | - } |
2720 | | - else |
2721 | | - { |
2722 | | - mtCOVERAGE_TEST_MARKER(); |
2723 | | - } |
2724 | | - } |
2725 | | - else |
2726 | | - { |
2727 | | - mtCOVERAGE_TEST_MARKER(); |
2728 | | - } |
2729 | | - } |
2730 | | - else |
2731 | | - { |
2732 | | - mtCOVERAGE_TEST_MARKER(); |
2733 | | - } |
2734 | | - |
2735 | | - xReturn = pdPASS; |
2736 | | - } |
2737 | | - else |
2738 | | - { |
2739 | | - xReturn = pdFAIL; |
2740 | | - } |
2741 | | - |
2742 | | - return xReturn; |
2743 | | - } |
2744 | | - |
2745 | | -#endif /* configUSE_CO_ROUTINES */ |
2746 | | -/*-----------------------------------------------------------*/ |
2747 | | - |
2748 | 2457 | #if ( configQUEUE_REGISTRY_SIZE > 0 ) |
2749 | 2458 |
|
2750 | 2459 | void vQueueAddToRegistry( QueueHandle_t xQueue, |
|
0 commit comments