Replace clang-format with uncrustify
LLVM/clang is not used for any compilation due to it not supporting the 8-bit architectures we use (MCS-51, AVR). This means we are effectively installing 250+ MiB of dependencies for a C formatting tool. Replace it with uncrustify, which uses only ~600 KiB of space and has more granular control of formatting (800+ options). Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Tim Crawford
parent
6c3b34ee6e
commit
d3894392d5
141
.clang-format
141
.clang-format
@ -1,141 +0,0 @@
|
||||
# https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormatStyleOptions.html
|
||||
# LLVM 14 used to support Ubuntu 22.04 LTS.
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignConsecutiveMacros: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- 'foreach'
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '(_test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseBlocks: true
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: NoIndent
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakAssignment: 1000
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Latest
|
||||
StatementMacros:
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- 'STRINGIZE'
|
||||
...
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
run: ./scripts/lint/01-spdx-tags.sh
|
||||
|
||||
- name: Check formatting
|
||||
run: ./scripts/lint/02-clang-format.sh
|
||||
run: ./scripts/lint/02-uncrustify.sh
|
||||
|
||||
- name: Check shell scripts
|
||||
run: ./scripts/lint/03-shellcheck.sh
|
||||
|
156
.uncrustify.cfg
Normal file
156
.uncrustify.cfg
Normal file
@ -0,0 +1,156 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
# SPDX-FileCopyrightText: NONE
|
||||
|
||||
# Uncrustify-0.78.1_f
|
||||
# https://github.com/uncrustify/uncrustify/blob/uncrustify-0.78.1/documentation/htdocs/config.txt
|
||||
|
||||
newlines = lf
|
||||
input_tab_size = 4
|
||||
output_tab_size = 4
|
||||
disable_processing_cmt = "uncrustify:off"
|
||||
enable_processing_cmt = "uncrustify:on"
|
||||
utf8_bom = remove
|
||||
sp_arith_additive = force
|
||||
sp_assign = force
|
||||
sp_enum_brace = force
|
||||
sp_enum_after_assign = force
|
||||
sp_pp_concat = ignore
|
||||
sp_bool = force
|
||||
sp_compare = force
|
||||
sp_inside_paren = remove
|
||||
sp_paren_paren = remove
|
||||
sp_cparen_oparen = remove
|
||||
sp_paren_brace = force
|
||||
sp_before_ptr_star = force
|
||||
sp_between_ptr_star = remove
|
||||
sp_between_ptr_ref = remove
|
||||
sp_after_ptr_star = remove
|
||||
sp_after_type = ignore # XXX: Fixes using macros in assignments
|
||||
sp_before_sparen = force
|
||||
sp_inside_sparen = remove
|
||||
sp_inside_for = remove
|
||||
sp_sparen_paren = remove
|
||||
sp_sparen_brace = force
|
||||
sp_do_brace_open = force
|
||||
sp_brace_close_while = force
|
||||
sp_before_semi_for = remove
|
||||
sp_before_semi_for_empty = remove
|
||||
sp_between_semi_for_empty = remove
|
||||
sp_after_semi_for_empty = remove
|
||||
sp_before_square = remove
|
||||
sp_before_squares = remove
|
||||
sp_inside_square = remove
|
||||
sp_after_comma = add
|
||||
sp_after_cast = remove
|
||||
sp_inside_paren_cast = remove
|
||||
sp_sizeof_paren = remove
|
||||
sp_inside_braces = add
|
||||
sp_inside_braces_empty = remove
|
||||
sp_func_proto_paren = remove
|
||||
sp_func_def_paren = remove
|
||||
sp_inside_fparens = remove
|
||||
sp_inside_fparen = remove
|
||||
sp_inside_tparen = remove
|
||||
sp_after_tparen_close = remove
|
||||
sp_fparen_brace = force
|
||||
sp_func_call_paren = remove
|
||||
sp_return_paren = force
|
||||
sp_attribute_paren = remove
|
||||
sp_defined_paren = remove
|
||||
sp_else_brace = force
|
||||
sp_brace_else = force
|
||||
sp_brace_typedef = force
|
||||
sp_before_nl_cont = force
|
||||
sp_cond_colon = force
|
||||
sp_cond_question = force
|
||||
sp_endif_cmt = force
|
||||
sp_before_tr_cmt = add
|
||||
sp_num_before_tr_cmt = 1
|
||||
indent_columns = 4
|
||||
indent_with_tabs = 0
|
||||
indent_macro_brace = false
|
||||
indent_ignore_label = true
|
||||
indent_paren_close = 2
|
||||
indent_align_assign = false
|
||||
indent_align_paren = false
|
||||
indent_compound_literal_return = false
|
||||
nl_collapse_empty_body = true
|
||||
nl_collapse_empty_body_functions = true
|
||||
nl_start_of_file = remove
|
||||
nl_end_of_file = force
|
||||
nl_end_of_file_min = 1
|
||||
nl_assign_brace = remove
|
||||
nl_fcall_brace = remove
|
||||
nl_enum_brace = remove
|
||||
nl_struct_brace = remove
|
||||
nl_union_brace = remove
|
||||
nl_if_brace = remove
|
||||
nl_brace_else = remove
|
||||
nl_else_brace = remove
|
||||
nl_else_if = remove
|
||||
nl_for_brace = remove
|
||||
nl_while_brace = remove
|
||||
nl_do_brace = remove
|
||||
nl_brace_while = remove
|
||||
nl_switch_brace = remove
|
||||
nl_after_case = true
|
||||
nl_enum_own_lines = force
|
||||
nl_func_type_name = remove
|
||||
nl_func_proto_type_name = remove
|
||||
nl_func_paren = remove
|
||||
nl_func_def_paren = remove
|
||||
nl_func_call_paren = remove
|
||||
nl_fdef_brace = remove
|
||||
nl_return_expr = remove
|
||||
nl_after_semicolon = true
|
||||
nl_brace_struct_var = remove
|
||||
nl_ds_struct_enum_close_brace = true
|
||||
nl_split_if_one_liner = true
|
||||
nl_split_for_one_liner = true
|
||||
nl_split_while_one_liner = true
|
||||
nl_max = 2
|
||||
eat_blanks_after_open_brace = true
|
||||
eat_blanks_before_close_brace = true
|
||||
code_width = 100
|
||||
ls_for_split_full = true
|
||||
ls_func_split_full = true
|
||||
align_on_tabstop = true
|
||||
align_var_def_star_style = 1
|
||||
align_var_def_amp_style = 1
|
||||
align_typedef_star_style = 1
|
||||
align_typedef_amp_style = 1
|
||||
align_func_proto_star_style = 1
|
||||
align_func_proto_amp_style = 1
|
||||
align_pp_define_together = true
|
||||
cmt_width = 100
|
||||
cmt_convert_tab_to_spaces = true
|
||||
cmt_trailing_single_line_c_to_cpp = true
|
||||
mod_paren_on_return = remove
|
||||
mod_remove_extra_semicolon = true
|
||||
mod_remove_duplicate_include = true
|
||||
mod_sort_incl_import_prioritize_filename = true
|
||||
mod_move_case_break = true
|
||||
mod_move_case_return = true
|
||||
mod_remove_empty_return = true
|
||||
mod_enum_last_comma = add
|
||||
pp_multiline_define_body_indent = 4
|
||||
pp_indent_case = false
|
||||
pp_indent_func_def = false
|
||||
pp_indent_extern = false
|
||||
|
||||
#set QUALIFIER __at # XXX: Allow it to be treated as a function call
|
||||
set QUALIFIER __code
|
||||
set QUALIFIER __critical
|
||||
set QUALIFIER __data
|
||||
set QUALIFIER __idata
|
||||
set QUALIFIER __pdata
|
||||
set QUALIFIER __reentrant
|
||||
set QUALIFIER __xdata
|
||||
|
||||
set TYPE __bit
|
||||
set TYPE __sbit
|
||||
set TYPE __sfr
|
||||
set TYPE __sfr16
|
||||
set TYPE __sfr32
|
||||
|
||||
set FUNC_CALL __asm__
|
2
Makefile
2
Makefile
@ -74,7 +74,7 @@ clean:
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
./scripts/clang-format.sh apply
|
||||
uncrustify -c .uncrustify.cfg -q --no-backup $(shell git ls-files '*.c' '*.h')
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
readarray -t FILES < <(git ls-files '*.c' '*.h')
|
||||
|
||||
FMT_OPTS=(
|
||||
"-style=file"
|
||||
"--fallback-style=none"
|
||||
"--Werror"
|
||||
)
|
||||
|
||||
if [[ "$1" = "apply" ]]; then
|
||||
clang-format "${FMT_OPTS[@]}" -i "${FILES[@]}"
|
||||
else
|
||||
clang-format "${FMT_OPTS[@]}" --dry-run "${FILES[@]}"
|
||||
fi
|
@ -19,7 +19,6 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
|
||||
--yes \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang-format \
|
||||
curl \
|
||||
gcc \
|
||||
gcc-avr \
|
||||
@ -30,6 +29,7 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
|
||||
pkgconf \
|
||||
sdcc \
|
||||
shellcheck \
|
||||
uncrustify \
|
||||
xxd
|
||||
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
|
||||
sudo dnf install \
|
||||
@ -37,13 +37,13 @@ elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
|
||||
avr-gcc \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang-tools-extra \
|
||||
curl \
|
||||
gcc \
|
||||
make \
|
||||
sdcc \
|
||||
ShellCheck \
|
||||
systemd-devel \
|
||||
uncrustify \
|
||||
vim-common
|
||||
elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
sudo pacman -S \
|
||||
@ -51,7 +51,6 @@ elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
avr-gcc \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
clang \
|
||||
curl \
|
||||
gcc \
|
||||
make \
|
||||
@ -59,6 +58,7 @@ elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then
|
||||
sdcc \
|
||||
shellcheck \
|
||||
systemd-libs \
|
||||
uncrustify \
|
||||
vim
|
||||
else
|
||||
msg "Please add support for your distribution to:"
|
||||
|
@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Check if any C files or headers need to be formatted.
|
||||
|
||||
LINT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
. "$LINT_DIR/util.sh"
|
||||
|
||||
echo -n "Checking C style..."
|
||||
|
||||
if ! command -v clang-format > /dev/null; then
|
||||
skipped "clang-format not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
readarray -t FILES < <(git ls-files '*.c' '*.h')
|
||||
|
||||
FMT_OPTS=(
|
||||
"-style=file"
|
||||
"--fallback-style=none"
|
||||
"--dry-run"
|
||||
"--Werror"
|
||||
)
|
||||
|
||||
# NOTE: It is too slow to run clang-format on every file individually to report
|
||||
# which ones fail. Leave it up to the user to apply formatting via `make fmt`.
|
||||
|
||||
_output=$(clang-format "${FMT_OPTS[@]}" "${FILES[@]}" 2>&1)
|
||||
if [[ $_output != "" ]]; then
|
||||
failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
passed
|
36
scripts/lint/02-uncrustify.sh
Executable file
36
scripts/lint/02-uncrustify.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Check if any C files or headers need to be formatted.
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
LINT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
. "$LINT_DIR/util.sh"
|
||||
|
||||
echo -n "Checking C style..."
|
||||
|
||||
if ! command -v uncrustify > /dev/null; then
|
||||
skipped "uncrustify not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
needs_formatting=()
|
||||
|
||||
for file in $(git ls-files '*.c' '*.h'); do
|
||||
if ! uncrustify -c .uncrustify.cfg -q --check "$file" >/dev/null 2>&1; then
|
||||
needs_formatting+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${#needs_formatting[@]}" != "0" ]]; then
|
||||
failed
|
||||
|
||||
for file in "${needs_formatting[@]}"; do
|
||||
echo "- $file"
|
||||
done
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
passed
|
@ -8,7 +8,7 @@
|
||||
#define OSC_DIVISOR 12
|
||||
#define TICK_INTERVAL_MS 1
|
||||
// Value to reload into the timer when the overflow interrupt is triggered.
|
||||
#define TIMER_RELOAD (0xFFFF - ((TICK_INTERVAL_MS) * ((CONFIG_CLOCK_FREQ_KHZ) / OSC_DIVISOR)))
|
||||
#define TIMER_RELOAD (0xFFFF - (TICK_INTERVAL_MS * (CONFIG_CLOCK_FREQ_KHZ / OSC_DIVISOR)))
|
||||
|
||||
static volatile uint32_t time_overflows = 0;
|
||||
|
||||
|
@ -11,9 +11,11 @@
|
||||
#include <arch/i2c_slave.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// uncrustify:off
|
||||
static void (*volatile i2c_slave_new_cb)() = NULL;
|
||||
static void (*volatile i2c_slave_recv_cb)(uint8_t) = NULL;
|
||||
static uint8_t (*volatile i2c_slave_send_cb)() = NULL;
|
||||
// uncrustify:on
|
||||
|
||||
void i2c_slave_init(
|
||||
uint8_t address,
|
||||
|
@ -16,14 +16,12 @@ struct Gpio {
|
||||
uint8_t value;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define GPIO(BLOCK, NUMBER) { \
|
||||
.pin = &PIN ## BLOCK, \
|
||||
.ddr = &DDR ## BLOCK, \
|
||||
.port = &PORT ## BLOCK, \
|
||||
.value = BIT(NUMBER), \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
bool gpio_get(const struct Gpio *const gpio);
|
||||
void gpio_set(struct Gpio *const gpio, bool value);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <arch/uart.h>
|
||||
#include <board/cpu.h>
|
||||
|
||||
// clang-format off
|
||||
#define UART(N) \
|
||||
{ \
|
||||
&UCSR ## N ## A, \
|
||||
@ -40,7 +39,6 @@
|
||||
#else
|
||||
#error "Could not find UART definitions"
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
int16_t uart_count(void) {
|
||||
return sizeof(UARTS) / sizeof(struct Uart);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <arch/gpio.h>
|
||||
#include <arch/uart.h>
|
||||
|
||||
// clang-format off
|
||||
// Mapping of 24-pin ribbon cable to parallel pins. See schematic
|
||||
#define PINS \
|
||||
/* Data (KSO0 - KSO7) - bi-directional */ \
|
||||
@ -114,8 +113,6 @@ static struct Parallel PORT = {
|
||||
.state = PARALLEL_STATE_UNKNOWN,
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Set port to all high-impedance inputs
|
||||
void parallel_hiz(struct Parallel *const port) {
|
||||
#define PIN(N, P) \
|
||||
@ -137,8 +134,10 @@ void parallel_data_dir(struct Parallel *const port, bool dir) {
|
||||
void parallel_data_set_high(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, true);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, true); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
@ -205,8 +204,10 @@ void parallel_state(struct Parallel *const port, enum ParallelState state) {
|
||||
uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
uint8_t byte = 0;
|
||||
#define DATA_BIT(B) \
|
||||
if (gpio_get(port->d##B)) \
|
||||
byte |= (1 << B);
|
||||
if (gpio_get(port->d##B)) { \
|
||||
byte |= (1 << B); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
return byte;
|
||||
@ -216,8 +217,10 @@ void parallel_write_data(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, false);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, false); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <arch/gpio.h>
|
||||
#include <arch/uart.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Mapping of 24-pin ribbon cable to parallel pins. See schematic
|
||||
#define PINS \
|
||||
/* Data (KSO0 - KSO7) - bi-directional */ \
|
||||
@ -67,8 +65,6 @@ static struct Gpio GPIOS[13] = {
|
||||
GPIO(C, 0),
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Parallel struct definition
|
||||
// See http://efplus.com/techref/io/parallel/1284/eppmode.htm
|
||||
struct Parallel {
|
||||
@ -89,6 +85,7 @@ void parallel_hiz(struct Parallel *const port) {
|
||||
#define PIN(N, P) \
|
||||
gpio_set_dir(port->N, false); \
|
||||
gpio_set(port->N, false);
|
||||
|
||||
PINS
|
||||
#undef PIN
|
||||
}
|
||||
@ -105,8 +102,10 @@ void parallel_data_dir(struct Parallel *const port, bool dir) {
|
||||
void parallel_data_set_high(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, true);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, true); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
@ -154,8 +153,10 @@ void parallel_reset(struct Parallel *const port, bool host) {
|
||||
uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
uint8_t byte = 0;
|
||||
#define DATA_BIT(B) \
|
||||
if (gpio_get(port->d##B)) \
|
||||
byte |= (1 << B);
|
||||
if (gpio_get(port->d##B)) { \
|
||||
byte |= (1 << B); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
return byte;
|
||||
@ -164,8 +165,10 @@ uint8_t parallel_read_data(struct Parallel *const port) {
|
||||
void parallel_write_data(struct Parallel *const port, uint8_t byte) {
|
||||
// By convention all lines are high, so only set the ones needed
|
||||
#define DATA_BIT(B) \
|
||||
if (!(byte & (1 << B))) \
|
||||
gpio_set(port->d##B, false);
|
||||
if (!(byte & (1 << B))) { \
|
||||
gpio_set(port->d##B, false); \
|
||||
}
|
||||
|
||||
DATA_BITS
|
||||
#undef DATA_BIT
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -42,7 +42,7 @@ struct Gpio __code USB_PWR_EN_N = GPIO(F, 7);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 0); // renamed to SLP_SUS_EC#
|
||||
struct Gpio __code WLAN_EN = GPIO(J, 2);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(B, 0);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -53,6 +52,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -40,7 +40,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 7);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -50,6 +49,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -32,7 +32,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(D, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -32,7 +32,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
//struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(H, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code AC_V1_EC = GPIO(J, 7);
|
||||
@ -39,7 +39,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4); // renamed to EN_3V
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code AC_V1_EC;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -34,7 +34,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(B, 5);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -43,6 +42,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -43,22 +43,22 @@ void fcommand(void) {
|
||||
break;
|
||||
// Set color
|
||||
case 3:
|
||||
// clang-format off
|
||||
kbled_set_color(
|
||||
((uint32_t)fbuf[0]) |
|
||||
((uint32_t)fbuf[1] << 16) |
|
||||
((uint32_t)fbuf[2] << 8)
|
||||
);
|
||||
// clang-format on
|
||||
break;
|
||||
// Get color
|
||||
case 4:
|
||||
// uncrustify:off
|
||||
{
|
||||
uint32_t color = kbled_get_color();
|
||||
fbuf[0] = color & 0xFF;
|
||||
fbuf[1] = (color >> 16) & 0xFF;
|
||||
fbuf[2] = (color >> 8) & 0xFF;
|
||||
}
|
||||
// uncrustify:on
|
||||
break;
|
||||
// DUPLICATE: Set brightness
|
||||
case 6:
|
||||
@ -83,7 +83,7 @@ void acpi_reset(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
uint8_t acpi_read(uint8_t addr) {
|
||||
uint8_t data = 0;
|
||||
|
||||
@ -181,20 +181,20 @@ uint8_t acpi_read(uint8_t addr) {
|
||||
#endif // HAVE_LED_AIRPLANE_N
|
||||
|
||||
// Set size of flash (from old firmware)
|
||||
ACPI_8 (0xE5, 0x80);
|
||||
ACPI_8(0xE5, 0x80);
|
||||
|
||||
ACPI_8 (0xF8, fcmd);
|
||||
ACPI_8 (0xF9, fdat);
|
||||
ACPI_8 (0xFA, fbuf[0]);
|
||||
ACPI_8 (0xFB, fbuf[1]);
|
||||
ACPI_8 (0xFC, fbuf[2]);
|
||||
ACPI_8 (0xFD, fbuf[3]);
|
||||
ACPI_8(0xF8, fcmd);
|
||||
ACPI_8(0xF9, fdat);
|
||||
ACPI_8(0xFA, fbuf[0]);
|
||||
ACPI_8(0xFB, fbuf[1]);
|
||||
ACPI_8(0xFC, fbuf[2]);
|
||||
ACPI_8(0xFD, fbuf[3]);
|
||||
}
|
||||
|
||||
TRACE("acpi_read %02X = %02X\n", addr, data);
|
||||
return data;
|
||||
}
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void acpi_write(uint8_t addr, uint8_t data) {
|
||||
TRACE("acpi_write %02X = %02X\n", addr, data);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <common/macro.h>
|
||||
#include <common/debug.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
|
||||
// Registers
|
||||
#define REG_CHARGE_CURRENT 0x14
|
||||
@ -86,7 +86,7 @@
|
||||
#error Invalid adapter:battery RSENSE ratio
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
// XXX: Assumption: ac_last is initialized high.
|
||||
static bool charger_enabled = false;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <common/debug.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
|
||||
// Registers
|
||||
#define REG_CHARGE_CURRENT 0x14
|
||||
@ -71,7 +71,8 @@
|
||||
#else
|
||||
#error Invalid CHARGER_PSYS_GAIN value
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// uncrustify:on
|
||||
|
||||
// Sense resistor values in milliohms.
|
||||
enum sense_resistor {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define DEBUG_SET(REG, MASK, BITS) \
|
||||
{ \
|
||||
DEBUG("%s: %X", #REG, REG); \
|
||||
REG = ((REG) & ~(MASK)) | (BITS); \
|
||||
REG = (REG & ~(MASK)) | (BITS); \
|
||||
DEBUG(" set to %X\n", REG); \
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,10 @@ uint8_t fan_duty(const struct Fan *const fan, int16_t temp) __reentrant {
|
||||
if (temp > prev->temp) {
|
||||
int16_t dtemp = (cur->temp - prev->temp);
|
||||
int16_t dduty = ((int16_t)cur->duty) - ((int16_t)prev->duty);
|
||||
// clang-format off
|
||||
return (uint8_t)(
|
||||
((int16_t)prev->duty) +
|
||||
((temp - prev->temp) * dduty) / dtemp
|
||||
);
|
||||
// clang-format on
|
||||
}
|
||||
} else {
|
||||
return prev->duty;
|
||||
@ -127,11 +125,9 @@ uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) __reentrant {
|
||||
// ramping down
|
||||
if (duty < last_duty) {
|
||||
// out of bounds (lower) safeguard
|
||||
// clang-format off
|
||||
uint8_t smoothed = last_duty < MIN_FAN_SPEED + MAX_JUMP_DOWN
|
||||
? MIN_FAN_SPEED
|
||||
: last_duty - MAX_JUMP_DOWN;
|
||||
// clang-format on
|
||||
|
||||
// use smoothed value if above min and if smoothed is closer than raw
|
||||
if (last_duty > MIN_SPEED_TO_SMOOTH && smoothed > duty) {
|
||||
@ -142,11 +138,9 @@ uint8_t fan_smooth(uint8_t last_duty, uint8_t duty) __reentrant {
|
||||
// ramping up
|
||||
if (duty > last_duty) {
|
||||
// out of bounds (higher) safeguard
|
||||
// clang-format off
|
||||
uint8_t smoothed = last_duty > MAX_FAN_SPEED - MAX_JUMP_UP
|
||||
? MAX_FAN_SPEED
|
||||
: last_duty + MAX_JUMP_UP;
|
||||
// clang-format on
|
||||
|
||||
// use smoothed value if above min and if smoothed is closer than raw
|
||||
if (duty > MIN_SPEED_TO_SMOOTH && smoothed < duty) {
|
||||
|
@ -15,7 +15,6 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
// clang-format off
|
||||
#define SPI_DEVICE (0x70)
|
||||
#define SPI_FOLLOW_MODE (0x0F)
|
||||
#define SPI_CHIP_SELECT (0xFD)
|
||||
@ -30,7 +29,6 @@ volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
#define SPI_ERASE_SECTOR_COMMAND (0xD7)
|
||||
|
||||
#define SPI_STATUS_WIP (0x01)
|
||||
// clang-format on
|
||||
|
||||
void flash_enter_follow_mode(void);
|
||||
void flash_exit_follow_mode(void);
|
||||
@ -48,9 +46,7 @@ void flash_write_enable(void);
|
||||
* NOTE: __critical to ensure interrupts are disabled. This does mean that interrupt
|
||||
* such as the timer will be block until flash acccess is complete
|
||||
*/
|
||||
// clang-format off
|
||||
void flash_entry(uint32_t addr, uint8_t *data, uint32_t length, uint8_t command) __reentrant __critical {
|
||||
// clang-format on
|
||||
// Only allow access from 64KB to 128KB.
|
||||
if ((addr < 0x10000) || (length > 0x10000) || ((addr + length) > 0x20000))
|
||||
return;
|
||||
@ -73,7 +69,8 @@ void flash_entry(uint32_t addr, uint8_t *data, uint32_t length, uint8_t command)
|
||||
flash_enter_follow_mode();
|
||||
|
||||
while (length) {
|
||||
// Note, this is the slow way to do it, but it's simple and all bytes are written properly.
|
||||
// Note, this is the slow way to do it, but it's simple and all
|
||||
// bytes are written properly.
|
||||
flash_write_enable();
|
||||
|
||||
// Select the device
|
||||
|
@ -12,11 +12,9 @@
|
||||
/** \cond INTERNAL
|
||||
* Internal defines
|
||||
*/
|
||||
// clang-format off
|
||||
#define FLASH_COMMAND_READ (0x0)
|
||||
#define FLASH_COMMAND_WRITE (0x1)
|
||||
#define FLASH_COMMAND_ERASE_1K (0x2)
|
||||
// clang-format on
|
||||
/** \endcond */
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,6 @@ static bool kbc_translate = true;
|
||||
// LED state
|
||||
uint8_t kbc_leds = 0;
|
||||
|
||||
// clang-format off
|
||||
// Values from linux/drivers/input/keyboard/atkbd.c
|
||||
static const uint16_t kbc_typematic_period[32] = {
|
||||
33, // 30.0 cps = ~33.33ms
|
||||
@ -77,7 +76,6 @@ static const uint16_t kbc_typematic_period[32] = {
|
||||
470, // 2.1 cps = ~478.19ms
|
||||
500, // 2.0 cps = 500ms
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static uint8_t kbc_buffer[16] = { 0 };
|
||||
static uint8_t kbc_buffer_head = 0;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
enum KbledKind kbled_kind = KBLED_NONE;
|
||||
|
||||
// clang-format off
|
||||
static uint8_t LEVEL_I = 1;
|
||||
#ifdef KBLED_DAC
|
||||
// XXX: DAC uses separate levels due to brightness being different.
|
||||
@ -38,7 +37,6 @@ static const uint32_t __code COLORS[] = {
|
||||
0x00FFFF,
|
||||
0xFFFF00
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void kbled_hotkey_color(void) {
|
||||
if (COLOR_I < (ARRAY_SIZE(COLORS) - 1)) {
|
||||
|
@ -330,10 +330,8 @@ void kbscan_event(void) {
|
||||
|
||||
// A key was pressed or released
|
||||
for (uint8_t j = 0; j < KM_IN; j++) {
|
||||
// clang-format off
|
||||
bool new_b = new & BIT(j);
|
||||
bool last_b = last & BIT(j);
|
||||
// clang-format on
|
||||
if (new_b != last_b) {
|
||||
bool reset = false;
|
||||
|
||||
|
@ -19,14 +19,12 @@
|
||||
* nWAIT = KSOH[1]
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
#define CTL_WRITE BIT(0)
|
||||
#define CTL_DATA BIT(1)
|
||||
#define CTL_RESET BIT(2)
|
||||
#define CTL_ADDR BIT(3)
|
||||
|
||||
#define STS_WAIT BIT(1)
|
||||
// clang-format on
|
||||
|
||||
// Maximum peripheral response time in ms
|
||||
#define PARALLEL_TIMEOUT 10
|
||||
|
@ -36,9 +36,7 @@ int16_t peci_temp = 0;
|
||||
// Maximum OOB channel response time in ms
|
||||
#define PECI_ESPI_TIMEOUT 10
|
||||
|
||||
// clang-format off
|
||||
#define FAN_POINT(T, D) { .temp = PECI_TEMP(T), .duty = PWM_DUTY(D) }
|
||||
// clang-format on
|
||||
|
||||
// Fan curve with temperature in degrees C, duty cycle in percent
|
||||
static struct FanPoint __code FAN_POINTS[] = {
|
||||
|
@ -491,7 +491,6 @@ void power_event(void) {
|
||||
}
|
||||
pg_last = pg_new;
|
||||
|
||||
// clang-format off
|
||||
static bool rst_last = false;
|
||||
bool rst_new = gpio_get(&BUF_PLT_RST_N);
|
||||
#if LEVEL >= LEVEL_DEBUG
|
||||
@ -508,7 +507,6 @@ void power_event(void) {
|
||||
#endif // CONFIG_BUS_ESPI
|
||||
}
|
||||
rst_last = rst_new;
|
||||
// clang-format on
|
||||
|
||||
#if HAVE_SLP_SUS_N
|
||||
#if LEVEL >= LEVEL_DEBUG
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(F, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -31,7 +31,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(E, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(F, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -31,7 +31,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(E, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -43,7 +43,7 @@ struct Gpio __code VA_EC_EN = GPIO(E, 3);
|
||||
struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(H, 5);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -40,7 +40,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -50,6 +49,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(F, 3);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(G, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -46,6 +45,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(F, 3);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(G, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -47,6 +46,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -42,7 +42,7 @@ struct Gpio __code VA_EC_EN = GPIO(E, 3);
|
||||
struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(H, 5);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -47,6 +46,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -41,7 +41,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -50,6 +49,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -39,7 +39,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -49,6 +48,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -38,7 +38,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -46,6 +45,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -36,7 +36,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -36,7 +36,7 @@ struct Gpio __code VA_EC_EN = GPIO(H, 7);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -36,7 +36,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(D, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -33,7 +33,7 @@ struct Gpio __code VA_EC_EN = GPIO(H, 7);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Not documented
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -39,7 +39,7 @@ struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -49,6 +48,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -36,7 +36,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Not documented
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -46,6 +45,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(A, 4);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -28,7 +28,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -44,6 +43,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
#define HAVE_WLAN_EN 0
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(A, 4);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -28,7 +28,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -44,6 +43,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
#define HAVE_WLAN_EN 0
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -40,7 +40,7 @@ struct Gpio __code VR_ON = GPIO(H, 4);
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VR_ON;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -34,7 +34,7 @@ struct Gpio __code SLP_SUS_N = GPIO(H, 7);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(D, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -35,7 +35,7 @@ struct Gpio __code SUSC_N_PCH = GPIO(H, 1);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(J, 0);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 6);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 7);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -38,7 +38,7 @@ struct Gpio __code USB_PWR_EN_N = GPIO(F, 7);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 0); // renamed to EC_SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(J, 7);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(B, 0);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Enable LPC reset on GPD2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
#define HAVE_XLP_OUT 0
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -38,7 +38,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to EC_SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -37,7 +37,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to EC_SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(H, 4);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
extern struct Gpio __code WLAN_EN;
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -35,7 +35,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to EC_SLP_SUS#
|
||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(H, 4);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// PWRSW WDT 2 Enable 2
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -38,7 +38,7 @@ struct Gpio __code USB_PWR_EN_N = GPIO(E, 3);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code WLAN_PWR_EN = GPIO(G, 1);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Not documented
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -48,6 +47,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
#define HAVE_WLAN_EN 0
|
||||
extern struct Gpio __code WLAN_PWR_EN;
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <board/gpio.h>
|
||||
#include <common/macro.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
struct Gpio __code ACIN_N = GPIO(B, 0);
|
||||
struct Gpio __code AC_PRESENT = GPIO(E, 1);
|
||||
struct Gpio __code ALL_SYS_PWRGD = GPIO(C, 0);
|
||||
@ -34,7 +34,7 @@ struct Gpio __code SWI_N = GPIO(B, 5);
|
||||
struct Gpio __code USB_PWR_EN_N = GPIO(E, 3);
|
||||
struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
||||
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
void gpio_init(void) {
|
||||
// Not documented
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
void gpio_init(void);
|
||||
|
||||
// clang-format off
|
||||
extern struct Gpio __code ACIN_N;
|
||||
extern struct Gpio __code AC_PRESENT;
|
||||
extern struct Gpio __code ALL_SYS_PWRGD;
|
||||
@ -45,6 +44,5 @@ extern struct Gpio __code VA_EC_EN;
|
||||
#define HAVE_WLAN_EN 0
|
||||
#define HAVE_WLAN_PWR_EN 0
|
||||
extern struct Gpio __code XLP_OUT;
|
||||
// clang-format on
|
||||
|
||||
#endif // _BOARD_GPIO_H
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
#include <common/i2c.h>
|
||||
|
||||
// clang-format off
|
||||
int16_t i2c_recv(struct I2C *const i2c, uint8_t addr, uint8_t *const data, uint16_t length) __reentrant {
|
||||
// clang-format on
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, true);
|
||||
@ -20,9 +18,7 @@ int16_t i2c_recv(struct I2C *const i2c, uint8_t addr, uint8_t *const data, uint1
|
||||
return res;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
int16_t i2c_send(struct I2C *const i2c, uint8_t addr, uint8_t *const data, uint16_t length) __reentrant {
|
||||
// clang-format on
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
|
@ -30,8 +30,6 @@ int16_t i2c_write(struct I2C *const i2c, const uint8_t *const data, uint16_t len
|
||||
// Must be defined by arch, board, or ec
|
||||
int16_t i2c_read(struct I2C *const i2c, uint8_t *const data, uint16_t length) __reentrant;
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Read multiple bytes from address in one transaction
|
||||
int16_t i2c_recv(
|
||||
struct I2C *const i2c,
|
||||
@ -48,8 +46,6 @@ int16_t i2c_send(
|
||||
uint16_t length
|
||||
) __reentrant;
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Read multiple bytes from a register in one transaction
|
||||
int16_t i2c_get(
|
||||
struct I2C *const i2c,
|
||||
|
@ -9,26 +9,24 @@
|
||||
#endif
|
||||
|
||||
// https://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html#ss10.3
|
||||
// clang-format off
|
||||
static uint8_t __code lookup[256] = {
|
||||
0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, 0x64, 0x44, 0x42, 0x40, 0x3e, 0x0f, 0x29, 0x59,
|
||||
0x65, 0x38, 0x2a, 0x70, 0x1d, 0x10, 0x02, 0x5a, 0x66, 0x71, 0x2c, 0x1f, 0x1e, 0x11, 0x03, 0x5b,
|
||||
0x67, 0x2e, 0x2d, 0x20, 0x12, 0x05, 0x04, 0x5c, 0x68, 0x39, 0x2f, 0x21, 0x14, 0x13, 0x06, 0x5d,
|
||||
0x69, 0x31, 0x30, 0x23, 0x22, 0x15, 0x07, 0x5e, 0x6a, 0x72, 0x32, 0x24, 0x16, 0x08, 0x09, 0x5f,
|
||||
0x6b, 0x33, 0x25, 0x17, 0x18, 0x0b, 0x0a, 0x60, 0x6c, 0x34, 0x35, 0x26, 0x27, 0x19, 0x0c, 0x61,
|
||||
0x6d, 0x73, 0x28, 0x74, 0x1a, 0x0d, 0x62, 0x6e, 0x3a, 0x36, 0x1c, 0x1b, 0x75, 0x2b, 0x63, 0x76,
|
||||
0x55, 0x56, 0x77, 0x78, 0x79, 0x7a, 0x0e, 0x7b, 0x7c, 0x4f, 0x7d, 0x4b, 0x47, 0x7e, 0x7f, 0x6f,
|
||||
0x52, 0x53, 0x50, 0x4c, 0x4d, 0x48, 0x01, 0x45, 0x57, 0x4e, 0x51, 0x4a, 0x37, 0x49, 0x46, 0x54,
|
||||
0x80, 0x81, 0x82, 0x41, 0x54, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, 0x64, 0x44, 0x42, 0x40, 0x3e, 0x0f, 0x29, 0x59,
|
||||
0x65, 0x38, 0x2a, 0x70, 0x1d, 0x10, 0x02, 0x5a, 0x66, 0x71, 0x2c, 0x1f, 0x1e, 0x11, 0x03, 0x5b,
|
||||
0x67, 0x2e, 0x2d, 0x20, 0x12, 0x05, 0x04, 0x5c, 0x68, 0x39, 0x2f, 0x21, 0x14, 0x13, 0x06, 0x5d,
|
||||
0x69, 0x31, 0x30, 0x23, 0x22, 0x15, 0x07, 0x5e, 0x6a, 0x72, 0x32, 0x24, 0x16, 0x08, 0x09, 0x5f,
|
||||
0x6b, 0x33, 0x25, 0x17, 0x18, 0x0b, 0x0a, 0x60, 0x6c, 0x34, 0x35, 0x26, 0x27, 0x19, 0x0c, 0x61,
|
||||
0x6d, 0x73, 0x28, 0x74, 0x1a, 0x0d, 0x62, 0x6e, 0x3a, 0x36, 0x1c, 0x1b, 0x75, 0x2b, 0x63, 0x76,
|
||||
0x55, 0x56, 0x77, 0x78, 0x79, 0x7a, 0x0e, 0x7b, 0x7c, 0x4f, 0x7d, 0x4b, 0x47, 0x7e, 0x7f, 0x6f,
|
||||
0x52, 0x53, 0x50, 0x4c, 0x4d, 0x48, 0x01, 0x45, 0x57, 0x4e, 0x51, 0x4a, 0x37, 0x49, 0x46, 0x54,
|
||||
0x80, 0x81, 0x82, 0x41, 0x54, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
uint16_t keymap_translate(uint16_t key) {
|
||||
return (key & 0xFF00) | lookup[(key & 0xFF)];
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define __code
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
static const char __code BOARD[] =
|
||||
"76EC_BOARD="
|
||||
xstr(__BOARD__);
|
||||
@ -15,7 +14,6 @@ static const char __code BOARD[] =
|
||||
static const char __code VERSION[] =
|
||||
"76EC_VERSION="
|
||||
xstr(__FIRMWARE_VERSION__);
|
||||
// clang-format on
|
||||
|
||||
const char *board(void) {
|
||||
return &BOARD[11];
|
||||
|
@ -134,15 +134,14 @@ static int16_t i2c_transaction(
|
||||
uint32_t timeout = I2C_TIMEOUT;
|
||||
for (timeout = I2C_TIMEOUT; timeout > 0; timeout--) {
|
||||
status = *(i2c->hosta);
|
||||
// If error occured, kill transaction and return error
|
||||
if (status & HOSTA_ERR) {
|
||||
// If error occured, kill transaction and return error
|
||||
i2c_reset(i2c, true);
|
||||
return -(int16_t)(status);
|
||||
} else
|
||||
} else if (status & HOSTA_BYTE_DONE) {
|
||||
// If byte done, break
|
||||
if (status & HOSTA_BYTE_DONE) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If timeout occured, kill transaction and return error
|
||||
if (timeout == 0) {
|
||||
|
@ -13,13 +13,11 @@ struct VirtualWire {
|
||||
uint8_t valid_mask;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define VIRTUAL_WIRE(INDEX, SHIFT) { \
|
||||
.index = &VWIDX ## INDEX, \
|
||||
.data_mask = BIT(SHIFT), \
|
||||
.valid_mask = BIT(SHIFT + 4), \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
enum VirtualWireState {
|
||||
VWS_INVALID = 0x00,
|
||||
|
@ -8,13 +8,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// clang-format off
|
||||
#define GPIO_ALT (0b00U << 6)
|
||||
#define GPIO_IN (0b10U << 6)
|
||||
#define GPIO_OUT (0b01U << 6)
|
||||
#define GPIO_UP BIT(2)
|
||||
#define GPIO_DOWN BIT(1)
|
||||
// clang-format on
|
||||
|
||||
struct Gpio {
|
||||
volatile uint8_t __xdata *data;
|
||||
@ -23,14 +21,12 @@ struct Gpio {
|
||||
uint8_t value;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define GPIO(BLOCK, NUMBER) { \
|
||||
.data = &GPDR ## BLOCK, \
|
||||
.mirror = &GPDMR ## BLOCK, \
|
||||
.control = &GPCR ## BLOCK ## NUMBER, \
|
||||
.value = BIT(NUMBER), \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
bool gpio_get(const struct Gpio *const gpio);
|
||||
void gpio_set(struct Gpio *const gpio, bool value);
|
||||
|
@ -10,7 +10,6 @@ struct IrqGroup {
|
||||
volatile uint8_t *polarity;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define IRQ_GROUP(nr) { \
|
||||
.status = &ISR ## nr, \
|
||||
.enable = &IER ## nr, \
|
||||
@ -44,7 +43,6 @@ static const struct IrqGroup irqs[] = {
|
||||
IRQ_GROUP(21),
|
||||
#endif
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void intc_enable(uint8_t nr) {
|
||||
// XXX: SDCC doesn't optimize division with power-of-2.
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <ec/pmc.h>
|
||||
|
||||
// clang-format off
|
||||
#define PMC(NUM) { \
|
||||
.status = &PM ## NUM ## STS, \
|
||||
.data_out = &PM ## NUM ## DO, \
|
||||
@ -11,7 +10,6 @@
|
||||
.interrupt_control = &PM ## NUM ## IC, \
|
||||
.interrupt_enable = &PM ## NUM ## IE, \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
struct Pmc __code PMC_1 = PMC(1);
|
||||
struct Pmc __code PMC_2 = PMC(2);
|
||||
|
@ -2,14 +2,12 @@
|
||||
|
||||
#include <ec/ps2.h>
|
||||
|
||||
// clang-format off
|
||||
#define PS2(NUM) { \
|
||||
.control = &PSCTL ## NUM, \
|
||||
.interrupt = &PSINT ## NUM, \
|
||||
.status = &PSSTS ## NUM, \
|
||||
.data = &PSDAT ## NUM, \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
struct Ps2 __code PS2_1 = PS2(1);
|
||||
struct Ps2 __code PS2_2 = PS2(2);
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <ec/espi.h>
|
||||
|
||||
// clang-format off
|
||||
#if CONFIG_BUS_ESPI
|
||||
// eSPI signature (byte 7 = 0xA4)
|
||||
static __code const uint8_t __at(0x40) SIGNATURE[16] = {
|
||||
@ -16,4 +15,3 @@ static __code const uint8_t __at(0x40) SIGNATURE[16] = {
|
||||
0x85, 0x12, 0x5A, 0x5A, 0xAA, 0x00, 0x55, 0x55,
|
||||
};
|
||||
#endif // CONFIG_BUS_ESPI
|
||||
// clang-format on
|
||||
|
@ -10,8 +10,6 @@ struct WucGroup {
|
||||
volatile uint8_t *enable;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Only groups 1, 3, and 4 have WUENR.
|
||||
#define WUC_GROUP_EN(nr) { \
|
||||
.edge = &WUEMR ## nr, \
|
||||
@ -43,8 +41,6 @@ static const struct WucGroup wuc[] = {
|
||||
WUC_GROUP(14),
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
void wuc_enable(uint8_t nr, enum WucEdgeMode detect) {
|
||||
// XXX: SDCC doesn't optimize division with power-of-2.
|
||||
const uint8_t group = nr >> 3U;
|
||||
|
@ -13,8 +13,8 @@
|
||||
// common/keymap.h requires KM_LAY, KM_OUT, and KM_IN definitions
|
||||
#include <common/keymap.h>
|
||||
|
||||
// clang-format off
|
||||
// Conversion of physical ANSI layout to keyboard matrix
|
||||
// uncrustify:off
|
||||
#define LAYOUT( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
||||
@ -41,7 +41,7 @@
|
||||
/*14*/{ ___, K2D, K57, K1D, ___, K0F, ___, K0G }, \
|
||||
/*15*/{ ___, ___, K3C, ___, K0C, ___, ___, K58 } \
|
||||
}
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
||||
// Position of physical Esc key in the matrix
|
||||
#define MATRIX_ESC_INPUT 7
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <board/keymap.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
uint16_t __code KEYMAP[KM_LAY][KM_OUT][KM_IN] = {
|
||||
LAYOUT(
|
||||
K_ESC, K_F1, K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8, K_F9, K_F10, K_F11, K_F12, K_PRINT_SCREEN, K_INSERT, K_PAUSE, K_DEL,
|
||||
@ -23,4 +23,4 @@ LAYOUT(
|
||||
K_LEFT_CTRL, KT_FN, K_LEFT_SUPER, K_LEFT_ALT, K_SPACE, K_RIGHT_ALT, K_APP, K_HOME, K_END, K_PGDN
|
||||
)
|
||||
};
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <board/keymap.h>
|
||||
|
||||
// clang-format off
|
||||
// uncrustify:off
|
||||
uint16_t __code KEYMAP[KM_LAY][KM_OUT][KM_IN] = {
|
||||
LAYOUT(
|
||||
K_ESC, K_F1, K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8, K_F9, K_F10, K_F11, K_F12, K_PRINT_SCREEN, K_INSERT, K_PAUSE, K_DEL,
|
||||
@ -23,4 +23,4 @@ LAYOUT(
|
||||
K_LEFT_CTRL, KT_FN, K_LEFT_ALT, K_LEFT_SUPER, K_ESC, K_RIGHT_ALT, K_APP, K_HOME, K_END, K_PGDN
|
||||
)
|
||||
};
|
||||
// clang-format on
|
||||
// uncrustify:on
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user