Exemple #1
0
/*!
 * \cond DOXYGEN_PRIVATE
 * \brief Initialization - called from init task, usually for io initialization.
 */
int _bsp_init(void)
{
    uint32_t result = MQX_OK;

    /** Cache settings **/
    _DCACHE_ENABLE(0);
    _ICACHE_ENABLE(0);

    /* Disable MPU if present on device. This dirty hack is done to workaround missing MPU_DRV_Disable() function in KSDK */
#ifdef MPU_INSTANCE_COUNT
    for(int i = 0; i < MPU_INSTANCE_COUNT; i++)
    {
        MPU_HAL_Disable(g_mpuBase[i]);
    }
#endif

/******************************************************************************
    Install interrupts for UART driver and setup debug console
******************************************************************************/


#if BSPCFG_ENABLE_IO_SUBSYSTEM
    _bsp_nio_stdio_install();
#else /* BSPCFG_ENABLE_IO_SUBSYSTEM */
#if  !defined(PEX_MQX_KSDK)
    dbg_uart_init();
#endif
#endif /* BSPCFG_ENABLE_IO_SUBSYSTEM */

    return result;
}
Exemple #2
0
int main (void)
{
   OSA_Init();

   /* Initialize clocks, debug console interface and configure required pins */
   hardware_init();

   /* Disable Memory Protection Unit */
   MPU_HAL_Disable(MPU);

	testPin.pinName = test_pin_name;
	testPin.config.outputLogic = 0;
	testPin.config.slewRate = kPortFastSlewRate;
	testPin.config.driveStrength = kPortHighDriveStrength;
	testPin.config.isOpenDrainEnabled = false;
	GPIO_DRV_OutputPinInit(&testPin);

	// Structure of initialize PIT channel No.0
   pit_user_config_t chn0Confg;
   chn0Confg.isInterruptEnabled = true;
   chn0Confg.periodUs = 1000000u;

   // Init pit module and enable run in debug
   PIT_DRV_Init(BOARD_PIT_INSTANCE, false);

   // Initialize PIT timer instance for channel 0 and 1
   PIT_DRV_InitChannel(BOARD_PIT_INSTANCE, 0, &chn0Confg);

   // Start channel 0
   PRINTF("\n\rStarting channel No.0 ...");
   PIT_DRV_StartTimer(BOARD_PIT_INSTANCE, 0);

//	drv_Mpu9250.Init();
	sdCard.Init(1);

   OSA_TaskCreate((task_t)MainTask,   (uint8_t*)"Main Task",    4096, NULL, 2, NULL, true, NULL);
   //OSA_TaskCreate((task_t)FnetTask,   (uint8_t*)"FNET Task",    2048, NULL, 3, NULL, true, NULL);

   OSA_Start(); // This function will not return

   while(1);

   return(0);
}