pv_imxrt1050.c
Go to the documentation of this file.
1 /*
2  Copyright 2020-2021 Picovoice Inc.
3 
4  You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5  file accompanying this source.
6 
7  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9  specific language governing permissions and limitations under the License.
10 */
11 
12 #include <stdbool.h>
13 #include <string.h>
14 
15 #include "MIMXRT1052.h"
16 
17 #include "board.h"
18 #include "clock_config.h"
19 #include "fsl_debug_console.h"
20 #include "fsl_ocotp.h"
21 #include "peripherals.h"
22 #include "pin_mux.h"
23 
24 #include "pv_imxrt1050.h"
25 
26 #define PV_OCOTP_FREQ_HZ (CLOCK_GetFreq(kCLOCK_IpgClk))
27 #define UUID_SIZE (8)
28 
29 static uint8_t uuid[UUID_SIZE];
30 
31 const uint8_t *pv_get_uuid(void) {
32  return (const uint8_t *) uuid;
33 }
34 
35 const uint32_t pv_get_uuid_size(void) {
36  return UUID_SIZE;
37 }
38 
42 
47  uint32_t uuid_int32[2] = {0};
51  uuid_int32[0] = OCOTP_ReadFuseShadowRegister(OCOTP, 0x01);
52  uuid_int32[1] = OCOTP_ReadFuseShadowRegister(OCOTP, 0x02);
53  memcpy(uuid, uuid_int32, UUID_SIZE);
54 
55  return PV_STATUS_SUCCESS;
56 }
57 
58 struct {
59  volatile bool is_new_message;
60  const char *context;
61 } pv_message;
62 
63 static pv_status_t pv_uart_init(void) {
64  return PV_STATUS_SUCCESS;
65 }
66 
70  }
71  return PV_STATUS_SUCCESS;
72 }
73 
75 }
76 
77 void pv_error_handler(void) {
78  while(true);
79 }
PV_OCOTP_FREQ_HZ
#define PV_OCOTP_FREQ_HZ
Definition: pv_imxrt1050.c:26
BOARD_InitDebugConsole
void BOARD_InitDebugConsole(void)
Definition: board.c:43
clock_config.h
PV_STATUS_INVALID_STATE
@ PV_STATUS_INVALID_STATE
Definition: porcupine/include/picovoice.h:40
OCOTP
#define OCOTP
Definition: MIMXRT1052.h:28351
pv_uart_init
static pv_status_t pv_uart_init(void)
Definition: pv_imxrt1050.c:63
OCOTP_ReloadShadowRegister
void OCOTP_ReloadShadowRegister(OCOTP_Type *base)
Reload the shadow register. This function will help reload the shadow register without reseting the O...
Definition: fsl_ocotp.c:59
fsl_ocotp.h
OCOTP_ReadFuseShadowRegister
uint32_t OCOTP_ReadFuseShadowRegister(OCOTP_Type *base, uint32_t address)
Read the fuse shadow register with the fuse addess.
Definition: fsl_ocotp.c:156
pv_get_uuid
const uint8_t * pv_get_uuid(void)
Definition: pv_imxrt1050.c:31
BOARD_InitBootPeripherals
void BOARD_InitBootPeripherals(void)
Definition: peripherals.c:45
OCOTP_ClearErrorStatus
static void OCOTP_ClearErrorStatus(OCOTP_Type *base)
Clear the error bit if this bit is set.
Definition: fsl_ocotp.h:103
PV_STATUS_SUCCESS
@ PV_STATUS_SUCCESS
Definition: porcupine/include/picovoice.h:34
pv_board_deinit
void pv_board_deinit()
Definition: pv_imxrt1050.c:74
uuid
static uint8_t uuid[UUID_SIZE]
Definition: pv_imxrt1050.c:29
pv_status_t
pv_status_t
Definition: porcupine/include/picovoice.h:33
BOARD_InitBootClocks
void BOARD_InitBootClocks(void)
This function executes default configuration of clocks.
Definition: clock_config.c:48
context
const char * context
Definition: pv_imxrt1050.c:60
peripherals.h
pv_board_init
pv_status_t pv_board_init()
Definition: pv_imxrt1050.c:39
pin_mux.h
UUID_SIZE
#define UUID_SIZE
Definition: pv_imxrt1050.c:27
fsl_debug_console.h
pv_get_uuid_size
const uint32_t pv_get_uuid_size(void)
Definition: pv_imxrt1050.c:35
OCOTP_Init
void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz)
Initializes OCOTP controller.
Definition: fsl_ocotp.c:114
BOARD_ConfigMPU
void BOARD_ConfigMPU(void)
Definition: board.c:235
MIMXRT1052.h
CMSIS Peripheral Access Layer for MIMXRT1052.
board.h
BOARD_InitBootPins
void BOARD_InitBootPins(void)
Calls initialization functions.
Definition: pin_mux.c:34
pv_message
struct @365 pv_message
BOARD_BootClockRUN
void BOARD_BootClockRUN(void)
This function executes configuration of clocks.
Definition: clock_config.c:172
is_new_message
volatile bool is_new_message
Definition: pv_imxrt1050.c:59
pv_error_handler
void pv_error_handler(void)
Definition: pv_imxrt1050.c:77
pv_message_init
pv_status_t pv_message_init(void)
Definition: pv_imxrt1050.c:67
pv_imxrt1050.h


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:50