Adds sitara_depot/free_rtos Original one is on server_gorbunov/SmartForce4.0/sitara_depot
23 lines
391 B
C
23 lines
391 B
C
/*
|
|
* eth_ip_checksum.c
|
|
*
|
|
* Created on: 14 ìàð. 2023 ã.
|
|
* Author: sychev
|
|
*/
|
|
#include "eth_ip_checksum.h"
|
|
#include "base/swap.h"
|
|
|
|
uint16_t eth_ip_calcChecksum(uint16_t * const data, uint32_t length)
|
|
{
|
|
uint32_t i, crc = 0;
|
|
|
|
for (i = 0 ; i < length; ++i ) {
|
|
crc += BASE_SWAP16(data[i]);
|
|
}
|
|
|
|
crc = (crc & 0xffff) + (crc >> 16);
|
|
|
|
return (uint16_t) (~crc);
|
|
}
|
|
|