initcalls: Add initial implementation
Create simple serial subsystem which makes use of initcalls, and convert existing serial drivers to its use.
This commit is contained in:
@ -22,6 +22,6 @@
|
||||
#define CONSOLE_H
|
||||
|
||||
void console_init(struct fb *f);
|
||||
void console_putc(char c);
|
||||
int console_putc(char c);
|
||||
|
||||
#endif /* CONSOLE_H */
|
||||
|
27
include/drivers/serial.h
Normal file
27
include/drivers/serial.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
|
||||
|
||||
This file is part of Aedrix.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
struct serial_dev {
|
||||
//TODO add more functions and attributes here
|
||||
int (*putc)(char);
|
||||
};
|
||||
|
||||
int serial_register_device(struct serial_dev *sdev);
|
||||
struct serial_dev *serial_first_device();
|
34
include/init.h
Normal file
34
include/init.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
|
||||
|
||||
This file is part of Aedrix.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
void init_earlyinitcalls();
|
||||
void init_initcalls();
|
||||
|
||||
struct initcall_func {
|
||||
void (*fptr)();
|
||||
};
|
||||
|
||||
#define _initcall(level_name, level, func) struct initcall_func func##_##level##_initcall \
|
||||
__attribute__ ((section ("." level_name "initcalls"))) = { func }
|
||||
|
||||
/* The actual calls to be used externally */
|
||||
#define early_initcall(func) _initcall("early", 0, func)
|
||||
#define driversubsys_initcall(func) _initcall("driversubsys", 1, func)
|
||||
#define device_initcall(func) _initcall("device", 2, func)
|
@ -21,8 +21,8 @@
|
||||
#ifndef PRINT_H
|
||||
#define PRINT_H
|
||||
|
||||
void print_init(void (*putc)(char));
|
||||
void print_init(int (*putc)(char));
|
||||
int print(char *fmt, ...);
|
||||
int print_func(void (putcf)(char), char *fmt, ...);
|
||||
int print_func(int (putcf)(char), char *fmt, ...);
|
||||
|
||||
#endif /* PRINT_H */
|
||||
|
Reference in New Issue
Block a user