/** ---------------------------------------------------------------------------- * @func rgb2ycbcr_dspSWI * * @desc SWI entry point. This SWI runs every time both IOM_READ and * IOM_WRITE request get completed. It puts does processing and put * next IOM_READ and IOM_WRITE requests. * * @modif None * ---------------------------------------------------------------------------- */ static Void rgb2ycbcr_dspSWI (Arg arg0, Arg arg1) { Int status = SYS_OK; SWIRGB2YCBCR_DSP_TransferInfo * info = (SWIRGB2YCBCR_DSP_TransferInfo *) arg0; Uns numWordsToWrite = info->readWords; Int iomStatus; Uns i; Uint32 y,cb,cr; (Void) arg1 ; /* To remove compiler warning */ /* Do processing of data here */ for (i = 0 ; (i+3) <= info->readWords ; i = i+3) { y = (((D11 * info->inputBuffer[i]) + (D12 * info->inputBuffer[i+1]) + (D13 * info->inputBuffer[i+2])) / 100) + C1; cb = (((D21 * info->inputBuffer[i]) + (D22 * info->inputBuffer[i+1]) + (D23 * info->inputBuffer[i+2])) / 100) + C2; cr = (((D31 * info->inputBuffer[i]) + (D32 * info->inputBuffer[i+1]) + (D33 * info->inputBuffer[i+2])) / 100) + C3; info->outputBuffer[i] = y; info->outputBuffer[i+1] = cb; info->outputBuffer[i+2] = cr; } /* Submit a Read data request */ iomStatus = GIO_submit (info->gioInputChan, IOM_READ, info->inputBuffer, (size_t *) &(info->bufferSize), &(info->appReadCb)) ; if (iomStatus != IOM_PENDING) { status = SYS_EBADIO ; SET_FAILURE_REASON (status) ; } /* Submit a Write data request */ if (status == SYS_OK) { iomStatus = GIO_submit (info->gioOutputChan, IOM_WRITE, info->outputBuffer, &numWordsToWrite, &(info->appWriteCb)) ; } if (iomStatus != IOM_PENDING) { status = SYS_EBADIO ; SET_FAILURE_REASON (status) ; } }
/** ---------------------------------------------------------------------------- * @func loopbackSWI * * @desc SWI entry point. This SWI runs every time both IOM_READ and * IOM_WRITE request get completed. It puts does processing and put * next IOM_READ and IOM_WRITE requests. * * @modif None * ---------------------------------------------------------------------------- */ static Void loopbackSWI (Arg arg0, Arg arg1) { Int status = SYS_OK; SWILOOP_TransferInfo * info = (SWILOOP_TransferInfo *) arg0; Uns numWordsToWrite = info->readWords; Int iomStatus; Uns i; (Void) arg1 ; /* To remove compiler warning */ /* Do processing of data here */ for (i = 0 ; i < info->readWords ; i++) { info->outputBuffer [i] = info->inputBuffer [i] ; } /* Submit a Read data request */ iomStatus = GIO_submit (info->gioInputChan, IOM_READ, info->inputBuffer, (size_t *) &(info->bufferSize), &(info->appReadCb)) ; if (iomStatus != IOM_PENDING) { status = SYS_EBADIO ; SET_FAILURE_REASON (status) ; } /* Submit a Write data request */ if (status == SYS_OK) { iomStatus = GIO_submit (info->gioOutputChan, IOM_WRITE, info->outputBuffer, &numWordsToWrite, &(info->appWriteCb)) ; } if (iomStatus != IOM_PENDING) { status = SYS_EBADIO ; SET_FAILURE_REASON (status) ; } }
/** ============================================================================ * @func SWIRGB2YCBCR_DSP_execute * * @desc Execute phase of SWIRGB2YCBCR_DSP application. It get the application * started after that SWIs get posted automatically. * * @modif None. * ============================================================================ */ Int SWIRGB2YCBCR_DSP_execute (SWIRGB2YCBCR_DSP_TransferInfo * info) { Int status = SYS_OK ; Int iomStatus ; /* Submit a read request */ iomStatus = GIO_submit (info->gioInputChan, IOM_READ, info->inputBuffer, (size_t *) &(info->bufferSize), &(info->appReadCb)) ; if (iomStatus != IOM_PENDING) { status = SYS_EBADIO ; SET_FAILURE_REASON (status) ; } /* We don't write for the first time so clearing write bit * from SWI's mailbox */ SWI_andn (info->swi, WRITE_MAILBOX_MASK) ; return status ; }
/* * ======== GIO_write ======== */ Int GIO_write(GIO_Object *obj, Ptr buf, SizeT *pSize) { Assert_isTrue((obj->model == GIO_Model_STANDARD), GIO_A_badModel); return (GIO_submit(obj, IOM_WRITE, buf, pSize, NULL)); }
/* * ======== GIO_flush ======== */ Int GIO_flush(GIO_Object *obj) { return (GIO_submit(obj, IOM_FLUSH, NULL, NULL, NULL)); }
/* * ======== GIO_abort ======== */ Int GIO_abort(GIO_Object *obj) { return (GIO_submit(obj, IOM_ABORT, NULL, NULL, NULL)); }