Dongjin Kim | 878094c | 2025-04-01 15:44:43 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2025 Hardkernel Co., Ltd. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | */ |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | #include <string.h> |
| 9 | #include "keypad.h" |
| 10 | #include "gpio.h" |
| 11 | #include "suspend.h" |
| 12 | |
| 13 | #define GPIO_EXTPHY_WOL GPIOH_10 |
| 14 | |
| 15 | static void vExtPhyCallBack(struct xReportEvent event) |
| 16 | { |
| 17 | uint32_t buf[4] = { 0 }; |
| 18 | |
| 19 | if (event.ulCode == GPIO_EXTPHY_WOL) { |
| 20 | buf[0] = ETH_PHY_GPIO; |
| 21 | STR_Wakeup_src_Queue_Send_FromISR(buf); |
| 22 | printf("EXTPHY: EVENT 0x%x,%d,%d\n", event.event, event.ulCode, |
| 23 | event.responseTime); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | struct xGpioKeyInfo gpioKeyInfo[] = { |
| 28 | GPIO_KEY_INFO(GPIO_EXTPHY_WOL, HIGH, EVENT_SHORT, vExtPhyCallBack, NULL), |
| 29 | }; |
| 30 | |
| 31 | void vExtPhyInit(void) |
| 32 | { |
| 33 | vCreateGpioKey(gpioKeyInfo, sizeof(gpioKeyInfo) / sizeof(struct xGpioKeyInfo)); |
| 34 | } |
| 35 | |
| 36 | void vExtPhyDeinit(void) |
| 37 | { |
| 38 | vDestroyGpioKey(); |
| 39 | } |