Small additions to core/system.[ch] Small addition to gpio driver header
authorNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 27 Sep 2016 21:06:54 +0000 (23:06 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:05 +0000 (17:03 +0100)
core/system.c
include/core/system.h
include/drivers/gpio.h

index 5939c49..f8e6ecc 100644 (file)
@@ -137,6 +137,12 @@ void subsystem_power(uint32_t power_bit, uint32_t on_off)
                sys_config->sys_AHB_clk_ctrl &= ~(power_bit);
        }
 }
+/* Check whether a subsystem is powered or not */
+uint8_t subsystem_powered(uint32_t power_bit)
+{
+       struct lpc_sys_config* sys_config = LPC_SYS_CONFIG;
+       return (sys_config->sys_AHB_clk_ctrl & power_bit);
+}
 
 /***************************************************************************** */
 /*                      System Clock                                           */
index dc3dfb1..4f06c0f 100644 (file)
@@ -46,6 +46,8 @@ void enter_deep_sleep(void);
 
 /* Power on or off a subsystem */
 void subsystem_power(uint32_t power_bit, uint32_t on_off);
+/* Check whether a subsystem is powered or not */
+uint8_t subsystem_powered(uint32_t power_bit);
 
 /* Configure the brown-out detection.
  * Note: Brown-Out detection must be powered to operate the ADC (See Section 19.2
index 5ca197f..d4bad31 100644 (file)
@@ -68,6 +68,12 @@ struct lpc_gpio
 /***************************************************************************** */
 /*   Public access to GPIO setup   */
 
+enum gpio_ports {
+       GPIO_PORT0 = 0,
+       GPIO_PORT1,
+       GPIO_PORT2,
+};
+
 #define GPIO_DIR_IN 0
 #define GPIO_DIR_OUT 1