This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to control UPP peripheral channels independantly

Other Parts Discussed in Thread: TMS320C6748

Hi,

I am using UPP peripheral of TMS320C6748 to connect FPGA for High speed data transfer. I am using upp_bios_drv_v10 provided at wiki. I want to configure upp peripheral in DUPLEX 1 mode of operation but need separate handles for CH A and CH B. I want to keep read and write operations to these channels independant of each other. I am unable to get handle using GIO_create with IOM_INPUT/IOM_OUTPUT parameter. It works only with IOM_INOUT. Is it possible to operate it independantly ? I mean if some read operation is going on CH B and at the same time if I will configure CH A for write operation, will it work without interferring other channel operation?

Regards,

Chandra

 

  • Chandra,

    The uPP driver on the wiki only supports channel creation using the IOM_INOUT mode, but the uPP channels are still independently programmable.  Calls to GIO_read() or GIO_write() must include a transfer handle.  The struct pointed to by this handle specifies which uPP channel will execute the transfer.  This allows you to manage both uPP channels using a single GIO handle.

    Alternatively, you can also use the uPP driver included in the BIOS PSP for C6748, which can be downloaded from this page:

    The PSP driver allows you to create separate SIO handles for each uPP channel, which may be more intuitive.

    Hope this helps.

  • Hi Joe,

    Thanks for reply. I have some doubts which I would like to clarified from you,

    1) Related to uPP driver on the wiki : Consider the scenario where two tasks are running with different priority. Let us assume low priority task has executed GIO_write and waiting for Transmit EOL callback at the same time if I got interrupt/event to Receive data on upp channel and scheduled high priority thread to execute GIO_read which will configure DMA for Rx channel. Whether this condition can create UPP peripheral to reset or data corruption on Tx Channel.

    2) Whether BIOSPSP driver will work with GIO calls. Because example are given with SIO and user document described with GIO.

    3) Unable to run uppSample example of BIOSPSP. It compiles but hangs during loading. It never goes to main().

    Thanks,

    Chandra

  • Chandra,

    Here are my answers to your questions:

    1. The drivers should be thread safe and re-entrant.  If you look at the source code, you should see HWI_disable() and HWI_restore() calls protecting critical actions, such as programming uPP transfers.
    2. I have not personally verified that GIO APIs work properly with the PSP driver.  If the documentation says that GIO is supported, then it should work. :)
    3. If a BIOS application does not reach main(), that generally means that some error has occurred during system initialization.  Some common problems include: using the wrong GEL file (i.e. some software expects the PSC and pinmux settings to be applied before the application is run), incorrect system setup in the TCF or TCI files, or memory map issues (ex. heap/stack too small).

    Hope this helps.

  • Hi Joe,

    I am able to add BIOSPSP upp driver to my application & able to load it also. But when first time I am calling  GIO_read to Receive data on RX Channel, code gets hang and I am able to see Following in Debug console

    Thread[main](Suspended)-> _PWRM_F_idleStopClk() at _pwrm_idleGemInclude64P.s64P:37 

    Same is the case of BIOSPSP sample also but it gets stuck before main.

    Regards,

    Chandra

  • Hi Chandra,

    The BIOS PSP 01_30_01 you are referring to, provides 2 sample applications - upp and uppEvm (Placed in : pspdrivers_01_30_01\packages\ti\pspiom\examples\evm6748)

    upp - Demonstrates the usage of upp in Loopback mode. whereas,

    uppEvm - Demonstrates the usage of upp driver in the duplex mode 0 of operation (for this you need to connect two EVM's. Run uppEvmA on one EVM and  uppEvmB on other EVM ) Please refer section 18.12 of C6748_BIOSPSP_Userguide.

    Which sample application are you using?. If it is the first one, the application should run in one go. If it is the second one well, the uppEvmA application hangs until it receives data from the uppEvmB. Load and run the default binaries that come with BIOS PSP first - this confirms all is good with the hardware/setup. Then you can proceed with own modifications and build.

    GIO_read(...) is a blocking call and it hangs forever provided no 'timeout' is set.

     

    chandrashekhar mishra said:

    I want to keep read and write operations to these channels independant of each other. I am unable to get handle using GIO_create with IOM_INPUT/IOM_OUTPUT parameter. It works only with IOM_INOUT

    If you refer the upp or uppEvm sample application, read and write operations are created/work independant of each other - using SIO calls. Please refer BIOS Userguide for more details on this.

     Hope this helps..

     

    Thanks & regards,

    Raghavendra   

  • Hi Raghwendra,

    I am trying to run upp Loopback mode for single evm. This itself I am unable to run because code gets stuck at

    Thread[main](Suspended)-> _PWRM_F_idleStopClk() at _pwrm_idleGemInclude64P.s64P:37 

    even before reaching to main(). I am able to run  PSP examples for other peripherals with same setup (EVM Board and gel file). I also disabled V/F Scaling support  of Power Manager properties which required for all BIOSPSP example to work.

    Regards,

    Chandra

  • Hi Chandra,

    Did you try with the default binaries?. If not, please try it.

    Would it be possible to share your project? It can speed up the debugging. Also, please list all the tool versions you are using..

     

    Thanks & regards,

    Raghavendra

  • Hi Raghavendra,

    I tried pre-compiled upp sample binary to run and it is loading the .out file but I could not see LOG_printf messages as I am getting error message that XDC path /XDC tool is not set. Even though I can see it in preferences window. I attached the snapshot of error message

     

    Also I am using  following tools

    CCS Version 4.2.4.00033

     Code Generation tool: TI v 7.2.3

    DSP/BIOS: 5.41.10.36

    PSP version:pspdrivers_01_30_01

    I could not load even after recompiling the same upp sample example provided with psp driver

    Regards,

    Chandra Shekhar Mishra

  • Hi Chandra,

     

    chandrashekhar mishra said:
    I tried pre-compiled upp sample binary to run and it is loading the .out file

    So, by loading the default binaries you did not face any issues. Probably there is something wrong in the build setup or application.

    The LOG_printf messages cannot be viewed in CCSv4 console. You can view it in CCSv3.3. But not to worry, you can even verify in CCSv4 by placing a breakpoint in the application. If you open uppSample_io.c file, line - 387 "LOG_printf(&trace,"Sample Application completed...");" Place a breakpoint at this point and run the application. Hitting this point would confirm working of the sample application.

    Coming to the tools,I request you to install all the tools mentioned in the C6748_BIOSPSP_Userguide - section: 1.2.1,build driver and application and then test.

    Have you done any modifications to the upp.pjt and uppSample.pjt files?. If so, please let us know the changes made.

    Thanks & regards,

    Raghavendra

  • Hi,

    I'm experimenting with the PSP uPP driver and am now very confused.  is the uPP GIO interface synchronous or asynchronous?

    Several documents refer to GIO as a synronous interface, but from the UPP Device Driver Design document (page28):

    The UPP IOM driver supports only asynchronous IO mechanism. In Asynchronous IO
    mechanism multiple IO requests can be submitted by the application thread without
    causing it to block while waiting for the IO request to complete. Application can
    submit multiple I/O requests using the “GIO_read ()” or “GIO_write ()” (also SIO)
    APIs and specify a callback function to be called after the IO transfer is completed.

    This reads to me that the GIO interface into UPP is asyncronous and uses callbacks.

    Also, both examples of UPP in the PSP only provide examples of using the SIO interface to UPP.  it is very difficult to use the GIO interface with no example code to reference

    Also, the BIOS PSP User Guide, in the section which describes the UPP driver only discusses the GIO interface but not the SIO interface. Does this mean that GIO is the preferred interface and if so, why do the examples solely use the SIO interface?  If SIO is the preferred interface why does the user guide only discuss the GIO interface?

  • Hi Jacob,

     

    I assume you are using the BIOS PSP 01.30.01

    Sorry for all the confusion made.

     

    UPP can be operated in asynchronous/synchronous IO mechanism depending on the BIOS APIs being used in the application.

    • GIO_write()/GIO_read() will be used for synchronous mode of operation.
    • ‘GIO_submit() with an appropriate callback’ or ‘SIO_issue()/SIO_reclaim() pair’ will be used for asynchronous mode of operation.

    Note: Refer DSP/BIOS userguide for GIO and SIO APIs.

    The UPP application provided in the PSP 1.30.01 will make use of ‘SIO_issue()/SIO_reclaim() pair’, which will demonstrate the usage of UPP driver asynchronously.

    Best Regards,

    Raghavendra

  • The GIO_write/GIO_read issue seems to be the source of my confusion.  Why does the userguide for the UPP  API's only  refer to the (supposedly synchronous) GIO_read/write calls if according to the same user-guide, synchronous calls are not supported (see quote from previous post)? this reads as if the normally synchronous GIO_read/write calls can be used asycronously and makes no mention of GIO_submit anywhere.  

    P.S. I am indeed using PSP 1.30.01

    I've tried using GIO_submit and do see a few registers in the upp address space change, but i never seem to enter my upp_rx (configured via UppChanParams).  I have my upp configured as:

    uppParams = Upp_PARAMS;
    uppParams.devMode = Upp_DevMode_DUPLEX_1;
    uppParams.dlbMode = Upp_Loopback_ENABLE_AB;
    uppParams.emulationMode = Upp_EmuMode_SOFT_STOP;
    uppParams.pllDomain = Upp_pllDomain_0;
    uppParams.pscPwrmEnable = FALSE;

    With the following channel parameters:

    Upp_ChanParams uppChanparamA =
    {
    TRUE,
    Upp_ChanSel_A,
    Upp_bitWidth_8,
    Upp_dataRate_SINGLE,
    Upp_ChanMode_NORMAL,
    Upp_dataPackFmt_RJZE,
    10000000,
    0xFFFF,
    NULL,
    NULL,
    NULL,
    NULL,
    Upp_fifoThreshold_64,
    {
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    Upp_clkPol_RISING_EDGE_SYNC,
    Upp_PinIdleState_IDLE_VAL,
    }
    };

    // parameters for channel B
    Upp_ChanParams uppChanparamB =
    {
    TRUE,
    Upp_ChanSel_B,
    Upp_bitWidth_8,
    Upp_dataRate_SINGLE,
    Upp_ChanMode_NORMAL,
    Upp_dataPackFmt_RJZE,
    10000000,
    0xFFFF,
    uppReadCallback,
    NULL,
    uppReadCallback,
    NULL,
    Upp_fifoThreshold_64,
    {
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    TRUE,
    Upp_polarity_ACTIVE_HIGH,
    Upp_clkPol_RISING_EDGE_SYNC,
    Upp_PinIdleState_IDLE_VAL,
    }
    };

    and creating my gio handles with : 

    GIO_Handle* uPPoutputPtr;
    GIO_Handle* uPPinputPtr;
    *uPPoutputPtr = GIO_create("/Upp0", IOM_OUTPUT, &status, &uppChanparamA, NULL);
    *uPPinputPtr = GIO_create("/Upp0", IOM_INPUT , &status, &uppChanparamB, NULL);

  • Hi Jacob,

    Jacob Leemaster said:
    The GIO_write/GIO_read issue seems to be the source of my confusion.  Why does the userguide for the UPP  API's only  refer to the (supposedly synchronous) GIO_read/write calls if according to the same user-guide, synchronous calls are not supported (see quote from previous post)? this reads as if the normally synchronous GIO_read/write calls can be used asycronously and makes no mention of GIO_submit anywhere.  

    I understand your point. The data in the Userguide(w.r.t API's) is not appropriate. Sorry for misleading you.

    Please consider my previous post wherein I have provided the right information required. I hope you do not have any queries w.r.t that.

    Coming to the application, what exactly is your application scenario?. Looking at the UPP configuration shared, all the settings seems to be fine. Is "upp_rx" a callback function?.

    Please test the sample application that comes with the PSP and verify.

    Best Regards,

    Raghavendra

  • Yes, meant to refer to upp_rx is actually uppReadCallback() with the following declaration:

    void uppReadCallback(Uint32 arg1, Uint32 arg2, Uint32 arg3)

    i'm currently just trying to get a basic upp driver working and am currently trying to use the GIO_submit function you described earlier.  since I'm trying to use the GIO_submit, the example code (which only uses SIO interface) isn't too helpful.   

    should I just give up on GIO and switch to SIO?  

  • Hi Jacob,

    Before you start using the GIO_submit(...) call in asynchronous mode, please verify if the GIO_submit(...) API in synchronous mode is working first(by not providing the callback function). Just do a ''write'' to the upp channel, and check if it is returning/completing successfully without any errors/hang. This is just to verify if the GIO settings are appropriate. Then you can proceed further by providing the application callback function to monitor its completion. The GIO_submit(...) call in asynchronous mode should be able to work.

    Since it is a loopback application, need to send a read request first and then a write.

    You can also verify/try by placing a breakpoint in the "uppIntrHandler(...)" function(in Upp.c driver file) to check if any completion interrupts are generated. Also, check if it is hitting the function "uppCompleteCurrentIo" wherein, the function completes the current pending request and then invokes the application registered callback(Line 2151 of Upp.c file).

    Jacob Leemaster said:
    should I just give up on GIO and switch to SIO?

    Not necessary. The reason I asked to test the sample application(that comes with the PSP) is just to verify the setup.


    Best Regards,

    Raghavendra

  • Hi Raghavendra,

    Alright, that sounds good.  I've been trying GIO_submit in syncronous mode and am getting timeout errors back in the returned status.  

    I agree I need to issue the read request first, but am now confused how to do that since GIO_read is a syncronous blocking call and I do not know of any asynchronous GIO read calls.  It sounds like you are describing the SIO read requests, how would I do that with GIO?  I'm sorry I don't quite understand.

    What function would that be?

    Thanks

    --Jacob

  • Jacob,

    Jacob Leemaster said:
     I've been trying GIO_submit in syncronous mode and am getting timeout errors back in the returned status

    while allocating and initializing the GIO object( during GIO_create(…)), they use a (GIO_Attrs *attrs) parameter.

    typedef struct GIO_Attrs {

    Int nPackets; /* number of asynch I/O packets */

    Uns timeout; /* for blocking calls (SYS_FOREVER) */

    } GIO_Attrs;

    By default, the timeout is set to "SYS_FOREVER" for blocking calls. If you have provided a 'timeout' value and not provided any data by then, you might get timeout errors.

    Jacob Leemaster said:

    It sounds like you are describing the SIO read requests, how would I do that with GIO?  I'm sorry I don't quite understand.

    What function would that be?

    Some Examples -

    Synchronous –

    GIO_Attrs gioAttrs      = GIO_ATTRS;

    *uPPoutputPtr = GIO_create("/Upp0", IOM_OUTPUT, &status, &uppChanparamA, &gioAttrs);

     

    status = GIO_submit(*uPPoutputPtr, IOM_WRITE, bufp, &pSize, NULL); /* Synchronous write*/

     

    Asynchronous –

        GIO_Attrs gioAttrs      = GIO_ATTRS;

     

                    /* Initialize channel attributes.                                         */

                    gioAttrs.nPackets = 5; /* Depends on application requirement */

                    gioAttrs.nPackets = 1000u; /* Specify timeout value according to your requirement */

      *uPPoutputPtr = GIO_create("/Upp0", IOM_OUTPUT, &status, &uppChanparamA, &gioAttrs);

     

     status = GIO_submit(*uPPoutputPtr, IOM_WRITE, bufp, &pSize, &uppWriteCallback);  /* Asynchronous write*/

     status = GIO_submit(*uPPinputPtr, IOM_READ, bufp, &pSize, &uppReadCallback);  /* Asynchronous read*/

     

    For more information, please refer the DSP/BIOS 5.x  API reference guide placed in top level docs folder of the DSP/BIOS package.

    Hope this answers your question..

    Best Regards,

    Raghavendra

     

  • Hi Raghavendra,

    Thanks for the examples, They helped progress my code a bit, but i'm still running into difficulty

    I am now doing a GIO_submit asyncronous call for both transmit and receive.

     If I submit try:

    j = GIO_submit(g_uPPinput, IOM_READ, &testbuf_input, &size_in, &readCallback);
    i = GIO_submit(g_uPPoutput, IOM_WRITE, &testbuf_output, &size_out, &writeCallback);

    Both return "Queued and Pending" IOM status values but the callback functions never run (they contain breakpoints so I can check)
     

    but If i try using GIO_submit with Upp_transParam structs, I still get the "queued and pending" status from 

    j = GIO_submit(g_uPPinput, IOM_READ, &rcv, &size_in, &readCallback);

    but then I do 

    i = GIO_submit(g_uPPoutput, IOM_WRITE, &xmt, &size_out, &writeCallback); to do a asyncronous write and it stalls forever.  

    xmt and rcv are Upp_transParam datatypes and size_out and size_in contain their size

    Thanks for your help.

    --Jacob

  • Jacob,

    Try digging into the code and check where exactly it is hung in the driver?. Are the parameters to the GIO API's set appropriately?. Take the original sample application code as a reference and modify it accordingly.

    Both (GIO_submit(...) calls) shall return "IOM_PENDING" since they are asynchronous calls.

    Attached is a code snippet which demonstrates the usage of GIO API's for this particular application setup(Loopback application). Modify and test your applciation accordingly. With this, you should be good to go.

    Best Regards,

    Raghavendra

  • Raghavendra,

    Thanks for the code snippet, but am still seeing the the following behaviour:

    GIO_submit returns IOM_PENDING in both the read and write calls, but niether callback is ever called (checked using breakpoints and printf)

    I'm attaching my C code and tcf file for your convenience.  large sections are commented out using block comments, so please be careful when reading.  

    Thanks

    --Jacob

    /*
     * Imager_uPP.c
     *
     *  Created on: Feb 9, 2012
     *      Author: jeleema
     *
     *      Almost all of this is copied from the PSP example
     */
    
    
    /* ========================================================================== */
    /*                            INCLUDE FILES                                   */
    /* ========================================================================== */
    
    #include <std.h>
    #include <gio.h>
    #include <iom.h>
    #include <que.h>
    #include <log.h>
    #include <tsk.h>
    #include <string.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "types.h"
    #include "ti/pspiom/upp/Upp.h"
    #include "ti/pspiom/platforms/evmOMAPL138/Upp_evmInit.h"
    #include "ti/pspiom/cslr/cslr_upp.h"
    #include "evmomapl138.h"
    #include "evmomapl138_uPP.h"
    #include "Imager_uPP.h"
    
    //***	FROM BSL	***//
    //-----------------------------------------------------------------------------
    // Private Defines
    //-----------------------------------------------------------------------------
    #define PINMUX_UPP_REG_0	(19)			//TODO: Check this one, but must be correct for the logicPD board
    #define PINMUX_UPP_MASK_0	(0x000F0000)	// -- JEL
    #define PINMUX_UPP_VAL_0	(0x00010000)	//
    
    #define PINMUX_UPP_REG_1	(13)
    #define PINMUX_UPP_MASK_1	(0xFFFF0000)
    #define PINMUX_UPP_VAL_1	(0x48440000)
    
    #define PINMUX_UPP_REG_2	(14)
    #define PINMUX_UPP_MASK_2	(0xFFFFFF00)
    #define PINMUX_UPP_VAL_2	(0x44444400)
    
    #define PINMUX_UPP_REG_3	(15)
    #define PINMUX_UPP_MASK_3	(0xFFFFFFFF)
    #define PINMUX_UPP_VAL_3	(0x44444444)
    
    #define PINMUX_UPP_REG_4	(16)
    #define PINMUX_UPP_MASK_4	(0xFFFFFFFF)
    #define PINMUX_UPP_VAL_4	(0x44444444)
    
    #define PINMUX_UPP_REG_5	(17)
    #define PINMUX_UPP_MASK_5	(0xFFFFFFFF)
    #define PINMUX_UPP_VAL_5	(0x44444444)
    
    #define PINMUX_UPP_REG_6	(15)
    #define PINMUX_UPP_MASK_6	(0x00FFFFFF)
    #define PINMUX_UPP_VAL_6	(0x00444444)
    
    #define PINMUX_UPP_REG_7	(18)
    #define PINMUX_UPP_MASK_7	(0x00FFFFFF)
    #define PINMUX_UPP_VAL_7	(0x00444444)
    
    
    
    //***	FROM PSP	***//
    ///* ========================================================================== */
    ///*                         MACRO DEFINITIONS                                  */
    ///* ========================================================================== */
    //
    //#define NUM_BUFS              4             /* Max of 1 outstanding requests  */
    //#define BUFALIGN              128           /* align buffers to 128 bytes     */
    //#define BUFSIZE               1024          /* 1K of data transceive          */
    //#define LOOP_COUNT            100           /* no of iterations               */
    //
    ///* ========================================================================== */
    ///*                          LOCAL VARIABLES                                   */
    ///* ========================================================================== */
    //
    ///* Handles for the TX and RX channels                                         */
    //static SIO_Handle uppOutHandle = NULL;
    //static SIO_Handle uppInHandle = NULL;
    ///* array to hold the pointer to the allocated buffers                         */
    //Ptr buf[2 * NUM_BUFS];
    //
    ///* Data structures to be used for submit                                      */
    //Upp_transParam  transParam[2 * NUM_BUFS];
    //
    ///* currently processed packet count                                           */
    //Uint32 pktCount = 0;
    //
    ///* parameters for channel A                                                   */
    
    /***	Disabled while using uPP_Sample.h	***/
    #define BUFSIZE 1024
    Upp_ChanParams uppChanparamA =
    {
        TRUE,
        Upp_ChanSel_A,
        Upp_bitWidth_8,
        Upp_dataRate_SINGLE,
        Upp_ChanMode_NORMAL,
        Upp_dataPackFmt_RJZE,
        10000000,
        0xFFFF,
        NULL,
        NULL,
        NULL,
        NULL,
        Upp_fifoThreshold_64,
        {
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            Upp_clkPol_RISING_EDGE_SYNC,
            Upp_PinIdleState_IDLE_VAL,
        }
    };
    
    // parameters for channel B
    Upp_ChanParams uppChanparamB =
    {
        TRUE,
        Upp_ChanSel_B,
        Upp_bitWidth_8,
        Upp_dataRate_SINGLE,
        Upp_ChanMode_NORMAL,
        Upp_dataPackFmt_RJZE,
        10000000,
        0xFFFF,
        NULL,
        NULL,
        NULL,
        NULL,
        Upp_fifoThreshold_64,
        {
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            TRUE,
            Upp_polarity_ACTIVE_HIGH,
            Upp_clkPol_RISING_EDGE_SYNC,
            Upp_PinIdleState_IDLE_VAL,
        }
    };
    
    
    ///*
    // * Upp device params. To be filled in userUppInit function which
    // * is called before driver creation
    // */
    
    Upp_Params     uppParams;
    
    // //END From PSP
    /***	Upp GIO Attrs	***/
    //GIO_Attrs uppAttrs = {
    //		2,			/* Number of asynch I/O packets (Int)*/
    //		SYS_FOREVER /* timeout for blocking calls (Uns)*/
    //};
    
    /***	Global Input/Ouput Handles	and Recieve flag***/
    GIO_Handle	g_uPPinput	=	NULL;
    GIO_Handle	g_uPPoutput	=	NULL;
    Uint8		g_UppRxFlag =	0;
    
    //debug
    #ifdef DEBUG
    volatile uPP_regs_t* g_UPP		= UPP;
    void IOM_Return_Error_String(int error, char* text);
    #endif
    //void gioReadCallback(Ptr arg, Int status, Ptr bufp, size_t size);
    GIO_TappCallback gioReadCallback();
    //void gioWriteCallback(Ptr arg, Int status, Ptr bufp, size_t size);
    GIO_TappCallback gioWriteCallback();
    
    /*Initialization function*/
    
    
    /*
     * Upp init function called when creating the driver.
     * Source: PSP OMAPL138 UPP Loopback Example
     */
    void uppUserInit()
    {
        Upp_init();
    
        uppParams = Upp_PARAMS;
        uppParams.devMode = Upp_DevMode_DUPLEX_1;
        uppParams.dlbMode = Upp_Loopback_ENABLE_AB;
        uppParams.emulationMode = Upp_EmuMode_SOFT_STOP;
        uppParams.pllDomain = Upp_pllDomain_0;
        uppParams.pscPwrmEnable = FALSE;
    
    /*
     * uppParams = Upp_PARAMS;
     *  uppParams.devMode = Upp_DevMode_DUPLEX_0;
     *  uppParams.dlbMode = Upp_Loopback_DISABLE;
     *  uppParams.emulationMode = Upp_EmuMode_RTEMU;
     *  uppParams.pllDomain = Upp_pllDomain_0;
     *  uppParams.pscPwrmEnable = FALSE;
     */
    }
    
    /***	EXTRACTED FROM BSL FILE: evmomapl138_uPP.c		***/
    void uppSetPinmux(){
    	   //take care of pin muxing
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_0,PINMUX_UPP_MASK_0, PINMUX_UPP_VAL_0);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_1,PINMUX_UPP_MASK_1, PINMUX_UPP_VAL_1);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_2,PINMUX_UPP_MASK_2, PINMUX_UPP_VAL_2);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_3,PINMUX_UPP_MASK_3, PINMUX_UPP_VAL_3);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_4,PINMUX_UPP_MASK_4, PINMUX_UPP_VAL_4);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_5,PINMUX_UPP_MASK_5, PINMUX_UPP_VAL_5);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_6,PINMUX_UPP_MASK_6, PINMUX_UPP_VAL_6);
    	   EVMOMAPL138_pinmuxConfig(PINMUX_UPP_REG_7,PINMUX_UPP_MASK_7, PINMUX_UPP_VAL_7);
    
    }
    
    Void uppCreateChannels(GIO_Handle* uPPinputPtr, GIO_Handle* uPPoutputPtr){
    	GIO_Attrs gioAttrs;
    	int status;
    
    	gioAttrs.nPackets = 10;
    	gioAttrs.timeout = SYS_FOREVER;
    
    	//in Duplex1 mode, A = XMT, B = RCV
    	*uPPoutputPtr = GIO_create("/Upp0", IOM_OUTPUT, &status, &uppChanparamA, &gioAttrs);
    	*uPPinputPtr  = GIO_create("/Upp0", IOM_INPUT , &status, &uppChanparamB, &gioAttrs);
    
    	if(g_uPPoutput == NULL){
            /*LOG_printf(&trace,*/printf("uPP Output Handle Creation Failed");
            SYS_abort("uPP Output Handle Creation Failed\n");
    	}
    	if(g_uPPinput == NULL){
            /*LOG_printf(&trace,*/printf("uPP Input Handle Creation Failed");
            SYS_abort("uPP Input Handle Creation Failed\n");
    	}
    
    	//status = GIO_control(*uPPoutputPtr, Upp_Ioctl_START, NULL);
    	//status = GIO_control(*uPPinputPtr,  Upp_Ioctl_START, NULL);
    
    
    
    	//status = GIO_control(*uPPinputPtr,  Upp_Ioctl_STOP, NULL);
    	//status = GIO_control(*uPPoutputPtr, Upp_Ioctl_STOP, NULL);
    
    	return;
    }
    
    
    void uppTest(){
    	int i;
    	int j;
    	char* testbuf_output;
    	char* testbuf_input;
    	GIO_AppCallback readCallback;
    	GIO_AppCallback writeCallback;
    	char statusText[64];
    
    	Upp_transParam xmt, rcv;
    	testbuf_output 	 = malloc(BUFSIZE); /*	Full buffer	*/
    	xmt.windowAddr	 = testbuf_output;
    	xmt.bytesPerLine = BUFSIZE;
    	xmt.lineCount	 = 1;
    	xmt.lineOffset	 = 0;
    
    	testbuf_input 	 = malloc(BUFSIZE);/*	Empty buffer	*/
    	rcv.windowAddr	 = testbuf_input;
    	rcv.bytesPerLine = sizeof(BUFSIZE);
    	rcv.lineCount	 = 1;
    	rcv.lineOffset	 = 0;
    
    #ifdef Upp_STATISTICS_ENABLE
    	Upp_devStats outputStats;
    	Upp_devStats inputStats;
    #endif
    
    	for (i = 0; i < BUFSIZE; i++){
    		testbuf_output[i] = i;
    	}
    
    
    	uppCreateChannels(&g_uPPinput, &g_uPPoutput);
    	readCallback.fxn = (GIO_TappCallback)&gioReadCallback;
    	readCallback.arg = NULL;
    
    	writeCallback.fxn = (GIO_TappCallback)&gioWriteCallback;
    	writeCallback.arg = NULL;
    	//read from channel B
    //	i = GIO_read(g_uPPinput, testbuf_input, &size_in);
    	j = GIO_submit(g_uPPinput, IOM_READ, &rcv, (size_t *)&rcv.bytesPerLine, &readCallback);
    //	j = GIO_submit(g_uPPinput, IOM_READ, &testbuf_input, &size_in, &readCallback);
    #ifdef DEBUG
    	if(j == IOM_PENDING){
    		printf("Upp GIO_submit successful\n");
    	}
    	else{
    		IOM_Return_Error_String(j, statusText);
    		printf("Upp GIO_submit returned code: %s\n",statusText);
    	}
    #endif
    
    	//write to channel A
    //	GIO_write(g_uPPoutput, testbuf_output, &size_out);
    	i = GIO_submit(g_uPPoutput, IOM_WRITE, &xmt, (size_t *)&xmt.bytesPerLine, &writeCallback);
    //	i = GIO_submit(g_uPPoutput, IOM_WRITE, &testbuf_output, &size_out, &writeCallback);
    
    #ifdef DEBUG
    	if(i == IOM_COMPLETED){
    		printf("Upp GIO_submit successful\n");
    	}
    	else{
    		IOM_Return_Error_String(i, statusText);
    		printf("Upp GIO_submit returned code: %s\n",statusText);
    	}
    #endif
    
    
    #ifdef Upp_STATISTICS_ENABLE
    	i = GIO_control(g_uPPoutput, Upp_Ioctl_QUERY_STATS, &outputStats);
    	i = GIO_control(g_uPPinput, Upp_Ioctl_QUERY_STATS, &inputStats);
    #endif
    
    	while(1);
    }
    /*
    void uppReadCallback(Uint32 arg1, Uint32 arg2, Uint32 arg3){
    
    	IOM_Packet* pkt;
    	unsigned int status;
    
    	pkt 		= (IOM_Packet*)arg3;
    	status		= arg2;
    	g_UppRxFlag	= 1;
    	printf("upp readCallback successful\n");
    
    
    }
    */
    //void gioReadCallback(Ptr arg, Int status, Ptr bufp, size_t size){
    GIO_TappCallback gioReadCallback(){
    	Uint32 i = 0x00;
    	i = i;
    	printf("gio readCallback successful\n");
    
    
    	return 0;
    }
    
    //void gioWriteCallback(Ptr arg, Int status, Ptr bufp, size_t size){
    GIO_TappCallback gioWriteCallback(){
    	Uint32 i = 0x00;
    
    	i = i;
    	printf("gio writeCallback successful\n");
    
    
    	return 0;
    }
    /*
    void uppWriteCallback(Uint32 arg1, Uint32 arg2, Uint32 arg3){
    
    	IOM_Packet* pkt;
    	unsigned int status;
    
    	pkt 		= (IOM_Packet*)arg3;
    	status		= arg2;
    	g_UppRxFlag	= 0;
    	printf("Upp writeCallback successful\n");
    
    }
    */
    //debug helper functions
    #ifdef DEBUG
    
    void IOM_Return_Error_String(int error, char* text){
    	switch(error){
    		case IOM_PENDING:			sprintf(text, "I/O Queued & Pending"); 					break;
    		case IOM_FLUSHED:			sprintf(text, "I/O Request Flushed"); 					break;
    		case IOM_ABORTED:			sprintf(text, "I/O Aborted");							break;
    		case IOM_EBADIO:			sprintf(text, "ERROR: Generic Failure");				break;
    		case IOM_ETIMEOUT:			sprintf(text, "ERROR: Timeout Occurred");				break;
    		case IOM_ENOPACKETS:		sprintf(text, "ERROR: No Packets Available");			break;
    		case IOM_EFREE:				sprintf(text, "ERROR: Unable To Free Resources");		break;
    		case IOM_EALLOC:			sprintf(text, "ERROR: Unable To Alloc Resource"); 		break;
    		case IOM_EABORT:			sprintf(text, "ERROR: I/O Aborted Uncompleted"); 		break;
    		case IOM_EBADMODE:			sprintf(text, "ERROR: Illegal Device Mode"); 			break;
    		case IOM_EOF:				sprintf(text, "ERROR: End Of File Encountered"); 		break;
    		case IOM_ENOTIMPL:			sprintf(text, "ERROR: Operation Not Supported"); 		break;
    		case IOM_EBADARGS:			sprintf(text, "ERROR: Illegal Arguments Used"); 		break;
    		case IOM_ETIMEOUTUNREC:		sprintf(text, "ERROR: Unrecoverable Timeout Occurred");	break;
    		case IOM_EINUSE:			sprintf(text, "ERROR: Device Already In Use");		 	break;
    		default:					sprintf(text, "ERROR: Device Already In Use");		 	break;
    	}
    	return;
    }
    
    #endif
    


    tcf code snippet:

    /*
    * ======== uPP Configuration ========
    */
    /* Add Upp driver to DEV table */
    bios.UDEV.create("Upp0");
    bios.UDEV.instance("Upp0").fxnTableType = "IOM_Fxns";
    bios.UDEV.instance("Upp0").initFxn = prog.extern("uppUserInit");
    bios.UDEV.instance("Upp0").params = prog.extern("uppParams");
    bios.UDEV.instance("Upp0").fxnTable = prog.extern("Upp_IOMFXNS");
    bios.UDEV.instance("Upp0").deviceId = 0;

    /*
    * UPP dependancies
    */

    bios.PWRM.ENABLE = 1;
    bios.PWRM.RESOURCETRACKING = 1;

    bios.ECM.ENABLE = 1;
    bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
    bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
    bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
    bios.HWI.instance("HWI_INT10").interruptSelectNumber = 3;


    // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

    prog.gen();



  • Jacob,

    Could you please double check your pinmux settings in the application?

    Since you are trying to use the UPP Instance 0 itself, try calling "configureUpp(...)" which sets the pinmux appropriately for UPP in the BIOS PSP sample applciation.

    Place a breakpoint in "uppMdCreateChan(...)" and "uppMdSubmitChan(..)" functions of the UPP driver and check if the parameters are updating correctly and the function is completing appropriately. 

    Best Regards,

    Raghavendra

  • Hi,

    I am trying to test uPP on TMDXEVM6657L board.  I am using CCS 5.2, SYS/BIOS 6.33.  Do you have any sample code for me?

    Thank you.

    Regards,

    Steve

  • Hello Steve,

    BIOSPSP does not support/have any UPP sample applications for this(6657L) device.

    Best Regards,

    Raghavendra