Functions
cppi_listlib.c File Reference

Implementation of a doubly linked list. More...

#include <stdint.h>
#include <stdlib.h>
#include <cppi_osal.h>
#include <ti/drv/cppi/include/cppi_listlib.h>

Functions

void cppi_list_add (Cppi_ListNode **ptr_list, Cppi_ListNode *ptr_node)
void cppi_list_cat (Cppi_ListNode **ptr_dst, Cppi_ListNode **ptr_src)
Cppi_ListNode * cppi_list_remove (Cppi_ListNode **ptr_list)
int cppi_list_remove_node (Cppi_ListNode **ptr_list, Cppi_ListNode *ptr_remove)
Cppi_ListNode * cppi_list_get_head (Cppi_ListNode **ptr_list)
Cppi_ListNode * cppi_list_get_next (Cppi_ListNode *ptr_list)
void cppi_list_cache_invalidate (Cppi_ListNode *ptr_list)

Detailed Description

Implementation of a doubly linked list.

NOTE: (C) Copyright 2008-2013, Texas Instruments, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Function Documentation

void cppi_list_add ( Cppi_ListNode **  ptr_list,
Cppi_ListNode *  ptr_node 
)

Description
The function is called to add a node to the list.

Cache assumptions: caller has invalidated *ptr_list, ptr_node, ptr_list Callee will write back any modified links.

Parameters:
[in]ptr_listThis is the list to which the node is to be added.
[in]ptr_nodeThis is the node which is to be added.
Return values:
NotApplicable
void cppi_list_cache_invalidate ( Cppi_ListNode *  ptr_list)

Description
Calls Cppi_osalBeginMemAccess () for each element in a list. This must be called before anything in the same heap as the list is dirtied, otherwise the dirty data (from items outside this list) will be discarded.

Parameters:
[in]ptr_listThis is the pointer to the head node in the list.
Return values:
nothing
void cppi_list_cat ( Cppi_ListNode **  ptr_dst,
Cppi_ListNode **  ptr_src 
)

Description
The function is called to concatenate the src list to the end of the destination list.

Cache assumptions: caller has invalidated *ptr_dst, *ptr_src, ptr_dst, ptr_src, as well as all applicable links in the list. Callee will write back any modified links.

Parameters:
[in]ptr_dstThis is the head of the destination list.
[in]ptr_srcThis is the head of the source list.
Return values:
NotApplicable
Cppi_ListNode* cppi_list_get_head ( Cppi_ListNode **  ptr_list)

Description
The function is used to get the head of the specific list

Parameters:
[in]ptr_listThis is the pointer to the list.
Return values:
Headof the list (could be NULL if the list is empty)
Cppi_ListNode* cppi_list_get_next ( Cppi_ListNode *  ptr_list)

Description
The function is used to get the next element in the list.

Parameters:
[in]ptr_listThis is the pointer to the node in the list.
Return values:
Nextelement in the list. (could be NULL if this is the last element)
Cppi_ListNode* cppi_list_remove ( Cppi_ListNode **  ptr_list)

Description
The function is called to remove the head node from the list.

Cache assumptions: caller has invalidated **ptr_list, ptr_list, Callee will write back any modified links.

Parameters:
[in]ptr_listThis is the pointer to the list from where nodes will be removed.
Return values:
Pointerto the head of the list.
int cppi_list_remove_node ( Cppi_ListNode **  ptr_list,
Cppi_ListNode *  ptr_remove 
)

Description
The function is called to remove the specified node from the list.

Cache assumptions: caller has invalidated **ptr_list, ptr_remove, as well as previous and next nodes (or whole list) Callee will write back any modified links.

Parameters:
[in]ptr_listThis is the pointer to the list from where node will be removed.
[in]ptr_removeThis is the node which is to be removed.
Return values:
Success- 0
Error- -1

Copyright 2014, Texas Instruments Incorporated