blob: ee44b08843530ec77806ee6f6108e153f787af0e [file] [log] [blame]
Risto Bell70345f82022-09-12 02:56:40 -07001// SPDX-FileCopyrightText: 2022 Efabless Corporation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// SPDX-License-Identifier: Apache-2.0
15
16`default_nettype none
17
18`ifndef __USER_DEFINES_H
19// User GPIO initial configuration parameters
20`define __USER_DEFINES_H
21
22// deliberately erroneous placeholder value; user required to config GPIO's to other
23`define GPIO_MODE_INVALID 13'hXXXX
24
25// Authoritive source of these MODE defs is: caravel/verilog/rtl/user_defines.v
26// Useful GPIO mode values. These match the names used in defs.h.
27//
Jeff DiCorpoe45bfdc2022-09-30 07:36:34 -070028`define GPIO_MODE_MGMT_STD_INPUT_NOPULL 13'h0403
Tim Edwards8b1a5142022-10-05 14:23:39 -040029`define GPIO_MODE_MGMT_STD_INPUT_PULLDOWN 13'h0c01
30`define GPIO_MODE_MGMT_STD_INPUT_PULLUP 13'h0801
Jeff DiCorpoe45bfdc2022-09-30 07:36:34 -070031`define GPIO_MODE_MGMT_STD_OUTPUT 13'h1809
32`define GPIO_MODE_MGMT_STD_BIDIRECTIONAL 13'h1801
33`define GPIO_MODE_MGMT_STD_ANALOG 13'h000b
Risto Bell70345f82022-09-12 02:56:40 -070034
Jeff DiCorpoe45bfdc2022-09-30 07:36:34 -070035`define GPIO_MODE_USER_STD_INPUT_NOPULL 13'h0402
Tim Edwards8b1a5142022-10-05 14:23:39 -040036`define GPIO_MODE_USER_STD_INPUT_PULLDOWN 13'h0c00
37`define GPIO_MODE_USER_STD_INPUT_PULLUP 13'h0800
Jeff DiCorpoe45bfdc2022-09-30 07:36:34 -070038`define GPIO_MODE_USER_STD_OUTPUT 13'h1808
39`define GPIO_MODE_USER_STD_BIDIRECTIONAL 13'h1800
40`define GPIO_MODE_USER_STD_OUT_MONITORED 13'h1802
41`define GPIO_MODE_USER_STD_ANALOG 13'h000a
Risto Bell70345f82022-09-12 02:56:40 -070042
43// The power-on configuration for GPIO 0 to 4 is fixed and cannot be
44// modified (allowing the SPI and debug to always be accessible unless
45// overridden by a flash program).
46
47// The values below can be any of the standard types defined above,
48// or they can be any 13-bit value if the user wants a non-standard
49// startup state for the GPIO. By default, every GPIO from 5 to 37
50// is set to power up as an input controlled by the management SoC.
51// Users may want to redefine these so that the user project powers
52// up in a state that can be used immediately without depending on
53// the management SoC to run a startup program to configure the GPIOs.
54
55`define USER_CONFIG_GPIO_5_INIT `GPIO_MODE_INVALID
56`define USER_CONFIG_GPIO_6_INIT `GPIO_MODE_INVALID
57`define USER_CONFIG_GPIO_7_INIT `GPIO_MODE_INVALID
58`define USER_CONFIG_GPIO_8_INIT `GPIO_MODE_INVALID
59`define USER_CONFIG_GPIO_9_INIT `GPIO_MODE_INVALID
60`define USER_CONFIG_GPIO_10_INIT `GPIO_MODE_INVALID
61`define USER_CONFIG_GPIO_11_INIT `GPIO_MODE_INVALID
62`define USER_CONFIG_GPIO_12_INIT `GPIO_MODE_INVALID
63`define USER_CONFIG_GPIO_13_INIT `GPIO_MODE_INVALID
Risto Bell70345f82022-09-12 02:56:40 -070064
Tim Edwards190ed852022-11-16 09:43:20 -050065// Configurations of GPIO 14 to 24 are used on caravel but not caravan.
66`define USER_CONFIG_GPIO_14_INIT `GPIO_MODE_INVALID
Risto Bell70345f82022-09-12 02:56:40 -070067`define USER_CONFIG_GPIO_15_INIT `GPIO_MODE_INVALID
68`define USER_CONFIG_GPIO_16_INIT `GPIO_MODE_INVALID
69`define USER_CONFIG_GPIO_17_INIT `GPIO_MODE_INVALID
70`define USER_CONFIG_GPIO_18_INIT `GPIO_MODE_INVALID
71`define USER_CONFIG_GPIO_19_INIT `GPIO_MODE_INVALID
72`define USER_CONFIG_GPIO_20_INIT `GPIO_MODE_INVALID
73`define USER_CONFIG_GPIO_21_INIT `GPIO_MODE_INVALID
74`define USER_CONFIG_GPIO_22_INIT `GPIO_MODE_INVALID
75`define USER_CONFIG_GPIO_23_INIT `GPIO_MODE_INVALID
76`define USER_CONFIG_GPIO_24_INIT `GPIO_MODE_INVALID
Risto Bell70345f82022-09-12 02:56:40 -070077
Tim Edwards190ed852022-11-16 09:43:20 -050078`define USER_CONFIG_GPIO_25_INIT `GPIO_MODE_INVALID
Risto Bell70345f82022-09-12 02:56:40 -070079`define USER_CONFIG_GPIO_26_INIT `GPIO_MODE_INVALID
80`define USER_CONFIG_GPIO_27_INIT `GPIO_MODE_INVALID
81`define USER_CONFIG_GPIO_28_INIT `GPIO_MODE_INVALID
82`define USER_CONFIG_GPIO_29_INIT `GPIO_MODE_INVALID
83`define USER_CONFIG_GPIO_30_INIT `GPIO_MODE_INVALID
84`define USER_CONFIG_GPIO_31_INIT `GPIO_MODE_INVALID
85`define USER_CONFIG_GPIO_32_INIT `GPIO_MODE_INVALID
86`define USER_CONFIG_GPIO_33_INIT `GPIO_MODE_INVALID
87`define USER_CONFIG_GPIO_34_INIT `GPIO_MODE_INVALID
88`define USER_CONFIG_GPIO_35_INIT `GPIO_MODE_INVALID
89`define USER_CONFIG_GPIO_36_INIT `GPIO_MODE_INVALID
90`define USER_CONFIG_GPIO_37_INIT `GPIO_MODE_INVALID
91
92`endif // __USER_DEFINES_H