Skip to content

Commit

Permalink
Merge branch 'RT-Thread:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
WwWangGuan authored Nov 28, 2024
2 parents 2e11005 + b874696 commit 3b6d4e4
Show file tree
Hide file tree
Showing 21 changed files with 3,842 additions and 1 deletion.
9 changes: 9 additions & 0 deletions bsp/phytium/aarch64/.config
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ CONFIG_RT_USING_QSPI=y
# CONFIG_RT_USING_LCD is not set
# CONFIG_RT_USING_HWCRYPTO is not set
# CONFIG_RT_USING_WIFI is not set
CONFIG_RT_USING_BLK=y

#
# Partition Types
#
CONFIG_RT_BLK_PARTITION_DFS=y
CONFIG_RT_BLK_PARTITION_EFI=y
# end of Partition Types

# CONFIG_RT_USING_VIRTIO is not set
CONFIG_RT_USING_PIN=y
CONFIG_RT_USING_KTIME=y
Expand Down
1 change: 1 addition & 0 deletions bsp/phytium/aarch64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config PHYTIUM_ARCH_AARCH64
select RT_USING_CACHE
select TARGET_ARMV8_AARCH64
select ARCH_ARM_BOOTWITH_FLUSH_CACHE
select ARCH_USING_IRQ_CTX_LIST
select RT_USING_HW_ATOMIC
default y

Expand Down
7 changes: 7 additions & 0 deletions bsp/phytium/aarch64/rtconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
#define RT_MMCSD_MAX_PARTITION 16
#define RT_USING_SPI
#define RT_USING_QSPI
#define RT_USING_BLK

/* Partition Types */

#define RT_BLK_PARTITION_DFS
#define RT_BLK_PARTITION_EFI
/* end of Partition Types */
#define RT_USING_PIN
#define RT_USING_KTIME
#define RT_USING_CHERRYUSB
Expand Down
1 change: 1 addition & 0 deletions components/drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rsource "touch/Kconfig"
rsource "graphic/Kconfig"
rsource "hwcrypto/Kconfig"
rsource "wlan/Kconfig"
rsource "led/Kconfig"
rsource "mailbox/Kconfig"
rsource "phye/Kconfig"
rsource "ata/Kconfig"
Expand Down
57 changes: 57 additions & 0 deletions components/drivers/include/drivers/led.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-3-08 GuEe-GUI the first version
*/

#ifndef __LED_H__
#define __LED_H__

#include <rthw.h>
#include <rtdef.h>

struct rt_led_ops;

enum rt_led_state
{
RT_LED_S_OFF,
RT_LED_S_ON,
RT_LED_S_TOGGLE,
RT_LED_S_BLINK,

RT_LED_STATE_NR,
};

struct rt_led_device
{
struct rt_device parent;

const struct rt_led_ops *ops;

struct rt_spinlock spinlock;

void *sysdata;
void *priv;
};

struct rt_led_ops
{
rt_err_t (*set_state)(struct rt_led_device *led, enum rt_led_state state);
rt_err_t (*get_state)(struct rt_led_device *led, enum rt_led_state *out_state);
rt_err_t (*set_period)(struct rt_led_device *led, rt_uint32_t period_ms);
rt_err_t (*set_brightness)(struct rt_led_device *led, rt_uint32_t brightness);
};

rt_err_t rt_hw_led_register(struct rt_led_device *led);
rt_err_t rt_hw_led_unregister(struct rt_led_device *led);

rt_err_t rt_led_set_state(struct rt_led_device *led, enum rt_led_state state);
rt_err_t rt_led_get_state(struct rt_led_device *led, enum rt_led_state *out_state);
rt_err_t rt_led_set_period(struct rt_led_device *led, rt_uint32_t period_ms);
rt_err_t rt_led_set_brightness(struct rt_led_device *led, rt_uint32_t brightness);

#endif /* __LED_H__ */
24 changes: 24 additions & 0 deletions components/drivers/include/drivers/pci_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct rt_pci_ep_msix_tbl
};

struct rt_pci_ep_ops;
struct rt_pci_ep_mem;

struct rt_pci_ep
{
Expand All @@ -84,6 +85,9 @@ struct rt_pci_ep
const struct rt_device *rc_dev;
const struct rt_pci_ep_ops *ops;

rt_size_t mems_nr;
struct rt_pci_ep_mem *mems;

rt_uint8_t max_functions;
RT_BITMAP_DECLARE(functions_map, 8);
rt_list_t epf_nodes;
Expand All @@ -92,6 +96,16 @@ struct rt_pci_ep
void *priv;
};

struct rt_pci_ep_mem
{
rt_ubase_t cpu_addr;
rt_size_t size;
rt_size_t page_size;

rt_bitmap_t *map;
rt_size_t bits;
};

struct rt_pci_epf
{
rt_list_t list;
Expand Down Expand Up @@ -170,6 +184,16 @@ rt_err_t rt_pci_ep_stop(struct rt_pci_ep *ep);
rt_err_t rt_pci_ep_register(struct rt_pci_ep *ep);
rt_err_t rt_pci_ep_unregister(struct rt_pci_ep *ep);

rt_err_t rt_pci_ep_mem_array_init(struct rt_pci_ep *ep,
struct rt_pci_ep_mem *mems, rt_size_t mems_nr);
rt_err_t rt_pci_ep_mem_init(struct rt_pci_ep *ep,
rt_ubase_t cpu_addr, rt_size_t size, rt_size_t page_size);

void *rt_pci_ep_mem_alloc(struct rt_pci_ep *ep,
rt_ubase_t *out_cpu_addr, rt_size_t size);
void rt_pci_ep_mem_free(struct rt_pci_ep *ep,
void *vaddr, rt_ubase_t cpu_addr, rt_size_t size);

rt_err_t rt_pci_ep_add_epf(struct rt_pci_ep *ep, struct rt_pci_epf *epf);
rt_err_t rt_pci_ep_remove_epf(struct rt_pci_ep *ep, struct rt_pci_epf *epf);

Expand Down
4 changes: 4 additions & 0 deletions components/drivers/include/rtdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ extern "C" {
#endif /* RT_ATA_AHCI */
#endif /* RT_USING_ATA */

#ifdef RT_USING_LED
#include "drivers/led.h"
#endif

#ifdef RT_USING_MBOX
#include "drivers/mailbox.h"
#endif /* RT_USING_MBOX */
Expand Down
15 changes: 15 additions & 0 deletions components/drivers/led/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
menuconfig RT_USING_LED
bool "Using Light Emitting Diode (LED) device drivers"
depends on RT_USING_DM
default n

config RT_LED_GPIO
bool "GPIO connected LEDs Support"
depends on RT_USING_LED
depends on RT_USING_PINCTRL
depends on RT_USING_OFW
default n

if RT_USING_LED
osource "$(SOC_DM_LED_DIR)/Kconfig"
endif
18 changes: 18 additions & 0 deletions components/drivers/led/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from building import *

group = []

if not GetDepend(['RT_USING_DM', 'RT_USING_LED']):
Return('group')

cwd = GetCurrentDir()
CPPPATH = [cwd + '/../include']

src = ['led.c']

if GetDepend(['RT_LED_GPIO']):
src += ['led-gpio.c']

group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
Loading

0 comments on commit 3b6d4e4

Please sign in to comment.