-
Notifications
You must be signed in to change notification settings - Fork 445
nimble/transport: Add ipc_icbmsg #1882
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
Open
mkasenberg
wants to merge
1
commit into
apache:master
Choose a base branch
from
mkasenberg:add-ble-hci-ipc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,26 @@ | |
#define _HCI_IPC_H_ | ||
|
||
#include <stdint.h> | ||
#include <syscfg/syscfg.h> | ||
|
||
#if MYNEWT_VAL(IPC_ICBMSG) | ||
#include "nimble/hci_common.h" | ||
#define HCI_IPC_TYPE_CMD 0x01 | ||
#define HCI_IPC_TYPE_ACL 0x02 | ||
/* #define HCI_IPC_TYPE_SCO 0x03 */ | ||
#define HCI_IPC_TYPE_EVT 0x04 | ||
#define HCI_IPC_TYPE_ISO 0x05 | ||
/* These two are not used actually */ | ||
#define HCI_IPC_TYPE_EVT_DISCARDABLE 0x06 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so looks like icbmsg uses simple H4, in such case it should simply use hci_h4 |
||
#define HCI_IPC_TYPE_EVT_IN_CMD 0x07 | ||
#else | ||
#define HCI_IPC_TYPE_CMD 0x01 | ||
#define HCI_IPC_TYPE_ACL 0x02 | ||
#define HCI_IPC_TYPE_EVT 0x04 | ||
#define HCI_IPC_TYPE_EVT_DISCARDABLE 0x05 | ||
#define HCI_IPC_TYPE_EVT_IN_CMD 0x06 | ||
#define HCI_IPC_TYPE_ISO 0x07 | ||
#endif | ||
|
||
struct __attribute__((packed)) hci_ipc_hdr { | ||
uint8_t type; | ||
|
@@ -55,15 +68,20 @@ struct hci_ipc_shm { | |
void hci_ipc_init(volatile struct hci_ipc_shm *shm, struct hci_ipc_sm *sm); | ||
int hci_ipc_rx(struct hci_ipc_sm *sm, const uint8_t *buf, uint16_t len); | ||
|
||
#if !MYNEWT_VAL(IPC_ICBMSG) | ||
extern void hci_ipc_atomic_put(volatile uint16_t *num); | ||
extern uint16_t hci_ipc_atomic_get(volatile uint16_t *num); | ||
|
||
/* Just to optimize static inlines below, do not use directly! */ | ||
extern volatile struct hci_ipc_shm *g_ipc_shm; | ||
#endif | ||
|
||
static inline int | ||
hci_ipc_get(uint8_t type) | ||
{ | ||
#if MYNEWT_VAL(IPC_ICBMSG) | ||
return 1; | ||
#else | ||
volatile struct hci_ipc_shm *shm = g_ipc_shm; | ||
|
||
switch (type) { | ||
|
@@ -76,11 +94,13 @@ hci_ipc_get(uint8_t type) | |
} | ||
|
||
return 0; | ||
#endif | ||
} | ||
|
||
static inline void | ||
hci_ipc_put(uint8_t type) | ||
{ | ||
#if !MYNEWT_VAL(IPC_ICBMSG) | ||
volatile struct hci_ipc_shm *shm = g_ipc_shm; | ||
|
||
switch (type) { | ||
|
@@ -94,6 +114,7 @@ hci_ipc_put(uint8_t type) | |
hci_ipc_atomic_put(&shm->n2a_num_evt_disc); | ||
break; | ||
} | ||
#endif | ||
} | ||
|
||
#endif /* _HCI_IPC_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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. | ||
|
||
syscfg.defs: | ||
IPC_ICBMSG: | ||
description: 'Enables ICBMsg backend for IPC.' | ||
value: 0 | ||
|
||
syscfg.vals.'BLE_TRANSPORT_LL=="ipc" || BLE_TRANSPORT_HS=="ipc"': | ||
IPC_ICBMSG: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# 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: nimble/transport/ipc/icbmsg | ||
pkg.description: HCI transport via IPC with ICBMsg backend | ||
pkg.author: "Apache Mynewt <[email protected]>" | ||
pkg.homepage: "http://mynewt.apache.org/" | ||
pkg.keywords: | ||
- ble | ||
- bluetooth | ||
- ipc | ||
- icbmsg | ||
|
||
pkg.deps: | ||
- nimble | ||
- nimble/transport/common/hci_ipc | ||
- "@apache-mynewt-core/hw/drivers/ipc/icbmsg" | ||
- "@apache-mynewt-core/kernel/os" | ||
- "@apache-mynewt-core/hw/drivers/ipc" | ||
|
||
pkg.apis: | ||
- ble_transport |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a separate commit