/** @file pwr_regs.h
 * Module defining Power control (PWR) registers.
 *
 * Mainly made to be used by the pwr module. It is recommanded to go through
 * the functions provided by that module instead of directly using the registers
 * defined here.
 */

#ifndef _PWR_REGS_H_
#define _PWR_REGS_H_

//--includes--------------------------------------------------------------------

#include "stdint.h"


//--type definitions------------------------------------------------------------

#define PWR_BASE_ADDRESS 0x40007000

union PWR_CR {
	struct {
		uint32_t LPDS:1;
		uint32_t PDDS:1;
		uint32_t CWUF:1;
		uint32_t CSBF:1;
		uint32_t PVDE:1;
		uint32_t PLS:3;
		uint32_t DBP:1;
		uint32_t reserved1:23;
	};
	uint32_t word;
};

union PWR_CSR  {
	struct {
		uint32_t WUF:1;
		uint32_t SBF:1;
		uint32_t PVDO:1;
		uint32_t reserved1:5;
		uint32_t EWUP:1;
		uint32_t reserved2:23;
	};
	uint32_t word;
};

struct PWR {
	union PWR_CR CR;
	union PWR_CSR CSR;
};


//--functions-------------------------------------------------------------------

#endif //_PWR_REGS_H_

