feat: reformatted driver code and linkage. Some optimizations
This commit is contained in:
20
kernel/driver.h
Normal file
20
kernel/driver.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by rick on 06-03-21.
|
||||
//
|
||||
|
||||
#ifndef NEW_KERNEL_DRIVER_H
|
||||
#define NEW_KERNEL_DRIVER_H
|
||||
#include <attributes.h>
|
||||
|
||||
#ifndef STRUCT_ALIGNMENT
|
||||
#define STRUCT_ALIGNMENT 16
|
||||
#endif
|
||||
#define DRIVER_CAT(a, b) DRIVER_DUMMY() a ## _ ## b
|
||||
#define DRIVER_DUMMY()
|
||||
|
||||
#define GENERIC_DRIVER(drivername, data...) \
|
||||
static struct drivername DRIVER_CAT(drivername, __COUNTER__) \
|
||||
__attribute((__used__, __section__(#drivername))) \
|
||||
= { data }
|
||||
|
||||
#endif //NEW_KERNEL_DRIVER_H
|
||||
Reference in New Issue
Block a user