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:
committed by
Jeremy Soller
parent
5599c02e83
commit
37fa06ebc8
@ -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
|
||||||
|
@ -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)) {
|
||||||
|
Reference in New Issue
Block a user