<commit_before>// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// The HAL layer for SDIO slave (common part)

#include <soc/slc_struct.h>
#include <soc/hinf_struct.h>
#include <hal/sdio_slave_types.h>
#include <soc/host_struct.h>
#include <string.h>
#include "hal/sdio_slave_hal.h"
#include "hal/hal_defs.h"
#include "esp_attr.h"


#define SDIO_SLAVE_CHECK(res, str, ret_val) do { if(!(res)){\
    HAL_LOGE(TAG, "%s", str);\
    return ret_val;\
} }while (0)

const char TAG[] = "SDIO_HAL";

static esp_err_t init_send_queue(sdio_slave_context_t *hal);

/**************** Ring buffer for SDIO sending use *****************/
typedef enum {
    RINGBUF_GET_ONE = 0,
    RINGBUF_GET_ALL = 1,
} ringbuf_get_all_t;

typedef enum {
    RINGBUF_WRITE_PTR,
    RINGBUF_READ_PTR,
    RINGBUF_FREE_PTR,
} sdio_ringbuf_pointer_t;

static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t *buf, esp_err_t (*copy_callback)(uint8_t *, void *), void *arg);
static inline esp_err_t sdio_ringbuf_recv(sdio_ringbuf_t *buf, uint8_t **start, uint8_t **end, ringbuf_get_all_t get_all);
static inline int sdio_ringbuf_return(sdio_ringbuf_t* buf, uint8_t *ptr);

#define _SEND_DESC_NEXT(x)    STAILQ_NEXT(&((sdio_slave_hal_send_desc_t*)x)->dma_desc, qe)
#define SEND_DESC_NEXT(x)    (sdio_slave_hal_send_desc_t*)_SEND_DESC_NEXT(x)<commit_msg>sdio_slave_hal: fix the TAG non-static issue<commit_after>// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// The HAL layer for SDIO slave (common part)

#include <soc/slc_struct.h>
#include <soc/hinf_struct.h>
#include <hal/sdio_slave_types.h>
#include <soc/host_struct.h>
#include <string.h>
#include "hal/sdio_slave_hal.h"
#include "hal/hal_defs.h"
#include "esp_attr.h"


#define SDIO_SLAVE_CHECK(res, str, ret_val) do { if(!(res)){\
    HAL_LOGE(TAG, "%s", str);\
    return ret_val;\
} }while (0)

static const char TAG[] = "SDIO_HAL";

static esp_err_t init_send_queue(sdio_slave_context_t *hal);

/**************** Ring buffer for SDIO sending use *****************/
typedef enum {
    RINGBUF_GET_ONE = 0,
    RINGBUF_GET_ALL = 1,
} ringbuf_get_all_t;

typedef enum {
    RINGBUF_WRITE_PTR,
    RINGBUF_READ_PTR,
    RINGBUF_FREE_PTR,
} sdio_ringbuf_pointer_t;

static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t *buf, esp_err_t (*copy_callback)(uint8_t *, void *), void *arg);
static inline esp_err_t sdio_ringbuf_recv(sdio_ringbuf_t *buf, uint8_t **start, uint8_t **end, ringbuf_get_all_t get_all);
static inline int sdio_ringbuf_return(sdio_ringbuf_t* buf, uint8_t *ptr);

#define _SEND_DESC_NEXT(x)    STAILQ_NEXT(&((sdio_slave_hal_send_desc_t*)x)->dma_desc, qe)
#define SEND_DESC_NEXT(x)    (sdio_slave_hal_send_desc_t*)_SEND_DESC_NEXT(x)
{'fraction_non_alphanumeric': 0.1256572029442692, 'fraction_numerical': 0.009989484752891693, 'mean_word_length': 4.908385093167702, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3091424', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1365, 'n_words': 373}