Imported ChibiOS/RT 2.0.6.
This commit is contained in:
67
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.c
Normal file
67
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
lpc111x_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* Extra, board-specific, initializations.
|
||||
* NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG
|
||||
* you must comment that line first.
|
||||
*/
|
||||
LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */
|
||||
LPC_IOCON->JTAG_nTRST_PIO1_2 = 0xC1; /* Disables pull-up on LED3B output
|
||||
and makes it GPIO1_2. */
|
||||
LPC_IOCON->PIO1_9 = 0xC0; /* Disables pull-up on LED3R output.*/
|
||||
LPC_IOCON->PIO1_10 = 0xC0; /* Disables pull-up on LED3G output.*/
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
92
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.h
Normal file
92
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for Embedded Artists LPCXpresso Base Board with LPC1114 daughter
|
||||
* board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifiers.
|
||||
*/
|
||||
#define BOARD_EA_BB_LPC1114
|
||||
#define BOARD_NAME "Embedded Artists LPCXpresso Base Board + LPC1114"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#define SYSOSCCLK 12000000
|
||||
|
||||
/*
|
||||
* GPIO 0 initial setup.
|
||||
* Bit7 - LPCxpresso LED, initially output at low level.
|
||||
*/
|
||||
#define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_LED2)
|
||||
#define VAL_GPIO0DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 1 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED3B) | \
|
||||
PAL_PORT_BIT(GPIO1_LED3R) | \
|
||||
PAL_PORT_BIT(GPIO1_LED3G)
|
||||
#define VAL_GPIO1DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 2 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO2DIR 0x00000000
|
||||
#define VAL_GPIO2DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 3 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO3DIR 0x00000000
|
||||
#define VAL_GPIO3DATA 0x00000000
|
||||
|
||||
/*
|
||||
* Pin definitions.
|
||||
*/
|
||||
#define GPIO0_SW3 1
|
||||
#define GPIO0_LED2 7
|
||||
|
||||
#define GPIO1_LED3B 2
|
||||
#define GPIO1_SW4 4
|
||||
#define GPIO1_LED3R 9
|
||||
#define GPIO1_LED3G 10
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.mk
Normal file
5
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1114/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/EA_LPCXPRESSO_BB_1114/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/EA_LPCXPRESSO_BB_1114
|
||||
67
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.c
Normal file
67
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
LPC13xx_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* Extra, board-specific, initializations.
|
||||
* NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG
|
||||
* you must comment that line first.
|
||||
*/
|
||||
LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */
|
||||
LPC_IOCON->JTAG_nTRST_PIO1_2 = 0xC1; /* Disables pull-up on LED3B output
|
||||
and makes it GPIO1_2. */
|
||||
LPC_IOCON->PIO1_9 = 0xC0; /* Disables pull-up on LED3R output.*/
|
||||
LPC_IOCON->PIO1_10 = 0xC0; /* Disables pull-up on LED3G output.*/
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
92
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.h
Normal file
92
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for Embedded Artists LPCXpresso Base Board with LPC1343 daughter
|
||||
* board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifiers.
|
||||
*/
|
||||
#define BOARD_EA_BB_LPC1343
|
||||
#define BOARD_NAME "Embedded Artists LPCXpresso Base Board + LPC1343"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#define SYSOSCCLK 12000000
|
||||
|
||||
/*
|
||||
* GPIO 0 initial setup.
|
||||
* Bit7 - LPCxpresso LED, initially output at low level.
|
||||
*/
|
||||
#define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_LED2)
|
||||
#define VAL_GPIO0DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 1 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED3B) | \
|
||||
PAL_PORT_BIT(GPIO1_LED3R) | \
|
||||
PAL_PORT_BIT(GPIO1_LED3G)
|
||||
#define VAL_GPIO1DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 2 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO2DIR 0x00000000
|
||||
#define VAL_GPIO2DATA 0x00000000
|
||||
|
||||
/*
|
||||
* GPIO 3 initial setup.
|
||||
*/
|
||||
#define VAL_GPIO3DIR 0x00000000
|
||||
#define VAL_GPIO3DATA 0x00000000
|
||||
|
||||
/*
|
||||
* Pin definitions.
|
||||
*/
|
||||
#define GPIO0_SW3 1
|
||||
#define GPIO0_LED2 7
|
||||
|
||||
#define GPIO1_LED3B 2
|
||||
#define GPIO1_SW4 4
|
||||
#define GPIO1_LED3R 9
|
||||
#define GPIO1_LED3G 10
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.mk
Normal file
5
ChibiOS_2.0.6/boards/EA_LPCXPRESSO_BB_1343/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/EA_LPCXPRESSO_BB_1343/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/EA_LPCXPRESSO_BB_1343
|
||||
70
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.c
Normal file
70
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
spc563_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* Various initialization (temporary code).
|
||||
*/
|
||||
SIU.PCR[GPIO_LED1].R = 0x0300; /* OBE | IBE. */
|
||||
SIU.PCR[GPIO_LED2].R = 0x0300; /* OBE | IBE. */
|
||||
SIU.PCR[GPIO_LED3].R = 0x0300; /* OBE | IBE. */
|
||||
SIU.PCR[GPIO_LED4].R = 0x0300; /* OBE | IBE. */
|
||||
SIU.PCR[GPIO_BUTTON1].R = 0x0100; /* IBE. */
|
||||
SIU.PCR[GPIO_BUTTON2].R = 0x0100; /* IBE. */
|
||||
SIU.PCR[GPIO_BUTTON3].R = 0x0100; /* IBE. */
|
||||
SIU.PCR[GPIO_BUTTON4].R = 0x0100; /* IBE. */
|
||||
SIU.PCR[GPIO_SCI_A_TX].R = 0x0500; /* Primary | IBE. */
|
||||
SIU.PCR[GPIO_SCI_A_RX].R = 0x0500; /* Primary | IBE. */
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
72
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.h
Normal file
72
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for a generic SPC563 proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifiers.
|
||||
*/
|
||||
#define BOARD_GENERIC_SPC563
|
||||
#define BOARD_NAME "Generic SPC563"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#if !defined(EXTCLK)
|
||||
#define EXTCLK 8000000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* I/O definitions.
|
||||
*/
|
||||
#define GPIO_SCI_A_TX 89
|
||||
#define GPIO_SCI_A_RX 90
|
||||
|
||||
#define GPIO_BUTTON1 179
|
||||
#define GPIO_BUTTON2 181
|
||||
#define GPIO_BUTTON3 183
|
||||
#define GPIO_BUTTON4 187
|
||||
|
||||
#define GPIO_LED1 188
|
||||
#define GPIO_LED2 189
|
||||
#define GPIO_LED3 190
|
||||
#define GPIO_LED4 191
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit0(void);
|
||||
void hwinit1(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.mk
Normal file
5
ChibiOS_2.0.6/boards/GENERIC_SPC563/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/GENERIC_SPC563/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/GENERIC_SPC563
|
||||
91
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.c
Normal file
91
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
CH_IRQ_HANDLER(TIMER0_COMP_vect) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Board initialization code.
|
||||
*/
|
||||
void hwinit(void) {
|
||||
|
||||
/*
|
||||
* I/O ports setup.
|
||||
*/
|
||||
DDRA = VAL_DDRA;
|
||||
PORTA = VAL_PORTA;
|
||||
DDRB = VAL_DDRB;
|
||||
PORTB = VAL_PORTB;
|
||||
DDRC = VAL_DDRC;
|
||||
PORTC = VAL_PORTC;
|
||||
DDRD = VAL_DDRD;
|
||||
PORTD = VAL_PORTD;
|
||||
DDRE = VAL_DDRE;
|
||||
PORTE = VAL_PORTE;
|
||||
DDRF = VAL_DDRF;
|
||||
PORTF = VAL_PORTF;
|
||||
DDRG = VAL_DDRG;
|
||||
PORTG = VAL_PORTG;
|
||||
|
||||
/*
|
||||
* External interrupts setup, all disabled initially.
|
||||
*/
|
||||
EICRA = 0x00;
|
||||
EICRB = 0x00;
|
||||
EIMSK = 0x00;
|
||||
|
||||
/*
|
||||
* Enables Idle mode for SLEEP instruction.
|
||||
*/
|
||||
SMCR = (1 << SE);
|
||||
|
||||
/*
|
||||
* Timer 0 setup.
|
||||
*/
|
||||
TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
|
||||
(0 << COM0A1) | (0 << COM0A0) | /* OC0A disabled. */
|
||||
(0 << CS02) | (1 << CS01) | (1 << CS00); /* CLK/64 clock. */
|
||||
OCR0A = F_CPU / 64 / CH_FREQUENCY - 1;
|
||||
TCNT0 = 0; /* Reset counter. */
|
||||
TIFR0 = (1 << OCF0A); /* Reset pending. */
|
||||
TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
}
|
||||
107
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.h
Normal file
107
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex AVR-CAN proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_AVR_CAN
|
||||
#define BOARD_NAME "Olimex AVR-CAN"
|
||||
|
||||
/*
|
||||
* All inputs with pullups.
|
||||
*/
|
||||
#define VAL_DDRA 0x00
|
||||
#define VAL_PORTA 0xFF
|
||||
|
||||
/*
|
||||
* All inputs with pullups.
|
||||
*/
|
||||
#define VAL_DDRB 0x00
|
||||
#define VAL_PORTB 0xFF
|
||||
|
||||
/*
|
||||
* All inputs with pullups.
|
||||
*/
|
||||
#define VAL_DDRC 0x00
|
||||
#define VAL_PORTC 0xFF
|
||||
|
||||
/* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
|
||||
* IN IN OUT IN OUT IN IN IN
|
||||
* DDRD 0 0 1 0 1 0 0 0
|
||||
* PU HiZ VAL PU VAL HiZ HiZ HiZ
|
||||
* PORTD 1 0 ?1 1 1 0 0 0
|
||||
*/
|
||||
#define VAL_DDRD 0x28
|
||||
#define VAL_PORTD 0xB8
|
||||
|
||||
/* PE7 PE6 BUT LED PE3 PE2 PE1 PE0
|
||||
* IN IN IN OUT IN IN OUT IN
|
||||
* DDRE 0 0 0 1 0 0 1 0
|
||||
* PU PU HiZ VAL PU PU VAL HiZ
|
||||
* PORTE 1 1 0 1 1 1 1 0
|
||||
*/
|
||||
#define VAL_DDRE 0x12
|
||||
#define VAL_PORTE 0xDE
|
||||
|
||||
/* TDI TDO TMS TCK PF3 PF2 PF1 PF0
|
||||
* x x x x IN IN IN IN
|
||||
* DDRF 0 0 0 0 0 0 0 0
|
||||
* x x x x PU PU PU PU
|
||||
* PORTF 0 0 0 0 1 1 1 1
|
||||
*
|
||||
*/
|
||||
#define VAL_DDRF 0x00
|
||||
#define VAL_PORTF 0x0F
|
||||
|
||||
/* x x x x x PG2 PG1 PG0
|
||||
* x x x x x IN IN IN
|
||||
* DDRG 0 0 0 0 0 0 0 0
|
||||
* x x x x x PU PU PU
|
||||
* PORTG 0 0 0 0 0 1 1 1
|
||||
*
|
||||
*/
|
||||
#define VAL_DDRG 0x00
|
||||
#define VAL_PORTG 0x07
|
||||
|
||||
#define PORTE_LED (1 << 4)
|
||||
#define PORTE_BUTTON (1 << 5)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_AVR_CAN/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_AVR_CAN/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_AVR_CAN
|
||||
91
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.c
Normal file
91
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
CH_IRQ_HANDLER(TIMER0_COMP_vect) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Board initialization code.
|
||||
*/
|
||||
void hwinit(void) {
|
||||
|
||||
/*
|
||||
* I/O ports setup.
|
||||
*/
|
||||
DDRA = VAL_DDRA;
|
||||
PORTA = VAL_PORTA;
|
||||
DDRB = VAL_DDRB;
|
||||
PORTB = VAL_PORTB;
|
||||
DDRC = VAL_DDRC;
|
||||
PORTC = VAL_PORTC;
|
||||
DDRD = VAL_DDRD;
|
||||
PORTD = VAL_PORTD;
|
||||
DDRE = VAL_DDRE;
|
||||
PORTE = VAL_PORTE;
|
||||
DDRF = VAL_DDRF;
|
||||
PORTF = VAL_PORTF;
|
||||
DDRG = VAL_DDRG;
|
||||
PORTG = VAL_PORTG;
|
||||
|
||||
/*
|
||||
* External interrupts setup, all disabled initially.
|
||||
*/
|
||||
EICRA = 0x00;
|
||||
EICRB = 0x00;
|
||||
EIMSK = 0x00;
|
||||
|
||||
/*
|
||||
* Enables Idle mode for SLEEP instruction.
|
||||
*/
|
||||
MCUCR = (1 << SE);
|
||||
|
||||
/*
|
||||
* Timer 0 setup.
|
||||
*/
|
||||
TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
|
||||
(0 << COM01) | (0 << COM00) | /* OC0A disabled. */
|
||||
(1 << CS02) | (0 << CS01) | (0 << CS00); /* CLK/64 clock. */
|
||||
OCR0 = F_CPU / 64 / CH_FREQUENCY - 1;
|
||||
TCNT0 = 0; /* Reset counter. */
|
||||
TIFR = (1 << OCF0); /* Reset pending. */
|
||||
TIMSK = (1 << OCIE0); /* IRQ on compare. */
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
}
|
||||
131
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.h
Normal file
131
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex AVR-MT-128 proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_AVR_MT_128
|
||||
#define BOARD_NAME "Olimex AVR-MT-128"
|
||||
|
||||
/* PA7 RLY DS B5 B4 B3 B2 B1
|
||||
* IN OUT IN IN IN IN IN IN
|
||||
* DDRA 0 1 0 0 0 0 0 0
|
||||
* PU VAL HiZ HiZ HiZ HiZ HiZ HiZ
|
||||
* PORTA 1 0 0 0 0 0 0 0
|
||||
*/
|
||||
#define VAL_DDRA 0x40
|
||||
#define VAL_PORTA 0x80
|
||||
|
||||
/*
|
||||
* All inputs with pullups.
|
||||
*/
|
||||
#define VAL_DDRB 0x00
|
||||
#define VAL_PORTB 0xFF
|
||||
|
||||
/* D7 D6 D5 D4 PC3 E R/W RS
|
||||
* OUT OUT OUT OUT IN OUT OUT OUT
|
||||
* DDRC 1 1 1 1 0 1 1 1
|
||||
* PU PU PU PU PU VAL VAL VAL
|
||||
* PORTC 0 0 0 0 1 0 0 0
|
||||
*/
|
||||
#define VAL_DDRC 0xF7
|
||||
#define VAL_PORTC 0x08
|
||||
|
||||
/* PD7 PD6 PD5 PD4 TXD RXD PD1 PD0
|
||||
* IN IN IN IN OUT IN IN IN
|
||||
* DDRD 0 0 0 0 1 0 0 0
|
||||
* PU PU PU PU VAL HiZ PU PU
|
||||
* PORTD 1 1 1 1 1 0 1 1
|
||||
*/
|
||||
#define VAL_DDRD 0x08
|
||||
#define VAL_PORTD 0xFB
|
||||
|
||||
/* PE7 PE6 BZ2 BZ2 PE3 PE2 PE1 PE0
|
||||
* IN IN OUT OUT IN IN OUT IN
|
||||
* DDRE 0 0 1 1 0 0 1 0
|
||||
* PU PU VAL VAL PU PU VAL PU
|
||||
* PORTE 1 1 1 1 1 1 1 1
|
||||
*/
|
||||
#define VAL_DDRE 0x32
|
||||
#define VAL_PORTE 0xFF
|
||||
|
||||
/* TDI TDO TMS TCK PF3 PF2 PF1 PF0
|
||||
* x x x x IN IN IN IN
|
||||
* DDRF 0 0 0 0 0 0 0 0
|
||||
* x x x x PU PU PU PU
|
||||
* PORTF 0 0 0 0 1 1 1 1
|
||||
*
|
||||
*/
|
||||
#define VAL_DDRF 0x00
|
||||
#define VAL_PORTF 0x0F
|
||||
|
||||
/* x x x x x PG2 PG1 PG0
|
||||
* x x x x x IN IN IN
|
||||
* DDRG 0 0 0 0 0 0 0 0
|
||||
* x x x x x PU PU PU
|
||||
* PORTG 0 0 0 0 0 1 1 1
|
||||
*
|
||||
*/
|
||||
#define VAL_DDRG 0x00
|
||||
#define VAL_PORTG 0x07
|
||||
|
||||
#define PORTA_BUTTON1 (1 << 0)
|
||||
#define PORTA_BUTTON2 (1 << 1)
|
||||
#define PORTA_BUTTON3 (1 << 2)
|
||||
#define PORTA_BUTTON4 (1 << 3)
|
||||
#define PORTA_BUTTON5 (1 << 4)
|
||||
#define PORTA_DALLAS (1 << 5)
|
||||
#define PORTA_RELAY (1 << 6)
|
||||
|
||||
#define PORTC_44780_RS (1 << 0)
|
||||
#define PORTC_44780_RW (1 << 1)
|
||||
#define PORTC_44780_E (1 << 2)
|
||||
#define PORTC_44780_D4 (1 << 4)
|
||||
#define PORTC_44780_D5 (1 << 5)
|
||||
#define PORTC_44780_D6 (1 << 6)
|
||||
#define PORTC_44780_D7 (1 << 7)
|
||||
#define PORTC_44780_DATA (PORTC_44780_D4 | PORTC_44780_D5 | \
|
||||
PORTC_44780_D6 | PORTC_44780_D7)
|
||||
|
||||
#define PORTE_BUZZ1 (1 << 4)
|
||||
#define PORTE_BUZZ2 (1 << 5)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_AVR_MT_128/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_AVR_MT_128/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_AVR_MT_128
|
||||
86
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.c
Normal file
86
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#define VAL_TC0_PRESCALER 0
|
||||
|
||||
/*
|
||||
* Timer 0 IRQ handling here.
|
||||
*/
|
||||
static CH_IRQ_HANDLER(T0IrqHandler) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
T0IR = 1; /* Clear interrupt on match MR0. */
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
VICVectAddr = 0;
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
lpc214x_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* System Timer initialization, 1ms intervals.
|
||||
*/
|
||||
SetVICVector(T0IrqHandler, 0, SOURCE_Timer0);
|
||||
VICIntEnable = INTMASK(SOURCE_Timer0);
|
||||
TC *timer = T0Base;
|
||||
timer->TC_PR = VAL_TC0_PRESCALER;
|
||||
timer->TC_MR0 = (PCLK / CH_FREQUENCY) / (VAL_TC0_PRESCALER + 1);
|
||||
timer->TC_MCR = 3; /* Interrupt and clear TC on match MR0. */
|
||||
timer->TC_TCR = 2; /* Reset counter and prescaler. */
|
||||
timer->TC_TCR = 1; /* Timer enabled. */
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
92
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.h
Normal file
92
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex LCP-P2148 proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_LCP_P2148
|
||||
#define BOARD_NAME "Olimex LCP-P2148"
|
||||
|
||||
/*
|
||||
* The following values are implementation dependent. You may change them in
|
||||
* order to match your HW.
|
||||
*/
|
||||
#define FOSC 12000000
|
||||
#define CCLK 48000000
|
||||
#define PCLK 12000000
|
||||
|
||||
/*
|
||||
* Pins configuration for Olimex LPC-P2148.
|
||||
*
|
||||
* PINSEL0
|
||||
* P0 P0 P0 P0 P0 P0 RXD TXD SSE MOS MIS SCK SDA SCL RXD TXD
|
||||
* 15 14 13 12 11 10 1 1 L0 I0 O0 0 0 0 0 0
|
||||
* 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01
|
||||
* FIO0DIR (15...0)
|
||||
* IN IN OUT OUT OUT OUT -- -- -- -- -- -- -- -- -- --
|
||||
* 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
|
||||
*
|
||||
* PINSEL1
|
||||
* P0 AD P0 P0 -- -- AO -- VB P0 P0 P0 MOS MIS SCK P0
|
||||
* 31 03 29 28 -- -- UT -- US 22 21 20 I1 O1 1 16
|
||||
* 00 01 00 00 00 00 10 00 01 00 00 00 10 10 10 00
|
||||
* FIO0DIR (31...16)
|
||||
* OUT -- OUT OUT -- -- -- -- -- OUT OUT OUT -- -- -- IN
|
||||
* 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0
|
||||
*
|
||||
* FIO1DIR (31...16)
|
||||
* -- -- -- -- -- IN IN OUT OUT OUT OUT OUT OUT OUT OUT OUT
|
||||
* 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
|
||||
*/
|
||||
#define VAL_PINSEL0 0x00055555
|
||||
#define VAL_PINSEL1 0x100840A8
|
||||
#define VAL_PINSEL2 0x00000004 /* Do not modify */
|
||||
#define VAL_FIO0DIR 0xB0703C00
|
||||
#define VAL_FIO1DIR 0x01FF0000
|
||||
#define VAL_FIO0PIN 0xFFFFFFFF
|
||||
#define VAL_FIO1PIN 0xFFFFFFFF
|
||||
|
||||
#define PA_LED1 10
|
||||
#define PA_LED2 11
|
||||
#define PA_BUZZ1 12
|
||||
#define PA_BUZZ2 13
|
||||
#define PA_BSL 14
|
||||
#define PA_BUTTON1 15
|
||||
#define PA_BUTTON2 16
|
||||
#define PA_SSEL1 20
|
||||
#define PA_LEDUSB 31
|
||||
|
||||
#define PB_WP1 24
|
||||
#define PB_CP1 25
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
8
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.mk
Normal file
8
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/board.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
# Board directory path
|
||||
BOARDPATH = ${CHIBIOS}/boards/OLIMEX_LPC_P2148/
|
||||
|
||||
# List of all the mandatory board related files.
|
||||
BOARDSRC = ${BOARDPATH}/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${BOARDPATH}
|
||||
119
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/buzzer.c
Normal file
119
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/buzzer.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Buzzer driver for Olimex LPC-P2148.
|
||||
* Uses the timer 1 for wave generation and a Virtual Timer for the sound
|
||||
* duration.
|
||||
* The driver also generates an event when the sound is done and the buzzer
|
||||
* goes silent.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#include "buzzer.h"
|
||||
|
||||
EventSource BuzzerSilentEventSource;
|
||||
|
||||
#define StartCounter(t) ((t)->TC_EMR = 0xF1, (t)->TC_TCR = 1)
|
||||
#define StopCounter(t) ((t)->TC_EMR = 0, (t)->TC_TCR = 2)
|
||||
|
||||
/**
|
||||
* @brief Buzzer driver initialization.
|
||||
*/
|
||||
void buzzInit(void) {
|
||||
|
||||
chEvtInit(&BuzzerSilentEventSource);
|
||||
|
||||
/*
|
||||
* Switches P0.12 and P0.13 to MAT1.0 and MAT1.1 functions.
|
||||
* Enables Timer1 clock.
|
||||
*/
|
||||
PINSEL0 &= 0xF0FFFFFF;
|
||||
PINSEL0 |= 0x0A000000;
|
||||
PCONP = (PCONP & PCALL) | PCTIM1;
|
||||
|
||||
/*
|
||||
* Timer setup.
|
||||
*/
|
||||
TC *tc = T1Base;
|
||||
StopCounter(tc);
|
||||
tc->TC_CTCR = 0; /* Clock source is PCLK. */
|
||||
tc->TC_PR = 0; /* Prescaler disabled. */
|
||||
tc->TC_MCR = 2; /* Clear TC on match MR0. */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stops the sound.
|
||||
*
|
||||
* @param[in] p pointer to the timer
|
||||
*/
|
||||
static void stop(void *p) {
|
||||
|
||||
StopCounter((TC *)p);
|
||||
chEvtBroadcastI(&BuzzerSilentEventSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Plays a tone asynchronously.
|
||||
*
|
||||
* @param[in] freq approximated tone frequency
|
||||
* @param[in] duration tone duration in systicks
|
||||
*/
|
||||
void buzzPlay(uint32_t freq, systime_t duration) {
|
||||
static VirtualTimer bvt;
|
||||
TC *tc = T1Base;
|
||||
|
||||
chSysLock();
|
||||
|
||||
if (chVTIsArmedI(&bvt)) { /* If a sound is already being */
|
||||
chVTResetI(&bvt); /* played then aborts it. */
|
||||
StopCounter(tc);
|
||||
}
|
||||
|
||||
tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2));
|
||||
StartCounter(tc);
|
||||
chVTSetI(&bvt, duration, stop, tc);
|
||||
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Plays a tone.
|
||||
*
|
||||
* @param[in] freq approximated tone frequency
|
||||
* @param[in] duration tone duration in systicks
|
||||
*/
|
||||
void buzzPlayWait(uint32_t freq, systime_t duration) {
|
||||
TC *tc = T1Base;
|
||||
|
||||
StopCounter(tc);
|
||||
tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2));
|
||||
StartCounter(tc);
|
||||
chThdSleep(duration);
|
||||
StopCounter(tc);
|
||||
}
|
||||
42
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/buzzer.h
Normal file
42
ChibiOS_2.0.6/boards/OLIMEX_LPC_P2148/buzzer.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BUZZER_H_
|
||||
#define _BUZZER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void buzzInit(void);
|
||||
void buzzPlay(uint32_t freq, systime_t duration);
|
||||
void buzzPlayWait(uint32_t freq, systime_t duration);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern EventSource BuzzerSilentEventSource;
|
||||
|
||||
#endif /* _BUZZER_H_ */
|
||||
61
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.c
Normal file
61
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
CH_IRQ_HANDLER(TIMERA0_VECTOR) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Hardware initialization goes here.
|
||||
* NOTE: Interrupts are still disabled.
|
||||
*/
|
||||
void hwinit(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* Timer 0 setup, uses SMCLK as source.
|
||||
*/
|
||||
TACCR0 = SMCLK / 4 / CH_FREQUENCY - 1;/* Counter limit. */
|
||||
TACTL = TACLR; /* Clean start. */
|
||||
TACTL = TASSEL_2 | ID_2 | MC_1; /* Src=SMCLK, ID=4, cmp=TACCR0. */
|
||||
TACCTL0 = CCIE; /* Interrupt on compare. */
|
||||
}
|
||||
88
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.h
Normal file
88
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex MSP430-P1611 proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_MSP430_P1611
|
||||
#define BOARD_NAME "Olimex MSP430-P1611"
|
||||
|
||||
/*
|
||||
* Clock constants.
|
||||
*/
|
||||
#define LFXT1CLK 32768
|
||||
#define XT2CLK 8000000
|
||||
#define DCOCLK 750000
|
||||
|
||||
/*
|
||||
* Pin definitions for the Olimex MSP430-P1611 board.
|
||||
*/
|
||||
#define P3_O_TXD0 4
|
||||
#define P3_O_TXD0_MASK (1 << P3_O_TXD0)
|
||||
#define P3_I_RXD0 5
|
||||
#define P3_I_RXD0_MASK (1 << P3_I_RXD0)
|
||||
#define P6_O_LED 0
|
||||
#define P6_O_LED_MASK (1 << P6_O_LED)
|
||||
#define P6_I_BUTTON 1
|
||||
#define P6_I_BUTTON_MASK (1 << P6_I_BUTTON)
|
||||
|
||||
/*
|
||||
* Initial I/O ports settings.
|
||||
*/
|
||||
#define VAL_P1OUT 0x00
|
||||
#define VAL_P1DIR 0xFF
|
||||
|
||||
#define VAL_P2OUT 0x00
|
||||
#define VAL_P2DIR 0xFF
|
||||
|
||||
#define VAL_P3OUT P3_O_TXD0_MASK
|
||||
#define VAL_P3DIR ~P3_I_RXD0_MASK
|
||||
|
||||
#define VAL_P4OUT 0x00
|
||||
#define VAL_P4DIR 0xFF
|
||||
|
||||
#define VAL_P5OUT 0x00
|
||||
#define VAL_P5DIR 0xFF
|
||||
|
||||
#define VAL_P6OUT P6_O_LED_MASK
|
||||
#define VAL_P6DIR ~P6_I_BUTTON_MASK
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_MSP430_P1611/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_MSP430_P1611/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_MSP430_P1611
|
||||
125
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.c
Normal file
125
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* SYS IRQ handling here.
|
||||
*/
|
||||
static CH_IRQ_HANDLER(SYSIrqHandler) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
if (AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) {
|
||||
(void) AT91C_BASE_PITC->PITC_PIVR;
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
}
|
||||
|
||||
#if USE_SAM7_DBGU_UART
|
||||
if (AT91C_BASE_DBGU->DBGU_CSR &
|
||||
(AT91C_US_RXRDY | AT91C_US_TXRDY | AT91C_US_PARE | AT91C_US_FRAME | AT91C_US_OVRE | AT91C_US_RXBRK)) {
|
||||
sd_lld_serve_interrupt(&SD3);
|
||||
}
|
||||
#endif
|
||||
AT91C_BASE_AIC->AIC_EOICR = 0;
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
/* Watchdog disabled.*/
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
at91sam7_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* LCD pins setup.
|
||||
*/
|
||||
palClearPad(IOPORT2, PIOB_LCD_BL);
|
||||
palSetPadMode(IOPORT2, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
palSetPad(IOPORT1, PIOA_LCD_RESET);
|
||||
palSetPadMode(IOPORT1, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
/*
|
||||
* Joystick and buttons setup.
|
||||
*/
|
||||
palSetGroupMode(IOPORT1,
|
||||
PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK |
|
||||
PIOA_B4_MASK | PIOA_B5_MASK,
|
||||
PAL_MODE_INPUT);
|
||||
palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT);
|
||||
|
||||
/*
|
||||
* MMC/SD slot setup.
|
||||
*/
|
||||
palSetGroupMode(IOPORT2,
|
||||
PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK,
|
||||
PAL_MODE_INPUT);
|
||||
|
||||
/*
|
||||
* PIT Initialization.
|
||||
*/
|
||||
AIC_ConfigureIT(AT91C_ID_SYS,
|
||||
AT91C_AIC_SRCTYPE_HIGH_LEVEL | (AT91C_AIC_PRIOR_HIGHEST - 1),
|
||||
SYSIrqHandler);
|
||||
AIC_EnableIT(AT91C_ID_SYS);
|
||||
AT91C_BASE_PITC->PITC_PIMR = (MCK / 16 / CH_FREQUENCY) - 1;
|
||||
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
|
||||
|
||||
/*
|
||||
* RTS/CTS pins enabled for USART0 only.
|
||||
*/
|
||||
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_RTS0 | AT91C_PA4_CTS0;
|
||||
AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
|
||||
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
100
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.h
Normal file
100
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex SAM7-EX256 development board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_SAM7_EX256
|
||||
#define BOARD_NAME "Olimex SAM7-EX256"
|
||||
|
||||
/*
|
||||
* Select your platform by modifying the following line.
|
||||
*/
|
||||
#if !defined(SAM7_PLATFORM)
|
||||
#define SAM7_PLATFORM SAM7X256
|
||||
#endif
|
||||
|
||||
#include "at91sam7.h"
|
||||
|
||||
#define CLK 18432000
|
||||
#define MCK 48054857
|
||||
|
||||
/*
|
||||
* Initial I/O setup.
|
||||
*/
|
||||
#define VAL_PIOA_ODSR 0x00000000 /* Output data. */
|
||||
#define VAL_PIOA_OSR 0x00000000 /* Direction. */
|
||||
#define VAL_PIOA_PUSR 0xFFFFFFFF /* Pull-up. */
|
||||
|
||||
#define VAL_PIOB_ODSR 0x00000000 /* Output data. */
|
||||
#define VAL_PIOB_OSR 0x00000000 /* Direction. */
|
||||
#define VAL_PIOB_PUSR 0xFFFFFFFF /* Pull-up. */
|
||||
|
||||
/*
|
||||
* I/O definitions.
|
||||
*/
|
||||
#define PIOA_LCD_RESET 2
|
||||
#define PIOA_LCD_RESET_MASK (1 << PIOA_LCD_RESET)
|
||||
#define PIOA_B1 7
|
||||
#define PIOA_B1_MASK (1 << PIOA_B1)
|
||||
#define PIOA_B2 8
|
||||
#define PIOA_B2_MASK (1 << PIOA_B2)
|
||||
#define PIOA_B3 9
|
||||
#define PIOA_B3_MASK (1 << PIOA_B3)
|
||||
#define PIOA_B4 14
|
||||
#define PIOA_B4_MASK (1 << PIOA_B4)
|
||||
#define PIOA_B5 15
|
||||
#define PIOA_B5_MASK (1 << PIOA_B5)
|
||||
#define PIOA_USB_PUP 25
|
||||
#define PIOA_USB_PUP_MASK (1 << PIOA_USB_PUP)
|
||||
#define PIOA_USB_PR 26
|
||||
#define PIOA_USB_PR_MASK (1 << PIOA_USB_PR)
|
||||
|
||||
#define PIOB_PHY_PD 18
|
||||
#define PIOB_PHY_PD_MASK (1 << PIOB_PHY_PD)
|
||||
#define PIOB_AUDIO_OUT 19
|
||||
#define PIOB_AUDIO_OUT_MASK (1 << PIOB_AUDIO_OUT)
|
||||
#define PIOB_LCD_BL 20
|
||||
#define PIOB_LCD_BL_MASK (1 << PIOB_LCD_BL)
|
||||
#define PIOB_MMC_WP 22
|
||||
#define PIOB_MMC_WP_MASK (1 << PIOB_MMC_WP)
|
||||
#define PIOB_MMC_CP 23
|
||||
#define PIOB_MMC_CP_MASK (1 << PIOB_MMC_CP)
|
||||
#define PIOB_SW1 24
|
||||
#define PIOB_SW1_MASK (1 << PIOB_SW1)
|
||||
#define PIOB_SW2 25
|
||||
#define PIOB_SW2_MASK (1 << PIOB_SW2)
|
||||
#define PIOB_PHY_IRQ 26
|
||||
#define PIOB_PHY_IRQ_MASK (1 << PIOB_PHY_IRQ)
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_SAM7_EX256/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_SAM7_EX256/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_SAM7_EX256
|
||||
107
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.c
Normal file
107
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* SYS IRQ handling here.
|
||||
*/
|
||||
static CH_IRQ_HANDLER(SYSIrqHandler) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
if (AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) {
|
||||
(void) AT91C_BASE_PITC->PITC_PIVR;
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
}
|
||||
AT91C_BASE_AIC->AIC_EOICR = 0;
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
/* Watchdog disabled.*/
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
at91sam7_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* LED pins setup.
|
||||
*/
|
||||
palClearPad(IOPORT1, PIOA_LED1);
|
||||
palSetPadMode(IOPORT1, PIOA_LED1, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palClearPad(IOPORT1, PIOA_LED2);
|
||||
palSetPadMode(IOPORT1, PIOA_LED2, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
/*
|
||||
* buttons setup.
|
||||
*/
|
||||
palSetGroupMode(IOPORT1, PIOA_B1_MASK | PIOA_B2_MASK, PAL_MODE_INPUT);
|
||||
|
||||
/*
|
||||
* MMC/SD slot setup.
|
||||
*/
|
||||
palSetGroupMode(IOPORT1,
|
||||
PIOA_MMC_WP_MASK | PIOA_MMC_CP_MASK,
|
||||
PAL_MODE_INPUT);
|
||||
|
||||
/*
|
||||
* PIT Initialization.
|
||||
*/
|
||||
AIC_ConfigureIT(AT91C_ID_SYS,
|
||||
AT91C_AIC_SRCTYPE_HIGH_LEVEL | (AT91C_AIC_PRIOR_HIGHEST - 1),
|
||||
SYSIrqHandler);
|
||||
AIC_EnableIT(AT91C_ID_SYS);
|
||||
AT91C_BASE_PITC->PITC_PIMR = (MCK / 16 / CH_FREQUENCY) - 1;
|
||||
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
79
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.h
Normal file
79
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex SAM7-P256 development board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_SAM7_P256
|
||||
|
||||
/*
|
||||
* Select your platform by modifying the following line.
|
||||
*/
|
||||
#if !defined(SAM7_PLATFORM)
|
||||
#define SAM7_PLATFORM SAM7S256
|
||||
#endif
|
||||
|
||||
#include "at91sam7.h"
|
||||
|
||||
#define CLK 18432000
|
||||
#define MCK 48054857
|
||||
|
||||
/*
|
||||
* Initial I/O setup.
|
||||
*/
|
||||
#define VAL_PIOA_ODSR 0x00000000 /* Output data. */
|
||||
#define VAL_PIOA_OSR 0x00000000 /* Direction. */
|
||||
#define VAL_PIOA_PUSR 0xFFFFFFFF /* Pull-up. */
|
||||
|
||||
/*
|
||||
* I/O definitions.
|
||||
*/
|
||||
#define PIOA_LED1 18
|
||||
#define PIOA_LED1_MASK (1 << PIOA_LED1_MASK)
|
||||
#define PIOA_LED2 17
|
||||
#define PIOA_LED2_MASK (1 << PIOA_LED2_MASK)
|
||||
#define PIOA_B1 19
|
||||
#define PIOA_B1_MASK (1 << PIOA_B1)
|
||||
#define PIOA_B2 20
|
||||
#define PIOA_B2_MASK (1 << PIOA_B2)
|
||||
#define PIOA_DP_PUP 25
|
||||
#define PIOA_DD_PUP_MASK (1 << PIOA_DP_PUP)
|
||||
#define PIOA_USB_D 26
|
||||
#define PIOA_USB_D_MASK (1 << PIOA_USB_D)
|
||||
|
||||
#define PIOA_MMC_WP 16
|
||||
#define PIOA_MMC_WP_MASK (1 << PIOA_MMC_WP)
|
||||
#define PIOA_MMC_CP 15
|
||||
#define PIOA_MMC_CP_MASK (1 << PIOA_MMC_CP)
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_SAM7_P256/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_SAM7_P256/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_SAM7_P256
|
||||
56
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.c
Normal file
56
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
142
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.h
Normal file
142
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the Olimex STM33-P103 proto board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_OLIMEX_STM32_P103
|
||||
#define BOARD_NAME "Olimex STM32-P103"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#define STM32_LSECLK 32768
|
||||
#define STM32_HSECLK 8000000
|
||||
|
||||
/*
|
||||
* MCU type, this macro is used by both the ST library and the ChibiOS/RT
|
||||
* native STM32 HAL.
|
||||
*/
|
||||
#define STM32F10X_MD
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_BUTTON 0
|
||||
#define GPIOA_SPI1NSS 4
|
||||
|
||||
#define GPIOB_SPI2NSS 12
|
||||
|
||||
#define GPIOC_MMCWP 6
|
||||
#define GPIOC_MMCCP 7
|
||||
#define GPIOC_CANCNTL 10
|
||||
#define GPIOC_DISC 11
|
||||
#define GPIOC_LED 12
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
*
|
||||
* The digits have the following meaning:
|
||||
* 0 - Analog input.
|
||||
* 1 - Push Pull output 10MHz.
|
||||
* 2 - Push Pull output 2MHz.
|
||||
* 3 - Push Pull output 50MHz.
|
||||
* 4 - Digital input.
|
||||
* 5 - Open Drain output 10MHz.
|
||||
* 6 - Open Drain output 2MHz.
|
||||
* 7 - Open Drain output 50MHz.
|
||||
* 8 - Digital input with PullUp or PullDown resistor depending on ODR.
|
||||
* 9 - Alternate Push Pull output 10MHz.
|
||||
* A - Alternate Push Pull output 2MHz.
|
||||
* B - Alternate Push Pull output 50MHz.
|
||||
* C - Reserved.
|
||||
* D - Alternate Open Drain output 10MHz.
|
||||
* E - Alternate Open Drain output 2MHz.
|
||||
* F - Alternate Open Drain output 50MHz.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Port A setup.
|
||||
* Everything input with pull-up except:
|
||||
* PA0 - Normal input (BUTTON).
|
||||
* PA2 - Alternate output (USART2 TX).
|
||||
* PA3 - Normal input (USART2 RX).
|
||||
*/
|
||||
#define VAL_GPIOACRL 0x88884B84 /* PA7...PA0 */
|
||||
#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */
|
||||
#define VAL_GPIOAODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port B setup.
|
||||
* Everything input with pull-up except:
|
||||
* PB13 - Alternate output (MMC SPI2 SCK).
|
||||
* PB14 - Normal input (MMC SPI2 MISO).
|
||||
* PB15 - Alternate output (MMC SPI2 MOSI).
|
||||
*/
|
||||
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
|
||||
#define VAL_GPIOBCRH 0xB4B88888 /* PB15...PB8 */
|
||||
#define VAL_GPIOBODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port C setup.
|
||||
* Everything input with pull-up except:
|
||||
* PC6 - Normal input because there is an external resistor.
|
||||
* PC7 - Normal input because there is an external resistor.
|
||||
* PC11 - Push Pull output (CAN CNTRL).
|
||||
* PC12 - Push Pull output (LED).
|
||||
*/
|
||||
#define VAL_GPIOCCRL 0x44888888 /* PC7...PC0 */
|
||||
#define VAL_GPIOCCRH 0x88833888 /* PC15...PC8 */
|
||||
#define VAL_GPIOCODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port D setup.
|
||||
* Everything input with pull-up except:
|
||||
* PD0 - Normal input (XTAL).
|
||||
* PD1 - Normal input (XTAL).
|
||||
*/
|
||||
#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
|
||||
#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
|
||||
#define VAL_GPIODODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port E setup.
|
||||
* Everything input with pull-up except:
|
||||
*/
|
||||
#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
|
||||
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
|
||||
#define VAL_GPIOEODR 0xFFFFFFFF
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.mk
Normal file
5
ChibiOS_2.0.6/boards/OLIMEX_STM32_P103/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/OLIMEX_STM32_P103/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/OLIMEX_STM32_P103
|
||||
74
ChibiOS_2.0.6/boards/RAISONANCE_REVA_STM8S/board.c
Normal file
74
ChibiOS_2.0.6/boards/RAISONANCE_REVA_STM8S/board.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* TIM 2 clock after the prescaler.
|
||||
*/
|
||||
#define TIM2_CLOCK (SYSCLK / 16)
|
||||
#define TIM2_ARR ((TIM2_CLOCK / CH_FREQUENCY) - 1)
|
||||
|
||||
/*
|
||||
* TIM2 interrupt handler.
|
||||
*/
|
||||
CH_IRQ_HANDLER(13) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysTimerHandlerI();
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
TIM2_SR1 = 0;
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Board initialization code.
|
||||
*/
|
||||
void hwinit(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* TIM2 initialization as system tick.
|
||||
*/
|
||||
CLK_PCKENR1 |= 32; /* PCKEN15, TIM2 clock source.*/
|
||||
TIM2_PSCR = 4; /* Prescaler divide by 2^4=16.*/
|
||||
TIM2_ARRH = TIM2_ARR >> 8;
|
||||
TIM2_ARRL = TIM2_ARR;
|
||||
TIM2_CNTRH = 0;
|
||||
TIM2_CNTRL = 0;
|
||||
TIM2_SR1 = 0;
|
||||
TIM2_IER = 1; /* UIE */
|
||||
TIM2_CR1 = 1; /* CEN */
|
||||
}
|
||||
193
ChibiOS_2.0.6/boards/RAISONANCE_REVA_STM8S/board.h
Normal file
193
ChibiOS_2.0.6/boards/RAISONANCE_REVA_STM8S/board.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for Raisonance REva V3 + STM8S208RB daughter board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifiers.
|
||||
*/
|
||||
#define BOARD_REVA_V3_STM8S208RB
|
||||
#define BOARD_NAME "Raisonance REva V3 + STM8S208RB"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#define HSECLK 24000000
|
||||
|
||||
/*
|
||||
* MCU model used on the board.
|
||||
* The available models are listed in the file ./os/hal/platforms/stm8/stm8.h
|
||||
*/
|
||||
#define STM8_PLATFORM PLATFORM_STM8S208RB
|
||||
|
||||
/*
|
||||
* Pin definitions.
|
||||
*/
|
||||
#define PA_OSCIN 1
|
||||
#define PA_J2_25 2 /* It is also OSCOUT. */
|
||||
#define PA_J2_27 3
|
||||
#define PA_RX 4
|
||||
#define PA_TX 5
|
||||
|
||||
#define PB_LED(n) (n)
|
||||
#define PB_LCD_D0 0
|
||||
#define PB_LCD_D1 1
|
||||
#define PB_LCD_CSB 2
|
||||
#define PB_LCD_RESB 3
|
||||
|
||||
#define PC_ADC_ETR 0
|
||||
#define PC_J2_51 1
|
||||
#define PC_J2_53 2
|
||||
#define PC_J2_55 3
|
||||
#define PC_J2_57 4
|
||||
#define PC_SCK 5
|
||||
#define PC_MOSI 6
|
||||
#define PC_MISO 7
|
||||
|
||||
#define PD_J2_69 0
|
||||
#define PD_J2_21 1
|
||||
#define PD_J2_67 2
|
||||
#define PD_J2_65 3
|
||||
#define PD_PWM 4
|
||||
#define PD_J2_63 5
|
||||
#define PD_J2_61 6
|
||||
#define PD_J2_59 7
|
||||
|
||||
#define PE_P2_49 0
|
||||
#define PE_SCL 1
|
||||
#define PE_SDA 2
|
||||
#define PE_P2_47 3
|
||||
#define PE_P2_45 4
|
||||
#define PE_P2_43 5
|
||||
#define PE_P2_41 6
|
||||
#define PE_P2_39 7
|
||||
|
||||
#define PF_J2_37 0
|
||||
#define PF_J2_35 1
|
||||
#define PF_J2_33 2
|
||||
#define PF_J2_31 3
|
||||
#define PF_ANA_IN1 4
|
||||
#define PF_ANA_IN2 5
|
||||
#define PF_ANA_TEMP 6
|
||||
#define PF_ANA_POT 7
|
||||
|
||||
#define PG_CAN_TX 0
|
||||
#define PG_CAN_RX 1
|
||||
#define PG_BT5 2
|
||||
#define PG_BT6 3
|
||||
#define PG_SW4 4
|
||||
#define PG_SW3 5
|
||||
#define PG_SW2 6
|
||||
#define PG_SW1 7
|
||||
|
||||
#define PI_J2_71 0
|
||||
|
||||
/*
|
||||
* Port A initial setup.
|
||||
*/
|
||||
#define VAL_GPIOAODR (1 << PA_TX) /* PA_TX initially to 1. */
|
||||
#define VAL_GPIOADDR (1 << PA_TX) /* PA_TX output, others inputs. */
|
||||
#define VAL_GPIOACR1 0xFF /* All pull-up or push-pull. */
|
||||
#define VAL_GPIOACR2 0
|
||||
|
||||
/*
|
||||
* Port B initial setup.
|
||||
*/
|
||||
#define VAL_GPIOBODR 0xFF /* Initially all set to high. */
|
||||
#define VAL_GPIOBDDR 0xFF /* All outputs. */
|
||||
#define VAL_GPIOBCR1 0xFF /* All push-pull. */
|
||||
#define VAL_GPIOBCR2 0
|
||||
|
||||
/*
|
||||
* Port C initial setup.
|
||||
*/
|
||||
#define VAL_GPIOCODR 0
|
||||
#define VAL_GPIOCDDR 0 /* All inputs. */
|
||||
#define VAL_GPIOCCR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIOCCR2 0
|
||||
|
||||
/*
|
||||
* Port D initial setup.
|
||||
*/
|
||||
#define VAL_GPIODODR 0
|
||||
#define VAL_GPIODDDR 0 /* All inputs. */
|
||||
#define VAL_GPIODCR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIODCR2 0
|
||||
|
||||
/*
|
||||
* Port E initial setup.
|
||||
*/
|
||||
#define VAL_GPIOEODR 0
|
||||
#define VAL_GPIOEDDR 0 /* All inputs. */
|
||||
#define VAL_GPIOECR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIOECR2 0
|
||||
|
||||
/*
|
||||
* Port F initial setup.
|
||||
*/
|
||||
#define VAL_GPIOFODR 0
|
||||
#define VAL_GPIOFDDR 0 /* All inputs. */
|
||||
#define VAL_GPIOFCR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIOFCR2 0
|
||||
|
||||
/*
|
||||
* Port G initial setup.
|
||||
*/
|
||||
#define VAL_GPIOGODR (1 << PG_CAN_TX)/* CAN_TX initially to 1. */
|
||||
#define VAL_GPIOGDDR (1 << PG_CAN_TX)/* CAN_TX output, others inputs. */
|
||||
#define VAL_GPIOGCR1 0xFF /* All pull-up or push-pull. */
|
||||
#define VAL_GPIOGCR2 0
|
||||
|
||||
/*
|
||||
* Port H initial setup (dummy, not present).
|
||||
*/
|
||||
#define VAL_GPIOHODR 0
|
||||
#define VAL_GPIOHDDR 0 /* All inputs. */
|
||||
#define VAL_GPIOHCR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIOHCR2 0
|
||||
|
||||
/*
|
||||
* Port I initial setup.
|
||||
*/
|
||||
#define VAL_GPIOIODR 0
|
||||
#define VAL_GPIOIDDR 0 /* All inputs. */
|
||||
#define VAL_GPIOICR1 0xFF /* All pull-up. */
|
||||
#define VAL_GPIOICR2 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void hwinit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
62
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.c
Normal file
62
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization is performed just after reset before BSS and DATA
|
||||
* segments initialization.
|
||||
*/
|
||||
void hwinit0(void) {
|
||||
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Late initialization code.
|
||||
* This initialization is performed after BSS and DATA segments initialization
|
||||
* and before invoking the main() function.
|
||||
*/
|
||||
void hwinit1(void) {
|
||||
|
||||
/*
|
||||
* HAL initialization.
|
||||
*/
|
||||
halInit();
|
||||
|
||||
/*
|
||||
* Remap USART2 to the PD5/PD6 pins, done after halInit since HAL resets
|
||||
* these.
|
||||
*/
|
||||
AFIO->MAPR |= AFIO_MAPR_USART2_REMAP;
|
||||
|
||||
/*
|
||||
* ChibiOS/RT initialization.
|
||||
*/
|
||||
chSysInit();
|
||||
}
|
||||
124
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.h
Normal file
124
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for the STMicroelectronics STM3210C-EVAL evaluation board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_ST_STM3210C_EVAL
|
||||
#define BOARD_NAME "ST STM3210C-EVAL"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
*/
|
||||
#define STM32_LSECLK 32768
|
||||
#define STM32_HSECLK 25000000
|
||||
|
||||
/*
|
||||
* MCU type, this macro is used by both the ST library and the ChibiOS/RT
|
||||
* native STM32 HAL.
|
||||
*/
|
||||
#define STM32F10X_CL
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
* *********************TO BE COMPLETED*********************
|
||||
*/
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
*
|
||||
* The digits have the following meaning:
|
||||
* 0 - Analog input.
|
||||
* 1 - Push Pull output 10MHz.
|
||||
* 2 - Push Pull output 2MHz.
|
||||
* 3 - Push Pull output 50MHz.
|
||||
* 4 - Digital input.
|
||||
* 5 - Open Drain output 10MHz.
|
||||
* 6 - Open Drain output 2MHz.
|
||||
* 7 - Open Drain output 50MHz.
|
||||
* 8 - Digital input with PullUp or PullDown resistor depending on ODR.
|
||||
* 9 - Alternate Push Pull output 10MHz.
|
||||
* A - Alternate Push Pull output 2MHz.
|
||||
* B - Alternate Push Pull output 50MHz.
|
||||
* C - Reserved.
|
||||
* D - Alternate Open Drain output 10MHz.
|
||||
* E - Alternate Open Drain output 2MHz.
|
||||
* F - Alternate Open Drain output 50MHz.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Port A setup.
|
||||
* Everything input except:
|
||||
*/
|
||||
#define VAL_GPIOACRL 0x44444444 /* PA7...PA0 */
|
||||
#define VAL_GPIOACRH 0x44444444 /* PA15...PA8 */
|
||||
#define VAL_GPIOAODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port B setup.
|
||||
* Everything input except:
|
||||
*/
|
||||
#define VAL_GPIOBCRL 0x44444444 /* PB7...PB0 */
|
||||
#define VAL_GPIOBCRH 0x44444444 /* PB15...PB8 */
|
||||
#define VAL_GPIOBODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port C setup.
|
||||
* Everything input except:
|
||||
*/
|
||||
#define VAL_GPIOCCRL 0x44444444 /* PC7...PC0 */
|
||||
#define VAL_GPIOCCRH 0x44444444 /* PC15...PC8 */
|
||||
#define VAL_GPIOCODR 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port D setup.
|
||||
* Everything input except:
|
||||
* PD5 - USART2TX (remapped) AF PP Output
|
||||
* PD6 - USART2RX (remapped) Digital Input
|
||||
* PD7 - LED (LD1) PP Output
|
||||
*/
|
||||
#define VAL_GPIODCRL 0x34B44444 /* PD7...PD0 */
|
||||
#define VAL_GPIODCRH 0x44444444 /* PD15...PD8 */
|
||||
#define VAL_GPIODODR 0x0F0FFFFF
|
||||
|
||||
/*
|
||||
* Port E setup.
|
||||
* Everything input except:
|
||||
*/
|
||||
#define VAL_GPIOECRL 0x44444444 /* PE7...PE0 */
|
||||
#define VAL_GPIOECRH 0x44444444 /* PE15...PE8 */
|
||||
#define VAL_GPIOEODR 0xFFFFFFFF
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
5
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.mk
Normal file
5
ChibiOS_2.0.6/boards/ST_STM3210C_EVAL/board.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/ST_STM3210C_EVAL/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/ST_STM3210C_EVAL
|
||||
6
ChibiOS_2.0.6/boards/readme.txt
Normal file
6
ChibiOS_2.0.6/boards/readme.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
This directory contains the support files for various board models. If you
|
||||
want to support a new board:
|
||||
- Create a new directory under ./boards, give it the name of your board.
|
||||
- Copy inside the new directory the files from a similar board.
|
||||
- Customize board.c, board.h and board.mk in order to correctly initialize
|
||||
your board.
|
||||
Reference in New Issue
Block a user