Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
augustofg committed Jan 14, 2021
2 parents 2a9a553 + c067cb7 commit a7b9bc3
Show file tree
Hide file tree
Showing 24 changed files with 287 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(CMAKE_ERROR_FLAGS "-Wall -Wextra -Wpointer-arith -Wno-packed-bitfield-compat

# Build specific flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ERROR_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -DDEBUG")
set(CMAKE_C_FLAGS_DEBUG "-Og -g3 -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-Os")

# When we break up long strings in CMake we get semicolon
Expand Down
2 changes: 1 addition & 1 deletion boot/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ void update_firmware( void )
}
}

//erase_sector( UPGRADE_FLASH_START_SECTOR , UPGRADE_FLASH_END_SECTOR );
erase_sector( UPGRADE_FLASH_START_SECTOR , UPGRADE_FLASH_END_SECTOR );
}
7 changes: 7 additions & 0 deletions linker/LPC1764_app.ld
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ MEMORY
__top_RamAHB16 = 0x2007c000 + 16K;

ENTRY(ResetISR)
EXTERN(NMI_Handler)
EXTERN(HardFault_Handler)
EXTERN(MemManage_Handler)
EXTERN(BusFault_Handler)
EXTERN(UsageFault_Handler)

SECTIONS
{
Expand Down Expand Up @@ -155,4 +160,6 @@ SECTIONS

PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc16 - 0);
/* Add 6 to the sum to compensate for the lacking of the less significant bit (thumb mode) */
PROVIDE(_VectorChecksum = 0 - (_vStackTop + ResetISR + NMI_Handler + HardFault_Handler + MemManage_Handler + BusFault_Handler + UsageFault_Handler + 6 ));
}
7 changes: 7 additions & 0 deletions linker/LPC1764_boot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ MEMORY
__top_RamAHB16 = 0x2007c000 + 16K;

ENTRY(ResetISR)
EXTERN(NMI_Handler)
EXTERN(HardFault_Handler)
EXTERN(MemManage_Handler)
EXTERN(BusFault_Handler)
EXTERN(UsageFault_Handler)

SECTIONS
{
Expand Down Expand Up @@ -147,4 +152,6 @@ SECTIONS

PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc16 - 0);
/* Add 6 to the sum to compensate for the lacking of the less significant bit (thumb mode) */
PROVIDE(_VectorChecksum = 0 - (_vStackTop + ResetISR + NMI_Handler + HardFault_Handler + MemManage_Handler + BusFault_Handler + UsageFault_Handler + 6 ));
}
7 changes: 7 additions & 0 deletions linker/LPC1769_app.ld
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ MEMORY
__top_RamAHB16 = 0x2007c000 + 32K;

ENTRY(ResetISR)
EXTERN(NMI_Handler)
EXTERN(HardFault_Handler)
EXTERN(MemManage_Handler)
EXTERN(BusFault_Handler)
EXTERN(UsageFault_Handler)

SECTIONS
{
Expand Down Expand Up @@ -155,4 +160,6 @@ SECTIONS

PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc16 - 0);
/* Add 6 to the sum to compensate for the lacking of the less significant bit (thumb mode) */
PROVIDE(_VectorChecksum = 0 - (_vStackTop + ResetISR + NMI_Handler + HardFault_Handler + MemManage_Handler + BusFault_Handler + UsageFault_Handler + 6 ));
}
7 changes: 7 additions & 0 deletions linker/LPC1769_boot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ MEMORY
__top_RamAHB16 = 0x2007c000 + 32K;

ENTRY(ResetISR)
EXTERN(NMI_Handler)
EXTERN(HardFault_Handler)
EXTERN(MemManage_Handler)
EXTERN(BusFault_Handler)
EXTERN(UsageFault_Handler)

SECTIONS
{
Expand Down Expand Up @@ -147,4 +152,6 @@ SECTIONS

PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc16 - 0);
/* Add 6 to the sum to compensate for the lacking of the less significant bit (thumb mode) */
PROVIDE(_VectorChecksum = 0 - (_vStackTop + ResetISR + NMI_Handler + HardFault_Handler + MemManage_Handler + BusFault_Handler + UsageFault_Handler + 6 ));
}
20 changes: 2 additions & 18 deletions modules/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,9 @@
#include "i2c.h"
#include "i2c_mapping.h"

/**
* @brief Number of I2C peripheral buses that are being controlled
* @note This value is contabilized at compile time and may change from board to board. Check the board's i2c_mapping.c file for more info
*
* @see i2c_mapping.c
*/
#define I2C_MUX_COUNT (sizeof(i2c_mux) / sizeof(i2c_mux_state_t))

/**
* @brief Number of I2C Chips that are being controlled
* @note This value is contabilized at compile time and may change from board to board. Check the board's i2c_mapping.c file for more info
*
* @see i2c_mapping.c
*/
#define I2C_CHIP_MAP_COUNT (sizeof(i2c_chip_map)/sizeof(i2c_chip_mapping_t))

void i2c_init( void )
{
for ( uint8_t i = 0; i < sizeof(i2c_mux)/sizeof(i2c_mux_state_t); i++ ) {
for ( uint8_t i = 0; i < I2C_MUX_CNT; i++ ) {
i2c_mux[i].semaphore = xSemaphoreCreateBinary();
vI2CConfig( i2c_mux[i].i2c_interface, SPEED_100KHZ );
xSemaphoreGive( i2c_mux[i].semaphore );
Expand Down Expand Up @@ -101,7 +85,7 @@ bool i2c_take_by_busid( uint8_t bus_id, uint8_t *i2c_interface, TickType_t timeo

bool i2c_take_by_chipid( uint8_t chip_id, uint8_t *i2c_address, uint8_t *i2c_interface, uint32_t timeout )
{
if ( chip_id > I2C_CHIP_MAP_COUNT ) {
if ( chip_id > I2C_BUS_CNT ) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions modules/ipmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ void IPMB_RXTask ( void *pvParameters )
/* Seq number checking is enough to match the messages */
if ( current_msg_rx->buffer.seq == last_sent_req->buffer.seq ) {
ipmb_notify_client ( current_msg_rx );
} else {
vPortFree(current_msg_rx);
}
/* If we received a response that doesn't match a previously sent request, just discard it */
} else {
vPortFree(current_msg_rx);
}

}else {
Expand Down
15 changes: 15 additions & 0 deletions modules/ipmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,18 @@ IPMI_HANDLER(ipmi_picmg_cmd_get_fru_control_capabilities, NETFN_GRPEXT, IPMI_PIC
rsp->data_len = len;
rsp->completion_code = IPMI_CC_OK;
}

IPMI_HANDLER(ipmi_custom_cmd_get_free_heap, NETFN_CUSTOM, IPMI_CUSTOM_CMD_MMC_GET_FREE_HEAP, ipmi_msg *req, ipmi_msg *rsp)
{
uint8_t len = rsp->data_len = 0;

uint32_t free_heap = xPortGetFreeHeapSize();

rsp->data[len++] = free_heap & 0xFF;
rsp->data[len++] = (free_heap >> 8) & 0xFF;
rsp->data[len++] = (free_heap >> 16) & 0xFF;
rsp->data[len++] = (free_heap >> 24) & 0xFF;

rsp->data_len = len;
rsp->completion_code = IPMI_CC_OK;
}
10 changes: 10 additions & 0 deletions modules/ipmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,16 @@
* @}
*/

/**
* @defgroup IPMI_CUSTOM_CMD IPMI Commands - Custom (0x32)
* @ingroup IPMI_CMD
* @{
*/
#define IPMI_CUSTOM_CMD_MMC_GET_FREE_HEAP 0x01
/**
* @}
*/

#define IPMI_EVENT_MESSAGE_REV 0x04

/**
Expand Down
1 change: 1 addition & 0 deletions modules/rtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "led.h"
#include "board_led.h"

volatile bool rtm_present;
extern EventGroupHandle_t rtm_payload_evt;

void RTM_Manage( void * Parameters )
Expand Down
2 changes: 1 addition & 1 deletion modules/rtm.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "rtm_user.h"

volatile bool rtm_present;
extern volatile bool rtm_present;

/**
* @brief Initialize RTM Manage task
Expand Down
3 changes: 3 additions & 0 deletions modules/sdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

volatile uint8_t sdr_count = 0;

sensor_t *sdr_head = NULL;
sensor_t *sdr_tail = NULL;

static uint16_t reservationID;
static uint32_t sdr_change_count;

Expand Down
8 changes: 4 additions & 4 deletions modules/sdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ typedef struct sensor_t {
} sensor_t;

extern volatile uint8_t sdr_count;
sensor_t *sdr_head;
sensor_t *sdr_tail;
extern sensor_t *sdr_head;
extern sensor_t *sdr_tail;

const SDR_type_12h_t SDR0;
const SDR_type_12h_t SDR_RTM_DEV_LOCATOR;
extern const SDR_type_12h_t SDR0;
extern const SDR_type_12h_t SDR_RTM_DEV_LOCATOR;

#define GET_SENSOR_TYPE(sensor) ((SDR_type_01h_t *)sensor->sdr)->sensortype

Expand Down
6 changes: 3 additions & 3 deletions port/board/afc-bpm/v3_0/i2c_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ enum {
#define I2C_BUS_CNT 7
#define I2C_CHIP_CNT 28

i2c_mux_state_t i2c_mux[I2C_MUX_CNT];
i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT];
i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT];
extern i2c_mux_state_t i2c_mux[];
extern i2c_bus_mapping_t i2c_bus_map[];
extern i2c_chip_mapping_t i2c_chip_map[];

#endif
2 changes: 1 addition & 1 deletion port/board/afc-bpm/v3_0/payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/**
* @brief Payload state machine state numbers
*/
enum {
extern enum {
PAYLOAD_NO_POWER = 0,
PAYLOAD_SWITCHING_ON,
PAYLOAD_POWER_GOOD_WAIT,
Expand Down
6 changes: 3 additions & 3 deletions port/board/afc-bpm/v3_1/i2c_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ enum {
#define I2C_BUS_CNT 7
#define I2C_CHIP_CNT 28

i2c_mux_state_t i2c_mux[I2C_MUX_CNT];
i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT];
i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT];
extern i2c_mux_state_t i2c_mux[];
extern i2c_bus_mapping_t i2c_bus_map[];
extern i2c_chip_mapping_t i2c_chip_map[];

#endif
2 changes: 1 addition & 1 deletion port/board/afc-bpm/v3_1/payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/**
* @brief Payload state machine state numbers
*/
enum {
extern enum {
PAYLOAD_NO_POWER = 0,
PAYLOAD_POWER_GOOD_WAIT,
PAYLOAD_STATE_FPGA_SETUP,
Expand Down
6 changes: 3 additions & 3 deletions port/board/afc-timing/i2c_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ enum {
#define I2C_BUS_CNT 7
#define I2C_CHIP_CNT 28

i2c_mux_state_t i2c_mux[I2C_MUX_CNT];
i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT];
i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT];
extern i2c_mux_state_t i2c_mux[I2C_MUX_CNT];
extern i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT];
extern i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT];

#endif
2 changes: 1 addition & 1 deletion port/board/afc-timing/payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/**
* @brief Payload state machine state numbers
*/
enum {
extern enum {
PAYLOAD_NO_POWER = 0,
PAYLOAD_POWER_GOOD_WAIT,
PAYLOAD_STATE_FPGA_SETUP,
Expand Down
1 change: 1 addition & 0 deletions port/ucontroller/nxp/lpc17xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_compile_options( -Wno-switch -Wno-unused-but-set-variable )
set(UCONTROLLER_SRCS
${LPC17XX_PATH}/cr_startup_lpc175x_6x.c
${LPC17XX_PATH}/sysinit.c
${LPC17XX_PATH}/faults.c
)

set(UCONTROLLER_HDRS
Expand Down
3 changes: 2 additions & 1 deletion port/ucontroller/nxp/lpc17xx/cr_startup_lpc175x_6x.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ extern int main(void);
//*****************************************************************************
extern void _vStackTop(void);

extern void _VectorChecksum(void);
//*****************************************************************************
#if defined (__cplusplus)
} // extern "C"
Expand All @@ -164,7 +165,7 @@ void (* const g_pfnVectors[])(void) = {
MemManage_Handler, // The MPU fault handler
BusFault_Handler, // The bus fault handler
UsageFault_Handler, // The usage fault handler
0, // Reserved
&_VectorChecksum, // VectorChecksum
0, // Reserved
0, // Reserved
0, // Reserved
Expand Down
Loading

0 comments on commit a7b9bc3

Please sign in to comment.