support rzg2ul-m33

This commit is contained in:
anguoyoula
2024-02-28 16:28:16 +08:00
parent d8213ec036
commit 9327b70860
368 changed files with 167651 additions and 6 deletions
@@ -0,0 +1,5 @@
SRC_DIR :=
SRC_FILES := $(wildcard *.c)
include $(KERNEL_ROOT)/compiler.mk
@@ -0,0 +1,24 @@
/* generated configuration header file - do not edit */
#ifndef BSP_CLOCK_CFG_H_
#define BSP_CLOCK_CFG_H_
#define BSP_CFG_CLOCKS_SECURE (0)
#define BSP_CFG_CLOCKS_OVERRIDE (0)
#define BSP_CFG_CLOCK_OSCCLK_HZ (24000000) /* OSC 24000000Hz */
#define BSP_CFG_CLOCK_ICLK_HZ (1000000000) /* ICLK 1000000000Hz */
#define BSP_CFG_CLOCK_I2CLK_HZ (200000000) /* I2CLK 200000000Hz */
#define BSP_CFG_CLOCK_S0CLK_HZ (12000) /* S0CLK 12000Hz */
#define BSP_CFG_CLOCK_SPI0CLK_HZ (200000000) /* SPI0CLK 200000000Hz */
#define BSP_CFG_CLOCK_SPI1CLK_HZ (100000000) /* SPI1CLK 100000000Hz */
#define BSP_CFG_CLOCK_SD0CLK_HZ (533000000) /* SD0CLK 533000000Hz */
#define BSP_CFG_CLOCK_SD1CLK_HZ (533000000) /* SD1CLK 533000000Hz */
#define BSP_CFG_CLOCK_M0CLK_HZ (200000000) /* M0CLK 200000000Hz */
#define BSP_CFG_CLOCK_M2CLK_HZ (266500000) /* M2CLK 266500000Hz */
#define BSP_CFG_CLOCK_M3CLK_HZ (3000000000) /* M3CLK 3000000000Hz */
#define BSP_CFG_CLOCK_HPCLK_HZ (250000000) /* HPCLK 250000000Hz */
#define BSP_CFG_CLOCK_TSUCLK_HZ (80000000) /* TSUCLK 80000000Hz */
#define BSP_CFG_CLOCK_ZTCLK_HZ (100000000) /* ZTCLK 100000000Hz */
#define BSP_CFG_CLOCK_P0CLK_HZ (100000000) /* P0CLK 100000000Hz */
#define BSP_CFG_CLOCK_P1CLK_HZ (200000000) /* P1CLK 200000000Hz */
#define BSP_CFG_CLOCK_P2CLK_HZ (100000000) /* P2CLK 100000000Hz */
#define BSP_CFG_CLOCK_ATCLK_HZ (400000000) /* ATCLK 400000000Hz */
#endif /* BSP_CLOCK_CFG_H_ */
@@ -0,0 +1,49 @@
/* generated common source file - do not edit */
#include "common_data.h"
/** IOPORT interface configuration for event link **/
ioport_event_group_output_t g_port_group_output_cfg[] = {
{
.pin_select = (uint8_t)(uintptr_t)NULL,
.operation = (ioport_event_output_operation_t)NULL
},
};
ioport_event_group_input_t g_port_group_input_cfg[] = {
{
.event_control = (ioport_event_control_t)NULL,
.edge_detection = (ioport_event_detection_t)NULL,
.overwrite_control = (ioport_event_control_t)NULL,
.pin_select = (uintptr_t)NULL,
.buffer_init_value = (uintptr_t)NULL
},
};
ioport_event_single_t g_single_port_cfg[] = {
{
.event_control = (ioport_event_control_t)NULL,
.direction = (ioport_event_direction_t)NULL,
.port_num = (uintptr_t)NULL,
.operation = (ioport_event_output_operation_t)NULL,
.edge_detection = (ioport_event_detection_t)NULL},
};
const ioport_extend_cfg_t g_ioport_cfg_extend =
{
.p_port_group_output_cfg = &g_port_group_output_cfg[0],
.p_port_group_input_cfg = &g_port_group_input_cfg[0],
.p_single_port_cfg = &g_single_port_cfg[0]
};
ioport_instance_ctrl_t g_ioport_ctrl;
const ioport_instance_t g_ioport =
{
.p_api = &g_ioport_on_ioport,
.p_ctrl = &g_ioport_ctrl,
.p_cfg = &g_bsp_pin_cfg,
};
void g_common_init(void)
{
}
@@ -0,0 +1,17 @@
/* generated common header file - do not edit */
#ifndef COMMON_DATA_H_
#define COMMON_DATA_H_
#include <stdint.h>
#include "bsp_api.h"
#include "r_ioport.h"
#include "bsp_pin_cfg.h"
FSP_HEADER
/* IOPORT Instance */
extern const ioport_instance_t g_ioport;
/* IOPORT control structure. */
extern ioport_instance_ctrl_t g_ioport_ctrl;
void g_common_init(void);
FSP_FOOTER
#endif /* COMMON_DATA_H_ */
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2021, Renesas Electronics Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the names of the copyright holders nor the names of any
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#include <stdarg.h>
typedef enum {
CONSOLE_RAW,
CONSOLE_BUFFERED,
CONSOLE_CONVERSION
} console_t;
int printf_raw(const char *format, ...);
int sprintf(char* buffer,const char *format, ...);
signed char scanf_raw(char *data);
#endif /* __CONSOLE_H__ */
@@ -0,0 +1,8 @@
/* generated main source file - do not edit */
#include "hal_data.h"
int fsp_main(void)
{
hal_entry ();
return 0;
}
@@ -0,0 +1,136 @@
/* generated HAL source file - do not edit */
#include "hal_data.h"
#define FSP_NOT_DEFINED (UINT32_MAX)
#if (FSP_NOT_DEFINED) != (FSP_NOT_DEFINED)
/* If the transfer module is DMAC, define a DMAC transfer callback. */
#include "r_dmac_b.h"
extern void scif_uart_tx_dmac_callback(scif_uart_instance_ctrl_t const *const p_ctrl);
void g_uart0_tx_transfer_callback(dmac_b_callback_args_t *p_args)
{
FSP_PARAMETER_NOT_USED(p_args);
scif_uart_tx_dmac_callback(&g_uart0_ctrl);
}
#endif
#if (FSP_NOT_DEFINED) != (FSP_NOT_DEFINED)
/* If the transfer module is DMAC, define a DMAC transfer callback. */
#include "r_dmac_b.h"
extern void scif_uart_rx_dmac_callback(scif_uart_instance_ctrl_t const *const p_ctrl);
void g_uart0_rx_transfer_callback(dmac_b_callback_args_t *p_args)
{
FSP_PARAMETER_NOT_USED(p_args);
scif_uart_rx_dmac_callback(&g_uart0_ctrl);
}
#endif
#undef FSP_NOT_DEFINED
scif_uart_instance_ctrl_t g_uart2_ctrl;
scif_baud_setting_t g_uart2_baud_setting = {
/* Baud rate calculated with 0.469% error. */
.semr_baudrate_bits_b.abcs = 0,
.semr_baudrate_bits_b.bgdm = 1,
.semr_baudrate_bits_b.cks = 0,
.brr = 53,
.mddr = (uint8_t)256,
.semr_baudrate_bits_b.brme = false
};
/** UART extended configuration for UARTonSCIF HAL driver */
const scif_uart_extended_cfg_t g_uart2_cfg_extend = {
.bri_ipl = 14,
.bri_irq = SCIF2_BRK_IRQn,
.clock = SCIF_UART_CLOCK_INT,
.noise_cancel = SCIF_UART_NOISE_CANCELLATION_DISABLE,
.p_baud_setting = &g_uart2_baud_setting,
.rx_fifo_trigger = SCIF_UART_RECEIVE_TRIGGER_MAX,
.rts_fifo_trigger = SCIF_UART_RTS_TRIGGER_14,
.uart_mode = SCIF_UART_MODE_RS232,
.flow_control = SCIF_UART_FLOW_CONTROL_NONE,
.rs485_setting = {
.enable = (sci_uart_rs485_enable_t)NULL,
.polarity = SCI_UART_RS485_DE_POLARITY_HIGH,
.de_control_pin = (bsp_io_port_pin_t)SCIF_UART_INVALID_16BIT_PARAM,
},
};
/** UART interface configuration */
const uart_cfg_t g_uart2_cfg = {
.channel = 2,
.data_bits = UART_DATA_BITS_8,
.parity = UART_PARITY_OFF,
.stop_bits = UART_STOP_BITS_1,
.p_callback = NULL,
.p_context = NULL,
.p_extend = &g_uart2_cfg_extend,
.p_transfer_tx = g_uart0_P_TRANSFER_TX,
.p_transfer_rx = g_uart0_P_TRANSFER_RX,
.rxi_ipl = 14,
.txi_ipl = 14,
.tei_ipl = 14,
.eri_ipl = 14,
.rxi_irq = SCIF2_RXI_IRQn,
.txi_irq = SCIF2_TXI_IRQn,
.tei_irq = SCIF2_TEI_DRI_IRQn,
.eri_irq = SCIF2_RERR_IRQn,
};
/* Instance structure to use this module. */
const uart_instance_t g_uart2 = {
.p_ctrl = &g_uart2_ctrl,
.p_cfg = &g_uart2_cfg,
.p_api = &g_uart_on_scif
};
mhu_ns_instance_ctrl_t g_mhu_ns0_ctrl;
const mhu_cfg_t g_mhu_ns0_cfg = {
.channel = 1,
.rx_ipl = 12,
.rx_irq = MHU1_NS_IRQn,
.p_callback = NULL,
.p_shared_memory = 0,
.p_context = NULL,
};
/* Instance structure to use this module. */
const mhu_instance_t g_mhu_ns0 = {
.p_ctrl = &g_mhu_ns0_ctrl,
.p_cfg = &g_mhu_ns0_cfg,
.p_api = &g_mhu_ns_on_mhu_ns
};
gtm_instance_ctrl_t g_timer2_ctrl;
const gtm_extended_cfg_t g_timer2_extend = {
.generate_interrupt_when_starts = GTM_GIWS_TYPE_DISABLED,
.gtm_mode = GTM_TIMER_MODE_INTERVAL,
};
const timer_cfg_t g_timer2_cfg = {
.mode = TIMER_MODE_PERIODIC,
.period_counts = (uint32_t)0x1869f /* Actual period: 0.001 seconds. */,
.channel = 2,
.p_callback = NULL,
.p_context = NULL,
.cycle_end_ipl = 255,
.p_extend = &g_timer2_extend,
#if defined(VECTOR_NUMBER_GTM2_COUNTER_OVERFLOW)
.cycle_end_irq = VECTOR_NUMBER_GTM2_COUNTER_OVERFLOW,
#else
.cycle_end_irq = GTM2_OSTM2INT_IRQn,
#endif
};
/* Instance structure to use this module. */
const timer_instance_t g_timer2 = {
.p_ctrl = &g_timer2_ctrl,
.p_cfg = &g_timer2_cfg,
.p_api = &g_timer_on_gtm
};
void g_hal_init(void)
{
g_common_init();
}
@@ -0,0 +1,57 @@
/* generated HAL header file - do not edit */
#ifndef HAL_DATA_H_
#define HAL_DATA_H_
#include <stdint.h>
#include "bsp_api.h"
#include "common_data.h"
#include "r_uart_api.h"
#include "r_scif_uart.h"
#include "r_mhu_ns.h"
#include "r_gtm.h"
#include "r_timer_api.h"
FSP_HEADER
/** UART on SCIF Instance. */
extern const uart_instance_t g_uart2;
/** Access the UART instance using these structures when calling API functions directly (::p_api is not used). */
extern scif_uart_instance_ctrl_t g_uart2_ctrl;
extern const uart_cfg_t g_uart2_cfg;
extern const scif_uart_extended_cfg_t g_uart2_cfg_extend;
#ifndef NULL
void NULL(uart_callback_args_t *p_args);
#endif
#define FSP_NOT_DEFINED (1)
#if (FSP_NOT_DEFINED == FSP_NOT_DEFINED)
#define g_uart0_P_TRANSFER_TX (NULL)
#else
#define g_uart0_P_TRANSFER_TX (&FSP_NOT_DEFINED)
#endif
#if (FSP_NOT_DEFINED == FSP_NOT_DEFINED)
#define g_uart0_P_TRANSFER_RX (NULL)
#else
#define g_uart0_P_TRANSFER_RX (&FSP_NOT_DEFINED)
#endif
#undef FSP_NOT_DEFINED
/** MHU Instance */
extern const mhu_instance_t g_mhu_ns0;
/** Access the MHU instance using these structures when calling API functions directly (::p_api is not used). */
extern mhu_ns_instance_ctrl_t g_mhu_ns0_ctrl;
extern const mhu_cfg_t g_mhu_ns0_cfg;
#ifndef NULL
void NULL(mhu_callback_args_t *p_args);
#endif
/** GTM Timer Instance */
extern const timer_instance_t g_timer2;
/** Access the GTM instance using these structures when calling API functions directly (::p_api is not used). */
extern gtm_instance_ctrl_t g_timer2_ctrl;
extern const timer_cfg_t g_timer2_cfg;
void hal_entry(void);
void g_hal_init(void);
FSP_FOOTER
#endif /* HAL_DATA_H_ */
@@ -0,0 +1,824 @@
/* mbed Microcontroller Library
* Copyright (c) 2017-2020 ARM Limited
* Copyright (c) 2021 Renesas Electronics Corporation
* SPDX-License-Identifier: Apache-2.0
*
* Licensed 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.
*/
/*
* Modified by Renesas so functions pass a context down to outbyte().
* outbyte() is implemented elsewhere so that it can pass a context that our
* serial output function. This is all done to allow us to create a printf_raw()
* function that outputs immediately to the UART for emergency output such as an
* abort.
*/
#include <stdbool.h>
#include <limits.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "console.h"
#include "hal_data.h"
#include <arch_interrupt.h>
#if !TARGET_LIKE_MBED
/* Linux implementation is for debug only */
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT 1
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS 6
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT 1
#endif
#ifndef MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT 0
#endif
#ifndef MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS 6
#endif
#ifndef MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT 1
#endif
/**
* Check architecture and choose storage data type.
* On 32 bit machines, the default storage type is 32 bit wide
* unless 64 bit integers are enabled in the configuration.
*/
#if INTPTR_MAX == INT32_MAX
#define MBED_SIGNED_NATIVE_TYPE int32_t
#define MBED_UNSIGNED_NATIVE_TYPE uint32_t
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT
#define MBED_SIGNED_STORAGE int64_t
#define MBED_UNSIGNED_STORAGE uint64_t
#else
#define MBED_SIGNED_STORAGE int32_t
#define MBED_UNSIGNED_STORAGE uint32_t
#endif
#elif INTPTR_MAX == INT64_MAX
#define MBED_SIGNED_NATIVE_TYPE int64_t
#define MBED_UNSIGNED_NATIVE_TYPE uint64_t
#define MBED_SIGNED_STORAGE int64_t
#define MBED_UNSIGNED_STORAGE uint64_t
#else
#error unsupported architecture
#endif
/**
* Precision defines
*/
#define PRECISION_DEFAULT (INT_MAX)
/**
* max data number of fifi data reg
*/
static const uint32_t SCIF_UART_TX_FIFO_STAGES = 16;
/**
* Enum for storing width modifier.
*/
typedef enum {
LENGTH_NONE = 0x00,
LENGTH_H = 0x11,
LENGTH_L = 0x21,
LENGTH_J = 0x31,
LENGTH_Z = 0x41,
LENGTH_T = 0x51,
LENGTH_CAPITAL_L = 0x61,
LENGTH_HH = 0x72,
LENGTH_LL = 0x82
} length_t;
/**
* Enum for integer printing type
*/
typedef enum {
INT_UNSIGNED,
INT_SIGNED,
HEX_LOWER,
HEX_UPPER,
ZERO_NEGATIVE /* special case when printing integer part of double values where it is 0 and the value is negative */
} integer_type_t;
/**
* Prototypes
*/
static void mbed_minimal_formatted_string_integer(char *buffer, size_t length, int *result, MBED_UNSIGNED_STORAGE value, integer_type_t type, int width_size, bool prepend_zeros, console_t console);
static void mbed_minimal_formatted_string_void_pointer(char *buffer, size_t length, int *result, const void *value, console_t console);
static void mbed_minimal_formatted_string_string(char *buffer, size_t length, int *result, const char *string, size_t precision, console_t console);
/**
* @brief Print a single character, checking for buffer and size overflows.
*
* @param buffer The buffer to store output (NULL for stdout).
* @param[in] length The length of the buffer.
* @param result The current output location.
* @param[in] data The char to be printed.
* @param[in] console The method of char data control.
*/
static void mbed_minimal_putchar(char *buffer, size_t length, int *result, char data, console_t console)
{
/* only continue if 'result' doesn't overflow */
if ((*result >= 0) && (*result <= INT_MAX - 1)) {
if ((CONSOLE_RAW == console) || (CONSOLE_BUFFERED == console)) {
outbyte(console, data);
*result += 1;
} else {
if (buffer) {
/* write data only if there's enough space */
if ((size_t)*result < length) {
buffer[*result] = data;
}
}
/* increment 'result' even if data was not written. This ensures that
'mbed_minimal_formatted_string' returns the correct value. */
*result += 1;
}
}
}
/**
* @brief Print integer in signed, unsigned or hexadecimal format.
*
* @param buffer The buffer to store output (NULL for stdout).
* @param[in] length The length of the buffer.
* @param result The current output location.
* @param[in] value The value to be printed.
* @param type The type of integer format that shall be printed (signed, unsigend or hexadecimal)
* @param width_size The width modifier.
* @param prepend_zeros Flag to prepends zeros when the width_size is greater than 0
* @param[in] console The method of char data control.
*/
static void mbed_minimal_formatted_string_integer(char *buffer, size_t length, int *result, MBED_UNSIGNED_STORAGE value, integer_type_t type, int width_size, bool prepend_zeros, console_t console)
{
/* allocate 3 digits per byte */
char scratch[sizeof(MBED_UNSIGNED_STORAGE) * 3] = { 0 };
int index = 0;
bool negative_value = false;
const char filler = prepend_zeros ? '0' : ' ';
if (type == INT_SIGNED) {
if ((MBED_SIGNED_STORAGE) value < 0) {
/* get absolute value using two's complement */
value = ~value + 1;
negative_value = true;
}
} else if (type == ZERO_NEGATIVE) {
negative_value = true;
}
if (value == 0) {
scratch[index] = '0';
index++;
} else {
/* write numbers in reverse order to scratch pad */
for (; value > 0; index++) {
if (type == HEX_LOWER || type == HEX_UPPER) {
/* get least significant byte */
const uint8_t output = value & 0x0F;
static const char int2hex_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
static const char int2hex_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
if (type == HEX_LOWER) {
scratch[index] = int2hex_lower[output];
} else {
scratch[index] = int2hex_upper[output];
}
/* shift value one byte position */
value = value >> 4;
} else {
/* use '0' as base and add digit */
scratch[index] = '0' + (value % 10);
/* shift value one decimal position */
value = value / 10;
}
}
}
if (negative_value) {
if (prepend_zeros) {
mbed_minimal_putchar(buffer, length, result, '-', console);
}
index++; // add one to index to count '-'
}
// print filler characters
if (width_size > index) {
for (int i = width_size; i > index; i--) {
mbed_minimal_putchar(buffer, length, result, filler, console);
}
}
if (negative_value) {
if (!prepend_zeros) {
mbed_minimal_putchar(buffer, length, result, '-', console);
}
index--; // Restore index to correct position
}
/* print absolute value of integer */
for (; index > 0; index--) {
mbed_minimal_putchar(buffer, length, result, scratch[index - 1], console);
}
}
/**
* @brief Print pointer.
*
* @param buffer The buffer to store output (NULL for stdout).
* @param[in] length The length of the buffer.
* @param result The current output location.
* @param[in] value The pointer to be printed.
* @param[in] console The method of char data control.
*/
static void mbed_minimal_formatted_string_void_pointer(char *buffer, size_t length, int *result, const void *value, console_t console)
{
/* write leading 0x */
mbed_minimal_putchar(buffer, length, result, '0', console);
mbed_minimal_putchar(buffer, length, result, 'x', console);
/* write rest as a regular hexadecimal number */
mbed_minimal_formatted_string_integer(buffer, length, result, (ptrdiff_t) value, HEX_UPPER, 0, false, console);
}
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
/**
* @brief Write double.
*
* @param buffer The buffer to store output (NULL for stdout).
* @param[in] length The length of the buffer.
* @param result The current output location.
* @param[in] value The value to be printed.
* @param[in] dec_precision The decimal precision. If PRECISION_DEFAULT MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS is used.
* @param width_size The width modifier.
* @param prepend_zeros Flag to prepends zeros when the width_size is greater than 0
* @param[in] console The method of char data control.
*/
static void mbed_minimal_formatted_string_double(char *buffer, size_t length, int *result, double value, int dec_precision, int width_size, bool prepend_zeros, console_t console)
{
/* get integer part */
MBED_SIGNED_STORAGE integer = value;
if (dec_precision == PRECISION_DEFAULT) {
dec_precision = MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS;
}
if (dec_precision != 0) {
width_size -= dec_precision + 1; // decimal precision plus '.'
if (width_size < 0) {
width_size = 0;
}
} else {
value = (value - integer) * 1.0;
if (!((value > -0.5) && (value < 0.5))) {
integer++;
}
}
/* write integer part */
if (integer == 0 && value < 0) {
mbed_minimal_formatted_string_integer(buffer, length, result, integer, ZERO_NEGATIVE, width_size, prepend_zeros, console);
} else {
mbed_minimal_formatted_string_integer(buffer, length, result, integer, INT_SIGNED, width_size, prepend_zeros, console);
}
if (dec_precision != 0) {
/* write decimal point */
mbed_minimal_putchar(buffer, length, result, '.', console);
/* get decimal part */
double precision = 1.0;
for (size_t index = 0; index < dec_precision; index++) {
precision *= 10;
}
/* convert to positive number */
if (value < 0.0) {
value *= -1.0;
}
MBED_UNSIGNED_STORAGE decimal = value;
/* round up or down */
value -= decimal;
if (!((value > -0.5) && (value < 0.5))) {
decimal++;
}
/* write decimal part */
mbed_minimal_formatted_string_integer(buffer, length, result, decimal, INT_UNSIGNED, dec_precision, true, console);
}
}
#endif
/**
* @brief Print string with precision.
*
* @param buffer The buffer to store output (NULL for stdout).
* @param[in] length The length of the buffer.
* @param result The current output location.
* @param[in] value The string to be printed.
* @param[in] precision The maximum number of characters to be printed.
* @param[in] console The method of char data control.
*/
static void mbed_minimal_formatted_string_string(char *buffer, size_t length, int *result, const char *string, size_t precision, console_t console)
{
while ((*string != '\0') && (precision)) {
mbed_minimal_putchar(buffer, length, result, *string, console);
string++;
precision--;
}
}
/**
* @brief Parse a string to an integer value as long as there are numerical characters in the string
*
* @param[in] string The input string. Has to begin with a numerical character to parse
* @param[out] value The output value.
* @return size_t The number of numerical characters parsed
*/
static size_t parse_string_to_integer(const char *string, int *value)
{
size_t inner_index = 0;
while ((string[inner_index] >= '0') && (string[inner_index] <= '9')) {
*value = *value * 10 + (string[inner_index] - '0');
inner_index++;
}
return inner_index;
}
/**
* @brief Parse formatted string and invoke write handlers based on type.
*
* @param buffer The buffer to write to, write to stdout if NULL.
* @param[in] length The length of the buffer.
* @param[in] format The formatted string.
* @param[in] arguments The va_list arguments.
* @param[in] console The method of char data control.
*
* @return Number of characters written.
*/
int mbed_minimal_formatted_string(char *buffer, size_t length, const char *format, va_list arguments, console_t console)
{
int result = 0;
bool empty_buffer = false;
/* ensure that function wasn't called with an empty buffer, or with or with
a buffer size that is larger than the maximum 'int' value, or with
a NULL format specifier */
if (format && length <= INT_MAX) {
/* Make sure that there's always space for the NULL terminator */
if (length > 0) {
length --;
} else {
/* the buffer is empty, there's no place to write the terminator */
empty_buffer = true;
}
/* parse string */
for (size_t index = 0; format[index] != '\0'; index++) {
/* format specifier begin */
if (format[index] == '%') {
size_t next_index = index + 1;
/**************************************************************
* skip and ignore flags [-+(space)#]
*************************************************************/
if ((format[next_index] == '-') ||
(format[next_index] == '+') ||
(format[next_index] == ' ') ||
(format[next_index] == '#')) {
/* skip to next character */
next_index++;
}
/**************************************************************
* look for width and prepending zeros [(number)], skip [*]
*************************************************************/
bool prepend_zeros = false;
int width_size = 0;
if (format[next_index] == '*') {
/* skip to next character */
next_index++;
/* discard argument */
va_arg(arguments, MBED_SIGNED_NATIVE_TYPE);
} else {
if (format[next_index] == '0') {
prepend_zeros = true;
do {
next_index++;
} while (format[next_index] == '0');
}
/* parse width modifier until not a decimal */
next_index += parse_string_to_integer(&format[next_index], &width_size);
}
/**************************************************************
* look for precision modifier
*************************************************************/
int precision = PRECISION_DEFAULT;
if ((format[next_index] == '.') &&
(format[next_index + 1] == '*')) {
next_index += 2;
/* read precision from argument list */
precision = va_arg(arguments, MBED_SIGNED_NATIVE_TYPE);
} else if (format[next_index] == '.') {
/* precision modifier found, reset default to 0 and increment index */
next_index++;
precision = 0;
/* parse precision until not a decimal */
next_index += parse_string_to_integer(&format[next_index], &precision);
}
/**************************************************************
* look for length modifier, default to NONE
*************************************************************/
length_t length_modifier = LENGTH_NONE;
/* look for two character length modifier */
if ((format[next_index] == 'h') && (format[next_index + 1] == 'h')) {
length_modifier = LENGTH_HH;
} else if ((format[next_index] == 'l') && (format[next_index + 1] == 'l')) {
length_modifier = LENGTH_LL;
}
/* look for one character length modifier if two character search failed */
else if (format[next_index] == 'h') {
length_modifier = LENGTH_H;
} else if (format[next_index] == 'l') {
length_modifier = LENGTH_L;
} else if (format[next_index] == 'j') {
length_modifier = LENGTH_J;
} else if (format[next_index] == 'z') {
length_modifier = LENGTH_Z;
} else if (format[next_index] == 't') {
length_modifier = LENGTH_T;
} else if (format[next_index] == 'L') {
length_modifier = LENGTH_CAPITAL_L;
}
/* increment index, length is encoded in modifier enum */
next_index += (length_modifier & 0x0F);
/**************************************************************
* read out character - this is a supported format character,
* '\0', or a not suported character
*************************************************************/
char next = format[next_index];
/* signed integer */
if ((next == 'd') || (next == 'i')) {
MBED_SIGNED_STORAGE value = 0;
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT
/* if 64 bit is enabled and the integer types are larger than the native type */
if (((length_modifier == LENGTH_LL) && (sizeof(long long int) > sizeof(MBED_SIGNED_NATIVE_TYPE))) ||
((length_modifier == LENGTH_L) && (sizeof(long int) > sizeof(MBED_SIGNED_NATIVE_TYPE))) ||
((length_modifier == LENGTH_NONE) && (sizeof(int) > sizeof(MBED_SIGNED_NATIVE_TYPE)))) {
/* use 64 bit storage type for readout */
value = va_arg(arguments, MBED_SIGNED_STORAGE);
} else
#else
/* If 64 bit is not enabled, print %ll[di] rather than truncated value */
if (length_modifier == LENGTH_LL) {
mbed_minimal_putchar(buffer, length, &result, '%', console);
if (next == '%') {
// Continue printing loop after `%`
index = next_index;
}
continue;
}
#endif
{
/* use native storage type (which can be 32 or 64 bit) */
value = va_arg(arguments, MBED_SIGNED_NATIVE_TYPE);
}
/* constrict value based on length modifier */
switch (length_modifier) {
case LENGTH_NONE:
value = (int) value;
break;
case LENGTH_HH:
value = (signed char) value;
break;
case LENGTH_H:
value = (short int) value;
break;
case LENGTH_L:
value = (long int) value;
break;
case LENGTH_LL:
value = (long long int) value;
break;
case LENGTH_J:
value = (intmax_t) value;
break;
case LENGTH_T:
value = (ptrdiff_t) value;
break;
default:
break;
}
index = next_index;
mbed_minimal_formatted_string_integer(buffer, length, &result, value, INT_SIGNED, width_size, prepend_zeros, console);
}
/* unsigned integer */
else if ((next == 'u') || (next == 'x') || (next == 'X')) {
MBED_UNSIGNED_STORAGE value = 0;
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT
/* if 64 bit is enabled and the integer types are larger than the native type */
if (((length_modifier == LENGTH_LL) && (sizeof(unsigned long long int) > sizeof(MBED_UNSIGNED_NATIVE_TYPE))) ||
((length_modifier == LENGTH_L) && (sizeof(unsigned long int) > sizeof(MBED_UNSIGNED_NATIVE_TYPE))) ||
((length_modifier == LENGTH_NONE) && (sizeof(unsigned int) > sizeof(MBED_UNSIGNED_NATIVE_TYPE)))) {
/* use 64 bit storage type for readout */
value = va_arg(arguments, MBED_UNSIGNED_STORAGE);
} else
#else
/* If 64 bit is not enabled, print %ll[uxX] rather than truncated value */
if (length_modifier == LENGTH_LL) {
mbed_minimal_putchar(buffer, length, &result, '%', console);
if (next == '%') {
// Continue printing loop after `%`
index = next_index;
}
continue;
}
#endif
{
/* use native storage type (which can be 32 or 64 bit) */
value = va_arg(arguments, MBED_UNSIGNED_NATIVE_TYPE);
}
/* constrict value based on length modifier */
switch (length_modifier) {
case LENGTH_NONE:
value = (unsigned int) value;
break;
case LENGTH_HH:
value = (unsigned char) value;
break;
case LENGTH_H:
value = (unsigned short int) value;
break;
case LENGTH_L:
value = (unsigned long int) value;
break;
case LENGTH_LL:
value = (unsigned long long int) value;
break;
case LENGTH_J:
value = (uintmax_t) value;
break;
case LENGTH_Z:
value = (size_t) value;
break;
case LENGTH_T:
value = (ptrdiff_t) value;
break;
default:
break;
}
index = next_index;
/* write unsigned or hexadecimal */
if (next == 'u') {
mbed_minimal_formatted_string_integer(buffer, length, &result, value, INT_UNSIGNED, width_size, prepend_zeros, console);
} else if (next == 'X') {
mbed_minimal_formatted_string_integer(buffer, length, &result, value, HEX_UPPER, width_size, prepend_zeros, console);
} else {
mbed_minimal_formatted_string_integer(buffer, length, &result, value, HEX_LOWER, width_size, prepend_zeros, console);
}
}
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
/* treat all floating points the same */
else if ((next == 'f') || (next == 'F') || (next == 'g') || (next == 'G')) {
double value = va_arg(arguments, double);
index = next_index;
mbed_minimal_formatted_string_double(buffer, length, &result, value, precision, width_size, prepend_zeros, console);
}
#endif
/* character */
else if (next == 'c') {
char value = va_arg(arguments, MBED_SIGNED_NATIVE_TYPE);
index = next_index;
mbed_minimal_putchar(buffer, length, &result, value, console);
}
/* string */
else if (next == 's') {
char *value = va_arg(arguments, char *);
index = next_index;
mbed_minimal_formatted_string_string(buffer, length, &result, value, precision, console);
}
/* pointer */
else if (next == 'p') {
void *value = va_arg(arguments, void *);
index = next_index;
mbed_minimal_formatted_string_void_pointer(buffer, length, &result, value, console);
} else {
// Unrecognised, or `%%`. Print the `%` that led us in.
mbed_minimal_putchar(buffer, length, &result, '%', console);
if (next == '%') {
// Continue printing loop after `%%`
index = next_index;
}
// Otherwise we continue the printing loop after the leading `%`, so an
// unrecognised thing like "Blah = %a" will just come out as "Blah = %a"
}
} else
/* not a format specifier */
{
/* write normal character */
mbed_minimal_putchar(buffer, length, &result, format[index], console);
}
}
if (buffer && !empty_buffer) {
/* NULL-terminate the buffer no matter what. We use '<=' to compare instead of '<'
because we know that we initially reserved space for '\0' by decrementing length */
if ((size_t)result <= length) {
buffer[result] = '\0';
} else {
buffer[length] = '\0';
}
}
}
return result;
}
static uint32_t xSerialPortInitialized = 0;
static uint32_t rx_data_full = 0;
static void uart_callback(uart_callback_args_t *const p_arg)
{
if (p_arg->event & UART_EVENT_RX_COMPLETE)
{
rx_data_full = 1;
}
if (p_arg->event & UART_EVENT_TX_COMPLETE)
{
__NOP();
}
if (p_arg->event & UART_EVENT_RX_CHAR)
{
__NOP();
}
if (p_arg->event & UART_EVENT_ERR_PARITY)
{
__NOP();
}
if (p_arg->event & UART_EVENT_ERR_FRAMING)
{
__NOP();
}
if (p_arg->event & UART_EVENT_ERR_OVERFLOW)
{
__NOP();
}
if (p_arg->event & UART_EVENT_BREAK_DETECT)
{
__NOP();
}
if (p_arg->event & UART_EVENT_TX_DATA_EMPTY)
{
__NOP();
}
}
static void outbyte1(console_t console, char c)
{
scif_uart_instance_ctrl_t * p_ctrl = (scif_uart_instance_ctrl_t *)g_uart2.p_ctrl;
uint32_t no_send_data_count = 0;
while (1)
{
// 获取还未发送的数据数量
no_send_data_count = (uint32_t) p_ctrl->p_reg->FDR_b.T;
// 还存在可以发送数据的空间
if (no_send_data_count < SCIF_UART_TX_FIFO_STAGES)
{
p_ctrl->p_reg->FTDR = c;
break;
}
}
}
signed char scanf_raw(char *data)
{
if (!xSerialPortInitialized)
{
g_uart2.p_api->open(g_uart2.p_ctrl, g_uart2.p_cfg);
g_uart2.p_api->callbackSet(g_uart2.p_ctrl, uart_callback, NULL, NULL);
xSerialPortInitialized = 1;
}
rx_data_full = 0;
g_uart2.p_api->read(g_uart2.p_ctrl, data, 1);
while (rx_data_full == 0)
{
__WFI();
}
return 1;
}
void outbyte(console_t console, char c)
{
if (!xSerialPortInitialized)
{
g_uart2.p_api->open(g_uart2.p_ctrl, g_uart2.p_cfg);
g_uart2.p_api->callbackSet(g_uart2.p_ctrl, uart_callback, NULL, NULL);
xSerialPortInitialized = 1;
}
/* Standard practice to convert \n to \r\n */
if (c == '\n')
outbyte1(console, '\r');
outbyte1(console, c);
}
int printf_raw(const char *format, ...)
{
console_t console = CONSOLE_RAW;
va_list args;
int ret;
va_start(args, format);
ret = mbed_minimal_formatted_string(NULL, LONG_MAX, format, args, console);
va_end(args);
return ret;
}
int sprintf(char *buffer, const char *format, ...)
{
console_t console = CONSOLE_RAW;
va_list args;
int ret;
va_start(args, format);
ret = mbed_minimal_formatted_string(buffer, LONG_MAX, format, args, console);
va_end(args);
return ret;
}
int snprintf(char *buffer, size_t length, const char *format, ...)
{
console_t console = CONSOLE_RAW;
va_list args;
int ret;
va_start(args, format);
ret = mbed_minimal_formatted_string(buffer, length, format, args, console);
va_end(args);
return ret;
}
@@ -0,0 +1,79 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/**
* @file OpenAMP_RPMsg_cfg.h
* @brief OpenAMP configurations
* @date 2020.10.21
* @author Copyright (c) 2020, eForce Co., Ltd. All rights reserved.
*
****************************************************************************
* @par History
* - rev 1.0 (2020.10.21) Imada
* Initial version for RZ/G2.
****************************************************************************
*/
#ifndef OPENAMP_RPMSG_CFG_H_
#define OPENAMP_RPMSG_CFG_H_
// RPMSG config
#define APP_EPT_ADDR (0x0U)
// Memory region reserved between 0x43000000 - 0x437FFFFF for RPMSG
#define RPMSG_MEM_BASE (0x43000000U)
#define RPMSG_MEM_SIZE (0x00800000U)
#define VRING_SIZE (0x100000U)
#define VRING_SHM_SIZE (0x300000U)
#define CFG_RPMSG_SVCNO (0x2U)
// RPMSG channel #0
#define CFG_RPMSG_SVC_NAME0 "rpmsg-service-0"
#define CFG_VRING0_BASE0_PA (0x43000000U)
#define CFG_VRING0_BASE0_VA (0x63000000U)
#define CFG_VRING1_BASE0_PA (0x43050000U)
#define CFG_VRING1_BASE0_VA (0x63050000U)
#define CFG_VRING_SIZE0 (VRING_SIZE)
#define CFG_VRING_ALIGN0 (0x100U)
#define CFG_RPMSG_NUM_BUFS0 (512U)
#define CFG_VRING_SHM_BASE0_PA (0x43200000U)
#define CFG_VRING_SHM_BASE0_VA (0x63200000U)
#define CFG_VRING_SHM_SIZE0 (VRING_SHM_SIZE)
#define CFG_VRING_CTL_NAME0 "43000000.vring-ctl0"
#define CFG_VRING_SHM_NAME0 "43200000.vring-shm0"
#define VRING_NOTIFYID0 (0U)
// RPMSG channel #1
#define CFG_RPMSG_SVC_NAME1 "rpmsg-service-1"
#define CFG_VRING0_BASE1_PA (0x43100000U)
#define CFG_VRING0_BASE1_VA (0x63100000U)
#define CFG_VRING1_BASE1_PA (0x43150000U)
#define CFG_VRING1_BASE1_VA (0x63150000U)
#define CFG_VRING_SIZE1 (VRING_SIZE)
#define CFG_VRING_ALIGN1 (0x100U)
#define CFG_RPMSG_NUM_BUFS1 (512U)
#define CFG_VRING_SHM_BASE1_PA (0x43500000U)
#define CFG_VRING_SHM_BASE1_VA (0x63500000U)
#define CFG_VRING_SHM_SIZE1 (VRING_SHM_SIZE)
#define CFG_VRING_CTL_NAME1 "43100000.vring-ctl1"
#define CFG_VRING_SHM_NAME1 "43500000.vring-shm1"
#define VRING_NOTIFYID1 (1U)
#endif /* OPENAMP_RPMSG_CFG_H_ */
@@ -0,0 +1,420 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/*
* Copyright (c) 2014, Mentor Graphics Corporation
* All rights reserved.
* Copyright (c) 2017 Xilinx, Inc.
* Copyright (c) 2020, eForce Co., Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**************************************************************************
* FILE NAME
*
* platform_info.c
*
* DESCRIPTION
*
* This file define platform specific data and implements APIs to set
* platform specific information for OpenAMP.
*
* @par History
* - rev 1.0 (2020.10.21) Imada
* Initial version.
*
**************************************************************************/
#include <metal/atomic.h>
#include <metal/assert.h>
#include <metal/device.h>
#include <metal/irq.h>
#include <metal/utilities.h>
#include <openamp/rpmsg_virtio.h>
#include "platform_info.h"
#include "rsc_table.h"
#include <metal/sys.h>
#include <sys/errno.h>
static int32 ipi_tsk_id[CFG_RPMSG_SVCNO] = {-1, -1};
/* IPI(MBX) information */
struct ipi_info ipi =
{
MBX_DEV_NAME, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
MBX_INT_NUM, // irq_info
0, // registered
{0, 0 }, // mbx_chn (not used on this SoC)
0, // chn_mask (not used on this SoC)
{-1, -1}, // ipi_mutx_id
};
/* vring information */
struct vring_info vrinfo[CFG_RPMSG_SVCNO] =
{
{ // vinfo[0]
{ // rsc
CFG_RSCTBL_DEV_NAME, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
{ // ctl
CFG_VRING_CTL_NAME0, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
{ // shm
CFG_VRING_SHM_NAME0, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
},
{ // vinfo[1]
{ // rsc
CFG_RSCTBL_DEV_NAME, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
{ // ctl
CFG_VRING_CTL_NAME1, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
{ // shm
CFG_VRING_SHM_NAME1, // name
DEV_BUS_NAME, // bus_name
NULL, // dev
NULL, // io
{0}, // mem
},
},
};
/* processor operations at RZ/G2. It defines
* notification operation and remote processor managementi operations. */
extern struct remoteproc_ops rzg2_proc_ops;
/* RPMsg virtio shared buffer pool */
static struct rpmsg_virtio_shm_pool shpool;
static void start_ipi_task(void * platform);
static struct remoteproc * platform_create_proc (int proc_index, int rsc_index)
{
void * rsc_table;
unsigned int rsc_size;
int ret;
struct remoteproc * rproc_inst;
struct remoteproc_priv * rproc_priv;
#ifdef __linux__
metal_phys_addr_t pa;
#endif
/* Allocate and initialize remoteproc_priv instance */
rproc_priv = metal_allocate_memory(sizeof(struct remoteproc_priv));
if (!rproc_priv)
{
return NULL;
}
memset(rproc_priv, 0, sizeof(*rproc_priv));
rproc_priv->notify_id = (unsigned int) proc_index;
rproc_priv->vr_info = &vrinfo[rsc_index];
/* Allocate remoteproc instance */
rproc_inst = metal_allocate_memory(sizeof(struct remoteproc));
if (!rproc_inst)
{
goto err1;
}
memset(rproc_inst, 0, sizeof(*rproc_inst));
/* remoteproc initialization */
if (!remoteproc_init(rproc_inst, &rzg2_proc_ops, rproc_priv))
{
goto err2;
}
/*
* Mmap shared memories
* Or shall we constraint that they will be set as carved out
* in the resource table?
*/ /* FreeRTOS */
rsc_table = get_resource_table(rsc_index, &rsc_size);
rproc_inst->rsc_io = rproc_priv->vr_info->rsc.io;
/* Parse resource table to remoteproc */
ret = remoteproc_set_rsc_table(rproc_inst, rsc_table, rsc_size);
if (ret)
{
LPRINTF("Failed to initialize remoteproc\n");
goto err2;
}
LPRINTF("Initialize remoteproc successfully.\n");
return rproc_inst;
err2:
(void) remoteproc_remove(rproc_inst);
metal_free_memory(rproc_inst);
err1:
metal_free_memory(rproc_priv);
return NULL;
}
struct rpmsg_device * platform_create_rpmsg_vdev (void * platform,
unsigned int vdev_index,
unsigned int role,
void ( * rst_cb)(struct virtio_device * vdev),
rpmsg_ns_bind_cb ns_bind_cb)
{
struct remoteproc * rproc = platform;
struct remoteproc_priv * prproc;
struct rpmsg_virtio_device * rpmsg_vdev;
struct virtio_device * vdev;
struct metal_io_region * shbuf_io;
metal_phys_addr_t pa;
int ret;
prproc = rproc->priv;
rpmsg_vdev = metal_allocate_memory(sizeof(*rpmsg_vdev));
if (!rpmsg_vdev)
{
return NULL;
}
memset(rpmsg_vdev, 0, sizeof(*rpmsg_vdev));
LPRINTF("creating remoteproc virtio\n");
vdev = remoteproc_create_virtio(rproc, (int) vdev_index, role, rst_cb);
if (!vdev)
{
LPRINTF("failed remoteproc_create_virtio\n");
goto err;
}
pa = metal_io_phys(prproc->vr_info->shm.io, 0x0U);
shbuf_io = remoteproc_get_io_with_pa(rproc, pa);
if (!shbuf_io)
{
LPRINTF("failed remoteproc_get_io_with_pa\n");
goto err;
}
LPRINTF("initializing rpmsg vdev\n");
/* RPMsg virtio slave can set shared buffers pool argument to NULL */
ret = rpmsg_init_vdev(rpmsg_vdev, vdev, ns_bind_cb, shbuf_io, &shpool);
if (ret)
{
LPRINTF("failed rpmsg_init_vdev\n");
goto err;
}
start_ipi_task(rproc);
return rpmsg_virtio_get_rpmsg_device(rpmsg_vdev);
err:
remoteproc_remove_virtio(rproc, vdev);
metal_free_memory(rpmsg_vdev);
return NULL;
}
int platform_poll (void * priv)
{
(void) priv;
return 0;
}
int platform_init (unsigned long proc_id, unsigned long rsc_id, void ** platform)
{
struct remoteproc * rproc;
if (!platform)
{
LPRINTF("Failed to initialize platform," "NULL pointer to store platform data.\n");
return -EINVAL;
}
if ((proc_id >= RSC_MAX_NUM) || (rsc_id >= RSC_MAX_NUM))
{
LPRINTF("Invalid rproc number specified.\n");
return -EINVAL;
}
rproc = platform_create_proc((int) proc_id, (int) rsc_id);
if (!rproc)
{
LPRINTF("Failed to create remoteproc device.\n");
return -EINVAL;
}
*platform = rproc;
return 0;
}
void platform_release_rpmsg_vdev (void * platform, struct rpmsg_device * rpdev)
{
/* Need to free memory regions already allocated but not used anymore? */
struct remoteproc * rproc = platform;
struct rpmsg_virtio_device * rpmsg_vdev;
struct remoteproc_priv * prproc = rproc->priv;
ipi.ipi_mutx_id[prproc->notify_id] = -1;
KTaskDelete(ipi_tsk_id[prproc->notify_id]);
ipi_tsk_id[prproc->notify_id] = -1;
rpmsg_vdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rpmsg_deinit_vdev(rpmsg_vdev);
remoteproc_remove_virtio(rproc, rpmsg_vdev->vdev);
metal_free_memory(rpmsg_vdev);
}
void platform_cleanup (void * platform)
{
struct remoteproc * rproc = platform;
struct remoteproc_priv * prproc;
struct metal_device * dev;
if (rproc)
{
prproc = rproc->priv;
if (rproc->priv)
{
/* Release allocated resource */
/* Shared memory devices */
metal_list_del(&(prproc->vr_info->ctl.mem.node));
dev = prproc->vr_info->ctl.dev;
if (dev)
{
metal_device_close(dev);
}
metal_list_del(&(prproc->vr_info->shm.mem.node));
dev = prproc->vr_info->shm.dev;
if (dev)
{
metal_device_close(dev);
}
/* Resource table device */
metal_list_del(&(prproc->vr_info->rsc.mem.node));
dev = prproc->vr_info->rsc.dev;
if (dev)
{
metal_device_close(dev);
}
/* Release the private area */
metal_free_memory(rproc->priv);
}
(void) remoteproc_remove(rproc);
metal_free_memory(rproc);
}
}
static void* IpiTask(void * exinf);
static void* IpiTask (void * exinf)
{
struct remoteproc * rproc = exinf;
struct remoteproc_priv * prproc = rproc->priv;
int ret;
while (1)
{
if (ipi.ipi_mutx_id[prproc->notify_id] != 1)
{
__WFI();
continue;
}
// KMutexObtain(ipi.ipi_mutx_id[prproc->notify_id], WAITING_FOREVER);
/* Ignore a incoming interrupt if the virtio layer of a target remoteproc is not yet initialized */
if (metal_list_is_empty(&rproc->vdevs))
{
continue;
}
ret = remoteproc_get_notification(rproc, RSC_NOTIFY_ID_ANY);
// KPrintf("IpiTask: after remoteproc_get_notification\n");
if (ret)
{
KPrintf("remoteproc_get_notification() failed with %d", ret);
break;
}
ipi.ipi_mutx_id[prproc->notify_id] = 0;
// DelayKTask(10);
}
}
static void start_ipi_task (void * platform)
{
struct remoteproc * rproc = platform;
struct remoteproc_priv * prproc = rproc->priv;
// int32 mutx_id = KMutexCreate();
// if (mutx_id < 0)
// {
// KPrintf("start_ipi_task: create sem fail!\n");
// return ;
// }
// ipi.ipi_mutx_id[prproc->notify_id] = mutx_id;
ipi.ipi_mutx_id[prproc->notify_id] = 0;
// KPrintf("start_ipi_task: prproc->notify_id = %d, ipi.ipi_mutx_id[prproc->notify_id] = %d \n",prproc->notify_id,ipi.ipi_mutx_id[prproc->notify_id]);
int32 ipi_task_id = -1;
ipi_task_id = KTaskCreate("ipi_task",IpiTask,platform,4096,SHELL_TASK_PRIORITY + 1);
if (ipi_task_id < 0)
{
LPRINTF("Failed to register an interrupt service routine.\n");
return ;
}
ipi_tsk_id[prproc->notify_id] = ipi_task_id;
StartupKTask(ipi_task_id);
}
@@ -0,0 +1,168 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/*
* @file platform_info.h
* @brief Platform specific configurations for OpenAMP and Shared memory
* @date 2020.10.21
* @author Copyright (c) 2020, eForce Co., Ltd. All rights reserved.
*
****************************************************************************
* @par History
* - rev 1.0 (2020.10.21) Imada
* Initial version for RZ/G2.
****************************************************************************
*/
#ifndef PLATFORM_INFO_H_
#define PLATFORM_INFO_H_
#include <openamp/rpmsg.h>
#include <openamp/remoteproc.h>
#include "open_amp_cfg.h"
#include "bsp_api.h"
#include <xizi.h>
#include "r_mhu_api.h"
#define DEV_BUS_NAME "generic"
#define MBX_REG_PA 0x10400000
#define MBX_REG_VA 0x40400000
#define MBX_MAP_SIZE 0x00000800
#define MBX_INT_NUM 69 // MSG1_NS_IRQn
#define RSC_MAX_NUM 2
extern int printf_raw(const char * format, ...);
/*
* If you want to enable OpenAMP debug output,
* you need to use the SCIF output from the expansion connector.
* And edit config.h to set DEBUG_SCIF to 1.
*/
#if 0
#define LPRINTF(format, ...) (printf_raw(format, ## __VA_ARGS__))
#define LPERROR(format, ...) (LPRINTF("ERROR: " format, ## __VA_ARGS__))
#else
#define LPRINTF(format, ...) {}
#define LPERROR(format, ...) {}
#endif
// Page size on Linux (Default: 4KB)
#define PAGE_SIZE (0x01000U) // 4KB page size as the dafault value
// Mailbox config
#define MBX_DEV_NAME "0x10400000.mbox-uio"
#define MBX_NO (0x0U) /* Maibox number (0, 1, ..., or 7) this program uses */
struct ipi_info
{
const char * name;
const char * bus_name;
struct metal_device * dev;
struct metal_io_region * io;
uintptr_t irq_info;
int registered;
unsigned int mbx_chn[CFG_RPMSG_SVCNO];
unsigned int chn_mask; /**< IPI channel mask */
volatile int32 ipi_mutx_id[CFG_RPMSG_SVCNO];
};
struct shm_info
{
const char * name;
const char * bus_name;
struct metal_device * dev; /**< pointer to shared memory device */
struct metal_io_region * io; /**< pointer to shared memory i/o region */
struct remoteproc_mem mem; /**< shared memory */
};
struct vring_info
{
struct shm_info rsc;
struct shm_info ctl;
struct shm_info shm;
};
struct remoteproc_priv
{
unsigned int notify_id;
unsigned int mbx_chn_id;
struct vring_info * vr_info;
};
/**
* platform_init - initialize the platform
*
* It will initialize the platform.
*
* @proc_id: processor id
* @rsc_id: resource id
* @platform: pointer to store the platform data pointer
*
* return 0 for success or negative value for failure
*/
int platform_init(unsigned long proc_id, unsigned long rsc_id, void ** platform);
/**
* platform_create_rpmsg_vdev - create rpmsg vdev
*
* It will create rpmsg virtio device, and returns the rpmsg virtio
* device pointer.
*
* @platform: pointer to the private data
* @vdev_index: index of the virtio device, there can more than one vdev
* on the platform.
* @role: virtio master or virtio slave of the vdev
* @rst_cb: virtio device reset callback
* @ns_bind_cb: rpmsg name service bind callback
*
* return pointer to the rpmsg virtio device
*/
struct rpmsg_device * platform_create_rpmsg_vdev(void * platform,
unsigned int vdev_index,
unsigned int role,
void ( * rst_cb)(struct virtio_device * vdev),
rpmsg_ns_bind_cb ns_bind_cb);
/**
* platform_poll - platform poll function
*
* @platform: pointer to the platform
*
* return negative value for errors, otherwise 0.
*/
int platform_poll(void * platform);
/**
* platform_release_rpmsg_vdev - release rpmsg virtio device
*
* @platform: pointer to the platform
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(void * platform, struct rpmsg_device * rpdev);
/**
* platform_cleanup - clean up the platform resource
*
* @platform: pointer to the platform
*/
void platform_cleanup(void * platform);
#endif
@@ -0,0 +1,16 @@
#ifndef __RPMSG_TASK_H__
#define __RPMSG_TASK_H__
#include "bsp_api.h"
#include "hal_data.h"
#include <xizi.h>
#define RECONNECT_FLG (1)
#define RECONNECT_DLY (1000U)
// 创建 RPMsg 任务的接口
void CreateRPMsgTask(void);
void* RPMsgTask_Entry(void* param);
#endif /* MAINTASK_H_ */
@@ -0,0 +1,107 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/**
* @file rsc_table.c
* @brief The remote resource table.
* @date 2020.10.20
* @author Copyright (c) 2020, eForce Co., Ltd. All rights reserved.
*
****************************************************************************
* @par History
* - rev 1.0 (2020.10.20) Imada
* First release for RZ/G2
****************************************************************************
*/
#include "rsc_table.h"
struct remote_resource_table __resource resources[2];
struct remote_resource_table resources_init[] =
{
{
/* Version */
1,
/* NUmber of table entries */
NUM_TABLE_ENTRIES,
/* reserved fields */
{0, 0},
/* Offsets of rsc entries */
{
offsetof(struct remote_resource_table, rproc_mem),
offsetof(struct remote_resource_table, rpmsg_vdev)
},
{RSC_RPROC_MEM, RPMSG_MEM_BASE, RPMSG_MEM_BASE, RPMSG_MEM_SIZE, 0},
/* Virtio device entry */
{
RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
NUM_VRINGS,{0, 0},
},
/* Vring rsc entry - part of vdev rsc entry */
{CFG_VRING0_BASE0_PA, CFG_VRING_ALIGN0, CFG_RPMSG_NUM_BUFS0, 0, 0},
{CFG_VRING1_BASE0_PA, CFG_VRING_ALIGN0, CFG_RPMSG_NUM_BUFS0, 0, 0}
},
{
/* Version */
1,
/* NUmber of table entries */
NUM_TABLE_ENTRIES,
/* reserved fields */
{0, 0},
/* Offsets of rsc entries */
{
offsetof(struct remote_resource_table, rproc_mem),
offsetof(struct remote_resource_table, rpmsg_vdev)
},
{RSC_RPROC_MEM, RPMSG_MEM_BASE, RPMSG_MEM_BASE, RPMSG_MEM_SIZE, 0},
/* Virtio device entry */
{
RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
NUM_VRINGS,{0, 0},
},
/* Vring rsc entry - part of vdev rsc entry */
{CFG_VRING0_BASE1_PA, CFG_VRING_ALIGN1, CFG_RPMSG_NUM_BUFS1, 1, 0},
{CFG_VRING1_BASE1_PA, CFG_VRING_ALIGN1, CFG_RPMSG_NUM_BUFS1, 1, 0}
},
};
void init_resource_table (void)
{
memcpy(resources, resources_init, sizeof(resources_init));
}
void * get_resource_table (int rsc_id, unsigned int * len)
{
*len = sizeof(resources[rsc_id]);
return (void *) &resources[rsc_id];
}
@@ -0,0 +1,78 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/**
* @file rsc_table.h
* @brief Configurations for the resource table.
* @date 2020.03.24
* @author Copyright (c) 2020, eForce Co., Ltd. All rights reserved.
*
****************************************************************************
* @par History
* - rev 1.0 (2020.03.24) Imada
* First release for AM65xx
****************************************************************************
*/
#ifndef RSC_TABLE_H_
#define RSC_TABLE_H_
#include <stddef.h>
#include "openamp/open_amp.h"
#include "platform_info.h"
/* Place resource table in special ELF section */
#define __section_t(S) __attribute__((__section__(#S)))
#define __resource __section_t(.resource_table)
#define RPMSG_IPU_C0_FEATURES (1U)
/* VirtIO rpmsg device id */
#define VIRTIO_ID_RPMSG_ (7U)
#define NUM_VRINGS (2U)
#define NUM_TABLE_ENTRIES (2U)
#define NO_RESOURCE_ENTRIES (2U)
/* Resource table UIO device */
#define CFG_RSCTBL_DEV_NAME "42F00000.rsctbl"
#define CFG_RSCTBL_MEM_VA (0x62F00000U)
#define CFG_RSCTBL_MEM_PA (0x42F00000U)
#define CFG_RSCTBL_MAP_SIZE (0x00001000U) // 4KB
/* MDK_ARM compiler does not apply __packed__ for this */
struct remote_resource_table
{
unsigned int version;
unsigned int num;
unsigned int reserved[2];
unsigned int offset[NO_RESOURCE_ENTRIES];
/* rproc memory entry */
struct fw_rsc_rproc_mem rproc_mem;
/* rpmsg vdev entry */
struct fw_rsc_vdev rpmsg_vdev;
struct fw_rsc_vdev_vring rpmsg_vring0;
struct fw_rsc_vdev_vring rpmsg_vring1;
};
void * get_resource_table(int rsc_id, unsigned int * len);
#endif /* RSC_TABLE_H_ */
@@ -0,0 +1,279 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/*
* Copyright (c) 2014, Mentor Graphics Corporation
* All rights reserved.
* Copyright (c) 2017 Xilinx, Inc.
* Copyright (c) 2020, eForce Co., Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**************************************************************************
* FILE NAME
*
* rzg2_rproc.c
*
* DESCRIPTION
*
* This file defines RZ/G2 CA5X/CR7 remoteproc implementation.
*
* @par History
* - rev 1.0 (2020.10.21) Imada
* Initial version.
*
**************************************************************************/
#include <metal/atomic.h>
#include <metal/assert.h>
#include <metal/device.h>
#include <metal/irq.h>
#include <metal/list.h>
#include <metal/utilities.h>
#include <openamp/rpmsg_virtio.h>
#include "platform_info.h"
#include <xizi.h>
#include "hal_data.h"
extern struct ipi_info ipi;
/* Inline functions to add accessing address check to corresponding
* libmetal functions to avoid accessing a reserved region.
* They are mainly required because of larger (uio) mmap size due the
* 4KB page size on Verified Linux. They are also utilized for FreeRTOS because
* accessing a reserved area of registers can cause system failure.
*/
static int init_memory_device (struct remoteproc * rproc, struct shm_info * info) {
struct metal_device * dev;
metal_phys_addr_t mem_pa;
int ret;
ret = metal_device_open(info->bus_name, info->name, &dev);
if (ret)
{
LPERROR("Failed to open uio device %s: %d.\n", info->name, ret);
goto err;
}
LPRINTF("Successfully open uio device: %s.\n", info->name);
info->dev = dev;
info->io = metal_device_io_region(dev, 0x0U);
if (!info->io)
{
goto err;
}
mem_pa = metal_io_phys(info->io, 0x0U);
remoteproc_init_mem(&info->mem, info->name, mem_pa, mem_pa, metal_io_region_size(info->io), info->io);
remoteproc_add_mem(rproc, &info->mem);
LPRINTF("Successfully added memory device %s.\n", info->name);
return 0;
err:
if (info->dev)
{
metal_device_close(info->dev);
}
return ret;
}
static int rzg2_mhu_callback (mhu_callback_args_t * p_args)
{
unsigned int val = 0U;
/* Clear the interrupt: Already done by MHU driver */
/* Get a massage from the mailbox */
val = p_args->msg;
if (val >= RSC_MAX_NUM) /* val should have the notify_id of the sender */
{
return METAL_IRQ_NOT_HANDLED; /* Invalid message arrived */
}
if (ipi.ipi_mutx_id[val] != -1)
{
ipi.ipi_mutx_id[val] = 1;
}
else
{
return METAL_IRQ_NOT_HANDLED;
}
return METAL_IRQ_HANDLED;
}
static int rzg2_enable_interrupt (struct remoteproc * rproc, struct metal_device * ipi_dev)
{
unsigned int irq_vect;
int ret = 0;
if (!ipi.registered)
{
/* Register interrupt handler and enable interrupt for RZ/G2 CA5X or CR7 */
irq_vect = (uintptr_t) ipi_dev->irq_info;
ret = metal_irq_register((int) irq_vect, R_MHU_NS_IsrSub, ipi_dev, rproc);
if (ret)
{
LPRINTF("metal_irq_register() failed with %d", ret);
return ret;
}
metal_irq_enable(irq_vect);
}
return ret;
}
static void rzg2_disable_interrupt (struct remoteproc * rproc)
{
(void) rproc;
struct metal_device * dev;
int ret;
dev = ipi.dev;
if (dev)
{
metal_irq_disable((uintptr_t) dev->irq_info);
ret = metal_irq_unregister((int) dev->irq_info, NULL, NULL, NULL);
if (ret)
{
LPRINTF("metal_irq_unregister() failed with %d", ret);
return;
}
metal_device_close(dev);
ipi.registered = 0;
}
}
static struct remoteproc * rzg2_proc_init (struct remoteproc * rproc, struct remoteproc_ops * ops, void * arg)
{
struct remoteproc_priv * prproc = arg;
struct metal_device * dev;
int ret;
/* Initialize MHU driver */
g_mhu_ns0.p_api->open(g_mhu_ns0.p_ctrl, g_mhu_ns0.p_cfg);
g_mhu_ns0.p_api->callbackSet(g_mhu_ns0.p_ctrl, rzg2_mhu_callback, NULL, NULL);
if ((!rproc) || (!prproc) || (!ops))
{
return NULL;
}
rproc->priv = prproc;
rproc->ops = ops;
if (!ipi.registered)
{
/* Get an IPI device (Mailbox) */
ret = metal_device_open(ipi.bus_name, ipi.name, &dev);
if (ret)
{
LPERROR("Failed to open ipi device: %d.\n", ret);
return NULL;
}
ipi.dev = dev;
ipi.io = metal_device_io_region(dev, 0x0U);
if (!ipi.io)
{
goto err1;
}
LPRINTF("Successfully probed IPI device\n");
}
ret = rzg2_enable_interrupt(rproc, ipi.dev);
if (ret)
{
LPERROR("Failed to register the interrupt handler.\n");
goto err1;
}
ipi.registered++;
/* Get the resource table device */
if (init_memory_device(rproc, &prproc->vr_info->rsc))
{
goto err1;
}
/* Get VRING related devices */
if (init_memory_device(rproc, &prproc->vr_info->ctl))
{
goto err1;
}
if (init_memory_device(rproc, &prproc->vr_info->shm))
{
goto err1;
}
return rproc;
err1:
metal_device_close(ipi.dev);
return NULL;
}
static void rzg2_proc_remove (struct remoteproc * rproc)
{
if (!rproc)
{
return;
}
if (ipi.registered > 1)
{
ipi.registered--;
return;
}
/* Disable interrupts */
rzg2_disable_interrupt(rproc);
}
static int rzg2_proc_notify (struct remoteproc * rproc, uint32_t id)
{
struct remoteproc_priv * prproc = rproc->priv;
g_mhu_ns0.p_api->msgSend(g_mhu_ns0.p_ctrl, prproc->notify_id);
return 0;
}
/* processor operations in rzg2. It defines
* notification operation and remote processor managementi operations. */
struct remoteproc_ops rzg2_proc_ops =
{
.init = rzg2_proc_init,
.remove = rzg2_proc_remove,
.mmap = NULL,
.notify = rzg2_proc_notify,
.start = NULL,
.stop = NULL,
.shutdown = NULL,
};
@@ -0,0 +1,207 @@
/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
/**
* @file sys_init.c
* @brief Metal device definitions
* @date 2020.10.15
* @author Copyright (c) 2020, eForce Co., Ltd. All rights reserved.
*
****************************************************************************
* @par History
* - rev 1.0 (2020.10.15) Imada
* First release
****************************************************************************
*/
#include "metal/io.h"
#include "metal/device.h"
#include "metal/sys.h"
#include "rsc_table.h"
#include "platform_info.h"
#include "bsp_api.h"
extern void init_resource_table(void);
const metal_phys_addr_t metal_phys[] =
{
MBX_REG_PA,
CFG_RSCTBL_MEM_PA,
CFG_VRING0_BASE0_PA,
CFG_VRING0_BASE1_PA,
CFG_VRING_SHM_BASE0_PA,
CFG_VRING_SHM_BASE1_PA,
};
struct metal_device metal_dev_table[] =
{
/* Mailbox device */
{
MBX_DEV_NAME,
NULL,
1,
{
{
(void *) MBX_REG_VA,
&metal_phys[0],
MBX_MAP_SIZE,
(sizeof(metal_phys_addr_t) << 3),
(metal_phys_addr_t) (-1),
0,
{NULL}
}
},
{NULL},
1,
(void *) MBX_INT_NUM,
},
/* Resource table */
{
CFG_RSCTBL_DEV_NAME,
NULL,
1,
{
{
(void *) (CFG_RSCTBL_MEM_VA),
&metal_phys[1],
CFG_RSCTBL_MAP_SIZE,
(sizeof(metal_phys_addr_t) << 3),
(unsigned long) (-1),
0,
{NULL},
}
},
{NULL},
0,
NULL,
},
/* RPMSG (vring) */
{ /* vring #0 CTL */
CFG_VRING_CTL_NAME0,
NULL,
1,
{
{
(void *) (CFG_VRING0_BASE0_VA),
&metal_phys[2],
CFG_VRING_SIZE0,
(sizeof(metal_phys_addr_t) << 3),
(unsigned long) (-1),
0,
{NULL},
}
},
{NULL},
0,
NULL,
},
{ /* vring #1 CTL */
CFG_VRING_CTL_NAME1,
NULL,
1,
{
{
(void *) (CFG_VRING0_BASE1_VA),
&metal_phys[3],
CFG_VRING_SIZE1,
(sizeof(metal_phys_addr_t) << 3),
(unsigned long) (-1),
0,
{NULL},
}
},
{NULL},
0,
NULL,
},
{ /* vring #0 SHM */
CFG_VRING_SHM_NAME0,
NULL,
1,
{
{
(void *) (CFG_VRING_SHM_BASE0_VA),
&metal_phys[4],
CFG_VRING_SHM_SIZE0,
(sizeof(metal_phys_addr_t) << 3),
(unsigned long) (-1),
0,
{NULL},
}
},
{NULL},
0,
NULL,
},
{ /* vring #1 SHM */
CFG_VRING_SHM_NAME1,
NULL,
1,
{
{
(void *) (CFG_VRING_SHM_BASE1_VA),
&metal_phys[5],
CFG_VRING_SHM_SIZE1,
(sizeof(metal_phys_addr_t) << 3),
(unsigned long) (-1),
0,
{NULL},
}
},
{NULL},
0,
NULL,
},
};
int init_system (void)
{
unsigned int i;
int ret;
struct metal_init_params metal_param = METAL_INIT_DEFAULTS;
struct metal_device * dev;
init_resource_table();
ret = metal_init(&metal_param);
if (ret)
{
return ret;
}
/* register device */
for (i = 0U; i < (sizeof(metal_dev_table) / sizeof(struct metal_device)); i++)
{
dev = &metal_dev_table[i];
ret = metal_register_generic_device(dev);
if (ret)
{
break;
}
}
return ret;
}
void cleanup_system (void)
{
metal_finish();
}
@@ -0,0 +1,498 @@
/* generated vector source file - do not edit */
#include "bsp_api.h"
#include "vector_data.h"
extern void Default_Handler(void);
BSP_DONT_REMOVE fsp_vector_t g_vector_table[BSP_ICU_VECTOR_MAX_ENTRIES] BSP_PLACE_IN_SECTION(BSP_SECTION_APPLICATION_VECTORS) = {
Default_Handler, /* IRQ:0 */
Default_Handler, /* IRQ:1 */
Default_Handler, /* IRQ:2 */
Default_Handler, /* IRQ:3 */
Default_Handler, /* IRQ:4 */
Default_Handler, /* IRQ:5 */
Default_Handler, /* IRQ:6 */
Default_Handler, /* IRQ:7 */
Default_Handler, /* IRQ:8 */
Default_Handler, /* IRQ:9 */
Default_Handler, /* IRQ:10 */
Default_Handler, /* IRQ:11 */
Default_Handler, /* IRQ:12 */
Default_Handler, /* IRQ:13 */
Default_Handler, /* IRQ:14 */
Default_Handler, /* IRQ:15 */
Default_Handler, /* IRQ:16 */
Default_Handler, /* IRQ:17 */
Default_Handler, /* IRQ:18 */
Default_Handler, /* IRQ:19 */
Default_Handler, /* IRQ:20 */
Default_Handler, /* IRQ:21 */
Default_Handler, /* IRQ:22 */
Default_Handler, /* IRQ:23 */
Default_Handler, /* IRQ:24 */
Default_Handler, /* IRQ:25 */
Default_Handler, /* IRQ:26 */
Default_Handler, /* IRQ:27 */
Default_Handler, /* IRQ:28 */
Default_Handler, /* IRQ:29 */
Default_Handler, /* IRQ:30 */
Default_Handler, /* IRQ:31 */
Default_Handler, /* IRQ:32 */
Default_Handler, /* IRQ:33 */
Default_Handler, /* IRQ:34 */
Default_Handler, /* IRQ:35 */
Default_Handler, /* IRQ:36 */
Default_Handler, /* IRQ:37 */
Default_Handler, /* IRQ:38 */
Default_Handler, /* IRQ:39 */
Default_Handler, /* IRQ:40 */
Default_Handler, /* IRQ:41 */
Default_Handler, /* IRQ:42 */
Default_Handler, /* IRQ:43 */
Default_Handler, /* IRQ:44 */
Default_Handler, /* IRQ:45 */
Default_Handler, /* IRQ:46 */
Default_Handler, /* IRQ:47 */
gtm_int_isr, /* IRQ:48 GTM2 INT (GTM2 Interrupt) */
Default_Handler, /* IRQ:49 */
Default_Handler, /* IRQ:50 */
Default_Handler, /* IRQ:51 */
Default_Handler, /* IRQ:52 */
Default_Handler, /* IRQ:53 */
Default_Handler, /* IRQ:54 */
Default_Handler, /* IRQ:55 */
Default_Handler, /* IRQ:56 */
Default_Handler, /* IRQ:57 */
Default_Handler, /* IRQ:58 */
Default_Handler, /* IRQ:59 */
Default_Handler, /* IRQ:60 */
Default_Handler, /* IRQ:61 */
Default_Handler, /* IRQ:62 */
Default_Handler, /* IRQ:63 */
Default_Handler, /* IRQ:64 */
Default_Handler, /* IRQ:65 */
Default_Handler, /* IRQ:66 */
Default_Handler, /* IRQ:67 */
Default_Handler, /* IRQ:68 */
metal_irq_isr_wrapper, /* IRQ:69 MHU1 MSG_INT_NS (Non-Secure Message Interrupt ch1) */
Default_Handler, /* IRQ:70 */
Default_Handler, /* IRQ:71 */
Default_Handler, /* IRQ:72 */
Default_Handler, /* IRQ:73 */
Default_Handler, /* IRQ:74 */
Default_Handler, /* IRQ:75 */
Default_Handler, /* IRQ:76 */
Default_Handler, /* IRQ:77 */
Default_Handler, /* IRQ:78 */
Default_Handler, /* IRQ:79 */
Default_Handler, /* IRQ:80 */
Default_Handler, /* IRQ:81 */
Default_Handler, /* IRQ:82 */
Default_Handler, /* IRQ:83 */
Default_Handler, /* IRQ:84 */
Default_Handler, /* IRQ:85 */
Default_Handler, /* IRQ:86 */
Default_Handler, /* IRQ:87 */
Default_Handler, /* IRQ:88 */
Default_Handler, /* IRQ:89 */
Default_Handler, /* IRQ:90 */
Default_Handler, /* IRQ:91 */
Default_Handler, /* IRQ:92 */
Default_Handler, /* IRQ:93 */
Default_Handler, /* IRQ:94 */
Default_Handler, /* IRQ:95 */
Default_Handler, /* IRQ:96 */
Default_Handler, /* IRQ:97 */
Default_Handler, /* IRQ:98 */
Default_Handler, /* IRQ:99 */
Default_Handler, /* IRQ:100 */
Default_Handler, /* IRQ:101 */
Default_Handler, /* IRQ:102 */
Default_Handler, /* IRQ:103 */
Default_Handler, /* IRQ:104 */
Default_Handler, /* IRQ:105 */
Default_Handler, /* IRQ:106 */
Default_Handler, /* IRQ:107 */
Default_Handler, /* IRQ:108 */
Default_Handler, /* IRQ:109 */
Default_Handler, /* IRQ:110 */
Default_Handler, /* IRQ:111 */
Default_Handler, /* IRQ:112 */
Default_Handler, /* IRQ:113 */
Default_Handler, /* IRQ:114 */
Default_Handler, /* IRQ:115 */
Default_Handler, /* IRQ:116 */
Default_Handler, /* IRQ:117 */
Default_Handler, /* IRQ:118 */
Default_Handler, /* IRQ:119 */
Default_Handler, /* IRQ:120 */
Default_Handler, /* IRQ:121 */
Default_Handler, /* IRQ:122 */
Default_Handler, /* IRQ:123 */
Default_Handler, /* IRQ:124 */
Default_Handler, /* IRQ:125 */
Default_Handler, /* IRQ:126 */
Default_Handler, /* IRQ:127 */
Default_Handler, /* IRQ:128 */
Default_Handler, /* IRQ:129 */
Default_Handler, /* IRQ:130 */
Default_Handler, /* IRQ:131 */
Default_Handler, /* IRQ:132 */
Default_Handler, /* IRQ:133 */
Default_Handler, /* IRQ:134 */
Default_Handler, /* IRQ:135 */
Default_Handler, /* IRQ:136 */
Default_Handler, /* IRQ:137 */
Default_Handler, /* IRQ:138 */
Default_Handler, /* IRQ:139 */
Default_Handler, /* IRQ:140 */
Default_Handler, /* IRQ:141 */
Default_Handler, /* IRQ:142 */
Default_Handler, /* IRQ:143 */
Default_Handler, /* IRQ:144 */
Default_Handler, /* IRQ:145 */
Default_Handler, /* IRQ:146 */
Default_Handler, /* IRQ:147 */
Default_Handler, /* IRQ:148 */
Default_Handler, /* IRQ:149 */
Default_Handler, /* IRQ:150 */
Default_Handler, /* IRQ:151 */
Default_Handler, /* IRQ:152 */
Default_Handler, /* IRQ:153 */
Default_Handler, /* IRQ:154 */
Default_Handler, /* IRQ:155 */
Default_Handler, /* IRQ:156 */
Default_Handler, /* IRQ:157 */
Default_Handler, /* IRQ:158 */
Default_Handler, /* IRQ:159 */
Default_Handler, /* IRQ:160 */
Default_Handler, /* IRQ:161 */
Default_Handler, /* IRQ:162 */
Default_Handler, /* IRQ:163 */
Default_Handler, /* IRQ:164 */
Default_Handler, /* IRQ:165 */
Default_Handler, /* IRQ:166 */
Default_Handler, /* IRQ:167 */
Default_Handler, /* IRQ:168 */
Default_Handler, /* IRQ:169 */
Default_Handler, /* IRQ:170 */
Default_Handler, /* IRQ:171 */
Default_Handler, /* IRQ:172 */
Default_Handler, /* IRQ:173 */
Default_Handler, /* IRQ:174 */
Default_Handler, /* IRQ:175 */
Default_Handler, /* IRQ:176 */
Default_Handler, /* IRQ:177 */
Default_Handler, /* IRQ:178 */
Default_Handler, /* IRQ:179 */
Default_Handler, /* IRQ:180 */
Default_Handler, /* IRQ:181 */
Default_Handler, /* IRQ:182 */
Default_Handler, /* IRQ:183 */
Default_Handler, /* IRQ:184 */
Default_Handler, /* IRQ:185 */
Default_Handler, /* IRQ:186 */
Default_Handler, /* IRQ:187 */
Default_Handler, /* IRQ:188 */
Default_Handler, /* IRQ:189 */
Default_Handler, /* IRQ:190 */
Default_Handler, /* IRQ:191 */
Default_Handler, /* IRQ:192 */
Default_Handler, /* IRQ:193 */
Default_Handler, /* IRQ:194 */
Default_Handler, /* IRQ:195 */
Default_Handler, /* IRQ:196 */
Default_Handler, /* IRQ:197 */
Default_Handler, /* IRQ:198 */
Default_Handler, /* IRQ:199 */
Default_Handler, /* IRQ:200 */
Default_Handler, /* IRQ:201 */
Default_Handler, /* IRQ:202 */
Default_Handler, /* IRQ:203 */
Default_Handler, /* IRQ:204 */
Default_Handler, /* IRQ:205 */
Default_Handler, /* IRQ:206 */
Default_Handler, /* IRQ:207 */
Default_Handler, /* IRQ:208 */
Default_Handler, /* IRQ:209 */
Default_Handler, /* IRQ:210 */
Default_Handler, /* IRQ:211 */
Default_Handler, /* IRQ:212 */
Default_Handler, /* IRQ:213 */
Default_Handler, /* IRQ:214 */
Default_Handler, /* IRQ:215 */
Default_Handler, /* IRQ:216 */
Default_Handler, /* IRQ:217 */
Default_Handler, /* IRQ:218 */
Default_Handler, /* IRQ:219 */
Default_Handler, /* IRQ:220 */
Default_Handler, /* IRQ:221 */
Default_Handler, /* IRQ:222 */
Default_Handler, /* IRQ:223 */
Default_Handler, /* IRQ:224 */
Default_Handler, /* IRQ:225 */
Default_Handler, /* IRQ:226 */
Default_Handler, /* IRQ:227 */
Default_Handler, /* IRQ:228 */
Default_Handler, /* IRQ:229 */
Default_Handler, /* IRQ:230 */
Default_Handler, /* IRQ:231 */
Default_Handler, /* IRQ:232 */
Default_Handler, /* IRQ:233 */
Default_Handler, /* IRQ:234 */
Default_Handler, /* IRQ:235 */
Default_Handler, /* IRQ:236 */
Default_Handler, /* IRQ:237 */
Default_Handler, /* IRQ:238 */
Default_Handler, /* IRQ:239 */
Default_Handler, /* IRQ:240 */
Default_Handler, /* IRQ:241 */
Default_Handler, /* IRQ:242 */
Default_Handler, /* IRQ:243 */
Default_Handler, /* IRQ:244 */
Default_Handler, /* IRQ:245 */
Default_Handler, /* IRQ:246 */
Default_Handler, /* IRQ:247 */
Default_Handler, /* IRQ:248 */
Default_Handler, /* IRQ:249 */
Default_Handler, /* IRQ:250 */
Default_Handler, /* IRQ:251 */
Default_Handler, /* IRQ:252 */
Default_Handler, /* IRQ:253 */
Default_Handler, /* IRQ:254 */
Default_Handler, /* IRQ:255 */
Default_Handler, /* IRQ:256 */
Default_Handler, /* IRQ:257 */
Default_Handler, /* IRQ:258 */
Default_Handler, /* IRQ:259 */
Default_Handler, /* IRQ:260 */
Default_Handler, /* IRQ:261 */
Default_Handler, /* IRQ:262 */
Default_Handler, /* IRQ:263 */
Default_Handler, /* IRQ:264 */
Default_Handler, /* IRQ:265 */
Default_Handler, /* IRQ:266 */
Default_Handler, /* IRQ:267 */
Default_Handler, /* IRQ:268 */
Default_Handler, /* IRQ:269 */
Default_Handler, /* IRQ:270 */
Default_Handler, /* IRQ:271 */
Default_Handler, /* IRQ:272 */
Default_Handler, /* IRQ:273 */
Default_Handler, /* IRQ:274 */
Default_Handler, /* IRQ:275 */
Default_Handler, /* IRQ:276 */
Default_Handler, /* IRQ:277 */
Default_Handler, /* IRQ:278 */
Default_Handler, /* IRQ:279 */
Default_Handler, /* IRQ:280 */
Default_Handler, /* IRQ:281 */
Default_Handler, /* IRQ:282 */
Default_Handler, /* IRQ:283 */
Default_Handler, /* IRQ:284 */
Default_Handler, /* IRQ:285 */
Default_Handler, /* IRQ:286 */
Default_Handler, /* IRQ:287 */
Default_Handler, /* IRQ:288 */
Default_Handler, /* IRQ:289 */
Default_Handler, /* IRQ:290 */
Default_Handler, /* IRQ:291 */
Default_Handler, /* IRQ:292 */
Default_Handler, /* IRQ:293 */
Default_Handler, /* IRQ:294 */
Default_Handler, /* IRQ:295 */
Default_Handler, /* IRQ:296 */
Default_Handler, /* IRQ:297 */
Default_Handler, /* IRQ:298 */
Default_Handler, /* IRQ:299 */
Default_Handler, /* IRQ:300 */
Default_Handler, /* IRQ:301 */
Default_Handler, /* IRQ:302 */
Default_Handler, /* IRQ:303 */
Default_Handler, /* IRQ:304 */
Default_Handler, /* IRQ:305 */
Default_Handler, /* IRQ:306 */
Default_Handler, /* IRQ:307 */
Default_Handler, /* IRQ:308 */
Default_Handler, /* IRQ:309 */
Default_Handler, /* IRQ:310 */
Default_Handler, /* IRQ:311 */
Default_Handler, /* IRQ:312 */
Default_Handler, /* IRQ:313 */
Default_Handler, /* IRQ:314 */
Default_Handler, /* IRQ:315 */
Default_Handler, /* IRQ:316 */
Default_Handler, /* IRQ:317 */
Default_Handler, /* IRQ:318 */
Default_Handler, /* IRQ:319 */
Default_Handler, /* IRQ:320 */
Default_Handler, /* IRQ:321 */
Default_Handler, /* IRQ:322 */
Default_Handler, /* IRQ:323 */
Default_Handler, /* IRQ:324 */
Default_Handler, /* IRQ:325 */
Default_Handler, /* IRQ:326 */
Default_Handler, /* IRQ:327 */
Default_Handler, /* IRQ:328 */
Default_Handler, /* IRQ:329 */
Default_Handler, /* IRQ:330 */
Default_Handler, /* IRQ:331 */
Default_Handler, /* IRQ:332 */
Default_Handler, /* IRQ:333 */
Default_Handler, /* IRQ:334 */
Default_Handler, /* IRQ:335 */
Default_Handler, /* IRQ:336 */
Default_Handler, /* IRQ:337 */
Default_Handler, /* IRQ:338 */
Default_Handler, /* IRQ:339 */
Default_Handler, /* IRQ:340 */
Default_Handler, /* IRQ:341 */
Default_Handler, /* IRQ:342 */
Default_Handler, /* IRQ:343 */
Default_Handler, /* IRQ:344 */
Default_Handler, /* IRQ:345 */
Default_Handler, /* IRQ:346 */
Default_Handler, /* IRQ:347 */
Default_Handler, /* IRQ:348 */
Default_Handler, /* IRQ:349 */
Default_Handler, /* IRQ:350 */
Default_Handler, /* IRQ:351 */
Default_Handler, /* IRQ:352 */
Default_Handler, /* IRQ:353 */
Default_Handler, /* IRQ:354 */
Default_Handler, /* IRQ:355 */
Default_Handler, /* IRQ:356 */
Default_Handler, /* IRQ:357 */
Default_Handler, /* IRQ:358 */
Default_Handler, /* IRQ:359 */
Default_Handler, /* IRQ:360 */
Default_Handler, /* IRQ:361 */
Default_Handler, /* IRQ:362 */
Default_Handler, /* IRQ:363 */
Default_Handler, /* IRQ:364 */
Default_Handler, /* IRQ:365 */
Default_Handler, /* IRQ:366 */
Default_Handler, /* IRQ:367 */
Default_Handler, /* IRQ:368 */
Default_Handler, /* IRQ:369 */
Default_Handler, /* IRQ:370 */
Default_Handler, /* IRQ:371 */
Default_Handler, /* IRQ:372 */
Default_Handler, /* IRQ:373 */
Default_Handler, /* IRQ:374 */
Default_Handler, /* IRQ:375 */
Default_Handler, /* IRQ:376 */
Default_Handler, /* IRQ:377 */
Default_Handler, /* IRQ:378 */
Default_Handler, /* IRQ:379 */
Default_Handler, /* IRQ:380 */
Default_Handler, /* IRQ:381 */
Default_Handler, /* IRQ:382 */
Default_Handler, /* IRQ:383 */
Default_Handler, /* IRQ:384 */
// scif_uart_eri_isr, /* IRQ:380 SCIF0 ERI (Framing or Parity error) */
// scif_uart_bri_isr, /* IRQ:381 SCIF0 BRI (Break (BRK) or Overrun (ORER) error) */
// scif_uart_rxi_isr, /* IRQ:382 SCIF0 RXI (Receive data full) */
// scif_uart_txi_isr, /* IRQ:383 SCIF0 TXI (Transmit data empty) */
// scif_uart_tei_isr, /* IRQ:384 SCIF0 TEI (Transmit end) */
Default_Handler, /* IRQ:385 */
Default_Handler, /* IRQ:386 */
Default_Handler, /* IRQ:387 */
Default_Handler, /* IRQ:388 */
Default_Handler, /* IRQ:389 */
scif_uart_eri_isr, /* IRQ:390 SCIF0 ERI (Framing or Parity error) */
scif_uart_bri_isr, /* IRQ:391 SCIF0 BRI (Break (BRK) or Overrun (ORER) error) */
scif_uart_rxi_isr, /* IRQ:392 SCIF0 RXI (Receive data full) */
scif_uart_txi_isr, /* IRQ:393 SCIF0 TXI (Transmit data empty) */
scif_uart_tei_isr, /* IRQ:394 SCIF0 TEI (Transmit end) */
// Default_Handler, /* IRQ:390 */
// Default_Handler, /* IRQ:391 */
// Default_Handler, /* IRQ:392 */
// Default_Handler, /* IRQ:393 */
// Default_Handler, /* IRQ:394 */
Default_Handler, /* IRQ:395 */
Default_Handler, /* IRQ:396 */
Default_Handler, /* IRQ:397 */
Default_Handler, /* IRQ:398 */
Default_Handler, /* IRQ:399 */
Default_Handler, /* IRQ:400 */
Default_Handler, /* IRQ:401 */
Default_Handler, /* IRQ:402 */
Default_Handler, /* IRQ:403 */
Default_Handler, /* IRQ:404 */
Default_Handler, /* IRQ:405 */
Default_Handler, /* IRQ:406 */
Default_Handler, /* IRQ:407 */
Default_Handler, /* IRQ:408 */
Default_Handler, /* IRQ:409 */
Default_Handler, /* IRQ:410 */
Default_Handler, /* IRQ:411 */
Default_Handler, /* IRQ:412 */
Default_Handler, /* IRQ:413 */
Default_Handler, /* IRQ:414 */
Default_Handler, /* IRQ:415 */
Default_Handler, /* IRQ:416 */
Default_Handler, /* IRQ:417 */
Default_Handler, /* IRQ:418 */
Default_Handler, /* IRQ:419 */
Default_Handler, /* IRQ:420 */
Default_Handler, /* IRQ:421 */
Default_Handler, /* IRQ:422 */
Default_Handler, /* IRQ:423 */
Default_Handler, /* IRQ:424 */
Default_Handler, /* IRQ:425 */
Default_Handler, /* IRQ:426 */
Default_Handler, /* IRQ:427 */
Default_Handler, /* IRQ:428 */
Default_Handler, /* IRQ:429 */
Default_Handler, /* IRQ:430 */
Default_Handler, /* IRQ:431 */
Default_Handler, /* IRQ:432 */
Default_Handler, /* IRQ:433 */
Default_Handler, /* IRQ:434 */
Default_Handler, /* IRQ:435 */
Default_Handler, /* IRQ:436 */
Default_Handler, /* IRQ:437 */
Default_Handler, /* IRQ:438 */
Default_Handler, /* IRQ:439 */
Default_Handler, /* IRQ:440 */
Default_Handler, /* IRQ:441 */
Default_Handler, /* IRQ:442 */
Default_Handler, /* IRQ:443 */
Default_Handler, /* IRQ:444 */
Default_Handler, /* IRQ:445 */
Default_Handler, /* IRQ:446 */
Default_Handler, /* IRQ:447 */
Default_Handler, /* IRQ:448 */
Default_Handler, /* IRQ:449 */
Default_Handler, /* IRQ:450 */
Default_Handler, /* IRQ:451 */
Default_Handler, /* IRQ:452 */
Default_Handler, /* IRQ:453 */
Default_Handler, /* IRQ:454 */
Default_Handler, /* IRQ:455 */
Default_Handler, /* IRQ:456 */
Default_Handler, /* IRQ:457 */
Default_Handler, /* IRQ:458 */
Default_Handler, /* IRQ:459 */
Default_Handler, /* IRQ:460 */
Default_Handler, /* IRQ:461 */
Default_Handler, /* IRQ:462 */
Default_Handler, /* IRQ:463 */
Default_Handler, /* IRQ:464 */
Default_Handler, /* IRQ:465 */
Default_Handler, /* IRQ:466 */
Default_Handler, /* IRQ:467 */
Default_Handler, /* IRQ:468 */
Default_Handler, /* IRQ:469 */
Default_Handler, /* IRQ:470 */
Default_Handler, /* IRQ:471 */
Default_Handler, /* IRQ:472 */
Default_Handler, /* IRQ:473 */
Default_Handler, /* IRQ:474 */
Default_Handler, /* IRQ:475 */
Default_Handler, /* IRQ:476 */
Default_Handler, /* IRQ:477 */
Default_Handler, /* IRQ:478 */
Default_Handler, /* IRQ:479 */
};
@@ -0,0 +1,24 @@
/* generated vector header file - do not edit */
#ifndef VECTOR_DATA_H
#define VECTOR_DATA_H
/* Number of interrupts allocated */
#ifndef VECTOR_DATA_IRQ_COUNT
#define VECTOR_DATA_IRQ_COUNT (7)
#endif
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
FSP_HEADER
/* ISR prototypes */
void gtm_int_isr(void);
void metal_irq_isr_wrapper(void);
void scif_uart_eri_isr(void);
void scif_uart_bri_isr(void);
void scif_uart_rxi_isr(void);
void scif_uart_txi_isr(void);
void scif_uart_tei_isr(void);
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
FSP_FOOTER
#endif