diff options
Diffstat (limited to 'os')
| -rw-r--r-- | os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h | 12 | ||||
| -rw-r--r-- | os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h | 16 | ||||
| -rw-r--r-- | os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h | 38 | ||||
| -rw-r--r-- | os/hal/boards/MCHCK_K20/board.h | 2 | ||||
| -rw-r--r-- | os/hal/boards/PJRC_TEENSY_3/board.h | 37 | ||||
| -rw-r--r-- | os/hal/boards/PJRC_TEENSY_3_1/board.h | 37 | ||||
| -rw-r--r-- | os/hal/boards/PJRC_TEENSY_LC/board.h | 28 | ||||
| -rw-r--r-- | os/hal/ports/KINETIS/LLD/hal_pal_lld.h | 37 | 
8 files changed, 196 insertions, 11 deletions
| diff --git a/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h b/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h index cf41495..8f8605c 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h @@ -45,6 +45,18 @@  #define GPIO_LED_BLUE   IOPORT1
  #define PIN_LED_BLUE    2
 +/* Inertial sensor: MMA8451Q */
 +/* Default I2C address 0x1D */
 +#define I2C_GYRO I2C0
 +
 +#define LINE_LED_RED    PAL_LINE(GPIO_LED_RED, PIN_LED_RED)
 +#define LINE_LED_GREEN  PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN)
 +#define LINE_LED_BLUE   PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE)
 +#define LINE_GYRO_SCL   PAL_LINE(GPIOB, 0U)
 +#define LINE_GYRO_SDA   PAL_LINE(GPIOB, 1U)
 +#define LINE_GYRO_INT1  PAL_LINE(GPIOC, 11U)
 +#define LINE_GYRO_INT2  PAL_LINE(GPIOC, 6U)
 +
  #if !defined(_FROM_ASM_)
  #ifdef __cplusplus
  extern "C" {
 diff --git a/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h b/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h index 35d8e06..289ee91 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h @@ -45,7 +45,21 @@  #define GPIO_LED_BLUE   IOPORT4
  #define PIN_LED_BLUE    1
 -#define I2C_INERIAL_SENSOR I2C0
 +/* Inertial sensor: MMA8451Q */
 +/* Default I2C address 0x1D */
 +/* Note: the pins PTE24/25 are assigned to I2C0 by default;
 + *       if I2C0 is wanted on other pins, these need to be
 + *       assigned another function explicitly!
 + */
 +#define I2C_GYRO I2C0
 +
 +#define LINE_LED_RED    PAL_LINE(GPIO_LED_RED, PIN_LED_RED)
 +#define LINE_LED_GREEN  PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN)
 +#define LINE_LED_BLUE   PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE)
 +#define LINE_GYRO_SCL   PAL_LINE(GPIOE, 24U)
 +#define LINE_GYRO_SDA   PAL_LINE(GPIOE, 25U)
 +#define LINE_GYRO_INT1  PAL_LINE(GPIOA, 14U)
 +#define LINE_GYRO_INT2  PAL_LINE(GPIOA, 15U)
  /*
   * Not configured:
 diff --git a/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h b/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h index 2ae42aa..1db7947 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h @@ -38,16 +38,34 @@  /*
   * Onboard features.
   */
 -#define GPIO_LED_RED    IOPORT5
 -#define PIN_LED_RED     29
 -#define GPIO_LED_GREEN  IOPORT5
 -#define PIN_LED_GREEN   31
 -#define GPIO_LED_BLUE   IOPORT4
 -#define PIN_LED_BLUE    5
 -#define GPIO_BUTTON     IOPORT4
 -#define PIN_BUTTON      0
 -#define GPIO_LIGHTSNS   IOPORT5
 -#define PIN_LIGHTSNS    22
 +#define GPIO_LED_RED        IOPORT5
 +#define PIN_LED_RED         29
 +#define GPIO_LED_GREEN      IOPORT5
 +#define PIN_LED_GREEN       31
 +#define GPIO_LED_BLUE       IOPORT4
 +#define PIN_LED_BLUE        5
 +#define GPIO_BUTTON         IOPORT4
 +#define PIN_BUTTON          0
 +#define GPIO_LIGHT_SENSOR   IOPORT5
 +#define PIN_LIGHT_SENSOR    22
 +
 +/* Inertial sensor: FXOS8700CQ */
 +/* Default I2C address 0x1D */
 +/* Note: the pins PTE24/25 are assigned to I2C0 by default;
 + *       if I2C0 is wanted on other pins, these need to be
 + *       assigned another function explicitly!
 + */
 +#define I2C_GYRO I2C0
 +
 +#define LINE_LED_RED      PAL_LINE(GPIO_LED_RED, PIN_LED_RED)
 +#define LINE_LED_GREEN    PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN)
 +#define LINE_LED_BLUE     PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE)
 +#define LINE_BUTTON       PAL_LINE(GPIO_BUTTON, PIN_BUTTON)
 +#define LINE_LIGHT_SENSOR PAL_LINE(GPIO_LIGHT_SENSOR, PIN_LIGHT_SENSOR)
 +#define LINE_GYRO_SCL     PAL_LINE(GPIOE, 24U)
 +#define LINE_GYRO_SDA     PAL_LINE(GPIOE, 25U)
 +#define LINE_GYRO_INT1    PAL_LINE(GPIOD, 0U)
 +#define LINE_GYRO_INT2    PAL_LINE(GPIOD, 1U)
  /*
   * Not configured:
 diff --git a/os/hal/boards/MCHCK_K20/board.h b/os/hal/boards/MCHCK_K20/board.h index 504ab0e..aad3e27 100644 --- a/os/hal/boards/MCHCK_K20/board.h +++ b/os/hal/boards/MCHCK_K20/board.h @@ -34,6 +34,8 @@  #define GPIOB_LED   16
 +#define LINE_LED    PAL_LINE(GPIOB, GPIOB_LED)
 +
  #if !defined(_FROM_ASM_)
  #ifdef __cplusplus
  extern "C" {
 diff --git a/os/hal/boards/PJRC_TEENSY_3/board.h b/os/hal/boards/PJRC_TEENSY_3/board.h index ee9f514..f3e7383 100644 --- a/os/hal/boards/PJRC_TEENSY_3/board.h +++ b/os/hal/boards/PJRC_TEENSY_3/board.h @@ -245,6 +245,43 @@  #define TEENSY_PIN26_IOPORT IOPORT5
  #define TEENSY_PIN31_IOPORT IOPORT5
 +#define LINE_PIN1           PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1)
 +#define LINE_PIN2           PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2)
 +#define LINE_PIN3           PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3)
 +#define LINE_PIN4           PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4)
 +#define LINE_PIN5           PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5)
 +#define LINE_PIN6           PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6)
 +#define LINE_PIN7           PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7)
 +#define LINE_PIN8           PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8)
 +#define LINE_PIN9           PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9)
 +#define LINE_PIN10          PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10)
 +#define LINE_PIN11          PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11)
 +#define LINE_PIN12          PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12)
 +#define LINE_PIN13          PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13)
 +#define LINE_PIN14          PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14)
 +#define LINE_PIN15          PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15)
 +#define LINE_PIN16          PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16)
 +#define LINE_PIN17          PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17)
 +#define LINE_PIN18          PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18)
 +#define LINE_PIN19          PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19)
 +#define LINE_PIN20          PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20)
 +#define LINE_PIN21          PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21)
 +#define LINE_PIN22          PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22)
 +#define LINE_PIN23          PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23)
 +#define LINE_PIN24          PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24)
 +#define LINE_PIN25          PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
 +#define LINE_PIN25          PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
 +#define LINE_PIN26          PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26)
 +#define LINE_PIN27          PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27)
 +#define LINE_PIN28          PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28)
 +#define LINE_PIN29          PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29)
 +#define LINE_PIN30          PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30)
 +#define LINE_PIN31          PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31)
 +#define LINE_PIN32          PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32)
 +#define LINE_PIN33          PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33)
 +
 +#define LINE_LED            LINE_PIN13
 +
  #if !defined(_FROM_ASM_)
  #ifdef __cplusplus
  extern "C" {
 diff --git a/os/hal/boards/PJRC_TEENSY_3_1/board.h b/os/hal/boards/PJRC_TEENSY_3_1/board.h index 6e89c07..76a52b7 100644 --- a/os/hal/boards/PJRC_TEENSY_3_1/board.h +++ b/os/hal/boards/PJRC_TEENSY_3_1/board.h @@ -245,6 +245,43 @@  #define TEENSY_PIN26_IOPORT IOPORT5
  #define TEENSY_PIN31_IOPORT IOPORT5
 +#define LINE_PIN1           PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1)
 +#define LINE_PIN2           PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2)
 +#define LINE_PIN3           PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3)
 +#define LINE_PIN4           PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4)
 +#define LINE_PIN5           PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5)
 +#define LINE_PIN6           PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6)
 +#define LINE_PIN7           PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7)
 +#define LINE_PIN8           PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8)
 +#define LINE_PIN9           PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9)
 +#define LINE_PIN10          PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10)
 +#define LINE_PIN11          PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11)
 +#define LINE_PIN12          PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12)
 +#define LINE_PIN13          PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13)
 +#define LINE_PIN14          PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14)
 +#define LINE_PIN15          PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15)
 +#define LINE_PIN16          PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16)
 +#define LINE_PIN17          PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17)
 +#define LINE_PIN18          PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18)
 +#define LINE_PIN19          PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19)
 +#define LINE_PIN20          PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20)
 +#define LINE_PIN21          PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21)
 +#define LINE_PIN22          PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22)
 +#define LINE_PIN23          PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23)
 +#define LINE_PIN24          PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24)
 +#define LINE_PIN25          PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
 +#define LINE_PIN25          PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
 +#define LINE_PIN26          PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26)
 +#define LINE_PIN27          PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27)
 +#define LINE_PIN28          PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28)
 +#define LINE_PIN29          PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29)
 +#define LINE_PIN30          PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30)
 +#define LINE_PIN31          PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31)
 +#define LINE_PIN32          PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32)
 +#define LINE_PIN33          PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33)
 +
 +#define LINE_LED            LINE_PIN13
 +
  #if !defined(_FROM_ASM_)
  #ifdef __cplusplus
  extern "C" {
 diff --git a/os/hal/boards/PJRC_TEENSY_LC/board.h b/os/hal/boards/PJRC_TEENSY_LC/board.h index 3f181f8..ad75343 100644 --- a/os/hal/boards/PJRC_TEENSY_LC/board.h +++ b/os/hal/boards/PJRC_TEENSY_LC/board.h @@ -238,6 +238,34 @@  #define TEENSY_PIN25_IOPORT IOPORT5
  #define TEENSY_PIN26_IOPORT IOPORT5
 +#define LINE_PIN1           PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1)
 +#define LINE_PIN2           PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2)
 +#define LINE_PIN3           PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3)
 +#define LINE_PIN4           PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4)
 +#define LINE_PIN5           PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5)
 +#define LINE_PIN6           PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6)
 +#define LINE_PIN7           PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7)
 +#define LINE_PIN8           PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8)
 +#define LINE_PIN9           PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9)
 +#define LINE_PIN10          PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10)
 +#define LINE_PIN11          PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11)
 +#define LINE_PIN12          PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12)
 +#define LINE_PIN13          PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13)
 +#define LINE_PIN14          PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14)
 +#define LINE_PIN15          PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15)
 +#define LINE_PIN16          PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16)
 +#define LINE_PIN17          PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17)
 +#define LINE_PIN18          PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18)
 +#define LINE_PIN19          PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19)
 +#define LINE_PIN20          PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20)
 +#define LINE_PIN21          PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21)
 +#define LINE_PIN22          PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22)
 +#define LINE_PIN23          PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23)
 +#define LINE_PIN24          PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24)
 +#define LINE_PIN25          PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
 +
 +#define LINE_LED            LINE_PIN13
 +
  #if !defined(_FROM_ASM_)
  #ifdef __cplusplus
  extern "C" {
 diff --git a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h index 05749d5..833d95e 100644 --- a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h @@ -70,6 +70,11 @@ typedef uint32_t ioportmask_t;  typedef uint32_t iomode_t;
  /**
 + * @brief   Type of an I/O line.
 + */
 +typedef uint32_t ioline_t;
 +
 +/**
   * @brief   Port Identifier.
   * @details This type can be a scalar or some kind of pointer, do not make
   *          any assumption about it, use the provided macros when populating
 @@ -129,6 +134,38 @@ typedef struct {   */
  #define IOPORT5          GPIOE
 +/**
 + * @name    Line handling macros
 + * @{
 + */
 +/**
 + * @brief   Forms a line identifier.
 + * @details A port/pad pair are encoded into an @p ioline_t type. The encoding
 + *          of this type is platform-dependent.
 + * @note    In this driver the pad number is encoded in the byte of the GPIO
 + *          address that's zero on all Kinetis devices.
 + */
 +#define PAL_LINE(port, pad)                                                 \
 +  ((ioline_t)((uint32_t)(port) | ((uint32_t)(pad)<<20)))
 +
 +/**
 + * @brief   Decodes a port identifier from a line identifier.
 + */
 +#define PAL_PORT(line)                                                      \
 +  ((GPIO_TypeDef *)(((uint32_t)(line)) & 0xF00FFFFFU))
 +
 +/**
 + * @brief   Decodes a pad identifier from a line identifier.
 + */
 +#define PAL_PAD(line)                                                       \
 +  ((uint32_t)((uint32_t)(line) & 0x0FF00000U)>>20)
 +
 +/**
 + * @brief   Value identifying an invalid line.
 + */
 +#define PAL_NOLINE                      0U
 +/** @} */
 +
  /*===========================================================================*/
  /* Implementation, some of the following macros could be implemented as      */
  /* functions, if so please put them in pal_lld.c.                            */
 | 
