parallel: Use u16 for data length

The length will never be negative. Change it from i16 to u16 so
SDCC will generate more efficient code.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2021-08-02 11:56:47 -06:00
committed by Jeremy Soller
parent 5599c02e83
commit 37fa06ebc8
2 changed files with 3 additions and 3 deletions

View File

@ -8,6 +8,6 @@
extern bool parallel_debug; extern bool parallel_debug;
bool parallel_init(void); bool parallel_init(void);
int16_t parallel_write(uint8_t * data, int16_t length); int16_t parallel_write(uint8_t * data, uint16_t length);
#endif // _BOARD_PARALLEL_H #endif // _BOARD_PARALLEL_H

View File

@ -82,14 +82,14 @@ bool parallel_init(void) {
return parallel_wait_peripheral(STS_WAIT, 0); return parallel_wait_peripheral(STS_WAIT, 0);
} }
int16_t parallel_write(uint8_t * data, int16_t length) { int16_t parallel_write(uint8_t * data, uint16_t length) {
// Assert nWRITE // Assert nWRITE
KSIGDAT &= ~CTL_WRITE; KSIGDAT &= ~CTL_WRITE;
// Set data lines as outputs // Set data lines as outputs
KSOLGOEN = 0xFF; KSOLGOEN = 0xFF;
int16_t i; uint16_t i;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
// Wait for peripheral to indicate it's ready for next cycle // Wait for peripheral to indicate it's ready for next cycle
if (!parallel_wait_peripheral(STS_WAIT, 0)) { if (!parallel_wait_peripheral(STS_WAIT, 0)) {