/***************************************************/ Code snippet demonstrating usage of GIO_submit() API /***************************************************/ /* Callback functions */ GIO_TappCallback uppReadCallback() { Uint32 i = 0x00; i = i; /* Done to avoid compiler warnings */ return 0; } GIO_TappCallback uppWriteCallback() { Uint32 i = 0x00; i = i; /* Done to avoid compiler warnings */ return 0; } Void uppCreateStreams(Void) { GIO_Attrs gioAttrs = GIO_ATTRS; /* * Initialize channel attributes. */ gioAttrs.nPackets = 10; /* Create a TX and RX channel for the DLB mode */ uPPoutHandle = GIO_create("/Upp0", IOM_OUTPUT, &status, &uppChanparamA, &gioAttrs); uPPinHandle = GIO_create("/Upp0", IOM_INPUT , &status, &uppChanparamB, &gioAttrs); if ((NULL == uPPoutHandle) || (NULL == uPPinHandle)) { LOG_printf(&trace,"Stream Creation Failed"); SYS_abort("Stream Creation Failed\n"); } } Void uppLoopback(Void) { Uint32 count = 0; Uint32 status = 0; GIO_AppCallback callback; transParam[count].windowAddr = buf[0]; /* Empty buffer */ transParam[count].bytesPerLine = BUFSIZE; /* 1024 bytes */ transParam[count].lineCount = 1; transParam[count].lineOffset = 0; callback.fxn = (GIO_TappCallback)&uppReadCallback; callback.arg = NULL; status = GIO_submit(uPPinHandle, IOM_READ, &transParam[count], (size_t *)&transParam[count].bytesPerLine, &callback); if (IOM_PENDING != status) { LOG_printf(&trace,"Issue to output stream failed."); SYS_abort("Issue to output stream failed\n"); } transParam[count].windowAddr = buf[1]; /* Filled buffer */ transParam[count].bytesPerLine = BUFSIZE; /* 1024 bytes */ transParam[count].lineCount = 1; transParam[count].lineOffset = 0; callback.fxn = (GIO_TappCallback)&uppWriteCallback; callback.arg = NULL; status = GIO_submit(uPPoutHandle, IOM_WRITE, &transParam[count], (size_t *)&transParam[count].bytesPerLine, &callback); if (IOM_PENDING != status) { LOG_printf(&trace,"Issue to output stream failed."); SYS_abort("Issue to output stream failed\n"); } /* Check for "buf[0]" - The received data should be available here */ }