Porting VxWorks 7.0 naibrd 2.x SSK to Customer SBC
Overview
The purpose of this document is to identify the changes that will be needed to the VxWorks 7.0 naibrd 2.x package for a Customer’s SBC.
Two packages have been provided:
-
VxWorks 7.0 naibrd 2.x package for NAI’s 75ARM1 SBC – this package is meant to be used as reference when porting to the Customer SBC. NAI has verified and tested this package on the 75ARM1 SBC.
-
VxWorks 7.0 naibrd 2.x package for Customer SBC – parts of this package will need to be modified to support the Customer’s SBC. Note: before changing any code, be sure that this package compiles on the SBC.
The following two files in the Customer SBC will need to be modified:
1. naibsp_memory_imp.c
Customer SBC VxWorks 7.0 naibrd 2.x:
..\base\nai_bsp\naibsp\drivers\memory\imps\naibsp_memory_imp.cNOTE: In this file the following function needs to be modified for the Customer’s SBC. Customer should refer to the VxWorks 7.0 DTB for the memory device for their SBC.
NAILOCAL naibsp_memory_status_t naibsp_memory_Init_ByName_Imp(const naibsp_memory_location_t argLocation,
naibsp_memory_region_t* NAIBSP_RESTRICT p_outRegion,
const char* const NAIBSP_RESTRICT argAttachName,
const char* const NAIBSP_RESTRICT argName,
const naibsp_size_t argAddrOffset,
const naibsp_size_t argSize,
const naibsp_memory_endian_t argEndian,
const naibsp_memory_access_type_t argAccessType)
{
naibsp_memory_status_t tmpStatusReturn = NAIBSP_MEMORY_STATUS_FAILED_NOT_SUPPORTED;
#if (NAIBSP_CONFIG_MEMORY_NAME_SUPPORT == 0U)
(void) argLocation;
(void) p_outRegion;
(void) argAttachName;
(void) argName;
(void) argAddrOffset;
(void) argSize;
(void) argEndian;
(void) argAccessType;
/*
* Named Memory has been disabled
*/
#else
/*
* VxWorks
*/
char deviceName[64] = "/amba/";
void * virtAddr= PMAP_FAILED;
uint32_t phyaddr;
int32_t offset;
int32_t len = 0;
strcat(deviceName, argAttachName);
offset = vxFdtPathOffset(deviceName);
if ((offset <= 0) || (vxFdtDefRegGet((int)offset, 0, (PHYS_ADDR *)&phyaddr, (size_t *)&len) != OK))
{
#if (NAIBSP_CONFIG_OPTIONS_SERVICES_STDIO == 1U)
naibsp_printf("ERROR: Device[ %s ] is not found\n", deviceName);
#endif
tmpStatusReturn = NAIBSP_MEMORY_STATUS_FAILED_INVALID_ATTACH_NAME;
}
else
{
virtAddr = pmapGlobalMap(phyaddr, (size_t) len, VXB_REG_MAP_MMU_ATTR);
tmpStatusReturn = NAIBSP_MEMORY_STATUS_SUCCESS;
}
if (virtAddr == PMAP_FAILED)
{
#if (NAIBSP_CONFIG_OPTIONS_SERVICES_STDIO == 1U)
naibsp_printf("pmapGlobalMap returned ERROR.\n");
#endif
tmpStatusReturn = NAIBSP_MEMORY_STATUS_FAILED_INVALID_LOCATION;
}
else
{
p_outRegion->VirtualAddrOffset_ = argAddrOffset;
p_outRegion->VirtualPtr16_ = (uint16_t*)virtAddr; /*lint -e740 */
p_outRegion->VirtualPtr8_ = (uint8_t*)virtAddr; /*lint -e740 */
p_outRegion->VirtualAddr_ = (uint32_t)virtAddr;
p_outRegion->SizeBytes_ = len;
}
#endif
return tmpStatusReturn;
}NOTE: The
= "/amba/";initializer ofdeviceNameis the part that must be changed to the memory device for the Customer’s SBC.
75ARM1 VxWorks 7.0 naibrd 2.x (reference):
..\base\nai_bsp\naibsp\drivers\memory\imps\naibsp_memory_imp.cNOTE: In the NAI 75ARM1 implementation, the Memory Init function refers to the “/amba/” device which is defined in the VxWorks 7.0 DTB for the 75ARM1.
2. naibsp_pci_imp_customer.c
Customer SBC VxWorks 7.0 naibrd 2.x:
..\base\nai_bsp\naibsp\drivers\pci\imps\customer\naibsp_pci_imp_customer.cNOTE: In this file the following functions need to contain the implementation for the Customer’s SBC. Customer should refer to the VxWorks 7.0 DTB for their SBC.
NAILOCAL naibsp_pci_status_t naibsp_pci_ReadU8_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
uint8_t* const argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}
NAIPUBLIC naibsp_pci_status_t naibsp_pci_ReadU16_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
uint16_t* const argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}
NAILOCAL naibsp_pci_status_t naibsp_pci_ReadU32_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
uint32_t* const argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}
NAILOCAL naibsp_pci_status_t naibsp_pci_WriteU8_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
const uint8_t argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}
NAILOCAL naibsp_pci_status_t naibsp_pci_WriteU16_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
const uint16_t argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}
NAILOCAL naibsp_pci_status_t naibsp_pci_WriteU32_Config_Imp( const naibsp_pci_instance_t argInstance,
const uint32_t argLane,
const uint32_t argBus,
const uint32_t argDevice,
const uint32_t argFunction,
const uint32_t argOffset,
const uint32_t argValue )
{
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE;
return tmpStatus;
}NOTE: The stub bodies (
naibsp_pci_status_t tmpStatus = NAIBSP_PCI_STATUS_NONE; return tmpStatus;) must be replaced with the PCI configuration read/write implementation for the Customer’s SBC.
75ARM1 VxWorks 7.0 naibrd 2.x (reference):
..\base\nai_bsp\naibsp\drivers\pci\imps\zynq7015\naibsp_pci_imp_zynq7015.cNOTE: In the NAI 75ARM1 implementation, the Read/Write APIs refer to the “vxbNaiCpci” device which is defined in the VxWorks 7.0 DTB for the 75ARM1.
Revision History
| Rev | Revision Date | Description | Author |
|---|---|---|---|
| 1 | June 5, 2020 | Initial Release | GC |
| 2 | September 2, 2026 | Markdown edition of this guide, replacing the Rev 1 Word version | FC |
