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

#ifndef PLATFORM_CMSIS_H_
#define PLATFORM_CMSIS_H_
#include <stddef.h>
#include <inttypes.h>
#include <platform/mockme.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)))

void __disable_irq();
uint32_t __get_PRIMASK();
void __set_PRIMASK(uint32_t priMask);

DECLARE_MOCK(__disable_irq);
DECLARE_MOCK(__get_PRIMASK);
DECLARE_MOCK(__set_PRIMASK);

#ifdef __cplusplus
}
#endif

#endif /* PLATFORM_CMSIS_H_ */
