[ADD] packet_io framework

This commit is contained in:
liuwentan
2022-07-26 15:05:14 +08:00
parent da47b80442
commit 82a97ff067
16 changed files with 516 additions and 46 deletions

34
sdk/include/util_errors.h Normal file
View 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";
}