- Main Page
- Data Structures
- Files

- File List
- Globals

# software/wrsw_rtud/rtu_hash.h

Go to the documentation of this file.

    00001 /*
    00002  * White Rabbit RTU (Routing Table Unit)
    00003  * Copyright (C) 2010, CERN.
    00004  *
    00005  * Version:     wrsw_rtud v1.0
    00006  *
    00007  * Authors:     Maciej Lipinski (maciej.lipinski@cern.ch)
    00008  *
    00009  * Description: Hash function presented below, produces hash which corresponds
    00010  *              to hash produced by VHDL generated on this page:
    00011  *              http://outputlogic.com/
    00012  *
    00013  * Fixes:
    00014  *
    00015  *
    00016  * This program is free software; you can redistribute it and/or
    00017  * modify it under the terms of the GNU General Public License
    00018  * as published by the Free Software Foundation; either version
    00019  * 2 of the License, or (at your option) any later version.
    00020  *
    00021  * This program is distributed in the hope that it will be useful,
    00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00024  * GNU General Public License for more details.
    00025  *
    00026  * You should have received a copy of the GNU General Public License
    00027  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    00028  */
    00029 #ifndef __WHITERABBIT_RTU_HASH_H
    00030 #define __WHITERABBIT_RTU_HASH_H
    00031
    00032 #include "mac.h"
    00033
    00034 /*
    00035   Hash polynomials implemented by RTU
    00036   ---------------------------------------------------------
    00037   |        name   |      poly equation      | poly (hex)  |
    00038   ---------------------------------------------------------
    00039   |  CRC-16-CCITT | 1+x^5+x^12+x^16         |    0x1021   |
    00040   |  CRC-16-IBM   | 1+x^2+x^15+x^16         |    0x8005   |
    00041   |  CRC-16-DECT  | 1+x^3+x^7+x^8+x^10+x^16 |    0x0589   |
    00042   ---------------------------------------------------------
    00043 */
    00044 #define HW_POLYNOMIAL_CCITT         0x1021
    00045 #define HW_POLYNOMIAL_IBM           0x8005
    00046 #define HW_POLYNOMIAL_DECT          0x0589
    00047
    00048 void rtu_hash_set_poly(uint16_t poly);
    00049 uint16_t rtu_hash(uint8_t mac[ETH_ALEN], uint8_t fid);
    00050
    00051 #endif /*__WHITERABBIT_RTU_HASH_H*/
    00052

All Data Structures Files Functions Variables Defines