1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
|
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_tsi_cnct.c
Copyright (c) 2001-2007 Octasic Inc.
Description:
This file contains functions used to open and close TSI connections
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The OCT6100 GPL API is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with the OCT6100 GPL API; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
$Octasic_Release: OCT612xAPI-01.00-PR49 $
$Octasic_Revision: 38 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
#include "oct6100api/oct6100_defines.h"
#include "oct6100api/oct6100_errors.h"
#include "oct6100api/oct6100_apiud.h"
#include "apilib/octapi_llman.h"
#include "oct6100api/oct6100_tlv_inst.h"
#include "oct6100api/oct6100_chip_open_inst.h"
#include "oct6100api/oct6100_chip_stats_inst.h"
#include "oct6100api/oct6100_interrupts_inst.h"
#include "oct6100api/oct6100_channel_inst.h"
#include "oct6100api/oct6100_remote_debug_inst.h"
#include "oct6100api/oct6100_debug_inst.h"
#include "oct6100api/oct6100_api_inst.h"
#include "oct6100api/oct6100_tsi_cnct_inst.h"
#include "oct6100api/oct6100_interrupts_pub.h"
#include "oct6100api/oct6100_chip_open_pub.h"
#include "oct6100api/oct6100_channel_pub.h"
#include "oct6100api/oct6100_tsi_cnct_pub.h"
#include "oct6100_chip_open_priv.h"
#include "oct6100_miscellaneous_priv.h"
#include "oct6100_memory_priv.h"
#include "oct6100_tsst_priv.h"
#include "oct6100_channel_priv.h"
#include "oct6100_tsi_cnct_priv.h"
/**************************** PUBLIC FUNCTIONS ****************************/
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100TsiCnctOpen
Description: This function opens a TSI connection between two TDM timeslots.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to TSI connection open structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100TsiCnctOpenDef
UINT32 Oct6100TsiCnctOpenDef(
tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen )
{
f_pTsiCnctOpen->pulTsiCnctHndl = NULL;
f_pTsiCnctOpen->ulInputTimeslot = cOCT6100_INVALID_TIMESLOT;
f_pTsiCnctOpen->ulInputStream = cOCT6100_INVALID_STREAM;
f_pTsiCnctOpen->ulOutputTimeslot = cOCT6100_INVALID_TIMESLOT;
f_pTsiCnctOpen->ulOutputStream = cOCT6100_INVALID_STREAM;
return cOCT6100_ERR_OK;
}
#endif
#if !SKIP_Oct6100TsiCnctOpen
UINT32 Oct6100TsiCnctOpen(
tPOCT6100_INSTANCE_API f_pApiInstance,
tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen )
{
tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
UINT32 ulSerRes = cOCT6100_ERR_OK;
UINT32 ulFncRes = cOCT6100_ERR_OK;
/* Set the process context of the serialize structure. */
SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
/* Seize all list semaphores needed by this function. */
SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
if ( ulSerRes == cOCT6100_ERR_OK )
{
/* Call the serialized function. */
ulFncRes = Oct6100TsiCnctOpenSer( f_pApiInstance, f_pTsiCnctOpen );
}
else
{
return ulSerRes;
}
/* Release the seized semaphores. */
ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
/* If an error occured then return the error code. */
if ( ulSerRes != cOCT6100_ERR_OK )
return ulSerRes;
if ( ulFncRes != cOCT6100_ERR_OK )
return ulFncRes;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100TsiCnctClose
Description: This function closes a TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctClose Pointer to TSI connection close structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100TsiCnctCloseDef
UINT32 Oct6100TsiCnctCloseDef(
tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose )
{
f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE;
return cOCT6100_ERR_OK;
}
#endif
#if !SKIP_Oct6100TsiCnctClose
UINT32 Oct6100TsiCnctClose(
tPOCT6100_INSTANCE_API f_pApiInstance,
tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose )
{
tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj;
tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj;
UINT32 ulSerRes = cOCT6100_ERR_OK;
UINT32 ulFncRes = cOCT6100_ERR_OK;
/* Set the process context of the serialize structure. */
SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext;
ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext;
/* Seize all list semaphores needed by this function. */
SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY;
ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj );
if ( ulSerRes == cOCT6100_ERR_OK )
{
/* Call the serialized function. */
ulFncRes = Oct6100TsiCnctCloseSer( f_pApiInstance, f_pTsiCnctClose );
}
else
{
return ulSerRes;
}
/* Release the seized semaphores. */
ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj;
ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj );
/* If an error occured then return the error code. */
if ( ulSerRes != cOCT6100_ERR_OK )
return ulSerRes;
if ( ulFncRes != cOCT6100_ERR_OK )
return ulFncRes;
return cOCT6100_ERR_OK;
}
#endif
/**************************** PRIVATE FUNCTIONS ****************************/
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiGetTsiCnctSwSizes
Description: Gets the sizes of all portions of the API instance pertinent
to the management the TSI memory.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pOpenChip Pointer to chip configuration struct.
f_pInstSizes Pointer to struct containing instance sizes.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiGetTsiCnctSwSizes
UINT32 Oct6100ApiGetTsiCnctSwSizes(
IN tPOCT6100_CHIP_OPEN f_pOpenChip,
OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes )
{
UINT32 ulTempVar;
UINT32 ulResult;
/* Determine the amount of memory required for the API TSI connection list. */
f_pInstSizes->ulTsiCnctList = f_pOpenChip->ulMaxTsiCncts * sizeof( tOCT6100_API_TSI_CNCT );
if ( f_pOpenChip->ulMaxTsiCncts > 0 )
{
/* Calculate memory needed for TSI memory allocation. */
ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxTsiCncts, &f_pInstSizes->ulTsiCnctAlloc );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_48;
}
else
{
f_pInstSizes->ulTsiCnctAlloc = 0;
}
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctList, ulTempVar )
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctAlloc, ulTempVar )
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiTsiCnctSwInit
Description: Initializes all elements of the instance structure associated
to the TSI memory.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep
the present state of the chip and all its resources.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiTsiCnctSwInit
UINT32 Oct6100ApiTsiCnctSwInit(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance )
{
tPOCT6100_API_TSI_CNCT pChannelsTsiList;
tPOCT6100_SHARED_INFO pSharedInfo;
UINT32 ulMaxTsiChannels;
PVOID pTsiChannelsAlloc;
UINT32 ulResult;
/* Get local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
/* Initialize the TSI connections API list. */
ulMaxTsiChannels = pSharedInfo->ChipConfig.usMaxTsiCncts;
mOCT6100_GET_TSI_CNCT_LIST_PNT( pSharedInfo, pChannelsTsiList )
/* Clear the memory. */
Oct6100UserMemSet( pChannelsTsiList, 0x00, sizeof(tOCT6100_API_TSI_CNCT) * ulMaxTsiChannels );
/* Set all entries in the TSI connections list to unused. */
if ( ulMaxTsiChannels > 0 )
{
mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChannelsAlloc )
ulResult = OctapiLlmAllocInit( &pTsiChannelsAlloc, ulMaxTsiChannels );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_49;
}
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100TsiCnctOpenSer
Description: Opens a TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to a tOCT6100_TSI_CNCT_OPEN structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100TsiCnctOpenSer
UINT32 Oct6100TsiCnctOpenSer(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen )
{
UINT16 usTsiChanIndex;
UINT16 usTsiMemIndex;
UINT16 usInputTsstIndex;
UINT16 usOutputTsstIndex;
UINT32 ulResult;
/* Check the user's configuration of the TSI connection open structure for errors. */
ulResult = Oct6100ApiCheckTsiParams( f_pApiInstance, f_pTsiCnctOpen );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Reserve all resources needed by the TSI connection. */
ulResult = Oct6100ApiReserveTsiResources( f_pApiInstance, f_pTsiCnctOpen, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Write all necessary structures to activate the TSI connection. */
ulResult = Oct6100ApiWriteTsiStructs( f_pApiInstance, f_pTsiCnctOpen, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Update the TSI connection entry in the API list. */
ulResult = Oct6100ApiUpdateTsiEntry( f_pApiInstance, f_pTsiCnctOpen, usTsiChanIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiCheckTsiParams
Description: Checks the user's TSI connection open configuration for errors.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to TSI connection open configuration structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiCheckTsiParams
UINT32 Oct6100ApiCheckTsiParams(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen )
{
UINT32 ulResult;
/* Check for errors. */
if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxTsiCncts == 0 )
return cOCT6100_ERR_TSI_CNCT_DISABLED;
if ( f_pTsiCnctOpen->pulTsiCnctHndl == NULL )
return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE;
/* Check the input TDM streams, timeslots component for errors. */
ulResult = Oct6100ApiValidateTsst( f_pApiInstance,
cOCT6100_NUMBER_TSSTS_1,
f_pTsiCnctOpen->ulInputTimeslot,
f_pTsiCnctOpen->ulInputStream,
cOCT6100_INPUT_TSST );
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT )
{
return cOCT6100_ERR_TSI_CNCT_INPUT_TIMESLOT;
}
else if ( ulResult == cOCT6100_ERR_TSST_STREAM )
{
return cOCT6100_ERR_TSI_CNCT_INPUT_STREAM;
}
else
{
return ulResult;
}
}
/* Check the output TDM streams, timeslots component for errors. */
ulResult = Oct6100ApiValidateTsst( f_pApiInstance,
cOCT6100_NUMBER_TSSTS_1,
f_pTsiCnctOpen->ulOutputTimeslot,
f_pTsiCnctOpen->ulOutputStream,
cOCT6100_OUTPUT_TSST );
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT )
{
return cOCT6100_ERR_TSI_CNCT_OUTPUT_TIMESLOT;
}
else if ( ulResult == cOCT6100_ERR_TSST_STREAM )
{
return cOCT6100_ERR_TSI_CNCT_OUTPUT_STREAM;
}
else
{
return ulResult;
}
}
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReserveTsiResources
Description: Reserves all resources needed for the new TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to tsi channel configuration structure.
f_pusTsiChanIndex Allocated entry in TSI channel list.
f_pusTsiMemIndex Allocated entry in the TSI control memory.
f_pusInputTsstIndex TSST memory index of the input samples.
f_pusOutputTsstIndex TSST memory index of the output samples.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReserveTsiResources
UINT32 Oct6100ApiReserveTsiResources(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen,
OUT PUINT16 f_pusTsiChanIndex,
OUT PUINT16 f_pusTsiMemIndex,
OUT PUINT16 f_pusInputTsstIndex,
OUT PUINT16 f_pusOutputTsstIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
UINT32 ulResult;
UINT32 ulTempVar;
BOOL fTsiChanEntry = FALSE;
BOOL fTsiMemEntry = FALSE;
BOOL fInputTsst = FALSE;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
/* Reserve an entry in the TSI connection list. */
ulResult = Oct6100ApiReserveTsiCnctEntry( f_pApiInstance, f_pusTsiChanIndex );
if ( ulResult == cOCT6100_ERR_OK )
{
fTsiChanEntry = TRUE;
/* Find a TSI memory entry. */
ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, f_pusTsiMemIndex );
if ( ulResult == cOCT6100_ERR_OK )
{
fTsiMemEntry = TRUE;
/* Reserve the input TSST entry. */
ulResult = Oct6100ApiReserveTsst( f_pApiInstance,
f_pTsiCnctOpen->ulInputTimeslot,
f_pTsiCnctOpen->ulInputStream,
cOCT6100_NUMBER_TSSTS_1,
cOCT6100_INPUT_TSST,
f_pusInputTsstIndex,
NULL );
if ( ulResult == cOCT6100_ERR_OK )
{
fInputTsst = TRUE;
/* Reserve the output TSST entry. */
ulResult = Oct6100ApiReserveTsst( f_pApiInstance,
f_pTsiCnctOpen->ulOutputTimeslot,
f_pTsiCnctOpen->ulOutputStream,
cOCT6100_NUMBER_TSSTS_1,
cOCT6100_OUTPUT_TSST,
f_pusOutputTsstIndex,
NULL );
}
}
else
{
/* Return an error other then a fatal. */
ulResult = cOCT6100_ERR_TSI_CNCT_NO_MORE_TSI_AVAILABLE;
}
}
if ( ulResult != cOCT6100_ERR_OK )
{
if( fTsiChanEntry == TRUE )
{
ulTempVar = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, *f_pusTsiChanIndex );
if ( ulTempVar != cOCT6100_ERR_OK )
return ulTempVar;
}
if( fTsiMemEntry == TRUE )
{
ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, *f_pusTsiMemIndex );
if ( ulTempVar != cOCT6100_ERR_OK )
return ulTempVar;
}
if( fInputTsst == TRUE )
{
ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance,
f_pTsiCnctOpen->ulInputTimeslot,
f_pTsiCnctOpen->ulInputStream,
cOCT6100_NUMBER_TSSTS_1,
cOCT6100_INPUT_TSST,
cOCT6100_INVALID_INDEX );
if ( ulTempVar != cOCT6100_ERR_OK )
return ulTempVar;
}
return ulResult;
}
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiWriteTsiStructs
Description: Performs all the required structure writes to configure the
new TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to tsi connection open structure.
f_usTsiMemIndex Allocated entry in the TSI control memory.
f_usInputTsstIndex TSST memory index of the input samples.
f_usOutputTsstIndex TSST memory index of the output samples.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiWriteTsiStructs
UINT32 Oct6100ApiWriteTsiStructs(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen,
IN UINT16 f_usTsiMemIndex,
IN UINT16 f_usInputTsstIndex,
IN UINT16 f_usOutputTsstIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tOCT6100_WRITE_PARAMS WriteParams;
UINT32 ulResult;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
/*==================================================================================*/
/* Configure the TSST control memory.*/
/* Set the input TSST control entry.*/
ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance,
f_usInputTsstIndex,
f_usTsiMemIndex,
cOCT6100_PCM_U_LAW );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Set the output TSST control entry. */
ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance,
f_usOutputTsstIndex,
cOCT6100_ADPCM_IN_LOW_BITS,
1,
f_usTsiMemIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*==================================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiUpdateTsiEntry
Description: Updates the new TSI connection in the TSI connection list.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep
the present state of the chip and all its resources.
f_pTsiCnctOpen Pointer to TSI connection open configuration structure.
f_usTsiMemIndex Allocated entry in TSI chariot memory.
f_usTsiChanIndex Allocated entry in the TSI channel list.
f_usInputTsstIndex TSST control memory index of the input TSST.
f_usOutputTsstIndex TSST control memory index of the output TSST.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiUpdateTsiEntry
UINT32 Oct6100ApiUpdateTsiEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen,
IN UINT16 f_usTsiChanIndex,
IN UINT16 f_usTsiMemIndex,
IN UINT16 f_usInputTsstIndex,
IN UINT16 f_usOutputTsstIndex )
{
tPOCT6100_API_TSI_CNCT pTsiCnctEntry;
/*================================================================================*/
/* Obtain a pointer to the new TSI connection's list entry. */
mOCT6100_GET_TSI_CNCT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsiCnctEntry, f_usTsiChanIndex )
/* Copy the TSI's configuration and allocated resources. */
pTsiCnctEntry->usInputTimeslot = (UINT16)( f_pTsiCnctOpen->ulInputTimeslot & 0xFFFF );
pTsiCnctEntry->usInputStream = (UINT16)( f_pTsiCnctOpen->ulInputStream & 0xFFFF );
pTsiCnctEntry->usOutputTimeslot = (UINT16)( f_pTsiCnctOpen->ulOutputTimeslot & 0xFFFF );
pTsiCnctEntry->usOutputStream = (UINT16)( f_pTsiCnctOpen->ulOutputStream & 0xFFFF );
/* Store hardware related information. */
pTsiCnctEntry->usTsiMemIndex = f_usTsiMemIndex;
pTsiCnctEntry->usInputTsstIndex = f_usInputTsstIndex;
pTsiCnctEntry->usOutputTsstIndex = f_usOutputTsstIndex;
/* Form handle returned to user. */
*f_pTsiCnctOpen->pulTsiCnctHndl = cOCT6100_HNDL_TAG_TSI_CNCT | (pTsiCnctEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usTsiChanIndex;
/* Finally, mark the connection as opened. */
pTsiCnctEntry->fReserved = TRUE;
/* Increment the number of TSI connection opened. */
f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts++;
/*================================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100TsiCnctCloseSer
Description: Closes a TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctClose Pointer to TSI connection close structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100TsiCnctCloseSer
UINT32 Oct6100TsiCnctCloseSer(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose )
{
UINT16 usTsiChanIndex;
UINT16 usTsiMemIndex;
UINT16 usInputTsstIndex;
UINT16 usOutputTsstIndex;
UINT32 ulResult;
/* Verify that all the parameters given match the state of the API. */
ulResult = Oct6100ApiAssertTsiParams( f_pApiInstance, f_pTsiCnctClose, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Release all resources associated to the TSI channel. */
ulResult = Oct6100ApiInvalidateTsiStructs( f_pApiInstance, usInputTsstIndex, usOutputTsstIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Release all resources associated to the TSI connection. */
ulResult = Oct6100ApiReleaseTsiResources( f_pApiInstance, usTsiChanIndex, usTsiMemIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Invalidate the handle. */
f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiAssertTsiParams
Description: Validate the handle given by the user and verify the state of
the TSI connection about to be closed.
Also returns all required information to deactivate the connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_pTsiCnctClose Pointer to TSI connection close structure.
f_pusTsiChanIndex Index of the TSI connection structure in the API list.
f_pusTsiMemIndex Index of the TSI entry within the TSI chariot memory
f_pusInputTsstIndex Index of the input entry in the TSST control memory.
f_pusOutputTsstIndex Index of the output entry in the TSST control memory.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiAssertTsiParams
UINT32 Oct6100ApiAssertTsiParams(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose,
OUT PUINT16 f_pusTsiChanIndex,
OUT PUINT16 f_pusTsiMemIndex,
OUT PUINT16 f_pusInputTsstIndex,
OUT PUINT16 f_pusOutputTsstIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_TSI_CNCT pTsiEntry;
UINT32 ulEntryOpenCnt;
/* Get local pointer(s). */
pSharedInfo = f_pApiInstance->pSharedInfo;
/* Check the provided handle. */
if ( (f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_TSI_CNCT )
return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE;
*f_pusTsiChanIndex = (UINT16)( f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_INDEX_MASK );
if ( *f_pusTsiChanIndex >= pSharedInfo->ChipConfig.usMaxTsiCncts )
return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE;
/*=======================================================================*/
/* Get a pointer to the channel's list entry. */
mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, *f_pusTsiChanIndex )
/* Extract the entry open count from the provided handle. */
ulEntryOpenCnt = (f_pTsiCnctClose->ulTsiCnctHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
/* Check for errors. */
if ( pTsiEntry->fReserved != TRUE )
return cOCT6100_ERR_TSI_CNCT_NOT_OPEN;
if ( ulEntryOpenCnt != pTsiEntry->byEntryOpenCnt )
return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE;
/* Return info needed to close the channel and release all resources. */
*f_pusInputTsstIndex = pTsiEntry->usInputTsstIndex;
*f_pusOutputTsstIndex = pTsiEntry->usOutputTsstIndex;
*f_pusTsiMemIndex = pTsiEntry->usTsiMemIndex;
/*=======================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiInvalidateTsiStructs
Description: This function closes a TSI connection.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_usInputTsstIndex Index of the input entry in the TSST control memory.
f_usOutputTsstIndex Index of the output entry in the TSST control memory.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiInvalidateTsiStructs
UINT32 Oct6100ApiInvalidateTsiStructs(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usInputTsstIndex,
IN UINT16 f_usOutputTsstIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tOCT6100_WRITE_PARAMS WriteParams;
UINT32 ulResult;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
/*==================================================================================*/
/* Deactivate the TSST control memory. */
/* Set the input TSST control entry to unused. */
WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usInputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE );
WriteParams.usWriteData = 0x0000;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Set the output TSST control entry to unused. */
WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usOutputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE );
WriteParams.usWriteData = 0x0000;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*==================================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReleaseTsiResources
Description: Release and clear the API entry associated to the TSI channel.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep the
present state of the chip and all its resources.
f_usTsiChanIndex Index of the TSI connection in the API list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReleaseTsiResources
UINT32 Oct6100ApiReleaseTsiResources(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usTsiChanIndex,
IN UINT16 f_usTsiMemIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_TSI_CNCT pTsiEntry;
UINT32 ulResult;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, f_usTsiChanIndex );
/* Release the entry in the TSI connection list. */
ulResult = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, f_usTsiChanIndex );
if ( ulResult == cOCT6100_ERR_OK )
{
ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, f_usTsiMemIndex );
if ( ulResult == cOCT6100_ERR_OK )
{
/* Release the input entry. */
ulResult = Oct6100ApiReleaseTsst( f_pApiInstance,
pTsiEntry->usInputTimeslot,
pTsiEntry->usInputStream,
cOCT6100_NUMBER_TSSTS_1,
cOCT6100_INPUT_TSST,
cOCT6100_INVALID_INDEX );
if ( ulResult == cOCT6100_ERR_OK )
{
/* Release the output TSST entry. */
ulResult = Oct6100ApiReleaseTsst( f_pApiInstance,
pTsiEntry->usOutputTimeslot,
pTsiEntry->usOutputStream,
cOCT6100_NUMBER_TSSTS_1,
cOCT6100_OUTPUT_TSST,
cOCT6100_INVALID_INDEX );
}
}
}
/* Check if an error occured while releasing the reserved resources. */
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult >= cOCT6100_ERR_FATAL )
return ulResult;
else
return cOCT6100_ERR_FATAL_4A;
}
/*=============================================================*/
/* Update the TSI connection's list entry. */
/* Mark the connection as closed. */
pTsiEntry->fReserved = FALSE;
pTsiEntry->byEntryOpenCnt++;
/* Decrement the number of TSI connection opened. */
f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts--;
/*=============================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReserveTsiCnctEntry
Description: Reserves one of the TSI connection API entry.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep
the present state of the chip and all its resources.
f_pusTsiChanIndex Resulting index reserved in the TSI channel list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReserveTsiCnctEntry
UINT32 Oct6100ApiReserveTsiCnctEntry(
IN tPOCT6100_INSTANCE_API f_pApiInstance,
OUT PUINT16 f_pusTsiChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
PVOID pTsiChanAlloc;
UINT32 ulResult;
UINT32 ulTsiIndex;
/* Get local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc )
ulResult = OctapiLlmAllocAlloc( pTsiChanAlloc, &ulTsiIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
return cOCT6100_ERR_TSI_CNCT_ALL_CHANNELS_ARE_OPENED;
else
return cOCT6100_ERR_FATAL_4B;
}
*f_pusTsiChanIndex = (UINT16)( ulTsiIndex & 0xFFFF );
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReleaseTsiCnctEntry
Description: Releases the specified TSI connection API entry.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This memory is used to keep
the present state of the chip and all its resources.
f_usTsiChanIndex Index reserved in the TSI channel list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReleaseTsiCnctEntry
UINT32 Oct6100ApiReleaseTsiCnctEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usTsiChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
PVOID pTsiChanAlloc;
UINT32 ulResult;
/* Get local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc )
ulResult = OctapiLlmAllocDealloc( pTsiChanAlloc, f_usTsiChanIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
return cOCT6100_ERR_FATAL_4C;
}
return cOCT6100_ERR_OK;
}
#endif
|