-
Notifications
You must be signed in to change notification settings - Fork 0
/
slcr.c
40 lines (33 loc) · 904 Bytes
/
slcr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* slcr.c
*
* Created on: Mar 21, 2023
* Author: Kian
*/
#include "slcr.h"
#include "xil_printf.h"
#include <stdio.h>
void unlockSLCR(){
u32 slcrLockStatus;
printf("UNLOCKING SLCR REGS\n");
Xil_Out32(SLCR_UNLOCK, SLCR_UNLOCK_VALUE);
slcrLockStatus = Xil_In32(SLCR_LOCKSTA);
printf("LOCKSTA value is %lu\n", slcrLockStatus);
}
void lockSLCR(){
u32 slcrLockStatus;
printf("LOCKING SLCR REGS\n");
Xil_Out32(SLCR_LOCK, SLCR_LOCK_VALUE);
slcrLockStatus = Xil_In32(SLCR_LOCKSTA);
printf("LOCKSTA value is %lu\n", slcrLockStatus);
}
void lockSLCRCheck(){
u32 slcrLockStatus;
slcrLockStatus = Xil_In32(SLCR_LOCKSTA);
if(!(slcrLockStatus & 0x1)){
printf("SLCR REGS ARE WRITEABLE: LOCKSTA value is %lu\n", slcrLockStatus);
}
else{
printf("SLCR REGS ARE WRITE PROTECTED: LOCKSTA value is %lu\n", slcrLockStatus);
}
}