diff options
Diffstat (limited to 'H64E-2/main.c')
-rw-r--r-- | H64E-2/main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/H64E-2/main.c b/H64E-2/main.c index 29184b7..791cc18 100644 --- a/H64E-2/main.c +++ b/H64E-2/main.c @@ -167,7 +167,7 @@ int main(int argc, const char * argv[]) { int fd; int in_bytes = 0, out_bytes=0, cnv_bytes=0; int in_total = 0, out_total=0, cnv_total=0; - uint8_t buf_in[128+1],buf_cnv_in[128+1],buf_cnv_out[256+1],buf_out[512+1]; + uint8_t buf_in[128+1],buf_cnv_in[128+1],buf_cnv_out[2048+1],buf_out[2048+1]; int i=0; printf("H64E-2 Project started 1\n"); @@ -176,21 +176,24 @@ int main(int argc, const char * argv[]) { H64E_t h64e; H64E_stream_in sin; H64E_stream_out sout; + + memset(&h64e,0,sizeof(H64E_t)); h64e_init(&h64e); h64e_si_init(&sin, 128); - h64e_so_init(&sout, 512); + h64e_so_init(&sout, 4096); h64e_set_input(&h64e, &sin); h64e_set_output(&h64e, &sout); H64E_format int8_fmt; //list of supported formats + h64e_fmt_init(&int8_fmt); //set all params from arguments /*get cmd args and set options */ - while ( (c = getopt(argc, argv, "abo:il:vc:g:e:s")) != -1 ) + while ( (c = getopt(argc, argv, "abo:il:vc:g:e:st")) != -1 ) { switch(c) { @@ -266,6 +269,7 @@ int main(int argc, const char * argv[]) { //configure format of u8 to terminate on new line and have space between types //printf("Column size set to %d\n",h64e.fmt.column_size); int8_fmt.f_space = !h64e.fmt.flag_space; + printf("h64e.fmt.flag_space %d\n",h64e.fmt.flag_space); int8_fmt.f_new_line = 1; int8_fmt.column_size = h64e.fmt.column_size; int8_fmt.group_fmt = h64e.fmt.group; @@ -290,11 +294,11 @@ int main(int argc, const char * argv[]) { h64e_si_data_in(&sin, &buf_in[0], in_bytes); //if buffer have enought data then convert it - if (h64e_si_len(&sin)>1) + if (h64e_si_len(&sin)>=int8_fmt.column_size) { int cnv_num=-1; //printf("Input Out\n"); - cnv_bytes = h64e_si_data_out(&sin, &buf_cnv_in[0], 1); + cnv_bytes = h64e_si_data_out(&sin, &buf_cnv_in[0], int8_fmt.column_size); //cnv_total += cnv_bytes; @@ -303,7 +307,7 @@ int main(int argc, const char * argv[]) { switch (h64e.fmt.group) { case H64E_G_BYTE: - cnv_num = h64e_fmt_byte(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 512); + cnv_num = h64e_fmt_byte_align16(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 2048); break; case H64E_G_WORD: cnv_num = h64e_fmt_word(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 512); |