RTEMS 4.11 AMBA Bus in PolyORB-HI-C
Hi all,
I have been here building a CAN Bus driver for RTEMS 4.11 integrated in TASTE.
I have reached the point where I am able to define in TASTE the interface view and deployment view setting the CAN BUS nodes connected to a bus, and able to compile and generate the binary.
Unfortunately is not tested yet, I hope to do this on Monday and for sure plenty of issues will arrive.
Anyway one that is certain, it the usage of the AMBA bus to register the CAN driver.
In RTEMS 4.11, the AMBA bus is set available through a global variable named ambapp_plb whose type is struct ambapp_bus *amba_bus.
When writing the CAN driver inside po-hi-c, I followed the examples given by eth-leon and the RASTA ones that also use AMBA.
Unfortunately while compiling, I get the error that it does not recognized ambapp_plb.
I have looked into examples in the RASTA, and they don't make much sense to me. They do the following (copied from "…driver_rasta_common.c"):
#ifdef RTEMS48
int apbuart_rasta_register(amba_confarea_type *bus);
static amba_confarea_type abus;
extern LEON3_IrqCtrl_Regs_Map *irq;
extern LEON_Register_Map *regs;
amba_confarea_type* __po_hi_driver_rasta_common_get_bus ()
{
return &abus;
}
#elif RTEMS411
extern int apbuart_rasta_register(struct ambapp_bus *bus);
static struct ambapp_bus abus;
/* Why do we have LEON3 specifics here ???
extern LEON3_IrqCtrl_Regs_Map *irq;
extern LEON_Register_Map *regs;
*/
struct ambapp_bus * __po_hi_driver_rasta_common_get_bus ()
{
return &abus;
}
#else
#error "o<"
#endif *
Strange enough the function seems simply returning a local variable. At the non common rasta files, there is only an extern declaration of the __po_hi_driver_rasta_common_get_bus ().
This works? How do I get the amba bus structure?
For now I did the following… Also made the same extern declarations, and make an explicit call to the …get_bus)= function call inside my init function to get the amba bus structure. But I think it is only returning a local variable with no real pointer to the AMBA bus.
Could please help and confirm the proper solution?
Thank you very much,