/*******************************************************************************
 * @fn          Main
 *
 * @brief       Application Main
 *
 * input parameters
 *
 * @param       None.
 *
 * output parameters
 *
 * @param       None.
 *
 * @return      None.
 */
int main()
{
#ifdef CACHE_AS_RAM
  // Invalidate cache
  VIMSModeSet( VIMS_BASE, VIMS_MODE_DISABLED );
  // Wait for disabling to be complete
  while ( VIMSModeGet( VIMS_BASE ) != VIMS_MODE_DISABLED );  
  // retain cache during standby
  Power_setConstraint(PowerCC26XX_SB_VIMS_CACHE_RETAIN);
#endif  
  
  RegisterAssertCback(AssertHandler);
  
  PIN_init(BoardGpioInitTable);
  
#ifndef POWER_SAVING
  /* Set constraints for Standby, powerdown and idle mode */
  Power_setConstraint(PowerCC26XX_SB_DISALLOW);
  Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
#endif //POWER_SAVING
  

#ifdef PRINTF_ENABLED
  // Enable System_printf(..) UART output
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.baudRate = 1000000;
    UartPrintf_init(UART_open(Board_UART, &uartParams));

    System_printf("Printf enabled\r\n");
#endif
  /* Initialize ICall module */
  ICall_init();
  
  /* Start tasks of external images - Priority 5 */
  ICall_createRemoteTasks();
  
  /* Kick off profile - Priority 3 */
  GAPRole_createTask();
  
  Keys_createTask();

  /* Kick off application - Priority 1 */
  SimpleTopology_createTask();
  

  /* enable interrupts and start SYS/BIOS */
  BIOS_start();
  
  return 0;
}
/*
 *  ======== main ========
 */
 int main(){
  PIN_init(BoardGpioInitTable);

#ifndef POWER_SAVING
    /* Set constraints for Standby, powerdown and idle mode */
    Power_setConstraint(Power_SB_DISALLOW);
    Power_setConstraint(Power_IDLE_PD_DISALLOW);
#endif // POWER_SAVING

    /* Initialize ICall module */
    ICall_init();

    /* Start tasks of external images - Priority 5 */
    ICall_createRemoteTasks();

#ifdef PRINTF_ENABLED
    // Enable System_printf(..) UART output
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.baudRate = 921600;
    UartPrintf_init(UART_open(Board_UART, &uartParams));
#endif
    /* Kick off profile - Priority 3 */
    GAPRole_createTask();
    
    Keys_createTask();
    SimpleBLEPeripheral_createTask();

#ifdef FEATURE_OAD
    {
      uint8_t counter;
      uint32_t *vectorTable =  (uint32_t*) 0x20000000;
#if defined(__IAR_SYSTEMS_ICC__)
      uint32_t *flashVectors = &__vector_table;
#elif defined(__TI_COMPILER_VERSION__)
      uint32_t *flashVectors = &ti_sysbios_family_arm_m3_Hwi_resetVectors;
#endif //Compiler.
      
      // Write image specific interrupt vectors into RAM vector table.
      for(counter = 0; counter < 15; ++counter)
      {
        *vectorTable++ = *flashVectors++;
      }
    }
#endif //FEATURE_OAD
    
    /* enable interrupts and start SYS/BIOS */
    BIOS_start();
    
    return 0;
}