コード例 #1
0
void __attribute__((interrupt, auto_psv)) _U1RXInterrupt(void) {
    IFS0bits.U1RXIF = 0; // clear RX interrupt flag

    /* get the data */
    if (U1STAbits.URXDA == 1) {
        if (decode_pkgs(ReadUART1())) {
            PARSER_FLAG = 1; //if correct packet parse command start interrupt flag
        }
    } else {
        /* check for receive errors */
        if (U1STAbits.FERR == 1) {
            pkg_error(ERROR_FRAMMING);
        }
        /* must clear the overrun error to keep uart receiving */
        if (U1STAbits.OERR == 1) {
            U1STAbits.OERR = 0;
            pkg_error(ERROR_OVERRUN);
        }
    }
}
コード例 #2
0
ファイル: pkg_archive.c プロジェクト: ownsherass/bxpkg
struct archive * pkg_archive_open(const char *path){
	struct archive *a;
	
	if(path == NULL)
		RETURN_P_ERR(P_ERR_INVALID_DESCRIPTOR, NULL);
	
	a = archive_read_new();
	
	if(a == NULL)
		return NULL;
		
	archive_read_support_compression_all(a);
	archive_read_support_format_tar(a);
		
	if(archive_read_open_file(a, path, 10240) != 0){
		pkg_error(0, (char *)archive_error_string(a));
		return NULL;
	}
	
	return a;
}