root/trunk/libffado/src/dice/dice_eap.cpp

Revision 1550, 19.1 kB (checked in by ppalmers, 13 years ago)

- Implement basic HSS1394 support for the Stanton SCS devices
- Start of the implementation of a generic TCAT DICE EAP control
- Reworked part of the busreset / ARM handler code

Line 
1 /*
2  * Copyright (C) 2005-2009 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "dice_avdevice.h"
25
26 #include "dice_eap.h"
27 #include "dice_defines.h"
28
29 #include "libutil/SystemTimeSource.h"
30
31 namespace Dice {
32
33 Device::EAP::EAP(Device &d)
34 : m_device(d)
35 , m_debugModule(d.m_debugModule)
36 {
37 }
38
39 Device::EAP::~EAP()
40 {
41 }
42
43 bool
44 Device::EAP::init() {
45     if(!supportsEAP(m_device)) {
46         debugError("Device does not support EAP");
47         return false;
48     }
49
50     // offsets and sizes are returned in quadlets, but we use byte values
51     if(!readReg(eRT_Base, DICE_EAP_CAPABILITY_SPACE_OFF, &m_capability_offset)) {
52         debugError("Could not initialize m_capability_offset\n");
53         return false;
54     }
55     m_capability_offset *= 4;
56
57     if(!readReg(eRT_Base, DICE_EAP_CAPABILITY_SPACE_SZ, &m_capability_size)) {
58         debugError("Could not initialize m_capability_size\n");
59         return false;
60     }
61     m_capability_size *= 4;
62    
63     if(!readReg(eRT_Base, DICE_EAP_CMD_SPACE_OFF, &m_cmd_offset)) {
64         debugError("Could not initialize m_cmd_offset\n");
65         return false;
66     }
67     m_cmd_offset *= 4;
68
69     if(!readReg(eRT_Base, DICE_EAP_CMD_SPACE_SZ, &m_cmd_size)) {
70         debugError("Could not initialize m_cmd_size\n");
71         return false;
72     }
73     m_cmd_size *= 4;
74    
75     if(!readReg(eRT_Base, DICE_EAP_MIXER_SPACE_OFF, &m_mixer_offset)) {
76         debugError("Could not initialize m_mixer_offset\n");
77         return false;
78     }
79     m_mixer_offset *= 4;
80
81     if(!readReg(eRT_Base, DICE_EAP_MIXER_SPACE_SZ, &m_mixer_size)) {
82         debugError("Could not initialize m_mixer_size\n");
83         return false;
84     }
85     m_mixer_size *= 4;
86    
87     if(!readReg(eRT_Base, DICE_EAP_PEAK_SPACE_OFF, &m_peak_offset)) {
88         debugError("Could not initialize m_peak_offset\n");
89         return false;
90     }
91     m_peak_offset *= 4;
92
93     if(!readReg(eRT_Base, DICE_EAP_PEAK_SPACE_SZ, &m_peak_size)) {
94         debugError("Could not initialize m_peak_size\n");
95         return false;
96     }
97     m_peak_size *= 4;
98    
99     if(!readReg(eRT_Base, DICE_EAP_NEW_ROUTING_SPACE_OFF, &m_new_routing_offset)) {
100         debugError("Could not initialize m_new_routing_offset\n");
101         return false;
102     }
103     m_new_routing_offset *= 4;
104
105     if(!readReg(eRT_Base, DICE_EAP_NEW_ROUTING_SPACE_SZ, &m_new_routing_size)) {
106         debugError("Could not initialize m_new_routing_size\n");
107         return false;
108     }
109     m_new_routing_size *= 4;
110    
111     if(!readReg(eRT_Base, DICE_EAP_NEW_STREAM_CFG_SPACE_OFF, &m_new_stream_cfg_offset)) {
112         debugError("Could not initialize m_new_stream_cfg_offset\n");
113         return false;
114     }
115     m_new_stream_cfg_offset *= 4;
116
117     if(!readReg(eRT_Base, DICE_EAP_NEW_STREAM_CFG_SPACE_SZ, &m_new_stream_cfg_size)) {
118         debugError("Could not initialize m_new_stream_cfg_size\n");
119         return false;
120     }
121     m_new_stream_cfg_size *= 4;
122    
123     if(!readReg(eRT_Base, DICE_EAP_CURR_CFG_SPACE_OFF, &m_curr_cfg_offset)) {
124         debugError("Could not initialize m_curr_cfg_offset\n");
125         return false;
126     }
127     m_curr_cfg_offset *= 4;
128
129     if(!readReg(eRT_Base, DICE_EAP_CURR_CFG_SPACE_SZ, &m_curr_cfg_size)) {
130         debugError("Could not initialize m_curr_cfg_size\n");
131         return false;
132     }
133     m_curr_cfg_size *= 4;
134    
135     if(!readReg(eRT_Base, DICE_EAP_STAND_ALONE_CFG_SPACE_OFF, &m_standalone_offset)) {
136         debugError("Could not initialize m_standalone_offset\n");
137         return false;
138     }
139     m_standalone_offset *= 4;
140
141     if(!readReg(eRT_Base, DICE_EAP_STAND_ALONE_CFG_SPACE_SZ, &m_standalone_size)) {
142         debugError("Could not initialize m_standalone_size\n");
143         return false;
144     }
145     m_standalone_size *= 4;
146    
147     if(!readReg(eRT_Base, DICE_EAP_APP_SPACE_OFF, &m_app_offset)) {
148         debugError("Could not initialize m_app_offset\n");
149         return false;
150     }
151     m_app_offset *= 4;
152
153     if(!readReg(eRT_Base, DICE_EAP_APP_SPACE_SZ, &m_app_size)) {
154         debugError("Could not initialize m_app_size\n");
155         return false;
156     }
157     m_app_size *= 4;
158
159     // initialize the capability info
160     quadlet_t tmp;
161     if(!readReg(eRT_Capability, DICE_EAP_CAPABILITY_ROUTER, &tmp)) {
162         debugError("Could not read router capabilities\n");
163         return false;
164     }
165     m_router_exposed = (tmp >> DICE_EAP_CAP_ROUTER_EXPOSED) & 0x01;
166     m_router_readonly = (tmp >> DICE_EAP_CAP_ROUTER_READONLY) & 0x01;
167     m_router_flashstored = (tmp >> DICE_EAP_CAP_ROUTER_FLASHSTORED) & 0x01;
168     m_router_nb_entries = (tmp >> DICE_EAP_CAP_ROUTER_MAXROUTES) & 0xFFFF;
169
170     if(!readReg(eRT_Capability, DICE_EAP_CAPABILITY_MIXER, &tmp)) {
171         debugError("Could not read mixer capabilities\n");
172         return false;
173     }
174     m_mixer_exposed = (tmp >> DICE_EAP_CAP_ROUTER_EXPOSED) & 0x01;
175     m_mixer_readonly = (tmp >> DICE_EAP_CAP_ROUTER_EXPOSED) & 0x01;
176     m_mixer_flashstored = (tmp >> DICE_EAP_CAP_ROUTER_EXPOSED) & 0x01;
177     m_mixer_input_id = (tmp >> DICE_EAP_CAP_MIXER_IN_DEV) & 0x000F;
178     m_mixer_output_id = (tmp >> DICE_EAP_CAP_MIXER_OUT_DEV) & 0x000F;
179     m_mixer_nb_inputs = (tmp >> DICE_EAP_CAP_MIXER_INPUTS) & 0x00FF;
180     m_mixer_nb_outputs = (tmp >> DICE_EAP_CAP_MIXER_OUTPUTS) & 0x00FF;
181
182     if(!readReg(eRT_Capability, DICE_EAP_CAPABILITY_GENERAL, &tmp)) {
183         debugError("Could not read general capabilities\n");
184         return false;
185     }
186     m_general_support_dynstream = (tmp >> DICE_EAP_CAP_GENERAL_STRM_CFG_EN) & 0x01;
187     m_general_support_flash = (tmp >> DICE_EAP_CAP_GENERAL_FLASH_EN) & 0x01;
188     m_general_peak_enabled = (tmp >> DICE_EAP_CAP_GENERAL_PEAK_EN) & 0x01;
189     m_general_max_tx = (tmp >> DICE_EAP_CAP_GENERAL_MAX_TX_STREAM) & 0x0F;
190     m_general_max_rx = (tmp >> DICE_EAP_CAP_GENERAL_MAX_RX_STREAM) & 0x0F;
191     m_general_stream_cfg_stored = (tmp >> DICE_EAP_CAP_GENERAL_STRM_CFG_FLS) & 0x01;
192     m_general_chip = (tmp >> DICE_EAP_CAP_GENERAL_CHIP) & 0xFFFF;
193
194     return true;
195 }
196
197 void
198 Device::EAP::show() {
199     printMessage("== DICE EAP ==\n");
200     debugOutput(DEBUG_LEVEL_VERBOSE, "Parameter Space info:\n");
201     debugOutput(DEBUG_LEVEL_VERBOSE, " Capability        : offset=%04X size=%06d\n", m_capability_offset, m_capability_size);
202     debugOutput(DEBUG_LEVEL_VERBOSE, " Command           : offset=%04X size=%06d\n", m_cmd_offset, m_cmd_size);
203     debugOutput(DEBUG_LEVEL_VERBOSE, " Mixer             : offset=%04X size=%06d\n", m_mixer_offset, m_mixer_size);
204     debugOutput(DEBUG_LEVEL_VERBOSE, " Peak              : offset=%04X size=%06d\n", m_peak_offset, m_peak_size);
205     debugOutput(DEBUG_LEVEL_VERBOSE, " New Routing Cfg   : offset=%04X size=%06d\n", m_new_routing_offset, m_new_routing_size);
206     debugOutput(DEBUG_LEVEL_VERBOSE, " New Stream Cfg    : offset=%04X size=%06d\n", m_new_stream_cfg_offset, m_new_stream_cfg_size);
207     debugOutput(DEBUG_LEVEL_VERBOSE, " Current Cfg       : offset=%04X size=%06d\n", m_curr_cfg_offset, m_curr_cfg_size);
208     debugOutput(DEBUG_LEVEL_VERBOSE, " Standalone Cfg    : offset=%04X size=%06d\n", m_standalone_offset, m_standalone_size);
209     debugOutput(DEBUG_LEVEL_VERBOSE, " Application Space : offset=%04X size=%06d\n", m_app_offset, m_app_size);
210
211     debugOutput(DEBUG_LEVEL_VERBOSE, "Capabilities:\n");
212     debugOutput(DEBUG_LEVEL_VERBOSE, " Router: %sexposed, %swritable, %sstored, %d routes\n",
213                                      (m_router_exposed?"":"not "),
214                                      (m_router_readonly?"not ":""),
215                                      (m_router_flashstored?"":"not "),
216                                      m_router_nb_entries);
217     debugOutput(DEBUG_LEVEL_VERBOSE, " Mixer : %sexposed, %swritable, %sstored\n",
218                                      (m_mixer_exposed?"":"not "),
219                                      (m_mixer_readonly?"not ":""),
220                                      (m_mixer_flashstored?"":"not "));
221     debugOutput(DEBUG_LEVEL_VERBOSE, "         input id: %d, output id: %d\n", m_mixer_input_id, m_mixer_output_id);
222     debugOutput(DEBUG_LEVEL_VERBOSE, "         nb inputs: %d, nb outputs: %d\n", m_mixer_nb_inputs, m_mixer_nb_outputs);
223     debugOutput(DEBUG_LEVEL_VERBOSE, " General: dynamic stream config %ssupported\n",
224                                      (m_general_support_dynstream?"":"not "));
225     debugOutput(DEBUG_LEVEL_VERBOSE, "          flash load and store %ssupported\n",
226                                      (m_general_support_flash?"":"not "));
227     debugOutput(DEBUG_LEVEL_VERBOSE, "          peak metering %s\n",
228                                      (m_general_peak_enabled?"enabled":"disabled"));
229     debugOutput(DEBUG_LEVEL_VERBOSE, "          stream config %sstored\n",
230                                      (m_general_stream_cfg_stored?"":"not "));
231     debugOutput(DEBUG_LEVEL_VERBOSE, "          max TX streams: %d, max RX streams: %d\n",
232                                      m_general_max_tx, m_general_max_rx);
233
234     if(m_general_chip == DICE_EAP_CAP_GENERAL_CHIP_DICEII) {
235         debugOutput(DEBUG_LEVEL_VERBOSE, "          Chip: DICE-II\n");
236     } else if(m_general_chip == DICE_EAP_CAP_GENERAL_CHIP_DICEMINI) {
237         debugOutput(DEBUG_LEVEL_VERBOSE, "          Chip: DICE Mini (TCD2210)\n");
238     } else if(m_general_chip == DICE_EAP_CAP_GENERAL_CHIP_DICEJR) {
239         debugOutput(DEBUG_LEVEL_VERBOSE, "          Chip: DICE Junior (TCD2220)\n");
240     }
241 }
242
243 // EAP load/store operations
244
245 enum Device::EAP::eWaitReturn
246 Device::EAP::operationBusy() {
247     fb_quadlet_t tmp;
248     if(!readReg(eRT_Command, DICE_EAP_COMMAND_OPCODE, &tmp)) {
249         debugError("Could not read opcode register\n");
250         return eWR_Error;
251     }
252     if( (tmp & DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE) == DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE) {
253         return eWR_Busy;
254     } else {
255         return eWR_Done;
256     }
257 }
258
259 enum Device::EAP::eWaitReturn
260 Device::EAP::waitForOperationEnd(int max_wait_time_ms) {
261     int max_waits = max_wait_time_ms;
262
263     while(max_waits--) {
264         enum eWaitReturn retval = operationBusy();
265         switch(retval) {
266             case eWR_Busy:
267                 break; // not done yet, keep waiting
268             case eWR_Done:
269                 return eWR_Done;
270             case eWR_Error:
271             case eWR_Timeout:
272                 debugError("Error while waiting for operation to end. (%d)\n", retval);
273         }
274         Util::SystemTimeSource::SleepUsecRelative(1000);
275     }
276     return eWR_Timeout;
277 }
278
279 bool
280 Device::EAP::commandHelper(fb_quadlet_t cmd) {
281     // check whether another command is still running
282     if(operationBusy()) {
283         debugError("Other operation in progress\n");
284         return false;
285     }
286
287     // execute the command
288     if(!writeReg(eRT_Command, DICE_EAP_COMMAND_OPCODE, cmd)) {
289         debugError("Could not write opcode register\n");
290         return false;
291     }
292
293     // wait for the operation to end
294     enum eWaitReturn retval = waitForOperationEnd();
295     switch(retval) {
296         case eWR_Done:
297             break; // do nothing
298         case eWR_Timeout:
299             debugWarning("Time-out while waiting for operation to end. (%d)\n", retval);
300             return false;
301         case eWR_Error:
302         case eWR_Busy: // can't be returned
303             debugError("Error while waiting for operation to end. (%d)\n", retval);
304             return false;
305     }
306
307     // check the return value
308     if(!readReg(eRT_Command, DICE_EAP_COMMAND_RETVAL, &cmd)) {
309         debugError("Could not read return value register\n");
310         return false;
311     }
312     if(cmd != 0) {
313         debugWarning("Command failed\n");
314         return false;
315     } else {
316         debugOutput(DEBUG_LEVEL_VERBOSE, "Command successful\n");
317         return true;
318     }
319 }
320
321 bool
322 Device::EAP::loadRouterConfig(bool low, bool mid, bool high) {
323     debugWarning("Untested code\n");
324     fb_quadlet_t cmd = DICE_EAP_CMD_OPCODE_LD_ROUTER;
325     if(low) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_LOW;
326     if(mid) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_MID;
327     if(high) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_HIGH;
328     cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE;
329     return commandHelper(cmd);
330 }
331
332 bool
333 Device::EAP::loadStreamConfig(bool low, bool mid, bool high) {
334     debugWarning("Untested code\n");
335     fb_quadlet_t cmd = DICE_EAP_CMD_OPCODE_LD_STRM_CFG;
336     if(low) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_LOW;
337     if(mid) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_MID;
338     if(high) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_HIGH;
339     cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE;
340     return commandHelper(cmd);
341 }
342
343 bool
344 Device::EAP::loadRouterAndStreamConfig(bool low, bool mid, bool high) {
345     debugWarning("Untested code\n");
346     fb_quadlet_t cmd = DICE_EAP_CMD_OPCODE_LD_RTR_STRM_CFG;
347     if(low) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_LOW;
348     if(mid) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_MID;
349     if(high) cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_HIGH;
350     cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE;
351     return commandHelper(cmd);
352 }
353
354 bool
355 Device::EAP::loadFlashConfig() {
356     debugWarning("Untested code\n");
357     fb_quadlet_t cmd = DICE_EAP_CMD_OPCODE_LD_FLASH_CFG;
358     cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE;
359     return commandHelper(cmd);
360 }
361
362 bool
363 Device::EAP::storeFlashConfig() {
364     debugWarning("Untested code\n");
365     fb_quadlet_t cmd = DICE_EAP_CMD_OPCODE_ST_FLASH_CFG;
366     cmd |= DICE_EAP_CMD_OPCODE_FLAG_LD_EXECUTE;
367     return commandHelper(cmd);
368 }
369
370 // internal I/O operations
371 bool
372 Device::EAP::readReg(enum eRegBase base, unsigned offset, fb_quadlet_t *result) {
373     fb_nodeaddr_t addr = offsetGen(base, offset, 4);
374     return m_device.readReg(addr, result);
375 }
376
377 bool
378 Device::EAP::writeReg(enum eRegBase base, unsigned offset, fb_quadlet_t data) {
379     fb_nodeaddr_t addr = offsetGen(base, offset, 4);
380     return m_device.writeReg(addr, data);
381 }
382
383 bool
384 Device::EAP::readRegBlock(enum eRegBase base, unsigned offset, fb_quadlet_t *data, size_t length) {
385     fb_nodeaddr_t addr = offsetGen(base, offset, length);
386     return m_device.readRegBlock(addr, data, length);
387 }
388
389 bool
390 Device::EAP::writeRegBlock(enum eRegBase base, unsigned offset, fb_quadlet_t *data, size_t length) {
391     fb_nodeaddr_t addr = offsetGen(base, offset, length);
392     return m_device.writeRegBlock(addr, data, length);
393 }
394
395 fb_nodeaddr_t
396 Device::EAP::offsetGen(enum eRegBase base, unsigned offset, size_t length) {
397     fb_nodeaddr_t addr;
398     fb_nodeaddr_t maxlen;
399     switch(base) {
400         case eRT_Base:
401             addr = 0;
402             maxlen = DICE_EAP_MAX_SIZE;
403             break;
404         case eRT_Capability:
405             addr = m_capability_offset;
406             maxlen = m_capability_size;
407             break;
408         case eRT_Command:
409             addr = m_cmd_offset;
410             maxlen = m_cmd_size;
411             break;
412         case eRT_Mixer:
413             addr = m_mixer_offset;
414             maxlen = m_mixer_size;
415             break;
416         case eRT_Peak:
417             addr = m_peak_offset;
418             maxlen = m_peak_size;
419             break;
420         case eRT_NewRouting:
421             addr = m_new_routing_offset;
422             maxlen = m_new_routing_size;
423             break;
424         case eRT_NewStreamCfg:
425             addr = m_new_stream_cfg_offset;
426             maxlen = m_new_stream_cfg_size;
427             break;
428         case eRT_CurrentCfg:
429             addr = m_curr_cfg_offset;
430             maxlen = m_curr_cfg_size;
431             break;
432         case eRT_Standalone:
433             addr = m_standalone_offset;
434             maxlen = m_standalone_size;
435             break;
436         case eRT_Application:
437             addr = m_app_offset;
438             maxlen = m_app_size;
439             break;
440     };
441
442     // out-of-range check
443     if(length > maxlen) {
444         debugError("requested length too large: %d > %d\n", length, maxlen);
445         return DICE_INVALID_OFFSET;
446     }
447     return DICE_EAP_BASE + addr + offset;
448 }
449
450 /**
451  * Check whether a device supports eap
452  * @param d the device to check
453  * @return true if the device supports EAP
454  */
455 bool
456 Device::EAP::supportsEAP(Device &d)
457 {
458     DebugModule &m_debugModule = d.m_debugModule;
459     quadlet_t tmp;
460     if(!d.readReg(DICE_EAP_BASE, &tmp)) {
461         debugOutput(DEBUG_LEVEL_VERBOSE, "Could not read from DICE EAP base address\n");
462         return false;
463     }
464     if(!d.readReg(DICE_EAP_BASE + DICE_EAP_ZERO_MARKER_1, &tmp)) {
465         debugOutput(DEBUG_LEVEL_VERBOSE, "Could not read from DICE EAP zero marker\n");
466         return false;
467     }
468     if(tmp != 0) {
469         debugOutput(DEBUG_LEVEL_VERBOSE, "DICE EAP zero marker not zero\n");
470         return false;
471     }
472     return true;
473 }
474
475 // ----------- Mixer -------------
476 Device::EAP::Mixer::Mixer(EAP &p)
477 : m_parent(p)
478 , m_coeff(NULL)
479 , m_debugModule(p.m_debugModule)
480 {
481 }
482
483 Device::EAP::Mixer::~Mixer()
484 {
485     if (m_coeff) {
486         free(m_coeff);
487         m_coeff = NULL;
488     }
489 }
490
491 bool
492 Device::EAP::Mixer::init()
493 {
494     if(!m_parent.m_mixer_exposed) {
495         debugError("Device does not expose mixer\n");
496         return false;
497     }
498
499     // remove previous coefficient array
500     if(m_coeff) {
501         free(m_coeff);
502         m_coeff = NULL;
503     }
504    
505     // allocate coefficient array
506     int nb_inputs = m_parent.m_mixer_nb_inputs;
507     int nb_outputs = m_parent.m_mixer_nb_outputs;
508
509     m_coeff = (fb_quadlet_t *)calloc(nb_outputs * nb_inputs, sizeof(fb_quadlet_t));
510
511     // load initial values
512     if(!updateCoefficients()) {
513         debugWarning("Could not initialize coefficients\n");
514         return false;
515     }
516    
517     return true;
518 }
519
520 bool
521 Device::EAP::Mixer::updateCoefficients()
522 {
523     if(m_coeff == NULL) {
524         debugError("Coefficients not initialized\n");
525         return false;
526     }
527     int nb_inputs = m_parent.m_mixer_nb_inputs;
528     int nb_outputs = m_parent.m_mixer_nb_outputs;
529     if(!m_parent.readRegBlock(eRT_Mixer, 4, m_coeff, nb_inputs * nb_outputs * 4)) {
530         debugError("Failed to read coefficients\n");
531         return false;
532     }
533     return true;
534 }
535
536 void
537 Device::EAP::Mixer::show()
538 {
539     int nb_inputs = m_parent.m_mixer_nb_inputs;
540     int nb_outputs = m_parent.m_mixer_nb_outputs;
541
542     const size_t bufflen = 4096;
543     char tmp[bufflen];
544     int cnt;
545
546     cnt = 0;
547     cnt += snprintf(tmp+cnt, bufflen-cnt, "%3s ", "");
548     for(int j=0; j<nb_inputs; j++) {
549         cnt += snprintf(tmp+cnt, bufflen-cnt, "%8d ", j);
550     }
551     printMessage("%s\n", tmp);
552
553     // display coefficients
554     for(int i=0; i<nb_outputs; i++) {
555         cnt = 0;
556         cnt += snprintf(tmp+cnt, bufflen-cnt, "%03d: ", i);
557         for(int j=0; j<nb_inputs; j++) {
558             cnt += snprintf(tmp+cnt, bufflen-cnt, "%08X ", *(m_coeff + nb_inputs * i + j));
559         }
560         printMessage("%s\n", tmp);
561     }
562
563 }
564
565 // ----------- Router -------------
566 Device::EAP::Router::Router(EAP &p)
567 : m_parent(p)
568 , m_debugModule(p.m_debugModule)
569 {
570
571 }
572
573 Device::EAP::Router::~Router()
574 {
575 }
576
577 bool
578 Device::EAP::Router::init()
579 {
580     return false;
581 }
582
583 void
584 Device::EAP::Router::show()
585 {
586
587 }
588
589 } // namespace Dice
590
591
592
Note: See TracBrowser for help on using the browser.