mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
Fixed sample rate not set correctly under slave I2S mode. (Tested this time. ^_^)
Added locking mechanism to periperials on SPI1. Added DMA mode read/write routine to SPI Flash. (Debug reuiqred. WARNING: !!! ENABLING DMA MODE MAY DESTROY YOUR DATA IN THE SPI FLASH !!!) git-svn-id: https://rt-thread.googlecode.com/svn/trunk@538 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
28232de6d0
commit
04428f9a8a
5 files changed
+599
-418
No files matched your search
@@ -18,6 +18,8 @@
|
||||
#include "stm32f10x.h"
|
||||
#include "board.h"
|
||||
|
||||
struct rt_semaphore spi1_lock;
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
@@ -87,7 +89,7 @@ static void all_device_reset(void)
|
||||
| RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG,ENABLE);
|
||||
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
|
||||
/* SDIO POWER */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
||||
@@ -279,6 +281,11 @@ void rt_hw_board_init()
|
||||
/* Enable SPI_MASTER */
|
||||
SPI_Cmd(SPI1, ENABLE);
|
||||
SPI_CalculateCRC(SPI1, DISABLE);
|
||||
|
||||
if (rt_sem_init(&spi1_lock, "spi1lock", 1, RT_IPC_FLAG_FIFO) != RT_EOK)
|
||||
{
|
||||
rt_kprintf("init spi1 lock semaphore failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
}/* rt_hw_board_init */
|
||||
|
||||
@@ -69,6 +69,8 @@ void rt_hw_board_init(void);
|
||||
void rt_hw_usart_init(void);
|
||||
void rt_hw_sdcard_init(void);
|
||||
|
||||
extern struct rt_semaphore spi1_lock;
|
||||
|
||||
#endif
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
+369
-354
File diff suppressed because it is too large.
Load diff
+218
-62
File diff suppressed because it is too large.
Load diff
@@ -18,7 +18,8 @@ thanks to gxlujd.
|
||||
#define AT45DB_PAGE_ERASE 0x81 /* 页删除(每页512/528字节) */
|
||||
#define AT45DB_SECTOR_ERASE 0x7C /* 扇区擦除(每扇区128K字节)*/
|
||||
#define AT45DB_READ_STATE_REGISTER 0xD7 /* 读取状态寄存器 */
|
||||
|
||||
#define AT45DB_MM_PAGE_READ 0xD2 /* 读取主储存器的指定页 */
|
||||
#define AT45DB_MM_PAGE_PROG_THRU_BUFFER1 0x82 /* 通过缓冲区写入主储存器 */
|
||||
|
||||
extern void rt_hw_spi_flash_init(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user