/*
 * cmsis.c
 *
 *  Created on: Nov 22, 2019
 *      Author: abody
 */
#include "cmsis.h"
#include <stdlib.h>
#include <CppUTestExt/MockSupport_c.h>
#include <platform/helpers.h>

uint32_t g_effective_primask = 0;

void __disable_irq() {
	g_effective_primask = 1;
	mock_c()->actualCall(__FUNCTION__);
}

void __enable_irq() {
	g_effective_primask = 0;
	mock_c()->actualCall(__FUNCTION__);
}

uint32_t __get_PRIMASK() {
	return mock_c()->actualCall(__FUNCTION__)->
			returnUnsignedIntValueOrDefault(g_effective_primask);
}


void __set_PRIMASK(uint32_t primask) {
	g_effective_primask = primask;
	mock_c()->actualCall(__FUNCTION__)->
			withUnsignedIntParameters(TOSTR(primask), primask);
}
