From: Nathael Pajani Date: Mon, 21 Apr 2014 19:33:27 +0000 (+0200) Subject: Some cleanup X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=d3016abcfff3f6789971d99cfc929e05d3d8d956;p=soft%2Flpc122x%2Fcore Some cleanup --- diff --git a/drivers/gpio.c b/drivers/gpio.c index cde7f0d..2c6bfc0 100644 --- a/drivers/gpio.c +++ b/drivers/gpio.c @@ -1,25 +1,25 @@ /**************************************************************************** - * drivers/gpio.c - * - * Copyright 2012 Nathael Pajani - * - * 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, see . - * - *************************************************************************** */ + * drivers/gpio.c + * + * Copyright 2012 Nathael Pajani + * + * 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, see . + * + *************************************************************************** */ /***************************************************************************** */ -/* GPIOs */ +/* GPIOs and GPIO Interrupts */ /***************************************************************************** */ @@ -28,6 +28,7 @@ #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" #include "core/system.h" +#include "core/pio.h" #include "drivers/gpio.h" diff --git a/drivers/i2c.c b/drivers/i2c.c index 26b99c4..02ba98b 100644 --- a/drivers/i2c.c +++ b/drivers/i2c.c @@ -20,13 +20,18 @@ * *************************************************************************** */ + +/**************************************************************************** */ +/* I2C */ +/**************************************************************************** */ + #include #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" #include "core/system.h" +#include "core/pio.h" #include "lib/string.h" -#include "drivers/gpio.h" #include "drivers/i2c.h" diff --git a/drivers/serial.c b/drivers/serial.c index f667cc3..4ce6eb0 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -29,9 +29,8 @@ #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" #include "core/system.h" +#include "core/pio.h" #include "lib/string.h" -#include "drivers/timers.h" -#include "drivers/gpio.h" #define SERIAL_OUT_BUFF_SIZE 64 struct uart_device @@ -260,14 +259,6 @@ static struct uart_def uart_defs[NUM_UARTS] = { /***************************************************************************** */ /* Public access to UART setup */ -void set_uarts_pins(void) -{ - int i = 0; - for (i = 0; i < NUM_UARTS; i++) { - uart_set_pin_func(i); - } -} - /* Allow any change to the main clock to be forwarded to us */ void uart_clk_update(void) { @@ -280,7 +271,6 @@ void uart_clk_update(void) } /* Do we need to allow setting of other parameters ? (Other than 8n1) */ -/* Do we need to allow specifying an interrupt handler ? */ int uart_on(uint32_t uart_num, uint32_t baudrate, void (*rx_callback)(char)) { struct uart_def* uart = NULL; diff --git a/drivers/timers.c b/drivers/timers.c index 0edd3e9..8a28cab 100644 --- a/drivers/timers.c +++ b/drivers/timers.c @@ -28,9 +28,9 @@ #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" #include "core/system.h" +#include "core/pio.h" #include "lib/string.h" #include "drivers/timers.h" -#include "drivers/gpio.h" /* These are local to our file */ @@ -49,6 +49,7 @@ static struct timer_device timer_devices[NUM_TIMERS] = { +/* FIXME : Add callbacks and implement all handlers ! */ /* Handlers */ void TIMER_0_Handler(void) { diff --git a/include/drivers/serial.h b/include/drivers/serial.h index 1881294..df1fcbd 100644 --- a/include/drivers/serial.h +++ b/include/drivers/serial.h @@ -1,5 +1,5 @@ /**************************************************************************** - * serial.h + * drivers/serial.h * * Copyright 2012 Nathael Pajani * @@ -45,13 +45,12 @@ int serial_write(uint32_t uart_num, const char *buf, uint32_t length); /***************************************************************************** */ /* Public access to UART setup */ -void set_uarts_pins(void); /* Allow any change to the main clock to be forwarded to us */ void uart_clk_update(void); /* Do we need to allow setting of other parameters ? (Other than 8n1) */ -void uart_on(uint32_t uart_num, uint32_t baudrate, void (*rx_callback)(char)); +int uart_on(uint32_t uart_num, uint32_t baudrate, void (*rx_callback)(char)); void uart_off(uint32_t uart_num); diff --git a/include/drivers/timers.h b/include/drivers/timers.h index 316a5fe..7e883c2 100644 --- a/include/drivers/timers.h +++ b/include/drivers/timers.h @@ -22,7 +22,6 @@ #define DRIVERS_TIMERS_H #include -#include "core/lpc_regs_12xx.h" /***************************************************************************** */ /* Timers */