vrahane commented on a change in pull request #2348:
URL: https://github.com/apache/mynewt-core/pull/2348#discussion_r467334451



##########
File path: hw/mcu/nordic/nrf91xxx/src/hal_timer.c
##########
@@ -0,0 +1,926 @@
+/*
+ * 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.
+ */
+
+#include <string.h>
+#include <stdint.h>
+#include <assert.h>
+#include <errno.h>
+#include "os/mynewt.h"
+#include "mcu/cmsis_nvic.h"
+#include "hal/hal_timer.h"
+#include "hal/nrf_clock.h"
+#include "nrf.h"
+#include "mcu/nrf91_hal.h"
+#include "nrfx_config_nrf9160.h"
+
+/* IRQ prototype */
+typedef void (*hal_timer_irq_handler_t)(void);
+
+/* User CC 2 for reading counter, CC 3 for timer isr */
+#define NRF_TIMER_CC_READ       (2)
+#define NRF_TIMER_CC_INT        (3)
+
+/* Output compare 2 used for RTC timers */
+#define NRF_RTC_TIMER_CC_INT    (2)
+
+/* Maximum number of hal timers used */
+#define NRF91_HAL_TIMER_MAX     (5)
+
+/* Maximum timer frequency */
+#define NRF91_MAX_TIMER_FREQ    (16000000)
+
+struct nrf91_hal_timer {
+    uint8_t tmr_enabled;
+    uint8_t tmr_irq_num;
+    uint8_t tmr_rtc;
+    uint8_t tmr_pad;
+    uint32_t tmr_cntr;
+    uint32_t timer_isrs;
+    uint32_t tmr_freq;
+    void *tmr_reg;
+    TAILQ_HEAD(hal_timer_qhead, hal_timer) hal_timer_q;
+};
+
+#if MYNEWT_VAL(TIMER_0)
+struct nrf91_hal_timer nrf91_hal_timer0;
+#endif
+#if MYNEWT_VAL(TIMER_1)
+struct nrf91_hal_timer nrf91_hal_timer1;
+#endif
+#if MYNEWT_VAL(TIMER_2)
+struct nrf91_hal_timer nrf91_hal_timer2;
+#endif
+#if MYNEWT_VAL(TIMER_3)
+struct nrf91_hal_timer nrf91_hal_timer3;
+#endif
+#if MYNEWT_VAL(TIMER_4)

Review comment:
       Why won't it work ? It is not being used as for the OS Tick, it is just 
used as a normal timer here.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to