this is testing

Committer:
pmallick
Date:
Thu Jan 14 18:54:16 2021 +0530
Revision:
0:3afcd581558d
this is testing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pmallick 0:3afcd581558d 1 /***************************************************************************//**
pmallick 0:3afcd581558d 2 * @file circular_buffer.h
pmallick 0:3afcd581558d 3 * @brief Circular buffer library header
pmallick 0:3afcd581558d 4 * @author Mihail Chindris (mihail.chindris@analog.com)
pmallick 0:3afcd581558d 5 ********************************************************************************
pmallick 0:3afcd581558d 6 * @copyright
pmallick 0:3afcd581558d 7 * Copyright 2020(c) Analog Devices, Inc.
pmallick 0:3afcd581558d 8 *
pmallick 0:3afcd581558d 9 * All rights reserved.
pmallick 0:3afcd581558d 10 *
pmallick 0:3afcd581558d 11 * Redistribution and use in source and binary forms, with or without
pmallick 0:3afcd581558d 12 * modification, are permitted provided that the following conditions are met:
pmallick 0:3afcd581558d 13 * - Redistributions of source code must retain the above copyright
pmallick 0:3afcd581558d 14 * notice, this list of conditions and the following disclaimer.
pmallick 0:3afcd581558d 15 * - Redistributions in binary form must reproduce the above copyright
pmallick 0:3afcd581558d 16 * notice, this list of conditions and the following disclaimer in
pmallick 0:3afcd581558d 17 * the documentation and/or other materials provided with the
pmallick 0:3afcd581558d 18 * distribution.
pmallick 0:3afcd581558d 19 * - Neither the name of Analog Devices, Inc. nor the names of its
pmallick 0:3afcd581558d 20 * contributors may be used to endorse or promote products derived
pmallick 0:3afcd581558d 21 * from this software without specific prior written permission.
pmallick 0:3afcd581558d 22 * - The use of this software may or may not infringe the patent rights
pmallick 0:3afcd581558d 23 * of one or more patent holders. This license does not release you
pmallick 0:3afcd581558d 24 * from the requirement that you obtain separate licenses from these
pmallick 0:3afcd581558d 25 * patent holders to use this software.
pmallick 0:3afcd581558d 26 * - Use of the software either in source or binary form, must be run
pmallick 0:3afcd581558d 27 * on or directly connected to an Analog Devices Inc. component.
pmallick 0:3afcd581558d 28 *
pmallick 0:3afcd581558d 29 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
pmallick 0:3afcd581558d 30 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
pmallick 0:3afcd581558d 31 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
pmallick 0:3afcd581558d 32 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
pmallick 0:3afcd581558d 33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
pmallick 0:3afcd581558d 34 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
pmallick 0:3afcd581558d 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
pmallick 0:3afcd581558d 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
pmallick 0:3afcd581558d 37 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
pmallick 0:3afcd581558d 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pmallick 0:3afcd581558d 39 *******************************************************************************/
pmallick 0:3afcd581558d 40
pmallick 0:3afcd581558d 41 #ifndef CIRCULAR_BUFFER_H
pmallick 0:3afcd581558d 42 #define CIRCULAR_BUFFER_H
pmallick 0:3afcd581558d 43
pmallick 0:3afcd581558d 44 /******************************************************************************/
pmallick 0:3afcd581558d 45 /***************************** Include Files **********************************/
pmallick 0:3afcd581558d 46 /******************************************************************************/
pmallick 0:3afcd581558d 47
pmallick 0:3afcd581558d 48 #include <stdint.h>
pmallick 0:3afcd581558d 49
pmallick 0:3afcd581558d 50 /******************************************************************************/
pmallick 0:3afcd581558d 51 /*************************** Types Declarations *******************************/
pmallick 0:3afcd581558d 52 /******************************************************************************/
pmallick 0:3afcd581558d 53
pmallick 0:3afcd581558d 54 /**
pmallick 0:3afcd581558d 55 * @brief Reference type for circular buffer
pmallick 0:3afcd581558d 56 *
pmallick 0:3afcd581558d 57 * Abstract type of the circular buffer, used as reference for the functions.
pmallick 0:3afcd581558d 58 */
pmallick 0:3afcd581558d 59 struct circular_buffer;
pmallick 0:3afcd581558d 60
pmallick 0:3afcd581558d 61 /******************************************************************************/
pmallick 0:3afcd581558d 62 /************************ Functions Declarations ******************************/
pmallick 0:3afcd581558d 63 /******************************************************************************/
pmallick 0:3afcd581558d 64
pmallick 0:3afcd581558d 65 int32_t cb_init(struct circular_buffer **desc, uint32_t size);
pmallick 0:3afcd581558d 66 int32_t cb_remove(struct circular_buffer *desc);
pmallick 0:3afcd581558d 67 int32_t cb_size(struct circular_buffer *desc, uint32_t *size);
pmallick 0:3afcd581558d 68
pmallick 0:3afcd581558d 69 int32_t cb_write(struct circular_buffer *desc, const void *data,
pmallick 0:3afcd581558d 70 uint32_t nb_elements);
pmallick 0:3afcd581558d 71 int32_t cb_read(struct circular_buffer *desc, void *data, uint32_t nb_elements);
pmallick 0:3afcd581558d 72
pmallick 0:3afcd581558d 73 int32_t cb_prepare_async_write(struct circular_buffer *desc,
pmallick 0:3afcd581558d 74 uint32_t raw_size_to_write,
pmallick 0:3afcd581558d 75 void **write_buff,
pmallick 0:3afcd581558d 76 uint32_t *raw_size_avilable);
pmallick 0:3afcd581558d 77 int32_t cb_end_async_write(struct circular_buffer *desc);
pmallick 0:3afcd581558d 78
pmallick 0:3afcd581558d 79 int32_t cb_prepare_async_read(struct circular_buffer *desc,
pmallick 0:3afcd581558d 80 uint32_t raw_size_to_read,
pmallick 0:3afcd581558d 81 void **read_buff,
pmallick 0:3afcd581558d 82 uint32_t *raw_size_avilable);
pmallick 0:3afcd581558d 83 int32_t cb_end_async_read(struct circular_buffer *desc);
pmallick 0:3afcd581558d 84
pmallick 0:3afcd581558d 85 #endif