1
1
/***********************************************************************************************************************
2
2
* DISCLAIMER
3
- * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
4
- * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
5
- * applicable laws, including copyright laws.
3
+ * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
4
+ * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
5
+ * applicable laws, including copyright laws.
6
6
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
7
- * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
8
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
9
- * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
10
- * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
7
+ * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
8
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
9
+ * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
10
+ * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
11
11
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
12
- * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
13
- * this software. By using this software, you agree to the additional terms and conditions found by accessing the
12
+ * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
13
+ * this software. By using this software, you agree to the additional terms and conditions found by accessing the
14
14
* following link:
15
- * http://www.renesas.com/disclaimer
15
+ * http://www.renesas.com/disclaimer
16
16
*
17
- * Copyright (C) 2018-2020 Renesas Electronics Corporation. All rights reserved.
17
+ * Copyright (C) 2018-2020 Renesas Electronics Corporation. All rights reserved.
18
18
***********************************************************************************************************************/
19
19
/* Copyright (c) 2018-2020 Renesas Electronics Corporation.
20
20
* SPDX-License-Identifier: Apache-2.0
39
39
40
40
/* Guards against multiple inclusion */
41
41
#ifndef R_ETHER_RZA2_IF_H
42
- #define R_ETHER_RZA2_IF_H
42
+ #define R_ETHER_RZA2_IF_H
43
43
44
44
/***********************************************************************************************************************
45
45
Includes <System Includes> , "Project Includes"
46
46
***********************************************************************************************************************/
47
- #include <stdint.h>
47
+ #include <stdint.h>
48
48
49
- #include "r_ether_rza2_config.h"
50
- #include "src/phy/phy.h"
49
+ #include "r_ether_rza2_config.h"
50
+ #include "src/phy/phy.h"
51
51
52
52
#ifdef __cplusplus
53
53
extern "C" {
@@ -56,30 +56,29 @@ extern "C" {
56
56
Macro definitions
57
57
***********************************************************************************************************************/
58
58
/* Version Number of API. */
59
- #define ETHER_RZA2_VERSION_MAJOR (1)
60
- #define ETHER_RZA2_VERSION_MINOR (0)
59
+ #define ETHER_RZA2_VERSION_MAJOR (1)
60
+ #define ETHER_RZA2_VERSION_MINOR (0)
61
61
62
62
/* When using the Read functions, ETHER_NO_DATA is the return value that indicates that no received data. */
63
- #define ETHER_NO_DATA (0)
63
+ #define ETHER_NO_DATA (0)
64
64
65
65
/* The value of flag which indicates that the interrupt of Ethernet occur. */
66
- #define ETHER_FLAG_OFF (0)
67
- #define ETHER_FLAG_ON (1)
68
- #define ETHER_FLAG_ON_LINK_ON (3)
69
- #define ETHER_FLAG_ON_LINK_OFF (2)
66
+ #define ETHER_FLAG_OFF (0)
67
+ #define ETHER_FLAG_ON (1)
68
+ #define ETHER_FLAG_ON_LINK_ON (3)
69
+ #define ETHER_FLAG_ON_LINK_OFF (2)
70
70
71
71
/* Channel definition of Ethernet */
72
- #define ETHER_CHANNEL_0 (0)
73
- #define ETHER_CHANNEL_1 (1)
72
+ #define ETHER_CHANNEL_0 (0)
73
+ #define ETHER_CHANNEL_1 (1)
74
74
75
- #define ETHER_CHANNEL_MAX (ETHER_CH0_EN + ETHER_CH1_EN)
75
+ #define ETHER_CHANNEL_MAX (ETHER_CH0_EN + ETHER_CH1_EN)
76
76
77
77
/***********************************************************************************************************************
78
78
Typedef definitions
79
79
***********************************************************************************************************************/
80
80
/* ETHER API error codes */
81
- typedef enum
82
- {
81
+ typedef enum {
83
82
ETHER_SUCCESS = 0 , /* Processing completed successfully */
84
83
ETHER_ERR_INVALID_PTR = -1 , /* Value of the pointer is NULL */
85
84
ETHER_ERR_INVALID_DATA = -2 , /* Value of the argument is out of range */
@@ -95,32 +94,28 @@ typedef enum
95
94
} ether_return_t ;
96
95
97
96
/* Event code of callback function */
98
- typedef enum
99
- {
97
+ typedef enum {
100
98
ETHER_CB_EVENT_ID_WAKEON_LAN , /* Magic packet detection */
101
99
ETHER_CB_EVENT_ID_LINK_ON , /* Link up detection */
102
100
ETHER_CB_EVENT_ID_LINK_OFF , /* Link down detection */
103
101
} ether_cb_event_t ;
104
102
105
103
/* Structure of the callback function pointer */
106
- typedef struct
107
- {
108
- void (* pcb_func ) (void * ); /* Callback function pointer */
109
- void (* pcb_int_hnd ) (void * ); /* Interrupt handler function pointer */
104
+ typedef struct {
105
+ void (* pcb_func )(void * ); /* Callback function pointer */
106
+ void (* pcb_int_hnd )(void * ); /* Interrupt handler function pointer */
110
107
} ether_cb_t ;
111
108
112
109
/* Structure to be used when decoding the argument of the callback function */
113
- typedef struct
114
- {
110
+ typedef struct {
115
111
uint32_t channel ; /* ETHERC channel */
116
112
ether_cb_event_t event_id ; /* Event code for callback function */
117
113
uint32_t status_ecsr ; /* ETHERC status register for interrupt handler */
118
114
uint32_t status_eesr ; /* ETHERC/EDMAC status register for interrupt handler */
119
115
} ether_cb_arg_t ;
120
116
121
117
/* Parameters of the control function (1st argument) */
122
- typedef enum
123
- {
118
+ typedef enum {
124
119
CONTROL_SET_CALLBACK , /* Callback function registration */
125
120
CONTROL_SET_PROMISCUOUS_MODE , /* Promiscuous mode setting */
126
121
CONTROL_SET_INT_HANDLER , /* Interrupt handler function registration */
@@ -130,45 +125,39 @@ typedef enum
130
125
CONTROL_BROADCASTFRAME_FILTER /* Broadcast frame filter setting*/
131
126
} ether_cmd_t ;
132
127
133
- typedef enum
134
- {
128
+ typedef enum {
135
129
ETHER_PROMISCUOUS_OFF , /* ETHERC operates in standard mode */
136
130
ETHER_PROMISCUOUS_ON /* ETHERC operates in promiscuous mode */
137
131
} ether_promiscuous_bit_t ;
138
132
139
- typedef enum
140
- {
133
+ typedef enum {
141
134
ETHER_MC_FILTER_OFF , /* Multicast frame filter disable */
142
135
ETHER_MC_FILTER_ON /* Multicast frame filter enable */
143
136
} ether_mc_filter_t ;
144
137
145
- typedef struct
146
- {
138
+ typedef struct {
147
139
uint32_t channel ; /* ETHERC channel */
148
140
ether_promiscuous_bit_t bit ; /* Promiscuous mode */
149
141
} ether_promiscuous_t ;
150
142
151
- typedef struct
152
- {
143
+ typedef struct {
153
144
uint32_t channel ; /* ETHERC channel */
154
145
ether_mc_filter_t flag ; /* Multicast frame filter */
155
146
} ether_multicast_t ;
156
147
157
- typedef struct
158
- {
148
+ typedef struct {
159
149
uint32_t channel ; /* ETHERC channel */
160
150
uint32_t counter ; /* Continuous reception number of Broadcast frame */
161
151
} ether_broadcast_t ;
162
152
163
153
/* Parameters of the control function (2nd argument) */
164
- typedef union
165
- {
154
+ typedef union {
166
155
ether_cb_t ether_callback ; /* Callback function pointer */
167
- ether_promiscuous_t * p_ether_promiscuous ; /* Promiscuous mode setting */
156
+ ether_promiscuous_t * p_ether_promiscuous ; /* Promiscuous mode setting */
168
157
ether_cb_t ether_int_hnd ; /* Interrupt handler function pointer */
169
158
uint32_t channel ; /* ETHERC channel number */
170
- ether_multicast_t * p_ether_multicast ; /* Multicast frame filter setting */
171
- ether_broadcast_t * p_ether_broadcast ; /* Broadcast frame filter setting */
159
+ ether_multicast_t * p_ether_multicast ; /* Multicast frame filter setting */
160
+ ether_broadcast_t * p_ether_broadcast ; /* Broadcast frame filter setting */
172
161
} ether_param_t ;
173
162
174
163
/***********************************************************************************************************************
@@ -178,21 +167,21 @@ typedef union
178
167
/***********************************************************************************************************************
179
168
Exported global functions (to be accessed by other files)
180
169
***********************************************************************************************************************/
181
- extern void R_ETHER_Initial (void );
182
- extern ether_return_t R_ETHER_Open_ZC2 (uint32_t channel , const uint8_t mac_addr [], uint8_t pause );
183
- extern ether_return_t R_ETHER_Close_ZC2 (uint32_t channel );
184
- extern int32_t R_ETHER_Read (uint32_t channel , void * pbuf );
185
- extern int32_t R_ETHER_Read_ZC2 (uint32_t channel , void * * pbuf );
186
- extern int32_t R_ETHER_Read_ZC2_BufRelease (uint32_t channel );
187
- extern ether_return_t R_ETHER_Write (uint32_t channel , void * pbuf , uint32_t len );
188
- extern ether_return_t R_ETHER_Write_ZC2_GetBuf (uint32_t channel , void * * pbuf , uint16_t * pbuf_size );
189
- extern ether_return_t R_ETHER_Write_ZC2_SetBuf (uint32_t channel , const uint32_t len );
190
- extern ether_return_t R_ETHER_CheckLink_ZC (uint32_t channel );
191
- extern void R_ETHER_LinkProcess (uint32_t channel );
192
- extern ether_return_t R_ETHER_WakeOnLAN (uint32_t channel );
193
- extern ether_return_t R_ETHER_CheckWrite (uint32_t channel );
194
- extern ether_return_t R_ETHER_Control (ether_cmd_t const cmd , ether_param_t const control );
195
- extern uint32_t R_ETHER_GetVersion (void );
170
+ extern void R_ETHER_Initial (void );
171
+ extern ether_return_t R_ETHER_Open_ZC2 (uint32_t channel , const uint8_t mac_addr [], uint8_t pause );
172
+ extern ether_return_t R_ETHER_Close_ZC2 (uint32_t channel );
173
+ extern int32_t R_ETHER_Read (uint32_t channel , void * pbuf );
174
+ extern int32_t R_ETHER_Read_ZC2 (uint32_t channel , void * * pbuf );
175
+ extern int32_t R_ETHER_Read_ZC2_BufRelease (uint32_t channel );
176
+ extern ether_return_t R_ETHER_Write (uint32_t channel , void * pbuf , uint32_t len );
177
+ extern ether_return_t R_ETHER_Write_ZC2_GetBuf (uint32_t channel , void * * pbuf , uint16_t * pbuf_size );
178
+ extern ether_return_t R_ETHER_Write_ZC2_SetBuf (uint32_t channel , const uint32_t len );
179
+ extern ether_return_t R_ETHER_CheckLink_ZC (uint32_t channel );
180
+ extern void R_ETHER_LinkProcess (uint32_t channel );
181
+ extern ether_return_t R_ETHER_WakeOnLAN (uint32_t channel );
182
+ extern ether_return_t R_ETHER_CheckWrite (uint32_t channel );
183
+ extern ether_return_t R_ETHER_Control (ether_cmd_t const cmd , ether_param_t const control );
184
+ extern uint32_t R_ETHER_GetVersion (void );
196
185
197
186
#ifdef __cplusplus
198
187
}
0 commit comments