X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=test_src%2Fcircularbytebuffer-asm.S;h=493b17cde6a71d07aedcf23f306d80f7dbb87f24;hp=f76cebee45ee66a7fd9256171cb82e5706b54a9e;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=7701e318e4e2bac7f84dbf6e368f1501814948fc diff --git a/test_src/circularbytebuffer-asm.S b/test_src/circularbytebuffer-asm.S index f76cebe..493b17c 100644 --- a/test_src/circularbytebuffer-asm.S +++ b/test_src/circularbytebuffer-asm.S @@ -1,7 +1,7 @@ /* circularbytebuffer-asm.S */ /* This file is part of the AVR-circularbytebuffer. - Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ */ /** * \file circularbytebuffer-asm.S - * \email daniel.otte@rub.de + * \email bg@nerilex.org * \author Daniel Otte * \date 2009-07-25 * \license GPLv3 or later @@ -29,10 +29,10 @@ typedef struct { uint8_t buffer_size; uint8_t fillcount; - uint8_t* buffer; - uint8_t* head; - uint8_t* tail; - uint8_t* top; + uint8_t *buffer; + uint8_t *head; + uint8_t *tail; + uint8_t *top; } circularbytebuffer_t; */ @@ -57,7 +57,7 @@ /******************************************************************************/ /* - * uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t *cb){ * cb->buffer_size = buffersize; * cb->buffer = malloc(buffersize); * cb->head = cb->tail = cb->buffer; @@ -105,7 +105,7 @@ circularbytebuffer_init: /******************************************************************************/ /* - * void circularbytebuffer_free(circularbytebuffer_t* cb){ + * void circularbytebuffer_free(circularbytebuffer_t *cb){ * free(cb->buffer); * } * @@ -124,7 +124,7 @@ circularbytebuffer_free: /******************************************************************************/ /* - * void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t* cb, void* buffer){ + * void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t *cb, void *buffer){ * cb->buffer_size = buffersize; * cb->buffer = buffer * cb->head = cb->tail = cb->buffer; @@ -157,7 +157,7 @@ circularbytebuffer_init2: /******************************************************************************/ /* - * uint8_t circularbytebuffer_cnt(circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_cnt(circularbytebuffer_t *cb){ * return (cb->fillcount); * } * @@ -172,7 +172,7 @@ circularbytebuffer_cnt: /******************************************************************************/ /* - * uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb){ + * uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t *cb){ * uint8_t ret; * if(cb->fillcount==0) * return 0xffff; @@ -216,7 +216,7 @@ circularbytebuffer_get_lifo: /******************************************************************************/ /* - * uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb){ + * uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t *cb){ * uint8_t ret; * if(cb->fillcount==0) * return 0xffff; @@ -264,7 +264,7 @@ circularbytebuffer_get_fifo: /******************************************************************************/ /* - * uint8_t circularbytebuffer_append(uint8_t elem, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_append(uint8_t elem, circularbytebuffer_t *cb){ * if(cb->fillcount==cb->buffer_size) * return 1; * cb->fillcount++; @@ -287,6 +287,7 @@ circularbytebuffer_append: ldd r23, Z+BUFFER_SIZE_OFFSET cp r22, r23 brne 10f +5: ldi r24, 1 ret 10: @@ -321,7 +322,7 @@ circularbytebuffer_append: /******************************************************************************/ /* - * uint8_t circularbytebuffer_push(uint8_t elem, circularbytebuffer_t* cb){ + * uint8_t circularbytebuffer_push(uint8_t elem, circularbytebuffer_t *cb){ * if(cb->fillcount==cb->buffer_size) * return 1; * cb->fillcount++; @@ -343,14 +344,15 @@ circularbytebuffer_push: ldd r22, Z+FILLCOUNT_OFFSET ldd r23, Z+BUFFER_SIZE_OFFSET cp r22, r23 - brne 10f - ldi r24, 1 - ret + brlo 10f + rjmp 5b +; ldi r24, 1 +; ret 10: - clt - tst r22 - brne 11f - set +; clt +; tst r22 +; brne 11f +; set 11: inc r22 std Z+FILLCOUNT_OFFSET, r22 @@ -368,7 +370,7 @@ circularbytebuffer_push: 20: std Z+HEAD_OFFSET, r26 std Z+HEAD_OFFSET+1, r27 - brtc 30b - std Z+TAIL_OFFSET, r26 - std Z+TAIL_OFFSET+1, r27 +; brtc 30b +; std Z+TAIL_OFFSET, r26 +; std Z+TAIL_OFFSET+1, r27 rjmp 30b