Merge pull request #5177 from Guozhanxin/gitee_master

同步 Gitee master
This commit is contained in:
guo 2021-10-14 15:06:24 +08:00 committed by GitHub
commit ce0803fe3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 20 deletions

View File

@ -347,11 +347,11 @@ FMC_STATUS_T FMC_ProgramOptionByteData(uint32_t address, uint8_t data)
* *
* @param page:the address of the pages to be write protection * @param page:the address of the pages to be write protection
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* for APM32F10X_LD * for APM32F10X_LD
* @arg FLASH_WRP_PAGE_0_3 to FLASH_WRP_PAGE_28_31 * @arg FLASH_WRP_PAGE_0_3 to FLASH_WRP_PAGE_28_31
* for APM32F10X_MD * for APM32F10X_MD
* @arg FLASH_WRP_PAGE_0_3 to FLASH_WRP_PAGE_124_127 * @arg FLASH_WRP_PAGE_0_3 to FLASH_WRP_PAGE_124_127
* for APM32F10X_HD * for APM32F10X_HD
* @arg FLASH_WRP_PAGE_0_1 to FLASH_WRP_PAGE_60_61 or FLASH_WRP_PAGE_62_127 * @arg FLASH_WRP_PAGE_0_1 to FLASH_WRP_PAGE_60_61 or FLASH_WRP_PAGE_62_127
* @arg FMC_WRP_PAGE_ALL * @arg FMC_WRP_PAGE_ALL
* *

View File

@ -88,7 +88,7 @@ void PMU_DisablePVD(void)
/*! /*!
* @brief Configure a voltage threshold detected by a power supply voltage detector (PVD). * @brief Configure a voltage threshold detected by a power supply voltage detector (PVD).
* *
* @param levelspecifies the PVD detection level * @param level : specifies the PVD detection level
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg PMU_PVD_LEVEL_2V2 : Config PVD detection level to 2.2V * @arg PMU_PVD_LEVEL_2V2 : Config PVD detection level to 2.2V
* @arg PMU_PVD_LEVEL_2V3 : Config PVD detection level to 2.3V * @arg PMU_PVD_LEVEL_2V3 : Config PVD detection level to 2.3V
@ -198,7 +198,7 @@ void PMU_EnterSTANDBYMode(void)
/*! /*!
* @brief Read the specified PWR flag is set or not. * @brief Read the specified PWR flag is set or not.
* *
* @param flagReads the status of specifies the flag. * @param flag : Reads the status of specifies the flag.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg PMU_FLAG_WUE : Wake Up flag * @arg PMU_FLAG_WUE : Wake Up flag
* @arg PMU_FLAG_SB : StandBy flag * @arg PMU_FLAG_SB : StandBy flag
@ -226,7 +226,7 @@ uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag)
/*! /*!
* @brief Clears the PWR's pending flags. * @brief Clears the PWR's pending flags.
* *
* @param flagClears the status of specifies the flag. * @param flag : Clears the status of specifies the flag.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg PMU_FLAG_WUE : Wake Up flag * @arg PMU_FLAG_WUE : Wake Up flag
* @arg PMU_FLAG_SB : StandBy flag * @arg PMU_FLAG_SB : StandBy flag

View File

@ -1032,7 +1032,7 @@ void RCM_ClearStatusFlag(void)
/*! /*!
* @brief Reads the specified RCM interrupt Flag * @brief Reads the specified RCM interrupt Flag
* *
* @param flag Reads specifies RCM interrupt flag. * @param flag : Reads specifies RCM interrupt flag.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCM_INT_LSIRDY : LSI ready interrupt flag * @arg RCM_INT_LSIRDY : LSI ready interrupt flag
* @arg RCM_INT_LSERDY : LSE ready interrupt flag * @arg RCM_INT_LSERDY : LSE ready interrupt flag

View File

@ -289,7 +289,7 @@ uint32_t SDIO_ReadDataCounter(void)
/*! /*!
* @brief Write the SDIO Data * @brief Write the SDIO Data
* *
* @param DataWrite 32-bit data * @param Data : Write 32-bit data
* *
* @retval None * @retval None
*/ */

View File

@ -15,7 +15,6 @@
/*@{*/ /*@{*/
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <ctype.h> #include <ctype.h>
#include <stdint.h> #include <stdint.h>
#include <rtthread.h> #include <rtthread.h>
@ -23,6 +22,10 @@
#include "drv_spi.h" #include "drv_spi.h"
#ifdef RT_USING_SPI #ifdef RT_USING_SPI
#ifdef RT_USING_SPI_GPIOCS
#include <drivers/pin.h>
#endif
static void spi_init(uint8_t spre_spr, uint8_t copl, uint8_t cpha) static void spi_init(uint8_t spre_spr, uint8_t copl, uint8_t cpha)
{ {
SET_SPI(SPSR, 0xc0); SET_SPI(SPSR, 0xc0);
@ -33,21 +36,18 @@ static void spi_init(uint8_t spre_spr, uint8_t copl, uint8_t cpha)
SET_SPI(SOFTCS, 0xff); SET_SPI(SOFTCS, 0xff);
} }
static void spi_set_csn(uint8_t val) rt_inline void spi_set_csn(uint8_t val)
{ {
SET_SPI(SOFTCS, val); SET_SPI(SOFTCS, val);
} }
#ifdef RT_USING_SPI_GPIOCS
#include <drivers/pin.h>
#endif
static void spi_set_cs(unsigned char cs, int new_status) static void spi_set_cs(unsigned char cs, int new_status)
{ {
if (cs < 4) if (cs < 4)
{ {
unsigned char val = 0; unsigned char val = 0;
val = GET_SPI(SOFTCS); val = GET_SPI(SOFTCS);
val |= 0x01 << cs ; // csen=1 val |= 0x01 << cs ; // csen=1
if (new_status) // cs = 1 if (new_status) // cs = 1
{ {
val |= (0x10 << cs); // csn=1 val |= (0x10 << cs); // csn=1
@ -67,6 +67,7 @@ static void spi_set_cs(unsigned char cs, int new_status)
} }
#endif #endif
} }
static uint8_t spi_write_for_response(uint8_t data) static uint8_t spi_write_for_response(uint8_t data)
{ {
uint8_t val; uint8_t val;
@ -97,6 +98,7 @@ static int cmd_spi_init(int argc, char *argv[])
} }
} }
MSH_CMD_EXPORT(cmd_spi_init, cmd_spi_init); MSH_CMD_EXPORT(cmd_spi_init, cmd_spi_init);
static int cmd_spi_set_csn(int argc, char *argv[]) static int cmd_spi_set_csn(int argc, char *argv[])
{ {
uint8_t val, csn; uint8_t val, csn;
@ -113,6 +115,7 @@ static int cmd_spi_set_csn(int argc, char *argv[])
} }
} }
MSH_CMD_EXPORT(cmd_spi_set_csn, cmd_spi_set_csn); MSH_CMD_EXPORT(cmd_spi_set_csn, cmd_spi_set_csn);
static int cmd_spi_write(int argc, char *argv[]) static int cmd_spi_write(int argc, char *argv[])
{ {
uint8_t data, resp; uint8_t data, resp;
@ -132,6 +135,7 @@ MSH_CMD_EXPORT(cmd_spi_write, cmd_spi_write);
static rt_err_t configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration); static rt_err_t configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *message); static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *message);
const static unsigned char SPI_DIV_TABLE[] = {0b0000, 0b0001, 0b0100, 0b0010, 0b0011, 0b0101, 0b0110, 0b0111, 0b1000, 0b1001, 0b1010, 0b1011}; const static unsigned char SPI_DIV_TABLE[] = {0b0000, 0b0001, 0b0100, 0b0010, 0b0011, 0b0101, 0b0110, 0b0111, 0b1000, 0b1001, 0b1010, 0b1011};
// 2 4 8 16 32 64 128 256 512 1024 2048 4096 // 2 4 8 16 32 64 128 256 512 1024 2048 4096
static rt_err_t configure(struct rt_spi_device *device, static rt_err_t configure(struct rt_spi_device *device,
@ -174,8 +178,8 @@ static rt_err_t configure(struct rt_spi_device *device,
return RT_EOK; return RT_EOK;
} }
static rt_uint32_t xfer(struct rt_spi_device *device,
struct rt_spi_message *message) static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{ {
unsigned char cs = 0; unsigned char cs = 0;
@ -217,18 +221,19 @@ static rt_uint32_t xfer(struct rt_spi_device *device,
} }
return message->length; return message->length;
} }
static struct rt_spi_ops loongson_spi_ops = static struct rt_spi_ops loongson_spi_ops =
{ {
.configure = configure, .configure = configure,
.xfer = xfer .xfer = xfer
}; };
static struct rt_spi_bus loongson_spi; static struct rt_spi_bus loongson_spi;
static int loongson_spi_init() static int loongson_spi_init()
{ {
//rt_kprintf("spi_init\n"); //rt_kprintf("spi_init\n");
return rt_spi_bus_register(&loongson_spi, "spi", &loongson_spi_ops); return rt_spi_bus_register(&loongson_spi, "spi", &loongson_spi_ops);
} }
INIT_BOARD_EXPORT(loongson_spi_init); INIT_BOARD_EXPORT(loongson_spi_init);
#endif #endif
/*@}*/ /*@}*/

View File

@ -582,8 +582,8 @@ void rt_show_version(void)
{ {
rt_kprintf("\n \\ | /\n"); rt_kprintf("\n \\ | /\n");
rt_kprintf("- RT - Thread Operating System\n"); rt_kprintf("- RT - Thread Operating System\n");
rt_kprintf(" / | \\ %d.%d.%d build %s\n", rt_kprintf(" / | \\ %d.%d.%d build %s %s\n",
RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__); RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__, __TIME__);
rt_kprintf(" 2006 - 2021 Copyright by rt-thread team\n"); rt_kprintf(" 2006 - 2021 Copyright by rt-thread team\n");
} }
RTM_EXPORT(rt_show_version); RTM_EXPORT(rt_show_version);