Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 33b4af6

Browse files
authored
Merge pull request #64 from NordicSemiconductor/feature/conn-reset
Port reset function from master branch
2 parents 9b98770 + b8b2889 commit 33b4af6

File tree

9 files changed

+199
-66
lines changed

9 files changed

+199
-66
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ _build
33
**/CMakeFiles
44
**/CMakeCache.txt
55
*.pyc
6-
sdk/
6+
**/build
7+
/sdk/
78

89
# Object files
910
*.o

include/common/sd_rpc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ SD_RPC_API uint32_t sd_rpc_close(adapter_t *adapter);
145145
*/
146146
SD_RPC_API uint32_t sd_rpc_log_handler_severity_filter_set(adapter_t *adapter, sd_rpc_log_severity_t severity_filter);
147147

148+
/**@brief Reset the connectivity chip.
149+
*
150+
* @param[in] adapter The transport adapter.
151+
*
152+
* @retval NRF_SUCCESS The connectivity chip was reset successfully.
153+
* @retval NRF_ERROR There was an error reset the connectivity chip.
154+
*/
155+
SD_RPC_API uint32_t sd_rpc_conn_reset(adapter_t *adapter);
156+
148157
#ifdef __cplusplus
149158
}
150159
#endif // __cplusplus

src/common/ble_impl.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
#include "ble.h"
4242
#include "ble_app.h"
43-
#include "conn_systemreset.h"
4443

4544
#include <stdint.h>
4645

@@ -240,13 +239,3 @@ uint32_t sd_ble_user_mem_reply(adapter_t *adapter, uint16_t conn_handle, ble_use
240239

241240
return encode_decode(adapter, encode_function, decode_function);
242241
}
243-
244-
245-
uint32_t conn_systemreset(adapter_t *adapter)
246-
{
247-
encode_function_t encode_function = [&](uint8_t *buffer, uint32_t *length) -> uint32_t {
248-
return 0;
249-
};
250-
251-
return encode_decode(adapter, encode_function, nullptr);
252-
}

src/common/sd_rpc_impl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "uart_boost.h"
4444
#include "uart_settings_boost.h"
4545
#include "serial_port_enum.h"
46+
#include "conn_systemreset_app.h"
47+
#include "ble_common.h"
4648

4749
#include <stdlib.h>
4850

@@ -185,3 +187,11 @@ uint32_t sd_rpc_log_handler_severity_filter_set(adapter_t *adapter, sd_rpc_log_s
185187
return adapterLayer->logSeverityFilterSet(severity_filter);
186188
}
187189

190+
uint32_t sd_rpc_conn_reset(adapter_t *adapter)
191+
{
192+
encode_function_t encode_function = [&](uint8_t *buffer, uint32_t *length) -> uint32_t {
193+
return conn_systemreset_enc(buffer, length);
194+
};
195+
196+
return encode_decode(adapter, encode_function, nullptr);
197+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2016 Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice, this
12+
* list of conditions and the following disclaimer in the documentation and/or
13+
* other materials provided with the distribution.
14+
*
15+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
16+
* contributors to this software may be used to endorse or promote products
17+
* derived from this software without specific prior written permission.
18+
*
19+
* 4. This software must only be used in or with a processor manufactured by Nordic
20+
* Semiconductor ASA, or in or with a processor manufactured by a third party that
21+
* is used in combination with a processor manufactured by Nordic Semiconductor.
22+
*
23+
* 5. Any software provided in binary or object form under this license must not be
24+
* reverse engineered, decompiled, modified and/or disassembled.
25+
*
26+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
30+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*/
37+
38+
#include "ble_serialization.h"
39+
#include "conn_systemreset_app.h"
40+
41+
uint32_t conn_systemreset_enc(uint8_t * const p_buf,
42+
uint32_t * const p_buf_len)
43+
{
44+
SER_ASSERT_NOT_NULL(p_buf);
45+
SER_ASSERT_NOT_NULL(p_buf_len);
46+
SER_ASSERT_LENGTH_LEQ(2, *p_buf_len);
47+
48+
*p_buf = CONN_SYSTEMRESET;
49+
*p_buf_len = 1;
50+
51+
return NRF_SUCCESS;
52+
}

src/sd_api_v2/sdk/components/serialization/application/codecs/common/conn_systemreset.h renamed to src/sd_api_v2/sdk/components/serialization/application/codecs/common/conn_systemreset_app.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,25 @@
3434
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3535
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636
*/
37-
37+
3838
#ifndef CONN_SYSTEMRESET_H__
3939
#define CONN_SYSTEMRESET_H__
4040

4141
#ifdef __cplusplus
4242
extern "C" {
4343
#endif
4444

45+
/** @addtogroup CONN_ENUMERATIONS Enumerations
46+
* @{ */
47+
48+
/**
49+
* @brief Connectivity API SVC numbers.
50+
*/
51+
enum CONN_SVCS
52+
{
53+
CONN_SYSTEMRESET = 0x00,
54+
};
55+
4556
/**
4657
* @addtogroup ser_codecs Serialization codecs
4758
* @ingroup ble_sdk_lib_serialization
@@ -66,7 +77,8 @@ extern "C" {
6677
* @retval NRF_SUCCESS Encoding success.
6778
* @retval NRF_ERROR_INTERNAL Encoding failure. Transport error.
6879
*/
69-
uint32_t conn_systemreset(void);
80+
uint32_t conn_systemreset_enc(uint8_t * const p_buf,
81+
uint32_t * const p_buf_len);
7082

7183
/** @} */
7284
#ifdef __cplusplus

src/sd_api_v3/sdk/components/serialization/application/codecs/common/conn_systemreset.h

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
2+
*
3+
* The information contained herein is property of Nordic Semiconductor ASA.
4+
* Terms and conditions of usage are described in detail in NORDIC
5+
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
6+
*
7+
* Licensees are granted free, non-transferable use of the information. NO
8+
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
9+
* the file.
10+
*
11+
*/
12+
13+
#include "ble_serialization.h"
14+
#include "conn_systemreset_app.h"
15+
16+
uint32_t conn_systemreset_enc(uint8_t * const p_buf,
17+
uint32_t * const p_buf_len)
18+
{
19+
SER_REQ_ENC_BEGIN(CONN_SYSTEMRESET);
20+
SER_REQ_ENC_END;
21+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
3+
*
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without modification,
7+
* are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form, except as embedded into a Nordic
13+
* Semiconductor ASA integrated circuit in a product or a software update for
14+
* such product, must reproduce the above copyright notice, this list of
15+
* conditions and the following disclaimer in the documentation and/or other
16+
* materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* 4. This software, with or without modification, must only be used with a
23+
* Nordic Semiconductor ASA integrated circuit.
24+
*
25+
* 5. Any software provided in binary form under this license must not be reverse
26+
* engineered, decompiled, modified and/or disassembled.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
29+
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30+
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
31+
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
32+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
34+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
37+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+
*
39+
*/
40+
#ifndef CONN_SYSTEMRESET_H__
41+
#define CONN_SYSTEMRESET_H__
42+
43+
#ifdef __cplusplus
44+
extern "C" {
45+
#endif
46+
47+
/** @addtogroup CONN_ENUMERATIONS Enumerations
48+
* @{ */
49+
50+
/**
51+
* @brief Connectivity API SVC numbers.
52+
*/
53+
enum CONN_SVCS
54+
{
55+
CONN_SYSTEMRESET = 0x00,
56+
};
57+
58+
/**
59+
* @addtogroup ser_codecs Serialization codecs
60+
* @ingroup ble_sdk_lib_serialization
61+
*/
62+
63+
/**
64+
* @addtogroup ser_app_common_codecs Application common codecs
65+
* @ingroup ser_codecs_app
66+
*/
67+
68+
/**@file
69+
*
70+
* @defgroup conn_systemreset Connectivity chip reset command request encoder
71+
* @{
72+
* @ingroup ser_app_common_codecs
73+
*
74+
* @brief Connectivity chip reset command request encoder.
75+
*/
76+
77+
/**@brief Function for performing the connectivity chip reset.
78+
*
79+
* @retval NRF_SUCCESS Encoding success.
80+
* @retval NRF_ERROR_INTERNAL Encoding failure. Transport error.
81+
*/
82+
uint32_t conn_systemreset_enc(uint8_t * const p_buf,
83+
uint32_t * const p_buf_len);
84+
85+
/** @} */
86+
87+
#ifdef __cplusplus
88+
}
89+
#endif
90+
91+
#endif // CONN_SYSTEMRESET_H__

0 commit comments

Comments
 (0)