Files
TencentOS-tiny/components/connectivity/mqttclient/common/log/fifo.h
jiejieTop 476e0dec02 the push is modified as follows:
1. delete some junk files.
2. mqttclient added comments and updated to v1.0.2.
3. update README.md.
4. update the author's own server certificate.
5. minor changes to salof.
2020-03-21 21:53:10 +08:00

42 lines
1.1 KiB
C

/*
* @Author: jiejie
* @Github: https://github.com/jiejieTop
* @Date: 2019-12-25 23:54:38
* @LastEditTime: 2020-02-25 08:10:01
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
*/
#ifndef _FIFO_H_
#define _FIFO_H_
#include "salof_defconfig.h"
#ifdef USE_LOG
#define FIFO_READ 0
#define FIFO_WRITE 1
#define FIFO_MAX(a,b) (((a) > (b)) ? (a) : (b))
#define FIFO_MIN(a,b) (((a) < (b)) ? (a) : (b))
struct fifo
{
unsigned int size; /* fifo size */
unsigned int in; /* data input pointer (in % size) */
unsigned int out; /* data output pointer (out % size) */
salof_mutex mutex; /* mutex */
salof_sem sem; /* sem */
void *buff; /* data area */
};
typedef struct fifo * fifo_t;
fifo_t fifo_create(unsigned int size);
unsigned int fifo_write(fifo_t fifo, void *buff, unsigned int len, unsigned int timeout);
unsigned int fifo_read(fifo_t fifo, void *buff, unsigned int len, unsigned int timeout);
unsigned int fifo_read_able(fifo_t fifo);
unsigned int fifo_write_able(fifo_t fifo);
#endif
#endif // !_FIFO_H_