//**************************************************************************** // //! Main function //! //! \param none //! //! This function //! 1. Invokes the SLHost task //! 2. Invokes the HIBUDPBroadcastTask //! //! \return None. // //**************************************************************************** void main() { long lRetVal = -1; // // Initialize board confifurations // BoardInit(); // // Pinmux for UART & LED // PinMuxConfig(); #ifndef NOTERM // // Configuring UART // InitTerm(); #endif // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the HIBUDPBroadcast task // lRetVal = osi_TaskCreate(HIBUDPBroadcastTask, (const signed char *)"HIB UDP Broadcast", OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
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("QuickStart - Parse for IoT sample application\r\n"); UART_PRINT("---------------------------------------------\r\n"); UART_PRINT("\r\n"); UART_PRINT("[QuickStart] Board init\r\n"); // start the spawn task VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // initialize the I2C bus I2C_IF_Open(I2C_MASTER_MODE_FST); UART_PRINT("[QuickStart] Device : TI SimpleLink CC3200\r\n"); #ifdef USE_TIRTOS UART_PRINT("[QuickStart] Operating system : TI-RTOS\r\n"); #endif #ifdef USE_FREERTOS UART_PRINT("[QuickStart] Operating system : FreeRTOS\r\n"); #endif #ifndef SL_PLATFORM_MULTI_THREADED UART_PRINT("[QuickStart] Operating system : None\r\n"); #endif }
//**************************************************************************** // //! Main function //! //! \param none //! //! This function //! 1. Invokes the Loader Task //! //! \return None. // //**************************************************************************** void main() { BoardInit(); PinMuxConfig(); InitTerm(); DisplayBanner(APPLICATION_NAME); // Start the SimpleLink Host VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // Start the Loader task osi_TaskCreate(Loader, (const signed char*)"Loader Task", \ OSI_STACK_SIZE, NULL, 1, NULL ); // Start the task scheduler osi_start(); }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { #if defined(ewarm) IntVTableBaseSet((unsigned long)&__vector_table); #endif // // Board Initialization // MCUInit(); // // Enable the SYSTICK interrupt // IntEnable(FAULT_SYSTICK); UART_PRINT("hellow i am in\n\r"); // // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // WlanStationMode(NULL); // UART_PRINT("hellow i am in\n\r"); // Start the WlanStationMode task // osi_TaskCreate( WlanStationMode, (const signed char*)"wireless LAN in station mode", 2048, NULL, 1, NULL ); // // Start the task scheduler // osi_start(); }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { // // Board Initialization // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); #ifndef NOTERM // // Configuring UART // InitTerm(); #endif // // Display banner // DisplayBanner(APP_NAME); // // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // Start the WlanAPMode task // osi_TaskCreate( WlanAPMode, (const signed char*)"wireless LAN in AP mode", OSI_STACK_SIZE, NULL, 1, NULL ); // // Start the task scheduler // osi_start(); }
void SystemTaskCreate() { // Initializing DMA UDMAInit(); // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // Start the GetWeather task // osi_TaskCreate(SystemTaskManager, (const signed char *)"system", OSI_STACK_SIZE, NULL, 1, NULL ); }
int main() { long lRetVal = -1; // // Initialize Board configurations // BoardInit(); // // Configuring UART // #ifndef NOTERM InitTerm(); #endif //NOTERM // // Simplelinkspawntask // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Create 'CameraService' task // lRetVal = osi_TaskCreate(CameraService,(signed char *) "CameraService", OSI_STACK_SIZE, NULL, 1, NULL); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } osi_start(); return 0; }
//**************************************************************************** // //! Main function //! //! \param none //! //! This function //! 1. Invokes the SLHost task //! 2. Invokes the LPDSTCPServerTask //! //! \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 SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // Start the TCPServer task // osi_TaskCreate(TCPServerTask, (const signed char *)"DeepSleep TCP", OSI_STACK_SIZE, NULL, 1, NULL ); // // Start the task scheduler // osi_start(); }
STATIC void mptask_pre_init (void) { #if MICROPY_HW_ENABLE_RTC pybrtc_init(); #endif // Create the simple link spawn task ASSERT (OSI_OK == VStartSimpleLinkSpawnTask(SIMPLELINK_SPAWN_TASK_PRIORITY)); // Allocate memory for the flash file system ASSERT ((sflash_fatfs = mem_Malloc(sizeof(FATFS))) != NULL); // this one allocates memory for the nvic vault pybsleep_pre_init(); // this one allocates memory for the WLAN semaphore wlan_pre_init(); // this one allocates memory for the updater semaphore updater_pre_init(); // this one allocates memory for the socket semaphore modusocket_pre_init(); #if MICROPY_HW_HAS_SDCARD pybsd_init0(); #endif CRYPTOHASH_Init(); #ifdef DEBUG ASSERT (OSI_OK == osi_TaskCreate(TASK_Servers, (const signed char *)"Servers", SERVERS_STACK_SIZE, NULL, SERVERS_PRIORITY, &svTaskHandle)); #else ASSERT (OSI_OK == osi_TaskCreate(TASK_Servers, (const signed char *)"Servers", SERVERS_STACK_SIZE, NULL, SERVERS_PRIORITY, NULL)); #endif }
int main(void) { // // Board Initialization // BoardInit(); // // Enable and configure DMA // UDMAInit(); //Config pins PinMuxConfig(); InitPWMModules(); VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); osi_TaskCreate(HttpServerAppTask, "WebSocketApp", OSI_STACK_SIZE, NULL, HTTP_SERVER_APP_TASK_PRIORITY, NULL ); osi_TaskCreate(TargetTask, "Target", OSI_STACK_SIZE, NULL, TARGET_TASK_PRIORITY, NULL ); osi_start(); return 0; }
//**************************************************************************** // //! Main function //! //! \param none //! //! This function //! 1. Invokes the SLHost task //! 2. Invokes the AP Antenna Selection Task //! //! \return None. // //**************************************************************************** void main() { // // Setup the interrupt vector table // #if defined(ewarm) MAP_IntVTableBaseSet((unsigned long)&__vector_table); #endif //MCU Initialization PRCMCC3200MCUInit(); MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK); MAP_GPIODirModeSet(GPIOA3_BASE,0xC,GPIO_DIR_MODE_OUT); // // Configure PIN_29 for GPIOOutput // HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000 )); // // Set the mode. // HWREG(REG_PAD_CONFIG_26) = (((HWREG(REG_PAD_CONFIG_26) & ~PAD_MODE_MASK) | 0x00000000) & ~(3<<10)); // // Set the direction // HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~0xC00) | 0x00000800); // // Configure PIN_30 for GPIOOutput // HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000 )); // // Set the mode. // HWREG(REG_PAD_CONFIG_27) = (((HWREG(REG_PAD_CONFIG_27) & ~PAD_MODE_MASK) | 0x00000000) & ~(3<<10)); // // Set the direction // HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800); //Enable Interrupt MAP_IntMasterEnable(); MAP_IntEnable(FAULT_SYSTICK); // // Simplelinkspawntask // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); osi_TaskCreate(AntennaSelection, (signed char*)"AntennaSelection",1024, NULL, APP_TASK_PRIORITY, NULL ); osi_start(); }
int main() { long lRetVal = -1; // // Initialize Board configurations // BoardInit(); // // Pinmuxing for GPIO,UART // PinMuxConfig(); // // configure LEDs // GPIO_IF_LedConfigure(LED1|LED2|LED3); GPIO_IF_LedOff(MCU_ALL_LED_IND); #ifndef NOTERM // // Configuring UART // InitTerm(); #endif // // Display Welcome Message // DisplayBanner(APP_NAME); // Generate Menu Output for Application OutputMenu(); // Initialize AP security params SecurityParams.Key = (signed char *)SECURITY_KEY; SecurityParams.KeyLen = strlen(SECURITY_KEY); SecurityParams.Type = SECURITY_TYPE; uiUartCmd=0; // // Simplelinkspawntask // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } lRetVal = osi_MsgQCreate(&g_PBQueue,"PBQueue",sizeof(tPushButtonMsg),1); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } lRetVal = osi_TaskCreate(PushButtonHandler, \ (signed char*)"PushButtonHandler", \ OSI_STACK_SIZE , NULL, \ TASK_PRIORITY+2, &g_PushButtonTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } lRetVal = osi_TaskCreate(SimpleEmail, (signed char*)"SimpleEmail", \ OSI_STACK_SIZE, \ NULL, TASK_PRIORITY+1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } osi_start(); while(1) { } }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { /* Display banner */ Report("\r\n\r\nTexas Instruments CC3200 Application - Powered by 2lemetry's ThingFabric Cloud\r\n\r\n"); BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD); // // UART Init // InitTerm(); // // LED Init // GPIO_IF_LedConfigure(LED1); //Turn Off the LEDs GPIO_IF_LedOff(MCU_RED_LED_GPIO); // // I2C Init // I2C_IF_Open(I2C_MASTER_MODE_FST); //Init Temprature Sensor TMP006DrvOpen(); //Init Accelerometer Sensor BMA222Open(); // // Simplelinkspawntask // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // Create semaphore to indicate CC3200 connected to an access point if (osi_SyncObjCreate(&semaphore_Connected) != 0) { Report("Semaphore not created\r\n"); } // // Create OOB Task // Report("Starting OOBTask\r\n"); osi_TaskCreate(OOBTask, (signed char*)"OOBTask", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL ); // // Create mqtt Task // Report("Starting mqttTask\r\n"); osi_TaskCreate(mqttTask, (signed char*)"mqttTask", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL ); // // Start OS Scheduler // osi_start(); while (1) { } }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { long lRetVal = -1; // // Board Initialization // BoardInit(); // // configure the GPIO pins for LEDs,UART // PinMuxConfig(); // // Configure the UART // #ifndef NOTERM InitTerm(); #endif //NOTERM // // Display Application Banner // DisplayBanner(APPLICATION_NAME); // // Configure all 3 LEDs // GPIO_IF_LedConfigure(LED1|LED2|LED3); // switch off all LEDs GPIO_IF_LedOff(MCU_ALL_LED_IND); // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the WlanStationMode task // lRetVal = osi_TaskCreate( WlanStationMode, \ (const signed char*)"Wlan Station Task", \ OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { long lRetVal = -1; //Board Initialization BoardInit(); //Pin Configuration PinMuxConfig(); //Change Pin 58 Configuration from Default to Pull Down MAP_PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD); // // Initialize GREEN and ORANGE LED // GPIO_IF_LedConfigure(LED1|LED2|LED3); //Turn Off the LEDs GPIO_IF_LedOff(MCU_ALL_LED_IND); //UART Initialization MAP_PRCMPeripheralReset(PRCM_UARTA0); MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH), UART_BAUD_RATE,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); //Display Application Banner on UART Terminal DisplayBanner(APPLICATION_NAME); // // Simplelinkspawntask // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { UART_PRINT("Unable to start simpelink spawn task\n\r"); LOOP_FOREVER(); } // // Create HTTP Server Task // lRetVal = osi_TaskCreate(HTTPServerTask, (signed char*)"HTTPServerTask", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL ); if(lRetVal < 0) { UART_PRINT("Unable to create task\n\r"); LOOP_FOREVER(); } // // Start OS Scheduler // osi_start(); while (1) { } }
//****************************************************************************** // MAIN FUNCTION //****************************************************************************** int main() { long lRetVal = -1; BoardInit(); // // Pinmux Configuration // PinMuxConfig(); // // Initialising the UART terminal // InitTerm(); // // Create RX and TX Buffer // pTxBuffer = CreateCircularBuffer(TX_BUFFER_SIZE); if(pTxBuffer == NULL) { UART_PRINT("Unable to Allocate Memory for Tx Buffer\n\r"); LOOP_FOREVER(); } pRxBuffer = CreateCircularBuffer(RX_BUFFER_SIZE); if(pRxBuffer == NULL) { UART_PRINT("Unable to Allocate Memory for Rx Buffer\n\r"); LOOP_FOREVER(); } // // Initialising the I2C Interface // lRetVal = I2C_IF_Open(1); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Configure Audio Codec // ConfigureAudioCodec(CODEC_I2S_WORD_LEN_24); GPIO_IF_LedConfigure(LED2|LED3); GPIO_IF_LedOff(MCU_RED_LED_GPIO); GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); // // Configure PIN_01 for GPIOOutput // MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false); MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT); // // Configure PIN_02 for GPIOOutput // MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false); MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT); //Turning off Green,Orange LED after i2c writes completed - First Time GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO); // // Initialize the Audio(I2S) Module // AudioCapturerInit(); // // Initialize the DMA Module // UDMAInit(); UDMAChannelSelect(UDMA_CH4_I2S_RX, NULL); UDMAChannelSelect(UDMA_CH5_I2S_TX, NULL); // // Setup the DMA Mode // SetupPingPongDMATransferTx(); SetupPingPongDMATransferRx(); // // Setup the Audio In/Out // lRetVal = AudioCapturerSetupDMAMode(DMAPingPongCompleteAppCB_opt, \ CB_EVENT_CONFIG_SZ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } AudioCaptureRendererConfigure(); // // Start Audio Tx/Rx // Audio_Start(); // // Start the simplelink thread // lRetVal = VStartSimpleLinkSpawnTask(9); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Network Task // lRetVal = osi_TaskCreate( Network, (signed char*)"NetworkTask",\ OSI_STACK_SIZE, NULL, 1, &g_NetworkTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Control Task // lRetVal = ControlTaskCreate(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Microphone Task // lRetVal = osi_TaskCreate( Microphone,(signed char*)"MicroPhone", \ OSI_STACK_SIZE, NULL, 1, &g_MicTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Speaker Task // lRetVal = osi_TaskCreate( Speaker, (signed char*)"Speaker",OSI_STACK_SIZE, \ NULL, 1, &g_SpeakerTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { #if defined(ewarm) IntVTableBaseSet((unsigned long)&__vector_table); #endif // // Board Initialization // MCUInit(); // // Enable the SYSTICK interrupt // IntEnable(FAULT_SYSTICK); sysTickInit(); // // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // WlanStationMode(NULL); // UART_PRINT("hellow i am in\n\r"); // Start the WlanStationMode task // if(OSI_OK !=osi_TaskCreate( WlanStationMode, (const signed char*)"WlanStationMode task", 2048, NULL, 3, NULL )) UART_PRINT("WlanStationMode failed\n\r"); if(OSI_OK != osi_TaskCreate( taskServer, (const signed char*)"taskServer", 2048, NULL, 2, (OsiTaskHandle)&ServerTaskHandle ) ) UART_PRINT("taskServer failed\n\r"); if(OSI_OK != osi_TaskCreate( taskClient, (const signed char*)"taskClient", 2048, NULL, 1, (OsiTaskHandle)&clientTaskHandle )) UART_PRINT("taskClient failed\n\r"); /* if(OSI_OK != osi_TaskCreate( taskTest1, (const signed char*)"taskTest1", 2048, NULL, 1, NULL )) UART_PRINT("taskTest1 failed\n\r"); if(OSI_OK != osi_TaskCreate( taskTest2, (const signed char*)"taskTest2", 2048, NULL, 1, NULL )) UART_PRINT("taskTest1 failed\n\r"); */ // // Start the task scheduler // //osi_start(); vTaskStartScheduler(); }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { long lRetVal = -1; // // Board Initilization // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD); // Initialize Global Variables InitializeAppVariables(); // // UART Init // InitTerm(); DisplayBanner(APP_NAME); // // LED Init // GPIO_IF_LedConfigure(LED1); //Turn Off the LEDs GPIO_IF_LedOff(MCU_RED_LED_GPIO); // // I2C Init // lRetVal = I2C_IF_Open(I2C_MASTER_MODE_FST); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } //Init Temprature Sensor lRetVal = TMP006DrvOpen(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } //Init Accelerometer Sensor lRetVal = BMA222Open(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Simplelinkspawntask // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Create OOB Task // lRetVal = osi_TaskCreate(OOBTask, (signed char*)"OOBTask", \ OSI_STACK_SIZE, NULL, \ OOB_TASK_PRIORITY, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start OS Scheduler // osi_start(); while (1) { } }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { long lRetVal = -1; // // Board Initialization // BoardInit(); // // configure the GPIO pins for LEDs,UART // PinMuxConfig(); // // Configure the UART // #ifndef NOTERM InitTerm(); #endif //NOTERM // // Display Application Banner // DisplayBanner(APPLICATION_NAME); // // Configure all 3 LEDs // GPIO_IF_LedConfigure(LED1|LED2|LED3); // switch off all LEDs GPIO_IF_LedOff(MCU_ALL_LED_IND); // // SysTick Enabling // //SysTickIntRegister(SysTickHandler); ///SysTickPeriodSet(SYSTICK_RELOAD_VALUE); //SysTickEnable(); // // Base address for first timer // g_ulBase = TIMERA0_BASE; // // Configuring the timers // Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0); // // Setup the interrupts for the timer timeouts. // Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler); // // Turn on the timers feeding values in mSec // Timer_IF_Start(g_ulBase, TIMER_A, 1000); // // Start the SimpleLink Host // lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the WlanStationMode task // lRetVal = osi_TaskCreate( WlanStationMode, \ (const signed char*)"Wlan Station Task", \ OSI_STACK_SIZE, NULL, 1, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main(void) { int iRetVal; // // Board Initialization // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); // // Initialize the platform // platform_init(); // // Configuring UART // g_tUartHndl = uart_open(PRCM_UARTA0); #ifdef DEBUG_GPIO // // setting up GPIO for indicating the entry into LPDS // tGPIODbgHndl = cc_gpio_open(GPIO_09, GPIO_DIR_OUTPUT); cc_gpio_write(tGPIODbgHndl, GPIO_09, 1); #endif // // Start the SimpleLink Host // iRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(iRetVal < 0) { UART_PRINT("could not create simplelink task\n\r"); LOOP_FOREVER(); } // // sync object for inter thread communication // iRetVal = osi_MsgQCreate(&g_tConnectionFlag, NULL, sizeof( unsigned char ), 1); if(iRetVal < 0) { UART_PRINT("could not create msg queue\n\r"); LOOP_FOREVER(); } // // Task creation for providing host_irq as a wake up source(LPDS) // iRetVal = osi_TaskCreate(UDPServerTask, (const signed char *)"UDP Server waiting to recv"\ "packets", OSI_STACK_SIZE, NULL, 1, NULL ); if(iRetVal < 0) { UART_PRINT("First Task creation failed\n\r"); LOOP_FOREVER(); } // // setting up timer and gpio as source for wake up from lPDS // iRetVal = osi_TaskCreate(TimerGPIOTask, (const signed char*)"Configuring Timer and GPIO as"\ " wake src", OSI_STACK_SIZE, NULL, 1, NULL ); if(iRetVal < 0) { UART_PRINT("Second Task creation failed\n\r"); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }
static void uart_int() { int c = UARTCharGet(CONSOLE_UART); struct prompt_event pe = {.type = PROMPT_CHAR_EVENT, .data = (void *) c}; osi_MsgQWrite(&s_v7_q, &pe, OSI_NO_WAIT); MAP_UARTIntClear(CONSOLE_UART, UART_INT_RX); } void sj_prompt_init_hal(struct v7 *v7) { (void) v7; } static void v7_task(void *arg) { struct v7 *v7 = s_v7; printf("\n\nSmart.JS for CC3200\n"); osi_MsgQCreate(&s_v7_q, "V7", sizeof(struct prompt_event), 32 /* len */); osi_InterruptRegister(CONSOLE_UART_INT, uart_int, INT_PRIORITY_LVL_1); MAP_UARTIntEnable(CONSOLE_UART, UART_INT_RX); sl_Start(NULL, NULL, NULL); v7 = s_v7 = init_v7(&v7); sj_init_timers(v7); sj_init_v7_ext(v7); init_wifi(v7); if (init_fs(v7) != 0) { fprintf(stderr, "FS initialization failed.\n"); } mongoose_init(); sj_init_http(v7); init_i2cjs(v7); /* Common config infrastructure. Mongoose & v7 must be initialized. */ init_device(v7); v7_val_t res; if (v7_exec_file(v7, "sys_init.js", &res) != V7_OK) { fprintf(stderr, "Error: "); v7_fprint(stderr, v7, res); } sj_prompt_init(v7); while (1) { struct prompt_event pe; mongoose_poll(MONGOOSE_POLL_LENGTH_MS); if (osi_MsgQRead(&s_v7_q, &pe, V7_POLL_LENGTH_MS) != OSI_OK) continue; switch (pe.type) { case PROMPT_CHAR_EVENT: { sj_prompt_process_char((char) ((int) pe.data)); break; } case V7_INVOKE_EVENT: { struct v7_invoke_event_data *ied = (struct v7_invoke_event_data *) pe.data; _sj_invoke_cb(v7, ied->func, ied->this_obj, ied->args); v7_disown(v7, &ied->args); v7_disown(v7, &ied->this_obj); v7_disown(v7, &ied->func); free(ied); break; } } } } /* Int vector table, defined in startup_gcc.c */ extern void (*const g_pfnVectors[])(void); void device_reboot(void) { sj_system_restart(); } int main() { MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]); MAP_IntEnable(FAULT_SYSTICK); MAP_IntMasterEnable(); PRCMCC3200MCUInit(); cc3200_leds_init(); /* Console UART init. */ MAP_PRCMPeripheralClkEnable(CONSOLE_UART_PERIPH, PRCM_RUN_MODE_CLK); MAP_PinTypeUART(PIN_55, PIN_MODE_3); /* PIN_55 -> UART0_TX */ MAP_PinTypeUART(PIN_57, PIN_MODE_3); /* PIN_57 -> UART0_RX */ MAP_UARTConfigSetExpClk( CONSOLE_UART, MAP_PRCMPeripheralClockGet(CONSOLE_UART_PERIPH), CONSOLE_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); MAP_UARTFIFODisable(CONSOLE_UART); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); VStartSimpleLinkSpawnTask(8); osi_TaskCreate(v7_task, (const signed char *) "v7", V7_STACK_SIZE + 256, NULL, 3, NULL); osi_TaskCreate(blinkenlights_task, (const signed char *) "blink", 256, NULL, 9, NULL); osi_start(); return 0; }
//**************************************************************************** // MAIN FUNCTION //**************************************************************************** void main() { // // Board Initialization // BoardInit(); // // Enable and configure DMA // UDMAInit(); // // Pinmux for UART // PinMuxConfig(); PinMuxConfig1(); GPIO_IF_GetPortNPin(GPIO_PWREN, &g_uiGPIO_PWREN_Port, &g_ucGPIO_PWREN_Pin); GPIO_IF_Set(GPIO_PWREN, g_uiGPIO_PWREN_Port, g_ucGPIO_PWREN_Pin, 1); GPIO_IF_GetPortNPin(GPIO_STDBY, &g_uiGPIO_STDBY_Port, &g_ucGPIO_STDBY_Pin); GPIO_IF_Set(GPIO_STDBY, g_uiGPIO_STDBY_Port, g_ucGPIO_STDBY_Pin, 0); #ifndef NOTERM // // Configuring UART // InitTerm(); // // Display Application Banner // DisplayBanner(APP_NAME); #endif // // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // Start the HttpServer Task // // osi_TaskCreate(HttpServerAppTask, "WebSocketApp", OSI_STACK_SIZE, NULL, HTTP_SERVER_APP_TASK_PRIORITY, NULL ); UART_PRINT("HttpServerApp Initialized \n\r"); // // Start the task scheduler // osi_start(); return; }
//****************************************************************************** // MAIN FUNCTION //****************************************************************************** int main() { long lRetVal = -1; unsigned char RecordPlay; BoardInit(); // // Pinmux Configuration // PinMuxConfig(); // // Initialising the UART terminal // InitTerm(); // // Initialising the I2C Interface // lRetVal = I2C_IF_Open(1); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } RecordPlay = I2S_MODE_RX_TX; g_loopback = 1; // // Create RX and TX Buffer // if(RecordPlay == I2S_MODE_RX_TX) { pRecordBuffer = CreateCircularBuffer(RECORD_BUFFER_SIZE); if(pRecordBuffer == NULL) { UART_PRINT("Unable to Allocate Memory for Tx Buffer\n\r"); LOOP_FOREVER(); } } /* Play */ if(RecordPlay & I2S_MODE_TX) { pPlayBuffer = CreateCircularBuffer(PLAY_BUFFER_SIZE); if(pPlayBuffer == NULL) { UART_PRINT("Unable to Allocate Memory for Rx Buffer\n\r"); LOOP_FOREVER(); } } // // Configure Audio Codec // AudioCodecReset(AUDIO_CODEC_TI_3254, NULL); AudioCodecConfig(AUDIO_CODEC_TI_3254, AUDIO_CODEC_16_BIT, 16000, AUDIO_CODEC_STEREO, AUDIO_CODEC_SPEAKER_ALL, AUDIO_CODEC_MIC_ALL); AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_ALL, 50); AudioCodecMicVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_ALL, 50); GPIO_IF_LedConfigure(LED2|LED3); GPIO_IF_LedOff(MCU_RED_LED_GPIO); GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); // // Configure PIN_01 for GPIOOutput // //MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false); // MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT); // // Configure PIN_02 for GPIOOutput // //MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false); // MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT); //Turning off Green,Orange LED after i2c writes completed - First Time GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); GPIO_IF_LedOff(MCU_ORANGE_LED_GPIO); // // Initialize the Audio(I2S) Module // AudioInit(); // // Initialize the DMA Module // UDMAInit(); if(RecordPlay & I2S_MODE_TX) { UDMAChannelSelect(UDMA_CH5_I2S_TX, NULL); SetupPingPongDMATransferRx(pPlayBuffer); } if(RecordPlay == I2S_MODE_RX_TX) { UDMAChannelSelect(UDMA_CH4_I2S_RX, NULL); SetupPingPongDMATransferTx(pRecordBuffer); } // // Setup the Audio In/Out // lRetVal = AudioSetupDMAMode(DMAPingPongCompleteAppCB_opt, \ CB_EVENT_CONFIG_SZ, RecordPlay); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } AudioCaptureRendererConfigure(AUDIO_CODEC_16_BIT, 16000, AUDIO_CODEC_STEREO, RecordPlay, 1); // // Start Audio Tx/Rx // Audio_Start(RecordPlay); // // Start the simplelink thread // lRetVal = VStartSimpleLinkSpawnTask(9); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Network Task // lRetVal = osi_TaskCreate( Network, (signed char*)"NetworkTask",\ OSI_STACK_SIZE, NULL, 1, &g_NetworkTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Control Task // lRetVal = ControlTaskCreate(); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Microphone Task // lRetVal = osi_TaskCreate( Microphone,(signed char*)"MicroPhone", \ OSI_STACK_SIZE, NULL, 1, &g_MicTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the Speaker Task // lRetVal = osi_TaskCreate( Speaker, (signed char*)"Speaker",OSI_STACK_SIZE, \ NULL, 1, &g_SpeakerTask ); if(lRetVal < 0) { ERR_PRINT(lRetVal); LOOP_FOREVER(); } // // Start the task scheduler // osi_start(); }