/*
 * cmsis.h
 *
 *  Created on: Nov 22, 2019
 *      Author: abody
 */

#ifndef PLATFORM_CMSIS_H_
#define PLATFORM_CMSIS_H_
#include <stddef.h>
#include <inttypes.h>

#ifdef __cplusplus
extern "C" {
#endif

#define __IO volatile
#define SET_BIT(REG, BIT)     ((REG) |= (BIT))
#define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
#define READ_BIT(REG, BIT)    ((REG) & (BIT))
#define CLEAR_REG(REG)        ((REG) = (0x0))
#define WRITE_REG(REG, VAL)   ((REG) = (VAL))
#define READ_REG(REG)         ((REG))
#define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))

extern uint32_t g_effective_primask;
void __disable_irq();
void __enable_irq();
uint32_t __get_PRIMASK();
void __set_PRIMASK(uint32_t priMask);

#ifdef __cplusplus
}
#endif

#endif /* PLATFORM_CMSIS_H_ */
