56 lines
1.6 KiB
C
Raw Normal View History

2025-05-21 11:31:07 +08:00
/******************************************************************************
Copyright @2024 - 2044 Shenzhen dcenzix Technology Ltd.
******************************************************************************
@file cola_init.h
@brief
@author xiexiongwu
@version V1.0
@date 2024525
******************************************************************************/
#ifndef __COLA_INIT_H__
#define __COLA_INIT_H__
/*----------------------------------------------*
* *
*----------------------------------------------*/
/* 修改后的宏定义适配GCC */
#define __used __attribute__((used)) // 简化属性语法
typedef void (*initcall_t)(void);
/* 重新定义段命名规则 */
#define __define_initcall(fn, level) \
static const initcall_t __initcall_##fn##level __used \
__attribute__((__section__(".initcall" #level ".init"))) = fn;
#define sysclk_initcall(fn) __define_initcall(fn, 0)
#define register_initcall(fn) __define_initcall(fn, 1)
#define bsp_initcall(fn) __define_initcall(fn, 2)
#define device_initcall(fn) __define_initcall(fn, 3)
#define app_initcall(fn) __define_initcall(fn, 4)
/*----------------------------------------------*
* *
*----------------------------------------------*/
#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */
extern void do_init_call(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __COLA_INIT_H__ */