예제 #1
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);
}
예제 #2
0
/*
 *  ======== main ========
 */
Int main()
{       
    Clock_Params     clkParams;
    Task_Params      tskParams;
    Mailbox_Params   mbxParams;
    Semaphore_Params semParams;
    
    /* Create a one-shot Clock Instance with timeout = 5 system time units */
    Clock_Params_init(&clkParams);
    clkParams.startFlag = TRUE;
    clk1 = Clock_create(clk0Fxn, 5, &clkParams, NULL);
    
    /* Create an one-shot Clock Instance with timeout = 10 system time units */
    Clock_Params_init(&clkParams);
    clkParams.startFlag = TRUE;
    clk2 = Clock_create(clk1Fxn, 10, &clkParams, NULL);

    /* create an Event Instance */
    evt = Event_create(NULL, NULL);
    
    /* create a Semaphore Instance */
    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    semParams.event = evt;
    semParams.eventId = Event_Id_01;
    sem = Semaphore_create(0, &semParams, NULL);

    /* create a Mailbox Instance */
    Mailbox_Params_init(&mbxParams);
    mbxParams.readerEvent = evt;
    mbxParams.readerEventId = Event_Id_02;
    mbx = Mailbox_create(sizeof(MsgObj), 2, &mbxParams, NULL);

    /* create a writer task */
    Task_Params_init(&tskParams);
    tskParams.priority = 1;
    tskParams.arg0 = (UArg) mbx;
    Task_create(writer, &tskParams, NULL);

    /* create a reader task */
    Task_create(reader, &tskParams, NULL);

    BIOS_start();    /* does not return */
    return(0);
}
예제 #3
0
MBX_Handle MBX_create(Uns size, Uns length, MBX_Attrs *attrs)
{
    Mailbox_Params params;
    Error_Block eb;

    if (attrs == NULL) {
        attrs = &MBX_ATTRS;
    }

    Mailbox_Params_init(&params);

    params.instance->name = attrs->name;
    params.heap = MEM_getHandle(attrs->segid);

    Error_init(&eb);

    return ((MBX_Handle)Mailbox_create(size, length, &params, &eb));
}
/*
 *  ======== main ========
 */
Int main(Void)
{

    Mailbox_Params mboxParams;
    /*    Task_Params grlibTaskParams;
        Task_Params consoleTaskParams;
        Task_Handle grlibTaskHandle;
        Task_Handle consoleTaskHandle;*/

    Error_Block eb;

    /* Init board-specific functions. */
    Board_initGeneral();
    Board_initGPIO();
    Board_initUART();
    Board_initUSB(Board_USBDEVICE);
    /* Turn on user LED */
//    GPIO_write(DK_TM4C123G_LED, DK_TM4C123G_LED_ON);

    add_device("UART", _MSA, UARTUtils_deviceopen,
               UARTUtils_deviceclose, UARTUtils_deviceread,
               UARTUtils_devicewrite, UARTUtils_devicelseek,
               UARTUtils_deviceunlink, UARTUtils_devicerename);

    /* Open UART0 for writing to stdout and set buffer */
    freopen("UART:0", "w", stdout);
    setvbuf(stdout, NULL, _IOLBF, 128);

    /* Open UART0 for reading from stdin and set buffer */
    freopen("UART:0", "r", stdin);
    setvbuf(stdin, NULL, _IOLBF, 128);

    /*
     *  Initialize UART port 0 used by SysCallback.  This and other SysCallback
     *  UART functions are implemented in UARTUtils.c. Calls to System_printf
     *  will go to UART0, the same as printf.
     */
    UARTUtils_systemInit(0);

    /* Init LCD and USBCDC */
    LCD_init();
//    USBCDCD_init();

    TouchScreenInit();

    TouchScreenCallbackSet(grlibTouchTaskFxn);


    Bounder_set();

    LED_OFF();
    /* Init and enable interrupts */
    GPIO_setupCallbacks(&EK_TM4C123GXL_gpioPortFCallbacks);

    GPIO_enableInt(EK_TM4C123GXL_SW1, GPIO_INT_RISING);
    GPIO_enableInt(EK_TM4C123GXL_SW2, GPIO_INT_RISING);

    /* SYS/BIOS Mailbox create */
    Error_init(&eb);
    Mailbox_Params_init(&mboxParams);
    mailboxHandle = Mailbox_create(sizeof(DrawMessage), 2, &mboxParams, &eb);
    if (mailboxHandle == NULL) {
        System_abort("Mailbox create failed\nAborting...");
    }

    /* Console task create */
    /* Error_init(&eb);
     Task_Params_init(&consoleTaskParams);
     consoleTaskParams.instance->name = "consoleTask";
     consoleTaskParams.stackSize = 1024;
     consoleTaskParams.priority = 2;
     consoleTaskHandle = Task_create(consoleTaskFxn, &consoleTaskParams, &eb);
     if (consoleTaskHandle == NULL) {
         System_abort("Console task was not created\nAborting...");
     }

      Grlib task create
     Error_init(&eb);
     Task_Params_init(&grlibTaskParams);
     grlibTaskParams.instance->name = "grlibTask";
     grlibTaskParams.stackSize = 2048;
     grlibTaskParams.priority = 1;
     grlibTaskHandle = Task_create(grlibTaskFxn, &grlibTaskParams, &eb);
     if (grlibTaskHandle == NULL) {
         System_abort("Grlib task was not created\nAborting...");
     }*/

    System_printf("Starting the example\n%s, %s",
                  "System provider is set to SysMin",
                  "halt the target and use ROV to view output.\n");

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

    USBCDCD_init();//?????? why not working
    fillBox(4);
    fillBox(4);
    output(4,Array2048);
    /* Start BIOS. Will not return from this call. */
    BIOS_start();

    return (0);
}