wireless networks lab – application queue api

13
Wireless Networks Lab – Application Queue API 2007/10/17

Upload: raya-waters

Post on 31-Dec-2015

34 views

Category:

Documents


1 download

DESCRIPTION

Wireless Networks Lab – Application Queue API. 2007/10/17. Environment. When you build up your environment in Lab1 BoardAPI FontalBSP FontalButton, FontalLED HardwareAPI Stack – 802.15.4 MAC Application Queue API Service Access Point – AppApi.h - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Wireless Networks  Lab – Application Queue API

Wireless Networks Lab – Application Queue API

2007/10/17

Page 2: Wireless Networks  Lab – Application Queue API

Environment

When you build up your environment in Lab1 BoardAPI FontalBSP

FontalButton, FontalLED

HardwareAPI Stack – 802.15.4 MAC

Application Queue APIService Access Point – AppApi.h

Access functions and structures used by the application to interact with the Jennic 802.15.4 stack

Page 3: Wireless Networks  Lab – Application Queue API

Application API

u32AppApiInit Communication from the MAC up to the ap

plication or network layer Callback routines implemented by the upper la

yer Registered with the MAC

A general interrupt handler can be registered during the initialization of the application API

Page 4: Wireless Networks  Lab – Application Queue API

MLME/MCPS to NWK

Page 5: Wireless Networks  Lab – Application Queue API

MAC/NWK layer interface

Page 6: Wireless Networks  Lab – Application Queue API

Application Queue API

The Application Queue API handles interrupts coming from The MAC sub-layer of the IEEE 802.15.4 stack The integrated peripherals of the wireless

microcontroller The API implements a queue for each of three

types of interruptMCPS (MAC Data Services) interrupts coming from the

stack MLME (MAC Management Services) interrupts coming

from the stackHardware interrupts coming from the hardware drivers

Page 7: Wireless Networks  Lab – Application Queue API

Application Queue API

The Application Queue API allows callbacks to be defined by the application As with the normal IEEE 802.15.4 Stack A

PI

Page 8: Wireless Networks  Lab – Application Queue API

u32AppQApiInit

u32AppQApiInit Init the Application Queue API, as well as t

he underlying 802.15.4 Stack API The function creates there queues

MLME indications and confirmationsMCPS indications and confirmationsIntegrated Peripherals API indications

The function refers to callback functions for the three queues

Page 9: Wireless Networks  Lab – Application Queue API

Polling Queue MLME

PUBLIC MAC_MlmeDcfmInd_s *psAppQApiReadMlmeInd(void);

PUBLIC void vAppQApiReturnMlmeIndBuffer(MAC_MlmeDcfmInd_s *psBuffer);Return MLME buffer previously passed

MCPS PUBLIC MAC_McpsDcfmInd_s *psAppQApiRead

McpsInd(void); PUBLIC void vAppQApiReturnMcpsIndBuffer(MA

C_McpsDcfmInd_s *psBuffer);Return MCPS buffer previously passed

Page 10: Wireless Networks  Lab – Application Queue API

Polling Queue

typedef struct

{

uint32 u32DeviceId;

uint32 u32ItemBitmap;

} AppQApiHwInd_s;

Allows the application to return a hardware event buffer previously passed up to the application from the Integrated Peripherals API

Once returned, the buffer can be re-used to store and pass another message

Page 11: Wireless Networks  Lab – Application Queue API

Lab3 sample codePRIVATE void InitSystem(void){

u32AHI_Init();

u32AppQApiInit(NULL, NULL, vTickTimerISR);

led_init();led_on(LED0);led_on(LED1);

vAHI_TickTimerConfigure(E_AHI_TICK_TIMER_RESTART);vAHI_TickTimerWrite(0);vAHI_TickTimerInterval((16*1000*1000) / 2);vAHI_TickTimerIntEnable(TRUE);

}

Page 12: Wireless Networks  Lab – Application Queue API

Lab3 sample code

PUBLIC void AppColdStart(void){InitSystem();while (TRUE);

}

PRIVATE void vTickTimerISR(void) {led_toggle(LED0);

}

Page 13: Wireless Networks  Lab – Application Queue API

Lab

Using the Application Queue API to achieve the requirement of Lab2’s bonus part

Bonus Let the CPU really sleep if the Tick Timer ti

meoutNot only turn of the LEDs

Using WakeTimer to wake up CPUIntegrated Peripherals API

You can only get this bonus before 9:45PM