src/ENC28J60.c
static int8_t rx_buf_init(struct enc28j60_dev *priv,
                          uint16_t start, uint16_t end) {
    uint16_t erxrdpt;

    if ((start > 0x1FFF) || (end > 0x1FFF) || (start > end)) {
        printf_P(PSTR("rx_buf_init(%d, %d) - RX buf bad parameters!\n"), start, end);
        // errno
        return -1;
    }
    
    priv->packet_ptr = start;
    wcr(priv, ENC28J60_ERXSTL, (uint8_t)start);
    wcr(priv, ENC28J60_ERXSTH, (uint8_t)(start >> 8));

    wcr(priv, ENC28J60_ERXNDL, (uint8_t)end);
    wcr(priv, ENC28J60_ERXNDH, (uint8_t)(end >> 8));

    erxrdpt = erxrdpt_workaround(priv->packet_ptr, start, end);
    wcr(priv, ENC28J60_ERXRDPTL, (uint8_t)erxrdpt);
    wcr(priv, ENC28J60_ERXRDPTH, (uint8_t)(erxrdpt >> 8));

    return 0;
}
/*!
 * @brief RX buffer initialize.
 *  Set ERXST and ERXND pointer - receive buffer.
 *  For tracking, the ERXRDPT registers should be programmed with the same value
 *  (ERXRDPTL first, followed by ERXRDPTH).
 * @param start Start address of RX buffer
 * @param end End address of RX buffer
 * @return 0 if success; errno if error
 */
@brief RX buffer initialize.
Set ERXST and ERXND pointer - receive buffer.
For tracking, the ERXRDPT registers should be programmed with the same value
(ERXRDPTL first, followed by ERXRDPTH).
@param start Start address of RX buffer
@param end End address of RX buffer
@return 0 if success; errno if error
@brief RX buffer initialize . Set ERXST and ERXND pointer - receive buffer . For tracking the ERXRDPT registers should be programmed with the same value ( ERXRDPTL first followed by ERXRDPTH ) . @param start Start address of RX buffer @param end End address of RX buffer @return 0 if success ; errno if error
static int8_t rx_buf_init(struct enc28j60_dev *priv,
                          uint16_t start, uint16_t end) {
    uint16_t erxrdpt;
    if ((start > 0x1FFF) || (end > 0x1FFF) || (start > end)) {
        printf_P(PSTR("rx_buf_init(%d, %d) - RX buf bad parameters!\n"), start, end);
        return -1;
    }
    priv->packet_ptr = start;
    wcr(priv, ENC28J60_ERXSTL, (uint8_t)start);
    wcr(priv, ENC28J60_ERXSTH, (uint8_t)(start >> 8));
    wcr(priv, ENC28J60_ERXNDL, (uint8_t)end);
    wcr(priv, ENC28J60_ERXNDH, (uint8_t)(end >> 8));
    erxrdpt = erxrdpt_workaround(priv->packet_ptr, start, end);
    wcr(priv, ENC28J60_ERXRDPTL, (uint8_t)erxrdpt);
    wcr(priv, ENC28J60_ERXRDPTH, (uint8_t)(erxrdpt >> 8));
    return 0;
}
static int8_t rx_buf_init ( struct enc28j60_dev * priv , uint16_t start , uint16_t end ) { uint16_t erxrdpt ; if ( ( start > 0x1FFF ) || ( end > 0x1FFF ) || ( start > end ) ) { printf_P ( PSTR ( " \n " ) , start , end ) ; return -1 ; } priv -> packet_ptr = start ; wcr ( priv , ENC28J60_ERXSTL , ( uint8_t ) start ) ; wcr ( priv , ENC28J60_ERXSTH , ( uint8_t ) ( start >> 8 ) ) ; wcr ( priv , ENC28J60_ERXNDL , ( uint8_t ) end ) ; wcr ( priv , ENC28J60_ERXNDH , ( uint8_t ) ( end >> 8 ) ) ; erxrdpt = erxrdpt_workaround ( priv -> packet_ptr , start , end ) ; wcr ( priv , ENC28J60_ERXRDPTL , ( uint8_t ) erxrdpt ) ; wcr ( priv , ENC28J60_ERXRDPTH , ( uint8_t ) ( erxrdpt >> 8 ) ) ; return 0 ; }
@brief RX buffer initialize.
@brief RX buffer initialize .
// errno