Example #1
0
File: main.c Project: oter/BSPTools
//*****************************************************************************
//
//! Board Initialization & Configuration
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
static void
BoardInit(void)
{
    //
    // Set vector table base
    //
#ifndef USE_TIRTOS
  //
  // Set vector table base
  //
#if defined(ccs) || defined(gcc)
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
    MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif

    //
    // Enable Processor
    //
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
Example #2
0
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;
}
Example #3
0
//*****************************************************************************
//
//! Board Initialization & Configuration
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
    //
    // Set vector table base
    //
#if defined(ccs)
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif  //ccs
#if defined(ewarm)
    MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif  //ewarm
    
#endif  //USE_TIRTOS
    
    //
    // Enable Processor
    //
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
Example #4
0
/*
 *  ======== Board_initGeneral ========
 */
void Board_initGeneral(void)
{
    /*  Reset DMA + other essential peripheral initialization
     *  ASSUMED by the simplelink and driverlib libraries
     */
    PRCMCC3200MCUInit();

    /* Configure pins as specified in the current configuration */

    /*
     * ======== Enable Peripheral Clocks ========
     * Enable all clocks (because wiring can use any pin in any mode
     * at runtime)
     */
    MAP_PRCMPeripheralClkEnable(PRCM_CAMERA, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_GSPI, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_I2S, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_SDHOST, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA1, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA2, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA3, PRCM_RUN_MODE_CLK);
}
Example #5
0
//*****************************************************************************
//! Board Initialization & Configuration
//*****************************************************************************
static void bootmgr_board_init(void) {
    // set the vector table base
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    // enable processor interrupts
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    // mandatory MCU initialization
    PRCMCC3200MCUInit();

    mperror_bootloader_check_reset_cause();

#if MICROPY_HW_ANTENNA_DIVERSITY
    // configure the antenna selection pins
    antenna_init0();
#endif

    // enable the data hashing engine
    CRYPTOHASH_Init();

    // init the system led and the system switch
    mperror_init0();

    // clear the safe boot flag, since we can't trust its content after reset
    PRCMClearSafeBootRequest();
}
Example #6
0
//*****************************************************************************
//! Board Initialization & Configuration
//*****************************************************************************
static void bootmgr_board_init(void) {
    // set the vector table base
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    // enable processor interrupts
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    // mandatory MCU initialization
    PRCMCC3200MCUInit();

    // clear all the special bits, since we can't trust their content after reset
    // except for the WDT reset one!!
    PRCMClearSpecialBit(PRCM_SAFE_BOOT_BIT);
    PRCMClearSpecialBit(PRCM_FIRST_BOOT_BIT);

    // check the reset after clearing the special bits
    mperror_bootloader_check_reset_cause();

#if MICROPY_HW_ANTENNA_DIVERSITY
    // configure the antenna selection pins
    antenna_init0();
#endif

    // enable the data hashing engine
    CRYPTOHASH_Init();

    // init the system led and the system switch
    mperror_init0();
}
Example #7
0
//****************************************************************************
//
//! \brief  This function restore the backed up data (after S3)
//!
//! \param  none
//!
//! \return none
//
//****************************************************************************
void lp3p0_restore_soc_data(void)
{       
        /* Invoking the default CC3xxx service impl. */
        cc_restore_soc_data();
		
		PRCMCC3200MCUInit();

        /* disabling all wk up srcs */
        PRCMLPDSWakeupSourceDisable(PRCM_LPDS_HOST_IRQ|PRCM_LPDS_GPIO|PRCM_LPDS_TIMER);

        //
        // Configure the pinmux settings for the peripherals exercised
        //
        PinMuxConfig();   
        
        //
        // enable peripherals
        //
        enable_peripherals();

        /* ungates the clk for the shared SPI*/
        MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK|
                                    PRCM_SLP_MODE_CLK);
        
        MAP_PRCMIntEnable(PRCM_INT_SLOW_CLK_CTR);
}
Example #8
0
static void BoardInit(void)
{

  MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

  MAP_IntMasterEnable();
  MAP_IntEnable(FAULT_SYSTICK);

  PRCMCC3200MCUInit();
}
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
}
Example #10
0
//*****************************************************************************
//
//! Board Initialization & Configuration
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
static void BoardInit(void)
{
    // Set vector table base
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    // Enable Processor
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
Example #11
0
File: cpu.c Project: attdona/RIOT
/**
 * @brief Initialize the CPU, set IRQ priorities
 */
void cpu_init(void) {

    /* initializes the Cortex-M core */
    cortexm_init();

    PRCMCC3200MCUInit();

    /* 1 priority group */
    MAP_IntPriorityGroupingSet(0);

}
Example #12
0
int main() {
#ifndef USE_TIRTOS
  MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]);
#endif
  MAP_IntEnable(FAULT_SYSTICK);
  MAP_IntMasterEnable();
  PRCMCC3200MCUInit();

  /* 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_UARTFIFOLevelSet(CONSOLE_UART, UART_FIFO_TX1_8, UART_FIFO_RX4_8);
  MAP_UARTFIFOEnable(CONSOLE_UART);

  setvbuf(stdout, NULL, _IOLBF, 0);
  setvbuf(stderr, NULL, _IOLBF, 0);
  cs_log_set_level(LL_INFO);
  cs_log_set_file(stdout);

  LOG(LL_INFO, ("Hello, world!"));

  MAP_PinTypeI2C(PIN_01, PIN_MODE_1); /* SDA */
  MAP_PinTypeI2C(PIN_02, PIN_MODE_1); /* SCL */
  I2C_IF_Open(I2C_MASTER_MODE_FST);

  /* Set up the red LED. Note that amber and green cannot be used as they share
   * pins with I2C. */
  MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
  MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
  MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
  GPIO_IF_LedConfigure(LED1);
  GPIO_IF_LedOn(MCU_RED_LED_GPIO);

  if (VStartSimpleLinkSpawnTask(8) != 0) {
    LOG(LL_ERROR, ("Failed to create SL task"));
  }

  if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
    LOG(LL_ERROR, ("Failed to create MG task"));
  }

  osi_start();

  return 0;
}
Example #13
0
void SysPlatformConfig(void)
/********************************************************************************/
{
#if defined(COMPLIER_CCS)
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#elif defined(COMPLIER_EARM)
    MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
    
    /* Enable Processor */
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
Example #14
0
static void BoardInit()
{
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();

    UDMAInit();

    MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
    MAP_PinTypeUART(PIN_55, PIN_MODE_3);
    MAP_PinTypeUART(PIN_57, PIN_MODE_3);

    InitTerm();
}
Example #15
0
//*****************************************************************************
//
//! Board Initialization & Configuration
//!
//! \param  None
//!
//! \return None
//
//*****************************************************************************
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
    //
    // Set vector table base
    //
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    //
    // Enable Processor
    //
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
Example #16
0
//*****************************************************************************
//! Board Initialization & Configuration
//*****************************************************************************
static void bootmgr_board_init(void) {
    // Set vector table base
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    // Enable Processor Interrupts
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    // Mandatory MCU Initialization
    PRCMCC3200MCUInit();

    mperror_bootloader_check_reset_cause();

    // Enable the Data Hashing Engine
    HASH_Init();

    // Init the system led and the system switch
    mperror_init0();

    // clear the safe boot flag, since we can't trust its content after reset
    PRCMClearSafeBootRequest();
}
Example #17
0
int main(void)
{
	IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
    
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA0, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
	MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);
    
	MAP_IntMasterEnable();
	PRCMCC3200MCUInit();
	MAP_SysTickIntEnable();
	MAP_SysTickPeriodSet(F_CPU / 1000);
	MAP_SysTickEnable();
    
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}
}
Example #18
0
//*****************************************************************************
//! Board Initialization & Configuration
//*****************************************************************************
static void bootmgr_board_init(void) {
    // Set vector table base
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

    // Enable Processor Interrupts
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    // Mandatory MCU Initialization
    PRCMCC3200MCUInit();

    pybwdt_check_reset_cause();

    // Enable the Data Hashing Engine
    HASH_Init();

    // Init the system led and the system switch
    mperror_init0();

    // clear the safe boot request, since we should not trust
    // the register's state after reset
    mperror_clear_safe_boot();
}
Example #19
0
int main()
{
  MAP_IntVTableBaseSet((unsigned long)vectors);
  MAP_IntMasterEnable();
  MAP_IntEnable(FAULT_SYSTICK);
  PRCMCC3200MCUInit();
#ifdef UART_LOG
  MAP_PRCMPeripheralClkEnable(PRCM_UART_TERM, PRCM_RUN_MODE_CLK);
  MAP_PinTypeUART(PIN_TERM_TX, PIN_TERM_TX_MODE);
  MAP_PinTypeUART(PIN_TERM_RX, PIN_TERM_RX_MODE);
  MAP_UARTConfigSetExpClk(UART_TERM,
                          MAP_PRCMPeripheralClockGet(PRCM_UART_TERM),
                          115200,
                          (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
#endif

  MonitorLoop();

  asm(" BKPT");
  while ( 1 );

  return 0;
}
Example #20
0
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;
}
Example #21
0
int main(void) {
  MAP_IntVTableBaseSet((unsigned long) &int_vectors[0]);
  MAP_IntMasterEnable();
  PRCMCC3200MCUInit();

/* Console UART init. */
#ifndef NO_DEBUG
  MAP_PRCMPeripheralClkEnable(DEBUG_UART_PERIPH, PRCM_RUN_MODE_CLK);
#if MIOT_DEBUG_UART == 0
  MAP_PinTypeUART(PIN_55, PIN_MODE_3); /* UART0_TX */
  MAP_PinTypeUART(PIN_57, PIN_MODE_3); /* UART0_RX */
#else
  MAP_PinTypeUART(PIN_07, PIN_MODE_5); /* UART1_TX */
  MAP_PinTypeUART(PIN_08, PIN_MODE_5); /* UART1_RX */
#endif
  MAP_UARTConfigSetExpClk(
      DEBUG_UART_BASE, MAP_PRCMPeripheralClockGet(DEBUG_UART_PERIPH),
      MIOT_DEBUG_UART_BAUD_RATE,
      (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
  MAP_UARTFIFOLevelSet(DEBUG_UART_BASE, UART_FIFO_TX1_8, UART_FIFO_RX4_8);
  MAP_UARTFIFODisable(DEBUG_UART_BASE);
#endif

  dbg_puts("\r\n\n");

  if (sl_Start(NULL, NULL, NULL) < 0) abort();
  dbg_putc('S');

  int cidx = get_active_boot_cfg_idx();
  if (cidx < 0) abort();
  dbg_putc('0' + cidx);
  struct boot_cfg cfg;
  if (read_boot_cfg(cidx, &cfg) < 0) abort();

  dbg_puts(cfg.app_image_file);
  dbg_putc('@');
  print_addr(cfg.app_load_addr);

  /*
   * Zero memory before loading.
   * This should provide proper initialisation for BSS, wherever it is.
   */
  uint32_t *pstart = (uint32_t *) 0x20000000;
  uint32_t *pend = (&_text_start - 0x100 /* our stack */);
  for (uint32_t *p = pstart; p < pend; p++) *p = 0;

  if (load_image(cfg.app_image_file, (_u8 *) cfg.app_load_addr) != 0) {
    abort();
  }

  dbg_putc('.');

  sl_Stop(0);
  print_addr(*(((uint32_t *) cfg.app_load_addr) + 1));
  dbg_puts("\r\n\n");

  MAP_IntMasterDisable();
  MAP_IntVTableBaseSet(cfg.app_load_addr);

  run(cfg.app_load_addr); /* Does not return. */

  abort();

  return 0; /* not reached */
}
Example #22
0
/*
 *  ======== Board_initGeneral ========
 */
void Board_initGeneral(void)
{
    /*  Reset DMA + other essential peripheral initialization
     *  ASSUMED by the simplelink and driverlib libraries
     */
    PRCMCC3200MCUInit();

    /* Configure pins as specified in the current configuration */

    /*
     * ======== Enable Peripheral Clocks ========
     * Enable all clocks (because wiring can use any pin for in any mode
     * at runtime)
     */
    MAP_PRCMPeripheralClkEnable(PRCM_CAMERA, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_GSPI, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_I2S, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_SDHOST, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA1, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA2, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA3, PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);


    /* ======== UART Pin Configuration ======== */

    /* Serial */

    /*
     * Configure LaunchPad P2.9 as a UART1: UART1 TX (via USB port)
     *     device pin: 55 (UART0_TX)
     *     Wiring id : 12
     */
    MAP_PinTypeUART(PIN_55, PIN_MODE_6);

    /*
     * Configure LaunchPad P3.3 as a UART1: UART1 RX (via USB port)
     *     device pin: 57 (UART0_RX)
     *     Wiring id : 23
     */
    MAP_PinTypeUART(PIN_57, PIN_MODE_6);

    /* Serial1 */

    /*
     * Configure LaunchPad P1.4 as a UART0: UART0 TX
     *     device pin: 3 (UART0_TX)
     *     Wiring id : 4
     */
    MAP_PinTypeUART(PIN_03, PIN_MODE_7);

    /*
     * Configure LaunchPad P1.3 as a UART0: UART0 RX
     *     device pin: 4 (UART0_RX)
     *     Wiring id : 3
     */
    MAP_PinTypeUART(PIN_04, PIN_MODE_7);


    /* ======== SPI Pin Configuration ======== */

    /*
     * Configure LaunchPad P1.7 as a SPI pin: SPI CLK
     *     device pin: 5 (GSPI_CLK)
     *     Wiring id : 7
     */
    MAP_PinTypeSPI(PIN_05, PIN_MODE_7);

    /*
     * Configure LaunchPad P2.6 as a SPI pin: SPI MOSI
     *     device pin: 7 (GSPI_MOSI)
     *     Wiring id : 15
     */
    MAP_PinTypeSPI(PIN_07, PIN_MODE_7);

    /*
     * Configure LaunchPad P2.7 as a SPI pin: SPI MISO
     *     device pin: 6 (GSPI_MISO)
     *     Wiring id : 14
     */
    MAP_PinTypeSPI(PIN_06, PIN_MODE_7);


    /* ======== I2C Pin Configuration ======== */

    /*
     * Configure LaunchPad P1.9 as a I2C pin: LaunchPad Sensor Data (via I2C)
     *     device pin: 1 (I2C_SCL)
     *     Wiring id : 9
     */
    MAP_PinTypeI2C(PIN_01, PIN_MODE_1);

    /*
     * Configure LaunchPad P1.10 as a I2C pin: LaunchPad Sensor Data (via I2C)
     *     device pin: 2 (I2C_SDA)
     *     Wiring id : 10
     */
    MAP_PinTypeI2C(PIN_02, PIN_MODE_1);
}
Example #23
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();

    
}