Beispiel #1
0
bool stopTsPort(ts_channel_s *tsChannel) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
	if (isCommandLineConsoleOverTTL()) {
#if 0
		usb_serial_stop();
#endif
		// don't stop USB!
		return false;
	} else
#endif
	{
		if (CONFIGB(useSerialPort)) {
			// todo: disable Rx/Tx pads?
#if TS_UART_DMA_MODE
			uartStop(TS_DMA_UART_DEVICE);
#else
			sdStop(TS_SERIAL_UART_DEVICE);
#endif /* TS_UART_DMA_MODE */
		}
	}

	tsChannel->channel = (BaseChannel *) NULL;
	return true;
#else  /* EFI_PROD_CODE */
	// don't stop simulator!
	return false;
#endif /* EFI_PROD_CODE */
}
Beispiel #2
0
uint32_t dma_storm_uart_stop(void){

  uartStopSend(&UARTD6);
  uartStopReceive(&UARTD6);
  uartStop(&UARTD6);

  return its;
}
Beispiel #3
0
/**
 * Stop the system and jump to the bootloader.
 */
void flash_helper_jump_to_bootloader(void) {
	typedef void (*pFunction)(void);

	mcpwm_unlock();
	mcpwm_release_motor();
	usbDisconnectBus(&USBD1);
	usbStop(&USBD1);

	uartStop(&HW_UART_DEV);
	palSetPadMode(HW_UART_TX_PORT, HW_UART_TX_PIN, PAL_MODE_INPUT);
	palSetPadMode(HW_UART_RX_PORT, HW_UART_RX_PIN, PAL_MODE_INPUT);

	// Disable watchdog
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, DISABLE);

	chSysDisable();

	pFunction jump_to_bootloader;

	// Variable that will be loaded with the start address of the application
	vu32* jump_address;
	const vu32* bootloader_address = (vu32*)0x080E0000;

	// Get jump address from application vector table
	jump_address = (vu32*) bootloader_address[1];

	// Load this address into function pointer
	jump_to_bootloader = (pFunction) jump_address;

	// Clear pending interrupts
	SCB_ICSR = ICSR_PENDSVCLR;

	// Disable all interrupts
	for(int i = 0;i < 8;i++) {
		NVIC->ICER[i] = NVIC->IABR[i];
	}

	// Set stack pointer
	__set_MSP((u32) (bootloader_address[0]));

	// Jump to the bootloader
	jump_to_bootloader();
}