Debian Codegraph @

src/vendorcode/cavium/include/bdk/libbdk-hal/bdk-gpio.h

raw symbols SCIP
1 #ifndef __CB_BDK_GPIO_H__
2 #define __CB_BDK_GPIO_H__
3 /***********************license start***********************************
4 * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights
5 * reserved.
6 *
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 *
20 * * Neither the name of Cavium Inc. nor the names of
21 * its contributors may be used to endorse or promote products
22 * derived from this software without specific prior written
23 * permission.
24 *
25 * This Software, including technical data, may be subject to U.S. export
26 * control laws, including the U.S. Export Administration Act and its
27 * associated regulations, and may be subject to export or import
28 * regulations in other countries.
29 *
30 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
31 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
32 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT
33 * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
34 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
35 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
36 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
37 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT,
38 * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK
39 * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
40 ***********************license end**************************************/
41
42 /**
43 * @file
44 *
45 * General Purpose IO interface.
46 *
47 * <hr>$Revision: 49448 $<hr>
48 *
49 * @addtogroup hal
50 * @{
51 */
52
53
54 /**
55 * Initialize a single GPIO as either an input or output. If it is
56 * an output, also set its output value.
57 *
58 * @param node Node to use in a Numa setup. Can be an exact ID or a special
59 * value.
60 * @param gpio GPIO to initialize
61 * @param is_output Non zero if this GPIO should be an output
62 * @param output_value
63 * Value of the GPIO if it should be an output. Not used if the
64 * GPIO isn't an output.
65 *
66 * @return Zero on success, negative ob failure
67 */
68 extern int bdk_gpio_initialize(bdk_node_t node, int gpio, int is_output, int output_value);
69
70 /**
71 * GPIO Read Data
72 *
73 * @param node Node GPIO block is on
74 * @param gpio_block GPIO block to access. Each block contains up to 64 GPIOs
75 *
76 * @return Status of the GPIO pins for the given block
77 */
78 extern uint64_t bdk_gpio_read(bdk_node_t node, int gpio_block);
79
80 /**
81 * GPIO Clear pin
82 *
83 * @param node Node GPIO block is on
84 * @param gpio_block GPIO block to access. Each block contains up to 64 GPIOs
85 * @param clear_mask Bit mask to indicate which bits to drive to '0'.
86 */
87 extern void bdk_gpio_clear(bdk_node_t node, int gpio_block, uint64_t clear_mask);
88
89 /**
90 * GPIO Set pin
91 *
92 * @param node Node GPIO block is on
93 * @param gpio_block GPIO block to access. Each block contains up to 64 GPIOs
94 * @param set_mask Bit mask to indicate which bits to drive to '1'.
95 */
96 extern void bdk_gpio_set(bdk_node_t node, int gpio_block, uint64_t set_mask);
97
98 /** GPIO Select pin
99 *
100 * @param node CPU node
101 * @param gpio GPIO number
102 * @param pin Pin number
103 */
104 extern void bdk_gpio_select_pin(bdk_node_t node, int gpio, int pin);
105
106 /**
107 * Return the number of GPIO pins on this chip
108 *
109 * @return Number of GPIO pins
110 */
111 extern int bdk_gpio_get_num(void);
112
113 /** @} */
114 #endif /* !__CB_BDK_GPIO_H__ */