示例#1
0
void main()
{
    __disable_interrupt();

    init_core();
    init_device();
    init_wdt();

    __enable_interrupt();

    microrl_init (pointerMicrorl, &serprintf);
    microrl_set_execute_callback (pointerMicrorl, execute);
    microrl_set_complete_callback (pointerMicrorl, complet);
    microrl_set_sigint_callback (pointerMicrorl, sigint);

    init_app_settings();

    print_revision();
    DEBUG_PRINTF("FlashMem: %s %s\n\r",
        get_family_desc_at25df(),
        get_density_desc_at25df());

    enable_default_lis3dh();
    init_tasks();
    init_reco_drift();
    init_can_j1939();

    DEBUG_PRINTF("\r\n\r\n");

    while (1) {
        if (pointerRingBuff->size(pointerRingBuff) > 0) {
            const uint8_t data = pointerRingBuff->get(pointerRingBuff);

            if (!get_proto_type()) {
                microrl_insert_char (pointerMicrorl, data);
            } else {
                sdp_insert_char(data);
            }
        }

        poll_can_msg();

        run_tasks();

        clear_wdt();
    }
}
示例#2
0
文件: sockstat.c 项目: frlen/freebsd
static int
parse_protos(char *protospec)
{
	char *prot;
	int proto_type, proto_index;

	if (protospec == NULL)
		return (-1);

	init_protos(0);
	proto_index = 0;
	while ((prot = strsep(&protospec, ",")) != NULL) {
		if (strlen(prot) == 0)
			continue;
		proto_type = get_proto_type(prot);
		if (proto_type != -1)
			protos[proto_index++] = proto_type;
	}
	numprotos = proto_index;
	return (proto_index);
}
示例#3
0
int pomme_print_proto(pomme_protocol_t *pro,int (*data_printer)(void *))
{
    int ret = 0;
    assert(pro!=NULL);
    printf("OP_TYPE:");
    get_proto_type(pro);

    // TODO add  logic to determine how to printf size_t
    // use %u instead now

    printf("total data length: %u\n",pro->total_len);
    printf("pack data length: %u\n",pro->len);
    if(data_printer != NULL)
    {
        printf("The data is:\n");
        ret = data_printer(pro->data);
        if( ret < 0 )
        {
            debug("Wrong data format cased printer print error");
        }
        printf("\n");
    }
    return ret ;
}