fifo.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("Autochips Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to Autochips Inc. and/or its licensors.
  6. * Without the prior written permission of Autochips inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of Autochips Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. *
  10. * Copyright(C) 2016, Autochips ( All rights reserved. )
  11. *
  12. * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("AUTOCHIPS SOFTWARE")
  14. * RECEIVED FROM Autochips AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  15. * AN "AS-IS" BASIS ONLY. Autochips EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES Autochips PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE Autochips SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. Autochips SHALL ALSO
  22. * NOT BE RESPONSIBLE FOR ANY Autochips SOFTWARE RELEASES MADE TO BUYER'S
  23. * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  24. *
  25. * BUYER'S SOLE AND EXCLUSIVE REMEDY AND Autochips'S ENTIRE AND CUMULATIVE
  26. * LIABILITY WITH RESPECT TO THE Autochips SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT Autochips'S OPTION, TO REVISE OR REPLACE THE Autochips SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  29. *
  30. * Autochips FOR SUCH Autochips SOFTWARE AT ISSUE.
  31. *
  32. * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  33. * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  34. * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  35. * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  36. * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  37. *****************************************************************************/
  38. /* Define to prevent recursive inclusion -------------------------------------*/
  39. #ifndef _FIFO_H_
  40. #define _FIFO_H_
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "ac780x.h"
  43. typedef struct
  44. {
  45. uint32_t head; /* output conut */
  46. uint32_t tail; /* input count */
  47. uint32_t size; /* total size */
  48. uint8_t * baseAddr;
  49. }fifo_TypeDef;
  50. uint8_t fifo_Init(fifo_TypeDef * _fifo, uint8_t* data, uint32_t size);
  51. uint8_t fifo_DeInit(fifo_TypeDef * _fifo);
  52. uint8_t fifo_Reset(fifo_TypeDef * _fifo);
  53. uint32_t fifo_insert(fifo_TypeDef * _fifo, uint8_t *data, uint32_t len);
  54. uint32_t fifo_retrieve(fifo_TypeDef * _fifo, uint8_t *data, uint32_t len);
  55. uint32_t fifo_GetLen(fifo_TypeDef * _fifo);
  56. uint8_t fifo_NotFull(fifo_TypeDef * _fifo);
  57. uint32_t fifo_GetFreeSpace(fifo_TypeDef * _fifo);
  58. uint32_t Fifo_strchr(fifo_TypeDef * _fifo, uint8_t data);
  59. #endif