コード例 #1
0
ファイル: message.c プロジェクト: skitlab/ti-ipc
/*
 *  ======== serverTask ========
 */
Void serverTask(UArg arg0, UArg arg1)
{
    MessageQ_Handle  serverMessageQ;
    MessageQ_QueueId replyQueue;
    MessageQ_Msg     msg;
    UInt16           msgId;
    Int              status;

    serverMessageQ = MessageQ_create(SERVERNAME, NULL);
    
    /* Loop forever processing requests */
    System_printf("Server is ready to set processing requests\n");
    while (TRUE) {
    
        /* Wait for a request. */
        status = MessageQ_get(serverMessageQ, &msg, MessageQ_FOREVER);
        if (status < 0) {
            System_abort("Stopping test\n");
        }

        /* Get the id and increment it to send back as validation */
        msgId = MessageQ_getMsgId(msg);
        msgId += NUMCLIENTS;
        MessageQ_setMsgId(msg, msgId);
        
        /* Use the embedded reply destination */
        replyQueue = MessageQ_getReplyQueue(msg);

        /* Send the response back */
        status = MessageQ_put(replyQueue, msg);
        if (status < 0) {            
            System_abort("MessageQ_put was not successful\n");
        }
    }
}
コード例 #2
0
ファイル: notify_dsp.c プロジェクト: skitlab/ti-ipc
/*
 *  ======== tsk0_func ========
 *  Wait to be released then send an interrupt to the ARM processor
 */
Void tsk0_func(UArg arg0, UArg arg1)
{
    Int status;

    while (seq < NUMLOOPS) {
        /* Wait to be released by callback function */
        Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

        System_printf("Received request #%d from ARM (lineId = 0)\n",
                      seq);

        status = Notify_sendEvent(armProcId, LINE_1, EVENTID, seq, TRUE);
        if (status < 0) {
            System_abort("sendEvent failed\n");
        }

        System_printf("Sent request #%d to ARM (lineId = 1)\n", seq);

        /* Wait to be released by the cbFxn posting the semaphore */
        Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
        
        System_printf("Received request #%d from ARM (lineId = 1)\n");

        /* Send an event to the ARM */
        status = Notify_sendEvent(armProcId, LINE_0, EVENTID, seq, TRUE);
        if (status < 0) {
            System_abort("sendEvent failed\n");
        }

        System_printf("Sent request #%d to ARM (lineId = 0)\n", seq);
    }

    System_printf("Test completed\n");
    BIOS_exit(0);
}
コード例 #3
0
ファイル: messageq_multi.c プロジェクト: Hashcode/ipcdev
/*
 *  ======== loopbackFxn========
 *  Receive and return messages.
 *  Run at priority lower than tsk1Fxn above.
 *  Inputs:
 *     - arg0: number of the thread, appended to MessageQ host and slave names.
 */
Void loopbackFxn(UArg arg0, UArg arg1)
{
    MessageQ_Msg     getMsg;
    MessageQ_Handle  messageQ;
    MessageQ_QueueId remoteQueueId;
    Int              status;
    UInt16           msgId = 0;
    Char             localQueueName[64];
    Char             hostQueueName[64];

    System_printf("Thread loopbackFxn: %d\n", arg0);

    System_sprintf(localQueueName, "%s_%d", SLAVE_MESSAGEQNAME, arg0);
    System_sprintf(hostQueueName,  "%s_%d", HOST_MESSAGEQNAME,  arg0);

    /* Create a message queue. */
    messageQ = MessageQ_create(localQueueName, NULL);
    if (messageQ == NULL) {
        System_abort("MessageQ_create failed\n");
    }

    System_printf("loopbackFxn: created MessageQ: %s; QueueID: 0x%x\n",
        localQueueName, MessageQ_getQueueId(messageQ));

    System_printf("Start the main loop: %d\n", arg0);
    while (msgId < NUMLOOPS) {
        /* Get a message */
        status = MessageQ_get(messageQ, &getMsg, MessageQ_FOREVER);
        if (status != MessageQ_S_SUCCESS) {
           System_abort("This should not happen since timeout is forever\n");
        }
        remoteQueueId = MessageQ_getReplyQueue(getMsg);

#ifndef BENCHMARK
        System_printf("%d: Received message #%d from core %d\n",
                arg0, MessageQ_getMsgId(getMsg),
                MessageQ_getProcId(remoteQueueId));
#endif
        /* test id of message received */
        if (MessageQ_getMsgId(getMsg) != msgId) {
            System_abort("The id received is incorrect!\n");
        }

#ifndef BENCHMARK
        /* Send it back */
        System_printf("%d: Sending message Id #%d to core %d\n",
                      arg0, msgId, MessageQ_getProcId(remoteQueueId));
#endif
        status = MessageQ_put(remoteQueueId, getMsg);
        if (status != MessageQ_S_SUCCESS) {
           System_abort("MessageQ_put had a failure/error\n");
        }
        msgId++;
    }

    MessageQ_delete(&messageQ);
    numTests += NUMLOOPS;

    System_printf("Test thread %d complete!\n", arg0);
}
コード例 #4
0
/*
 *  ======== USBCDCD_init ========
 */
void USBCDCD_init(void)
{
    Hwi_Handle hwi;
    Error_Block eb;

    Error_init(&eb);

    /* Install interrupt handler */
    hwi = Hwi_create(INT_USB0, USBCDCD_LoggerIdle_hwiHandler, NULL, &eb);
    if (hwi == NULL) {
        System_abort("Can't create USB Hwi");
    }

    /* State specific variables */
    state = USBCDCD_STATE_UNCONFIGURED;

    /* Set the USB stack mode to Device mode with VBUS monitoring */
    USBStackModeSet(0, eUSBModeForceDevice, 0);

    /* Initialize the transmit buffer */
    USBBufferInit(&txBuffer);

    /*
     * Pass our device information to the USB HID device class driver,
     * initialize the USB controller and connect the device to the bus.
     */
    if (!USBDCDCInit(0, &serialDevice)) {
        System_abort("Error initializing the serial device");
    }
}
コード例 #5
0
ファイル: message_core0.c プロジェクト: skitlab/ti-ipc
/*
 *  ======== main ========
 *  Synchronizes all processors.
 *  Creates a HeapBufMP and registers it with MessageQ.
 */
Int main(Int argc, Char* argv[])
{
    Int status;
    HeapBufMP_Handle              heapHandle;
    HeapBufMP_Params              heapBufParams;

    /*  
     *  Ipc_start() calls Ipc_attach() to synchronize all remote processors
     *  because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
     */
    status = Ipc_start();
    if (status < 0) {
        System_abort("Ipc_start failed\n");
    }

    /* 
     *  Create the heap that will be used to allocate messages.
     */     
    HeapBufMP_Params_init(&heapBufParams);
    heapBufParams.regionId       = 0;
    heapBufParams.name           = HEAP_NAME;
    heapBufParams.align          = HEAP_ALIGN;
    heapBufParams.numBlocks      = HEAP_NUMMSGS;
    heapBufParams.blockSize      = HEAP_MSGSIZE;
    heapHandle = HeapBufMP_create(&heapBufParams);
    if (heapHandle == NULL) {
        System_abort("HeapBufMP_create failed\n" );
    }
    
    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
 
    BIOS_start();
    return (0);
}
コード例 #6
0
int main(void)
{
	/* Call board init functions */
	uint32_t ui32SysClock;
	ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
			SYSCTL_OSC_MAIN |
			SYSCTL_USE_PLL |
			SYSCTL_CFG_VCO_480), 120E6);

	Board_initGeneral(ui32SysClock);
	Board_initEMAC();
	Board_initGPIO();
	// Board_initI2C();
	// Board_initSDSPI();
	// Board_initSPI();
	// Board_initUART();
	// Board_initUSB(Board_USBDEVICE);
	// Board_initUSBMSCHFatFs();
	// Board_initWatchdog();
	// Board_initWiFi();

	setup_ledcube();

	Mailbox_Params mbox_Params;
	Error_Block eb;
	Error_init(&eb);

	_sem = Semaphore_create(0, NULL, &eb);
	if (_sem == NULL) {
		System_abort("Couldn't create semaphore");
	}

	ledEvent = Event_create(NULL,&eb);
	Mailbox_Params_init(&mbox_Params);
	mbox_Params.readerEvent=ledEvent;
	mbox_Params.readerEventId=Event_Id_01;

	mbox_led = Mailbox_create(sizeof(struct ledMatrix),1, &mbox_Params, &eb);
	if(mbox_led == NULL){
		// Do something with errorblock, in the real world
		System_abort("woho!");
	}

	create_led_task((UArg) mbox_led);
	//netOpenHook((UArg) mbox_led);
	netOpenHook(mbox_led);


	System_printf("Starting the example\nSystem provider is set to SysMin. "
			"Halt the target to view any SysMin contents in ROV.\n");

	/* SysMin will only print to the console when you call flush or exit */
	System_flush();

	/* Start BIOS */
	BIOS_start();

	return (0);
}
コード例 #7
0
/* ARGSUSED */
Void smain(UArg arg0, UArg arg1)
{
    SemThread_Params semParams;
    Task_Params      taskParams;
    Task_Handle      tsk;
    Int              i;

    Log_print0(Diags_ENTRY, "[+E] smain> Enter ");

    SemThread_Params_init(&semParams);
    done = SemThread_create(0, &semParams, NULL);

    SemThread_Params_init(&semParams);
    mutex = SemThread_create(1, &semParams, NULL);

    if ((done == NULL) || (mutex == NULL)) {
        Log_print0(Diags_USER7, "[+7] smain> SemThread creation failed");

        System_abort("SemThread_create failed \n");
    }

    Task_Params_init(&taskParams);
    /*
     *  Add the following line to have the stack allocated from the external
     *  heap:
     *      taskParams.stackHeap = (IHeap_Handle)EXTMEM_HEAP;
     */

    taskParams.stackSize = 0x1000;

    for (i = 0; i < NUMTASKS; i++) {
        Task_Params_init(&taskParams);
        taskParams.priority = attrsTable[i].priority;

        taskParams.arg0 = i + 1; /* task id */
        taskParams.arg1 = i;     /* index into attrsTable */
        tsk = Task_create((Task_FuncPtr)rmanTask, &taskParams, NULL);

        if (tsk == NULL) {

            Log_print1(Diags_USER7, "[+7] smain> Task_create of task %d failed",
                    (IArg)(i + 1));

            System_abort("Task_create() failed\n");
        }
    }

    for (i = 0; i < NUMTASKS; i++) {
        SemThread_pend(done, SemThread_FOREVER, NULL);
    }

    SemThread_delete(&mutex);
    SemThread_delete(&done);

    Log_print0(Diags_USER4, "[+4] smain> TEST PASSED ");

    Log_print0(Diags_EXIT, "[+X] smain> Exit ");
}
コード例 #8
0
Void cycleLED(UArg arg0, UArg arg1)
{
    unsigned int    i = 0;
    uint8_t         writeBuffer[4];
    I2C_Handle      handle;
    I2C_Params      i2cparams;
    I2C_Transaction i2c;

    I2C_Params_init(&i2cparams);
    i2cparams.bitRate = I2C_400kHz;
    handle = I2C_open(Board_I2C_TPL0401, &i2cparams);
    if (handle == NULL) {
        System_abort("I2C was not opened");
    }

    i2c.slaveAddress = Board_TPL0401_ADDR;
    i2c.readCount = 0;
    i2c.readBuf = NULL;
    i2c.writeBuf = writeBuffer;

    /* Enable the PWM oscillator */
    writeBuffer[0] = 0x00;
    writeBuffer[1] = 0x81;
    i2c.writeCount = 2;
    if (!I2C_transfer(handle, &i2c)) {
        GPIO_write(Board_LED1, Board_LED_ON);
        System_abort("Bad I2C transfer!");
    }

    /* Bring the LEDs into PWM mode */
    writeBuffer[0] = 0x8C;
    writeBuffer[1] = 0xAA;
    writeBuffer[2] = 0xAA;
    i2c.writeCount = 3;
    if (!I2C_transfer(handle, &i2c)) {
        GPIO_write(Board_LED1, Board_LED_ON);
        System_abort("Bad I2C transfer!");
    }

    i2c.writeCount = 4;
    while (true) {
        /* Point to the new LED pattern */
        i2c.writeBuf = (uint8_t *) &(rgbcmd[i]);

        if (!I2C_transfer(handle, &i2c)) {
            GPIO_write(Board_LED1, Board_LED_ON);
            System_abort("Bad I2C transfer!");
        }

        /* Reached the end of the RGB patterns; reset index */
        if (rgbcmd[++i].LED == 0x00) {
            i = 0;
        }
        Task_sleep(100);
    }
}
コード例 #9
0
/*
 *  ======== tsk0 ========
 */
Void tsk0(UArg arg0, UArg arg1)
{
    Int              status;
    MessageQ_Msg     msg; 
    
    System_printf("tsk0 starting\n");

    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)SharedRegion_getHeap(0), HEAP_ID);

    /* Open the 'next' remote message queue. Spin until it is ready. */
    do {
        status = MessageQ_open(nextQueueName, &nextQueueId); 
    }
    while (status < 0);
    
    if (selfId == 0) {
        msg = MessageQ_alloc(HEAP_ID, MSGSIZE);
        if (msg == NULL) {
            System_abort("MessageQ_alloc failed\n");
        }
        
        /* Kick off the loop */
        status = MessageQ_put(nextQueueId, msg);
        if (status < 0) {
            System_abort("MessageQ_put failed\n");
        }
    }
    
    for (numReceived = 0; numReceived < NUMLOOPS; numReceived++) {
        /* Get a message */
        status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
        if (status < 0) {
            System_abort("MessageQ_get failed\n");
        }
        
        if (selfId == 0) {
            rawtimestamps[numReceived] = Timestamp_get32();
            
            if (numReceived == NUMLOOPS - 1) {
                printStatistics();
                break;
            }
        }
        
        status = MessageQ_put(nextQueueId, msg);
        if (status < 0) {
            System_abort("MessageQ_put failed\n");
        }
    }
    
    System_exit(0);
    
}
コード例 #10
0
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status        status;

    /* Set default Diags mask to all, to get trace for init() functions */
    FCSettings_init();
    Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");

    buf = Memory_calloc(NULL, BUFSIZE, BUFALIGN, NULL);

    if (buf == NULL) {
        System_abort("Allocation of buffer for BUFRES failed. Aborting.\n");
    }

    status = RMAN_init();

    //Diags_setMask(RMAN_MODNAME"+EX1234567");

    if (IRES_OK != status) {
        System_printf("main> RMAN initialization Failed [%d]\n", status);
        System_abort("Aborting...\n");
    }

    config.iresConfig.size = sizeof(BUFRES_Params);
//    config.iresConfig.allocFxn = _ALG_allocMemory;
//    config.iresConfig.freeFxn = _ALG_freeMemory;
    config.iresConfig.allocFxn = DSKT2_allocPersistent;
    config.iresConfig.freeFxn = DSKT2_freePersistent;

    config.base = buf;
    config.length = (UInt32)BUFSIZE;

    status = RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config);

    /*
     *  Now that are resource is initialized,
     *  set default Diags mask to warnings and errors
     */
    Diags_setMask(FCSETTINGS_MODNAME"-EX12345");
    //Diags_setMask(BUFRES_MODNAME"-EX12345");

    if (status != IRES_OK) {
        /* Test failed */
        System_printf("BUFRES_init() failed [0x%x]\n", status);
        System_abort("Aborting.\n");
        return (-1);
    }

    smain(argc, argv);

    return (0);
}
コード例 #11
0
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    // TODO: Use Diags_setMask()
#if 0
    GT_init();
    GT_create(&CURTRACE, "ti.sdo.fc.rman.examples.hdvicp");
        GT_set(MOD_NAME "=01234567");
        GT_set("ti.sdo.fc.rman" "=4567");
        GT_set("ti.sdo.fc.dskt2" "=67");
        GT_set("ti.sdo.fc.ires.hdvicp" "=01234567");
/*      GT_set("ti.sdo.fc.dskt2" "=01234567");*/
#endif

    Log_print0(Diags_ENTRY, "[+E] _main> Enter ");

    status = RMAN_init();
    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
                (IArg)status);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    /*
     * Supply initialization information for the RESMAN while registering
     */
    size = sizeof(IRESMAN_HdVicpParams);

    configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
    configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
    configParams.baseConfig.size = size;

    /* Register the HDVICP protocol/resource manager with the
     * generic resource manager */

    status = RMAN_register(&IRESMAN_HDVICP, (IRESMAN_Params *)&configParams);

    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_register() failed [%d]",
                (IArg)status);
        System_abort("RMAN_register() failed, aborting...\n");
    }

    Log_print0(Diags_EXIT, "[+X] main> Exit");

    BIOS_start();

    return(0);
}
コード例 #12
0
ファイル: NameServerApp.c プロジェクト: liyaoshi/ipcdev
Int main(Int argc, Char* argv[])
{
    Error_Block     eb;
    Task_Params     taskParams;
    Registry_Result result;

    Log_print0(Diags_ENTRY, "--> main:");

    /* must initialize the error block before using it */
    Error_init(&eb);

    /* create main thread (interrupts not enabled in main on BIOS) */
    Task_Params_init(&taskParams);
    taskParams.instance->name = "smain";
    taskParams.stackSize = 0x1000;
    Task_create(smain, &taskParams, &eb);

    if (Error_check(&eb)) {
        System_abort("main: failed to create application startup thread");
    }

    /* register with xdc.runtime to get a diags mask */
    result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
    Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

    /* start scheduler, this never returns */
    BIOS_start();

    /* should never get here */
    Log_print0(Diags_EXIT, "<-- main:");
    return (0);
}
コード例 #13
0
/*
 *  ======== main ========
 */
Int main(Int argc, Char* argv[])
{  
    selfId = MultiProc_self();
    
    System_printf("Core (\"%s\") starting\n", MultiProc_getName(selfId));
    
    if (numCores == 0) {
        numCores = MultiProc_getNumProcessors();
    }
    
    attachAll(numCores);
    
    System_sprintf(localQueueName, "CORE%d", selfId);
    System_sprintf(nextQueueName, "CORE%d", 
        ((selfId + 1) % numCores));
    System_sprintf(prevQueueName, "CORE%d", 
        (selfId - 1 + numCores)
            % numCores);
            
    /* Create a message queue. */
    messageQ = MessageQ_create(localQueueName, NULL);    
    if (messageQ == NULL) {
        System_abort("MessageQ_create failed\n" );
    }
 
    BIOS_start();

    return (0);
}
コード例 #14
0
ファイル: dskt2_lock.c プロジェクト: mobiaqua/ti-fc
/*
 *  ======== DSKT2_initLocks ========
 *  Implements yield function and initializes all the
 *  the lock semaphores, and yield contexts.
 */
Void DSKT2_initLocks()
{
    Int i;

    /*
     * Initialize the yielding context and lock create flags
     */
    for (i = 0; i < DSKT2_NUM_SCRATCH_GROUPS; i++) {
        _DSKT2_yieldingContext[i] = NULL;

        /*
         * Note, an optimization could be to allow this array to be
         * sparse, and only create enough semaphores for the groups that
         * will be used.  Might require some extra config on the user's part
         * but it would save on some resources in environments where sems
         * are heavy.
         */
        _locks[i] = Semaphore_create(1, NULL, NULL);

        if (_locks[i] == NULL) {
            /* This is a fatal error */
            System_abort("DSKT2_initLocks(): Semaphore creation failed\n");
        }
    }
}
コード例 #15
0
ファイル: fatsdraw.c プロジェクト: tomaszmat/simulate
/*
 *  ======== printDrive ========
 *  Function to print drive information such as the total disk space
 *  This function was created by referencing FatFs's API documentation
 *  http://elm-chan.org/fsw/ff/en/getfree.html
 *
 *  This function call may take a while to process, depending on the size of
 *  SD Card used.
 */
void printDrive(const char *driveNumber, FATFS **fatfs)
{
    FRESULT        fresult;
    DWORD          freeClusterCount;
    DWORD          totalSectorCount;
    DWORD          freeSectorCount;

    System_printf("Reading disk information...");
    System_flush();

    fresult = f_getfree(driveNumber, &freeClusterCount, fatfs);
    if (fresult) {
        System_abort("Error getting the free cluster count from the FatFs object");
    }
    else {
        System_printf("done\n");

        /* Get total sectors and free sectors */
        totalSectorCount = ((*fatfs)->n_fatent - 2) * (*fatfs)->csize;
        freeSectorCount  = freeClusterCount * (*fatfs)->csize;

        /* Print the free space (assuming 512 bytes/sector) */
        System_printf("Total Disk size: %10lu KiB\n"
                      "Free Disk space: %10lu KiB\n",
                      totalSectorCount / 2,
                      freeSectorCount  / 2);
    }
}
コード例 #16
0
ファイル: gatempapp.c プロジェクト: liyaoshi/ipcdev
/*
 *  ======== main ========
 */
Int main(Int argc, Char* argv[])
{
    Error_Block     eb;
    Task_Params     taskParams;

    Log_print0(Diags_ENTRY, "--> main:");

    /* must initialize the error block before using it */
    Error_init(&eb);

    /* create main thread (interrupts not enabled in main on BIOS) */
    Task_Params_init(&taskParams);
    taskParams.instance->name = "smain";
    taskParams.stackSize = 0x1000;
    Task_create(smain, &taskParams, &eb);

    if (Error_check(&eb)) {
        System_abort("main: failed to create application startup thread");
    }

    /* start scheduler, this never returns */
    BIOS_start();

    /* should never get here */
    Log_print0(Diags_EXIT, "<-- main:");
    return (0);
}
コード例 #17
0
ファイル: App.c プロジェクト: supermk2/Tiva_C
Void Task_UART(UArg arg0, UArg arg1)
{
    UART_Handle uart;
    UART_Params uartParams;
    const char echoPrompt[] = "\fEchoing characters:\r\n";
    char input;    
    
    UART_Params_init(&uartParams);
    uartParams.writeMode = UART_MODE_BLOCKING;
    uartParams.readMode = UART_MODE_BLOCKING;
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uartParams.parityType = UART_PAR_NONE;
    uartParams.dataLength = UART_LEN_8;
    uartParams.stopBits = UART_STOP_ONE;
    
    uart = UART_open(Board_UART0, &uartParams);
    if (uart == NULL) {
        System_abort("Error opening the UART");
    }

    System_printf("\nTask_UART");
    UART_write(uart, echoPrompt, sizeof(echoPrompt));
    
    // Loop forever echoing 
    while (1) {
        UART_read(uart, &input, 1);
        input++;
        UART_write(uart, &input, 1);
    }
}
コード例 #18
0
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    FCSettings_init();
    Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
    Diags_setMask("xdc.runtime.Main+EX1234567");
    Diags_setMask("ti.sdo.fc.%+EX1234567");

    Log_print0(Diags_ENTRY, "[+E] _main> Enter");

    status = RMAN_init();
    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
                   (IArg)status);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    Log_print0(Diags_EXIT, "[+X] main> Exit");

    BIOS_start();

    return(0);
}
コード例 #19
0
Void myTaskFxn (UArg arg0, UArg arg1)
{
    AT45DB_Handle at45dbHandle;
    AT45DB_Transaction at45dbTransaction;

    /* Open AT45DB */
    at45dbHandle = AT45DB_open(0);
    if (at45dbHandle == NULL) {
        System_abort("Error opening AT45DB161D");
    }

    /* Initialize at45dbTransaction */
    at45dbTransaction.address.page = 0;
    at45dbTransaction.address.byte = 0;
    at45dbTransaction.data_size = PAGE_SIZE;
    at45dbTransaction.data = textarray;

    if(!AT45DB_pageWriteThroughBuffer(at45dbHandle, &at45dbTransaction) ) {
       System_printf("Page write unsuccessful");
    }
    /* set transaction data to read buffer */
    at45dbTransaction.data = readBuf;

    if(AT45DB_readMainMemoryPage(at45dbHandle, &at45dbTransaction) ) {
        /* Print contents of read buffer */
        System_printf("%s", readBuf);
    }
    else {
        System_printf("Page read unsuccessful");
    }
    /* Close At45DB */
    AT45DB_close(at45dbHandle);

    BIOS_exit(0);
}
コード例 #20
0
/*
 *  ======== main ========
 */
int main(void)
{
    PIN_Handle ledPinHandle;

    /* Call board init functions */
    Board_initGeneral();
    Board_initUART();

    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, ledPinTable);
    if(!ledPinHandle) {
        System_abort("Error initializing board LED pins\n");
    }

    PIN_setOutputValue(ledPinHandle, Board_LED1, 1);

    /* This example has logging and many other debug capabilities enabled */
    System_printf("This example does not attempt to minimize code or data "
                  "footprint\n");
    System_flush();

    System_printf("Starting the UART Echo example\nSystem provider is set to "
                  "SysMin. Halt the target to view any SysMin contents in "
                  "ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
コード例 #21
0
ファイル: cmdInterp Ernie.c プロジェクト: erniep/Potatoes
void cmdTerp() {
	UART_Handle uart;
	UART_Params uartParams;

	UART_Params_init(&uartParams);
	uartParams.writeDataMode = UART_DATA_BINARY;
	uartParams.readDataMode = UART_DATA_BINARY;
	uartParams.readReturnMode = UART_RETURN_FULL;
	uartParams.readEcho = UART_ECHO_OFF;
	uartParams.baudRate = 9600;
	uart = UART_open(Board_UART1, &uartParams);
	globalUART = &uart;

	if (uart == NULL) {
	        System_abort("Error opening the UART");
	}

	char input[2];
	uint8_t duty;

	while(1) {
		UART_write(uart,">",1);
		UART_read(uart,input,1);
		UART_write(uart,input,1);

		cmdExecute(input,duty);
	}
}
コード例 #22
0
int main(void)
{
    Task_Params taskParams;

    /* Call board init functions */
    Board_initGeneral();
    memoryInit(spiHandle, 6250);
    // Board_initWatchdog();

    /* Construct heartBeat Task  thread */
    Task_Params_init(&taskParams);
    taskParams.arg0 = 1000000 / Clock_tickPeriod;
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);

    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, ledPinTable);
    if(!ledPinHandle) {
        System_abort("Error initializing board LED pins\n");
    }

    //IOCPortConfigureSet(PIN_SPI_MOSI, PORTID, PIN-CONFIG); // oklart om och hur denna funkar.
    //IOCPortConfigureSet(DIOn, PORTID, PIN-CONFIG);
    //PIN_setOutputValue(ledPinHandle, Board_LED1, 1);

    /* Start BIOS */
    BIOS_start();

    return (0);
}
コード例 #23
0
/*
 *  setup task function
 */
int setup_Blink_Task( UArg mbox)
{

	Task_Params taskLedParams;
	Task_Handle taskLed;
	/* Errorblock beinhält daten über grund des Fehlers bei Taskcreation
	  */
	Error_Block eb;


	
    /* Create Blink task with priority 15*/
    Error_init(&eb);
    Task_Params_init(&taskLedParams);
    taskLedParams.stackSize = 1024;/*stack in bytes*/
    taskLedParams.priority = 15;/*0-15  default 16 is highest priority -> see RTOS configuration*/
    taskLedParams.arg0 = mbox;
    taskLed = Task_create((Task_FuncPtr)BlinkFxn, &taskLedParams, &eb);
    if (taskLed == NULL) {
    	System_abort("TaskLed create failed");
    }


    return (0);
}
コード例 #24
0
ファイル: notify_f28m35x.c プロジェクト: skitlab/ti-ipc
/*
 *  ======== main ========
 *  Synchronizes all processors (in Ipc_start), calls BIOS_start, and registers 
 *  for an incoming event
 */
Int main(Int argc, Char* argv[])
{
    Int status;
    UInt numProcs = MultiProc_getNumProcessors();

    /*
     *  Determine which processors Notify will communicate with based on the
     *  local MultiProc id.  Also, create a processor-specific Task.
     */
    srcProc = ((MultiProc_self() - 1 + numProcs) % numProcs);
    dstProc = ((MultiProc_self() + 1) % numProcs);

    System_printf("main: MultiProc id = %d\n", MultiProc_self());
    System_printf("main: MultiProc name = %s\n", 
        MultiProc_getName(MultiProc_self()));
    
    /*
     *  Register call back with Notify. It will be called when the processor
     *  with id = srcProc sends event number EVENTID to this processor.
     */
    status = Notify_registerEvent(srcProc, INTERRUPT_LINE, EVENTID,
                                  (Notify_FnNotifyCbck)cbFxn, NULL);
    if (status < 0) {
        System_abort("Notify_registerEvent failed\n");
    }

    BIOS_start();
    
    return (0);
}
コード例 #25
0
/*
 *  ======== echoFxn ========
 *  Task for this function is created statically. See the project's .cfg file.
 */
Void echoFxn(UArg arg0, UArg arg1)
{
    char input;
    UART_Handle uart;
    UART_Params uartParams;
    const char echoPrompt[] = "\fEchoing characters:\r\n";

    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 9600;
    uart = UART_open(Board_UART0, &uartParams);

    if (uart == NULL) {
        System_abort("Error opening the UART");
    }

    UART_write(uart, echoPrompt, sizeof(echoPrompt));

    /* Loop forever echoing */
    while (1) {
        UART_read(uart, &input, 1);
        UART_write(uart, &input, 1);
    }
}
コード例 #26
0
/**
 * /fn SetupUartTask
 * /brief Setup UART tasks.
 *
 * Task has priority 15 and receives 1kB of stack.
 *
 * /return Always 0. In case of error the system halts.
 */
int SetupUartTask(void) {
	Task_Params taskTransferParams;
	Task_Handle taskTransfer;
	Error_Block eb;

	/* Enable and configure the peripherals used by the UART7 */
	SysCtlPeripheralEnable(GPIO_PORTC_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
	GPIOPinConfigure(GPIO_PC4_U7RX);
	GPIOPinConfigure(GPIO_PC5_U7TX);
	GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);

	/* Enable and configure the peripherals used by the UART6 */
	SysCtlPeripheralEnable(GPIO_PORTP_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
	GPIOPinConfigure(GPIO_PP0_U6RX);
	GPIOPinConfigure(GPIO_PP1_U6TX);
	GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UART_init();

	InitializeLedUserSwitch();

	Error_init(&eb);
	Task_Params_init(&taskTransferParams);
	taskTransferParams.stackSize = 1024;
	taskTransferParams.priority = 15;
	taskTransfer = Task_create((Task_FuncPtr) TransferFunction,
			&taskTransferParams, &eb);
	if (taskTransfer == NULL) {
		System_abort("UART task create failed");
	}

	return (0);
}
コード例 #27
0
Int32 fxnTest1(UInt32 size, UInt32 *data)
{
    FxnArgs *args = (FxnArgs *)((UInt32)data + sizeof(map_info_type));
    t1.buffer1 = t2.buffer1 = (int*)(args->a) ;
    t1.buffer2 = t2.buffer2 = (int*)(args->b) ; 
    t1.buffer3 = t2.buffer3 = (int*)(args->c) ;
    t1.start_indx = t2.start_indx = args->start_indx;
    t1.end_indx = t2.end_indx = args->end_indx;

    int unit_work = (t2.end_indx - t1.start_indx)/2 ;
    t1.end_indx = t1.start_indx + unit_work ;
    t2.start_indx = t2.start_indx + unit_work ;
 

    task0 = Task_create((Task_FuncPtr)common_wrapper, &taskParams0, &eb0);
    if (task0 == NULL) {
	    System_abort("Task create failed");
    }   

    task1 = Task_create((Task_FuncPtr)common_wrapper, &taskParams1, &eb1);
    if (task1 == NULL) {
      //    System_abort("Task create failed");
    }

    UInt events ;
    events = Event_pend(edgeDetectEvent, Event_Id_00 + Event_Id_01, Event_Id_NONE, BIOS_WAIT_FOREVER) ;

    Task_delete(&task0) ;
    Task_delete(&task1) ;


    Uint32 reta = 1 ;
    return reta ;
}
コード例 #28
0
Int main(Int argc, Char* argv[])
{
    Error_Block eb;
    Task_Params taskParams;


    Log_print3(Diags_ENTRY,
        "--> %s: (argc: %d, argv: 0x%x)", (IArg)FXNN, (IArg)argc, (IArg)argv);

    /* must initialize the error block before using it */
    Error_init(&eb);

    /* initialize ipc layer */
    Ipc_start();

    /* create main thread (interrupts not enabled in main on BIOS) */
    Task_Params_init(&taskParams);
    taskParams.instance->name = "AppMain_main__P";
    taskParams.arg0 = (UArg)argc;
    taskParams.arg1 = (UArg)argv;
    taskParams.stackSize = 0x4000;
    Task_create(AppMain_main__P, &taskParams, &eb);

    if (Error_check(&eb)) {
        System_abort("main() failed to create application startup thread");
    }

    /* start scheduler, this never returns */
    BIOS_start();
    
    /* should never get here */
    Log_print1(Diags_EXIT, "<-- %s: should never get here", (IArg)FXNN);
    return(0);
}
コード例 #29
0
/**
 * usage: this method sets up the events needed by the queues
 * @method setup_Events
 * @author: patrik.szabo
 * @param arg0 - not used param for the task
 * @return 0, if everything succeeded
 */
int setup_Events() {
	Error_Block eb;
	/* Default instance configuration params */

	uartReadyEvent = Event_create(NULL, &eb);
	if (uartReadyEvent == NULL) {
		System_abort("UartReadyEvent create failed");
	}

	externalModuleReadyEvent = Event_create(NULL, &eb);
	if (uartReadyEvent == NULL) {
		System_abort("ExternalModuleReadyEvent create failed");
	}

	return (0);
}
コード例 #30
0
/*
 *  ======== main ========
 *  Synchronizes all processors (in Ipc_start) and calls BIOS_start
 */
Int main(Int argc, Char* argv[])
{
    Int status;

    nextProcId = (MultiProc_self() + 1) % MultiProc_getNumProcessors();

    System_printf("main: MultiProc id = %d\n", MultiProc_self());
    System_printf("main: MultiProc name = %s\n",
                  MultiProc_getName(MultiProc_self()));

    /* Generate queue names based on own proc ID and total number of procs */
    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
    System_sprintf(nextQueueName, "%s",  MultiProc_getName(nextProcId));

    /*
     *  Ipc_start() calls Ipc_attach() to synchronize all remote processors
     *  because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
     */
    status = Ipc_start();
    if (status < 0) {
        System_abort("Ipc_start failed\n");
    }

    BIOS_start();

    return (0);
}