File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
targets/TARGET_Silicon_Labs/TARGET_EFM32 Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ /***************************************************************************/ /**
2
+ * @file cpu_uid_api.c
3
+ *******************************************************************************
4
+ * @section License
5
+ * <b>(C) Copyright 2017 Silicon Labs, http://www.silabs.com</b>
6
+ *******************************************************************************
7
+ *
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
11
+ * not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ *
22
+ ******************************************************************************/
23
+
24
+ #include "device.h"
25
+
26
+ #if DEVICE_CPUUID
27
+
28
+ #include "em_system.h"
29
+ #include "cpu_uid_api.h"
30
+
31
+ #define UID_LENGTH 8
32
+
33
+ int cpu_uid_get_length (void )
34
+ {
35
+ return UID_LENGTH ;
36
+ }
37
+
38
+ void cpu_uid_get_uid (uint8_t * uid )
39
+ {
40
+ int pos = 0 ;
41
+ uint64_t tempuid = SYSTEM_GetUnique ();
42
+
43
+ for (int i = (UID_LENGTH - 1 ); i >= 0 ; -- i )
44
+ {
45
+ uid [pos ] = (uint8_t )((tempuid >> (i * 8 )) & 0xFF );
46
+ ++ pos ;
47
+ }
48
+ }
49
+
50
+ #endif
You can’t perform that action at this time.
0 commit comments