/**
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
+ * Copyright (C) 2013-2015 Czech Technical University in Prague
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
+ * Carlos Jenkins <carlos@jenkins.co.cr>
+ * Rostislav Lisovy <lisovy@gmail.com>
+ * Jan Doležal <pm.jenik@gmail.com>
*
*/
* interface driver for lwIP.
*
*/
-/* Copyright (C) 2013-2014 Czech Technical University in Prague
- *
- * Authors:
- * - Carlos Jenkins <carlos@jenkins.co.cr>
- * - Rostislav Lisovy <lisovy@gmail.com>
- * - Jan Doležal <pm.jenik@gmail.com>
- *
- * This document contains proprietary information belonging to Czech
- * Technical University in Prague. Passing on and copying of this
- * document, and communication of its contents is not permitted
- * without prior written authorization.
- *
- * File: eth.c
- * Abstract:
- * Ethernet Communication RPP API implementation file. Using one PHY.
- *
- * References:
- * eth.h
- * RPP API documentation.
- */
#include "rpp/rpp.h"
#include "netif/ppp_oe.h"
/* end - lwIP headers */
-#include "hal/hal.h"
+#include "drv/digital_io.h"
#include "sys/sys.h" /* includes - sys/phy_dp83848h.h */
#include "drv/emac.h"
#include "os/os.h"
*
* @note mac_addr[0] is considered MSB
*/
-void hdkif_macaddrset(u32_t inst_num, u8_t *mac_addr)
+static void hdkif_macaddrset(u32_t inst_num, u8_t *mac_addr)
{
struct hdkif *hdkif;
u32_t temp;
struct ip_addr net_mask;
struct ip_addr gw_addr;
int8_t retVal = SUCCESS;
- int ret;
struct netif *netif = &hdkNetIF[instNum];
struct netif *netif_tmp;
u8_t mac_addr[MAC_ADDR_LEN] = RPP_MAC_ADDR;
#if STATIC_IP_ADDRESS
netif_set_up(netif);
#elif LWIP_DHCP
- ret = dhcp_start(netif);
+ int ret = dhcp_start(netif);
if (ret != ERR_OK) {
rpp_debug_printf("dhcp mem err\r\n");
return DHCP_MEM_ERR;
}
#define INIT_ONLY_AFTER_RESET 1 // FIXME Why? Wat? Wut? For future implementation?
-err_t rpp_eth_hw_init(struct hdkif *hdkif)
+static err_t rpp_eth_hw_init(struct hdkif *hdkif)
{
uint8_t index;
uint16_t regContent;
*/
index = configCPU_CLOCK_HZ/1000000;
#endif /* NO_SYS */
- hal_gpio_pin_set_value(*hal_gpio_pin_get_dsc(PIN_NAME_ETHRST, -1), 0);
- while(index--)
- ;
+ dio_gpio_pin_set_value(*dio_gpio_pin_get_dsc(PIN_NAME_ETHRST, -1), 0);
+ while (index--) ;
#endif /* !INIT_ONLY_AFTER_RESET */
+ /* we have pull-down resistor, so after reset, we only need to put ETHRST pin to log. high */
+ dio_gpio_pin_set_value(*dio_gpio_pin_get_dsc(DIO_PIN_NAME_ETHRST, -1), 1);
/*
* We have pull-down resistor, so after reset, we only need
* to put ETHRST pin to log. high
*/
- hal_gpio_pin_set_value(*hal_gpio_pin_get_dsc(PIN_NAME_ETHRST, -1), 1);
+ dio_gpio_pin_set_value(*dio_gpio_pin_get_dsc(DIO_PIN_NAME_ETHRST, -1), 1);
/* Initialize EMAC control module and EMAC module */
EMACInit(hdkif->emac_ctrl_base, hdkif->emac_base);
return SUCCESS;
}
-err_t rpp_eth_hw_init_postInit(struct netif *netif)
+static err_t rpp_eth_hw_init_postInit(struct netif *netif)
{
/* 0x3FFFFFFF is for 80MHz aproximately 13s */
volatile unsigned int autonegFinishWait = 0x3FFFFFFF;
/**
* When called from rpp_eth_send(), the 'lev' lock is held
*/
-err_t rpp_eth_send_raw(struct netif *netif, struct pbuf *pbuf)
+static err_t rpp_eth_send_raw(struct netif *netif, struct pbuf *pbuf)
{
struct pbuf *q;
struct txch *txch;
volatile struct emac_rx_bd *curr_bd;
volatile struct emac_rx_bd *curr_tail;
volatile struct emac_rx_bd *curr_head;
- volatile struct pbuf *pbuf;
- volatile struct pbuf *new_pbuf;
- volatile struct pbuf *q;
+ struct pbuf *pbuf;
+ struct pbuf *new_pbuf;
+ struct pbuf *q;
hdkif = netif->state;
rxch = &(hdkif->rxch);