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



##########
File path: hw/mcu/nordic/nrf91xxx/src/hal_spi.c
##########
@@ -0,0 +1,1059 @@
+/*
+ * 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 <errno.h>
+#include <assert.h>
+#include "os/mynewt.h"
+#include <mcu/cmsis_nvic.h>
+#include <hal/hal_spi.h>
+#include "mcu/nrf91_hal.h"
+#include "nrf.h"
+#include "nrfx_config_nrf9160.h"
+
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+#define SPIM_TXD_MAXCNT_MAX             65535
+
+/* IRQ handler type */
+typedef void (*nrf91_spi_irq_handler_t)(void);
+
+/* XXX:
+ * 1) what about stats?
+ * 2) Dealing with errors (OVERFLOW, OVERREAD)
+ * 3) Dont think I need dummy_rx as I can set master RX maxcnt to zero.
+ */
+
+/* The maximum number of SPI interfaces we will allow */
+#define NRF91_HAL_SPI_MAX (4)
+
+/* Used to disable all interrupts */
+#define NRF_SPI_IRQ_DISABLE_ALL 0xFFFFFFFF
+
+/*
+ *  Slave states
+ *
+ *  IDLE: Slave not ready to be used. If master attempts to access
+ *        slave it will receive the default character
+ *  ACQ_SEM: Slave is attempting to acquire semaphore.
+ *  READY: Slave is ready for master to send it data
+ *
+ */
+#define HAL_SPI_SLAVE_STATE_IDLE        (0)
+#define HAL_SPI_SLAVE_STATE_ACQ_SEM     (1)
+#define HAL_SPI_SLAVE_STATE_READY       (2)
+
+struct nrf91_hal_spi {
+    uint8_t spi_type;
+    uint8_t spi_xfr_flag;   /* Master only */
+    uint8_t dummy_rx;       /* Master only */
+    uint8_t slave_state;    /* Slave only */
+    uint16_t nhs_buflen;

Review comment:
       but you are right for this one I am just going to remove the prefix, not 
needed. 




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