📄 readme.arch
字号:
Linmodem architecture Copyright (c) 2000 Fabrice Bellard1) Overview:-----------The hardware dependent layer (for example lmreal.c, lmsim.c,lmsoundcard.c) must call the functionvoid sm_process(struct sm_state *sm, s16 *output, s16 *input, int nb_samples);at least every 10 ms. It must supply 'nb_samples' 16 bit input samplesat 8000 Hz. The function sm_process returns the 'output' samples ithas computed. These samples can them be sent to the phone line.'sm_process' handles the dialing, ring detection and Vxx protocolinitization. Then, each protocol can supply a similar function. Forexample, 'v8.c' supplies the function:int V8_process(V8State *sm, s16 *output, s16 *input, int nb_samples);It returns the modulation to which the modem must go after the V8phase.Note that no threads are used. It implies that each 'xx_process'function must use an internal state machine. The first parameter('V8State' here) is usually the structure in which the state isstored.2) Timing:---------The protocols must use only 'nb_samples' as a timing, not the realtime of the system. It allows to simulate the whole modem withoutchanging anything.3) Reentrancy:-------------Each protocol must be reentrant, so that multiple modems can beinstanciated at the same time. It is needed for example to dosimulations.4) Data handling:----------------When a protocol gets a bit from the input samples, it should can a function int get_bit(void *opaque);provided at its initialization with the opaque parameter 'opaque'. Thesame should be done for output with :void put_bit(void *opaque, int bit);'sm_process' instanciate each protocol by giving it one of itsstandard bit I/O functions. These functions are responsible fromhandling the higher level protocol (asynchronous, LAPM, V42bis).See the file 'serial.c' to see how the data can be handled. V42/V42bisshould be added the same way.The decoded bytes are put in the FIFO sm->rx_fifo. This fifo is thenreturn to the modem tty. The inverse is done with sm->tx_fifo.5) Modem configuration:----------------------The configuration parameters are defined in 'lm.c'. See 'structLinModemConfig default_lm_config'.6) Linmodem harware interface:-----------------------------See the file lmsoundcard.c which gives an example to interface to asound card with the Open Sound System API. 7) Linmodem kernel interface:----------------------------The hardware interface to an actual modem is not completely definedyet. However, it will be very close to the Open Sound System API:- the write() & read() syscalls write & read 16 bit samples from themodem.- An ioctl can select the sampling rate (at least 8000 Hz must beavailable). - an ioctl set/reset the offhook relay.- an ioctl set/reset the pulse relay.- an ioctl gives the state of the ring detection. Each time the ring rings, the event POLLPRI (urgent data) should be set so that the poll() syscall can handle it.- an ioctl changes the input & output gains, as the volume for a sound card.8) AT command parser:--------------------See the file atparse.c: The parser must remain sample. We do not wantto support all the AT commands, but only the minimal subset so thatlinux programs can work : 'chat' for PPP, 'mgetty/vgetty' forvoice/data/fax calls, 'sendfax' to send faxes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -