2 Commits
Author SHA1 Message Date
Gatsby Van fd9e7f54eb update make file 2024-06-25 11:00:10 +08:00
Gatsby Van f8212892a2 avoid usage of goto` 2024-06-25 10:59:54 +08:00
24 changed files with 217 additions and 176 deletions
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/dev_profile/global_timer_profile.c \
../src/dev_profile/intc_profile.c \
../src/dev_profile/timer_profile.c
../src/dev_profile/timer_profile.c
OBJS += \
./src/dev_profile/global_timer_profile.o \
./src/dev_profile/intc_profile.o \
./src/dev_profile/timer_profile.o
./src/dev_profile/timer_profile.o
C_DEPS += \
./src/dev_profile/global_timer_profile.d \
./src/dev_profile/intc_profile.d \
./src/dev_profile/timer_profile.d
./src/dev_profile/timer_profile.d
# Each subdirectory must supply rules for building sources it contributes
src/dev_profile/%.o: ../src/dev_profile/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+1 -1
View File
@@ -20,7 +20,7 @@ C_DEPS += \
src/systembus/%.o: ../src/systembus/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/geometry/coord.c \
../src/networking/link_layer/geometry/eulerangles.c \
../src/networking/link_layer/geometry/quaternion.c
../src/networking/link_layer/geometry/quaternion.c
OBJS += \
./src/networking/link_layer/geometry/coord.o \
./src/networking/link_layer/geometry/eulerangles.o \
./src/networking/link_layer/geometry/quaternion.o
./src/networking/link_layer/geometry/quaternion.o
C_DEPS += \
./src/networking/link_layer/geometry/coord.d \
./src/networking/link_layer/geometry/eulerangles.d \
./src/networking/link_layer/geometry/quaternion.d
./src/networking/link_layer/geometry/quaternion.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/framing.c \
../src/networking/link_layer/link_layer.c \
@@ -11,7 +11,7 @@ C_SRCS += \
../src/networking/link_layer/scan.c \
../src/networking/link_layer/schdevent.c \
../src/networking/link_layer/service.c \
../src/networking/link_layer/time_sync.c
../src/networking/link_layer/time_sync.c
OBJS += \
./src/networking/link_layer/framing.o \
@@ -21,7 +21,7 @@ OBJS += \
./src/networking/link_layer/scan.o \
./src/networking/link_layer/schdevent.o \
./src/networking/link_layer/service.o \
./src/networking/link_layer/time_sync.o
./src/networking/link_layer/time_sync.o
C_DEPS += \
./src/networking/link_layer/framing.d \
@@ -31,14 +31,14 @@ C_DEPS += \
./src/networking/link_layer/scan.d \
./src/networking/link_layer/schdevent.d \
./src/networking/link_layer/service.d \
./src/networking/link_layer/time_sync.d
./src/networking/link_layer/time_sync.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/phy_layer/phy_antenna.c \
../src/networking/phy_layer/phy_layer.c
../src/networking/phy_layer/phy_layer.c
OBJS += \
./src/networking/phy_layer/phy_antenna.o \
./src/networking/phy_layer/phy_layer.o
./src/networking/phy_layer/phy_layer.o
C_DEPS += \
./src/networking/phy_layer/phy_antenna.d \
./src/networking/phy_layer/phy_layer.d
./src/networking/phy_layer/phy_layer.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+6 -6
View File
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
LD_SRCS += \
../src/lscript.ld
../src/lscript.ld
C_SRCS += \
../src/main.c \
../src/system_monitor.c
../src/system_monitor.c
OBJS += \
./src/main.o \
./src/system_monitor.o
./src/system_monitor.o
C_DEPS += \
./src/main.d \
./src/system_monitor.d
./src/system_monitor.d
# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+5 -5
View File
@@ -2,22 +2,22 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/time_ctrl/time_ctrl.c
../src/time_ctrl/time_ctrl.c
OBJS += \
./src/time_ctrl/time_ctrl.o
./src/time_ctrl/time_ctrl.o
C_DEPS += \
./src/time_ctrl/time_ctrl.d
./src/time_ctrl/time_ctrl.d
# Each subdirectory must supply rules for building sources it contributes
src/time_ctrl/%.o: ../src/time_ctrl/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+5 -5
View File
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/util/circ_queue.c \
../src/util/clist.c \
../src/util/common.c \
../src/util/crc.c \
../src/util/list.c \
../src/util/util.c
../src/util/util.c
OBJS += \
./src/util/circ_queue.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/util/common.o \
./src/util/crc.o \
./src/util/list.o \
./src/util/util.o
./src/util/util.o
C_DEPS += \
./src/util/circ_queue.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/util/common.d \
./src/util/crc.d \
./src/util/list.d \
./src/util/util.d
./src/util/util.d
# Each subdirectory must supply rules for building sources it contributes
src/util/%.o: ../src/util/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+41 -25
View File
@@ -278,7 +278,7 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
* @param InstPtr A double pointer to MPC instance.
* @param config A pointer to MPC configurations.
*
* @return None.
* @return Error code.
*
******************************************************************************/
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
@@ -290,7 +290,7 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
(*instPtr) = malloc(sizeof(MPC));
if ((*instPtr) == NULL)
{
return FAILURE;
return ENOMEM;
}
(*instPtr)->rxQueue = NULL;
(*instPtr)->txQueue = NULL;
@@ -307,14 +307,15 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
bramConfigPtr = XBram_LookupConfig(config->bramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&mpcBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -322,7 +323,8 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
Status = XBram_SelfTest(&mpcBram, 0);
if (Status != SUCCESS)
{
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return Status;
}
mpcHwConfig.txBuffAddr = mpcBram.Config.MemBaseAddress;
@@ -332,32 +334,47 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
Status = MpcHw_Init(&((*instPtr)->mpchwDesc), &mpcHwConfig);
if (Status != SUCCESS)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->isEnable = false; // nothing received.
(*instPtr)->isRxDone = false; // nothing received.
(*instPtr)->isTxDone = true; // nothing to be sent.
return SUCCESS;
mpc_init_error:
free((*instPtr)->mpchwDesc);
free((*instPtr)->txQueue);
free((*instPtr)->rxQueue);
free(*instPtr);
return Status;
}
/*****************************************************************************/
/**
* @brief Destroy MPC instance.
*
* @param InstPtr A pointer to MPC instance.
*
* @return None.
*
******************************************************************************/
void Mpc_Destroy(MPC *instPtr)
{
if (instPtr == NULL)
{
return;
}
free(instPtr->mpchwDesc);
free(instPtr->txQueue);
free(instPtr->rxQueue);
free(instPtr);
}
/*****************************************************************************/
/**
* @brief Generate a remote test response message.
@@ -534,17 +551,16 @@ int32_t Mpc_RxIrqHandler(MPC *instPtr)
Status = MpcHw_Recv(instPtr->mpchwDesc, mpcReq);
if (Status != SUCCESS)
{
goto recv_error;
DBG_ERROR("SystemBus::RX error!\n");
free(mpcReq);
return Status;
}
if (CircQueuePush(instPtr->rxQueue, (void *)mpcReq) == false)
{
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
Status = EQUEUE;
goto recv_error;
free(mpcReq);
return EQUEUE;
}
instPtr->isRxDone = false; // another reception is undergoing.
return SUCCESS;
recv_error:
free(mpcReq);
return Status;
}
+1
View File
@@ -52,6 +52,7 @@ typedef struct
/************************** Function Prototypes ******************************/
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config);
void Mpc_Destroy(MPC *instPtr);
int32_t Mpc_HandleCmd(MPC *instPtr);
int32_t Mpc_PendRemoteTest(MPC *instPtr);
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/dev_profile/ad9361_profile.c \
../src/dev_profile/ad9361_reg_profile.c \
../src/dev_profile/global_timer_profile.c \
../src/dev_profile/hmc7044_profile.c \
../src/dev_profile/intc_profile.c \
../src/dev_profile/timer_profile.c
../src/dev_profile/timer_profile.c
OBJS += \
./src/dev_profile/ad9361_profile.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/dev_profile/global_timer_profile.o \
./src/dev_profile/hmc7044_profile.o \
./src/dev_profile/intc_profile.o \
./src/dev_profile/timer_profile.o
./src/dev_profile/timer_profile.o
C_DEPS += \
./src/dev_profile/ad9361_profile.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/dev_profile/global_timer_profile.d \
./src/dev_profile/hmc7044_profile.d \
./src/dev_profile/intc_profile.d \
./src/dev_profile/timer_profile.d
./src/dev_profile/timer_profile.d
# Each subdirectory must supply rules for building sources it contributes
src/dev_profile/%.o: ../src/dev_profile/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/geometry/coord.c \
../src/networking/link_layer/geometry/eulerangles.c \
../src/networking/link_layer/geometry/quaternion.c
../src/networking/link_layer/geometry/quaternion.c
OBJS += \
./src/networking/link_layer/geometry/coord.o \
./src/networking/link_layer/geometry/eulerangles.o \
./src/networking/link_layer/geometry/quaternion.o
./src/networking/link_layer/geometry/quaternion.o
C_DEPS += \
./src/networking/link_layer/geometry/coord.d \
./src/networking/link_layer/geometry/eulerangles.d \
./src/networking/link_layer/geometry/quaternion.d
./src/networking/link_layer/geometry/quaternion.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/framing.c \
../src/networking/link_layer/link_layer.c \
@@ -11,7 +11,7 @@ C_SRCS += \
../src/networking/link_layer/scan.c \
../src/networking/link_layer/schdevent.c \
../src/networking/link_layer/service.c \
../src/networking/link_layer/time_sync.c
../src/networking/link_layer/time_sync.c
OBJS += \
./src/networking/link_layer/framing.o \
@@ -21,7 +21,7 @@ OBJS += \
./src/networking/link_layer/scan.o \
./src/networking/link_layer/schdevent.o \
./src/networking/link_layer/service.o \
./src/networking/link_layer/time_sync.o
./src/networking/link_layer/time_sync.o
C_DEPS += \
./src/networking/link_layer/framing.d \
@@ -31,14 +31,14 @@ C_DEPS += \
./src/networking/link_layer/scan.d \
./src/networking/link_layer/schdevent.d \
./src/networking/link_layer/service.d \
./src/networking/link_layer/time_sync.d
./src/networking/link_layer/time_sync.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/phy_layer/phy_antenna.c \
../src/networking/phy_layer/phy_layer.c
../src/networking/phy_layer/phy_layer.c
OBJS += \
./src/networking/phy_layer/phy_antenna.o \
./src/networking/phy_layer/phy_layer.o
./src/networking/phy_layer/phy_layer.o
C_DEPS += \
./src/networking/phy_layer/phy_antenna.d \
./src/networking/phy_layer/phy_layer.d
./src/networking/phy_layer/phy_layer.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+1 -1
View File
@@ -26,7 +26,7 @@ C_DEPS += \
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+5 -5
View File
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/systembus/systembus.c \
../src/systembus/systembus_uart.c
../src/systembus/systembus_uart.c
OBJS += \
./src/systembus/systembus.o \
./src/systembus/systembus_uart.o
./src/systembus/systembus_uart.o
C_DEPS += \
./src/systembus/systembus.d \
./src/systembus/systembus_uart.d
./src/systembus/systembus_uart.d
# Each subdirectory must supply rules for building sources it contributes
src/systembus/%.o: ../src/systembus/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+5 -5
View File
@@ -2,22 +2,22 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/time_ctrl/time_ctrl.c
../src/time_ctrl/time_ctrl.c
OBJS += \
./src/time_ctrl/time_ctrl.o
./src/time_ctrl/time_ctrl.o
C_DEPS += \
./src/time_ctrl/time_ctrl.d
./src/time_ctrl/time_ctrl.d
# Each subdirectory must supply rules for building sources it contributes
src/time_ctrl/%.o: ../src/time_ctrl/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
arm-none-eabi-gcc -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
arm-none-eabi-gcc -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
+5 -5
View File
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/util/circ_queue.c \
../src/util/clist.c \
../src/util/common.c \
../src/util/crc.c \
../src/util/list.c \
../src/util/util.c
../src/util/util.c
OBJS += \
./src/util/circ_queue.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/util/common.o \
./src/util/crc.o \
./src/util/list.o \
./src/util/util.o
./src/util/util.o
C_DEPS += \
./src/util/circ_queue.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/util/common.d \
./src/util/crc.d \
./src/util/list.d \
./src/util/util.d
./src/util/util.d
# Each subdirectory must supply rules for building sources it contributes
src/util/%.o: ../src/util/%.c
@echo 'Building file: $<'
@echo 'Invoking: ARM v7 gcc compiler'
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
@@ -470,6 +470,12 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
// Clear random content
memset(*instPtr, 0x00, sizeof(L2_INST));
(*instPtr)->sendPktData = NULL;
(*instPtr)->recvPktData = NULL;
(*instPtr)->schdEventPool = NULL;
(*instPtr)->nodeList = NULL;
(*instPtr)->scanFSM = NULL;
(*instPtr)->serviceFSM = NULL;
memcpy(&((*instPtr)->config), config, sizeof(L2_CONFIG));
// Packet buffer
@@ -477,15 +483,15 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
if ((*instPtr)->sendPktData == NULL)
{
DBG_ERROR("Allocate memory for sendPktData failed.\n");
Status = ENOMEM;
goto init_error;
Linklayer_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->recvPktData = calloc(L2_PACK_LEN_MAX / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->recvPktData == NULL)
{
DBG_ERROR("Allocate memory for recvPktData failed.\n");
Status = ENOMEM;
goto init_error;
Linklayer_Destroy(*instPtr);
return ENOMEM;
}
// Reset basic info
(*instPtr)->netStartTime = NET_START_TIME_INFTY;
@@ -528,32 +534,33 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
if (Status != SUCCESS)
{
DBG_ERROR("L2_CreateSchedEventPool runs failed, with error code: %" PRId32 ".\n", Status);
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
Status = L2_NodeList_Init(&((*instPtr)->nodeList));
if (Status != SUCCESS)
{
DBG_ERROR("NodeList_Init runs failed, with error code: %" PRId32 ".\n", Status);
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
Status = L2_Scan_Init(&((*instPtr)->scanFSM));
if (Status != SUCCESS)
{
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
Status = L2_Service_Init(&((*instPtr)->serviceFSM));
if (Status != SUCCESS)
{
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
return SUCCESS;
init_error:
Linklayer_Destroy(*instPtr);
return Status;
}
/*****************************************************************************/
@@ -637,7 +644,10 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
******************************************************************************/
void Linklayer_Destroy(L2_INST *instPtr)
{
ASSERT(instPtr != NULL);
if (instPtr == NULL)
{
return;
}
free(instPtr->sendPktData);
free(instPtr->recvPktData);
// Destroy FSMs and nodeList
@@ -796,7 +796,6 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{
ASSERT(instPtr != NULL);
L2_TOR_TYPE torState;
int32_t Status;
const NODE_ENTRY *commNode;
PHY_INST *phyRef = instPtr->config.phyInstPtr;
DBG_INFO("-------- Scan Routine --------\n");
@@ -856,8 +855,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD && torState == L2_TOR_TX)
{
DBG_ERROR("Only head node can send init-scan Frame.\n");
Status = FAILURE;
goto routine_err;
return FAILURE;
}
L2_SetupNextSlot(instPtr, torState, L2_SCAN_FRAME);
break;
@@ -868,14 +866,12 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
{
DBG_ERROR("Only head node can send ADV Frame.\n");
Status = FAILURE;
goto routine_err;
return FAILURE;
}
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
if (ScanMsg_Packing(instPtr, L2_ADV_FRAME, rtneEntry->dst) != SUCCESS)
{
Status = FAILURE;
goto routine_err;
return FAILURE;
}
}
/* Antenna setting (reserved.) */
@@ -896,8 +892,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
if (ScanMsg_Packing(instPtr, L2_CFM_FRAME, rtneEntry->dst) != SUCCESS)
{
Status = FAILURE;
goto routine_err;
return FAILURE;
}
}
/* Antenna setting (reserved.) */
@@ -905,12 +900,9 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
break;
default:
DBG_ERROR("Cannot start a routine for slot type [%" PRId8 "] properly.\n", rtneEntry->slotType);
Status = FAILURE;
goto routine_err;
return FAILURE;
}
return SUCCESS;
routine_err:
return Status;
}
/** @} LinkLayer_Scan*/
@@ -439,14 +439,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
bramConfigPtr = XBram_LookupConfig(phyConfig->antBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&antConfigBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -454,20 +455,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&antConfigBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
bramConfigPtr = XBram_LookupConfig(phyConfig->txBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&txDataBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -475,20 +478,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&txDataBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
bramConfigPtr = XBram_LookupConfig(phyConfig->rxBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&rxDataBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -496,7 +501,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&rxDataBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
(*instPtr)->antConfigAddr = antConfigBram.Config.MemBaseAddress;
@@ -510,14 +516,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
bramConfigPtr = XBram_LookupConfig(phyConfig->antInfoBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&antInfoBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver self test.
@@ -525,7 +532,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&antInfoBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
(*instPtr)->antInfoAddr = antInfoBram.Config.MemBaseAddress;
uint32_t phyMainCtrl = PhyRead(*instPtr, PHY_MAIN_CTRL);
@@ -545,8 +553,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
xadcConfigPtr = XAdcPs_LookupConfig(phyConfig->hwXadcId);
if (xadcConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
XAdcPs_CfgInitialize(&((*instPtr)->hwXadc), xadcConfigPtr, xadcConfigPtr->BaseAddress);
@@ -554,36 +562,37 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XAdcPs_SelfTest(&((*instPtr)->hwXadc));
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/* Disable the Channel Sequencer before configuring the Sequence registers. */
XAdcPs_SetSequencerMode(&((*instPtr)->hwXadc), XADCPS_SEQ_MODE_SAFE);
#else
(*instPtr)->antConfigAddr = NULL;
(*instPtr)->recvDataAddr = NULL;
(*instPtr)->sendDataAddr = NULL;
(*instPtr)->antConfigAddr = (uintptr_t)calloc(L1_ANTCONFIG_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->antConfigAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
(*instPtr)->recvDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->recvDataAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
(*instPtr)->sendDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->sendDataAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
#endif
return SUCCESS;
init_error:
Phy_Destroy(*instPtr);
return Status;
}
/*****************************************************************************/
+34 -20
View File
@@ -658,7 +658,7 @@ int32_t SystemBus_MakeResp(SYSBUS *instPtr)
* @param InstPtr A double pointer to System Bus instance.
* @param config A pointer to System Bus configurations.
*
* @return None.
* @return Error code.
*
******************************************************************************/
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
@@ -670,7 +670,7 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
(*instPtr) = malloc(sizeof(SYSBUS));
if ((*instPtr) == NULL)
{
return FAILURE;
return ENOMEM;
}
(*instPtr)->rxQueue = NULL;
(*instPtr)->txQueue = NULL;
@@ -684,29 +684,45 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
Status = SysbusUart_Init(&((*instPtr)->uartInst), &uartConfig);
if (Status != SUCCESS)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->isRxDone = false; // nothing received.
(*instPtr)->isTxDone = true; // nothing to be sent.
return SUCCESS;
}
sysbus_init_error:
free((*instPtr)->uartInst);
free((*instPtr)->txQueue);
free((*instPtr)->rxQueue);
free(*instPtr);
return Status;
/*****************************************************************************/
/**
* @brief Destroy System Bus instance.
*
* @param InstPtr A pointer to System Bus instance.
*
* @return None.
*
******************************************************************************/
void SystemBus_Destroy(SYSBUS *instPtr)
{
if (instPtr == NULL)
{
return;
}
free(instPtr->uartInst);
free(instPtr->txQueue);
free(instPtr->rxQueue);
free(instPtr);
}
/*****************************************************************************/
@@ -748,19 +764,17 @@ int32_t SystemBus_RxIntrHandler(SYSBUS *instPtr)
Status = SysbusUart_Recv(instPtr->uartInst, sysbusReq);
if (Status != SUCCESS)
{
goto recv_error;
free(sysbusReq);
return Status;
}
if (CircQueuePush(instPtr->rxQueue, (void *)sysbusReq) == false)
{
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
Status = EQUEUE;
goto recv_error;
free(sysbusReq);
return EQUEUE;
}
instPtr->isRxDone = false; // another reception is undergoing.
return SUCCESS;
recv_error:
free(sysbusReq);
return Status;
}
/** @} SystemBus*/
+1
View File
@@ -60,6 +60,7 @@ typedef struct
/************************** Function Prototypes ******************************/
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config);
void SystemBus_Destroy(SYSBUS *instPtr);
/**
* @defgroup SystemBus_Protocol_Routine
+3 -5
View File
@@ -54,7 +54,7 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
ASSERT(q != NULL);
CIRC_QUEUE *queue;
queue = malloc(sizeof(CIRC_QUEUE));
if (!queue)
if (queue == NULL)
{
return false;
}
@@ -65,16 +65,14 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
queue->data = malloc(queueCapacity * sizeof(void *));
if (queue->data == NULL)
{
goto error;
free(queue);
return false;
}
queue->bounds = queueCapacity;
queue->nelts = 0;
queue->in = 0;
queue->out = 0;
return true;
error:
free(queue);
return false;
}
/**