Step-by-step Usage Instructions
|Top Previous Next|
1. Make sure you have the SOCK library in your project.
2. Add pppoe.tbs and pppoe.tbh files to your project (they are in current_library_set\pppoe\trunk).
3. Add #define PPPOE_DEBUG_PRINT 1 to the defines section of the global.tbh file of your project. This way you will "see what's going on". Don't forget to remove this later, after you've made sure that the library operates as expected.
4. Add include "pppoe\trunk\pppoe.tbh" to the includes section of the global.tbh file.
7. Create empty callback function bodies (presumably in the device.tbs): callback_pppoe_ok(), callback_pppoe_failure(), callback_pppoe_pre_buffrq(). Hint: copy from declarations in the pppoe.tbh or from our code example.
8. Call pppoe_start() from somewhere. The no-brainer decision is to call from the on_sys_init() event handler. Supply correct ADSL login and password (suggestion: use STG library to keep them). Note that pppoe_start() may fail, so it is wise to check the returned status code.
9. Implement meaningful code for the callback_pppoe_ok(). Once it is called, you know that your PPPoE interface is up.
All of the above is illustrated in the code example.
The PPPOE library expects the pppoe_proc_timer() to be called at 0.5 sec intervals. This is the default value which can be changed through the sys.onsystimerperiod property. If your project needs to have the on_sys_timer() event at a different rate, please make sure that pppoe_proc_timer() is still called 2 times/second. For example, if the on_sys_timer() is set to trigger 4 times/second, you need to add "divider" code that only calls pppoe_proc_timer() on every second invocation of the on_sys_timer().