summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2020-02-18 17:39:36 +0800
committerGitHub <[email protected]>2020-02-18 17:39:36 +0800
commit60ff401cac840cabb97d3a4b8d6458bd0ab4ce4a (patch)
treee29b70c9029f2ebb0a4fb64c75ee0be3f211d623
parent5e1be7f67c5a6d44cf21f9c40e01e964f2d503dc (diff)
parent55eaea2f26e7e99b504d7f8a3f297d6249619ea4 (diff)
Merge pull request #3381 from pinxue/master
Make MicroPython run on Raspi3-64 bsp
-rw-r--r--bsp/raspberry-pi/raspi3-64/driver/Kconfig16
-rw-r--r--bsp/raspberry-pi/raspi3-64/driver/drv_spi.c62
2 files changed, 67 insertions, 11 deletions
diff --git a/bsp/raspberry-pi/raspi3-64/driver/Kconfig b/bsp/raspberry-pi/raspi3-64/driver/Kconfig
index 2deffef99c..e45d0a3ca2 100644
--- a/bsp/raspberry-pi/raspi3-64/driver/Kconfig
+++ b/bsp/raspberry-pi/raspi3-64/driver/Kconfig
@@ -27,16 +27,16 @@ menu "Hardware Drivers Config"
menuconfig BSP_USING_SYSTIMER
bool "Enable SYSTIMER"
- select BSP_USING_SYSTIMER
+ select RT_USING_SYSTIMER
default n
- if BSP_USING_SYSTIMER
- config RT_USING_SYSTIMER1
- bool "Enable sys timer1"
- default n
- config RT_USING_SYSTIMER3
- bool "Enable sys timer3"
- default n
+ if RT_USING_SYSTIMER
+ config RT_USING_SYSTIMER1
+ bool "Enable sys timer1"
+ default n
+ config RT_USING_SYSTIMER3
+ bool "Enable sys timer3"
+ default n
endif
menuconfig BSP_USING_I2C
diff --git a/bsp/raspberry-pi/raspi3-64/driver/drv_spi.c b/bsp/raspberry-pi/raspi3-64/driver/drv_spi.c
index 041a97b510..70d2096277 100644
--- a/bsp/raspberry-pi/raspi3-64/driver/drv_spi.c
+++ b/bsp/raspberry-pi/raspi3-64/driver/drv_spi.c
@@ -18,6 +18,60 @@
#ifdef RT_USING_SPI
+struct rpi_pin_index
+{
+ rt_uint8_t phy_id;
+ rt_uint8_t bcm_id;
+ rt_uint8_t signal_name;
+ rt_uint8_t magic;
+};
+
+//raspi phy id and bcm id
+static struct rpi_pin_index phypin_index[] =
+{
+ {0, 0, 0, 0},
+ {1, 0, 0, 0},
+ {2, 0, 0, 0},
+ {3, BCM_GPIO_PIN_2, RPI_SDA1, PIN_MAGIC},
+ {4, 0, 0, 0},
+ {5, BCM_GPIO_PIN_3, RPI_SCL1, PIN_MAGIC},
+ {6, 0, 0, 0},
+ {7, BCM_GPIO_PIN_4, RPI_GPIO_GCLK, PIN_MAGIC},
+ {8, BCM_GPIO_PIN_14, RPI_TXD0, PIN_MAGIC},
+ {9, 0, 0, 0},
+ {10, BCM_GPIO_PIN_15, RPI_RXD0, PIN_MAGIC},
+ {11, BCM_GPIO_PIN_17, RPI_GPIO_GEN0, PIN_MAGIC},
+ {12, BCM_GPIO_PIN_18, RPI_GPIO_GEN1, PIN_MAGIC},
+ {13, BCM_GPIO_PIN_27, RPI_GPIO_GEN2, PIN_MAGIC},
+ {14, 0, 0, 0},
+ {15, BCM_GPIO_PIN_22, RPI_GPIO_GEN3, PIN_MAGIC},
+ {16, BCM_GPIO_PIN_23, RPI_GPIO_GEN4, PIN_MAGIC},
+ {17, 0, 0, 0},
+ {18, BCM_GPIO_PIN_24, RPI_GPIO_GEN5, PIN_MAGIC},
+ {19, BCM_GPIO_PIN_10, RPI_SPI_MOSI, PIN_MAGIC},
+ {20, 0, 0, 0},
+ {21, BCM_GPIO_PIN_9, RPI_SPI_MISO, PIN_MAGIC},
+ {22, BCM_GPIO_PIN_25, RPI_GPIO_GEN6, PIN_MAGIC},
+ {23, BCM_GPIO_PIN_11, RPI_SPI_SCLK, PIN_MAGIC},
+ {24, BCM_GPIO_PIN_8, RPI_SPI_CE0_N, PIN_MAGIC},
+ {25, 0, 0, 0},
+ {26, BCM_GPIO_PIN_7, RPI_SPI_CE1_N, PIN_MAGIC},
+ {27, BCM_GPIO_PIN_0, RPI_SDA0, PIN_MAGIC},
+ {28, BCM_GPIO_PIN_1, RPI_SCL0, PIN_MAGIC},
+ {29, BCM_GPIO_PIN_5, RPI_CAM_CLK, PIN_MAGIC},
+ {30, 0, 0, 0},
+ {31, BCM_GPIO_PIN_6, RPI_LAN_RUN, PIN_MAGIC},
+ {32, BCM_GPIO_PIN_12, 0, PIN_MAGIC},
+ {33, BCM_GPIO_PIN_13, 0, PIN_MAGIC},
+ {34, 0, 0, 0},
+ {35, BCM_GPIO_PIN_19, 0, PIN_MAGIC},
+ {36, BCM_GPIO_PIN_16, RPI_STATUS_LED_N, PIN_MAGIC},
+ {37, BCM_GPIO_PIN_26, 0, PIN_MAGIC},
+ {38, BCM_GPIO_PIN_20, 0, PIN_MAGIC},
+ {39, 0, 0, 0},
+ {40, BCM_GPIO_PIN_21, RPI_CAM_GPIO, PIN_MAGIC},
+};
+
static rt_uint8_t bcm2835_spi_bit_order = BCM283X_SPI_BIT_ORDER_MSBFIRST;
static rt_uint8_t bcm2835_byte_reverse_table[] =
@@ -317,10 +371,11 @@ const static struct rt_spi_ops raspi_spi_ops =
#if defined (BSP_USING_SPI0)
#define SPI0BUS_NAME "spi0.0"
+struct rt_spi spi0;
struct rt_spi_bus raspi_spi0_bus =
{
.ops = &raspi_spi_ops,
- .parent.user_data = spi0
+ .parent.user_data = &spi0
};
struct rt_spi_hw_config raspi_spi0_hw =
@@ -348,11 +403,12 @@ struct rt_spi spi0 =
#if defined (BSP_USING_SPI1)
#define SPI1BUS_NAME "spi0.1"
-
+
+struct rt_spi spi1;
struct rt_spi_bus raspi_spi1_bus =
{
.ops = &raspi_spi_ops,
- .parent.user_data = spi1
+ .parent.user_data = &spi1
};
struct rt_spi_hw_config raspi_spi1_hw =