Skip to content

Commit 7a7873c

Browse files
vmedcyArto Kinnunen
authored andcommitted
PSOC6: add WHD sources
1 parent 5c027db commit 7a7873c

File tree

82 files changed

+70271
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+70271
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* This file is used to set the MAC address in NVRAM.
3+
* The MAC address of the Wi-Fi device may be configured in OTP and/or in NVRAM.
4+
* If both OTP and NVRAM contains the MAC address then OTP programmed MAC address will be used.
5+
* PSOC boards are usually programmed with OTP MAC address.
6+
* MAC address is printed during WHD power up
7+
*/
8+
9+
#define NVRAM_GENERATED_MAC_ADDRESS "macaddr=00:A0:50:45:2e:c8"
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright 2019 Cypress Semiconductor Corporation
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/** @file whd.h
19+
* Provides abstract pointer type to act as instance for: driver, interface, buffer funcs, network funcs, resource funcs and bus funcs.
20+
*/
21+
22+
#include "whd_types.h"
23+
24+
#ifndef INCLUDED_WHD_H
25+
#define INCLUDED_WHD_H
26+
27+
#ifdef __cplusplus
28+
extern "C"
29+
{
30+
#endif
31+
32+
/**
33+
* Abstract pointer type that acts as a handle to an instance of the driver
34+
*/
35+
typedef struct whd_driver *whd_driver_t;
36+
37+
/**
38+
* Abstract pointer type to handle instance of whd interface
39+
*/
40+
typedef struct whd_interface *whd_interface_t;
41+
42+
/**
43+
* Abstract type that acts as a handle to an instance of a buffer function
44+
*/
45+
typedef struct whd_buffer_funcs whd_buffer_funcs_t;
46+
47+
/**
48+
* Abstract type that acts as a handle to an instance of a network interface function
49+
*/
50+
typedef struct whd_netif_funcs whd_netif_funcs_t;
51+
52+
/**
53+
* Abstract type that acts as a handle to an instance of a resource function
54+
*/
55+
typedef struct whd_resource_source whd_resource_source_t;
56+
57+
/**
58+
* Abstract type that acts as a handle to an instance of a bus function used for SDIO specific functionality
59+
*/
60+
typedef struct whd_bus_funcs whd_sdio_funcs_t;
61+
62+
/**
63+
* Abstract type that acts as a handle to an instance of a bus function used for SPI specific functionality
64+
*/
65+
typedef struct whd_bus_funcs whd_spi_funcs_t;
66+
67+
/**
68+
* Structure for storing WHD init configurations
69+
*/
70+
typedef struct whd_init_config
71+
{
72+
void *thread_stack_start; /**< Pointer to the WHD thread stack */
73+
uint32_t thread_stack_size; /**< Size of the WHD thread stack */
74+
uint32_t thread_priority; /**< Priority to be set to WHD Thread */
75+
whd_country_code_t country; /**< Variable to strore country code information */
76+
} whd_init_config_t;
77+
78+
#ifdef __cplusplus
79+
} /* extern "C" */
80+
#endif
81+
#endif /* INCLUDED_WHD_H */
82+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright 2019 Cypress Semiconductor Corporation
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/** @file whd_bus_types.h
19+
* Defines common data types used with WHD SDIO/SPI bus
20+
*
21+
*/
22+
23+
#ifndef INCLUDED_WHD_BUS_TYPES_H
24+
#define INCLUDED_WHD_BUS_TYPES_H
25+
26+
#include "whd.h"
27+
28+
#ifdef __cplusplus
29+
extern "C"
30+
{
31+
#endif
32+
33+
/** @addtogroup busapi WHD Bus API
34+
* Allows WHD to operate with specific SDIO/SPI bus
35+
* @{
36+
*/
37+
38+
/**
39+
* WiFi device GPIO pin selections
40+
*/
41+
typedef enum whd_dev_gpio_sel
42+
{
43+
WHD_DEV_GPIO_SEL_GPIO0 = 0, /**< Select GPIO0 */
44+
} whd_dev_gpio_sel_t;
45+
46+
/**
47+
* Interrupt configuration structure
48+
*/
49+
typedef struct whd_intr_config
50+
{
51+
whd_dev_gpio_sel_t dev_gpio_sel; /**< WiFi device-side GPIO pin selection */
52+
whd_bool_t is_falling_edge; /**< Interrupt trigger (polarity) */
53+
} whd_intr_config_t;
54+
55+
/**
56+
* Prototype for a user-defined function to enable interrupt to be signaled.
57+
*
58+
* This function must be provided whenever @ref WHD_BUS_SDIO_OOB_INTR is set.
59+
*
60+
* WHD will call this function to enable or disable an interrupt depending on the enable bool variable. When the interrupt
61+
* is asserted, the IRQ handler must call the appropriate "asserted" function with the WHD
62+
* context pointer associated with the IRQ.
63+
*
64+
* @param whd_drv Pointer to handle instance of the driver
65+
* @param intr Opaque interrupt signal
66+
* @param enable WHD_TRUE means to enable the interrupt, otherwise disable.
67+
*/
68+
typedef void (*whd_enable_intr_func_t)(whd_driver_t whd_drv, const whd_variant_t intr, whd_bool_t enable);
69+
70+
/**
71+
* Prototype for a user-defined function to get interrupt configuration.
72+
*
73+
* WHD calls this function to get an interrupt's configuration.
74+
*
75+
* This function must be provided whenever @ref WHD_BUS_SDIO_OOB_INTR is set.
76+
*
77+
* @param whd_driver Pointer to handle instance of the driver
78+
* @param intr Opaque interrupt signal
79+
* @param config Pointer to the interrupt configuration
80+
*/
81+
typedef void (*whd_get_intr_config_func_t)(whd_driver_t whd_driver, const whd_variant_t intr,
82+
whd_intr_config_t *config);
83+
84+
/**
85+
* Structure of function pointers for bus operations.
86+
*/
87+
struct whd_bus_funcs
88+
{
89+
whd_enable_intr_func_t whd_enable_intr; /**< Enable interrupt to be signaled */
90+
whd_get_intr_config_func_t whd_get_intr_config; /**< Get interrupt configuration */
91+
};
92+
/* @} */
93+
94+
#ifdef __cplusplus
95+
} /*extern "C" */
96+
#endif
97+
#endif /* INCLUDED_WHD_BUS_TYPES_H */
98+

0 commit comments

Comments
 (0)