Skip to content

Commit

Permalink
[wip] hw/drivers: Add ipc_icbmsg
Browse files Browse the repository at this point in the history
  • Loading branch information
mkasenberg committed Sep 30, 2024
1 parent cb10a2f commit b487329
Show file tree
Hide file tree
Showing 14 changed files with 1,709 additions and 7 deletions.
4 changes: 2 additions & 2 deletions hw/bsp/nordic_pca10095/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pkg.deps:
- "@apache-mynewt-core/libc"
- "@apache-mynewt-core/sys/flash_map"

pkg.deps.BSP_NRF5340_NET_FLASH_ENABLE:
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
# pkg.deps.BSP_NRF5340_NET_FLASH_ENABLE:
# - "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"

pkg.deps.SOFT_PWM:
- "@apache-mynewt-core/hw/drivers/pwm/soft_pwm"
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10095/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ syscfg.vals.BLE_HOST:
BLE_HS_FLOW_CTRL: 1

syscfg.vals.BLE_TRANSPORT:
BLE_TRANSPORT_LL: nrf5340
BLE_TRANSPORT_LL: ipc_icbmsg

syscfg.vals.BSP_NRF5340_NET_ENABLE:
BSP_NRF5340_NET_FLASH_ENABLE: 1
Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/nordic_pca10095_net/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ pkg.deps:
- "@apache-mynewt-core/hw/scripts"
- "@apache-mynewt-core/hw/mcu/nordic/nrf5340_net"
- "@apache-mynewt-core/libc"
- "@apache-mynewt-core/sys/flash_map"
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
# - "@apache-mynewt-core/sys/flash_map"
# - "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10095_net/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ syscfg.vals.BLE_CONTROLLER:
BLE_PHY_NRF5340_VDDH: 1

syscfg.vals.BLE_TRANSPORT:
BLE_TRANSPORT_HS: nrf5340
BLE_TRANSPORT_HS: ipc_icbmsg
79 changes: 79 additions & 0 deletions hw/drivers/ipc_icbmsg/include/ipc_icbmsg/ipc_icbmsg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

#ifndef _HW_DRIVERS_IPC_ICBMSG_H
#define _HW_DRIVERS_IPC_ICBMSG_H

#include <stdint.h>
#include <stdbool.h>
#include <os/os.h>

#ifdef __cplusplus
extern "C" {
#endif

struct ipc_service_cb {
void (*bound)(void *priv);
void (*received)(const void *data, size_t len, void *user_data);
void (*error)(const char *message, void *priv);
};

struct ipc_ept_cfg {
const char *name;
struct ipc_service_cb cb;
void *user_data;
};

struct ipc_icmsg_buf {
size_t block_id;
uint8_t *data;
uint16_t len;
};

typedef void (*ipc_icbmsg_recv_cb)(uint8_t ipc_id, void *user_data);

void ipc_icbmsg_init(void);

void ipc_icbmsg_netcore_init(void);

void ipc_icbmsg_reset(void);

void ipc_icbmsg_enable_ipc_irq(uint8_t ipc_id, uint8_t on);

uint8_t ipc_icmsg_register_ept(uint8_t ipc_id, struct ipc_ept_cfg *cfg);

int ipc_icbmsg_send(uint8_t ipc_id, uint8_t ept_addr, const void *data, uint16_t len);

int ipc_icbmsg_send_buf(uint8_t ipc_id, uint8_t ept_addr, struct ipc_icmsg_buf *buf);

int ipc_icbmsg_alloc_tx_buf(uint8_t ipc_id, struct ipc_icmsg_buf *buf, uint32_t size);

int ipc_icbmsg_open(uint8_t ipc_id);

void ipc_icbmsg_process_icmsg(uint8_t ipc_id);

void ipc_icbmsg_signal(uint8_t ipc_id);

uint8_t ipc_icsmsg_ready(uint8_t ipc_id);

#ifdef __cplusplus
}
#endif

#endif /* _HW_DRIVERS_IPC_ICBMSG_H */
34 changes: 34 additions & 0 deletions hw/drivers/ipc_icbmsg/pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

pkg.name: hw/drivers/ipc_icbmsg
pkg.description: IPC driver for nRF5340
pkg.author: "Apache Mynewt <dev@mynewt.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
- ipc
- nrf5340

pkg.deps:
- "@apache-mynewt-core/hw/mcu/nordic"
- "@apache-mynewt-core/kernel/os"

pkg.init:
ipc_icbmsg_init: 10
ipc_icbmsg_netcore_init: 11
Loading

0 comments on commit b487329

Please sign in to comment.