gustavonihei commented on a change in pull request #4401: URL: https://github.com/apache/incubator-nuttx/pull/4401#discussion_r698766375
########## File path: arch/xtensa/src/esp32s2/esp32s2_tim.h ########## @@ -0,0 +1,139 @@ +/**************************************************************************** + * arch/xtensa/src/esp32s2/esp32s2_tim.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_XTENSA_SRC_ESP32S2_ESP32S2_TIM_H +#define __ARCH_XTENSA_SRC_ESP32S2_ESP32S2_TIM_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> + +#include <nuttx/irq.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Helpers ******************************************************************/ + +#define ESP32S2_TIM_START(d) ((d)->ops->start(d)) +#define ESP32S2_TIM_STOP(d) ((d)->ops->stop(d)) +#define ESP32S2_TIM_CLEAR(d) ((d)->ops->clear(d)) +#define ESP32S2_TIM_SETMODE(d, m) ((d)->ops->setmode(d, m)) +#define ESP32S2_TIM_SETPRE(d, p) ((d)->ops->setpre(d, p)) +#define ESP32S2_TIM_GETCTR(d, v) ((d)->ops->getcounter(d, v)) +#define ESP32S2_TIM_CLK_SRC(d, s) ((d)->ops->setclksrc(d, s)) +#define ESP32S2_TIM_SETCTR(d, v) ((d)->ops->setcounter(d, v)) +#define ESP32S2_TIM_RLD_NOW(d) ((d)->ops->reloadnow(d)) +#define ESP32S2_TIM_GETALRVL(d, v) ((d)->ops->getalarmvalue(d, v)) +#define ESP32S2_TIM_SETALRVL(d, v) ((d)->ops->setalarmvalue(d, v)) +#define ESP32S2_TIM_SETALRM(d, e) ((d)->ops->setalarm(d, e)) +#define ESP32S2_TIM_SETARLD(d, e) ((d)->ops->setautoreload(d, e)) +#define ESP32S2_TIM_SETISR(d, hnd, arg) ((d)->ops->setisr(d, hnd, arg)) +#define ESP32S2_TIM_ENABLEINT(d) ((d)->ops->enableint(d)) +#define ESP32S2_TIM_DISABLEINT(d) ((d)->ops->disableint(d)) +#define ESP32S2_TIM_ACKINT(d) ((d)->ops->ackint(d)) +#define ESP32S2_TIM_CHECKINT(d) ((d)->ops->checkint(d)) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#define GROUP0 0 +#define GROUP1 1 + +#define TIMER0 0 Review comment: These defines are confusing. They are defined on the ESP32 Timer interface, but they are used just for internal references (for the `gid` and `tid` fields of the private structure). I see two scenarios here: - Either move these definitions (both `GROUPx` and `TIMERx`) to the implementation - Remove the GROUPx defines and add TIMER2 and TIMER3 so that the API consumer may use them all as arguments to `esp32s2_tim_init`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
