Files
TencentOS-tiny/components/connectivity/mqttclient/common/log/salof_defconfig.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

145 lines
3.9 KiB
C

/*
* @Author: jiejie
* @Github: https://github.com/jiejieTop
* @Date: 2019-12-25 23:56:34
* @LastEditTime: 2020-03-02 01:32:32
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
*/
#ifndef _SALOF_DEFCONFIG_H_
#define _SALOF_DEFCONFIG_H_
#include "salof_config.h"
#ifdef USE_LOG
#define USE_RTT 1
#define USE_FREERTOS 2
#define USE_TENCENTOS 3
#define USE_LINUX 4
#define BASE_LEVEL (0)
#define ASSERT_LEVEL (BASE_LEVEL + 1)
#define ERR_LEVEL (ASSERT_LEVEL + 1)
#define WARN_LEVEL (ERR_LEVEL + 1)
#define INFO_LEVEL (WARN_LEVEL + 1)
#define DEBUG_LEVEL (INFO_LEVEL + 1)
#ifndef USE_SALOF
#define USE_SALOF (1U)
#endif
#ifndef USE_IDLE_HOOK
#define USE_IDLE_HOOK (0U)
#endif
#ifndef LOG_COLOR
#define LOG_COLOR (1U)
#endif
#ifndef LOG_TS
#define LOG_TS (1U)
#endif
#ifndef LOG_TAR
#define LOG_TAR (0U)
#endif
#ifndef LOG_LEVEL
#define LOG_LEVEL DEBUG_LEVEL //WARN_LEVEL DEBUG_LEVEL
#endif
#if USE_SALOF
#ifndef SALOF_BUFF_SIZE
#define SALOF_BUFF_SIZE (512U)
#endif
#ifndef SALOF_FIFO_SIZE
#define SALOF_FIFO_SIZE (1024*4U)
#endif
#ifndef SALOF_TASK_STACK_SIZE
#define SALOF_TASK_STACK_SIZE (2048U)
#endif
#ifndef SALOF_TASK_TICK
#define SALOF_TASK_TICK (20U)
#endif
#endif
#if !defined(SALOF_OS)
#error "SALOF_OS isn't defined in 'salof_config.h'"
#endif
#if (SALOF_OS == USE_FREERTOS)
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#define salof_mutex SemaphoreHandle_t
#define salof_tcb TaskHandle_t
#define salof_sem salof_mutex
#if USE_IDLE_HOOK
#define salof_handler vApplicationIdleHook
#endif
#define SALOF_TASK_PRIO (0U)
#elif (SALOF_OS == USE_TENCENTOS)
#include "tos_k.h"
#define salof_mutex k_mutex_t*
#define salof_sem k_sem_t*
#define salof_tcb k_task_t*
#define SALOF_TASK_PRIO (TOS_CFG_TASK_PRIO_MAX - 2u)
#undef USE_IDLE_HOOK
#elif (SALOF_OS == USE_RTT)
#include <rtconfig.h>
#include <rtthread.h>
#include <rthw.h>
#include <stdio.h>
#define salof_mutex rt_mutex_t
#define salof_sem rt_sem_t
#define salof_tcb rt_thread_t
#define SALOF_TASK_PRIO (RT_THREAD_PRIORITY_MAX - 1)
#elif (SALOF_OS == USE_LINUX)
#include "pthread.h"
#include "memory.h"
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#define salof_mutex pthread_mutex_t*
#define salof_sem sem_t*
#define salof_tcb pthread_t*
#define SALOF_TASK_PRIO (0U)
#undef USE_IDLE_HOOK
#else
#error "not supported OS type"
#endif
void *salof_alloc(unsigned int size);
void salof_free(void *mem);
salof_tcb salof_task_create(const char *name,
void (*task_entry)(void *param),
void * const param,
unsigned int stack_size,
unsigned int priority,
unsigned int tick);
salof_mutex salof_mutex_create(void);
void salof_mutex_delete(salof_mutex mutex);
int salof_mutex_pend(salof_mutex mutex, unsigned int timeout);
int salof_mutex_post(salof_mutex mutex);
salof_sem salof_sem_create(void);
void salof_sem_delete(salof_sem sem);
int salof_sem_pend(salof_sem sem, unsigned int timeout);
int salof_sem_post(salof_sem sem);
unsigned int salof_get_tick(void);
char *salof_get_task_name(void);
extern int send_buff(char *buf, int len);
#endif
#endif // !_SALOF_DEFCONFIG_H_