This commit is contained in:
刘可亮
2024-09-30 17:06:01 +08:00
parent 2ce4d6bb89
commit 0ef85b55da
9363 changed files with 843557 additions and 428518 deletions

View File

@@ -18,8 +18,8 @@ extern "C" {
/* Luban-Lite version information */
#define LL_VERSION 1 /**< major version number */
#define LL_SUBVERSION 0 /**< minor version number */
#define LL_REVISION 6 /**< revise version number */
#define LL_SUBVERSION 1 /**< minor version number */
#define LL_REVISION 0 /**< revise version number */
typedef __signed__ char s8;
typedef unsigned char u8;
@@ -140,6 +140,11 @@ typedef unsigned long ptr_t;
# define _IO(x, y) (((x) << 8) | y)
#endif
#ifdef asm
#undef asm
#endif
#define asm __asm__
#define ARCH_DMA_MINALIGN CACHE_LINE_SIZE
#if defined(KERNEL_RTTHREAD)
@@ -152,6 +157,8 @@ typedef unsigned long ptr_t;
#endif
#elif defined(KERNEL_BAREMETAL)
#define CONFIG_SYSTICK_HZ 100
#elif defined(KERNEL_UCOS_II)
#define CONFIG_SYSTICK_HZ UCOS_TICKS_PER_SEC
#endif
#undef offsetof

View File

@@ -11,6 +11,33 @@
extern "C" {
#endif
#define FLAG_WAKEUP_SOURCE (1)
#define FLAG_POWER_PIN (2)
struct aic_pinmux
{
unsigned char func;
unsigned char bias;
unsigned char drive;
char * name;
/* This flag indicates whether the pin is the wakeup source.
*
* For example:
* 1.The I2C0 is the wakeup source, then you need to set the flag
* of I2C0 pinmux to 1.
* {4, PIN_PULL_DIS, 3, "PD.6", FLAG_WAKEUP_SOURCE}, // SCK
* {4, PIN_PULL_DIS, 3, "PD.7", FLAG_WAKEUP_SOURCE}, // SDA
*
* 2.The GPIO PD6 is the wakeup source, then you need to set the flag
* of PD6 pinmux to 1.
* {1, PIN_PULL_DIS, 3, "PD.6", FLAG_WAKEUP_SOURCE},
*/
unsigned char flag;
};
extern struct aic_pinmux aic_pinmux_config[];
extern uint32_t aic_pinmux_config_size;
void hexdump(unsigned char *buf, unsigned long len, int groupsize);
void hexdump_msg(char *msg, unsigned char *buf, unsigned long len, int groupsize);
@@ -19,6 +46,9 @@ void show_speed(char *msg, unsigned long len, unsigned long us);
int pinmux_fdt_parse(void);
#endif
void aic_board_pinmux_init(void);
void aic_board_pinmux_deinit(void);
#ifdef __cplusplus
}
#endif

View File

@@ -162,3 +162,44 @@ int pinmux_fdt_parse(void)
return 0;
}
#endif
__WEAK void aic_board_pinmux_init(void)
{
uint32_t i = 0;
long pin = 0;
unsigned int g;
unsigned int p;
for (i=0; i < aic_pinmux_config_size; i++) {
pin = hal_gpio_name2pin(aic_pinmux_config[i].name);
if (pin < 0)
continue;
g = GPIO_GROUP(pin);
p = GPIO_GROUP_PIN(pin);
hal_gpio_set_func(g, p, aic_pinmux_config[i].func);
hal_gpio_set_bias_pull(g, p, aic_pinmux_config[i].bias);
hal_gpio_set_drive_strength(g, p, aic_pinmux_config[i].drive);
}
}
__WEAK void aic_board_pinmux_deinit(void)
{
uint32_t i = 0;
long pin = 0;
unsigned int g;
unsigned int p;
for (i=0; i < aic_pinmux_config_size; i++) {
if (aic_pinmux_config[i].flag)
continue;
pin = hal_gpio_name2pin(aic_pinmux_config[i].name);
if (pin < 0)
continue;
g = GPIO_GROUP(pin);
p = GPIO_GROUP_PIN(pin);
hal_gpio_set_func(g, p, 0);
hal_gpio_set_bias_pull(g, p, 0);
hal_gpio_set_drive_strength(g, p, 0);
}
}