FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
driver_cpuctrl.c
Go to the documentation of this file.
1
22
23// Framework Includes
24#include <driver_ccp_asm.h>
25#include <driver_cpuctrl.h>
26
27// Device-specific Includes
28#include <xc.h>
29
30void CPUCTRL_WriteSplim(uint16_t value)
31{
32 CPU_SPLIM = value;
33}
34
35void CPUCTRL_SetControlA(uint8_t bitmask)
36{
37 const uint8_t currentValue = CPU_CTRLA;
38 const uint8_t updatedValue = currentValue | bitmask;
39 ASM_WriteCcp8(&CPU_CTRLA, updatedValue);
40}
41
42void CPUCTRL_ClearControlA(uint8_t bitmask)
43{
44 const uint8_t currentValue = CPU_CTRLA;
45 const uint8_t updatedValue = currentValue & (uint8_t)(~bitmask);
46 ASM_WriteCcp8(&CPU_CTRLA, updatedValue);
47}
48
50{
51 return CPU_INTFLAGS;
52}
53
54void CPUCTRL_WriteIntFlags(uint8_t value)
55{
56 ASM_WriteCcp8(&CPU_INTFLAGS, value);
57}
58
60{
61 return CPU_SREG;
62}
63
64void CPUCTRL_SetStatusRegister(uint8_t bitmask)
65{
66 CPU_SREG |= bitmask;
67}
68
69void CPUCTRL_ClearStatusRegister(uint8_t bitmask)
70{
71 CPU_SREG &= (uint8_t)(~bitmask);
72}
void ASM_WriteCcp8(register8_t *regAddr, uint8_t value)
Writes value to a Configuration Change Protected (CCP) 8-bit register.
void CPUCTRL_WriteSplim(uint16_t value)
Overwrites the SPLIM register value.
void CPUCTRL_ClearControlA(uint8_t bitmask)
Clears specific bits in the CTRLA register.
uint8_t CPUCTRL_ReadStatusRegister(void)
Reads the SREG register value.
void CPUCTRL_ClearStatusRegister(uint8_t bitmask)
Clears specific bits in the SREG register.
void CPUCTRL_SetControlA(uint8_t bitmask)
Sets specific bits in the CTRLA register.
void CPUCTRL_SetStatusRegister(uint8_t bitmask)
Sets specific bits in the SREG register.
uint8_t CPUCTRL_ReadIntFlags(void)
Reads the INTFLAGS register value.
void CPUCTRL_WriteIntFlags(uint8_t value)
Overwrites the INTFLAGS register value.