1 /*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
4 *
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 static char const n8_id[] = "$Id: n8_system.c,v 1.2 2014/03/25 16:19:14 christos Exp $";
36 /*****************************************************************************/
37 /** @file n8_system.c
38 * @brief Implements the API call N8_GetSystemParameter, which allows users to
39 * query the system for characteristics as defined in the enumeration
40 * N8_Parameter_t.
41 *****************************************************************************/
42
43 /*****************************************************************************
44 * Revision history:
45 *
46 * 05/16/03 brr Eliminate obsolete include file.
47 * 03/10/03 brr Added N8_INITIALIZE_INFO parameter to N8_GetSystemParameter.
48 * 03/02/03 bac Added support for N8_HARDWAREREVISION.
49 * 07/08/02 brr Added N8_FILEDESCRIPTOR parameter to N8_GetSystemParameter.
50 * 04/05/02 brr Added N8_SWVERSIONTEXT parameter to N8_GetSystemParameter.
51 * 04/03/02 brr Use version identification from n8_version.h. Also added
52 * N8_PrintSoftwareVersion api call to print version info.
53 * 02/25/02 brr Updated for 2.1 release. Use a single call to obtain driver
54 * information & removed all QMgr references.
55 * 10/30/01 hml First working version.
56 * 06/10/01 mel Original version.
57 ****************************************************************************/
58 /** @defgroup SystemInfo System Parameter retrieval
59 */
60
61 #include "n8_util.h"
62 #include "n8_API_Initialize.h"
63 #include "n8_device_info.h"
64 #include "n8_version.h"
65
66 static N8_Status_t setCount(N8_Buffer_t *value_p, N8_Status_t type);
67 static N8_Status_t setType(N8_Buffer_t *value_p, N8_Status_t type);
68 static N8_Status_t setNumberOfChips(N8_Buffer_t *value_p);
69 static N8_Status_t setHWversion(N8_Buffer_t *value_p);
70 static N8_Status_t setHWrevision(N8_Buffer_t *value_p);
71 static N8_Status_t setSWversion(N8_Buffer_t *value_p);
72 static N8_Status_t setContextSize(N8_Buffer_t *value_p);
73 static N8_Status_t setSKSsize(N8_Buffer_t *value_p);
74 static N8_Status_t setSWversionText(N8_Buffer_t *value_p, size_t value_l);
75 static N8_Status_t setFD(N8_Buffer_t *value_p);
76 static N8_Status_t setInitInfo(N8_Buffer_t *value_p);
77
78 extern NSPdriverInfo_t nspDriverInfo;
79
80 /*****************************************************************************
81 * N8_GetSystemParameter
82 *****************************************************************************/
83 /** @ingroup SystemInfo
84 * @brief Allows the caller to determine the value of various NSP2000 and API
85 * system and configuration values.
86 *
87 * The configuration parameter desired is determined by the value specified in
88 * Parameter. Note that the hash units are currently being treated the same
89 * as the EA units since the NSP2000 does not have a separate hash core.
90 *
91 * @param parameter RO: A constant naming the configuration value to
92 * return.
93 * @param value_p WO: A pointer to where to return the value(s) of the
94 * requested system parameter. The format (type) of
95 * what is returned depends on the value of
96 * Parameter.
97 *
98 * @return
99 * returnResult - returns N8_STATUS_OK if successful or Error value.
100 * @par Errors
101 * N8_INVALID_ENUM - The value of Parameter is not one of the
102 * defined valid configuration enumerations.
103 * N8_INVALID_OBJECT The output parameter is NULL.
104 * @par Assumptions
105 * None<br>
106 *****************************************************************************/
N8_GetSystemParameter(N8_Parameter_t parameter,void * value_p,size_t value_l)107 N8_Status_t N8_GetSystemParameter(N8_Parameter_t parameter, void *value_p,
108 size_t value_l)
109 {
110 N8_Status_t ret = N8_STATUS_OK;
111
112 DBG(("N8_GetSystemParameter\n"));
113 do
114 {
115 ret = N8_preamble();
116 CHECK_RETURN(ret);
117
118 /* verify value object */
119 CHECK_OBJECT(value_p, ret);
120
121 switch (parameter)
122 {
123 case N8_EACOUNT:
124 ret = setCount(value_p, N8_EA);
125 break;
126 case N8_EATYPE:
127 ret = setType(value_p, N8_EA);
128 break;
129 case N8_PKCOUNT:
130 ret = setCount(value_p, N8_PKP);
131 break;
132 case N8_PKTYPE:
133 ret = setType(value_p, N8_PKP);
134 break;
135 case N8_HPCOUNT:
136 ret = setCount(value_p, N8_EA);
137 break;
138 case N8_HPTYPE:
139 ret = setType(value_p, N8_EA);
140 break;
141 case N8_HARDWAREVERSION:
142 ret = setHWversion(value_p);
143 break;
144 case N8_HARDWAREREVISION:
145 ret = setHWrevision(value_p);
146 break;
147 case N8_SOFTWAREVERSION:
148 ret = setSWversion(value_p);
149 break;
150 case N8_CONTEXTMEMSIZE:
151 ret = setContextSize(value_p);
152 break;
153 case N8_SKSMEMSIZE:
154 ret = setSKSsize(value_p);
155 break;
156 case N8_NUMBEROFCHIPS:
157 ret = setNumberOfChips(value_p);
158 break;
159 case N8_SWVERSIONTEXT:
160 ret = setSWversionText(value_p, value_l);
161 break;
162 case N8_INITIALIZE_INFO:
163 ret = setInitInfo(value_p);
164 break;
165 case N8_FILEDESCRIPTOR:
166 ret = setFD(value_p);
167 break;
168 default:
169 /* invalid parameter */
170 DBG(("Invalid parameter\n"));
171 DBG(("N8_GetSystemParameter - return Error\n"));
172 ret = N8_INVALID_ENUM;
173 break;
174 } /* switch */
175 }while (FALSE);
176 DBG(("N8_GetSystemParameter - OK\n"));
177 return ret;
178 } /* N8_GetSystemParameter */
179
180
181 /*****************************************************************************
182 * setCount
183 *****************************************************************************/
184 /** @ingroup SystemInfo
185 * @brief Get the count of units.
186 *
187 * Currently all of the hardware or emulation types have only one unit of any
188 * type. As soon as this ceases to be true, we will need to call the driver
189 * function N8_GetConfigurationItem or depend on knowledge of the
190 * hardware type being stored in the QueueControl structure.
191 *
192 *
193 * @param value_p WO: Pointer in which to store the number of units.
194 *
195 * @par Externals:
196 * None.
197 *
198 * @return
199 * N8_STATUS_OK: The function worked correctly.
200 * N8_INVALID_OBJECT: The output pointer is NULL.
201 * N8_UNEXPECTED_ERROR: The hardware type in one of the queues
202 * was not recognized.
203 *
204 * @par Errors:
205 * N8_INVALID_OBJECT and N8_UNEXPECTED_ERROR as described in the
206 * return section.
207 *
208 *
209 * @par Locks:
210 * None.
211 *
212 * @par Assumptions:
213 * This function can not be called until the initialization of the API
214 * is complete.
215 *****************************************************************************/
216
setCount(N8_Buffer_t * value_p,N8_Component_t type)217 static N8_Status_t setCount(N8_Buffer_t *value_p, N8_Component_t type)
218 {
219 N8_Status_t ret = N8_STATUS_OK;
220 int nStructs;
221 unsigned int nDevices = 0;
222 int i;
223
224 DBG(("setCount\n"));
225 do
226 {
227 CHECK_OBJECT(value_p, ret);
228
229 nStructs = nspDriverInfo.numChips;
230
231 for (i = 0; i < nStructs; i++)
232 {
233
234 switch (nspDriverInfo.chipInfo[i].hardwareType)
235 {
236 /* Note that all of these devices have only one unit
237 per device. This may well change with future devices.
238 */
239 case N8_FPGA:
240 case N8_BM:
241 case N8_NSP2000_HW:
242 nDevices ++;
243 break;
244 default:
245 ret = N8_UNEXPECTED_ERROR;
246 }
247 }
248 CHECK_RETURN(ret);
249
250 }while (FALSE);
251
252 DBG(("setCount - OK\n"));
253
254 if (ret == N8_STATUS_OK)
255 {
256 memcpy(value_p, &nDevices, sizeof(int));
257 }
258 return ret;
259 } /* setCount */
260
261 /*****************************************************************************
262 * setType
263 *****************************************************************************/
264 /** @ingroup SystemInfo
265 * @brief Get types of units.
266 *
267 * Currently all of the hardware or emulation types have only one unit of any
268 * type. When this ceases to be true, we will need to revisit this call.
269 *
270 * @param value_p WO: Pointer in which to store unit types.
271 *
272 * @par Externals:
273 * None.
274 *
275 * @return
276 * N8_STATUS_OK: The function worked correctly.
277 * N8_INVALID_OBJECT: The output pointer is NULL.
278 * N8_UNEXPECTED_ERROR: The hardware type in one of the queues
279 * was not recognized.
280 *
281 * @par Errors:
282 * N8_INVALID_OBJECT and N8_UNEXPECTED_ERROR as described in the
283 * return section.
284 *
285 *
286 * @par Locks:
287 * None.
288 *
289 * @par Assumptions:
290 * This function can not be called until the initialization of the API
291 * is complete. The value_p pointer points to a "reasonable" array.
292 *****************************************************************************/
293
setType(N8_Buffer_t * value_p,N8_Component_t type)294 static N8_Status_t setType(N8_Buffer_t *value_p, N8_Component_t type)
295 {
296 N8_Status_t ret = N8_STATUS_OK;
297 int nStructs;
298 int i;
299 unsigned int *vPtr_p;
300
301 DBG(("setType\n"));
302 do
303 {
304 CHECK_OBJECT(value_p, ret);
305
306 nStructs = nspDriverInfo.numChips;
307
308 vPtr_p = (unsigned int *)value_p;
309
310 for (i = 0; i < nStructs; i++)
311 {
312 switch (nspDriverInfo.chipInfo[i].hardwareType)
313 {
314 /* Note that all of these devices have only one unit
315 per device. This may well change with future devices.
316 */
317 case N8_FPGA:
318 case N8_BM:
319 *vPtr_p = N8_NSP2000EMULATED;
320 break;
321 case N8_NSP2000_HW:
322 *vPtr_p = N8_NSP2000;
323 break;
324 default:
325 ret = N8_UNEXPECTED_ERROR;
326 }
327 vPtr_p ++;
328 }
329 CHECK_RETURN(ret);
330
331 }while (FALSE);
332
333 DBG(("setType - OK\n"));
334
335 return ret;
336 } /* setType */
337 /*****************************************************************************
338 * setHWversion
339 *****************************************************************************/
340 /** @ingroup SystemInfo
341 * @brief Gets the hardware version or returns an emulation type for each
342 * chip or emulation thereof in the current system.
343 *
344 * @param value_p WO: Pointer in which to store chip types.
345 *
346 * @par Externals:
347 * None.
348 *
349 * @return
350 * N8_STATUS_OK: The function worked correctly.
351 * N8_INVALID_OBJECT: The output pointer is NULL.
352 * N8_UNEXPECTED_ERROR: The hardware type in one of the queues
353 * was not recognized.
354 *
355 * @par Errors:
356 * N8_INVALID_OBJECT and N8_UNEXPECTED_ERROR as described in the
357 * return section.
358 *
359 *
360 * @par Locks:
361 * None.
362 *
363 * @par Assumptions:
364 * This function can not be called until the initialization of the API
365 * is complete. The value_p pointer points to a "reasonable" array.
366 *****************************************************************************/
setHWversion(N8_Buffer_t * value_p)367 static N8_Status_t setHWversion(N8_Buffer_t *value_p)
368 {
369 N8_Status_t ret = N8_STATUS_OK;
370 int nStructs;
371 int i;
372 unsigned int *vPtr_p;
373
374 DBG(("setHWversion\n"));
375 do
376 {
377 CHECK_OBJECT(value_p, ret);
378
379 nStructs = nspDriverInfo.numChips;
380
381 vPtr_p = (unsigned int *) value_p;
382
383 for (i = 0; i < nStructs; i++)
384 {
385 switch (nspDriverInfo.chipInfo[i].hardwareType)
386 {
387 /* Note that we only care to know whether or not there is real
388 hardware for this queue.
389 */
390 case N8_FPGA:
391 case N8_BM:
392 *vPtr_p = N8_NSP2000EMULATED;
393 break;
394 case N8_NSP2000_HW:
395 *vPtr_p = nspDriverInfo.chipInfo[i].HardwareVersion;
396 break;
397 default:
398 ret = N8_UNEXPECTED_ERROR;
399 }
400 vPtr_p ++;
401 }
402 CHECK_RETURN(ret);
403
404 }while (FALSE);
405
406 DBG(("setHWversion - OK\n"));
407
408 return ret;
409 } /* setHWversion */
410
411 /*****************************************************************************
412 * setHWrevision
413 *****************************************************************************/
414 /** @ingroup SystemInfo
415 * @brief Gets the hardware revision from the PCI interface. This value is the
416 * same as returned by 'lspci' under Linux.
417 *
418 * @param value_p WO: Pointer in which to store chip types.
419 *
420 * @par Externals:
421 * None.
422 *
423 * @return
424 * N8_STATUS_OK: The function worked correctly.
425 * N8_INVALID_OBJECT: The output pointer is NULL.
426 * N8_UNEXPECTED_ERROR: The hardware type in one of the queues
427 * was not recognized.
428 *
429 * @par Errors:
430 * N8_INVALID_OBJECT and N8_UNEXPECTED_ERROR as described in the
431 * return section.
432 *
433 * @par Locks:
434 * None.
435 *
436 * @par Assumptions:
437 * This function can not be called until the initialization of the API
438 * is complete. The value_p pointer points to a "reasonable" array.
439 *****************************************************************************/
setHWrevision(N8_Buffer_t * value_p)440 static N8_Status_t setHWrevision(N8_Buffer_t *value_p)
441 {
442 N8_Status_t ret = N8_STATUS_OK;
443 int nStructs;
444 int i;
445 unsigned int *vPtr_p;
446
447 DBG(("setHWrevision\n"));
448 do
449 {
450 CHECK_OBJECT(value_p, ret);
451
452 nStructs = nspDriverInfo.numChips;
453
454 vPtr_p = (unsigned int *) value_p;
455
456 for (i = 0; i < nStructs; i++)
457 {
458 *vPtr_p = (unsigned int) nspDriverInfo.chipInfo[i].RevisionID;
459 vPtr_p ++;
460 }
461
462 } while (FALSE);
463
464 DBG(("setHWrevision - OK\n"));
465
466 return ret;
467 } /* setHWrevision */
468
469 /*****************************************************************************
470 * setSWVersion
471 *****************************************************************************/
472 /** @ingroup SystemInfo
473 * @brief Get the current version of the software.
474 *
475 * This function returns the current major and minor revision numbers of the
476 * SDK as specified by the N8_MAJOR_REVISION and N8_MINOR_REVISION #defines
477 * at the top of this file. When the software revision is changed, change
478 * these defines.
479 *
480 * @param value_p WO: Pointer in which to store revision info.
481 *
482 * @par Externals:
483 * None.
484 *
485 * @return
486 * N8_STATUS_OK: The function worked correctly.
487 * N8_INVALID_OBJECT: The output pointer is NULL.
488 *
489 * @par Errors:
490 * N8_INVALID_OBJECT as described in the return section.
491 *
492 * @par Locks:
493 * None.
494 *
495 * @par Assumptions:
496 * This function can not be called until the initialization of the API
497 * is complete. The value_p pointer points to a "reasonable" location.
498 *****************************************************************************/
setSWversion(N8_Buffer_t * value_p)499 static N8_Status_t setSWversion(N8_Buffer_t *value_p)
500 {
501 N8_Status_t ret = N8_STATUS_OK;
502 unsigned int version = 0;
503
504 DBG(("setSWversion\n"));
505 do
506 {
507 CHECK_OBJECT(value_p, ret);
508 version = N8_VERSION;
509 memcpy(value_p, &version, sizeof(unsigned int));
510 }while (FALSE);
511 DBG(("setSWversion - OK\n"));
512 return ret;
513 } /* setSWversion */
514
515 /*****************************************************************************
516 * setContextSize
517 *****************************************************************************/
518 /** @ingroup SystemInfo
519 * @brief Get the sizes of the context memory for all EA units.
520 *
521 * Currently all of the hardware or emulation types have only one unit of any
522 * type. When this ceases to be true, we will need to revisit this call.
523 *
524 * @param value_p WO: Pointer in which to store unit types.
525 *
526 * @par Externals:
527 * None.
528 *
529 * @return
530 * N8_STATUS_OK: The function worked correctly.
531 * N8_INVALID_OBJECT: The output pointer is NULL.
532 *
533 * @par Errors:
534 * N8_INVALID_OBJECT as described in the return section.
535 *
536 *
537 * @par Locks:
538 * None.
539 *
540 * @par Assumptions:
541 * This function can not be called until the initialization of the API
542 * is complete. The value_p pointer points to a "reasonable" array.
543 *****************************************************************************/
setContextSize(N8_Buffer_t * value_p)544 static N8_Status_t setContextSize(N8_Buffer_t *value_p)
545 {
546 N8_Status_t ret = N8_STATUS_OK;
547 int nStructs;
548 int i;
549 unsigned long *vPtr_p;
550
551 DBG(("setContextSize\n"));
552 do
553 {
554 CHECK_OBJECT(value_p, ret);
555
556 nStructs = nspDriverInfo.numChips;
557
558 vPtr_p = (unsigned long *) value_p;
559
560 for (i = 0; i < nStructs; i++)
561 {
562 memcpy(vPtr_p, &nspDriverInfo.chipInfo[i].contextMemsize, sizeof(int));
563 vPtr_p ++;
564 }
565 CHECK_RETURN(ret);
566 }while (FALSE);
567
568 DBG(("setContextSize - OK\n"));
569 return ret;
570 } /* setContextSize */
571
572 /*****************************************************************************
573 * setSKSsize
574 *****************************************************************************/
575 /** @ingroup SystemInfo
576 * @brief Get the sizes of the SKS memory for all PKP units.
577 *
578 * Currently all of the hardware or emulation types have only one unit of any
579 * type. When this ceases to be true, we will need to revisit this call.
580 *
581 * @param value_p WO: Pointer in which to store unit types.
582 *
583 * @par Externals:
584 * None.
585 *
586 * @return
587 * N8_STATUS_OK: The function worked correctly.
588 * N8_INVALID_OBJECT: The output pointer is NULL.
589 *
590 * @par Errors:
591 * N8_INVALID_OBJECT as described in the return section.
592 *
593 *
594 * @par Locks:
595 * None.
596 *
597 * @par Assumptions:
598 * This function can not be called until the initialization of the API
599 * is complete. The value_p pointer points to a "reasonable" array.
600 *****************************************************************************/
setSKSsize(N8_Buffer_t * value_p)601 static N8_Status_t setSKSsize(N8_Buffer_t *value_p)
602 {
603 N8_Status_t ret = N8_STATUS_OK;
604 int nStructs;
605 int i;
606 unsigned long *vPtr_p;
607
608 DBG(("setSKSSize\n"));
609 do
610 {
611 CHECK_OBJECT(value_p, ret);
612
613 nStructs = nspDriverInfo.numChips;
614
615 vPtr_p = (unsigned long *)value_p;
616
617 for (i = 0; i < nStructs; i++)
618 {
619 memcpy(vPtr_p, &nspDriverInfo.chipInfo[i].SKS_size, sizeof(unsigned long));
620 vPtr_p ++;
621 }
622 CHECK_RETURN(ret);
623 }while (FALSE);
624
625 DBG(("setSKSSize - OK\n"));
626 return ret;
627 } /* setSKSsize */
628
629 /*****************************************************************************
630 * setNumberOfChips
631 *****************************************************************************/
632 /** @ingroup SystemInfo
633 * @brief Get the number of chips on the system.
634 *
635 * Because we also want to include the number of "emulated" chips on the system,
636 * we can simply return the number of control structures on the system.
637 *
638 * @param value_p WO: Pointer in which to store unit types.
639 *
640 * @par Externals:
641 * None.
642 *
643 * @return
644 * N8_STATUS_OK: The function worked correctly.
645 * N8_INVALID_OBJECT: The output pointer is NULL.
646 *
647 * @par Errors:
648 * N8_INVALID_OBJECT as described in the return section.
649 *
650 *
651 * @par Locks:
652 * None.
653 *
654 * @par Assumptions:
655 * This function can not be called until the initialization of the API
656 * is complete. The value_p pointer points to a "reasonable" memory location.
657 *****************************************************************************/
setNumberOfChips(N8_Buffer_t * value_p)658 static N8_Status_t setNumberOfChips(N8_Buffer_t *value_p)
659 {
660 N8_Status_t ret = N8_STATUS_OK;
661 int nStructs;
662
663 DBG(("setNumberOfChips\n"));
664
665 nStructs = nspDriverInfo.numChips;
666
667 DBG(("setNumberOfChips - OK\n"));
668 memcpy(value_p, &nStructs, sizeof(int));
669
670 return ret;
671 } /* setNumberOfChips */
672
673 /*****************************************************************************
674 * setSWversionText
675 *****************************************************************************/
676 /** @ingroup SystemInfo
677 * @brief Returns a text string that describes this version of the SDK library.
678 *
679 * @param NONE
680 *
681 * @return
682 * ret - always returns N8_STATUS_OK.
683 *
684 * @par Errors
685 *
686 * @par Assumptions
687 * None<br>
688 *****************************************************************************/
setSWversionText(N8_Buffer_t * value_p,size_t value_l)689 N8_Status_t setSWversionText(N8_Buffer_t *value_p, size_t value_l)
690 {
691 snprintf(value_p, value_l, N8_VERSION_STRING);
692 return N8_STATUS_OK;
693 } /* setSWversionText */
694
695 /*****************************************************************************
696 * setFD
697 *****************************************************************************/
698 /** @ingroup SystemInfo
699 * @brief Get the file descriptor for the NSP2000
700 *
701 * This function returns the file descriptor for the NSP2000 device.
702 *
703 * @param value_p WO: Pointer in which to store revision info.
704 *
705 * @par Externals:
706 * None.
707 *
708 * @return
709 * N8_STATUS_OK: The function worked correctly.
710 * N8_INVALID_OBJECT: The output pointer is NULL.
711 *
712 * @par Errors:
713 * N8_INVALID_OBJECT as described in the return section.
714 *
715 * @par Locks:
716 * None.
717 *
718 * @par Assumptions:
719 * This function can not be called until the initialization of the API
720 * is complete. The value_p pointer points to a "reasonable" location.
721 *****************************************************************************/
setFD(N8_Buffer_t * value_p)722 static N8_Status_t setFD(N8_Buffer_t *value_p)
723 {
724 N8_Status_t ret = N8_STATUS_OK;
725 int fd = 0;
726
727 DBG(("setFD\n"));
728 do
729 {
730 CHECK_OBJECT(value_p, ret);
731 fd = N8_GetFD();
732 memcpy(value_p, &fd, sizeof(unsigned int));
733 }while (FALSE);
734 DBG(("setFD - OK\n"));
735 return ret;
736 } /* setFD */
737 /*****************************************************************************
738 * setInitInfo
739 *****************************************************************************/
740 /** @ingroup SystemInfo
741 * @brief Get the configuration parameters used to initialize the API.
742 *
743 * This function returns the configuration parameters that were used to
744 * initialize the API.
745 *
746 * @param value_p WO: Pointer in which to store revision info.
747 *
748 * @par Externals:
749 * None.
750 *
751 * @return
752 * N8_STATUS_OK: The function worked correctly.
753 * N8_INVALID_OBJECT: The output pointer is NULL.
754 *
755 * @par Errors:
756 * N8_INVALID_OBJECT as described in the return section.
757 *
758 * @par Locks:
759 * None.
760 *
761 * @par Assumptions:
762 * This function can not be called until the initialization of the API
763 * is complete. The value_p pointer points to a "reasonable" location.
764 *****************************************************************************/
setInitInfo(N8_Buffer_t * value_p)765 static N8_Status_t setInitInfo(N8_Buffer_t *value_p)
766 {
767 N8_Status_t ret = N8_STATUS_OK;
768
769 DBG(("setInitInfo\n"));
770 do
771 {
772 CHECK_OBJECT(value_p, ret);
773 n8_getConfigInfo((N8_ConfigAPI_t *)value_p);
774 }while (FALSE);
775 DBG(("setInitInfo - OK\n"));
776 return ret;
777 }
778