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 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586
|
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
File: oct6100_mixer.c
Copyright (c) 2001-2007 Octasic Inc.
Description:
This file contains the functions used to manage the allocation of mixer
blocks in memories.
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: 42 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/***************************** INCLUDE FILES *******************************/
#include "octdef.h"
#include "oct6100api/oct6100_defines.h"
#include "oct6100api/oct6100_errors.h"
#include "apilib/octapi_llman.h"
#include "oct6100api/oct6100_apiud.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_remote_debug_inst.h"
#include "oct6100api/oct6100_debug_inst.h"
#include "oct6100api/oct6100_api_inst.h"
#include "oct6100api/oct6100_channel_inst.h"
#include "oct6100api/oct6100_mixer_inst.h"
#include "oct6100api/oct6100_interrupts_pub.h"
#include "oct6100api/oct6100_chip_open_pub.h"
#include "oct6100api/oct6100_channel_pub.h"
#include "oct6100api/oct6100_mixer_pub.h"
#include "oct6100_chip_open_priv.h"
#include "oct6100_miscellaneous_priv.h"
#include "oct6100_channel_priv.h"
#include "oct6100_mixer_priv.h"
/**************************** PUBLIC FUNCTIONS ****************************/
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100MixerCopyEventCreate
Description: This function creates a mixer copy event used to copy
information from one channel port to another channel port.
-------------------------------------------------------------------------------
| 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_pCopyEventCreate Pointer to a mixer copy event structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100MixerCopyEventCreateDef
UINT32 Oct6100MixerCopyEventCreateDef(
tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate )
{
f_pCopyEventCreate->pulCopyEventHndl = NULL;
f_pCopyEventCreate->ulSourceChanHndl = cOCT6100_INVALID_HANDLE;
f_pCopyEventCreate->ulSourcePort = cOCT6100_INVALID_PORT;
f_pCopyEventCreate->ulDestinationChanHndl = cOCT6100_INVALID_HANDLE;
f_pCopyEventCreate->ulDestinationPort = cOCT6100_INVALID_PORT;
return cOCT6100_ERR_OK;
}
#endif
#if !SKIP_Oct6100MixerCopyEventCreate
UINT32 Oct6100MixerCopyEventCreate(
tPOCT6100_INSTANCE_API f_pApiInstance,
tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate )
{
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 = Oct6100MixerCopyEventCreateSer( f_pApiInstance, f_pCopyEventCreate );
}
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: Oct6100MixerCopyEventDestroy
Description: This function destroys a mixer copy event used to copy
information from one channel port to another.
-------------------------------------------------------------------------------
| 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_pCopyEventDestroy Pointer to a destroy copy event structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100MixerCopyEventDestroyDef
UINT32 Oct6100MixerCopyEventDestroyDef(
tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy )
{
f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE;
return cOCT6100_ERR_OK;
}
#endif
#if !SKIP_Oct6100MixerCopyEventDestroy
UINT32 Oct6100MixerCopyEventDestroy(
tPOCT6100_INSTANCE_API f_pApiInstance,
tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy )
{
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 = Oct6100MixerCopyEventDestroySer( f_pApiInstance, f_pCopyEventDestroy );
}
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: Oct6100ApiGetMixerSwSizes
Description: Gets the sizes of all portions of the API instance pertinent
to the management of mixer events.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pOpenChip User chip configuration.
f_pInstSizes Pointer to struct containing instance sizes.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiGetMixerSwSizes
UINT32 Oct6100ApiGetMixerSwSizes(
IN tPOCT6100_CHIP_OPEN f_pOpenChip,
OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes )
{
UINT32 ulTempVar;
UINT32 ulResult;
/* Calculate the API memory required for the resource entry lists. */
f_pInstSizes->ulMixerEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT );
/* Calculate memory needed for mixers entry allocation. */
ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulMixerEventAlloc );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_1D;
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventList, ulTempVar )
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventAlloc, ulTempVar )
f_pInstSizes->ulCopyEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_COPY_EVENT );
ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulCopyEventAlloc );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_1D;
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventList, ulTempVar )
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventAlloc, ulTempVar )
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiMixerSwInit
Description: Initializes all elements of the instance structure associated
to the mixer events.
-------------------------------------------------------------------------------
| Argument | Description
-------------------------------------------------------------------------------
f_pApiInstance Pointer to API instance. This mixer is used to keep
the present state of the chip and all its resources.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiMixerSwInit
UINT32 Oct6100ApiMixerSwInit(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_MIXER_EVENT pMixerEventList;
PVOID pMixerEventAlloc;
PVOID pCopyEventAlloc;
UINT32 ulTempVar;
UINT32 ulResult;
/* Get local pointer(s). */
pSharedInfo = f_pApiInstance->pSharedInfo;
/*===================================================================*/
/* Initialize the mixer event list. */
mOCT6100_GET_MIXER_EVENT_LIST_PNT( pSharedInfo, pMixerEventList );
/* Initialize the mixer event allocation software to "all free". */
Oct6100UserMemSet( pMixerEventList, 0x00, cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT ));
mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( pSharedInfo, pMixerEventAlloc )
ulResult = OctapiLlmAllocInit( &pMixerEventAlloc, cOCT6100_MAX_MIXER_EVENTS );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_1F;
/* Now reserve the first entry as the first node. */
ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar );
if ( ulResult != cOCT6100_ERR_OK )
{
return cOCT6100_ERR_FATAL_20;
}
/* Check that we obtain the first event. */
if ( ulTempVar != 0 )
return cOCT6100_ERR_FATAL_21;
/* Now reserve the tail entry. */
ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar );
if ( ulResult != cOCT6100_ERR_OK )
{
return cOCT6100_ERR_FATAL_AA;
}
/* Check that we obtain the first event. */
if ( ulTempVar != 1 )
return cOCT6100_ERR_FATAL_AB;
/* Program the head node. */
pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].fReserved = TRUE;
pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE;
pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
/* Program the tail node. */
pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].fReserved = TRUE;
pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usNextEventPtr = cOCT6100_INVALID_INDEX;
pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
/* Now reserve the entry used for channel recording if the feature is enabled. */
if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE )
{
UINT32 ulAllocIndex;
/* Reserve an entry to copy the desire SOUT signal to the SIN signal of the recording channel. */
ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
return cOCT6100_ERR_FATAL_90;
}
pSharedInfo->MixerInfo.usRecordCopyEventIndex = (UINT16)( ulAllocIndex & 0xFFFF );
/* Reserve an entry to copy the saved SIN signal of the debugged channel into it's original location. */
ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
return cOCT6100_ERR_FATAL_90;
}
pSharedInfo->MixerInfo.usRecordSinEventIndex = (UINT16)( ulAllocIndex & 0xFFFF );
/* Configure the SIN event. */
pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].fReserved = TRUE;
pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE;
pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
/* Configure the SOUT copy event. */
pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].fReserved = TRUE;
pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex;
pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
/* Program the head node. */
pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex;
}
/* Initialize the copy event list. */
mOCT6100_GET_COPY_EVENT_ALLOC_PNT( pSharedInfo, pCopyEventAlloc )
ulResult = OctapiLlmAllocInit( &pCopyEventAlloc, cOCT6100_MAX_MIXER_EVENTS );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_B4;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiMixerEventAdd
Description: This function adds a mixer event event to the list of events
based on the event type passed to the function.
-------------------------------------------------------------------------------
| 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_usEventIndex Index of the event within the API's mixer event list.
f_usEventType Type of mixer event.
f_usDestinationChanIndex Index of the destination channel within the API's
channel list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiMixerEventAdd
UINT32 Oct6100ApiMixerEventAdd(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usEventIndex,
IN UINT16 f_usEventType,
IN UINT16 f_usDestinationChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_MIXER_EVENT pCurrentEventEntry;
tPOCT6100_API_MIXER_EVENT pTempEventEntry;
tPOCT6100_API_CHANNEL pDestinationEntry;
tOCT6100_WRITE_PARAMS WriteParams;
UINT32 ulResult;
UINT16 usTempEventIndex;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
/* Get a pointer to the event entry. */
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex );
/* Get a pointer to the destination channel entry. */
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex );
/* Now proceed according to the event type. */
switch ( f_usEventType )
{
case cOCT6100_EVENT_TYPE_SOUT_COPY:
/* Now insert the Sin copy event */
if ( pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
{
/* The only node in the list before the point where the node needs to */
/* be inserted is the head node. */
usTempEventIndex = cOCT6100_MIXER_HEAD_NODE;
/* This node will be the first one in the Sout copy section. */
pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = f_usEventIndex;
pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex;
}
else /* pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr != cOCT6100_INVALID_INDEX */
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex;
}
break;
case cOCT6100_EVENT_TYPE_SIN_COPY:
/* Now insert the Sin copy event. */
if ( pSharedInfo->MixerInfo.usFirstSinCopyEventPtr == cOCT6100_INVALID_INDEX )
{
/* This is the first Sin copy event. We must find the event that comes before */
/* the event we want to add. First let's check for a bridge event. */
if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == cOCT6100_INVALID_INDEX )
{
/* No event in the bridge section, now let's check in the Sout copy section. */
if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX )
{
/* The only node in the list then is the head node. */
usTempEventIndex = cOCT6100_MIXER_HEAD_NODE;
}
else
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
}
}
else
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr;
}
/* This node will be the first one in the Sin copy section. */
pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = f_usEventIndex;
pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex;
}
else /* pSharedInfo->MixerInfo.usFirstSinCopyEventPtr != cOCT6100_INVALID_INDEX */
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastSinCopyEventPtr;
pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex;
}
break;
default:
return cOCT6100_ERR_FATAL_AF;
}
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex );
/*=======================================================================*/
/* Program the Copy event. */
/* Set the Copy event first. */
pCurrentEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_COPY;
pCurrentEventEntry->usNextEventPtr = pTempEventEntry->usNextEventPtr;
WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
WriteParams.ulWriteAddress += 4;
WriteParams.usWriteData = pCurrentEventEntry->usNextEventPtr;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/*=======================================================================*/
/* Modify the previous node. */
/* Set the last Sub-store entry. */
pTempEventEntry->usNextEventPtr = f_usEventIndex;
WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
WriteParams.ulWriteAddress += 4;
WriteParams.usWriteData = f_usEventIndex;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/* Save the destination channel index, needed when removing the event from the mixer. */
pCurrentEventEntry->usDestinationChanIndex = f_usDestinationChanIndex;
/* Mark the entry as reserved. */
pCurrentEventEntry->fReserved = TRUE;
/* Increment the event count on that particular destination channel */
pDestinationEntry->usMixerEventCnt++;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiMixerEventRemove
Description: This function removes a mixer event event from the list of events based
on the event type passed to the function.
-------------------------------------------------------------------------------
| 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_usEventIndex Index of event within the API's mixer event list.
f_usEventType Type of mixer event.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiMixerEventRemove
UINT32 Oct6100ApiMixerEventRemove(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usEventIndex,
IN UINT16 f_usEventType )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_MIXER_EVENT pCurrentEventEntry;
tPOCT6100_API_MIXER_EVENT pTempEventEntry;
tPOCT6100_API_CHANNEL pDestinationEntry;
tOCT6100_WRITE_BURST_PARAMS BurstWriteParams;
tOCT6100_WRITE_PARAMS WriteParams;
BOOL fFirstSinCopyEvent = FALSE;
UINT32 ulResult;
UINT16 usTempEventIndex;
UINT32 ulLoopCount = 0;
UINT16 ausWriteData[ 4 ] = { 0 };
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
BurstWriteParams.pProcessContext = f_pApiInstance->pProcessContext;
BurstWriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
BurstWriteParams.pusWriteData = ausWriteData;
BurstWriteParams.ulWriteLength = 4;
/* Get a pointer to the event entry. */
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex );
/* Get the pointer to the channel entry. */
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCurrentEventEntry->usDestinationChanIndex );
/* Now proceed according to the event type. */
switch ( f_usEventType )
{
case cOCT6100_EVENT_TYPE_SOUT_COPY:
if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr )
{
usTempEventIndex = cOCT6100_MIXER_HEAD_NODE;
}
else
{
/* Now insert the Sin copy event. */
usTempEventIndex = pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr;
}
/* Find the copy entry before the entry to remove. */
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex );
while( pTempEventEntry->usNextEventPtr != f_usEventIndex )
{
usTempEventIndex = pTempEventEntry->usNextEventPtr;
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex );
ulLoopCount++;
if ( ulLoopCount == cOCT6100_MAX_LOOP )
return cOCT6100_ERR_FATAL_B2;
}
/*=======================================================================*/
/* Update the global mixer pointers. */
if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr )
{
if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr )
{
/* This event was the only of the list.*/
pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = cOCT6100_INVALID_INDEX;
pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = cOCT6100_INVALID_INDEX;
}
else
{
pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = pCurrentEventEntry->usNextEventPtr;
}
}
else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr )
{
pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = usTempEventIndex;
}
/*=======================================================================*/
break;
case cOCT6100_EVENT_TYPE_SIN_COPY:
if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr )
{
fFirstSinCopyEvent = TRUE;
if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr != cOCT6100_INVALID_INDEX )
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr;
}
else if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr != cOCT6100_INVALID_INDEX )
{
usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr;
}
else
{
usTempEventIndex = cOCT6100_MIXER_HEAD_NODE;
}
}
else
{
/* Now insert the Sin copy event. */
usTempEventIndex = pSharedInfo->MixerInfo.usFirstSinCopyEventPtr;
}
/* Find the copy entry before the entry to remove. */
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex );
/* If we are not the first event of the Sin copy list. */
if ( fFirstSinCopyEvent == FALSE )
{
while( pTempEventEntry->usNextEventPtr != f_usEventIndex )
{
usTempEventIndex = pTempEventEntry->usNextEventPtr;
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex );
ulLoopCount++;
if ( ulLoopCount == cOCT6100_MAX_LOOP )
return cOCT6100_ERR_FATAL_B1;
}
}
/*=======================================================================*/
/* Update the global mixer pointers. */
if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr )
{
if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr )
{
/* This event was the only of the list. */
pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = cOCT6100_INVALID_INDEX;
pSharedInfo->MixerInfo.usLastSinCopyEventPtr = cOCT6100_INVALID_INDEX;
}
else
{
pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pCurrentEventEntry->usNextEventPtr;
}
}
else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr )
{
pSharedInfo->MixerInfo.usLastSinCopyEventPtr = usTempEventIndex;
}
/*=======================================================================*/
break;
default:
return cOCT6100_ERR_FATAL_B0;
}
/*=======================================================================*/
/* Modify the previous event. */
pTempEventEntry->usNextEventPtr = pCurrentEventEntry->usNextEventPtr;
WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
WriteParams.ulWriteAddress += 4;
WriteParams.usWriteData = pTempEventEntry->usNextEventPtr;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/*=======================================================================*/
/* Clear the current event. */
BurstWriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
mOCT6100_DRIVER_WRITE_BURST_API( BurstWriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/*=======================================================================*/
/* Decrement the mixer event count active on that channel. */
pDestinationEntry->usMixerEventCnt--;
/*=======================================================================*/
/*=======================================================================*/
/* This index of this channel is not valid anymore! */
pCurrentEventEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX;
/* Mark this entry as free. */
pCurrentEventEntry->fReserved = FALSE;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100MixerCopyEventCreateSer
-------------------------------------------------------------------------------
| 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_pCopyEventCreate Pointer to a create copy event structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100MixerCopyEventCreateSer
UINT32 Oct6100MixerCopyEventCreateSer(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate )
{
UINT16 usCopyEventIndex = 0;
UINT16 usMixerEventIndex = 0;
UINT16 usSourceChanIndex;
UINT16 usDestinationChanIndex;
UINT32 ulResult;
/* Check the user's configuration of the copy event for errors. */
ulResult = Oct6100ApiCheckCopyEventCreateParams( f_pApiInstance,
f_pCopyEventCreate,
&usSourceChanIndex,
&usDestinationChanIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Reserve all resources needed by the copy event. */
ulResult = Oct6100ApiReserveCopyEventCreateResources( f_pApiInstance,
&usCopyEventIndex,
&usMixerEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Write all necessary structures to activate the echo cancellation channel. */
ulResult = Oct6100ApiWriteCopyEventCreateStructs( f_pApiInstance,
f_pCopyEventCreate,
usMixerEventIndex,
usSourceChanIndex,
usDestinationChanIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Update the new echo cancellation channels's entry in the ECHO channel list. */
ulResult = Oct6100ApiUpdateCopyEventCreateEntry( f_pApiInstance,
f_pCopyEventCreate,
usCopyEventIndex,
usMixerEventIndex,
usSourceChanIndex,
usDestinationChanIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiCheckCopyEventCreateParams
Description: Checks the user's parameter passed to the create
copy event function.
-------------------------------------------------------------------------------
| 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_pCopyEventCreate Pointer to a create copy event structure.
f_pusSourceChanIndex Pointer to the index of the input channel.
f_pusDestinationChanIndex Pointer to the index of the output channel.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiCheckCopyEventCreateParams
UINT32 Oct6100ApiCheckCopyEventCreateParams(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate,
OUT PUINT16 f_pusSourceChanIndex,
OUT PUINT16 f_pusDestinationChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_CHANNEL pSourceEntry;
tPOCT6100_API_CHANNEL pDestinationEntry;
UINT32 ulEntryOpenCnt;
/* Obtain shared resources pointer. */
pSharedInfo = f_pApiInstance->pSharedInfo;
if ( f_pCopyEventCreate->pulCopyEventHndl == NULL )
return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE;
if ( f_pCopyEventCreate->ulSourceChanHndl == cOCT6100_INVALID_HANDLE )
return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE;
if ( f_pCopyEventCreate->ulDestinationChanHndl == cOCT6100_INVALID_HANDLE )
return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE;
if ( f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_RIN &&
f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_SIN )
return cOCT6100_ERR_MIXER_SOURCE_PORT;
if ( f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_RIN &&
f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_SIN )
return cOCT6100_ERR_MIXER_DESTINATION_PORT;
/*=======================================================================*/
/* Verify the first channel handle. */
if ( (f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE;
*f_pusSourceChanIndex = (UINT16)( f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_INDEX_MASK );
if ( *f_pusSourceChanIndex >= pSharedInfo->ChipConfig.usMaxChannels )
return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE;
/* Get a pointer to the channel's list entry. */
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, *f_pusSourceChanIndex )
/* Extract the entry open count from the provided handle. */
ulEntryOpenCnt = ( f_pCopyEventCreate->ulSourceChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
/* Check for errors. */
if ( pSourceEntry->fReserved != TRUE )
return cOCT6100_ERR_CHANNEL_NOT_OPEN;
if ( ulEntryOpenCnt != pSourceEntry->byEntryOpenCnt )
return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE;
if ( pSourceEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulSourcePort )
return cOCT6100_ERR_MIXER_SOURCE_ADPCM_RESOURCES_ACTIVATED;
/*=======================================================================*/
/*=======================================================================*/
/* Verify the second channel handle. */
if ( (f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL )
return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE;
*f_pusDestinationChanIndex = (UINT16)( f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_INDEX_MASK );
if ( *f_pusDestinationChanIndex >= pSharedInfo->ChipConfig.usMaxChannels )
return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE;
/* Get a pointer to the channel's list entry. */
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, *f_pusDestinationChanIndex )
/* Extract the entry open count from the provided handle. */
ulEntryOpenCnt = ( f_pCopyEventCreate->ulDestinationChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
/* Check for errors. */
if ( pDestinationEntry->fReserved != TRUE )
return cOCT6100_ERR_CHANNEL_NOT_OPEN;
if ( ulEntryOpenCnt != pDestinationEntry->byEntryOpenCnt )
return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE;
if ( pDestinationEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulDestinationPort )
return cOCT6100_ERR_MIXER_DEST_ADPCM_RESOURCES_ACTIVATED;
/*=======================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReserveCopyEventCreateResources
-------------------------------------------------------------------------------
| 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_pusCopyEntryIndex Pointer to the index of the copy entry within the API's list.
f_pusCopyEventIndex Pointer to the index of the mixer copy event.
.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReserveCopyEventCreateResources
UINT32 Oct6100ApiReserveCopyEventCreateResources(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
OUT PUINT16 f_pusCopyEntryIndex,
IN OUT PUINT16 f_pusCopyEventIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
UINT32 ulResult = cOCT6100_ERR_OK;
UINT32 ulTempVar;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
/*===============================================================================*/
/* Verify and reserve the resources that might already be allocated. */
ulResult = Oct6100ApiReserveCopyEventEntry( f_pApiInstance,
f_pusCopyEntryIndex );
if ( ulResult == cOCT6100_ERR_OK )
{
/* Reserve the source copy event for the first channel. */
ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance,
f_pusCopyEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
/* Reserve the Sin copy event for the first channel. */
ulTempVar = Oct6100ApiReleaseCopyEventEntry ( f_pApiInstance,
*f_pusCopyEntryIndex );
if ( ulTempVar != cOCT6100_ERR_OK )
return ulTempVar;
}
}
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiWriteCopyEventCreateStructs
Description: Performs all the required structure writes to configure the
new copy event
-------------------------------------------------------------------------------
| 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_pCopyEventCreate Pointer to a create copy event structure.
f_usMixerEventIndex Index of the copy event within the mixer memory.
f_usSourceChanIndex Index of the source channel within the API's channel list.
f_usDestinationChanIndex Index of the destination channel within the API's channel list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiWriteCopyEventCreateStructs
UINT32 Oct6100ApiWriteCopyEventCreateStructs(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate,
IN UINT16 f_usMixerEventIndex,
IN UINT16 f_usSourceChanIndex,
IN UINT16 f_usDestinationChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_CHANNEL pSourceEntry;
tPOCT6100_API_CHANNEL pDestinationEntry;
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;
/*==============================================================================*/
/* Get a pointer to the two channel entry. */
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, f_usSourceChanIndex );
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex );
/*==============================================================================*/
/* Configure the TSST control memory and add the Sin copy event if necessary. */
WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY;
if ( f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_RIN )
{
WriteParams.usWriteData |= pSourceEntry->usRinRoutTsiMemIndex;
WriteParams.usWriteData |= pSourceEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
}
else /* f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_SIN */
{
if ( pSourceEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX )
{
WriteParams.usWriteData |= pSourceEntry->usExtraSinTsiMemIndex;
}
else
{
WriteParams.usWriteData |= pSourceEntry->usSinSoutTsiMemIndex;
}
WriteParams.usWriteData |= pSourceEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET;
}
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
WriteParams.ulWriteAddress += 2;
if ( f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_RIN )
{
WriteParams.usWriteData = (UINT16)( pDestinationEntry->usRinRoutTsiMemIndex );
}
else /* f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_SIN */
{
WriteParams.usWriteData = (UINT16)( pDestinationEntry->usSinSoutTsiMemIndex );
}
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/* Now insert the event into the event list. */
ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance,
f_usMixerEventIndex,
cOCT6100_EVENT_TYPE_SIN_COPY,
f_usDestinationChanIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Increment the copy event count on this channel. */
pDestinationEntry->usCopyEventCnt++;
/*==============================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiUpdateCopyEventCreateEntry
-------------------------------------------------------------------------------
| 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_pCopyEventCreate Pointer to a create copy event structure.
f_usCopyEventIndex Index of the copy event within the API's event list.
f_usMixerEventIndex Index of the copy event within the mixer memory.
f_usSourceChanIndex Index of the source channel within the API's channel list.
f_usDestinationChanIndex Index of the destination channel within the API's channel list.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiUpdateCopyEventCreateEntry
UINT32 Oct6100ApiUpdateCopyEventCreateEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate,
IN UINT16 f_usCopyEventIndex,
IN UINT16 f_usMixerEventIndex,
IN UINT16 f_usSourceChanIndex,
IN UINT16 f_usDestinationChanIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_COPY_EVENT pCopyEventEntry;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
/* Obtain a pointer to the new buffer's list entry. */
mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex );
/*=======================================================================*/
/* Copy the channel's configuration and allocated resources. */
/* Save the channel info in the copy event. */
pCopyEventEntry->usSourceChanIndex = f_usSourceChanIndex;
pCopyEventEntry->bySourcePort = (UINT8)( f_pCopyEventCreate->ulSourcePort & 0xFF );
pCopyEventEntry->usDestinationChanIndex = f_usDestinationChanIndex;
pCopyEventEntry->byDestinationPort = (UINT8)( f_pCopyEventCreate->ulDestinationPort & 0xFF );
pCopyEventEntry->usMixerEventIndex = f_usMixerEventIndex;
/*=======================================================================*/
/* Form handle returned to user. */
*f_pCopyEventCreate->pulCopyEventHndl = cOCT6100_HNDL_TAG_COPY_EVENT | (pCopyEventEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usCopyEventIndex;
/* Finally, mark the event as used. */
pCopyEventEntry->fReserved = TRUE;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100MixerCopyEventDestroySer
-------------------------------------------------------------------------------
| 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_pCopyEventDestroy Pointer to a destroy copy event structure.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100MixerCopyEventDestroySer
UINT32 Oct6100MixerCopyEventDestroySer(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy )
{
UINT16 usCopyEventIndex;
UINT16 usMixerEventIndex;
UINT32 ulResult;
/* Verify that all the parameters given match the state of the API. */
ulResult = Oct6100ApiAssertCopyEventDestroyParams( f_pApiInstance,
f_pCopyEventDestroy,
&usCopyEventIndex,
&usMixerEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Release all resources associated to the echo cancellation channel. */
ulResult = Oct6100ApiInvalidateCopyEventStructs( f_pApiInstance,
usCopyEventIndex,
usMixerEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Release all resources associated to the echo cancellation channel. */
ulResult = Oct6100ApiReleaseCopyEventResources( f_pApiInstance,
usCopyEventIndex,
usMixerEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/* Invalidate the handle. */
f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiAssertCopyEventDestroyParams
Description:
-------------------------------------------------------------------------------
| 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_pCopyEventDestroy Pointer to a destroy copy event structure.
f_pusCopyEventIndex Pointer to the index of the copy event in the API.
f_pusMixerEventIndex Pointer to the index of the copy event in the mixer memory.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiAssertCopyEventDestroyParams
UINT32 Oct6100ApiAssertCopyEventDestroyParams(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy,
IN OUT PUINT16 f_pusCopyEventIndex,
IN OUT PUINT16 f_pusMixerEventIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_COPY_EVENT pCopyEventEntry;
UINT32 ulEntryOpenCnt;
/* Get local pointer(s). */
pSharedInfo = f_pApiInstance->pSharedInfo;
/* Check the provided handle. */
if ( (f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_COPY_EVENT )
return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE;
*f_pusCopyEventIndex = (UINT16)( f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_INDEX_MASK );
if ( *f_pusCopyEventIndex >= cOCT6100_MAX_MIXER_EVENTS )
return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE;
/*=======================================================================*/
mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, *f_pusCopyEventIndex )
/* Extract the entry open count from the provided handle. */
ulEntryOpenCnt = ( f_pCopyEventDestroy->ulCopyEventHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK;
/* Check for errors. */
if ( pCopyEventEntry->fReserved != TRUE )
return cOCT6100_ERR_MIXER_EVENT_NOT_OPEN;
if ( ulEntryOpenCnt != pCopyEventEntry->byEntryOpenCnt )
return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE;
/*=======================================================================*/
/* Return the index of the associated event. */
*f_pusMixerEventIndex = pCopyEventEntry->usMixerEventIndex;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiInvalidateCopyEventStructs
Description: Destroy the link between the two channels.
-------------------------------------------------------------------------------
| 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_usCopyEventIndex Index of the copy event in the API.
f_usMixerEventIndex Index of the copy event in the mixer memory.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiInvalidateCopyEventStructs
UINT32 Oct6100ApiInvalidateCopyEventStructs(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usCopyEventIndex,
IN UINT16 f_usMixerEventIndex )
{
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;
/*=======================================================================*/
/* Clear the Copy event. */
WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE );
WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP;
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
/*=======================================================================*/
/* Remove the event from the list. */
ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance,
f_usMixerEventIndex,
cOCT6100_EVENT_TYPE_SIN_COPY );
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReleaseCopyEventResources
-------------------------------------------------------------------------------
| 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_usCopyEventIndex Index of the copy event in the API.
f_usMixerEventIndex Index of the copy event in the mixer memory.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReleaseCopyEventResources
UINT32 Oct6100ApiReleaseCopyEventResources(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usCopyEventIndex,
IN UINT16 f_usMixerEventIndex )
{
tPOCT6100_SHARED_INFO pSharedInfo;
tPOCT6100_API_CHANNEL pDestinationEntry;
tPOCT6100_API_COPY_EVENT pCopyEventEntry;
tPOCT6100_API_MIXER_EVENT pTempEventEntry;
UINT32 ulResult;
/* Obtain local pointer to shared portion of instance. */
pSharedInfo = f_pApiInstance->pSharedInfo;
mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex );
ulResult = Oct6100ApiReleaseCopyEventEntry( f_pApiInstance, f_usCopyEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_AC;
/* Relese the SIN copy event. */
ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usMixerEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_B3;
mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, f_usMixerEventIndex );
/* Invalidate the entry. */
pTempEventEntry->fReserved = FALSE;
pTempEventEntry->usEventType = cOCT6100_INVALID_INDEX;
pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX;
mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCopyEventEntry->usDestinationChanIndex );
/* Decrement the copy event count on this channel. */
pDestinationEntry->usCopyEventCnt--;
/*=======================================================================*/
/* Mark the event entry as unused. */
pCopyEventEntry->fReserved = FALSE;
pCopyEventEntry->byEntryOpenCnt++;
/*=======================================================================*/
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReserveMixerEventEntry
Description: Reserves a free entry in the mixer event 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_pusEventIndex List entry reserved.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReserveMixerEventEntry
UINT32 Oct6100ApiReserveMixerEventEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
OUT PUINT16 f_pusEventIndex )
{
PVOID pMixerEventAlloc;
UINT32 ulResult;
UINT32 ulEventIndex;
mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc )
ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
return cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED;
else
return cOCT6100_ERR_FATAL_2B;
}
*f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF );
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReleaseMixerEventEntry
Description: Release an entry from the mixer event 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_usEventIndex List entry reserved.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReleaseMixerEventEntry
UINT32 Oct6100ApiReleaseMixerEventEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usEventIndex )
{
PVOID pMixerEventAlloc;
UINT32 ulResult;
mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc )
ulResult = OctapiLlmAllocDealloc( pMixerEventAlloc, f_usEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_2C;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiGetFreeMixerEventCnt
Description: Retrieve the number of events left in the 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_pulFreeEventCnt How many events left.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiGetFreeMixerEventCnt
UINT32 Oct6100ApiGetFreeMixerEventCnt(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
OUT PUINT32 f_pulFreeEventCnt )
{
PVOID pMixerEventAlloc;
UINT32 ulResult;
UINT32 ulAllocatedEvents;
UINT32 ulAvailableEvents;
mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc )
ulResult = OctapiLlmAllocInfo( pMixerEventAlloc, &ulAllocatedEvents, &ulAvailableEvents );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_E8;
/* Return number of free events. */
*f_pulFreeEventCnt = ulAvailableEvents;
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReserveCopyEventEntry
Description: Reserves a free entry in the copy event 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_pusEventIndex List entry reserved.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReserveCopyEventEntry
UINT32 Oct6100ApiReserveCopyEventEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
OUT PUINT16 f_pusEventIndex )
{
PVOID pCopyEventAlloc;
UINT32 ulResult;
UINT32 ulEventIndex;
mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc )
ulResult = OctapiLlmAllocAlloc( pCopyEventAlloc, &ulEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
{
if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
return cOCT6100_ERR_MIXER_ALL_COPY_EVENT_ENTRY_OPENED;
else
return cOCT6100_ERR_FATAL_AD;
}
*f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF );
return cOCT6100_ERR_OK;
}
#endif
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
Function: Oct6100ApiReleaseCopyEventEntry
Description: Release an entry from the copy event 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_usEventIndex List entry reserved.
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if !SKIP_Oct6100ApiReleaseCopyEventEntry
UINT32 Oct6100ApiReleaseCopyEventEntry(
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
IN UINT16 f_usEventIndex )
{
PVOID pCopyEventAlloc;
UINT32 ulResult;
mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc )
ulResult = OctapiLlmAllocDealloc( pCopyEventAlloc, f_usEventIndex );
if ( ulResult != cOCT6100_ERR_OK )
return cOCT6100_ERR_FATAL_AE;
return cOCT6100_ERR_OK;
}
#endif
|