summaryrefslogtreecommitdiff
path: root/common/btle_ll.c
Commit message (Collapse)AuthorAgeFilesLines
* tree: Files should end with single newlineTom Hughes2021-10-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* COIL: Remove non-inclusive words from Bluetooth codeDossym Nurmukhanov2021-01-121-2/+2
| | | | | | | | | | | BUG=none BRANCH=none TEST=build hadoken Signed-off-by: dossym@chromium.org Change-Id: I9a453bcdf14b3a6823bad23824aaee77a7013a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622066 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* ec: change usage of whitelist/blacklistPaul Fagerburg2020-07-281-10/+10
| | | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the terms "whitelist", "blacklist", and similar with inclusive alternatives. BUG=b:162262297 BRANCH=None TEST=`grep -Eirl "(white|black)[ _\-]*list" .` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie5210b98e1096c22d0e9284c101a42820bd3d79d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321549 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* printf: Fix formatting errorsEvan Green2019-10-051-1/+1
| | | | | | | | | | | | | | | | | | | This change fixes the printf formatting errors found by the compile-time prinf format checker. The errors fall into a few categories: 1. Incorrect size specifier (missing or extra l). 2. Missing or extra arguments. 3. Bad line splitting. BUG=chromium:984041 TEST=make -j buildall BRANCH=none Change-Id: I5618097a581210b9fcbfc81560dec050ae30b61c Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819653 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* printf: Convert %l to %llEvan Green2019-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | In order to make our printf more standard, utilize %ll for long long arguments, rather than %l. This does cost a little bit in flash space for that extra l in a couple of places, but enables us to turn on compile-time printf format checking. For this commit only, the semantics are such that both %l and %ll take 64-bit arguments. In the next commit, %l goes to its correct behavior of taking a sizeof(long) argument. BUG=chromium:984041 TEST=make -j buildall BRANCH=none Cq-Depend:chrome-internal:1863686,chrome-internal:1860161,chrome-internal:1914029 Change-Id: I18081b55a8dbf5ef8ec15fc499ca75e59d31da58 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819652 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* printf: Fix up %p to %pPEvan Green2019-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In order to avoid landmines later with future extensions to %p, disallow %p by itself. The danger is that we'll have something like: printf("%pFOO", myptr), and then later will add a %pF extension, but miss this printf (maybe the string is split, maybe it's just missed). Missing a conversion during extension is worse than just seeing a print like <ptr_val>OO, since %pF likely reaches through the pointer and interprets its contents according to whatever F means. Convert existing uses of %p to %pP, so they're explicitly printing a pointer value, giving us flexibility to extend in the future. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Cq-Depend:chrome-internal:1560879 Change-Id: I36a4bee8d41cb9a6139171f8de0d8f2f19468132 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730604 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common/btle_ll.c: define default return valuePatrick Georgi2019-09-121-1/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #160945 BUG=none BRANCH=none TEST=none Change-Id: I9689d88785db721c48c29d793c5b783a6f4dd583 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1801205 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-261-1/+1
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* btle_ll.c: Initialize variables to fix GCC warningsMartin Roth2016-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | The variable last_rx_time shouldn't be able to be used without being initialized, so initialize it to make GCC 5.x & 6.x happy. common/btle_ll.c: In function 'bluetooth_ll_task': common/btle_ll.c:835:25: error: 'last_rx_time' may be used uninitialized in this function [-Werror=maybe-uninitialized] This does not change the size of any ec.*.flat file. BRANCH=none BUG=none TEST=build succeeds under GCC 4.9.2, 5.3, and 6.2 Change-Id: I99f716fcb3c8c871e4f325eca3bf3cd622e727d1 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/411406 Reviewed-by: Shawn N <shawnn@chromium.org>
* btle_ll.c: Initialize variable "offset" before it's usedMartin Roth2016-11-161-0/+2
| | | | | | | | | | | | | | | | | | | | The variable "offset" gets configured if it's not the first data packet, but gets used even on the first data packet. common/btle_ll.c: In function 'connected_communicate': common/btle_ll.c:729:15: error: 'offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] This does not change the size of any ec.*.flat file. BRANCH=none BUG=none TEST=build succeeds under GCC 4.9.2, 5.3, and 6.2 Change-Id: Ib3882aab3e081afc4b00dc02b002ba4c590cb0f9 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403500 Reviewed-by: Shawn N <shawnn@chromium.org>
* btle: Accepts and maintains connectionsLevi Oliver2016-08-231-4/+299
| | | | | | | | | | | | | | | | | | Can now accept and maintain a single connection indefinitely by sending empty packets at every connection interval to keep the connection alive. TEST=BTLE dongle sending connect requests and connecting to NRF51 running this code. Connection was established and ran for at least 48 hours until manual termination. BUG=None BRANCH=None Change-Id: Iad4bd434ecd1edd6c5c8dfe8b72ca41fd82d0bb4 Signed-off-by: Levi Oliver <levio@google.com> Reviewed-on: https://chromium-review.googlesource.com/370839 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common/btle_ll.c: Return error code instead of uninitialized valueMartin Roth2016-08-161-1/+1
| | | | | | | | | | | | | The variable rv was being returned without being initialized. Instead, return EC_SUCCESS. BUG=None BRANCH=None TEST=Build all boards successfully. Change-Id: If37057b737e6419c1d5cc22215a7d76d920d1267 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/370664
* btle: Add framework for parsing data packetsLevi Oliver2016-08-111-1/+3
| | | | | | | | | | | | | | | | | | | Re-wrote ble_radio_init to work with both data and advertising packets. Updated all calls to refactored function. RADIO_PCNF0_ADV renamed because it applies to advertisement and data packet formats. Updated all references to this value. TEST=make BOARD=hadoken BUG=None BRANCH=None Change-Id: I0fdbe0eb146ce5cbc40e3ac67bf4d0e5465dcc2f Signed-off-by: Levi Oliver <levio@google.com> Reviewed-on: https://chromium-review.googlesource.com/367732 Commit-Ready: Myles Watson <mylesgw@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Myles Watson <mylesgw@chromium.org>
* btle_ll: Set advertising channel frequencyLevi Oliver2016-08-091-2/+12
| | | | | | | | | | | | | | Remove repeated deadline resets. Deadline reset now in the STANDBY state. Set radio frequency to match selected channel. TEST=ble_hci_adv 0 BUG=None BRANCH=None Change-Id: Ic7ff0dba862c0216301d138413a89e4ef4a812fe Signed-off-by: Levi Oliver <levio@google.com> Reviewed-on: https://chromium-review.googlesource.com/367094 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* btle: Add common link layer codeMyles Watson2016-08-081-0/+552
BUG=None BRANCH=None TEST=make BOARD=hadoken Add a task that is responsible for the state of the link layer. Change-Id: Ifc79bf1e4c57f5de448ab05b3a8d3a1aca5a58e2 Signed-off-by: Myles Watson <mylesgw@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/362144 Commit-Ready: Dan Shi <dshi@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>