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

Revision 1569, 19.1 kB (checked in by holin, 13 years ago)

tidy up

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