示例#1
0
文件: csp_io.c 项目: tbyerinn/libcsp
int csp_init(unsigned char address) {

	int ret;

	/* Initialize CSP */
	my_address = address;

	ret = csp_conn_init();
	if (ret != CSP_ERR_NONE)
		return ret;

	ret = csp_port_init();
	if (ret != CSP_ERR_NONE)
		return ret;

	ret = csp_route_table_init();
	if (ret != CSP_ERR_NONE)
		return ret;

	/* Generate CRC32 table */
#ifdef CSP_USE_CRC32
	csp_crc32_gentab();
#endif

	return CSP_ERR_NONE;

}
示例#2
0
文件: csp_io.c 项目: janbre/NUTS
int csp_init(unsigned char address) {

    int ret;

    /* Initialize CSP */
    my_address = address;

    ret = csp_conn_init();
    if (ret != CSP_ERR_NONE)
        return ret;

    ret = csp_port_init();
    if (ret != CSP_ERR_NONE)
        return ret;

    ret = csp_route_table_init();
    if (ret != CSP_ERR_NONE)
        return ret;

    /* Generate CRC32 table */
#ifdef CSP_USE_CRC32
    csp_crc32_gentab();
#endif

    /* Register loopback route */
    ret = csp_route_set(address, &csp_if_lo, CSP_NODE_MAC);
    if (ret != CSP_ERR_NONE)
        return ret;

    /* Also register loopback as default, until user redefines default route */
    ret = csp_route_set(CSP_DEFAULT_ROUTE, &csp_if_lo, CSP_NODE_MAC);
    if (ret != CSP_ERR_NONE)
        return ret;

    return CSP_ERR_NONE;

}