2015-11-03 21:52:12 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016, Wind River Systems, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file Header file for the Freescale K64 GPIO module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GPIO_K64_H_
|
|
|
|
#define _GPIO_K64_H_
|
|
|
|
|
|
|
|
#include <nanokernel.h>
|
|
|
|
|
|
|
|
#include <gpio.h>
|
|
|
|
|
|
|
|
/* GPIO Port Register offsets */
|
2016-03-23 17:53:04 +08:00
|
|
|
#define GPIO_K64_DATA_OUT_OFFSET 0x00 /* Port Data Output */
|
|
|
|
#define GPIO_K64_SET_OUT_OFFSET 0x04 /* Port Set Output */
|
|
|
|
#define GPIO_K64_CLR_OUT_OFFSET 0x08 /* Port Clear Output */
|
|
|
|
#define GPIO_K64_TOGGLE_OUT_OFFSET 0x0C /* Port Toggle Output */
|
|
|
|
#define GPIO_K64_DATA_IN_OFFSET 0x10 /* Port Data Input */
|
|
|
|
#define GPIO_K64_DIR_OFFSET 0x14 /* Port Data Direction */
|
2015-11-03 21:52:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** Configuration data */
|
|
|
|
struct gpio_k64_config {
|
arm: Freescale K64/FRDM-K64F Pinmux support
K64 pinmux support is created as a normal driver.
As opposed to the Galileo board, the pin configuration options are
defined by the MCU and are not board-specific. Separate
platform/board-specific configuration code uses the pinmux driver for
the default pin settings. For FRDM-K64F, only the Arduino pins (22 of a
possible 160) are set up.
Some of the I/O pins routed to the Arduino header are also configured as
JTAG/SWD signals by default and are used by the OpenSDAv2 debug
interface. Therefore, a PRESERVE_JTAG_IO_PINS config option was created
for the FRDM-K64 platform to prevent the default pin settings from
re-configuring these pins.
The K64 MCU separates pin configuration and control, implemented in the
pinmux driver, from GPIO. This results in some cross referencing
between the K64 GPIO driver and the K64 pinmux driver due to the
dependencies of one on the other.
This pinmux driver also uses the expanded pinmux function/mode parameter
size to describe pin configuration options with bit fields for the K64,
including up to 8 pin functions, plus interrupt, pullup/down, drive
strength, open-drain and slew rate.
The following GCC warnings in the K64 pinmux driver are prevented when not
compiling with 'no-optimization' (-O0):
warning: 'gpio_dev' may be used uninitialized in this function
[-Wmaybe-uninitialized]
Change-Id: Ie5031d18750143bf895883058b3cd55fd9989fd3
Signed-off-by: Jeff Blais <jeff.blais@windriver.com>
2016-02-02 06:30:48 +08:00
|
|
|
/* GPIO module base address */
|
|
|
|
uint32_t gpio_base_addr;
|
|
|
|
/* Port Control module base address */
|
|
|
|
uint32_t port_base_addr;
|
2015-11-03 21:52:12 +08:00
|
|
|
};
|
|
|
|
|
2015-12-12 02:23:10 +08:00
|
|
|
struct gpio_k64_data {
|
|
|
|
/* port ISR callback routine address */
|
2016-03-23 19:01:06 +08:00
|
|
|
sys_slist_t callbacks;
|
2015-12-12 02:23:10 +08:00
|
|
|
/* pin callback routine enable flags, by pin number */
|
|
|
|
uint32_t pin_callback_enables;
|
|
|
|
};
|
2015-11-03 21:52:12 +08:00
|
|
|
#endif /* _GPIO_K64_H_ */
|