-
Notifications
You must be signed in to change notification settings - Fork 104
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
lib: stm32wb0: Add BLE controller implementation #236
Open
HoZHel
wants to merge
3
commits into
zephyrproject-rtos:main
Choose a base branch
from
HoZHel:stm32wb0_ble_lib
base: main
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
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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,12 @@ | ||
# Copyright (c) 2024 STMicroelectronics | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_include_directories(hci) | ||
|
||
zephyr_sources(hci/hw_ipcc.c) | ||
zephyr_sources(hci/shci.c) | ||
zephyr_sources(hci/shci_tl.c) | ||
zephyr_sources(hci/shci_tl_if.c) | ||
zephyr_sources(hci/stm_list.c) | ||
zephyr_sources(hci/tl_mbox.c) |
This file contains 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,130 @@ | ||
/* USER CODE BEGIN Header */ | ||
/** | ||
****************************************************************************** | ||
* @file app_common.h | ||
* @author MCD Application Team | ||
* @brief App Common application configuration file for STM32WPAN Middleware. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
* in the root directory of this software component. | ||
* If no LICENSE file comes with this software, it is provided AS-IS. | ||
* | ||
****************************************************************************** | ||
*/ | ||
/* USER CODE END Header */ | ||
/* Define to prevent recursive inclusion -------------------------------------*/ | ||
#ifndef APP_COMMON_H | ||
#define APP_COMMON_H | ||
|
||
#ifdef __cplusplus | ||
extern "C"{ | ||
#endif | ||
|
||
#include <stdint.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdarg.h> | ||
|
||
#include "app_conf.h" | ||
|
||
/* -------------------------------- * | ||
* Basic definitions * | ||
* -------------------------------- */ | ||
#undef NULL | ||
#define NULL 0 | ||
|
||
#undef FALSE | ||
#define FALSE 0 | ||
|
||
#undef TRUE | ||
#define TRUE (!0) | ||
|
||
/* -------------------------------- * | ||
* Critical Section definition * | ||
* -------------------------------- */ | ||
#define ATOMIC_SECTION_BEGIN() uint32_t uwPRIMASK_Bit = __get_PRIMASK(); \ | ||
__disable_irq(); | ||
/* Must be called in the same or in a lower scope of ATOMIC_SECTION_BEGIN */ | ||
#define ATOMIC_SECTION_END() __set_PRIMASK(uwPRIMASK_Bit) | ||
|
||
/* -------------------------------- * | ||
* Macro delimiters * | ||
* -------------------------------- */ | ||
#define M_BEGIN do { | ||
|
||
#define M_END } while(0) | ||
|
||
/* -------------------------------- * | ||
* Some useful macro definitions * | ||
* -------------------------------- */ | ||
#ifndef MAX | ||
#define MAX( x, y ) (((x)>(y))?(x):(y)) | ||
#endif | ||
|
||
#ifndef MIN | ||
#define MIN( x, y ) (((x)<(y))?(x):(y)) | ||
#endif | ||
|
||
#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END | ||
|
||
#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END | ||
|
||
#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END | ||
|
||
#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m ) | ||
|
||
#define PAUSE( t ) M_BEGIN \ | ||
__IO int _i; \ | ||
for ( _i = t; _i > 0; _i -- ); \ | ||
M_END | ||
|
||
#define DIVF( x, y ) ((x)/(y)) | ||
|
||
#define DIVC( x, y ) (((x)+(y)-1)/(y)) | ||
|
||
#define DIVR( x, y ) (((x)+((y)/2))/(y)) | ||
|
||
#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1) | ||
|
||
#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1) | ||
|
||
#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END | ||
|
||
#define INT(x) ((int)(x)) | ||
|
||
#define FRACTIONAL_1DIGIT(x) (x>0)? ((int) (((x) - INT(x)) * 10)) : ((int) ((INT(x) - (x)) * 10)) | ||
|
||
#define FRACTIONAL_2DIGITS(x) (x>0)? ((int) (((x) - INT(x)) * 100)) : ((int) ((INT(x) - (x)) * 100)) | ||
|
||
#define FRACTIONAL_3DIGITS(x) (x>0)? ((int) (((x) - INT(x)) * 1000)) : ((int) ((INT(x) - (x)) * 1000)) | ||
|
||
/** @brief Macro that returns a 16-bit value from a buffer where the value is stored in Little Endian Format */ | ||
#define LE_TO_HOST_16(ptr) (uint16_t) ( ((uint16_t)*((uint8_t *)(ptr))) | \ | ||
((uint16_t)*((uint8_t *)(ptr) + 1) << 8) ) | ||
|
||
/** @brief Macro that stores a 16-bit value into a buffer in Little Endian Format (2 bytes) */ | ||
#define HOST_TO_LE_16(buf, val) ( ((buf)[0] = (uint8_t) (val) ) , \ | ||
((buf)[1] = (uint8_t) ((val)>>8) ) ) | ||
|
||
/** @brief Macro that returns a 32-bit value from a buffer where the value is stored in Little Endian Format */ | ||
#define LE_TO_HOST_32(ptr) (uint32_t) ( ((uint32_t)*((uint8_t *)(ptr))) | \ | ||
((uint32_t)*((uint8_t *)(ptr) + 1) << 8) | \ | ||
((uint32_t)*((uint8_t *)(ptr) + 2) << 16) | \ | ||
((uint32_t)*((uint8_t *)(ptr) + 3) << 24) ) | ||
|
||
/* -------------------------------- * | ||
* Compiler * | ||
* -------------------------------- */ | ||
#define PLACE_IN_SECTION( __x__ ) __attribute__((used, section (__x__))) | ||
|
||
#ifdef __cplusplus | ||
} /* extern "C" */ | ||
#endif | ||
|
||
#endif /*APP_COMMON_H */ |
Oops, something went wrong.
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 is fine but we need consistency across vraious libs.
Hence I'd expect the same to be done fro WBA and WB
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.
I didn't get this comment well. Should I do something?
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.
You're adding a sub section to handle WB0 case, which is indeed a good idea.
But in that case, for consistency, it would be nice to do the same on other series (in a dedicated commit).
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.
Done.