IgH EtherCAT Master  1.6.2
eoe_request.c
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT Master.
6  *
7  * The IgH EtherCAT Master is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version 2, as
9  * published by the Free Software Foundation.
10  *
11  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with the IgH EtherCAT Master; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  ****************************************************************************/
21 
26 /****************************************************************************/
27 
28 #include <linux/module.h>
29 #include <linux/jiffies.h>
30 #include <linux/slab.h>
31 
32 #include "eoe_request.h"
33 
34 /****************************************************************************/
35 
39  ec_eoe_request_t *req
40  )
41 {
42  INIT_LIST_HEAD(&req->list);
43  req->state = EC_INT_REQUEST_INIT;
44  req->jiffies_sent = 0U;
45 
46  req->mac_address_included = 0;
47  req->ip_address_included = 0;
48  req->subnet_mask_included = 0;
49  req->gateway_included = 0;
50  req->dns_included = 0;
51  req->name_included = 0;
52 
53  memset(req->mac_address, 0x00, ETH_ALEN);
54  req->ip_address.s_addr = 0;
55  req->subnet_mask.s_addr = 0;
56  req->gateway.s_addr = 0;
57  req->dns.s_addr = 0;
58  req->name[0] = 0x00;
59 
60  req->result = 0x0000;
61 }
62 
63 /****************************************************************************/
64 
68  const ec_eoe_request_t *req
69  )
70 {
71  return
72  req->mac_address_included ||
73  req->ip_address_included ||
74  req->subnet_mask_included ||
75  req->gateway_included ||
76  req->dns_included ||
77  req->name_included;
78 }
79 
80 /****************************************************************************/
unsigned long jiffies_sent
Jiffies, when the request was sent.
Definition: eoe_request.h:44
void ec_eoe_request_init(ec_eoe_request_t *req)
EoE request constructor.
Definition: eoe_request.c:38
int ec_eoe_request_valid(const ec_eoe_request_t *req)
Checks if EoE request has something to set.
Definition: eoe_request.c:67
EtherCAT EoE request structure.
Ethernet-over-EtherCAT set IP parameter request.
Definition: eoe_request.h:41
ec_internal_request_state_t state
Request state.
Definition: eoe_request.h:43
struct list_head list
List item.
Definition: eoe_request.h:42