#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ti/platform/platform.h"
#include "ti/platform/resource_mgr.h"

#define CORE_NUM_6670     4
#define CORE_NUM_6678     8

platform_info    sPlatformInfo;

void MulticoreBoot()
{

    int *pBootMagicAddCore0;
    int *IpcGr0;
	platform_init_flags  sFlags;
    platform_init_config sConfig;
    int i;
    int pform_status;



	    /*
	     * You can choose what to initialize on the platform by setting the following
	     * flags. We will initialize everything.
	     */
	    memset( (void *) &sFlags,  0, sizeof(platform_init_flags));
	    memset( (void *) &sConfig, 0, sizeof(platform_init_config));


	    sFlags.pll  = 0;    /* PLLs for clocking      */
	    sFlags.ddr  = 0;    /* External memory         */
	    sFlags.tcsl = 1;    /* Time stamp counter     */
		sFlags.phy  = 1;    /* Ethernet             */
	    sFlags.ecc  = 0;    /* Memory ECC             */

	    sConfig.pllm = 0;    /* Use libraries default clock divisor */
	    pform_status =  platform_init(&sFlags, &sConfig);

	    /* Platform Information - we will read it form the Platform Library */
	    platform_get_info(&sPlatformInfo);

	    if (pform_status == Platform_EOK)
	    {

	       /*write Boot Magic add of other cores and send IPC interrupt*/
	       pBootMagicAddCore0 = (int*)0x1087FFFC;

  	     *(pBootMagicAddCore0+ (0x01000000*7)/4 ) =0x1785b7c0 ;

	       IpcGr0  = (int*)0x02620240;

	       *(IpcGr0+7) = (*(IpcGr0+7)) | 0x00000001;
	    }





}
