/*
 *  ======== taskFxn ========
 */
Void taskFxn(UArg a0, UArg a1)
{
    System_printf("enter taskFxn()\n");
	
    Task_sleep(10);
	
    System_printf("exit taskFxn()\n");
}
Esempio n. 2
0
Int IpcResource_setConstraints(IpcResource_Handle handle,
                               IpcResource_ResHandle resHandle,
                               UInt32 action,
                               Void *constraints)
{
    Char msg[MAXMSGSIZE];
    IpcResource_Ack *ack = (Void *)msg;
    IpcResource_Req *req = (Void *)msg;
    UInt16 rlen = sizeof(IpcResource_ConstraintData);
    UInt16 alen = sizeof(*ack);
    UInt16 len;
    UInt32 remote;
    Int status;

    if (!handle) {
        System_printf("IpcResource_setConstraints: Invalid paramaters\n");
        return IpcResource_E_INVALARGS;
    }

    if (rlen && !constraints) {
        System_printf("IpcResource_setConstraints: needs parameters\n");
        return IpcResource_E_INVALARGS;
    }

    req->resType = 0;
    req->reqType = action;
    req->resHandle = resHandle;

    memcpy(req->resParams, constraints, rlen);
    status = MessageQCopy_send(MultiProc_getId("HOST"), IpcResource_server,
                        handle->endPoint, req, sizeof(*req) + rlen);
    if (status) {
        System_printf("IpcResource_setConstraints: MessageQCopy_send "
                      "failed status %d\n", status);
        status = IpcResource_E_FAIL;
        goto end;
    }

    if (action == IpcResource_REQ_TYPE_REL_CONSTRAINTS)
        goto end;

    status = MessageQCopy_recv(handle->msgq, ack, &len, &remote,
                               handle->timeout);
    if (status) {
        System_printf("IpcResource_setConstraints: MessageQCopy_recv "
                      "failed status %d\n", status);
        status = (status == MessageQCopy_E_TIMEOUT) ? IpcResource_E_TIMEOUT :
                 IpcResource_E_FAIL;
        goto end;
    }

    Assert_isTrue(len == (rlen + alen), NULL);

    status = _IpcResource_translateError(ack->status);

end:
    return status;
}
Esempio n. 3
0
void initNbExec(int* nbExec, int nbDump){
    int i = 0;

    for(i=1; i<nbDump; i++){
        //*(nbExec+i) = 1;
        System_printf("%d;",i);
    }
    System_printf("\n");
}
Esempio n. 4
0
/*
 *  ======== clk1Fxn =======
 */
Void clk1Fxn(UArg arg0)
{
    UInt32 time;
    
    time = Clock_getTicks();
    System_printf("System time in clk1Fxn = %lu\n", (ULong)time);
    System_printf("Calling BIOS_exit() from clk1Fxn\n");
    BIOS_exit(0);
}       
Esempio n. 5
0
/*
 *  ======== testwolfcrypt ========
 *  Run the wolfcrypt test
 */
void testwolfcrypt(UArg arg0, UArg arg1)
{
    System_printf("Running wolfcrypt tests...\n");
    System_flush();
    wolfcrypt_test((void *)arg0);
    System_printf("Tests completed.\n");

    BIOS_exit(0);
}
void         	printMessages(int coreNum, unsigned char *ptr)
{
	int   i   ;
	System_printf("message arrived to core %d \n ",coreNum);
	for (i=0; i< NUMBER_PRINTS; i++)
	{
		System_printf("->  %x \n",*ptr++ );
	}
}
Esempio n. 7
0
IpcResource_Handle IpcResource_connect(UInt timeout)
{
    UInt16 dstProc;
    UInt16 len;
    UInt32 remote;
    IpcResource_Handle handle;
    IpcResource_Req req;
    IpcResource_Ack ack;
    Int status;

    handle = Memory_alloc(NULL, sizeof(*handle), 0, NULL);
    if (!handle) {
        System_printf("IpcResource_connect: No memory");
        return NULL;
    }

    handle->timeout = (!timeout) ? DEFAULT_TIMEOUT :
                      (timeout == IpcResource_FOREVER) ? MessageQCopy_FOREVER :
                      timeout;

    dstProc = MultiProc_getId("HOST");

    handle->msgq= MessageQCopy_create(MessageQCopy_ASSIGN_ANY,
                                      &handle->endPoint);
    req.resType = 0;
    req.reqType = IpcResource_REQ_TYPE_CONN;
    req.resHandle = 0;
    status = MessageQCopy_send(dstProc, IpcResource_server,
                      handle->endPoint, &req, sizeof(req));
    if (status) {
        System_printf("IpcResource_connect: MessageQCopy_send "
                      " failed status %d\n", status);
        goto err;
    }

    status = MessageQCopy_recv(handle->msgq, &ack, &len, &remote,
                               handle->timeout);
    if (status) {
        System_printf("IpcResource_connect: MessageQCopy_recv "
                      "failed status %d\n", status);
        goto err;
    }
    status = _IpcResource_translateError(ack.status);
    if (status) {
        System_printf("IpcResource_connect: A9 Resource Manager "
                      "failed status %d\n", status);
        goto err;
    }

    return handle;
err:
    Memory_free(NULL, handle, sizeof(*handle));
    return NULL;
}
Esempio n. 8
0
static UInt32 createService(Char * name, UInt32 * endpt)
{
    Int i;
    Int status = 0;
    struct ServiceDef *sd;
    RcmServer_Handle  rcmSrvHandle;

    for (i = 0; i < ServiceMgr_NUMSERVICETYPES; i++) {
       if (!strcmp(name, serviceDefs[i].name)) {
           sd = &serviceDefs[i];
           break;
       }
    }

    if (i >= ServiceMgr_NUMSERVICETYPES) {
       System_printf("createService: unrecognized service name: %s\n", name);
       return OMX_NOTSUPP;
    }

    /* Create the RcmServer instance. */
#if 0
    System_printf("createService: Calling RcmServer_create with name = %s\n"
                  "priority = %d\n"
                  "osPriority = %d\n"
                  "rcmServerParams.fxns.length = %d\n",
                  sd->name, sd->rcmServerParams.priority,
                  sd->rcmServerParams.osPriority,
                  sd->rcmServerParams.fxns.length);
#endif
    status = RcmServer_create(sd->name, &sd->rcmServerParams, &rcmSrvHandle);

    if (status < 0) {
        System_printf("createService: RcmServer_create() returned error %d\n",
                       status);
        return OMX_FAIL;
    }

    /* Get endpoint allowing clients to send messages to this new server: */
    *endpt = RcmServer_getLocalAddress(rcmSrvHandle);

    /* Store Server's endpoint with handle so we can cleanup on disconnect: */
    if (!storeTuple(*endpt, (UInt32)rcmSrvHandle))  {
        System_printf("createService: Limit reached on max instances!\n");
        RcmServer_delete(&rcmSrvHandle);
        return OMX_FAIL;
    }

    /* start the server */
    RcmServer_start(rcmSrvHandle);

    System_printf("createService: new OMX Service at endpoint: %d\n", *endpt);

    return OMX_SUCCESS;
}
Esempio n. 9
0
void tools_ShowVersion()
{
    System_printf("\n\n **** DSPMM VERSION INFO **** \n\nCompile DATE %s TIME %s \n", __DATE__, __TIME__);

    System_printf("\n** DSPMM VERSION INFO END ** \n");
#if 0
    System_printf("Trace Buffer PA 0x%x Trace Level %d\
                   \nTrace Usage: level:[0-4: 0-no trace, 1-err, 2-debug, 3-info, 4-CE,FC,IPC traces] \n\n",
                  MEMUTILS_getPhysicalAddr((Ptr)(TRACEBUFADDR)), dce_debug);
#endif
}
Esempio n. 10
0
/*
 *  ======== tsk0_func ========
 *  Sends an event to the remote processor then pends on a semaphore.
 *  The semaphore is posted by the callback function.
 */
Void tsk0_func(UArg arg0, UArg arg1)
{
    Int i = 1;
    Int status;
    
    if (MultiProc_self() == 0) {
        while (i <= NUMLOOPS) {
            /* Send an event to the remote processor */
            status = Notify_sendEvent(dstProc, INTERRUPT_LINE, EVENTID, i, 
                    TRUE);

            /* Continue until remote side is up */
            if (status < 0) {
                continue;
            }

            System_printf("tsk1_func: Sent request #%d to %s\n", seq,
                MultiProc_getName(dstProc));

            /* Wait to be released by the cbFxn posting the semaphore */
            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

            System_printf("tsk1_func: Received request #%d from %s\n", seq,
                MultiProc_getName(recvProcId));

            /* increment for remote iteration */
            i++;
        }
    }
    else {
        while (seq < NUMLOOPS) {
            /* wait forever on a semaphore, semaphore is posted in callback */
            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

            System_printf("tsk1_func: Received request #%d from %s\n", seq,
                MultiProc_getName(recvProcId));

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

            System_printf("tsk1_func: Sent request #%d to %s\n", seq,
                MultiProc_getName(dstProc));
        }
    }

    System_printf("Test completed\n");
    
    BIOS_exit(0);
}
/*
 *  ======== runBenchmarks ========
 *  Run the CyaSSL benchmark application
 */
void runBenchmarks(UArg arg0, UArg arg1)
{
    void *args = NULL;
    msTimer_init();

    System_printf("Running benchmarks...\n");
    System_flush();
    benchmark_test(args);
    System_printf("Benchmarks completed.\n");

    BIOS_exit(0);
}
Esempio n. 12
0
void imu_init() {
	// Initialize SPI
	System_printf("Initializing IMU\n");
	garbage = garbage; // Just avoid a warning for the never USED variable.

	imu_init_spia();
	if (imu_test()) {
		System_printf("IMU - Test successfully finished.");
	} else {
		System_printf("IMU - Test failed!");
	}
}
/* 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);
}
Esempio n. 14
0
static RPC_OMX_ERRORTYPE RPC_SKEL_GetHandle(Void *srvc, UInt32 size,
                                           UInt32 *data)
{
    char              cComponentName[128] = {0};
    OMX_HANDLETYPE    hComp;
    Char              cb_data[HDRSIZE + OMXPACKETSIZE + PAYLOAD_SIZE] =  {0};

    /*
     * Note: Currently, rpmsg_omx linux driver expects an omx_msg_hdr in front
     * of the omx_packet data, so we allow space for this:
     */
    struct omx_msg_hdr * hdr = (struct omx_msg_hdr *)cb_data;
    struct omx_packet  * packet = (struct omx_packet *)hdr->data;


    //Marshalled:[>offset(cParameterName)|>pAppData|>offset(RcmServerName)|>pid|
    //>--cComponentName--|>--CallingCorercmServerName--|
    //<hComp]

    strcpy(cComponentName, (char *)data + sizeof(map_info_type));

#if CHATTER
    System_printf("RPC_SKEL_GetHandle: Component Name received: %s\n",
                  cComponentName);
#endif

    /* Simulate sending an async OMX callback message, passing an omx_packet
     * structure.
     */
    packet->msg_id  = 99;   // Set to indicate callback instance, buffer id, etc.
    packet->fxn_idx = 5;    // Set to indicate callback fxn
    packet->data_size = PAYLOAD_SIZE;
    strcpy((char *)packet->data, CALLBACK_DATA);

#if CHATTER
    System_printf("RPC_SKEL_GetHandle: Sending callback message id: %d, "
                  "fxn_id: %d, data: %s\n",
                  packet->msg_id, packet->fxn_idx, packet->data);
#endif
    ServiceMgr_send(srvc, cb_data, CALLBACK_DATA_SIZE);

    /* Call OMX_Get_Handle() and return handle for future calls. */
    //eCompReturn = OMX_GetHandle(&hComp, (OMX_STRING)&cComponentName[0], pAppData,&rpcCallBackInfo);
    hComp = 0x5C0FFEE5;
    data[0] = hComp;

#if CHATTER
    System_printf("RPC_SKEL_GetHandle: returning hComp: 0x%x\n", hComp);
#endif

    return(0);
}
Esempio n. 15
0
/*
 *  ======== main ========
 */
Int main(Int argc, Char* argv[])
{
    UInt32 myArg1 = 12345;
    UInt32 myArg2 = 67890;
    UInt16 myProcId = MultiProc_self();
    Int status;
    
    /* Register the functions to be called */
    System_printf("Registering myFxn1 & myArg1 to event #%d..\n", EVENT);
    Notify_registerEvent(myProcId, 0, EVENT,
                         (Notify_FnNotifyCbck)myFxn1, (UArg)&myArg1);

    System_printf("Registering myFxn2 & myArg2 to event #%d..\n", EVENT);
    Notify_registerEvent(myProcId, 0, EVENT,
                         (Notify_FnNotifyCbck)myFxn2, (UArg)&myArg2);

    /* Send an event */
    System_printf("Sending event #%d (myFxn1 and myFxn2 should run)\n", EVENT);
    Notify_sendEvent(myProcId, 0, EVENT, 0xaaaaa, TRUE);

    /* Unregister one of the functions */
    System_printf("Unregistering myFxn1 + myArg1\n");
    status = Notify_unregisterEvent(myProcId, 0, EVENT,
                                    (Notify_FnNotifyCbck)myFxn1, 
                                    (UArg)&myArg1);
    if (status < 0) {
        System_abort("Listener not found! (THIS IS UNEXPECTED)\n");
    }

    /* Send an event */
    System_printf("Sending event #%d (myFxn2 should run)\n", EVENT);
    Notify_sendEvent(myProcId, 0, EVENT, 0xbbbbb, TRUE);

    /* Disable event */
    System_printf("Disabling event #%d:\n", EVENT);
    Notify_disableEvent(myProcId, 0, EVENT);

    /* Send an event (nothing should happen) */
    System_printf("Sending event #%d (nothing should happen)\n", EVENT);
    Notify_sendEvent(myProcId, 0, EVENT, 0xbbbbb, TRUE);

    /* Enable event */
    System_printf("Enabling event #%d:\n", EVENT);
    Notify_enableEvent(myProcId, 0, EVENT);

    /* Send an event */
    System_printf("Sending event #%d (myFxn2 should run)\n", EVENT);
    Notify_sendEvent(myProcId, 0, EVENT, 0xbbbbb, TRUE);
    
    System_printf("Test completed\n");
    return (0);
}
Esempio n. 16
0
void writeTime(int* dumpBuffer, int nbDump, int* nbExec) {
	int i;

	CACHE_invL2(dumpBuffer, nbDump * sizeof(int), CACHE_WAIT);

	for (i = 1; i < nbDump; i++) {
		int res;
		res = dumpBuffer[i] - dumpBuffer[i - 1];
		System_printf("%d;", res);
	}
	System_printf("\n");

}
Esempio n. 17
0
/*
 *  ======== tcpWorker ========
 *  Task to handle TCP connection. Can be multiple Tasks running
 *  this function.
 */
Void tcpWorker(UArg arg0, UArg arg1)
{
    int rc;
    int clientfd = 0;
    SSH *ssh = (SSH *)arg0;

    clientfd = SSH_get_fd(ssh);
    System_printf("tcpWorker: start clientfd = 0x%x\n", clientfd);

    /* Init structs */
    transportInit(ssh);

    /* Signal active session */
    ssh->ctx->actSe = 1;

    /* Version exchange */
    rc = transportVersion_hd(ssh);
    if (rc < 0 )
        goto ABORT;
    if (rc == 1)
        goto PROCESS;

    /* Main loop */
    for (;;) {
        /* Read plain/encrypt packet from client */
        rc = transportGetPacket(ssh);
        if (rc < 0)
            break;

PROCESS:
        rc = transportExtract(ssh);
        if (rc < 0)
            break;

        /* Process the reply packet */
        rc = transportProcessPacket(ssh);
        if (rc != 0)
            break;

        //System_flush();
    }

ABORT:
    System_printf("tcpWorker stop clientfd = 0x%x\n", clientfd);
    System_flush();

    if (ssh)
        SSH_free(ssh);
    close(clientfd);
}
Esempio n. 18
0
/*
 *  ======== Exception_internalHandler ========
 *  This function is called only if an internal exception has occurred.
 *  It checks the EFR register to determine what type of exceptions occurred.
 */
Void Exception_internalHandler(Void)
{
    extern volatile cregister unsigned IERR;
    UInt32 ierr;

    ierr = IERR;

    /* record IERR in Exc_module field */
    Exception_module->ierr = ierr;

    if (Exception_enablePrint) {
        System_printf("Internal exception: IERR=0x%x\n", Exception_module->ierr);

        if (ierr & Exception_IERRIFX) {
            System_printf("Instruction fetch exception\n");
        }
        if (ierr & Exception_IERRFPX) {
            System_printf("Fetch packet exception\n");
        }
        if (ierr & Exception_IERREPX) {
            System_printf("Execute packet exception\n");
        }
        if (ierr & Exception_IERROPX) {
            System_printf("Opcode exception\n");
        }
        if (ierr & Exception_IERRRCX) {
            System_printf("Resource conflict exception\n");
        }
        if (ierr & Exception_IERRRAX) {
            System_printf("Resource access exception\n");
        }
        if (ierr & Exception_IERRPRX) {
            System_printf("Privilege exception\n");
        }
        if (ierr & Exception_IERRLBX) {
            System_printf("Loop buffer exception\n");
        }
        if (ierr & Exception_IERRMSX) {
            System_printf("Missed stall exception\n");
        }
    }

    if (*Exception_internalHook != NULL) {
        (*Exception_internalHook)();
    }

    /* clear internal exceptions to allow them to be recognized again */
    IERR = 0;
}
Esempio n. 19
0
static Void IpcPower_suspendSwi(UArg arg0, UArg arg1)
{
#ifndef SMP
    if (MultiProc_self() == sysm3ProcId) {
#endif
        Log_print0(Diags_INFO, FXNN":Core0 Hibernation Swi");
#ifndef SMP
        PowerSuspArgs.pmMasterCore = MASTERCORE;
    }
    else if (MultiProc_self() == appm3ProcId) {
        Log_print0(Diags_INFO, FXNN":Core1 Hibernation Swi");
        PowerSuspArgs.pmMasterCore = NO_MASTERCORE;
    }
#endif
    if (refWakeLockCnt) {
        System_printf("Warning: Wake locks in use\n");
    }

    Power_suspend(&PowerSuspArgs);
#ifndef SMP
    IpcPower_sleepMode(IpcPower_SLEEP_MODE_DEEPSLEEP);
    IpcPower_setWugen();

    Log_print0(Diags_INFO, FXNN":Resume");
#endif
}
Esempio n. 20
0
File: wifi.cpp Progetto: energia/emt
/*
 *  ======== getAddrCnt ========
 */
static void getAddrCnt(char *buf, int bcnt, long *addr, int *cnt)
{
    static const char hex[] = "0123456789abcdef";
    int i = 0;

    *addr = 0;
    *cnt = 0;
    
    for (i = 0; i < bcnt;  i++) {
        unsigned char c = buf[i];
        char *cp = strchr(hex, c);
        if (cp == NULL) {
            break;
        }
        *addr = (*addr * 16) + (cp - hex);
    }
    
    i++;
    for (; i < bcnt;  i++) {
        if (buf[i] == '\n' || buf[i] == '\r') {
            break;
        }
        *cnt = (*cnt * 10) + (buf[i] - '0');
    }
    System_printf("read(0x%x, %d)\n", *addr, *cnt);
}
Esempio n. 21
0
/*
 *  ======== myFxn2 ========
 */
Void myFxn2(UInt16 procId, UInt16 lineId, UInt32 eventNo, UArg arg, 
            UInt32 payload)
{
    UInt32 *theArg = (UInt32 *)arg;
    System_printf("myFxn2: eventNo: #%d, arg: %d, payload: %x\n",
                  eventNo, *theArg, payload);
}
Esempio n. 22
0
/*
 *  ======== main ========
 */
int main(void)
{
    Task_Params taskParams;

    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initSDSPI();

    /* Construct file copy Task thread */
    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    Task_construct(&task0Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the FatSD Raw example\n");

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Esempio n. 23
0
void netOpenHook(UArg uarg0)
{
	Task_Handle taskHandle;
	Task_Params taskParams;
	Error_Block eb;

	/* Make sure Error_Block is initialized */
	Error_init(&eb);

	/*
	 *  Create the Task that farms out incoming TCP connections.
	 *  arg0 will be the port that this task listens to.
	 */
	Task_Params_init(&taskParams);
	taskParams.stackSize = UDPHANDLERSTACK;
	taskParams.priority = 1;
	taskParams.arg0 = UDPPORT;
	//mbox
	taskParams.arg1 = uarg0;
	taskHandle = Task_create((Task_FuncPtr)udpHandler, &taskParams, &eb);
	if (taskHandle == NULL) {
		System_printf("netOpenHook: Failed to create tcpHandler Task\n");
	}

	System_flush();
}
Esempio n. 24
0
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);
    }
}
Esempio n. 25
0
/*
 *  ======== 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");
        }
    }
}
Esempio n. 26
0
Void Task_PWM(UArg arg0, UArg arg1)
{
    PWM_Handle pwm[3];
    PWM_Params params;
    uint16_t   period=1500;
    uint16_t   duty[3]={0, };

    PWM_Params_init(&params);
    params.period = period; //ms
    //params.polarity = PWM_POL_ACTIVE_LOW;
    params.polarity = PWM_POL_ACTIVE_HIGH;
    //params.dutyMode = PWM_DUTY_COUNTS; 
    params.dutyMode = PWM_DUTY_SCALAR;
    //params.dutyMode = PWM_DUTY_TIME:;
    pwm[0] = PWM_open(Board_PWM0, &params);
    pwm[1] = PWM_open(EK_TM4C1294XL_Mk_PF1_M0PWM1, &params);    
    pwm[2] = PWM_open(EK_TM4C1294XL_Mk_PF2_M0PWM2, &params);   
    
    System_printf("\nTask_PWM");
    for (;;) {
        PWM_setDuty(pwm[0], duty[0]);
        PWM_setDuty(pwm[1], duty[1]);
        PWM_setDuty(pwm[2], duty[2]);
        
        duty[0]+=0xf;
        duty[1]=duty[0]+0xff;
        duty[2]=duty[1]+0xff;
        
        Task_sleep(1); //One Tick is 1ms
    }    
}
Esempio n. 27
0
/*
 *  ======== idl0Fxn ========
 */
Void idl0Fxn()
{
    if (finishFlag) {
        System_printf("Calling BIOS_exit from idl0Fxn\n");   
        BIOS_exit(0);
    }
}
void             printStartEndChar(unsigned char buffer[], int N)
{
	int  i   ;
	System_printf("Consumer ->  ");
	for (i=0; i< 2* AMOUNT ;i++)
	{
		System_printf("%x ", buffer[i]);
	}
	System_printf(" -> .. ->  ");
	for (i=N-2*AMOUNT ; i< N; i++)
	{
		System_printf("%x ", buffer[i]);
	}
	System_printf("\n") ;

}
Esempio n. 29
0
/*
 *  ======== main ========
 */
int main(void)
{
    Task_Params taskParams;

    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initI2C();
    // Board_initSDSPI();
    // Board_initSPI();
    // Board_initUART();
    // Board_initUSB(Board_USBDEVICE);
    // Board_initWatchdog();
    // Board_initWiFi();

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

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    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);
}
Esempio n. 30
0
File: main.cpp Progetto: energia/emt
/*
 *  ======== main ========
 */
int main()
{
    /* initialize all device/board specific peripherals */
    Board_init();

    Task_Params taskParams;

    System_printf("Startup\n");
    System_flush();

    /* initialize taskParams to the defaults */
    Task_Params_init(&taskParams);

    taskParams.priority = Task_numPriorities - 1;
    taskParams.stackSize = 0x800;

    /* Set the task name */
    taskParams.instance->name = (xdc_String)"hello";

    /* Create the task */
    Task_create(hello_task, &taskParams, NULL);

    /* does not return */
    BIOS_start();

    return (0); /* should never get here, but just in case ... */
}