Skip to content

Commit 0a83fa5

Browse files
committed
hw/drivers: Add support for IPC ICBMsg transport
Tested with nRF5340.
1 parent af7c575 commit 0a83fa5

File tree

14 files changed

+1291
-1361
lines changed

14 files changed

+1291
-1361
lines changed

hw/bsp/nordic_pca10095/syscfg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ syscfg.defs:
2626
value: 0
2727

2828
BSP_NRF5340_NET_ENABLE:
29-
description: >
29+
description: >
3030
When enabled Network Core of nRF5340 is started on init.
31-
value: 0
31+
value: 0
3232

3333
BSP_NRF5340_NET_FLASH_ENABLE:
3434
description: >

hw/bsp/nordic_pca10095_net/nrf5340_net.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ MEMORY
2121
FLASH (rx) : ORIGIN = 0x01008000, LENGTH = 0x30000
2222
RAM (rwx) : ORIGIN = 0x21000000, LENGTH = 0x10000
2323
IPC (rw) : ORIGIN = 0x20000400, LENGTH = 0x400
24+
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
25+
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
2426
}
2527

2628
/* This linker script is used for images and thus contains an image header */

hw/bsp/nordic_pca10095_net/pkg.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ pkg.deps:
3434
- "@apache-mynewt-core/hw/scripts"
3535
- "@apache-mynewt-core/hw/mcu/nordic/nrf5340_net"
3636
- "@apache-mynewt-core/libc"
37-
- "@apache-mynewt-core/sys/flash_map"
38-
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
37+
38+
pkg.deps.'BLE_TRANSPORT_HS != "ipc_icbmsg"':
39+
- "@apache-mynewt-core/sys/flash_map"
40+
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#ifndef _HW_DRIVERS_IPC_ICBMSG_H
21+
#define _HW_DRIVERS_IPC_ICBMSG_H
22+
23+
#include <stdint.h>
24+
#include <stdbool.h>
25+
#include <os/os.h>
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
struct ipc_service_cb {
32+
void (*received)(const void *data, size_t len, void *user_data);
33+
};
34+
35+
struct ipc_ept_cfg {
36+
const char *name;
37+
struct ipc_service_cb cb;
38+
void *user_data;
39+
uint8_t tx_channel;
40+
uint8_t rx_channel;
41+
};
42+
43+
struct ipc_icmsg_buf {
44+
size_t block_id;
45+
uint8_t *data;
46+
uint16_t len;
47+
};
48+
49+
typedef void (*ipc_icbmsg_recv_cb)(uint8_t ipc_id, void *user_data);
50+
51+
void ipc_icbmsg_init(void);
52+
53+
void ipc_icbmsg_netcore_init(void);
54+
55+
void ipc_icbmsg_reset(void);
56+
57+
void ipc_icbmsg_enable_ipc_irq(uint8_t channel, uint8_t on);
58+
59+
uint8_t ipc_icmsg_register_ept(uint8_t ipc_id, struct ipc_ept_cfg *cfg);
60+
61+
int ipc_icbmsg_send(uint8_t ipc_id, uint8_t ept_addr, const void *data, uint16_t len);
62+
63+
int ipc_icbmsg_send_buf(uint8_t ipc_id, uint8_t ept_addr, struct ipc_icmsg_buf *buf);
64+
65+
int ipc_icbmsg_alloc_tx_buf(uint8_t ipc_id, struct ipc_icmsg_buf *buf, uint32_t size);
66+
67+
int ipc_icbmsg_open(uint8_t ipc_id);
68+
69+
void ipc_icbmsg_process_icmsg(uint8_t ipc_id);
70+
71+
void ipc_icbmsg_signal(uint8_t ipc_id);
72+
73+
uint8_t ipc_icsmsg_ready(uint8_t ipc_id);
74+
75+
uint8_t ipc_icsmsg_ept_ready(uint8_t ipc_id, uint8_t ept_addr);
76+
77+
#ifdef __cplusplus
78+
}
79+
#endif
80+
81+
#endif /* _HW_DRIVERS_IPC_ICBMSG_H */

hw/drivers/ipc_icbmsg/pkg.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
pkg.name: hw/drivers/ipc_icbmsg
21+
pkg.description: IPC driver for nRF5340
22+
pkg.author: "Apache Mynewt <dev@mynewt.apache.org>"
23+
pkg.homepage: "http://mynewt.apache.org/"
24+
pkg.keywords:
25+
- ipc
26+
- nrf5340
27+
28+
pkg.deps:
29+
- "@apache-mynewt-core/hw/mcu/nordic"
30+
- "@apache-mynewt-core/kernel/os"
31+
32+
pkg.init:
33+
ipc_icbmsg_init: 10
34+
ipc_icbmsg_netcore_init: 11

0 commit comments

Comments
 (0)