Exemplo n.º 1
0
int csp_init(unsigned char address) {

	int ret;

	/* Initialize CSP */
	csp_set_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_qfifo_init();
	if (ret != CSP_ERR_NONE)
		return ret;

	/* Loopback */
	csp_iflist_add(&csp_if_lo);

	/* Register loopback route */
	csp_route_set(csp_get_address(), &csp_if_lo, CSP_NODE_MAC);

	/* Also register loopback as default, until user redefines default route */
	csp_route_set(CSP_DEFAULT_ROUTE, &csp_if_lo, CSP_NODE_MAC);

	return CSP_ERR_NONE;

}
Exemplo n.º 2
0
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;

}
Exemplo n.º 3
0
/** csp_init
 * Start up the can-space protocol
 * @param address The CSP node address
 */
void csp_init(unsigned char address) {

    /* Initialize CSP */
    my_address = address;
	csp_conn_init();
	csp_port_init();
	csp_route_table_init();

	/* Initialize random number generator */
	srand(csp_get_ms());

	/* Register loopback route */
	csp_route_set("LOOP", address, csp_lo_tx, CSP_NODE_MAC);

}
Exemplo n.º 4
0
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;

	return CSP_ERR_NONE;

}
Exemplo n.º 5
0
Arquivo: csp_io.c Projeto: 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;

}