Skip to content

Commit 875da6b

Browse files
author
ganghe
committed
[int][new][zbt] Add patch folder for release.
Project: Bluetooth redmine: #5146, REDMINE-id ext-redmine: bug|feat#id Required by Zephyr. Affected branch: [master] Change-Id: I4d3d4b3cee148aa56794fcb3de6b9ba9fc77e5e0
1 parent 17e039d commit 875da6b

File tree

4 files changed

+1031
-0
lines changed

4 files changed

+1031
-0
lines changed

patch/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SiFli Bluetooth patches
2+
3+
## Overview
4+
5+
This is official Sifli bluetooth controller CPU(LCPU) images and patches release.
6+
Each subfolder contain the image and patches for a SiFli SF32LB soc serial, and also
7+
for installation help function implement.
8+
9+
Relevant documentation:
10+
- https://wiki.sifli.com/
11+
- https://docs.sifli.com/projects/sdk/latest/sf32lb52x/index.html

patch/sf32lb52/lcpu_install.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include "rtconfig.h"
2+
#include <stdio.h>
3+
#include <string.h>
4+
#include <stdint.h>
5+
#include "sf32lb52_lcpu.h"
6+
#include "sf32lb52_lcpu_patch.h"
7+
#include "bf0_hal.h"
8+
#include "mem_map.h"
9+
10+
/* Install Bluetooth core (LCPU) image*/
11+
void lcpu_img_install()
12+
{
13+
memcpy((void *)(HCPU_LCPU_CODE_START_ADDR), g_lcpu_bin, sizeof(g_lcpu_bin));
14+
}
15+
16+
/* Install Bluetooth core (LCPU) image patch*/
17+
void lcpu_patch_install()
18+
{
19+
memcpy((void *)(LCPU_PATCH_RECORD_ADDR), g_lcpu_patch_list, sizeof(g_lcpu_patch_list));
20+
HAL_PATCH_install();
21+
memset((void *)(LCPU_PATCH_START_ADDR_S), 0, LCPU_PATCH_TOTAL_SIZE);
22+
memcpy((void *)(LCPU_PATCH_START_ADDR_S), g_lcpu_patch_bin, sizeof(g_lcpu_patch_bin));
23+
};
24+
25+
/* Install Bluetooth core (LCPU) image patch for rev B chipsets*/
26+
void lcpu_patch_install_rev_b()
27+
{
28+
uint32_t entry[3] = {0x48434150, 0xA, LCPU_PATCH_CODE_START_ADDR + 1};
29+
30+
memcpy((void *)LCPU_PATCH_BUF_START_ADDR, (void *)&entry, 12);
31+
memset((void *)(LCPU_PATCH_CODE_START_ADDR_S), 0, LCPU_PATCH_CODE_SIZE);
32+
memcpy((void *)(LCPU_PATCH_CODE_START_ADDR_S), g_lcpu_patch_bin, sizeof(g_lcpu_patch_bin));
33+
HAL_PATCH_install();
34+
}
35+
36+
/* Get patch entry address*/
37+
uint32_t *HAL_PATCH_GetEntryAddr(void)
38+
{
39+
uint32_t *entry_addr;
40+
uint8_t rev_id = __HAL_SYSCFG_GET_REVID();
41+
42+
if (rev_id >= HAL_CHIP_REV_ID_A4)
43+
entry_addr = (uint32_t *)g_lcpu_patch_list;
44+
else
45+
entry_addr = (uint32_t *)LCPU_PATCH_RECORD_ADDR;
46+
return entry_addr;
47+
}

0 commit comments

Comments
 (0)