/******************************************************************
 * @file  CBCRC.s.c
 * @brief: 
 * @author: xuwei
 * COPYRIGHT NOTICE: (c) smartlogictech. All rights reserved. 
 * Version      Change_date         Owner         Change_content

*****************************************************************/
#include <stdlib.h>
#include <math.h>

int CBCRC(int ConfigBaseAddr,int cb_size, int InputAddr, int LUTAddr1,int LUTAddr2)

{
	volatile int a,b,c;
	volatile int *addr = (int*)ConfigBaseAddr;

	b = (cb_size & 0x3FF)>>3;
	a = 128 - b;

	addr[0*16] = (cb_size>>3)+(int)InputAddr;

	addr[1*16] = (int)InputAddr;
	addr[2*16] = b+(int)InputAddr;
	addr[3*16] = (cb_size+(a<<3))>>10;
	addr[4*16] = a;

	addr[8*16] = (int)LUTAddr1+0x8000;
	addr[8*16+1] = (int)LUTAddr1+0x8000;

	addr[9*16] = (int)LUTAddr2+0x8000;
	addr[9*16+1] = (int)LUTAddr2+0x8000;

	return a;
}
