[ADD] packet_io framework
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: logger.h
|
||||
* Description: log module
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-07-15
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct logger;
|
||||
#define log_debug(x, ...)
|
||||
|
||||
#define log_info(x, ...)
|
||||
|
||||
#define log_notice(x, ...)
|
||||
|
||||
#define log_error(x, ...)
|
||||
|
||||
34
sdk/include/util_errors.h
Normal file
34
sdk/include/util_errors.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: util_errors.h
|
||||
* Description: different error type
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-07-15
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#define CASE_CODE(E) case E: return #E
|
||||
|
||||
/* ST is short for stellar */
|
||||
typedef enum {
|
||||
ST_OK = 0,
|
||||
ST_ERR_MEM_ALLOC,
|
||||
ST_ERR_RUN_MODE,
|
||||
ST_ERR_PIO_INSTANCE,
|
||||
ST_ERR_PIO_DEVICE,
|
||||
ST_ERR_MAX
|
||||
} error_code_t;
|
||||
|
||||
const char *st_error_to_string(error_code_t err)
|
||||
{
|
||||
switch (err) {
|
||||
CASE_CODE (ST_OK);
|
||||
CASE_CODE (ST_ERR_MEM_ALLOC);
|
||||
CASE_CODE (ST_ERR_RUN_MODE);
|
||||
CASE_CODE (ST_ERR_PIO_INSTANCE);
|
||||
CASE_CODE (ST_ERR_PIO_DEVICE);
|
||||
}
|
||||
|
||||
return "UNKNOWN_ERROR";
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <stdlib.h> //calloc
|
||||
|
||||
#define ALLOC(type, number) ((type *)calloc(sizeof(type), number))
|
||||
#define FREE(p) {free(*p);*p=NULL;}
|
||||
#define CALLOC(type, number) ((type *)calloc(sizeof(type), number))
|
||||
#define FREE(p) {free(p);p=NULL;}
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
Reference in New Issue
Block a user