Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw/drivers: Add ipc_icbmsg #3312

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095_net/nrf5340_net.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ MEMORY
FLASH (rx) : ORIGIN = 0x01008000, LENGTH = 0x30000
RAM (rwx) : ORIGIN = 0x21000000, LENGTH = 0x10000
IPC (rw) : ORIGIN = 0x20000400, LENGTH = 0x400
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
}

/* This linker script is used for images and thus contains an image header */
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095_net/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ pkg.deps:
- "@apache-mynewt-core/hw/scripts"
- "@apache-mynewt-core/hw/mcu/nordic/nrf5340_net"
- "@apache-mynewt-core/libc"

pkg.deps.'BLE_TRANSPORT_HS != "ipc"':
- "@apache-mynewt-core/sys/flash_map"
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
65 changes: 65 additions & 0 deletions hw/drivers/ipc/icbmsg/include/icbmsg/icbmsg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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 (*received)(const void *data, size_t len, void *user_data);
};

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

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);

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);

uint8_t ipc_icsmsg_ept_ready(uint8_t ipc_id, uint8_t ept_addr);

#ifdef __cplusplus
}
#endif

#endif /* _HW_DRIVERS_IPC_ICBMSG_H */
29 changes: 29 additions & 0 deletions hw/drivers/ipc/icbmsg/pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# 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 with icbmsg backend
pkg.author: "Apache Mynewt <dev@mynewt.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
- ipc

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