miscellaneous fix.

This commit is contained in:
Gatsby Van
2023-12-27 17:14:58 +08:00
parent 6bf35c8c5d
commit 1e57ca2c1b
4 changed files with 84 additions and 73 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ int SetupInterruptSystem(XScuGic *instPtr, uint32_t devId);
void PhysicalIntr_Handler(void *callBackRef); void PhysicalIntr_Handler(void *callBackRef);
void PeriodicPull_Handler(void *callBackRef); void PeriodicPull_Handler(void *callBackRef);
#ifdef _MPC_CTRL #ifdef _MPC_CTRL
void MPC_IntrHandler(void *CallBackRef); void MPC_IntrHandler(void *callBackRef);
#endif #endif
/*********************** Driver Instance Definitions **************************/ /*********************** Driver Instance Definitions **************************/
+1 -2
View File
@@ -1,5 +1,4 @@
/*************************************************************************** /*******************************************************************************
//**
* @file util.h * @file util.h
* @brief Implementation of utility functions. * @brief Implementation of utility functions.
* @author DBogdan ([email protected]) * @author DBogdan ([email protected])
+22 -13
View File
@@ -28,7 +28,9 @@
/************************** Constant Definitions *****************************/ /************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
#define __PRINT_BLOCK(block) do {\ #define __PRINT_BLOCK(block) \
do \
{ \
block \ block \
} while (0) } while (0)
@@ -38,41 +40,48 @@
/* Stringify */ /* Stringify */
#define STR(x) #x #define STR(x) #x
#define _814_DEBUG_LEVEL 3 // #define _814_DEBUG_LEVEL 3
#if _814_DEBUG_LEVEL > 0 #if _814_DEBUG_LEVEL > 0
#define DBG_PRINT(...) printf(__VA_ARGS__) #define DBG_PRINT(...) printf(__VA_ARGS__)
#endif #endif
#if _814_DEBUG_LEVEL >= 1 #if _814_DEBUG_LEVEL >= 1
#define DBG_ERROR(...) __PRINT_BLOCK( \ #define DBG_ERROR(...) __PRINT_BLOCK( \
printf("in"__FILE__" #%4d [error]\t",__LINE__); \ printf("in"__FILE__ \
printf(__VA_ARGS__); \ " #%4d [error]\t", \
) __LINE__); \
printf(__VA_ARGS__);)
#endif #endif
#if _814_DEBUG_LEVEL >= 2 #if _814_DEBUG_LEVEL >= 2
#define DBG_WARNING(...) __PRINT_BLOCK( \ #define DBG_WARNING(...) __PRINT_BLOCK( \
printf("[warning]\t"); \ printf("[warning]\t"); \
printf(__VA_ARGS__); \ printf(__VA_ARGS__);)
)
#endif #endif
#if _814_DEBUG_LEVEL >= 3 #if _814_DEBUG_LEVEL >= 3
#define DBG_INFO(...) __PRINT_BLOCK( \ #define DBG_INFO(...) __PRINT_BLOCK( \
printf("[Info]\t"); \ printf("[Info]\t"); \
printf(__VA_ARGS__); \ printf(__VA_ARGS__);)
)
#endif #endif
#ifndef DBG_ERROR #ifndef DBG_ERROR
#define DBG_ERROR(...) {} #define DBG_ERROR(...) \
{ \
}
#endif #endif
#ifndef DBG_WARNING #ifndef DBG_WARNING
#define DBG_WARNING(...) {} #define DBG_WARNING(...) \
{ \
}
#endif #endif
#ifndef DBG_INFO #ifndef DBG_INFO
#define DBG_INFO(...) {} #define DBG_INFO(...) \
{ \
}
#endif #endif
#ifndef DBG_PRINT #ifndef DBG_PRINT
#define DBG_PRINT(...) {} #define DBG_PRINT(...) \
{ \
}
#endif #endif
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
+6 -3
View File
@@ -1,4 +1,4 @@
/***************************************************************************//** /*******************************************************************************
* @file util.h * @file util.h
* @brief Implementation of utility functions. * @brief Implementation of utility functions.
* @author DBogdan ([email protected]) * @author DBogdan ([email protected])
@@ -84,7 +84,11 @@
(type) clamp((type)(val), (type)(min_val), (type)(max_val)) (type) clamp((type)(val), (type)(min_val), (type)(max_val))
#define swap(x, y) \ #define swap(x, y) \
{typeof(x) _tmp_ = (x); (x) = (y); (y) = _tmp_;} { \
typeof(x) _tmp_ = (x); \
(x) = (y); \
(y) = _tmp_; \
}
#define round_up(x, y) \ #define round_up(x, y) \
(((x) + (y)-1) / (y)) (((x) + (y)-1) / (y))
@@ -191,4 +195,3 @@ bool crc16_check(uint8_t* buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_
int crc8_gen(uint8_t *buffPtr, uint32_t dataLen, uint16_t poly, uint8_t *crcVal); int crc8_gen(uint8_t *buffPtr, uint32_t dataLen, uint16_t poly, uint8_t *crcVal);
bool crc8_check(uint8_t *buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly); bool crc8_check(uint8_t *buffPtr, uint32_t dataLen, uint32_t crcOffset, uint16_t poly);
#endif // UTIL_H_ #endif // UTIL_H_