//**************************************************************************** //! Main function //! //! \param none //! //! \return None. // //**************************************************************************** void main() { // Initialize the board BoardInit(); // Configure the pinmux settings for the peripherals exercised PinMuxConfig(); #ifndef NOTERM // Configuring UART InitTerm(); ClearTerm(); #endif // Start the TCPServer task long lRetVal = osi_TaskCreate(InfiniteLoopTask, (const signed char *)"Infinite Loop Task", OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); while(1); } // Start the task scheduler osi_start(); TimerDeinitStop(); }
void initBoard() { #ifndef USE_TIRTOS #if defined(ccs) || defined(gcc) MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]); #endif #if defined(ewarm) MAP_IntVTableBaseSet((unsigned long)&__vector_table); #endif #endif MAP_IntMasterEnable(); MAP_IntEnable(FAULT_SYSTICK); PRCMCC3200MCUInit(); PinMuxConfig(); GPIO_IF_LedConfigure(LED1); GPIO_IF_LedOff(MCU_RED_LED_GPIO); InitTerm(); ClearTerm(); UART_PRINT("Blink - Parse for IoT sample application\r\n"); UART_PRINT("----------------------------------------\r\n"); UART_PRINT("\r\n"); UART_PRINT("[Blink] Board init\r\n"); // start the spawn task short status = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if (status < 0) { UART_PRINT("[Blink] Spawn task failed\r\n"); ERR_PRINT(status); LOOP_FOREVER(); } // initialize the I2C bus status = I2C_IF_Open(I2C_MASTER_MODE_FST); if (status < 0) { UART_PRINT("[Blink] I2C opening error\r\n"); ERR_PRINT(status); LOOP_FOREVER(); } UART_PRINT("[Blink] Device : TI SimpleLink CC3200\r\n"); #ifdef USE_TIRTOS UART_PRINT("[Blink] Operating system : TI-RTOS\r\n"); #endif #ifdef USE_FREERTOS UART_PRINT("[Blink] Operating system : FreeRTOS\r\n"); #endif #ifndef SL_PLATFORM_MULTI_THREADED UART_PRINT("[Blink] Operating system : None\r\n"); #endif }
//**************************************************************************** // //! Main function //! //! \param none //! //! This function //! 1. Invokes the SLHost task //! 2. Invokes the LPDSTCPServerTask //! //! \return None. // //**************************************************************************** void main() { long lRetVal = -1; // // Initialize the board // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); #ifndef NOTERM // // Configuring UART // InitTerm(); ClearTerm(); #endif // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the TCPServer task // lRetVal = osi_TaskCreate(TCPServerTask, (const signed char *)"DeepSleep TCP", OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
void platform_init(void) { long lRetVal; // // Board Initialization // BoardInit(); // // configure the GPIO pins for LEDs,UART // PinMuxConfig(); // // Configure the UART // #ifndef NOTERM InitTerm(); ClearTerm(); #endif //NOTERM my_logger_init(logger_writer); // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); ASSERT(lRetVal >= 0); // // Start the IoTKit runloop task // lRetVal = osi_TaskCreate(application_main, (const signed char*)"appmain", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL); ASSERT(lRetVal >= 0); UDMAInit(); _platform_spi_init(); // // Start the task scheduler // osi_start(); }
void UartTask(void *pvParameters) { //OsiReturnVal_e eRetVal; char * pcMsg; InitTerm(); ClearTerm(); /*eRetVal = */osi_MsgQCreate(&g_sUartQuee, "Uart Channel", sizeof(unsigned long), 10); //if(eRetVal != OSI_OK) //Report("ERROR: Failed to init Uart Quee, error code %d.\n\r", eRetVal); Message("Uart Channel Initialized.\n\r Waiting for messages.\n\r"); while (1) { osi_MsgQRead(&g_sUartQuee, &pcMsg, OSI_WAIT_FOREVER); Message(pcMsg); } }
//***************************************************************************** // //! Main function handling the UART and DMA configuration. It takes 8 //! characters from terminal without displaying them. The string of 8 //! caracters will be printed on the terminal as soon as 8th character is //! typed in. //! //! \param None //! //! \return None //! //***************************************************************************** void main() { // // Initailizing the board // BoardInit(); // // Initialize the RX done flash // bRxDone = false; // // Initialize uDMA // UDMAInit(); // // Muxing for Enabling UART_TX and UART_RX. // PinMuxConfig(); // // Register interrupt handler for UART // MAP_UARTIntRegister(UARTA0_BASE,UARTIntHandler); // // Enable DMA done interrupts for uart // MAP_UARTIntEnable(UARTA0_BASE,UART_INT_DMARX); // // Initialising the Terminal. // MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH), UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Clear terminal // ClearTerm(); // // Display Banner // DisplayBanner(APP_NAME); Message("\t\t****************************************************\n\r"); Message("\t\t Type in a string of 8 characters, the characters \n\r"); Message("\t\t will not be displayed on the terminal until \n\r"); Message("\t\t 8th character is entered.\n\r") ; Message("\t\t****************************************************\n\r"); Message("\n\n\n\r"); // // Set the message // Message("Type in 8 characters:"); // // Configure the UART Tx and Rx FIFO level to 1/8 i.e 2 characters // UARTFIFOLevelSet(UARTA0_BASE,UART_FIFO_TX1_8,UART_FIFO_RX1_8); // // Setup DMA transfer for UART A0 // UDMASetupTransfer(UDMA_CH8_UARTA0_RX, UDMA_MODE_BASIC, 8, UDMA_SIZE_8, UDMA_ARB_2, (void *)(UARTA0_BASE+UART_O_DR), UDMA_SRC_INC_NONE, (void *)ucTextBuff, UDMA_DST_INC_8); // // Enable Rx DMA request from UART // MAP_UARTDMAEnable(UARTA0_BASE,UART_DMA_RX); // // Wait for RX to complete // while(!bRxDone) { } // // Setup DMA transfer for UART A0 // UDMASetupTransfer(UDMA_CH9_UARTA0_TX, UDMA_MODE_BASIC, 8, UDMA_SIZE_8, UDMA_ARB_2, (void *)ucTextBuff, UDMA_SRC_INC_8, (void *)(UARTA0_BASE+UART_O_DR), UDMA_DST_INC_NONE); // // Enable TX DMA request // MAP_UARTDMAEnable(UARTA0_BASE,UART_DMA_TX); while(1) { // // Inifite loop // } }
//**************************************************************************** // //! Main function //! //! \param none //! //! //! \return None. // //**************************************************************************** void main() { FIL fp; FATFS fs; FRESULT res; DIR dir; UINT Size; // // Initialize Board configurations // BoardInit(); // // Muxing for Enabling UART_TX and UART_RX. // PinMuxConfig(); // // Set the SD card clock as output pin // MAP_PinDirModeSet(PIN_07,PIN_DIR_MODE_OUT); // // Enable Pull up on data // MAP_PinConfigSet(PIN_06,PIN_STRENGTH_4MA, PIN_TYPE_STD_PU); // // Enable Pull up on CMD // MAP_PinConfigSet(PIN_08,PIN_STRENGTH_4MA, PIN_TYPE_STD_PU); // // Initialising the Terminal. // InitTerm(); // // Clearing the Terminal. // ClearTerm(); // // Display the Banner // Message("\n\n\n\r"); Message("\t\t ********************************************\n\r"); Message("\t\t CC3200 SDHost Fatfs Demo Application \n\r"); Message("\t\t ********************************************\n\r"); Message("\n\n\n\r"); // // Enable MMCHS // MAP_PRCMPeripheralClkEnable(PRCM_SDHOST,PRCM_RUN_MODE_CLK); // // Reset MMCHS // MAP_PRCMPeripheralReset(PRCM_SDHOST); // // Configure MMCHS // MAP_SDHostInit(SDHOST_BASE); // // Configure card clock // MAP_SDHostSetExpClk(SDHOST_BASE, MAP_PRCMPeripheralClockGet(PRCM_SDHOST),15000000); f_mount(&fs,"0",1); res = f_opendir(&dir,"/"); if( res == FR_OK) { Message("Opening root directory.................... [ok]\n\n\r"); Message("/\n\r"); ListDirectory(&dir); } else { Message("Opening root directory.................... [Failed]\n\n\r"); } Message("\n\rReading user file...\n\r"); res = f_open(&fp,USERFILE,FA_READ); if(res == FR_OK) { f_read(&fp,pBuffer,100,&Size); Report("Read : %d Bytes\n\n\r",Size); Report("%s",pBuffer); f_close(&fp); } else { Report("Failed to open %s\n\r",USERFILE); } Message("\n\n\rWriting system file...\n\r"); res = f_open(&fp,SYSFILE,FA_CREATE_ALWAYS|FA_WRITE); if(res == FR_OK) { f_write(&fp,SYSTEXT,sizeof(SYSTEXT),&Size); Report("Wrote : %d Bytes",Size); res = f_close(&fp); } else { Message("Failed to create a new file\n\r"); } while(1) { } }