|
| 1 | +/**************************************************************************** |
| 2 | + * arch/risc-v/src/mpfs/mpfs_rcc.h |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + * |
| 6 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 7 | + * contributor license agreements. See the NOTICE file distributed with |
| 8 | + * this work for additional information regarding copyright ownership. The |
| 9 | + * ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 10 | + * "License"); you may not use this file except in compliance with the |
| 11 | + * License. You may obtain a copy of the License at |
| 12 | + * |
| 13 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + * |
| 15 | + * Unless required by applicable law or agreed to in writing, software |
| 16 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 17 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 18 | + * License for the specific language governing permissions and limitations |
| 19 | + * under the License. |
| 20 | + * |
| 21 | + ****************************************************************************/ |
| 22 | + |
| 23 | +#ifndef ARCH_RISC_V_SRC_MPFS_MPFS_RCC_H |
| 24 | +#define ARCH_RISC_V_SRC_MPFS_MPFS_RCC_H |
| 25 | + |
| 26 | +/**************************************************************************** |
| 27 | + * Included Files |
| 28 | + ****************************************************************************/ |
| 29 | + |
| 30 | +#include <nuttx/config.h> |
| 31 | + |
| 32 | +#include <stdint.h> |
| 33 | + |
| 34 | +/**************************************************************************** |
| 35 | + * Pre-processor Definitions |
| 36 | + ****************************************************************************/ |
| 37 | + |
| 38 | +/**************************************************************************** |
| 39 | + * Public Types |
| 40 | + ****************************************************************************/ |
| 41 | + |
| 42 | +enum mpfs_rcc_id_e |
| 43 | +{ |
| 44 | + MPFS_RCC_CAN, |
| 45 | + MPFS_RCC_I2C, |
| 46 | + MPFS_RCC_PWM, |
| 47 | + MPFS_RCC_SPI, |
| 48 | + MPFS_RCC_UART, |
| 49 | + MPFS_RCC_LAST, |
| 50 | +}; |
| 51 | + |
| 52 | +#ifndef __ASSEMBLY__ |
| 53 | + |
| 54 | +/**************************************************************************** |
| 55 | + * Public Data |
| 56 | + ****************************************************************************/ |
| 57 | + |
| 58 | +#undef EXTERN |
| 59 | +#if defined(__cplusplus) |
| 60 | +#define EXTERN extern "C" |
| 61 | +extern "C" |
| 62 | +{ |
| 63 | +#else |
| 64 | +#define EXTERN extern |
| 65 | +#endif |
| 66 | + |
| 67 | +/**************************************************************************** |
| 68 | + * Public Function Prototypes |
| 69 | + ****************************************************************************/ |
| 70 | + |
| 71 | +/**************************************************************************** |
| 72 | + * Name: mpfs_set_reset |
| 73 | + * |
| 74 | + * Description: |
| 75 | + * Enable / disable peripheral reset. |
| 76 | + * |
| 77 | + * Input Parameters: |
| 78 | + * rcc_id - Device id. |
| 79 | + * instance - Optional instance number for device. |
| 80 | + * |
| 81 | + * Returned Value: |
| 82 | + * Zero (OK) is returned on success; a negated errno value is returned on |
| 83 | + * any failure. |
| 84 | + * |
| 85 | + ****************************************************************************/ |
| 86 | + |
| 87 | +#ifdef CONFIG_MPFS_RCC |
| 88 | +int mpfs_set_reset(int rcc_id, int instance, bool state); |
| 89 | +#else |
| 90 | +# define mpfs_set_reset(rcc_id, instance, state) (0) |
| 91 | +#endif |
| 92 | + |
| 93 | +/**************************************************************************** |
| 94 | + * Name: mpfs_set_clock |
| 95 | + * |
| 96 | + * Description: |
| 97 | + * Enable / disable peripheral clock. |
| 98 | + * |
| 99 | + * Input Parameters: |
| 100 | + * rcc_id - Device id. |
| 101 | + * instance - Optional instance number for device. |
| 102 | + * |
| 103 | + * Returned Value: |
| 104 | + * Zero (OK) is returned on success; a negated errno value is returned on |
| 105 | + * any failure. |
| 106 | + * |
| 107 | + ****************************************************************************/ |
| 108 | + |
| 109 | +#ifdef CONFIG_MPFS_RCC |
| 110 | +int mpfs_set_clock(int rcc_id, int instance, bool state); |
| 111 | +#else |
| 112 | +# define mpfs_set_clock(rcc_id, instance, state) (0) |
| 113 | +#endif |
| 114 | + |
| 115 | +#if defined(__cplusplus) |
| 116 | +} |
| 117 | +#endif |
| 118 | +#undef EXTERN |
| 119 | + |
| 120 | +#endif /* __ASSEMBLY__ */ |
| 121 | +#endif /* ARCH_RISC_V_SRC_MPFS_MPFS_RCC_H */ |
0 commit comments