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.

Code composer studio v 5.5.0 files inclusion



Hi,

I am trying to download and debug sample video applications on Spectrum Digital davinci EVM6446 and trying a sample video loopback code given by spectrum digital(importing ccs 3 codes). when I include some c files and header files in the code, the functions are not getting linked and also I am confused with how to include the files(file path) gone through   link too. but still the same problem, can anyone suggest proper inclusion and execution of the application

tools: 

CCS : Code Composer Studio 5.5.0 (for Windows XP PC)

Emulator: spectrum Digital XDS560v2 LC traveler Emulator

video_loopback.rar

/*
 *  Copyright 2005 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 *
 *  Not for distribution.
 */

/*
 *  Video Loopback Test
 *
 */

#include "stdio.h"
#include "davincievm.h"

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  Testing Function                                                        *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void TEST_execute( Int16 ( *funchandle )( ), char *testname, Int16 ledmask )
{
    Int16 status;

    /* Display test ID */
    printf( "%02d  Testing %s...\n", ledmask, testname );

    /* Call test function */
    status = funchandle( );

    /* Check for test fail */
    if ( status != 0 )
    {
        /* Print error message */
        printf( "     FAIL... error code %d... quitting\n", status, testname );

        /* Software Breakpoint to Code Composer */
        SW_BREAKPOINT;
    }
    else
    {
        /* Print error message */
        printf( "    PASS\n", testname );
    }
}

extern Int16 video_loopback_test();

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  main( )                                                                 *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void main( void )
{
    /* Initialize BSL */
    DAVINCIEVM_init( );

    TEST_execute( video_loopback_test,  "Video Loopback", 1 );

    printf( "\n***ALL Tests Passed***\n" );
    SW_BREAKPOINT;
}





/*
 *  Copyright 2005 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 *
 *  Not for distribution.
 */

/*
 *  Video Loopback Test
 *
 */

#include "davincievm_i2c.h"

#define TVP5146_I2C_ADDR 0x5D

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  tvp5146_rset                                                            *
 *                                                                          *
 *      Set codec register regnum to value regval                           *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void tvp5146_rset( Uint8 regnum, Uint8 regval )
{
    Uint8 cmd[2];
    cmd[0] = regnum;    // 8-bit Register Address
    cmd[1] = regval;    // 8-bit Register Data

    DAVINCIEVM_I2C_write( TVP5146_I2C_ADDR, cmd, 2 );
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  tvp5146_rget                                                            *
 *                                                                          *
 *      Return value of codec register regnum                               *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Uint8 tvp5146_rget( Uint8 regnum )
{
    Uint8 cmd[2];

    cmd[0] = regnum;    // 8-bit Register Address
    cmd[1] = 0;         // 8-bit Register Data

    DAVINCIEVM_I2C_write( TVP5146_I2C_ADDR, cmd, 1 );
    DAVINCIEVM_I2C_read ( TVP5146_I2C_ADDR, cmd, 1 );

    return cmd[0];
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  tvp5146_init( )                                                         *
 *                                                                          *
 *      Initialize the TVP5146                                              *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void tvp5146_init( )
{
    DAVINCIEVM_waitusec( 1000 );        // wait 1 msec

    tvp5146_rset( 0xE8, 0x02 );         // Initalize TVP5146, must do after power on
    tvp5146_rset( 0xE9, 0x00 );
    tvp5146_rset( 0xEA, 0x80 );
    tvp5146_rset( 0xE0, 0x01 );
    tvp5146_rset( 0xE8, 0x60 );
    tvp5146_rset( 0xE9, 0x00 );
    tvp5146_rset( 0xEA, 0xB0 );
    tvp5146_rset( 0xE0, 0x01 );
    tvp5146_rset( 0xE0, 0x00 );

    DAVINCIEVM_waitusec( 1000 );        // wait 1 msec

  //tvp5146_rset( 0x00, 0x05 );         // Input Video: CVBS   : VI_2_B
    tvp5146_rset( 0x00, 0x46 );         // Input Video: S-video: VI_2_C(Y) VI_1_C(C)
    tvp5146_rset( 0x02, 0x01 );         // NTSC
    tvp5146_rset( 0x34, 0x11 );         // Enabling clock & Y/CB/CR input format

    DAVINCIEVM_waitusec( 1000 );        // wait 1 msec
}

#define NTSC 1

#if NTSC
    #define BASEP_X 0x7A // 122
    #define BASEP_Y 0x12 // 18
#elif PAL
    #define BASEP_X 0x84 // 132
    #define BASEP_Y 0x16 // 22
#endif

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  vpfe_init( )                                                            *
 *                                                                          *
 *  NTSC:                                                                   *
 *      Width:  720                                                         *
 *      Height: 480                                                         *
 *                                                                          *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void vpfe_init( Uint32 buffer, Uint32 width, Uint32 height )
{
    VPFE_SYN_MODE   = 0x00032F84;   // interlaced, with VD pority as negative
    VPFE_HD_VD_WID  = 0;
    VPFE_PIX_LINES  = 0x02CF020D;

    /*
     *  sph = 1, nph = 1440, according to page 32-33 of the CCDC spec
     *  for BT.656 mode, this setting captures only the 720x480 of the
     *  active NTSV video window
     */
    VPFE_HORZ_INFO  = width << 1;   // Horizontal lines
    VPFE_HSIZE_OFF  = width << 1;   // Horizontal line offset
    VPFE_VERT_START = 0;            // Vertical start line
    VPFE_VERT_LINES = height >> 1;  // Vertical lines
    VPFE_CULLING    = 0xFFFF00FF;   // Disable cullng

    /*
     *  Interleave the two fields 
     */
    VPFE_SDOFST     = 0x00000249;
    VPFE_SDR_ADDR   = buffer;
    VPFE_CLAMP      = 0;
    VPFE_DCSUB      = 0;
    VPFE_COLPTN     = 0xEE44EE44;
    VPFE_BLKCMP     = 0;
    VPFE_FPC_ADDR   = 0x86800000;
    VPFE_FPC        = 0;
    VPFE_VDINT      = 0;
    VPFE_ALAW       = 0;
    VPFE_REC656IF   = 0x00000003;

    /*
     *  Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position 
     */
    VPFE_CCDCFG     = 0x00000800;
    VPFE_FMTCFG     = 0;
    VPFE_FMT_HORZ   = 0x000002D0;
    VPFE_FMT_VERT   = 0x0000020E;
    VPFE_FMT_ADDR0  = 0;
    VPFE_FMT_ADDR1  = 0;
    VPFE_FMT_ADDR2  = 0;
    VPFE_FMT_ADDR3  = 0;
    VPFE_FMT_ADDR4  = 0;
    VPFE_FMT_ADDR5  = 0;
    VPFE_FMT_ADDR6  = 0;
    VPFE_FMT_ADDR7  = 0;
    VPFE_PRGEVEN_0  = 0;
    VPFE_PRGEVEN_1  = 0;
    VPFE_PRGODD_0   = 0;
    VPFE_PRGODD_1   = 0;
    VPFE_VP_OUT     = 0x041A2D00;
    VPFE_PCR        = 0x00000001;   // Enable CCDC
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  vpbe_init( )                                                            *
 *                                                                          *
 *  NTSC:                                                                   *
 *      Width:  720                                                         *
 *      Height: 480                                                         *
 *                                                                          *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void vpbe_init( Uint32 buffer, Uint32 width, Uint32 height, Uint32 cb_enable )
{
    /*
     * Setup VPBE
     */
    VPSS_CLK_CTRL   = 0x00000018;   // Enable DAC and VENC clock, both at 27 MHz
    VPBE_PCR        = 0;            // No clock div, clock enable

    /*
     * Setup OSD
     */
    OSD_MODE        = 0x000000fc;   // Blackground color blue using clut in ROM0
    OSD_OSDWIN0MD   = 0;            // Disable both osd windows and cursor window
    OSD_OSDWIN1MD   = 0;
    OSD_RECTCUR     = 0;

    OSD_VIDWIN0OFST = width >> 4;
    OSD_VIDWIN0ADR  = buffer;
    OSD_BASEPX      = BASEP_X;
    OSD_BASEPY      = BASEP_Y;
    OSD_VIDWIN0XP   = 0;
    OSD_VIDWIN0YP   = 0;
    OSD_VIDWIN0XL   = width;
    OSD_VIDWIN0YL   = height >> 1;
    OSD_MISCCTL     = 0;

    OSD_VIDWINMD    = 0x00000003;   // Disable vwindow 1 and enable vwindow 0
                                    // Frame mode with no up-scaling

    /*
     *  Setup VENC
     */
    VENC_VMOD       = 0x00000003;   // Standard NTSC interlaced output
    VENC_VDPRO      = cb_enable << 8;
    VENC_DACTST     = 0;
    VENC_DACSEL     = 0x00004210;
}


/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  video_loopback_test( )                                                  *
 *                                                                          *
 *                                                                          *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 video_loopback_test( )
{
    tvp5146_init( );
    vpfe_init( 0x81000000, 720, 480 );      // Setup Front-End
    vpbe_init( 0x81000000, 720, 480, 0 );   // Setup Back-End

    return 0;
}




/*
 *  Copyright 2005 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 *
 *  Not for distribution.
 */

/*
 *  Board Setup
 *
 */

#include "davincievm.h"
#include "davincievm_ddr.h"
#include "davincievm_emif.h"
#include "davincievm_gpio_exp.h"
#include "davincievm_i2c.h"
#include "davincievm_msp430.h"
#include "davincievm_pll.h"
#include "davincievm_pmx.h"
#include "davincievm_psc.h"

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_initPscPllMemory( )                                          *
 *                                                                          *
 *      Setup the PSC, PLL, & Memory                                        *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_initPscPllMemory( )
{
    DAVINCIEVM_initPsc( );                  // Setup PSC
    DAVINCIEVM_enableAllPowerModules( );    // Enable all power modules

    DAVINCIEVM_enablePll1( 0, 16 );         // Setup Pll1 ( Clk @ 459 MHz )
    DAVINCIEVM_enablePll2( 0, 19, 9, 1 );   // Setup Pll2 ( DDR @ 135 MHz )

    DAVINCIEVM_DDR_init( );                 // Setup DDR2
    DAVINCIEVM_EMIF_init( );                // Setup EMIF

    return 0;
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_init( )                                                      *
 *                                                                          *
 *      Setup I2C, MSP430, & GPIO_EXP                                       *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_init( )
{
    DAVINCIEVM_PMX_init( );                 // Setup Pin Mux

    /*
     *  PSC, PLL, DDR, & AEMIF are already configured in the GEL file
     *  However the function _initPscPllMemory can be called to perform
     *  the same effect as the GEL files.
     *
     */
    //DAVINCIEVM_initPscPllMemory( );

    DAVINCIEVM_I2C_init( );                 // Setup I2C
    DAVINCIEVM_MSP430_open( );              // Setup MSP430
    DAVINCIEVM_GPIO_EXP_init( );            // Setup GPIO Expander

    return 0;
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_wait( delay )                                                *
 *                                                                          *
 *      Wait in a software loop                                             *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void DAVINCIEVM_wait( Uint32 delay )
{
    volatile Uint32 i;
    for ( i = 0 ; i < delay ; i++ );
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_waitusec( usec )                                             *
 *                                                                          *
 *      Wait in a software loop for X microseconds                          *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void DAVINCIEVM_waitusec( Uint32 usec )
{
    #ifdef ARM_SIDE

        DAVINCIEVM_wait( ( usec * 51 ) >> 6 );

    #elif DSP_SIDE

        DAVINCIEVM_wait( ( usec * 28 ) );

    #endif
}
/*
 *  Copyright 2005 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 *
 *  Not for distribution.
 */

/*
 *  I2C implementation
 *
 */

#include "davincievm_i2c.h"

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_init( )                                                  *
 *                                                                          *
 *      Enable and initalize the I2C module                                 *
 *                                                                          *
 *      The I2C clk is set to run at 20 KHz                                 *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_init( )
{
    #ifdef ARM_SIDE

        CSL_Status status;
        CSL_I2cClkSetup i2c_clksetup;
        CSL_I2cHwSetup  i2c_hwsetup;
        CSL_I2cParam    i2c_param;

        CSL_i2cInit( 0 );
        i2c_handle = CSL_i2cOpen( &i2c_obj, 0, &i2c_param, &status );

        i2c_clksetup.prescalar      = 26;
        i2c_clksetup.clklowdiv      = 20;
        i2c_clksetup.clkhighdiv     = 20;

        i2c_hwsetup.mode            = 1;    // 0: Slave mode        1: Master mode
        i2c_hwsetup.dir             = 0;    // 0: Rx mode           1: Tx mode
        i2c_hwsetup.addrMode        = 0;    // 0: 7-bit mode        1: 10-bit mode
        i2c_hwsetup.sttbyteen       = 0;    // 0: Normal mode       1: Start byte mode
        i2c_hwsetup.ownaddr         = 0;    // #: Own address
        i2c_hwsetup.ackMode         = 0;    // 0: ACK mode          1: NACK mode
        i2c_hwsetup.runMode         = 1;    // 0: No Free run mode  1: Free run mode
        i2c_hwsetup.repeatMode      = 0;    // 0: No repeat mode    1: Repeat mode
        i2c_hwsetup.loopBackMode    = 0;    // 0: No loopback       1: Loopback mode
        i2c_hwsetup.freeDataFormat  = 0;    // 0: No Free data fmt  1: Free data fmt
        i2c_hwsetup.resetMode       = 0;    // 0: Reset             1: Out of reset
        i2c_hwsetup.bcm             = 0;    // 0: Not compatible    1: Compatible
        i2c_hwsetup.inten           = 0;    // #: Intr enable mask
        i2c_hwsetup.clksetup        = &i2c_clksetup;

        status = CSL_i2cHwSetup( i2c_handle, &i2c_hwsetup );

        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_OUTOFRESET, 0 );
        return 0;

    #elif DSP_SIDE

        I2C_ICMDR   = 0;                    // Reset I2C
        I2C_ICPSC   = 26;                   // Config prescaler for 27MHz
        I2C_ICCLKL  = 5;                    // Config clk LOW for 50kHz
        I2C_ICCLKH  = 5;                    // Config clk HIGH for 50kHz
        I2C_ICMDR  |= ICMDR_IRS;            // Release I2C from reset
        return 0;

    #endif
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_close( )                                                 *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_close( )
{
    #ifdef ARM_SIDE

        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_RESET, 0 );
        CSL_i2cClose( i2c_handle );
        return 0;

    #elif DSP_SIDE

        I2C_ICMDR = 0;                      // Reset I2C
        return 0;

    #endif
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_reset( )                                                 *
 *                                                                          *
 *                                                                          *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_reset( )
{
    DAVINCIEVM_I2C_close( );
    DAVINCIEVM_I2C_init( );
    return 0;
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_write( i2caddr, data, len )                              *
 *                                                                          *
 *      I2C write in Master mode                                            *
 *                                                                          *
 *      i2caddr <- I2C slave address                                        *
 *      data    <- I2C data ptr                                             *
 *      len     <- # of bytes to write                                      *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_write( Uint16 i2caddr, Uint8* data, Uint16 len )
{
    Uint16 i;
    Int32 timeout   = 0x20000;
    Int32 timecount = 0;

    #ifdef ARM_SIDE

        Uint16 response;

        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_DATA_COUNT, &len );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_SLAVE_ADDR, &i2caddr );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_DIR_TRANSMIT, 0 );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_START, 0 );

        DAVINCIEVM_wait( 10 );

        for ( i = 0 ; i < len ; i++ )
        {
            CSL_i2cWrite( i2c_handle, &data[i] );

            timecount = 0;
            do
            {
                CSL_i2cGetHwStatus( i2c_handle, CSL_I2C_QUERY_TX_RDY, &response );

                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }

            } while( response == 0 );
        }

      //CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_STOP, 0 );

        return 0;

    #elif DSP_SIDE

        I2C_ICCNT = len;                    // Set len
        I2C_ICSAR = i2caddr;                // Set I2C slave address
        I2C_ICMDR = ICMDR_STT               // Config for master write
                  | ICMDR_TRX
                  | ICMDR_MST
                  | ICMDR_IRS
                  | ICMDR_FREE
                  ;

        DAVINCIEVM_wait( 10 );              // Short delay

        for ( i = 0 ; i < len ; i++ )
        {
            I2C_ICDXR = data[i];            // Write

            timecount = 0;
            do
            {
                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }
            } while ( ( I2C_ICSTR & ICSTR_ICXRDY ) == 0 );// Wait for Tx Ready
        }

        I2C_ICMDR |= ICMDR_STP;             // Generate STOP
        return 0;

    #endif
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_read( i2caddr, data, len )                               *
 *                                                                          *
 *      I2C read in Master mode                                             *
 *                                                                          *
 *      i2caddr <- I2C slave address                                        *
 *      data    <- I2C data ptr                                             *
 *      len     <- # of bytes to write                                      *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_read( Uint16 i2caddr, Uint8* data, Uint16 len )
{
    Uint16 i;
    Int32 timeout   = 0x20000;
    Int32 timecount = 0;

    #ifdef ARM_SIDE

        Uint16 response;

        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_DATA_COUNT, &len );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_SLAVE_ADDR, &i2caddr );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_DIR_RECEIVE, 0 );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_START, 0 );

        DAVINCIEVM_wait( 10 );

        for ( i = 0 ; i < len ; i++ )
        {
            timecount = 0;
            do
            {
                CSL_i2cGetHwStatus( i2c_handle, CSL_I2C_QUERY_RX_RDY, &response );

                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }

            } while( response == 0 );

            CSL_i2cRead( i2c_handle, &data[i] );
        }

      //CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_STOP, 0 );

        return 0;

    #elif DSP_SIDE

        I2C_ICCNT = len;                    // Set len
        I2C_ICSAR = i2caddr;                // Set I2C slave address
        I2C_ICMDR = ICMDR_STT               // Config for master read
                  | ICMDR_MST
                  | ICMDR_IRS
                  | ICMDR_FREE
                  ;

        for ( i = 0 ; i < len ; i++ )
        {
            timecount = 0;
            do
            {
                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }
            } while ( ( I2C_ICSTR & ICSTR_ICRRDY ) == 0 );// Wait for Rx Ready
            data[i] = I2C_ICDRR;            // Read
        }

        I2C_ICMDR |= ICMDR_STP;             // Generate STOP
        return 0;

    #endif
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  DAVINCIEVM_I2C_read_variable( i2caddr, data, len )                      *
 *                                                                          *
 *      I2C read in Master mode                                             *
 *                                                                          *
 *      i2caddr <- I2C slave address                                        *
 *      data    <- I2C data ptr                                             *
 *      len     <- # of bytes to write                                      *
 *                                                                          *
 * ------------------------------------------------------------------------ */
Int16 DAVINCIEVM_I2C_read_variable( Uint16 i2caddr, Uint8* data, Uint16 len )
{
    Uint16 i;
    Int32 timeout   = 0x20000;
    Int32 timecount = 0;

    #ifdef ARM_SIDE

        Uint16 response;

        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_DATA_COUNT, &len );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_SLAVE_ADDR, &i2caddr );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_DIR_RECEIVE, 0 );
        CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_START, 0 );

        DAVINCIEVM_wait( 10 );

        for ( i = 0 ; i < len ; i++ )
        {
            if ( i == 1 )
            {
                len = data[0];
                CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_SET_DATA_COUNT, &len );
            }

            timecount = 0;
            do
            {
                CSL_i2cGetHwStatus( i2c_handle, CSL_I2C_QUERY_RX_RDY, &response );

                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }

            } while( response == 0 );

            CSL_i2cRead( i2c_handle, &data[i] );
        }

      //CSL_i2cHwControl( i2c_handle, CSL_I2C_CMD_STOP, 0 );

        return 0;

    #elif DSP_SIDE

        I2C_ICCNT = len;                    // Set len
        I2C_ICSAR = i2caddr;                // Set I2C slave address
        I2C_ICMDR = ICMDR_STT               // Config for master read
                  | ICMDR_MST
                  | ICMDR_IRS
                  | ICMDR_FREE
                  ;

        for ( i = 0 ; i < len ; i++ )
        {
            if ( i == 1 )
            {
                len = data[0];
                I2C_ICCNT = len;            // Set len
            }

            timecount = 0;
            do
            {
                timecount++;
                if ( timecount >= timeout )
                {
                    DAVINCIEVM_I2C_reset( );
                    return 1000;
                }
            } while ( ( I2C_ICSTR & ICSTR_ICRRDY ) == 0 );// Wait for Rx Ready
            data[i] = I2C_ICDRR;            // Read
        }

        I2C_ICMDR |= ICMDR_STP;             // Generate STOP
        return 0;

    #endif
}

http://c6000.spectrumdigital.com/davincievm/revf/

Regards.

  • Hi Venkat,

    You can copy the *.c file into project directly like (ctrl+c and ctrl+v) and you have to mention the path when you include the *.h file & library file (*.lib) path.

    Where did you get this code ?
    Could you direct to me there.

    Is that TI released code or 3rd party like spectrum or LogicPD etc., ?

    This code seems released by spectrum digital inc.

    I've googled and got some link for "davincievm.h" required include file.

    Download this file and mention this path in CCS properties to avoid the "file not found" error.

    Please let me know if any issues.

    www.pudn.com/.../detail753464.html
  • Hi, Thank you.

    I will try to include the files as suggested by you and update u back. I am using spectrum digital sample code ( please go to the link

    ( c6000.spectrumdigital.com/.../davincievm.zip ) and download the davincievm zip folder. (\davincievm\davincievm\examples\video_loopback)
    or
    c6000.spectrumdigital.com/.../revf ( download DaVinci EVM Target content ).
    )

    Currently I am trying to run the code using emulator Spectrum digital XDS560 v2 LC traveller and i am trying sample video loopback code file from the above link and imported this ccs3.3 project into ccs 5.5.0 and tried to debug, I get an error saying -l..\..\csl\arm\lib\Debug\csl_davinciArm9.lib
    -l..\..\lib\davincievmbsl.lib files are not found. later I gave proper path and it was compiled. then if i click on a function definition and try to open function declaration say Int16 DAVINCIEVM_init( ); but this function is not opening even the header file containing the function is included in the library path in project settings . Actually When we extract this ccs3.3 project only project will be copied, we have to include the other files like davincievm.h,davincievm.h, davincievm _i2c.h, davincievm _i2c.h etc manually. Here I am a bit confused which all the files I have to include, where to include the path of the file. Please go through the samples given in above link.

    Regards,

    Venkat
  • Hi Venkat,

    1) I've downloaded the "davincievm.zip" from your given link.

    2) Just I imported the "video_loopback" project in CCSv5 through "Import legacy CCSv3.3 project" option

    3) Rebuild the project and got below error.

    Please note that I've not changed any thing so far.

    **** Build of configuration Debug for project video_loopback ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all

    'Building file: C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/main.c'

    'Invoking: ARM Compiler'

    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv5e --abi=ti_arm9_abi -me -O1 --include_path="C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="C:/ti/xdais_7_21_01_07/packages/ti/xdais" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/include" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/csl/arm/inc" -g --define="_DEBUG" --define="ARM_SIDE" --quiet --display_error_number --diag_wrap=off --obj_directory="C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug" --preproc_with_compile --preproc_dependency="main.pp"  "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/main.c"

    "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/main.c", line 38: warning #1119-D: this assembly directive potentially unsafe inside a function

    "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/main.c", line 62: warning #1119-D: this assembly directive potentially unsafe inside a function

    'Finished building: C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/main.c'

    ' '

    'Building file: C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_test.c'

    'Invoking: ARM Compiler'

    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv5e --abi=ti_arm9_abi -me -O1 --include_path="C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="C:/ti/xdais_7_21_01_07/packages/ti/xdais" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/include" --include_path="C:/Users/10607926.LNTIES/Downloads/davincievm/csl/arm/inc" -g --define="_DEBUG" --define="ARM_SIDE" --quiet --display_error_number --diag_wrap=off --obj_directory="C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug" --preproc_with_compile --preproc_dependency="video_test.pp"  "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_test.c"

    'Finished building: C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_test.c'

    ' '

    'Building target: C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_loopback/../Debug/video_loopback.out'

    'Invoking: ARM Linker'

    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv5e --abi=ti_arm9_abi -me -O1 -g --define="_DEBUG" --define="ARM_SIDE" --quiet --display_error_number --diag_wrap=off --obj_directory="C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug" -z -m"C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/video_loopback.map" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" -i"C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_loopback" -i"C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="video_loopback_linkInfo.xml" --rom_model -o "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_loopback/../Debug/video_loopback.out"  "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/video_test.obj" "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/main.obj" "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video.cmd"

    warning #10366-D: automatic library build: using library

      "C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib/rts32e.lib" for the first time, so

      it must be built.  This may take a few minutes.

    error #10008-D: cannot find file "..\..\csl\arm\lib\Debug\csl_davinciArm9.lib"

    error #10008-D: cannot find file "..\..\lib\davincievmbsl.lib"

    undefined             first referenced                                                                          

     symbol                   in file                                                                              

    ---------             ----------------                                                                          

    _DAVINCIEVM_I2C_read  C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/video_test.obj

    _DAVINCIEVM_I2C_write C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/video_test.obj

    _DAVINCIEVM_init      C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/main.obj      

    _DAVINCIEVM_waitusec  C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/Debug/video_test.obj

    error #10234-D: unresolved symbols remain

    error #10010: errors encountered during linking; "C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_loopback/../Debug/video_loopback.out" not built

    >> Compilation failure

    gmake: *** [C:/Users/10607926.LNTIES/Downloads/davincievm/examples/video_loopback/video_loopback/../Debug/video_loopback.out] Error 1

    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    4) I'm getting library linker error that library not found.

    5) I've commented out the library entry in video.cmd file.

    video.cmd

    //-l..\..\csl\arm\lib\Debug\csl_davinciArm9.lib

    //-l..\..\lib\davincievmbsl.lib

    6) Then I've added the library name and its path in  CCS properties.

    CCS properties -> CCS Build -> ARM Linker -> File search path

    Please refer to the attached screen shot.

    C:\Users\10607926.LNTIES\Downloads\davincievm\lib

    C:\Users\10607926.LNTIES\Downloads\davincievm\csl\arm\lib\Debug

    davincievmbsl.lib

    csl_davinciArm9.lib

     

    Now, I'm able to build the video loopback example. You have to do the same step for all examples given.

    Please let me know the results.

  • Hi,

    instead of comenting
    //-l..\..\csl\arm\lib\Debug\csl_davinciArm9.lib

    //-l..\..\lib\davincievmbsl.lib
    paths you can give your absolute path or relative path of the said .lib files in your pC(these files also available in davincievm folder you have downloaded : "davincievmbsl.lib" is in \davincievm\davincievm\lib and "csl_davinciArm9.lib "will be in : davincievm\davincievm\csl\arm\lib\Debug folders)

    Here I am not getting the errors. I am able to compile the code But even if I have included the files in the project settings I am not able to open a particular function by right clicking on function name and selecting " open declaration"(refer attached screenshot :file1") later I have tried this ( www.argenox.com/.../making-code-composer-studio-projects-portable) suggestions and my files are getting linked.
    My doubt here is if I creat a new project having some files where all i have to mention the inclusion of the file in project setting? In project setting CCS has options like Linked resources, include options, file search path( right click on project name in the project explorer and select settings). which is the proper way to include, and which is for what?

    Regards,

    Venkat
  • Please find the attachments

    file 1: function link

    file 2:  for project setting

  • Use "copy" option when you create a new CCS project for new "*.c" "*.h" file.
    Link option is some what confuse for newbie.
    Just you can copy the selected file from one CCS project and paste to some other CCS project.
    Able to build successfully the CCS project and executable ?