Skip to content

Commit 1ee27f7

Browse files
committed
modules/openthread/platform: update to new ring_buffer API
Move to use new ring_buffer_api. Signed-off-by: Måns Ansgariusson <[email protected]>
1 parent 355835d commit 1ee27f7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

modules/openthread/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ config OPENTHREAD_MBEDTLS_LIB_NAME
206206
config OPENTHREAD_COPROCESSOR
207207
bool "OpenThread Co-Processor"
208208
select OPENTHREAD_MANUAL_START
209-
select RING_BUFFER
210209
select UART_INTERRUPT_DRIVEN
211210
help
212211
Enable Co-Processor in OpenThread stack.

modules/openthread/platform/ble.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ static bool ot_plat_ble_queue_msg(const uint8_t *aData, uint16_t aLen, int8_t aR
126126

127127
len = sizeof(aLen) + sizeof(aRssi) + ((aLen <= PLAT_BLE_MSG_DATA_MAX) ? aLen : 0);
128128

129-
if (ring_buf_space_get(&ot_plat_ble_ring_buf) >= len) {
130-
ring_buf_put(&ot_plat_ble_ring_buf, (uint8_t *)&aLen, sizeof(aLen));
131-
ring_buf_put(&ot_plat_ble_ring_buf, &aRssi, sizeof(aRssi));
129+
if (ring_buffer_space(&ot_plat_ble_ring_buf) >= len) {
130+
ring_buffer_write(&ot_plat_ble_ring_buf, (uint8_t *)&aLen, sizeof(aLen));
131+
ring_buffer_write(&ot_plat_ble_ring_buf, &aRssi, sizeof(aRssi));
132132
if (aLen <= PLAT_BLE_MSG_DATA_MAX) {
133-
ring_buf_put(&ot_plat_ble_ring_buf, aData, aLen);
133+
ring_buffer_write(&ot_plat_ble_ring_buf, aData, aLen);
134134
}
135135
k_sem_give(&ot_plat_ble_event_semaphore);
136136
} else {
@@ -156,10 +156,10 @@ static void ot_plat_ble_thread(void *unused1, void *unused2, void *unused3)
156156

157157
while (1) {
158158
k_sem_take(&ot_plat_ble_event_semaphore, K_FOREVER);
159-
ring_buf_get(&ot_plat_ble_ring_buf, (uint8_t *)&len, sizeof(len));
160-
ring_buf_get(&ot_plat_ble_ring_buf, &rssi, sizeof(rssi));
159+
ring_buffer_read(&ot_plat_ble_ring_buf, (uint8_t *)&len, sizeof(len));
160+
ring_buffer_read(&ot_plat_ble_ring_buf, &rssi, sizeof(rssi));
161161
if (len <= PLAT_BLE_MSG_DATA_MAX) {
162-
ring_buf_get(&ot_plat_ble_ring_buf, ot_plat_ble_msg_buf, len);
162+
ring_buffer_read(&ot_plat_ble_ring_buf, ot_plat_ble_msg_buf, len);
163163
}
164164

165165
openthread_mutex_lock();

0 commit comments

Comments
 (0)