Mistake on this page?
Report an issue in GitHub or email us
r_ether_rza2_if.h
1 /***********************************************************************************************************************
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.
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
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
14  * following link:
15  * http://www.renesas.com/disclaimer
16  *
17  * Copyright (C) 2018-2020 Renesas Electronics Corporation. All rights reserved.
18  ***********************************************************************************************************************/
19 /* Copyright (c) 2018-2020 Renesas Electronics Corporation.
20  * SPDX-License-Identifier: Apache-2.0
21  *
22  * Licensed under the Apache License, Version 2.0 (the "License");
23  * you may not use this file except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  * http://www.apache.org/licenses/LICENSE-2.0
27  *
28  * Unless required by applicable law or agreed to in writing, software
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  */
34 /***********************************************************************************************************************
35  * File Name : r_ether_rza2_if.h
36  * Version : 1.00
37  * Description : Ethernet module device driver
38  ***********************************************************************************************************************/
39 
40 /* Guards against multiple inclusion */
41 #ifndef R_ETHER_RZA2_IF_H
42 #define R_ETHER_RZA2_IF_H
43 
44 /***********************************************************************************************************************
45  Includes <System Includes> , "Project Includes"
46  ***********************************************************************************************************************/
47 #include <stdint.h>
48 
49 #include "r_ether_rza2_config.h"
50 #include "src/phy/phy.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 /***********************************************************************************************************************
56  Macro definitions
57  ***********************************************************************************************************************/
58 /* Version Number of API. */
59 #define ETHER_RZA2_VERSION_MAJOR (1)
60 #define ETHER_RZA2_VERSION_MINOR (0)
61 
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)
64 
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)
70 
71 /* Channel definition of Ethernet */
72 #define ETHER_CHANNEL_0 (0)
73 #define ETHER_CHANNEL_1 (1)
74 
75 #define ETHER_CHANNEL_MAX (ETHER_CH0_EN + ETHER_CH1_EN)
76 
77 /***********************************************************************************************************************
78  Typedef definitions
79  ***********************************************************************************************************************/
80 /* ETHER API error codes */
81 typedef enum {
82  ETHER_SUCCESS = 0, /* Processing completed successfully */
83  ETHER_ERR_INVALID_PTR = -1, /* Value of the pointer is NULL */
84  ETHER_ERR_INVALID_DATA = -2, /* Value of the argument is out of range */
85  ETHER_ERR_INVALID_CHAN = -3, /* Nonexistent channel number */
86  ETHER_ERR_INVALID_ARG = -4, /* Invalid argument */
87  ETHER_ERR_LINK = -5, /* Auto-negotiation is not completed, and transmission/reception is not enabled. */
88  ETHER_ERR_MPDE = -6, /* As a Magic Packet is being detected, and transmission/reception is not enabled. */
89  ETHER_ERR_TACT = -7, /* Transmit buffer is not empty. */
90  ETHER_ERR_CHAN_OPEN = -8, /* Indicates the Ethernet cannot be opened because it is being used by another application */
91  ETHER_ERR_MC_FRAME = -9, /* Detect multicast frame when multicast frame filtering enable */
92  ETHER_ERR_RECV_ENABLE = -10, /* Enable receive function in ETHERC */
93  ETHER_ERR_OTHER = -11 /* Other error */
94 } ether_return_t;
95 
96 /* Event code of callback function */
97 typedef enum {
98  ETHER_CB_EVENT_ID_WAKEON_LAN, /* Magic packet detection */
99  ETHER_CB_EVENT_ID_LINK_ON, /* Link up detection */
100  ETHER_CB_EVENT_ID_LINK_OFF, /* Link down detection */
101 } ether_cb_event_t;
102 
103 /* Structure of the callback function pointer */
104 typedef struct {
105  void (*pcb_func)(void *); /* Callback function pointer */
106  void (*pcb_int_hnd)(void *); /* Interrupt handler function pointer */
107 } ether_cb_t;
108 
109 /* Structure to be used when decoding the argument of the callback function */
110 typedef struct {
111  uint32_t channel; /* ETHERC channel */
112  ether_cb_event_t event_id; /* Event code for callback function */
113  uint32_t status_ecsr; /* ETHERC status register for interrupt handler */
114  uint32_t status_eesr; /* ETHERC/EDMAC status register for interrupt handler */
116 
117 /* Parameters of the control function (1st argument) */
118 typedef enum {
119  CONTROL_SET_CALLBACK, /* Callback function registration */
120  CONTROL_SET_PROMISCUOUS_MODE, /* Promiscuous mode setting */
121  CONTROL_SET_INT_HANDLER, /* Interrupt handler function registration */
122  CONTROL_POWER_ON, /* Cancel ETHERC/EDMAC module stop */
123  CONTROL_POWER_OFF, /* Transition to ETHERC/EDMAC module stop */
124  CONTROL_MULTICASTFRAME_FILTER,/* Multicast frame filter setting*/
125  CONTROL_BROADCASTFRAME_FILTER /* Broadcast frame filter setting*/
126 } ether_cmd_t;
127 
128 typedef enum {
129  ETHER_PROMISCUOUS_OFF, /* ETHERC operates in standard mode */
130  ETHER_PROMISCUOUS_ON /* ETHERC operates in promiscuous mode */
131 } ether_promiscuous_bit_t;
132 
133 typedef enum {
134  ETHER_MC_FILTER_OFF, /* Multicast frame filter disable */
135  ETHER_MC_FILTER_ON /* Multicast frame filter enable */
136 } ether_mc_filter_t;
137 
138 typedef struct {
139  uint32_t channel; /* ETHERC channel */
140  ether_promiscuous_bit_t bit; /* Promiscuous mode */
142 
143 typedef struct {
144  uint32_t channel; /* ETHERC channel */
145  ether_mc_filter_t flag; /* Multicast frame filter */
147 
148 typedef struct {
149  uint32_t channel; /* ETHERC channel */
150  uint32_t counter; /* Continuous reception number of Broadcast frame */
152 
153 /* Parameters of the control function (2nd argument) */
154 typedef union {
155  ether_cb_t ether_callback; /* Callback function pointer */
156  ether_promiscuous_t *p_ether_promiscuous; /* Promiscuous mode setting */
157  ether_cb_t ether_int_hnd; /* Interrupt handler function pointer */
158  uint32_t channel; /* ETHERC channel number */
159  ether_multicast_t *p_ether_multicast; /* Multicast frame filter setting */
160  ether_broadcast_t *p_ether_broadcast; /* Broadcast frame filter setting */
161 } ether_param_t;
162 
163 /***********************************************************************************************************************
164  Exported global variables
165  ***********************************************************************************************************************/
166 
167 /***********************************************************************************************************************
168  Exported global functions (to be accessed by other files)
169  ***********************************************************************************************************************/
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);
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* R_ETHER_RZA2_IF_H*/
Main packet buffer struct.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.