mirror of https://github.com/Desuuuu/klipper.git
sam3x8e: Add an internal.h header file with local definitions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c3a2fc981d
commit
ecba3e9a19
|
@ -10,25 +10,17 @@
|
||||||
#include "command.h" // shutdown
|
#include "command.h" // shutdown
|
||||||
#include "compiler.h" // ARRAY_SIZE
|
#include "compiler.h" // ARRAY_SIZE
|
||||||
#include "gpio.h" // gpio_out_setup
|
#include "gpio.h" // gpio_out_setup
|
||||||
|
#include "internal.h" // gpio_peripheral
|
||||||
#include "sam3x8e.h" // Pio
|
#include "sam3x8e.h" // Pio
|
||||||
#include "sched.h" // sched_shutdown
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
* Pin mappings
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
#define GPIO(PORT, NUM) (((PORT)-'A') * 32 + (NUM))
|
|
||||||
#define GPIO2PORT(PIN) ((PIN) / 32)
|
|
||||||
#define GPIO2BIT(PIN) (1<<((PIN) % 32))
|
|
||||||
|
|
||||||
static Pio * const digital_regs[] = {
|
static Pio * const digital_regs[] = {
|
||||||
PIOA, PIOB, PIOC, PIOD
|
PIOA, PIOB, PIOC, PIOD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* General Purpose Input Output (GPIO) pins
|
* Pin multiplexing
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -47,6 +39,10 @@ gpio_peripheral(char bank, uint32_t bit, char ptype, uint32_t pull_up)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* General Purpose Input Output (GPIO) pins
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
struct gpio_out
|
struct gpio_out
|
||||||
gpio_out_setup(uint8_t pin, uint8_t val)
|
gpio_out_setup(uint8_t pin, uint8_t val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#ifndef __SAM3X8E_GPIO_H
|
#ifndef __SAM3X8E_GPIO_H
|
||||||
#define __SAM3X8E_GPIO_H
|
#define __SAM3X8E_GPIO_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h> // uint32_t
|
||||||
|
|
||||||
void gpio_peripheral(char bank, uint32_t bit, char ptype, uint32_t pull_up);
|
|
||||||
|
|
||||||
struct gpio_out {
|
struct gpio_out {
|
||||||
void *regs;
|
void *regs;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __SAM3_INTERNAL_H
|
||||||
|
#define __SAM3_INTERNAL_H
|
||||||
|
// Local definitions for sam3 code
|
||||||
|
|
||||||
|
#include <stdint.h> // uint32_t
|
||||||
|
|
||||||
|
#define GPIO(PORT, NUM) (((PORT)-'A') * 32 + (NUM))
|
||||||
|
#define GPIO2PORT(PIN) ((PIN) / 32)
|
||||||
|
#define GPIO2BIT(PIN) (1<<((PIN) % 32))
|
||||||
|
|
||||||
|
void gpio_peripheral(char bank, uint32_t bit, char ptype, uint32_t pull_up);
|
||||||
|
|
||||||
|
#endif // internal.h
|
|
@ -5,8 +5,8 @@
|
||||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
#include "autoconf.h" // CONFIG_SERIAL_BAUD
|
#include "autoconf.h" // CONFIG_SERIAL_BAUD
|
||||||
#include "board/gpio.h" // gpio_peripheral
|
|
||||||
#include "board/serial_irq.h" // serial_rx_data
|
#include "board/serial_irq.h" // serial_rx_data
|
||||||
|
#include "internal.h" // gpio_peripheral
|
||||||
#include "sam3x8e.h" // UART
|
#include "sam3x8e.h" // UART
|
||||||
#include "sched.h" // DECL_INIT
|
#include "sched.h" // DECL_INIT
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
#include <sam3x8e.h> // REGPTR
|
#include <sam3x8e.h> // REGPTR
|
||||||
#include "command.h" // shutdown
|
#include "command.h" // shutdown
|
||||||
#include "gpio.h" // gpio_peripheral
|
#include "gpio.h" // spi_setup
|
||||||
|
#include "internal.h" // gpio_peripheral
|
||||||
#include "sched.h" // sched_shutdown
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
#define REGPTR SPI0
|
#define REGPTR SPI0
|
||||||
|
|
Loading…
Reference in New Issue