mendel.c: move CPU initialisation to cpu.c (cpu-avr.c).
No functional change, but more code separated by architecture.
This commit is contained in:
parent
083f8f9b22
commit
d337fd18ad
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#if defined TEACUP_C_INCLUDE && defined __ARMEL__
|
||||
|
||||
/* Nothing yet. */
|
||||
void cpu_init() {
|
||||
}
|
||||
|
||||
#endif /* defined TEACUP_C_INCLUDE && defined __ARMEL__ */
|
||||
|
|
|
|||
34
cpu-avr.c
34
cpu-avr.c
|
|
@ -7,6 +7,38 @@
|
|||
|
||||
#if defined TEACUP_C_INCLUDE && defined __AVR__
|
||||
|
||||
/* Nothing yet. */
|
||||
#include <avr/io.h>
|
||||
#include "pinio.h"
|
||||
|
||||
|
||||
/** Initialise the CPU.
|
||||
|
||||
This sets up the CPU the way we need it. It disables modules we don't use,
|
||||
so they don't mess on the I/O pins they're connected to.
|
||||
*/
|
||||
void cpu_init() {
|
||||
#ifdef PRR
|
||||
#if defined TEMP_MAX6675 || defined SD
|
||||
PRR = MASK(PRTWI) | MASK(PRADC);
|
||||
#else
|
||||
PRR = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
|
||||
#endif
|
||||
#elif defined PRR0
|
||||
#if defined TEMP_MAX6675 || defined SD
|
||||
PRR0 = MASK(PRTWI) | MASK(PRADC);
|
||||
#else
|
||||
PRR0 = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
|
||||
#endif
|
||||
#if defined(PRUSART3)
|
||||
// Don't use USART2 or USART3. Leave USART1 for GEN3 and derivatives.
|
||||
PRR1 |= MASK(PRUSART3) | MASK(PRUSART2);
|
||||
#endif
|
||||
#if defined(PRUSART2)
|
||||
// Don't use USART2 or USART3. Leave USART1 for GEN3 and derivatives.
|
||||
PRR1 |= MASK(PRUSART2);
|
||||
#endif
|
||||
#endif
|
||||
ACSR = MASK(ACD);
|
||||
}
|
||||
|
||||
#endif /* defined TEACUP_C_INCLUDE && defined __AVR__ */
|
||||
|
|
|
|||
2
cpu.h
2
cpu.h
|
|
@ -2,6 +2,6 @@
|
|||
#ifndef _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
/* Nothing yet. */
|
||||
void cpu_init(void);
|
||||
|
||||
#endif /* _CPU_H */
|
||||
|
|
|
|||
29
mendel.c
29
mendel.c
|
|
@ -32,6 +32,7 @@
|
|||
#include "config_wrapper.h"
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
|
||||
#include "cpu.h"
|
||||
#include "serial.h"
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
#include "dda_queue.h"
|
||||
|
|
@ -69,31 +70,6 @@
|
|||
/// initialise all I/O - set pins as input or output, turn off unused subsystems, etc
|
||||
void io_init(void) {
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
// disable modules we don't use
|
||||
#ifdef PRR
|
||||
#if defined TEMP_MAX6675 || defined SD
|
||||
PRR = MASK(PRTWI) | MASK(PRADC);
|
||||
#else
|
||||
PRR = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
|
||||
#endif
|
||||
#elif defined PRR0
|
||||
#if defined TEMP_MAX6675 || defined SD
|
||||
PRR0 = MASK(PRTWI) | MASK(PRADC);
|
||||
#else
|
||||
PRR0 = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
|
||||
#endif
|
||||
#if defined(PRUSART3)
|
||||
// don't use USART2 or USART3- leave USART1 for GEN3 and derivatives
|
||||
PRR1 |= MASK(PRUSART3) | MASK(PRUSART2);
|
||||
#endif
|
||||
#if defined(PRUSART2)
|
||||
// don't use USART2 or USART3- leave USART1 for GEN3 and derivatives
|
||||
PRR1 |= MASK(PRUSART2);
|
||||
#endif
|
||||
#endif
|
||||
ACSR = MASK(ACD);
|
||||
|
||||
// setup I/O pins
|
||||
|
||||
// X Stepper
|
||||
WRITE(X_STEP_PIN, 0); SET_OUTPUT(X_STEP_PIN);
|
||||
|
|
@ -206,6 +182,9 @@ void io_init(void) {
|
|||
investigated).
|
||||
*/
|
||||
void init(void) {
|
||||
|
||||
cpu_init();
|
||||
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
// set up watchdog
|
||||
wd_init();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
#include "simulator.h"
|
||||
#include "data_recorder.h"
|
||||
|
||||
uint8_t ACSR;
|
||||
void cpu_init(void) {
|
||||
}
|
||||
|
||||
uint8_t TIMSK1;
|
||||
uint16_t
|
||||
TCCR0A,
|
||||
|
|
@ -205,7 +207,7 @@ void sim_tick(char ch) {
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
static char gcode_buffer[300];
|
||||
static char gcode_buffer[300];
|
||||
static int gcode_buffer_index;
|
||||
void sim_gcode_ch(char ch) {
|
||||
// Got CR, LF or buffer full
|
||||
|
|
|
|||
Loading…
Reference in New Issue