AnsweredAssumed Answered

Mlme_Main return value

Question asked by Roy Versteeg on Jun 17, 2010
Latest reply on Jun 22, 2010 by Roy Versteeg



I'm trying to make an application that uses de 802.15.4 MacPhy on the freescale MC13224, but I don't want to use the complete freescale beekit MAC codebase.


I tried removing a lot of code-files generated by the beekit to get some idea of how the MacPhy.a library works, but I'm having some difficulties understanding how I should call Mlme_Main. The NwkMacInterface.h file says the following


/************************************************************************************* MAC main function. Must be called by the NWK loop until it returns FALSE. The * function will examine the MAC input queues, and handle incoming/outgoing* MAC/MCPS messages.*   * Interface assumptions:*   None*   * Return value:*   TRUE if there are more messages for the Mlme_Main function process.*   FALSE otherwise.* ************************************************************************************///bool_t Mlme_Main(uint16_t events);void Mlme_Main(event_t events);



So the bool_t version is commented out, but it seems that is the one I need. So i commented the function returning a void and use the one returning an bool_t.


The problem I'm having is that it always returns TRUE, even if I haven't sent any message to the MAC layer.


I'm having some other concerns as to the dependency's of MACPHY.a as it has a dependancy to the gbTaskMode, gMacTaskID_c, TS_SendEvent, TMR_StartTimer, TMR_IsTimerActive, TMR_StopTimer and TMR_AllocateTimer.


I call Init_802_15_4(FALSE) so the global gbTaskMode variable is set to FALSE ( because i don't want to use the TS )


When I call MacPhyInit_Initialize this triggers an TMR_AllocateTimer(), but no timers are started, so that should not be a problem.


But now I'm still not sure how I should use Mlme_Main without using the Timer and TaskScheduler module from freescale. And I can't seem to find any documentation for that.


My Main in MApp_init now looks like this


uint32_t mlme_mainCalls = 0x00;void Main(void){  InterruptInit();  IntDisableAll();  Platform_Init();    /* Don't use TS for MAC*/  Init_802_15_4(FALSE);    for(;;) {    DelayMs(1000);    while(Mlme_Main(0)) {      mlme_mainCalls++;    }            }}




Can somebody help me?