2015-11-11 18:43:15 +08:00
|
|
|
/* gpio_sch.h - Descriptions of registers for Intel SCH GPIO controller */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-11-11 18:43:15 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GPIO_SCH_H__
|
|
|
|
#define __GPIO_SCH_H__
|
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2016-12-20 07:41:17 +08:00
|
|
|
#include <kernel.h>
|
2015-11-11 18:43:15 +08:00
|
|
|
#include <gpio.h>
|
|
|
|
|
|
|
|
#define GPIO_SCH_REG_GEN (0x00)
|
|
|
|
#define GPIO_SCH_REG_GIO (0x04)
|
|
|
|
#define GPIO_SCH_REG_GLVL (0x08)
|
|
|
|
#define GPIO_SCH_REG_GTPE (0x0C)
|
|
|
|
#define GPIO_SCH_REG_GTNE (0x10)
|
|
|
|
#define GPIO_SCH_REG_GGPE (0x14)
|
|
|
|
#define GPIO_SCH_REG_GSMI (0x18)
|
|
|
|
#define GPIO_SCH_REG_GTS (0x1C)
|
|
|
|
|
|
|
|
struct gpio_sch_config {
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t regs;
|
|
|
|
u8_t bits;
|
|
|
|
u8_t stride[3];
|
2015-11-11 18:43:15 +08:00
|
|
|
};
|
|
|
|
|
2016-11-12 20:15:52 +08:00
|
|
|
#define GPIO_SCH_POLLING_STACK_SIZE 1024
|
|
|
|
#define GPIO_SCH_POLLING_MSEC 200
|
2015-11-11 18:43:15 +08:00
|
|
|
|
|
|
|
struct gpio_sch_data {
|
|
|
|
char __stack polling_stack[GPIO_SCH_POLLING_STACK_SIZE];
|
2017-05-10 03:12:54 +08:00
|
|
|
struct k_thread polling_thread;
|
2016-03-23 19:01:06 +08:00
|
|
|
sys_slist_t callbacks;
|
2017-01-06 14:03:57 +08:00
|
|
|
struct k_timer poll_timer;
|
2015-11-11 18:43:15 +08:00
|
|
|
|
|
|
|
struct {
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t gtpe;
|
|
|
|
u32_t gtne;
|
2015-11-11 18:43:15 +08:00
|
|
|
} int_regs;
|
|
|
|
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t cb_enabled;
|
|
|
|
u8_t poll;
|
|
|
|
u8_t stride[3];
|
2015-11-11 18:43:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __GPIO_SCH_H__ */
|