Explorar el Código

Use enum for IRQ numbers, rename mk20dx128.h to kinetis.h

main
PaulStoffregen hace 10 años
padre
commit
479bde6866
Se han modificado 15 ficheros con 160 adiciones y 158 borrados
  1. +1
    -1
      teensy3/DMAChannel.h
  2. +1
    -2
      teensy3/HardwareSerial.h
  3. +1
    -2
      teensy3/IntervalTimer.h
  4. +1
    -1
      teensy3/avr_emulation.h
  5. +1
    -1
      teensy3/core_pins.h
  6. +1
    -1
      teensy3/eeprom.c
  7. +147
    -142
      teensy3/kinetis.h
  8. +1
    -1
      teensy3/mk20dx128.c
  9. +1
    -1
      teensy3/serial1.c
  10. +1
    -1
      teensy3/serial2.c
  11. +1
    -1
      teensy3/serial3.c
  12. +1
    -1
      teensy3/usb_desc.c
  13. +1
    -1
      teensy3/usb_dev.c
  14. +1
    -1
      teensy3/usb_mem.c
  15. +0
    -1
      teensy3/usb_seremu.c

+ 1
- 1
teensy3/DMAChannel.h Ver fichero

@@ -1,7 +1,7 @@
#ifndef DMAChannel_h_
#define DMAChannel_h_

#include "mk20dx128.h"
#include "kinetis.h"

// This code is a work-in-progress. It's incomplete and not usable yet...
//

+ 1
- 2
teensy3/HardwareSerial.h Ver fichero

@@ -31,8 +31,7 @@
#ifndef HardwareSerial_h
#define HardwareSerial_h

#include "mk20dx128.h"
#include <inttypes.h>
#include "kinetis.h"

// uncomment to enable 9 bit formats
//#define SERIAL_9BIT_SUPPORT

+ 1
- 2
teensy3/IntervalTimer.h Ver fichero

@@ -21,8 +21,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef __INTERVALTIMER_H__
#define __INTERVALTIMER_H__

#include <stdint.h>
#include "mk20dx128.h"
#include "kinetis.h"

#ifdef __cplusplus
extern "C" {

+ 1
- 1
teensy3/avr_emulation.h Ver fichero

@@ -31,7 +31,7 @@
#ifndef _avr_emulation_h_
#define _avr_emulation_h_

#include "mk20dx128.h"
#include "kinetis.h"
#include "core_pins.h"
#include "pins_arduino.h"


+ 1
- 1
teensy3/core_pins.h Ver fichero

@@ -31,7 +31,7 @@
#ifndef _core_pins_h_
#define _core_pins_h_

#include "mk20dx128.h"
#include "kinetis.h"
#include "pins_arduino.h"



+ 1
- 1
teensy3/eeprom.c Ver fichero

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

#include "mk20dx128.h"
#include "kinetis.h"
#include <stdint.h>
//#include "HardwareSerial.h"


teensy3/mk20dx128.h → teensy3/kinetis.h Ver fichero

@@ -28,19 +28,153 @@
* SOFTWARE.
*/

#ifndef _mk20dx128_h_
#define _mk20dx128_h_

//#ifdef F_CPU
//#undef F_CPU
//#endif
//#define F_CPU 168000000
//#define F_CPU 144000000
//#define F_CPU 120000000
//#define F_CPU 96000000
//#define F_CPU 72000000
//#define F_CPU 48000000
//#define F_CPU 24000000
#ifndef _kinetis_h_
#define _kinetis_h_

#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif

// Teensy 3.0
#if defined(__MK20DX128__)
enum IRQ_NUMBER_t {
IRQ_DMA_CH0 = 0,
IRQ_DMA_CH1 = 1,
IRQ_DMA_CH2 = 2,
IRQ_DMA_CH3 = 3,
IRQ_DMA_ERROR = 4,
IRQ_FTFL_COMPLETE = 6,
IRQ_FTFL_COLLISION = 7,
IRQ_LOW_VOLTAGE = 8,
IRQ_LLWU = 9,
IRQ_WDOG = 10,
IRQ_I2C0 = 11,
IRQ_SPI0 = 12,
IRQ_I2S0_TX = 13,
IRQ_I2S0_RX = 14,
IRQ_UART0_LON = 15,
IRQ_UART0_STATUS = 16,
IRQ_UART0_ERROR = 17,
IRQ_UART1_STATUS = 18,
IRQ_UART1_ERROR = 19,
IRQ_UART2_STATUS = 20,
IRQ_UART2_ERROR = 21,
IRQ_ADC0 = 22,
IRQ_CMP0 = 23,
IRQ_CMP1 = 24,
IRQ_FTM0 = 25,
IRQ_FTM1 = 26,
IRQ_CMT = 27,
IRQ_RTC_ALARM = 28,
IRQ_RTC_SECOND = 29,
IRQ_PIT_CH0 = 30,
IRQ_PIT_CH1 = 31,
IRQ_PIT_CH2 = 32,
IRQ_PIT_CH3 = 33,
IRQ_PDB = 34,
IRQ_USBOTG = 35,
IRQ_USBDCD = 36,
IRQ_TSI = 37,
IRQ_MCG = 38,
IRQ_LPTMR = 39,
IRQ_PORTA = 40,
IRQ_PORTB = 41,
IRQ_PORTC = 42,
IRQ_PORTD = 43,
IRQ_PORTE = 44,
IRQ_SOFTWARE = 45
};
#define NVIC_NUM_INTERRUPTS 46
#define DMA_NUM_CHANNELS 4
#define KINETISK_UART0
#define KINETISK_UART0_FIFO
#define KINETISK_UART1
#define KINETISK_UART2

// Teensy 3.1
#elif defined(__MK20DX256__)
enum IRQ_NUMBER_t {
IRQ_DMA_CH0 = 0,
IRQ_DMA_CH1 = 1,
IRQ_DMA_CH2 = 2,
IRQ_DMA_CH3 = 3,
IRQ_DMA_CH4 = 4,
IRQ_DMA_CH5 = 5,
IRQ_DMA_CH6 = 6,
IRQ_DMA_CH7 = 7,
IRQ_DMA_CH8 = 8,
IRQ_DMA_CH9 = 9,
IRQ_DMA_CH10 = 10,
IRQ_DMA_CH11 = 11,
IRQ_DMA_CH12 = 12,
IRQ_DMA_CH13 = 13,
IRQ_DMA_CH14 = 14,
IRQ_DMA_CH15 = 15,
IRQ_DMA_ERROR = 16,
IRQ_FTFL_COMPLETE = 18,
IRQ_FTFL_COLLISION = 19,
IRQ_LOW_VOLTAGE = 20,
IRQ_LLWU = 21,
IRQ_WDOG = 22,
IRQ_I2C0 = 24,
IRQ_I2C1 = 25,
IRQ_SPI0 = 26,
IRQ_SPI1 = 27,
IRQ_CAN_MESSAGE = 29,
IRQ_CAN_BUS_OFF = 30,
IRQ_CAN_ERROR = 31,
IRQ_CAN_TX_WARN = 32,
IRQ_CAN_RX_WARN = 33,
IRQ_CAN_WAKEUP = 34,
IRQ_I2S0_TX = 35,
IRQ_I2S0_RX = 36,
IRQ_UART0_LON = 44,
IRQ_UART0_STATUS = 45,
IRQ_UART0_ERROR = 46,
IRQ_UART1_STATUS = 47,
IRQ_UART1_ERROR = 48,
IRQ_UART2_STATUS = 49,
IRQ_UART2_ERROR = 50,
IRQ_ADC0 = 57,
IRQ_ADC1 = 58,
IRQ_CMP0 = 59,
IRQ_CMP1 = 60,
IRQ_CMP2 = 61,
IRQ_FTM0 = 62,
IRQ_FTM1 = 63,
IRQ_FTM2 = 64,
IRQ_CMT = 65,
IRQ_RTC_ALARM = 66,
IRQ_RTC_SECOND = 67,
IRQ_PIT_CH0 = 68,
IRQ_PIT_CH1 = 69,
IRQ_PIT_CH2 = 70,
IRQ_PIT_CH3 = 71,
IRQ_PDB = 72,
IRQ_USBOTG = 73,
IRQ_USBDCD = 74,
IRQ_DAC0 = 81,
IRQ_TSI = 83,
IRQ_MCG = 84,
IRQ_LPTMR = 85,
IRQ_PORTA = 87,
IRQ_PORTB = 88,
IRQ_PORTC = 89,
IRQ_PORTD = 90,
IRQ_PORTE = 91,
IRQ_SOFTWARE = 94
};
#define NVIC_NUM_INTERRUPTS 95
#define DMA_NUM_CHANNELS 16
#define KINETISK_UART0
#define KINETISK_UART0_FIFO
#define KINETISK_UART1
#define KINETISK_UART1_FIFO
#define KINETISK_UART2

#endif // end of board-specific definitions


#if (F_CPU == 168000000)
#define F_BUS 56000000
@@ -82,11 +216,6 @@
#define NULL ((void *)0)
#endif

#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif

// chapter 11: Port control and interrupts (PORT)
#define PORTA_PCR0 (*(volatile uint32_t *)0x40049000) // Pin Control Register n
#define PORT_PCR_ISF ((uint32_t)0x01000000) // Interrupt Status Flag
@@ -2312,130 +2441,6 @@ typedef struct {
#define NVIC_SET_PRIORITY(irqnum, priority) (*((volatile uint8_t *)0xE000E400 + (irqnum)) = (uint8_t)(priority))
#define NVIC_GET_PRIORITY(irqnum) (*((uint8_t *)0xE000E400 + (irqnum)))

#if defined(__MK20DX128__)
#define IRQ_DMA_CH0 0
#define IRQ_DMA_CH1 1
#define IRQ_DMA_CH2 2
#define IRQ_DMA_CH3 3
#define IRQ_DMA_ERROR 4
#define IRQ_FTFL_COMPLETE 6
#define IRQ_FTFL_COLLISION 7
#define IRQ_LOW_VOLTAGE 8
#define IRQ_LLWU 9
#define IRQ_WDOG 10
#define IRQ_I2C0 11
#define IRQ_SPI0 12
#define IRQ_I2S0_TX 13
#define IRQ_I2S0_RX 14
#define IRQ_UART0_LON 15
#define IRQ_UART0_STATUS 16
#define IRQ_UART0_ERROR 17
#define IRQ_UART1_STATUS 18
#define IRQ_UART1_ERROR 19
#define IRQ_UART2_STATUS 20
#define IRQ_UART2_ERROR 21
#define IRQ_ADC0 22
#define IRQ_CMP0 23
#define IRQ_CMP1 24
#define IRQ_FTM0 25
#define IRQ_FTM1 26
#define IRQ_CMT 27
#define IRQ_RTC_ALARM 28
#define IRQ_RTC_SECOND 29
#define IRQ_PIT_CH0 30
#define IRQ_PIT_CH1 31
#define IRQ_PIT_CH2 32
#define IRQ_PIT_CH3 33
#define IRQ_PDB 34
#define IRQ_USBOTG 35
#define IRQ_USBDCD 36
#define IRQ_TSI 37
#define IRQ_MCG 38
#define IRQ_LPTMR 39
#define IRQ_PORTA 40
#define IRQ_PORTB 41
#define IRQ_PORTC 42
#define IRQ_PORTD 43
#define IRQ_PORTE 44
#define IRQ_SOFTWARE 45
#define NVIC_NUM_INTERRUPTS 46
#define DMA_NUM_CHANNELS 4

#elif defined(__MK20DX256__)
#define IRQ_DMA_CH0 0
#define IRQ_DMA_CH1 1
#define IRQ_DMA_CH2 2
#define IRQ_DMA_CH3 3
#define IRQ_DMA_CH4 4
#define IRQ_DMA_CH5 5
#define IRQ_DMA_CH6 6
#define IRQ_DMA_CH7 7
#define IRQ_DMA_CH8 8
#define IRQ_DMA_CH9 9
#define IRQ_DMA_CH10 10
#define IRQ_DMA_CH11 11
#define IRQ_DMA_CH12 12
#define IRQ_DMA_CH13 13
#define IRQ_DMA_CH14 14
#define IRQ_DMA_CH15 15
#define IRQ_DMA_ERROR 16
#define IRQ_FTFL_COMPLETE 18
#define IRQ_FTFL_COLLISION 19
#define IRQ_LOW_VOLTAGE 20
#define IRQ_LLWU 21
#define IRQ_WDOG 22
#define IRQ_I2C0 24
#define IRQ_I2C1 25
#define IRQ_SPI0 26
#define IRQ_SPI1 27
#define IRQ_CAN_MESSAGE 29
#define IRQ_CAN_BUS_OFF 30
#define IRQ_CAN_ERROR 31
#define IRQ_CAN_TX_WARN 32
#define IRQ_CAN_RX_WARN 33
#define IRQ_CAN_WAKEUP 34
#define IRQ_I2S0_TX 35
#define IRQ_I2S0_RX 36
#define IRQ_UART0_LON 44
#define IRQ_UART0_STATUS 45
#define IRQ_UART0_ERROR 46
#define IRQ_UART1_STATUS 47
#define IRQ_UART1_ERROR 48
#define IRQ_UART2_STATUS 49
#define IRQ_UART2_ERROR 50
#define IRQ_ADC0 57
#define IRQ_ADC1 58
#define IRQ_CMP0 59
#define IRQ_CMP1 60
#define IRQ_CMP2 61
#define IRQ_FTM0 62
#define IRQ_FTM1 63
#define IRQ_FTM2 64
#define IRQ_CMT 65
#define IRQ_RTC_ALARM 66
#define IRQ_RTC_SECOND 67
#define IRQ_PIT_CH0 68
#define IRQ_PIT_CH1 69
#define IRQ_PIT_CH2 70
#define IRQ_PIT_CH3 71
#define IRQ_PDB 72
#define IRQ_USBOTG 73
#define IRQ_USBDCD 74
#define IRQ_DAC0 81
#define IRQ_TSI 83
#define IRQ_MCG 84
#define IRQ_LPTMR 85
#define IRQ_PORTA 87
#define IRQ_PORTB 88
#define IRQ_PORTC 89
#define IRQ_PORTD 90
#define IRQ_PORTE 91
#define IRQ_SOFTWARE 94
#define NVIC_NUM_INTERRUPTS 95
#define DMA_NUM_CHANNELS 16

#endif





+ 1
- 1
teensy3/mk20dx128.c Ver fichero

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

#include "mk20dx128.h"
#include "kinetis.h"


extern unsigned long _stext;

+ 1
- 1
teensy3/serial1.c Ver fichero

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

#include "mk20dx128.h"
#include "kinetis.h"
#include "core_pins.h"
#include "HardwareSerial.h"


+ 1
- 1
teensy3/serial2.c Ver fichero

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

#include "mk20dx128.h"
#include "kinetis.h"
#include "core_pins.h"
#include "HardwareSerial.h"


+ 1
- 1
teensy3/serial3.c Ver fichero

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

#include "mk20dx128.h"
#include "kinetis.h"
#include "core_pins.h"
#include "HardwareSerial.h"


+ 1
- 1
teensy3/usb_desc.c Ver fichero

@@ -33,7 +33,7 @@
#include "usb_desc.h"
#ifdef NUM_ENDPOINTS
#include "usb_names.h"
#include "mk20dx128.h"
#include "kinetis.h"
#include "avr_functions.h"

// USB Descriptors are binary data which the USB host reads to

+ 1
- 1
teensy3/usb_dev.c Ver fichero

@@ -31,7 +31,7 @@
#include "usb_dev.h"
#if F_CPU >= 20000000 && defined(NUM_ENDPOINTS)

#include "mk20dx128.h"
#include "kinetis.h"
//#include "HardwareSerial.h"
#include "usb_mem.h"


+ 1
- 1
teensy3/usb_mem.c Ver fichero

@@ -31,7 +31,7 @@
#include "usb_dev.h"
#if F_CPU >= 20000000 && defined(NUM_ENDPOINTS)

#include "mk20dx128.h"
#include "kinetis.h"
//#include "HardwareSerial.h"
#include "usb_mem.h"


+ 0
- 1
teensy3/usb_seremu.c Ver fichero

@@ -30,7 +30,6 @@

#if F_CPU >= 20000000

//#include "mk20dx128.h"
#include "usb_dev.h"
#include "usb_seremu.h"
#include "core_pins.h" // for yield()

Cargando…
Cancelar
Guardar