mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 04:06:46 +00:00 
			
		
		
		
	 7d378ed6e3
			
		
	
	
		7d378ed6e3
		
	
	
	
	
		
			
			The watchdog is part of NPCM7XX's timer module. Its behavior is controlled by the WTCR register in the timer. When enabled, the watchdog issues an interrupt signal after a pre-set amount of cycles, and issues a reset signal shortly after that. Reviewed-by: Tyrone Ting <kfting@nuvoton.com> Signed-off-by: Hao Wu <wuhaotsh@google.com> Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: deleted blank line at end of npcm_watchdog_timer-test.c] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Nuvoton NPCM7xx Clock Control Registers.
 | |
|  *
 | |
|  * Copyright 2020 Google LLC
 | |
|  *
 | |
|  * This program is free software; you can redistribute it and/or modify it
 | |
|  * under the terms of the GNU General Public License as published by the
 | |
|  * Free Software Foundation; either version 2 of the License, or
 | |
|  * (at your option) any later version.
 | |
|  *
 | |
|  * This program is distributed in the hope that it will be useful, but WITHOUT
 | |
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | |
|  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 | |
|  * for more details.
 | |
|  */
 | |
| #ifndef NPCM7XX_CLK_H
 | |
| #define NPCM7XX_CLK_H
 | |
| 
 | |
| #include "exec/memory.h"
 | |
| #include "hw/sysbus.h"
 | |
| 
 | |
| /*
 | |
|  * The reference clock frequency for the timer modules, and the SECCNT and
 | |
|  * CNTR25M registers in this module, is always 25 MHz.
 | |
|  */
 | |
| #define NPCM7XX_TIMER_REF_HZ            (25000000)
 | |
| 
 | |
| /*
 | |
|  * Number of registers in our device state structure. Don't change this without
 | |
|  * incrementing the version_id in the vmstate.
 | |
|  */
 | |
| #define NPCM7XX_CLK_NR_REGS             (0x70 / sizeof(uint32_t))
 | |
| 
 | |
| #define NPCM7XX_WATCHDOG_RESET_GPIO_IN "npcm7xx-clk-watchdog-reset-gpio-in"
 | |
| 
 | |
| typedef struct NPCM7xxCLKState {
 | |
|     SysBusDevice parent;
 | |
| 
 | |
|     MemoryRegion iomem;
 | |
| 
 | |
|     uint32_t regs[NPCM7XX_CLK_NR_REGS];
 | |
| 
 | |
|     /* Time reference for SECCNT and CNTR25M, initialized by power on reset */
 | |
|     int64_t ref_ns;
 | |
| } NPCM7xxCLKState;
 | |
| 
 | |
| #define TYPE_NPCM7XX_CLK "npcm7xx-clk"
 | |
| #define NPCM7XX_CLK(obj) OBJECT_CHECK(NPCM7xxCLKState, (obj), TYPE_NPCM7XX_CLK)
 | |
| 
 | |
| #endif /* NPCM7XX_CLK_H */
 |