http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c deleted file mode 100644 index e73c49f..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c +++ /dev/null @@ -1,571 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_struct_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "ble_gatts_struct_serialization.h" -#include "ble_serialization.h" -#include "app_util.h" -#include "ble_types.h" -#include "ble_l2cap.h" -#include "ble.h" -#include "cond_field_serialization.h" -#include <string.h> - - -uint32_t ble_uuid_t_enc(void const * const p_void_uuid, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint16_t_enc(&p_uuid->uuid, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_uuid->type, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_uuid) -{ - ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; - - SER_ASSERT_LENGTH_LEQ(3, buf_len - *p_index); - uint16_dec(p_buf, buf_len, p_index, &p_uuid->uuid); - uint8_dec(p_buf, buf_len, p_index, &p_uuid->type); - - return NRF_SUCCESS; -} - -uint32_t ble_uuid128_t_enc(void const * const p_void_uuid, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); - - memcpy(&p_buf[*p_index], p_uuid->uuid128, sizeof (p_uuid->uuid128)); - - *p_index += sizeof (p_uuid->uuid128); - - return err_code; -} - -uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_uuid) -{ - ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); - - memcpy(p_uuid->uuid128, &p_buf[*p_index], sizeof (p_uuid->uuid128)); - - *p_index += sizeof (p_uuid->uuid128); - - return err_code; -} - -uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_header); - - ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint16_t_enc(&(p_header->len), p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_enc(&(p_header->cid), p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_header) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_header); - - ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->len)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->cid)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_evt_rx); - - ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_l2cap_header_t_enc(&(p_evt_rx->header), p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); - memcpy(&p_buf[*p_index], p_evt_rx->data, p_evt_rx->header.len); - *p_index += p_evt_rx->header.len; - - return err_code; -} - -uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - uint32_t * const p_struct_len, - void * const p_void_evt_rx) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_struct_len); - - ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; - uint32_t err_code = NRF_SUCCESS; - - uint32_t total_struct_len = *p_struct_len; - - /* Get data length */ - uint32_t tmp_index = *p_index; - uint16_t len = 0; - - err_code = uint16_t_dec(p_buf, buf_len, &tmp_index, &len); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - /* Update struct length */ - *p_struct_len = offsetof(ble_l2cap_evt_rx_t, data[0]); - *p_struct_len += (uint8_t*)&p_evt_rx->data[len] - (uint8_t*)&p_evt_rx->data[0]; - - /* Decode header and copy data */ - if (p_void_evt_rx != NULL) - { - SER_ASSERT_LENGTH_LEQ(*p_struct_len, total_struct_len); - - err_code = ble_l2cap_header_t_dec(p_buf, buf_len, p_index, &(p_evt_rx->header)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); - memcpy(p_evt_rx->data, &p_buf[*p_index], p_evt_rx->header.len); - *p_index += p_evt_rx->header.len; - } - - return err_code; -} - -uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_enable_params); - - ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_common_enable_params_t_enc(&p_enable_params->common_enable_params, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_enable_params_t_enc(&p_enable_params->gap_enable_params, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gatts_enable_params_t_enc(&p_enable_params->gatts_enable_params, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_enable_params) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_enable_params); - - ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_common_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->common_enable_params)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gap_enable_params)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gatts_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gatts_enable_params)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_t_enc(void const * const p_void_conn_bw, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw); - - ble_conn_bw_t * p_conn_bw = (ble_conn_bw_t *)p_void_conn_bw; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint8_t_enc(&p_conn_bw->conn_bw_rx, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_conn_bw->conn_bw_tx, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw); - - ble_conn_bw_t * p_conn_bw = (ble_conn_bw_t *)p_void_conn_bw; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw_rx); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw_tx); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_opt_conn_bw_t_enc(void const * const p_void_opt_conn_bw, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_opt_conn_bw); - - ble_common_opt_conn_bw_t * p_conn_bw = (ble_common_opt_conn_bw_t *)p_void_opt_conn_bw; - uint32_t err_code = NRF_SUCCESS; - uint8_t byte; - - byte = p_conn_bw->role; - err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_conn_bw_t_enc(&p_conn_bw->conn_bw, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_opt_conn_bw_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_opt_conn_bw) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_opt_conn_bw); - - ble_common_opt_conn_bw_t * p_conn_bw = (ble_common_opt_conn_bw_t *)p_void_opt_conn_bw; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->role); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_conn_bw_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_count_t_enc(void const * const p_void_conn_bw_count, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw_count); - - ble_conn_bw_count_t * p_conn_bw_count = (ble_conn_bw_count_t *)p_void_conn_bw_count; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint8_t_enc(&p_conn_bw_count->high_count, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_conn_bw_count->mid_count, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_conn_bw_count->low_count, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_count_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw_count) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw_count); - - ble_conn_bw_count_t * p_conn_bw_count = (ble_conn_bw_count_t *)p_void_conn_bw_count; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->high_count); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->mid_count); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->low_count); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_counts_t_enc(void const * const p_void_conn_bw_counts, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw_counts); - - ble_conn_bw_counts_t * p_conn_bw_counts = (ble_conn_bw_counts_t *)p_void_conn_bw_counts; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_conn_bw_count_t_enc(&p_conn_bw_counts->tx_counts, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_conn_bw_count_t_enc(&p_conn_bw_counts->rx_counts, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_conn_bw_counts_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw_counts) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_conn_bw_counts); - - ble_conn_bw_counts_t * p_conn_bw_counts = (ble_conn_bw_counts_t *)p_void_conn_bw_counts; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_conn_bw_count_t_dec(p_buf, buf_len, p_index, &p_conn_bw_counts->tx_counts); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_conn_bw_count_t_dec(p_buf, buf_len, p_index, &p_conn_bw_counts->rx_counts); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_enable_params_t_enc(void const * const p_void_common_enable_params, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_common_enable_params); - - ble_common_enable_params_t * p_common_enable_params = (ble_common_enable_params_t *)p_void_common_enable_params; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint16_t_enc(&p_common_enable_params->vs_uuid_count, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = cond_field_enc(p_common_enable_params->p_conn_bw_counts, p_buf, buf_len, p_index, ble_conn_bw_counts_t_enc); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_enable_params_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_common_enable_params) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_common_enable_params); - - ble_common_enable_params_t * p_common_enable_params = (ble_common_enable_params_t *)p_void_common_enable_params; - uint32_t err_code = NRF_SUCCESS; - - err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_common_enable_params->vs_uuid_count); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_common_enable_params->p_conn_bw_counts), - ble_conn_bw_counts_t_dec); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_opt_pa_lna_t_enc(void const * const p_void_opt, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_opt); - - ble_common_opt_pa_lna_t * p_opt = (ble_common_opt_pa_lna_t *)p_void_opt; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_pa_lna_cfg_t_enc(&p_opt->pa_cfg, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_pa_lna_cfg_t_enc(&p_opt->lna_cfg, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_opt->ppi_ch_id_set, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_opt->ppi_ch_id_clr, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_enc(&p_opt->gpiote_ch_id, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_common_opt_pa_lna_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_opt) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_opt); - - ble_common_opt_pa_lna_t * p_opt = (ble_common_opt_pa_lna_t *)p_void_opt; - uint32_t err_code = NRF_SUCCESS; - - err_code = ble_pa_lna_cfg_t_dec(p_buf, buf_len, p_index, &p_opt->pa_cfg); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_pa_lna_cfg_t_dec(p_buf, buf_len, p_index, &p_opt->lna_cfg); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->ppi_ch_id_set); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->ppi_ch_id_clr); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->gpiote_ch_id); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - - -uint32_t ble_pa_lna_cfg_t_enc(void const * const p_void_cfg, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_cfg); - - ble_pa_lna_cfg_t * p_cfg = (ble_pa_lna_cfg_t *)p_void_cfg; - uint32_t err_code = NRF_SUCCESS; - - uint8_t data = (p_cfg->enable & 0x01) | - ((p_cfg->active_high & 0x01) << 1) | - (p_cfg->gpio_pin << 2); - - err_code = uint8_t_enc(&data, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return err_code; -} - -uint32_t ble_pa_lna_cfg_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_cfg) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_index); - SER_ASSERT_NOT_NULL(p_void_cfg); - - ble_pa_lna_cfg_t * p_cfg = (ble_pa_lna_cfg_t *)p_void_cfg; - uint32_t err_code = NRF_SUCCESS; - - uint8_t data; - - err_code = uint8_t_dec(p_buf, buf_len, p_index, &data); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - p_cfg->enable = data & 0x01; - p_cfg->active_high = (data >> 1) & 0x01; - p_cfg->gpio_pin = (data >> 2); - - - return err_code; -} - -
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h deleted file mode 100644 index c967335..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_types.h" - - -uint32_t ble_uuid_t_enc(void const * const p_void_uuid, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_uuid); - -uint32_t ble_uuid128_t_enc(const void * const p_void_uuid, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_uuid); - -uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_header); - -uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - uint32_t * const p_event_len, - void * const p_void_evt_rx); - -uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_enable_params); - -uint32_t ble_conn_bw_t_enc(void const * const p_void_conn_bw, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_conn_bw_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw); - -uint32_t ble_common_opt_conn_bw_t_enc(void const * const p_void_opt_conn_bw, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_common_opt_conn_bw_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_opt_conn_bw); - -uint32_t ble_conn_bw_count_t_enc(void const * const p_void_conn_bw_count, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_conn_bw_count_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw_count); - -uint32_t ble_conn_bw_counts_t_enc(void const * const p_void_conn_bw_count, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_conn_bw_counts_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_conn_bw_count); - -uint32_t ble_common_enable_params_t_enc(void const * const p_void_common_enable_params, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_common_enable_params_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_common_enable_params); - -uint32_t ble_common_opt_pa_lna_t_enc(void const * const p_void_opt, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_common_opt_pa_lna_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_opt); - -uint32_t ble_pa_lna_cfg_t_enc(void const * const p_void_cfg, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t ble_pa_lna_cfg_t_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_void_cfg); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c deleted file mode 100644 index 2de56c4..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "nrf_soc_struct_serialization.h" -#include "ble_serialization.h" -#include "cond_field_serialization.h" -#include "app_util.h" -#include "string.h" - -uint32_t nrf_ecb_hal_data_t_in_enc(void const * const p_data, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data; - uint32_t err_code; - - err_code = buf_enc(p_ecb_data->key,SOC_ECB_KEY_LENGTH, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = buf_enc(p_ecb_data->cleartext,SOC_ECB_CLEARTEXT_LENGTH, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return NRF_SUCCESS; -} - -uint32_t nrf_ecb_hal_data_t_in_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_data) -{ - nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data; - uint32_t err_code; - - uint8_t * p_tmp = p_ecb_data->key; - err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_KEY_LENGTH,SOC_ECB_KEY_LENGTH); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - p_tmp = p_ecb_data->cleartext; - err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_CLEARTEXT_LENGTH, SOC_ECB_CLEARTEXT_LENGTH); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return NRF_SUCCESS; -} - -uint32_t nrf_ecb_hal_data_t_out_enc(void const * const p_data, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index) -{ - nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data; - uint32_t err_code; - - err_code = buf_enc(p_ecb_data->ciphertext,SOC_ECB_CIPHERTEXT_LENGTH, p_buf, buf_len, p_index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return NRF_SUCCESS; -} - -uint32_t nrf_ecb_hal_data_t_out_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_data) -{ - nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data; - uint32_t err_code; - - uint8_t * p_tmp = p_ecb_data->ciphertext; - err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_CIPHERTEXT_LENGTH, SOC_ECB_CIPHERTEXT_LENGTH); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h deleted file mode 100644 index 2a4b065..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "nrf_soc.h" - -uint32_t nrf_ecb_hal_data_t_in_enc(void const * const p_data, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t nrf_ecb_hal_data_t_in_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_data); - -uint32_t nrf_ecb_hal_data_t_out_enc(void const * const p_data, - uint8_t * const p_buf, - uint32_t buf_len, - uint32_t * const p_index); - -uint32_t nrf_ecb_hal_data_t_out_dec(uint8_t const * const p_buf, - uint32_t buf_len, - uint32_t * const p_index, - void * const p_data); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h deleted file mode 100644 index 88dfa01..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#ifndef DEBUG_HCI_CONFIG_NRF6310_H__ -#define DEBUG_HCI_CONFIG_NRF6310_H__ - -#include "boards.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// define CONN_DGB to prevent CONN chip from being reseted while connected via DBG -#define nCONN_DGB - -#define PIN_EVT_DBG - -#define LED_MEM_CALLBACK LED_3 -#define LED_RX_CALLBACK LED_4 -#define LED_TX_CALLBACK LED_5 -#define LED_DP_CALLBACK LED_6 -#define LED_TX_ERR_CALLBACK LED_7 - -#define PIO_SLIP_EVT_PKT_TX 24 -#define PIO_SLIP_EVT_ACK_TX 25 -#define PIO_SLIP_EVT_PKT_TXED 28 -#define PIO_SLIP_EVT_ACK_TXED 29 -#define PIO_SLIP_EVT_PKT_RXED 0 -#define PIO_SLIP_EVT_ACK_RXED 1 -#define PIO_TIMER_EVT_TIMEOUT 2 -#define PIO_HCI_RETX 3 -#define PIO_MAIN_BUSY 4 -#define PIO_TX_REQ 5 - -#define PIO_SLIP_EVT_ERR_RXED LED_2 // only pulses not change of state - - -#ifdef __cplusplus -} -#endif - -#endif //DEBUG_CONFIG_NRF6310_H__ - http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c deleted file mode 100644 index 8058da9..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c +++ /dev/null @@ -1,228 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include <stddef.h> -#include <stdint.h> -#include "nrf_delay.h" -#include "nrf_gpio.h" - -#ifdef SER_PHY_HCI_DEBUG_ENABLE - -#include "ser_phy_debug_comm.h" -#include "debug_hci_config_nRF6310.h" -#include "app_error.h" - -#define LED_BLINK_us 1 /* 1 us */ - -static hci_dbg_event_handler_t m_hci_dbg_event_handler = NULL; - -static void pio_blink(uint8_t led) -{ - nrf_gpio_pin_set(led); - nrf_delay_us(LED_BLINK_us); - nrf_gpio_pin_clear(led); -} - - -static void Debug_PulseOnMemCallback() -{ - pio_blink(LED_MEM_CALLBACK); -} - - -static void Debug_PulseOnRxCallback() -{ - pio_blink(LED_RX_CALLBACK); -} - - -static void Debug_PulseOnTxCallback() -{ - pio_blink(LED_TX_CALLBACK); -} - - -static void Debug_PulseOnPacketDroppedCallback() -{ - pio_blink(LED_DP_CALLBACK); -} - -static void Debug_PulseOnTxError() -{ - pio_blink(LED_TX_ERR_CALLBACK); -} - -static void Debug_PulseOnPacketTX() -{ - pio_blink(PIO_SLIP_EVT_PKT_TX); -} - -static void Debug_PulseOnAckTX() -{ - pio_blink(PIO_SLIP_EVT_ACK_TX); -} - -static void Debug_PulseOnPacketTXED() -{ - pio_blink(PIO_SLIP_EVT_PKT_TXED); -} - -static void Debug_PulseOnAckTXED() -{ - pio_blink(PIO_SLIP_EVT_ACK_TXED); -} - -static void Debug_PulseOnPacketRXED() -{ - pio_blink(PIO_SLIP_EVT_PKT_RXED); -} - -static void Debug_PulseOnAckRXED() -{ - pio_blink(PIO_SLIP_EVT_ACK_RXED); -} - -static void Debug_PulseOnErrRXED() -{ - pio_blink(PIO_SLIP_EVT_ERR_RXED); - /* throw assert when in debug mode*/ - APP_ERROR_CHECK_BOOL(false); -} - -static void Debug_PulseOnTimer() -{ - pio_blink(PIO_TIMER_EVT_TIMEOUT); -} - -static void Debug_PulseOnRETX() -{ - pio_blink(PIO_HCI_RETX); -} - -static void Debug_LevelOnBusy(uint32_t data) -{ - if (data) - { - nrf_gpio_pin_set(PIO_MAIN_BUSY); - } - else - { - nrf_gpio_pin_clear(PIO_MAIN_BUSY); - } -} - -static void Debug_PulseOnTXReq() -{ - pio_blink(PIO_TX_REQ); -} - -static void default_hci_event_handler(hci_dbg_evt_t event) -{ - switch (event.evt) - { - case HCI_PHY_EVT_TX_PKT_SENT: - Debug_PulseOnTxCallback(); - break; - case HCI_PHY_EVT_BUF_REQUEST: - Debug_PulseOnMemCallback(); - break; - case HCI_PHY_EVT_RX_PKT_RECEIVED: - Debug_PulseOnRxCallback(); - break; - case HCI_PHY_EVT_RX_PKT_DROPPED: - Debug_PulseOnPacketDroppedCallback(); - break; - case HCI_PHY_EVT_TX_ERROR: - Debug_PulseOnTxError(); - break; - case HCI_SLIP_EVT_PACKET_TX: - Debug_PulseOnPacketTX(); - break; - case HCI_SLIP_EVT_ACK_TX: - Debug_PulseOnAckTX(); - break; - case HCI_SLIP_EVT_PACKET_TXED: - Debug_PulseOnPacketTXED(); - break; - case HCI_SLIP_EVT_ACK_TXED: - Debug_PulseOnAckTXED(); - break; - case HCI_SLIP_EVT_PACKET_RXED: - Debug_PulseOnPacketRXED(); - break; - case HCI_SLIP_EVT_ACK_RXED: - Debug_PulseOnAckRXED(); - break; - case HCI_SLIP_EVT_ERR_RXED: - Debug_PulseOnErrRXED(); - break; - case HCI_TIMER_EVT_TIMEOUT: - Debug_PulseOnTimer(); - break; - case HCI_RETX: - Debug_PulseOnRETX(); - break; - case HCI_MAIN_BUSY: - Debug_LevelOnBusy(event.data); - break; - case HCI_TX_REQ: - Debug_PulseOnTXReq(); - break; - - default: - break; - } - return; -} - - -void debug_init(hci_dbg_event_handler_t evt_callback) -{ - //Configure all LED as outputs. - nrf_gpio_range_cfg_output(LED_START, LED_STOP); - - nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TX); - nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TX); - nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TXED); - nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TXED); - nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_RXED); - nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_RXED); - nrf_gpio_cfg_output(PIO_TIMER_EVT_TIMEOUT); - nrf_gpio_cfg_output(PIO_HCI_RETX); - nrf_gpio_cfg_output(PIO_MAIN_BUSY); - nrf_gpio_cfg_output(PIO_TX_REQ); - m_hci_dbg_event_handler = evt_callback; - if (evt_callback) - { - m_hci_dbg_event_handler = evt_callback; - } - else - { - m_hci_dbg_event_handler = default_hci_event_handler; - } - -} - - -void debug_evt(hci_dbg_evt_type_t evt, uint32_t data) -{ - hci_dbg_evt_t event; - event.evt = evt; - event.data = data; - - if (m_hci_dbg_event_handler) - { - m_hci_dbg_event_handler(event); - } -} - -#endif http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h deleted file mode 100644 index c7e5346..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#ifndef DTM_UART_PARAMS_H__ -#define DTM_UART_PARAMS_H__ - -#include <stdbool.h> -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup ble_dtm_app - */ - - -/**@brief Enumeration of supported baud rates. */ -typedef enum -{ - UART_BAUD_RATE_1200, /**< Baud rate 1200. */ - UART_BAUD_RATE_2400, /**< Baud rate 2400. */ - UART_BAUD_RATE_4800, /**< Baud rate 4800. */ - UART_BAUD_RATE_9600, /**< Baud rate 9600. */ - UART_BAUD_RATE_14400, /**< Baud rate 14400. */ - UART_BAUD_RATE_19200, /**< Baud rate 19200. */ - UART_BAUD_RATE_28800, /**< Baud rate 28800. */ - UART_BAUD_RATE_38400, /**< Baud rate 38400. */ - UART_BAUD_RATE_57600, /**< Baud rate 57600. */ - UART_BAUD_RATE_76800, /**< Baud rate 76800. */ - UART_BAUD_RATE_115200, /**< Baud rate 115200. */ - UART_BAUD_RATE_230400, /**< Baud rate 230400. */ - UART_BAUD_RATE_250000, /**< Baud rate 250000. */ - UART_BAUD_RATE_460800, /**< Baud rate 460800. */ - UART_BAUD_RATE_921600, /**< Baud rate 921600. */ - UART_BAUD_RATE_1000000, /**< Baud rate 1000000. */ - UART_BAUD_RATE_MAX /**< Enumeration upper bound. */ -} app_uart_stream_baud_rate_t; - -/**@brief UART communication structure holding configuration settings for the peripheral. - */ -typedef struct -{ - uint8_t rx_pin_no; /**< RX pin number. */ - uint8_t tx_pin_no; /**< TX pin number. */ - uint8_t rts_pin_no; /**< RTS pin number, only used if flow control is enabled. */ - uint8_t cts_pin_no; /**< CTS pin number, only used if flow control is enabled. */ - bool use_parity; /**< Even parity if TRUE, no parity if FALSE. */ - app_uart_stream_baud_rate_t baud_rate; /**< Baud rate configuration. */ -} app_uart_stream_comm_params_t; - -#ifdef __cplusplus -} -#endif - -#endif // DTM_UART_PARAMS_H__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c deleted file mode 100644 index 30a9fc9..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c +++ /dev/null @@ -1,460 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include <stdbool.h> -#include <string.h> -#include "app_error.h" -#include "ser_config.h" -#include "ser_phy.h" -#include "ser_hal_transport.h" - -/** - * @brief States of the RX state machine. - */ -typedef enum -{ - HAL_TRANSP_RX_STATE_CLOSED = 0, - HAL_TRANSP_RX_STATE_IDLE, - HAL_TRANSP_RX_STATE_RECEIVING, - HAL_TRANSP_RX_STATE_DROPPING, - HAL_TRANSP_RX_STATE_RECEIVED, - HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ, - HAL_TRANSP_RX_STATE_RECEIVED_DROPPING, - HAL_TRANSP_RX_STATE_MAX -}ser_hal_transp_rx_states_t; - -/** - * @brief States of the TX state machine. - */ -typedef enum -{ - HAL_TRANSP_TX_STATE_CLOSED = 0, - HAL_TRANSP_TX_STATE_IDLE, - HAL_TRANSP_TX_STATE_TX_ALLOCATED, - HAL_TRANSP_TX_STATE_TRANSMITTING, - HAL_TRANSP_TX_STATE_TRANSMITTED, - HAL_TRANSP_TX_STATE_MAX -}ser_hal_transp_tx_states_t; - -/** - * @brief RX state. - */ -static ser_hal_transp_rx_states_t m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; -/** - * @brief TX state. - */ -static ser_hal_transp_tx_states_t m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; - -/** - * @brief Transmission buffer. - */ -static uint8_t m_tx_buffer[SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE]; -/** - * @brief Reception buffer. - */ -static uint8_t m_rx_buffer[SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE]; - -/** - * @brief Callback function handler for Serialization HAL Transport layer events. - */ -static ser_hal_transport_events_handler_t m_events_handler = NULL; - - -/** - * @brief A callback function to be used to handle a PHY module events. This function is called in - * an interrupt context. - */ -static void phy_events_handler(ser_phy_evt_t phy_event) -{ - uint32_t err_code = 0; - ser_hal_transport_evt_t hal_transp_event; - - memset(&hal_transp_event, 0, sizeof (ser_hal_transport_evt_t)); - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TYPE_MAX; - - switch (phy_event.evt_type) - { - case SER_PHY_EVT_TX_PKT_SENT: - { - if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) - { - m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; - err_code = ser_hal_transport_tx_pkt_free(m_tx_buffer); - APP_ERROR_CHECK(err_code); - /* An event to an upper layer that a packet has been transmitted. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TX_PKT_SENT; - m_events_handler(hal_transp_event); - } - else - { - /* Lower layer should not generate this event in current state. */ - APP_ERROR_CHECK_BOOL(false); - } - break; - } - - case SER_PHY_EVT_RX_BUF_REQUEST: - { - /* An event to an upper layer that a packet is being scheduled to receive or to drop. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING; - - /* Receive or drop a packet. */ - if (phy_event.evt_params.rx_buf_request.num_of_bytes <= sizeof (m_rx_buffer)) - { - if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) - { - m_events_handler(hal_transp_event); - err_code = ser_phy_rx_buf_set(m_rx_buffer); - APP_ERROR_CHECK(err_code); - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) - { - /* It is OK to get know higher layer at this point that we are going to receive - * a new packet even though we will start receiving when rx buffer is freed. */ - m_events_handler(hal_transp_event); - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ; - } - else - { - /* Lower layer should not generate this event in current state. */ - APP_ERROR_CHECK_BOOL(false); - } - } - else - { - /* There is not enough memory but packet has to be received to dummy location. */ - if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) - { - m_events_handler(hal_transp_event); - err_code = ser_phy_rx_buf_set(NULL); - APP_ERROR_CHECK(err_code); - m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) - { - m_events_handler(hal_transp_event); - err_code = ser_phy_rx_buf_set(NULL); - APP_ERROR_CHECK(err_code); - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_DROPPING; - } - else - { - /* Lower layer should not generate this event in current state. */ - APP_ERROR_CHECK_BOOL(false); - } - } - break; - } - - case SER_PHY_EVT_RX_PKT_RECEIVED: - { - if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) - { - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = - SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED; - hal_transp_event.evt_params.rx_pkt_received.p_buffer = - phy_event.evt_params.rx_pkt_received.p_buffer; - hal_transp_event.evt_params.rx_pkt_received.num_of_bytes = - phy_event.evt_params.rx_pkt_received.num_of_bytes; - m_events_handler(hal_transp_event); - } - else - { - /* Lower layer should not generate this event in current state. */ - APP_ERROR_CHECK_BOOL(false); - } - break; - } - - case SER_PHY_EVT_RX_PKT_DROPPED: - { - if (HAL_TRANSP_RX_STATE_DROPPING == m_rx_state) - { - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; - m_events_handler(hal_transp_event); - m_rx_state = HAL_TRANSP_RX_STATE_IDLE; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) - { - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; - m_events_handler(hal_transp_event); - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; - } - else - { - /* Lower layer should not generate this event in current state. */ - APP_ERROR_CHECK_BOOL(false); - } - break; - } - - case SER_PHY_EVT_RX_OVERFLOW_ERROR: - { - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; - hal_transp_event.evt_params.phy_error.error_type = - SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW; - m_events_handler(hal_transp_event); - break; - } - - case SER_PHY_EVT_TX_OVERREAD_ERROR: - { - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; - hal_transp_event.evt_params.phy_error.error_type = - SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD; - m_events_handler(hal_transp_event); - break; - } - - case SER_PHY_EVT_HW_ERROR: - { - /* Generate the event to an upper layer. */ - hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; - hal_transp_event.evt_params.phy_error.error_type = - SER_HAL_TRANSP_PHY_ERROR_HW_ERROR; - hal_transp_event.evt_params.phy_error.hw_error_code = - phy_event.evt_params.hw_error.error_code; - if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) - { - m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; - err_code = ser_hal_transport_tx_pkt_free(phy_event.evt_params.hw_error.p_buffer); - APP_ERROR_CHECK(err_code); - /* An event to an upper layer that a packet has been transmitted. */ - } - else if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) - { - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; - err_code = ser_hal_transport_rx_pkt_free(phy_event.evt_params.hw_error.p_buffer); - APP_ERROR_CHECK(err_code); - } - m_events_handler(hal_transp_event); - - break; - } - - default: - { - APP_ERROR_CHECK_BOOL(false); - break; - } - } -} - -uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler) -{ - uint32_t err_code = NRF_SUCCESS; - - if ((HAL_TRANSP_RX_STATE_CLOSED != m_rx_state) || (HAL_TRANSP_TX_STATE_CLOSED != m_tx_state)) - { - err_code = NRF_ERROR_INVALID_STATE; - } - else if (NULL == events_handler) - { - err_code = NRF_ERROR_NULL; - } - else - { - /* We have to change states before calling lower layer because ser_phy_open() function is - * going to enable interrupts. On success an event from PHY layer can be emitted immediately - * after return from ser_phy_open(). */ - m_rx_state = HAL_TRANSP_RX_STATE_IDLE; - m_tx_state = HAL_TRANSP_TX_STATE_IDLE; - - m_events_handler = events_handler; - - /* Initialize a PHY module. */ - err_code = ser_phy_open(phy_events_handler); - - if (NRF_SUCCESS != err_code) - { - m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; - m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; - m_events_handler = NULL; - - if (NRF_ERROR_INVALID_PARAM != err_code) - { - err_code = NRF_ERROR_INTERNAL; - } - } - } - - return err_code; -} - - -void ser_hal_transport_close(void) -{ - /* Reset generic handler for all events, reset internal states and close PHY module. */ - ser_phy_interrupts_disable(); - m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; - m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; - - m_events_handler = NULL; - - ser_phy_close(); -} - - -uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer) -{ - uint32_t err_code = NRF_SUCCESS; - - ser_phy_interrupts_disable(); - - if (NULL == p_buffer) - { - err_code = NRF_ERROR_NULL; - } - else if (p_buffer != m_rx_buffer) - { - err_code = NRF_ERROR_INVALID_ADDR; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) - { - m_rx_state = HAL_TRANSP_RX_STATE_IDLE; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) - { - m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; - } - else if (HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ == m_rx_state) - { - err_code = ser_phy_rx_buf_set(m_rx_buffer); - - if (NRF_SUCCESS == err_code) - { - m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; - } - else - { - err_code = NRF_ERROR_INTERNAL; - } - } - else - { - /* Upper layer should not call this function in current state. */ - err_code = NRF_ERROR_INVALID_STATE; - } - ser_phy_interrupts_enable(); - - return err_code; -} - - -uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t * * pp_memory, uint16_t * p_num_of_bytes) -{ - uint32_t err_code = NRF_SUCCESS; - - if ((NULL == pp_memory) || (NULL == p_num_of_bytes)) - { - err_code = NRF_ERROR_NULL; - } - else if (HAL_TRANSP_TX_STATE_CLOSED == m_tx_state) - { - err_code = NRF_ERROR_INVALID_STATE; - } - else if (HAL_TRANSP_TX_STATE_IDLE == m_tx_state) - { - m_tx_state = HAL_TRANSP_TX_STATE_TX_ALLOCATED; - *pp_memory = &m_tx_buffer[0]; - *p_num_of_bytes = (uint16_t)sizeof (m_tx_buffer); - } - else - { - err_code = NRF_ERROR_NO_MEM; - } - - return err_code; -} - - -uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) -{ - uint32_t err_code = NRF_SUCCESS; - - /* The buffer provided to this function must be allocated through ser_hal_transport_tx_alloc() - * function - this assures correct state and that correct memory buffer is used. */ - if (NULL == p_buffer) - { - err_code = NRF_ERROR_NULL; - } - else if (0 == num_of_bytes) - { - err_code = NRF_ERROR_INVALID_PARAM; - } - else if (p_buffer != m_tx_buffer) - { - err_code = NRF_ERROR_INVALID_ADDR; - } - else if (num_of_bytes > sizeof (m_tx_buffer)) - { - err_code = NRF_ERROR_DATA_SIZE; - } - else if (HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) - { - ser_phy_interrupts_disable(); - err_code = ser_phy_tx_pkt_send(p_buffer, num_of_bytes); - - if (NRF_SUCCESS == err_code) - { - m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTING; - } - else - { - if (NRF_ERROR_BUSY != err_code) - { - err_code = NRF_ERROR_INTERNAL; - } - } - ser_phy_interrupts_enable(); - } - else - { - err_code = NRF_ERROR_INVALID_STATE; - } - - return err_code; -} - - -uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer) -{ - uint32_t err_code = NRF_SUCCESS; - - if (NULL == p_buffer) - { - err_code = NRF_ERROR_NULL; - } - else if (p_buffer != m_tx_buffer) - { - err_code = NRF_ERROR_INVALID_ADDR; - } - else if ((HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) || - (HAL_TRANSP_TX_STATE_TRANSMITTED == m_tx_state)) - { - /* Release TX buffer for use. */ - m_tx_state = HAL_TRANSP_TX_STATE_IDLE; - } - else - { - err_code = NRF_ERROR_INVALID_STATE; - } - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h deleted file mode 100644 index e8e90f2..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -/** @file - * - * @defgroup ser_hal_transport Serialization HAL Transport - * @{ - * @ingroup ble_sdk_lib_serialization - * - * @brief HAL Transport layer for serialization. - * - * @details This file contains declarations of functions and typedefs used as API of the HAL - * Transport layer for serialization. This layer is fully hardware independent. - * Currently the HAL Transport layer is responsible for controlling the PHY layer and - * memory management. In the future it is possible to add more feature to it as: crc, - * retransmission etc. - * - * \n \n - * \image html ser_hal_transport_rx_state_machine.png "RX state machine" - * \n \n - * \image html ser_hal_transport_tx_state_machine.png "TX state machine" - * \n - */ - -#ifndef SER_HAL_TRANSPORT_H__ -#define SER_HAL_TRANSPORT_H__ - -#include <stdint.h> - - -#ifdef __cplusplus -extern "C" { -#endif - -/**@brief Serialization HAL Transport layer event types. */ -typedef enum -{ - SER_HAL_TRANSP_EVT_TX_PKT_SENT = 0, /**< An event indicating that TX packet has been - transmitted. */ - SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING, /**< An event indicating that RX packet is being - scheduled to receive or to drop. */ - SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED, /**< An event indicating that RX packet is ready for - read. */ - SER_HAL_TRANSP_EVT_RX_PKT_DROPPED, /**< An event indicating that RX packet was dropped - because it was longer than available buffer. */ - SER_HAL_TRANSP_EVT_PHY_ERROR, /**< An event indicating error on PHY layer. */ - SER_HAL_TRANSP_EVT_TYPE_MAX /**< Enumeration upper bound. */ -} ser_hal_transport_evt_type_t; - - -/**@brief Serialization PHY layer error types. */ -typedef enum -{ - SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW = 0, /**< An error indicating that more information has - been transmitted than phy module could handle. */ - SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD, /**< An error indicating that phy module was forced to - transmit more information than possessed. */ - SER_HAL_TRANSP_PHY_ERROR_HW_ERROR, /**< An error indicating a hardware error in a phy - module. */ - SER_HAL_TRANSP_PHY_ERROR_TYPE_MAX /**< Enumeration upper bound. */ -} ser_hal_transport_phy_error_type_t; - - -/**@brief A struct containing parameters of the event of type - * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. - */ -typedef struct -{ - uint8_t * p_buffer; /**< Pointer to a buffer containing a packet to read. */ - uint16_t num_of_bytes; /**< Length of a received packet in octets. */ -} ser_hal_transport_evt_rx_pkt_received_params_t; - - -/**@brief A struct containing parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */ -typedef struct -{ - ser_hal_transport_phy_error_type_t error_type; /**< Type of PHY error. */ - uint32_t hw_error_code; /**< Hardware error code - specific for any microcontroller. Parameter - is valid only for the phy error of type - @ref SER_HAL_TRANSP_PHY_ERROR_HW_ERROR. */ -} ser_hal_transport_evt_phy_error_params_t; - - -/**@brief A struct containing events from the Serialization HAL Transport layer. - * - * @note Some events do not have parameters, then whole information is contained in the evt_type. - */ -typedef struct -{ - ser_hal_transport_evt_type_t evt_type; /**< Type of event. */ - union /**< Union alternative identified by evt_type in enclosing struct. */ - { - ser_hal_transport_evt_rx_pkt_received_params_t rx_pkt_received; /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. */ - ser_hal_transport_evt_phy_error_params_t phy_error; /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */ - } evt_params; -} ser_hal_transport_evt_t; - - -/**@brief A generic callback function type to be used by all Serialization HAL Transport layer - * events. - * - * @param[in] event Serialization HAL Transport layer event. - */ -typedef void (*ser_hal_transport_events_handler_t)(ser_hal_transport_evt_t event); - - -/**@brief A function for opening and initializing the Serialization HAL Transport layer. - * - * @note The function opens the transport channel, initializes a PHY layer and registers callback - * function to be used by all Serialization HAL Transport layer events. - * - * @warning If the function has been already called, the function @ref ser_hal_transport_close has - * to be called before ser_hal_transport_open can be called again. - * - * @param[in] events_handler Generic callback function to be used by all Serialization HAL - * Transport layer events. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Hardware initialization parameters taken from - * the configuration file are wrong. - * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. To call - * it again the function @ref ser_hal_transport_close has to be - * called previously. - * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. - */ -uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler); - - -/**@brief A function for closing a transport channel. - * - * @note The function disables hardware, resets internal module states and unregisters events - * callback function. Can be called multiple times, also for not opened channel. - */ -void ser_hal_transport_close(void); - - -/**@brief A function for freeing a memory allocated for RX packet. - * - * @note The function should be called as a response to an event of type - * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED when received data has beed processed. The function - * frees an RX memory pointed by p_buffer. The memory, immediately or at a later time, is - * reused by the underlying transport layer. - * - * @param[in] p_buffer A pointer to the beginning of a buffer that has been processed (has to be - * the same address as provided in an event of type - * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED). - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not - * the starting address of a buffer managed by HAL Transport layer). - * @retval NRF_ERROR_INVALID_STATE Operation failure. The function should be called as a response - * to an event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. - * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. - */ -uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer); - - -/**@brief A function for allocating a memory for TX packet. - * - * @param[out] pp_memory A pointer to pointer to which an address of the beginning of the - * allocated buffer is written. - * @param[out] p_num_of_bytes A pointer to a variable to which size in octets of the allocated - * buffer is written. - * - * @retval NRF_SUCCESS Operation success. Memory was allocated. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. - * @retval NRF_ERROR_NO_MEM Operation failure. No memory available. - * @retval NRF_ERROR_INVALID_STATE Operation failure. The function was called before calling - * @ref ser_hal_transport_open function. - */ -uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t ** pp_memory, uint16_t * p_num_of_bytes); - -/**@brief A function for transmitting a packet. - * - * @note The function adds a packet pointed by p_buffer parameter to a transmission queue. A buffer - * provided to this function must be allocated by @ref ser_hal_transport_tx_pkt_alloc function. - * - * @warning Completion of this method does not guarantee that actual peripheral transmission would - * have completed. - * - * @param[in] p_buffer A pointer to a buffer to transmit. - * @param[in] num_of_bytes Number of octets to transmit. Must be more than 0. - * - * @retval NRF_SUCCESS Operation success. Packet was added to the transmission queue. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. num_of_bytes is equal to 0. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not - * the starting address of a buffer managed by HAL Transport layer). - * @retval NRF_ERROR_DATA_SIZE Operation failure. Packet size exceeds limit. - * @retval NRF_ERROR_BUSY Operation failure. Transmission queue is full so packet was not - * added to the transmission queue. - * @retval NRF_ERROR_INVALID_STATE Operation failure. Transmittion channel was not opened by - * @ref ser_hal_transport_open function or provided buffer was not - * allocated by @ref ser_hal_transport_tx_pkt_alloc function. - * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. - */ -uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes); - - -/**@brief A function for freeing a memory allocated for TX packet. - * - * @note The function frees a TX memory pointed by p_buffer. Freeing a TX buffer is possible only if - * the buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc function and transmittion - * is not in progress. When transmittion has finished this function is automatically called by - * the Serialization HAL Transport layer, so the only case when this function should be used - * from outside is when a TX buffer was allocated but a transmittion has not been started - * (@ref ser_hal_transport_tx_pkt_send function has not been called). - * - * @param[in] p_buffer A pointer to the beginning of a buffer that has been allocated by - * @ref ser_hal_transport_tx_pkt_alloc function. - * - * @retval NRF_SUCCESS Operation success. Memory was freed. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not - * the starting address of a buffer managed by HAL Transport layer). - * @retval NRF_ERROR_INVALID_STATE Operation failure. Freeing a TX buffer is possible only if the - * buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc - * function and transmittion is not in progress. - */ -uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer); - - -#ifdef __cplusplus -} -#endif - -#endif /* SER_HAL_TRANSPORT_H__ */ -/** @} */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h deleted file mode 100644 index 9a4af06..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#ifndef SER_CONFIG_5W_APP_H__ -#define SER_CONFIG_5W_APP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SER_CONFIG_APP_H__ */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h deleted file mode 100644 index eaa6639..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#ifndef SER_CONFIG_APP_HAL_NRF51_H__ -#define SER_CONFIG_APP_HAL_NRF51_H__ - -#include "boards.h" -#include "ser_config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(SPI_MASTER_0_ENABLE) -#define SER_PHY_SPI_MASTER SPI_MASTER_0 -#endif -#if defined(SPI_MASTER_1_ENABLE) -#define SER_PHY_SPI_MASTER SPI_MASTER_1 -#endif -#if defined(SPI_MASTER_2_ENABLE) -#define SER_PHY_SPI_MASTER SPI_MASTER_2 -#endif - -#if (defined(SPI0_ENABLED) && (SPI0_ENABLED == 1)) || defined(SPI_MASTER_0_ENABLE) - -#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(0) -#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM0_SCK_PIN -#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM0_MISO_PIN -#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM0_MOSI_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM0_SS_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM0_REQ_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM0_RDY_PIN - -#elif (defined(SPI1_ENABLED) && (SPI1_ENABLED == 1)) || defined(SPI_MASTER_1_ENABLE) - -#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(1) -#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM1_SCK_PIN -#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM1_MISO_PIN -#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM1_MOSI_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM1_SS_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM1_REQ_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM1_RDY_PIN - -#elif (defined(SPI2_ENABLED) && (SPI2_ENABLED == 1)) || defined(SPI_MASTER_2_ENABLE) - -#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(2) -#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM2_SCK_PIN -#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM2_MISO_PIN -#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM2_MOSI_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM2_SS_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM2_REQ_PIN -#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM2_RDY_PIN - -#endif - -#define CONN_CHIP_RESET_PIN_NO SER_CONN_CHIP_RESET_PIN /**< Pin used for reseting the nRF51822. */ - -/* UART configuration */ -#define UART_IRQ_PRIORITY APP_IRQ_PRIORITY_MID -#define SER_PHY_UART_RX SER_APP_RX_PIN -#define SER_PHY_UART_TX SER_APP_TX_PIN -#define SER_PHY_UART_CTS SER_APP_CTS_PIN -#define SER_PHY_UART_RTS SER_APP_RTS_PIN - -#ifdef __cplusplus -} -#endif - -#endif //SER_CONFIG_APP_HAL_NRF51_H__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h deleted file mode 100644 index a929845..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h +++ /dev/null @@ -1,50 +0,0 @@ - /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#ifndef SER_PHY_CONFIG_CONN_NRF51_H__ -#define SER_PHY_CONFIG_CONN_NRF51_H__ - -#include "boards.h" -#include "ser_config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/***********************************************************************************************//** - * SER_PHY layer configuration. - **************************************************************************************************/ -#define SER_PHY_SPI_PPI_RDY_CH 0 -#define SER_PHY_SPI_GPIOTE_RDY_CH 0 - -#define SER_PHY_SPI_SLAVE_INSTANCE 1 - -#define SER_PHY_SPI_SLAVE_REQ_PIN SER_CON_SPIS_REQ_PIN -#define SER_PHY_SPI_SLAVE_RDY_PIN SER_CON_SPIS_RDY_PIN -#define SER_PHY_SPI_SLAVE_SCK_PIN SER_CON_SPIS_SCK_PIN -#define SER_PHY_SPI_SLAVE_MISO_PIN SER_CON_SPIS_MISO_PIN -#define SER_PHY_SPI_SLAVE_MOSI_PIN SER_CON_SPIS_MOSI_PIN -#define SER_PHY_SPI_SLAVE_SS_PIN SER_CON_SPIS_CSN_PIN - -/* UART configuration */ -#define UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW - -#define SER_PHY_UART_RX SER_CON_RX_PIN -#define SER_PHY_UART_TX SER_CON_TX_PIN -#define SER_PHY_UART_CTS SER_CON_CTS_PIN -#define SER_PHY_UART_RTS SER_CON_RTS_PIN - -#ifdef __cplusplus -} -#endif - -#endif //SER_PHY_CONFIG_CONN_NRF51_H__
