Skip to content
colognechip edited this page Jun 7, 2017 · 1 revision

Howto write mISDN layer1 drivers

  • hwskel is a base skeleton implementation of a layer1 mISDN driver.
  • It can register several mISDN ports, and act like an S0 interface having a Cross connector plugged, so all data layer2 sends down to layer1 are looped back immediately.
  • hwskel shows what it takes to register an mISDN interface, and how messaging with layer2 is done.

Source code

compile hwskel

in mISDN/Makefile: uncomment line

CONFIGS+=CONFIG_MISDN_HWSKEL=m

and run:

make && make modules_install

load hwskel

modprobe mISDN_hwskel

with module parameter numports=n you can create more than one hwskel interface

test data loop

using testlayer1, you can check if your virtual ISDN device is registered properly

testlayer1 --d --b1 --b2

function description

  • setup_instance() register mISDN interface at mISDN_core
  • release_instance() release mISDN interface at mISDN_core
  • ph_state(): handle a physical state change (S0 bus), such as ACTIVATE_INDICATION
    • ph_state_te(): handle state changes for TE (Terminal Equipment)
    • ph_state_nt(): handle state changes for NT (Network Terminator)
  • layer2 entry callback entry points:
    • hwskel_dctrl(): device control (open channel, etc)
    • hwskel_bctrl(): Bchannel control (close channel, set PCM settings, etc)
    • hwskel_l2l1D(): main layer2 D-Channel entry point for PH_DATA_REQ, PH_ACTIVATE_REQ, PH_DEACTIVATE_REQ
    • hwskel_l2l1B(): main layer2 B-Channel entry point for PH_DATA_REQ, PH_ACTIVATE_REQ, PH_DEACTIVATE_REQ
  • layer1 meta module callback
    • hwskel_l1callback() receives callbacks from the layer1 helper instance created via create_l1(). This instance cares about common layer1 jobs, e.g. Activation Timers (T3/T4), etc.
  • hwskel_ph_command(): wraps physical bus commands to perform e.g. S0 bus activation/deactivation