AWECoreOS 8.A.3 User's Guide
HelloWorld.c

Examples

/****************************************************************************
*
* Hello World
* --------------
*
****************************************************************************
*
* Description: Initialize an AWEOSInstance, open a tuning interface, connect to AWE Server. AWE Server will display the instance name "HiWorld"
*
* Copyright: (c) 2020 DSP Concepts, Inc. All rights reserved.
* 3235 Kifer Road
* Santa Clara, CA 95054-1527
*
* This example demonstrates initializing an AWEOSInstance and opening an integrated tuning interface. All default parameters are used, except for the instance name, which is changed to "HiWorld".
* With this simple application, an integrated tuning socket is opened on port 15002. Run the example, and use AWE Server to connect via <Target's IP adress> and port 15002
* This example is not realtime audio enabled, however module regression tests can be run from Matlab. (As long as they are not RT tests)
*
***************************************************************************/
#include <stdio.h>
#include "AWECoreOS.h"
#include "ModuleList.h"
#define PORTNO 15002
//Step 1: Declare an AWEInstance pointer. This will be your handle that is passed in to most of the functions. Memory for the instance is allocated by aweOS_init()
AWEOSInstance *g_AWEOSInstance;
//Step 2: Declare an AWEOSConfigParameters structure. The members of this structure determine the configuration of the AWEInstance members. For this example, it will be populated with defaults
static AWEOSConfigParameters configParams;
//Step 3: Declare a module descriptor table which will be passed into aweOS_init. This module descriptor table includes the modules as defined in ModuleList.h.
static const void* moduleDescriptorTable[] =
{
LISTOFCLASSOBJECTS
};
//Step 4: Calculate the size of the module descriptor table, which will be passed in to aweOS_init.
UINT32 moduleDescriptorTableSize = sizeof(moduleDescriptorTable) / sizeof(moduleDescriptorTable[0]);
int main()
{
printf("Entering Default Configuration Example ... \n");
//Step 5: Populate the configParams structure with DSPC defined default values.
aweOS_getParamDefaults(&configParams);
//Step 5a. Overwrite the name to "HiWorld"
configParams.pName = "HiWorld";
//Step 6: Initialize the AWEInstance with the parameters that were previously set in the config structure. This will allocate the AWEInstance, assign its members, etc.
INT32 ret = aweOS_init(&g_AWEOSInstance, &configParams, moduleDescriptorTable, moduleDescriptorTableSize);
//Step 7: Check if the aweOS_init succeeded. If it didn't then terminate the executable.
if (ret != 0)
{
printf("aweOS_init failed with error code %d %s. exiting application \n", ret, aweOS_errorToString(ret));
}
else
{
printf("AWEOSInstance succesfully initialized... \n");
//Step 8 (OPTIONAL): Open the aweOS integrated tuning interface. Note that this cannot be called before a succesful initialization. If called without succesful aweOS_init, it will fail
INT32 interfaceRet = aweOS_tuningSocketOpen(&g_AWEOSInstance, PORTNO, 1);
if (interfaceRet != 0)
{
printf("Failed to open integrated tuning interface \n");
}
else
{
printf("Opened TCP tuning interface on port %d: Waiting for AWE Server Connection from PC... \n", PORTNO);
}
//Step 9: Enter main idle loop
while (1)
{
usleep(1000);
}
}
return 0;
}
AWEOSConfigParameters::pName
const char * pName
Name of target.
Definition: AWECoreOS.h:122
AWEOSInstance
void AWEOSInstance
The AWE Core OS Instance instance type.
Definition: AWECoreOS.h:95
aweOS_getParamDefaults
INT32 aweOS_getParamDefaults(AWEOSConfigParameters *aweParams)
Populates an AWEOSConfigParameters structure with defaults.
aweOS_tuningSocketOpen
INT32 aweOS_tuningSocketOpen(AWEOSInstance **pAWEOS, INT32 portNo, UINT32 numInstances)
Initialize and open an integrated TCP/IP tuning interface socket.
aweOS_init
INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void *pModuleDescriptorTable, UINT32 moduleDescriptorTableSize)
Initialize the AWEOSInstance with the specified configuration parameters.
AWEOSConfigParameters
AWEOSConfigParameters.
Definition: AWECoreOS.h:106
aweOS_errorToString
const char * aweOS_errorToString(INT32 errorCode)
Convert an error code (INT32) to its corresponding error string.
AWECoreOS.h
The AWE Core OS API header file.