aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-08-04 09:10:46 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-08-04 09:10:46 -0400
commit6d8b91106fd952f45ff26f85dc9bd12ecb362652 (patch)
tree5085d8a6b63837e4b5d58bef1ace7df8fb338ea7
parentd2494611156c4ba477a1bbd1b07ba0cfc14b29e4 (diff)
downloadlibrambutan-6d8b91106fd952f45ff26f85dc9bd12ecb362652.tar.gz
librambutan-6d8b91106fd952f45ff26f85dc9bd12ecb362652.zip
Switch spi to use new rcc interface
-rw-r--r--libmaple/rcc.c2
-rw-r--r--libmaple/rcc.h2
-rw-r--r--libmaple/spi.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/libmaple/rcc.c b/libmaple/rcc.c
index 4f13b0d..ab62025 100644
--- a/libmaple/rcc.c
+++ b/libmaple/rcc.c
@@ -99,6 +99,8 @@ static const struct rcc_dev_info rcc_dev_table[] = {
[RCC_TIMER2] = { .clk_domain = APB1, .line_num = 0 },
[RCC_TIMER3] = { .clk_domain = APB1, .line_num = 1 },
[RCC_TIMER4] = { .clk_domain = APB1, .line_num = 2 },
+ [RCC_SPI1] = { .clk_domain = APB2, .line_num = 12 },
+ [RCC_SPI2] = { .clk_domain = APB1, .line_num = 14 },
};
/**
diff --git a/libmaple/rcc.h b/libmaple/rcc.h
index 1bc63e6..e6a28ea 100644
--- a/libmaple/rcc.h
+++ b/libmaple/rcc.h
@@ -104,6 +104,8 @@ enum {
RCC_TIMER2,
RCC_TIMER3,
RCC_TIMER4,
+ RCC_SPI1,
+ RCC_SPI2,
};
/* prescalers */
diff --git a/libmaple/spi.c b/libmaple/spi.c
index aa75c5f..68855a5 100644
--- a/libmaple/spi.c
+++ b/libmaple/spi.c
@@ -89,12 +89,12 @@ void spi_init(uint32 spi_num,
/* limit to 18 mhz max speed */
ASSERT(prescale != CR1_BR_PRESCALE_2);
spi = (SPI*)SPI1_BASE;
- rcc_enable_clk_spi1();
+ rcc_clk_enable(RCC_SPI1);
spi_gpio_cfg(&spi_dev1);
break;
case 2:
spi = (SPI*)SPI2_BASE;
- rcc_enable_clk_spi2();
+ rcc_clk_enable(RCC_SPI2);
spi_gpio_cfg(&spi_dev2);
break;
}