Ejemplo n.º 1
0
int main(void)
{
#if NUMBER_OF_CORES > 1
    StatusType rv;

    switch(GetCoreID())
    {
    case OS_CORE_ID_MASTER :
        TestRunner_start();
        SyncAllCores_Init();
        StartCore(OS_CORE_ID_1, &rv);
        if(rv == E_OK)
            StartOS(OSDEFAULTAPPMODE);
        break;
    case OS_CORE_ID_1 :
        StartOS(OSDEFAULTAPPMODE);
        break;
    default :
        /* Should not happen */
        break;
    }
#else
# error "This is a multicore example. NUMBER_OF_CORES should be > 1"
#endif
    return 0;
}
Ejemplo n.º 2
0
FUNC(int, OS_APPL_CODE) main(void)
{
#if NUMBER_OF_CORES > 1
    StatusType rv;

    switch(GetCoreID()){
      case OS_CORE_ID_MASTER :
        initLed();
        setLed(0, led_state1);
        /* Wakeup core 1 */
        StartCore(OS_CORE_ID_1, &rv);
        if(rv == E_OK)
          StartOS(OSDEFAULTAPPMODE);
        break;
      case OS_CORE_ID_1 :
        /* Core 1 : leds were already initialized by the core 0 at this step */
        setLed(1, led_state2);
        StartOS(OSDEFAULTAPPMODE);
        break;
      default :
        /* Should not happen */
        break;
    }
#else
    initLed();
    setLed(0, led_state1);
    StartOS(OSDEFAULTAPPMODE);
#endif

    return 0;
}
Ejemplo n.º 3
0
/*
 * This function is called whenever a process tries to do an ioctl on our
 * device file. We get two extra parameters (additional to the inode and file
 * structures, which all device functions get): the number of the ioctl called
 * and the parameter given to the ioctl function.
 *
 * If the ioctl is write or read/write (meaning output is returned to the
 * calling process), the ioctl call returns the output of this function.
 *
 */
long device_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
    printk(KERN_INFO "ioctl cmd=%d, arg=%08lx", cmd, arg);

    /*
     * Switch according to the ioctl called
     */
    switch (cmd)
    {

        case IOCTL_START_CORE:
        {
            CoreStartData   coreStartData;

            unsigned long r =  __copy_from_user( &coreStartData, (void*)arg, sizeof(coreStartData) );
            if(r == 0)
            {
                StartCore( coreStartData.coreID, coreStartData.startPoint );
            }


            break;
            
        }


        case IOCTL_TRIGGER_DOORBELL:
        {
            SendDoorBellToCore( arg );
            printk(KERN_INFO "Sending doorbell to core %d\n", (int)arg);
            break;
        }

    }

    return SUCCESS;
}