X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Flpc%2Fao_arch_funcs.h;h=0454b38b012e71f80d1dae78928dbe549579229e;hb=72bcff4c1af10571314e5cbbe29f073de818088e;hp=21a7a8e5702f779fd2ddce6e164e89a8bf77ab9e;hpb=292cb8380b478542555b5f370e8252eafa2f74ac;p=fw%2Faltos diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index 21a7a8e5..0454b38b 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -3,7 +3,8 @@ * * 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 - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,21 +19,32 @@ #ifndef _AO_ARCH_FUNCS_H_ #define _AO_ARCH_FUNCS_H_ -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<stack + AO_STACK_SIZE); + uint32_t *sp = (uint32_t *) (void *) (task->stack + AO_STACK_SIZE); uint32_t a = (uint32_t) start; int i; @@ -191,8 +204,8 @@ static inline void ao_arch_restore_stack(void) { ao_spi_put(bus); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<dr = byte; + while ((lpc_ssp->sr & (1 << LPC_SSP_SR_RNE)) == 0); + (void) lpc_ssp->dr; +} + #define ao_spi_init_cs(port, mask) do { \ uint8_t __bit__; \ for (__bit__ = 0; __bit__ < 32; __bit__++) { \ if (mask & (1 << __bit__)) \ - ao_enable_output(port, __bit__, PIN, 1); \ + ao_enable_output(port, __bit__, 1); \ } \ } while (0)