X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm%2Fao_arch_funcs.h;h=ad46ef32babf9fd52b0f9d58f08fd09e6f534275;hb=HEAD;hp=8f4f6cd4ce9e70658a64a352ab81b7a3ca015df2;hpb=341157c7415fcf879696c9d8167722a0c5ff264c;p=fw%2Faltos diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 8f4f6cd4..0f2f36a6 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -34,8 +34,9 @@ #define _AO_SPI_SPEED_62500Hz STM_SPI_CR1_BR_PCLK_256 static inline uint32_t -ao_spi_speed(uint32_t hz) +ao_spi_speed(int index, uint32_t hz) { + (void) index; if (hz >= 4000000) return _AO_SPI_SPEED_4MHz; if (hz >= 2000000) return _AO_SPI_SPEED_2MHz; if (hz >= 1000000) return _AO_SPI_SPEED_1MHz; @@ -92,6 +93,9 @@ ao_spi_get(uint8_t spi_index, uint32_t speed); void ao_spi_put(uint8_t spi_index); +void +ao_spi_put_pins(uint8_t spi_index); + void ao_spi_send(const void *block, uint16_t len, uint8_t spi_index); @@ -148,7 +152,7 @@ ao_spi_recv_byte(uint8_t spi_index) stm_spi->dr = 0xff; while (!(stm_spi->sr & (1 << STM_SPI_SR_RXNE))) ; - return stm_spi->dr; + return (uint8_t) stm_spi->dr; } void @@ -182,8 +186,8 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s ao_spi_put(bus); \ } while (0) -#define ao_spi_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<stack && - psp >= ao_cur_task->stack - 256) + (psp <= ao_cur_task->stack8 || + psp >= ao_cur_task->stack8 + AO_STACK_SIZE)) ao_panic(AO_PANIC_STACK); } #endif