linguini1 commented on code in PR #19005: URL: https://github.com/apache/nuttx/pull/19005#discussion_r3337029209
########## arch/arm64/src/am62x/am62x_tisci.c: ########## @@ -0,0 +1,528 @@ +/**************************************************************************** + * arch/arm64/src/am62x/am62x_tisci.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <errno.h> +#include <stdint.h> +#include <string.h> + +#include <nuttx/debug.h> + +#include <nuttx/arch.h> +#include <nuttx/mutex.h> + +#include "arm64_arch.h" +#include "arm64_internal.h" +#include "hardware/am62x_memorymap.h" +#include "hardware/am62x_secure_proxy.h" +#include "hardware/am62x_tisci_proto.h" +#include "am62x_tisci.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Host id and secure-proxy thread assignment (Kconfig-tunable; defaults + * match the A53 HLOS host on a standard AM62x DM/TIFS boardcfg). + */ + +#define AM62X_TISCI_HOST_ID CONFIG_AM62X_TISCI_HOST_ID +#define AM62X_TISCI_RX_THREAD CONFIG_AM62X_TISCI_RX_THREAD +#define AM62X_TISCI_TX_THREAD CONFIG_AM62X_TISCI_TX_THREAD + +/* Bounded poll: up to ~1 s waiting on a secure-proxy thread credit */ + +#define AM62X_TISCI_POLL_US 1 +#define AM62X_TISCI_POLL_MAX 1000000 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Serialises the single outstanding request/response transaction */ + +static mutex_t g_tisci_lock = NXMUTEX_INITIALIZER; + +/* Rolling sequence number used to match responses to requests */ + +static uint8_t g_tisci_seq; Review Comment: What happens when this overflows? Should it be atomic? -- 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]
