| 1 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 2 |
|
| 3 |
File: octapi_llman.h |
| 4 |
|
| 5 |
Copyright (c) 2001-2007 Octasic Inc. |
| 6 |
|
| 7 |
Description: |
| 8 |
|
| 9 |
Library used to manage allocation tables and linked lists. The library is |
| 10 |
made such that only a block of contiguous memory is needed for the |
| 11 |
management of the linked list/allocation table. |
| 12 |
|
| 13 |
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is |
| 14 |
free software; you can redistribute it and/or modify it under the terms of |
| 15 |
the GNU General Public License as published by the Free Software Foundation; |
| 16 |
either version 2 of the License, or (at your option) any later version. |
| 17 |
|
| 18 |
The OCT6100 GPL API is distributed in the hope that it will be useful, but |
| 19 |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 20 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 21 |
for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with the OCT6100 GPL API; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 26 |
|
| 27 |
$Octasic_Release: OCT612xAPI-01.00-PR49 $ |
| 28 |
|
| 29 |
$Octasic_Revision: 8 $ |
| 30 |
|
| 31 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 32 |
#ifndef __OCTAPI_LLMAN_H__ |
| 33 |
#define __OCTAPI_LLMAN_H__ |
| 34 |
|
| 35 |
#include "octdef.h" |
| 36 |
|
| 37 |
/* Error defines. */ |
| 38 |
#define OCTAPI_LLM_MEMORY_NOT_ALLOCATED 0xFFFFFFFF |
| 39 |
#define OCTAPI_LLM_NO_STRUCTURES_LEFT 0xFFFFFFFE |
| 40 |
#define OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE 0xFFFFFFFD |
| 41 |
#define OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED 0xFFFFFFFC |
| 42 |
#define OCTAPI_LLM_ELEMENT_NOT_FOUND 0xFFFFFFFB |
| 43 |
#define OCTAPI_LLM_LIST_EMPTY 0xFFFFFFFA |
| 44 |
#define OCTAPI_LLM_INVALID_LIST_HANDLE 0xFFFFFFF9 |
| 45 |
#define OCTAPI_LLM_TREE_NODE_ABSENT 0xFFFFFFF8 |
| 46 |
#define OCTAPI_LLM_INTERNAL_ERROR0 0xFFFFFFF7 |
| 47 |
#define OCTAPI_LLM_INTERNAL_ERROR1 0xFFFFFFF6 |
| 48 |
#define OCTAPI_LLM_INVALID_PARAMETER 0xFFFFFFF5 |
| 49 |
|
| 50 |
#define OCTAPI_LLM2_MEMORY_NOT_ALLOCATED 0xFEFFFFFF |
| 51 |
#define OCTAPI_LLM2_NO_STRUCTURES_LEFT 0xFEFFFFFE |
| 52 |
#define OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE 0xFEFFFFFD |
| 53 |
#define OCTAPI_LLM2_ELEMENT_ALREADY_ASSIGNED 0xFEFFFFFC |
| 54 |
#define OCTAPI_LLM2_ELEMENT_NOT_FOUND 0xFEFFFFFB |
| 55 |
#define OCTAPI_LLM2_LIST_EMPTY 0xFEFFFFFA |
| 56 |
#define OCTAPI_LLM2_INVALID_LIST_HANDLE 0xFEFFFFF9 |
| 57 |
#define OCTAPI_LLM2_TREE_NODE_ABSENT 0xFEFFFFF8 |
| 58 |
#define OCTAPI_LLM2_INTERNAL_ERROR0 0xFEFFFFF7 |
| 59 |
#define OCTAPI_LLM2_INTERNAL_ERROR1 0xFEFFFFF6 |
| 60 |
#define OCTAPI_LLM2_INVALID_PARAMETER 0xFEFFFFF5 |
| 61 |
|
| 62 |
/* Other defines. */ |
| 63 |
#define OCTAPI_LLM_LIST_APPEND 0xFFFFFFFF |
| 64 |
#define OCTAPI_LLM2_INSERT_ERROR 0xFFFFFFFF |
| 65 |
#define OCTAPI_LLM2_INSERT_FIRST_NODE 0xFFFF0000 |
| 66 |
#define OCTAPI_LLM2_INSERT_LIST_NODE 0xFFFF0001 |
| 67 |
#define OCTAPI_LLM2_INSERT_LAST_NODE 0xFFFF0002 |
| 68 |
#define OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE 0xFFFF0003 |
| 69 |
#define OCTAPI_LLM2_REMOVE_ERROR 0xFFFFFFFF |
| 70 |
#define OCTAPI_LLM2_REMOVE_FIRST_NODE 0xFFFF0004 |
| 71 |
#define OCTAPI_LLM2_REMOVE_LIST_NODE 0xFFFF0005 |
| 72 |
#define OCTAPI_LLM2_REMOVE_LAST_NODE 0xFFFF0006 |
| 73 |
#define OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE 0xFFFF0007 |
| 74 |
|
| 75 |
#ifdef __cplusplus |
| 76 |
extern "C" { |
| 77 |
#endif /* __cplusplus */ |
| 78 |
|
| 79 |
#define octapi_llm_alloc_get_size( number_of_items, l_size ) OctapiLlmAllocGetSize( (UINT32) number_of_items,(PUINT32) l_size ) |
| 80 |
#define octapi_llm_alloc_init( l, number_of_items ) OctapiLlmAllocInit( (PVOID*) l,(UINT32) number_of_items ) |
| 81 |
#define octapi_llm_alloc_info( l, allocated_items, available_items ) OctapiLlmAllocInfo( (PVOID) l, (PUINT32) allocated_items, (PUINT32) available_items ) |
| 82 |
#define octapi_llm_alloc_alloc( l, blocknum ) OctapiLlmAllocAlloc( (PVOID) l, (PUINT32) blocknum ) |
| 83 |
#define octapi_llm_alloc_dealloc( l, blocknum ) OctapiLlmAllocDealloc( (PVOID) l,(UINT32) blocknum ) |
| 84 |
#define octapi_llm_list_get_size( number_of_items, number_of_lists, user_info_size, l_size ) OctApiLlmListGetSize( (UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size,(PUINT32) l_size ) |
| 85 |
#define octapi_llm_list_init( l, number_of_items, number_of_lists, user_info_size ) OctApiLlmListInit( (PVOID*) l,(UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size ) |
| 86 |
#define octapi_llm_list_info( l, allocated_lists, allocated_items, free_lists, free_items ) OctApiLlmListInfo( (PVOID) l,(PUINT32) allocated_lists,(PUINT32) allocated_items,(PUINT32) free_lists,(PUINT32) free_items ) |
| 87 |
#define octapi_llm_list_create( l, list_handle ) OctApiLlmListCreate( (PVOID) l,(PUINT32) list_handle ) |
| 88 |
#define octapi_llm_list_create_full( l, list_length, plist_handle ) OctApiLlmListCreateFull( (PVOID) l, (UINT32) list_length, (PUINT32) plist_handle ) |
| 89 |
#define octapi_llm_list_append_items( l, list_handle, num_items ) OctApiLlmListAppendItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items ) |
| 90 |
#define octapi_llm_list_append_and_set_items( l, list_handle, num_items, data_list ) OctApiLlmListAppendAndSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items, (PVOID) data_list ) |
| 91 |
#define octapi_llm_list_delete( l, list_handle ) OctApiLlmListDelete( (PVOID) l,(UINT32) list_handle ) |
| 92 |
#define octapi_llm_list_length( l, list_handle, number_of_items_in_list ) OctApiLlmListLength( (PVOID) l,(UINT32) list_handle, (PUINT32) number_of_items_in_list ) |
| 93 |
#define octapi_llm_list_insert_item( l, list_handle, item_number, item_data_pnt ) OctApiLlmListInsertItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt ) |
| 94 |
#define octapi_llm_list_remove_item( l, list_handle, item_number ) OctApiLlmListRemoveItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number ) |
| 95 |
#define octapi_llm_list_item_data( l, list_handle, item_number, item_data_pnt ) OctApiLlmListItemData( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt ) |
| 96 |
#define octapi_llm_list_copy_data( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListCopyData( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list ) |
| 97 |
#define octapi_llm_list_set_items( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list ) |
| 98 |
|
| 99 |
/* Alloc man. */ |
| 100 |
UINT32 OctapiLlmAllocGetSize( UINT32 number_of_items,PUINT32 l_size ); |
| 101 |
UINT32 OctapiLlmAllocInit( PVOID* l,UINT32 number_of_items ); |
| 102 |
UINT32 OctapiLlmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items ); |
| 103 |
UINT32 OctapiLlmAllocAlloc( PVOID l, PUINT32 blocknum ); |
| 104 |
UINT32 OctapiLlmAllocDealloc( PVOID l,UINT32 blocknum ); |
| 105 |
|
| 106 |
/* Time managed alloc man. */ |
| 107 |
UINT32 OctApiTllmAllocGetSize( UINT32 number_of_items, PUINT32 l_size ); |
| 108 |
UINT32 OctApiTllmAllocInit( PVOID* l, UINT32 number_of_items ); |
| 109 |
UINT32 OctApiTllmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items ); |
| 110 |
UINT32 OctApiTllmAllocAlloc( PVOID l, PUINT32 blocknum, UINT32 current_time[2] ); |
| 111 |
UINT32 OctApiTllmAllocDealloc( PVOID l, UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2] ); |
| 112 |
|
| 113 |
/* List man. */ |
| 114 |
UINT32 OctApiLlmListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size ); |
| 115 |
UINT32 OctApiLlmListInit( PVOID* l, UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size ); |
| 116 |
UINT32 OctApiLlmListInfo( PVOID l, PUINT32 allocated_lists, PUINT32 allocated_items, PUINT32 free_lists, PUINT32 free_items ); |
| 117 |
UINT32 OctApiLlmListCreate( PVOID l, PUINT32 list_handle ); |
| 118 |
UINT32 OctApiLlmListCreateFull( PVOID l, UINT32 list_length, UINT32* plist_handle ); |
| 119 |
UINT32 OctApiLlmListAppendItems( PVOID l, UINT32 list_handle, UINT32 num_items ); |
| 120 |
UINT32 OctApiLlmListAppendAndSetItems( PVOID l, UINT32 list_handle, UINT32 num_items, PVOID data_list ); |
| 121 |
UINT32 OctApiLlmListDelete( PVOID l, UINT32 list_handle ); |
| 122 |
UINT32 OctApiLlmListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list ); |
| 123 |
UINT32 OctApiLlmListInsertItem( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt ); |
| 124 |
UINT32 OctApiLlmListRemoveItem( PVOID l, UINT32 list_handle, UINT32 item_number ); |
| 125 |
UINT32 OctApiLlmListItemData( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt ); |
| 126 |
UINT32 OctApiLlmListCopyData( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list ); |
| 127 |
UINT32 OctApiLlmListSetItems( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list ); |
| 128 |
|
| 129 |
/* Second list manager using a key to order info in the list. */ |
| 130 |
UINT32 OctApiLlm2ListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size ); |
| 131 |
UINT32 OctApiLlm2ListInit( PVOID* l,UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size ); |
| 132 |
UINT32 OctApiLlm2ListCreate( PVOID l, PUINT32 list_handle ); |
| 133 |
UINT32 OctApiLlm2ListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list ); |
| 134 |
UINT32 OctApiLlm2ListInsertItem(void * l, UINT32 list_handle, UINT32 item_key, void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt ); |
| 135 |
UINT32 OctApiLlm2ListRemoveItem(void * l, UINT32 list_handle, UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt ); |
| 136 |
UINT32 OctApiLlm2ListItemData( PVOID l, UINT32 list_handle, UINT32 item_key, PVOID* item_data_pnt, PUINT32 item_number ); |
| 137 |
|
| 138 |
#ifdef __cplusplus |
| 139 |
} |
| 140 |
#endif /* __cplusplus */ |
| 141 |
|
| 142 |
#endif /* __OCTAPI_LLMAN_H__ */ |