OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [compat-uitron-memory-pool-mgmt-functions.html] - Blame information for rev 629

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>         Memory pool Management Functions</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="µITRON API"
23
HREF="compat-uitron-microitron-api.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Interrupt management functions"
26
HREF="compat-uitron-interrupt-management-functions.html"><LINK
27
REL="NEXT"
28
TITLE="Time Management Functions"
29
HREF="compat-uitron-time-mgmt-functions.html"></HEAD
30
><BODY
31
CLASS="SECT1"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="compat-uitron-interrupt-management-functions.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 32. &micro;ITRON API</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="compat-uitron-time-mgmt-functions.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECT1"
82
><H1
83
CLASS="SECT1"
84
><A
85
NAME="COMPAT-UITRON-MEMORY-POOL-MGMT-FUNCTIONS">Memory pool Management Functions</H1
86
><P
87
>These functions are fully supported in this release: </P
88
><TABLE
89
BORDER="5"
90
BGCOLOR="#E0E0F0"
91
WIDTH="70%"
92
><TR
93
><TD
94
><PRE
95
CLASS="PROGRAMLISTING"
96
>ER <TT
97
CLASS="FUNCTION"
98
>get_blf</TT
99
>(
100
    VP *<SPAN
101
CLASS="emphasis"
102
><I
103
CLASS="EMPHASIS"
104
>p_blf,</I
105
></SPAN
106
>    ID <SPAN
107
CLASS="emphasis"
108
><I
109
CLASS="EMPHASIS"
110
>mpfid</I
111
></SPAN
112
> )</PRE
113
></TD
114
></TR
115
></TABLE
116
><TABLE
117
BORDER="5"
118
BGCOLOR="#E0E0F0"
119
WIDTH="70%"
120
><TR
121
><TD
122
><PRE
123
CLASS="PROGRAMLISTING"
124
>ER <TT
125
CLASS="FUNCTION"
126
>pget_blf</TT
127
>(
128
    VP *<SPAN
129
CLASS="emphasis"
130
><I
131
CLASS="EMPHASIS"
132
>p_blf,</I
133
></SPAN
134
>    ID <SPAN
135
CLASS="emphasis"
136
><I
137
CLASS="EMPHASIS"
138
>mpfid</I
139
></SPAN
140
> )</PRE
141
></TD
142
></TR
143
></TABLE
144
><TABLE
145
BORDER="5"
146
BGCOLOR="#E0E0F0"
147
WIDTH="70%"
148
><TR
149
><TD
150
><PRE
151
CLASS="PROGRAMLISTING"
152
>ER <TT
153
CLASS="FUNCTION"
154
>tget_blf</TT
155
>(
156
    VP *<SPAN
157
CLASS="emphasis"
158
><I
159
CLASS="EMPHASIS"
160
>p_blf,</I
161
></SPAN
162
>    ID <SPAN
163
CLASS="emphasis"
164
><I
165
CLASS="EMPHASIS"
166
>mpfid,</I
167
></SPAN
168
>    TMO <SPAN
169
CLASS="emphasis"
170
><I
171
CLASS="EMPHASIS"
172
>tmout</I
173
></SPAN
174
> )</PRE
175
></TD
176
></TR
177
></TABLE
178
><TABLE
179
BORDER="5"
180
BGCOLOR="#E0E0F0"
181
WIDTH="70%"
182
><TR
183
><TD
184
><PRE
185
CLASS="PROGRAMLISTING"
186
>ER <TT
187
CLASS="FUNCTION"
188
>rel_blf</TT
189
>(
190
    ID <SPAN
191
CLASS="emphasis"
192
><I
193
CLASS="EMPHASIS"
194
>mpfid,</I
195
></SPAN
196
>    VP <SPAN
197
CLASS="emphasis"
198
><I
199
CLASS="EMPHASIS"
200
>blf</I
201
></SPAN
202
> )</PRE
203
></TD
204
></TR
205
></TABLE
206
><TABLE
207
BORDER="5"
208
BGCOLOR="#E0E0F0"
209
WIDTH="70%"
210
><TR
211
><TD
212
><PRE
213
CLASS="PROGRAMLISTING"
214
>ER <TT
215
CLASS="FUNCTION"
216
>ref_mpf</TT
217
>(
218
    T_RMPF *<SPAN
219
CLASS="emphasis"
220
><I
221
CLASS="EMPHASIS"
222
>pk_rmpf,</I
223
></SPAN
224
>    ID <SPAN
225
CLASS="emphasis"
226
><I
227
CLASS="EMPHASIS"
228
>mpfid</I
229
></SPAN
230
> )</PRE
231
></TD
232
></TR
233
></TABLE
234
><TABLE
235
BORDER="5"
236
BGCOLOR="#E0E0F0"
237
WIDTH="70%"
238
><TR
239
><TD
240
><PRE
241
CLASS="PROGRAMLISTING"
242
>ER <TT
243
CLASS="FUNCTION"
244
>get_blk</TT
245
>(
246
    VP *<SPAN
247
CLASS="emphasis"
248
><I
249
CLASS="EMPHASIS"
250
>p_blk,</I
251
></SPAN
252
>    ID <SPAN
253
CLASS="emphasis"
254
><I
255
CLASS="EMPHASIS"
256
>mplid,</I
257
></SPAN
258
>    INT <SPAN
259
CLASS="emphasis"
260
><I
261
CLASS="EMPHASIS"
262
>blksz</I
263
></SPAN
264
> )</PRE
265
></TD
266
></TR
267
></TABLE
268
><TABLE
269
BORDER="5"
270
BGCOLOR="#E0E0F0"
271
WIDTH="70%"
272
><TR
273
><TD
274
><PRE
275
CLASS="PROGRAMLISTING"
276
>ER <TT
277
CLASS="FUNCTION"
278
>pget_blk</TT
279
>(
280
    VP *<SPAN
281
CLASS="emphasis"
282
><I
283
CLASS="EMPHASIS"
284
>p_blk,</I
285
></SPAN
286
>    ID <SPAN
287
CLASS="emphasis"
288
><I
289
CLASS="EMPHASIS"
290
>mplid,</I
291
></SPAN
292
>    INT <SPAN
293
CLASS="emphasis"
294
><I
295
CLASS="EMPHASIS"
296
>blksz</I
297
></SPAN
298
> )</PRE
299
></TD
300
></TR
301
></TABLE
302
><TABLE
303
BORDER="5"
304
BGCOLOR="#E0E0F0"
305
WIDTH="70%"
306
><TR
307
><TD
308
><PRE
309
CLASS="PROGRAMLISTING"
310
>ER <TT
311
CLASS="FUNCTION"
312
>tget_blk</TT
313
>(
314
    VP *<SPAN
315
CLASS="emphasis"
316
><I
317
CLASS="EMPHASIS"
318
>p_blk,</I
319
></SPAN
320
>    ID <SPAN
321
CLASS="emphasis"
322
><I
323
CLASS="EMPHASIS"
324
>mplid,</I
325
></SPAN
326
>    INT <SPAN
327
CLASS="emphasis"
328
><I
329
CLASS="EMPHASIS"
330
>blksz,</I
331
></SPAN
332
>    TMO <SPAN
333
CLASS="emphasis"
334
><I
335
CLASS="EMPHASIS"
336
>tmout</I
337
></SPAN
338
> )</PRE
339
></TD
340
></TR
341
></TABLE
342
><TABLE
343
BORDER="5"
344
BGCOLOR="#E0E0F0"
345
WIDTH="70%"
346
><TR
347
><TD
348
><PRE
349
CLASS="PROGRAMLISTING"
350
>ER <TT
351
CLASS="FUNCTION"
352
>rel_blk</TT
353
>(
354
    ID <SPAN
355
CLASS="emphasis"
356
><I
357
CLASS="EMPHASIS"
358
>mplid,</I
359
></SPAN
360
>    VP <SPAN
361
CLASS="emphasis"
362
><I
363
CLASS="EMPHASIS"
364
>blk</I
365
></SPAN
366
> )</PRE
367
></TD
368
></TR
369
></TABLE
370
><TABLE
371
BORDER="5"
372
BGCOLOR="#E0E0F0"
373
WIDTH="70%"
374
><TR
375
><TD
376
><PRE
377
CLASS="PROGRAMLISTING"
378
>ER <TT
379
CLASS="FUNCTION"
380
>ref_mpl</TT
381
>(
382
    T_RMPL *<SPAN
383
CLASS="emphasis"
384
><I
385
CLASS="EMPHASIS"
386
>pk_rmpl,</I
387
></SPAN
388
>    ID <SPAN
389
CLASS="emphasis"
390
><I
391
CLASS="EMPHASIS"
392
>mplid )</I
393
></SPAN
394
></PRE
395
></TD
396
></TR
397
></TABLE
398
><P
399
>Note that of the memory provided for a particular pool to
400
manage in the static initialization of the memory pool objects,
401
some memory will be used to manage the pool itself. Therefore the
402
number of blocks * the blocksize will be less than the total
403
memory size. </P
404
><P
405
>The following functions are supported in this release, when
406
enabled with
407
<TT
408
CLASS="LITERAL"
409
>CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE</TT
410
>
411
or
412
<TT
413
CLASS="LITERAL"
414
>CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE</TT
415
>
416
as appropriate, with some restrictions: </P
417
><TABLE
418
BORDER="5"
419
BGCOLOR="#E0E0F0"
420
WIDTH="70%"
421
><TR
422
><TD
423
><PRE
424
CLASS="PROGRAMLISTING"
425
>ER <TT
426
CLASS="FUNCTION"
427
>cre_mpl</TT
428
>(
429
    ID <SPAN
430
CLASS="emphasis"
431
><I
432
CLASS="EMPHASIS"
433
>mplid,</I
434
></SPAN
435
>    T_CMPL *<SPAN
436
CLASS="emphasis"
437
><I
438
CLASS="EMPHASIS"
439
>pk_cmpl</I
440
></SPAN
441
> )</PRE
442
></TD
443
></TR
444
></TABLE
445
><TABLE
446
BORDER="5"
447
BGCOLOR="#E0E0F0"
448
WIDTH="70%"
449
><TR
450
><TD
451
><PRE
452
CLASS="PROGRAMLISTING"
453
>ER <TT
454
CLASS="FUNCTION"
455
>del_mpl</TT
456
>(
457
    ID <SPAN
458
CLASS="emphasis"
459
><I
460
CLASS="EMPHASIS"
461
>mplid</I
462
></SPAN
463
> )</PRE
464
></TD
465
></TR
466
></TABLE
467
><TABLE
468
BORDER="5"
469
BGCOLOR="#E0E0F0"
470
WIDTH="70%"
471
><TR
472
><TD
473
><PRE
474
CLASS="PROGRAMLISTING"
475
>ER <TT
476
CLASS="FUNCTION"
477
>cre_mpf</TT
478
>(
479
    ID <SPAN
480
CLASS="emphasis"
481
><I
482
CLASS="EMPHASIS"
483
>mpfid,</I
484
></SPAN
485
>    T_CMPF *<SPAN
486
CLASS="emphasis"
487
><I
488
CLASS="EMPHASIS"
489
>pk_cmpf</I
490
></SPAN
491
> )</PRE
492
></TD
493
></TR
494
></TABLE
495
><TABLE
496
BORDER="5"
497
BGCOLOR="#E0E0F0"
498
WIDTH="70%"
499
><TR
500
><TD
501
><PRE
502
CLASS="PROGRAMLISTING"
503
>ER <TT
504
CLASS="FUNCTION"
505
>del_mpf</TT
506
>(
507
    ID <SPAN
508
CLASS="emphasis"
509
><I
510
CLASS="EMPHASIS"
511
>mpfid</I
512
></SPAN
513
> )</PRE
514
></TD
515
></TR
516
></TABLE
517
><P
518
>Because of the static initialization facilities provided for
519
system objects, a memory pool is allocated a region of memory to
520
manage statically in the configuration. So while memory pools can
521
be created and deleted, the same area of memory is used for that
522
memory pool (memory pool ID number) each time. The requested variable pool
523
size (pk_cmpl-&gt;mplsz) or the number of fixed-size
524
blocks (pk_cmpf-&gt;mpfcnt) times the block size
525
(pk_cmpf-&gt;blfsz) are checked for fitting within
526
the statically allocated memory area, so if a create call succeeds,
527
the resulting pool will be at least as large as that requested.
528
For this reason <TT
529
CLASS="FUNCTION"
530
>del_mpl()</TT
531
> and <TT
532
CLASS="FUNCTION"
533
>del_mpf()</TT
534
> do
535
not in any sense free the memory that was managed by the deleted
536
pool for use by other pools; it may only be managed by a pool of
537
the same object id. </P
538
><P
539
>For both fixed and variable memory pools, the queueing order
540
when waiting on a synchronization object depends on the underlying
541
kernel configuration. The multi-level queue scheduler is required
542
for strict &micro;ITRON conformance and
543
it queues tasks in FIFO order, so requests to create an object with
544
priority queueing of tasks (pk_cxxx-&gt;xxxatr = TA_TPRI)
545
are rejected with E_RSATR. Additional undefined bits in
546
the attributes fields must be zero. </P
547
><P
548
>In general, extended information (pk_cxxx-&gt;exinf)
549
is ignored. </P
550
><DIV
551
CLASS="SECT2"
552
><H2
553
CLASS="SECT2"
554
><A
555
NAME="AEN13913">Error checking</H2
556
><P
557
>The following conditions are only checked for, and only return
558
errors if
559
<TT
560
CLASS="LITERAL"
561
>CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS</TT
562
>
563
is enabled:</P
564
><P
565
></P
566
><UL
567
><LI
568
><P
569
>invalid object id; less than 1 or greater than
570
<TT
571
CLASS="LITERAL"
572
>CYGNUM_UITRON_MEMPOOLVAR/MEMPOOLFIXED</TT
573
>
574
as appropriate returns E_ID</P
575
></LI
576
><LI
577
><P
578
>dispatching is enabled in any call which can sleep, or
579
E_CTX</P
580
></LI
581
><LI
582
><P
583
>tmout must be positive, otherwise E_PAR</P
584
></LI
585
><LI
586
><P
587
>pk_cxxx pointers in
588
<TT
589
CLASS="FUNCTION"
590
>cre_xxx()</TT
591
>
592
 must be valid pointers, or E_PAR</P
593
></LI
594
><LI
595
><P
596
>return value pointer in
597
<TT
598
CLASS="FUNCTION"
599
>ref_xxx()</TT
600
>
601
 is a valid pointer, or E_PAR</P
602
></LI
603
><LI
604
><P
605
>return value pointers in get block routines is a valid
606
pointer, or E_PAR</P
607
></LI
608
><LI
609
><P
610
>blocksize request in get variable block routines is greater
611
than zero, or E_PAR</P
612
></LI
613
></UL
614
><P
615
>The following conditions are checked for, and can return error
616
codes, regardless of the setting of
617
<TT
618
CLASS="LITERAL"
619
>CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS</TT
620
>:</P
621
><P
622
></P
623
><UL
624
><LI
625
><P
626
>When create and delete functions
627
<TT
628
CLASS="FUNCTION"
629
>cre_xxx()</TT
630
>
631
 and
632
<TT
633
CLASS="FUNCTION"
634
>del_xxx()</TT
635
>
636
 are supported, all calls which use a valid object ID number check
637
that the object exists. If not, E_NOEXS is returned.</P
638
></LI
639
><LI
640
><P
641
>When create functions
642
<TT
643
CLASS="FUNCTION"
644
>cre_xxx()</TT
645
>
646
 are supported, if the object already exists, then E_OBJ</P
647
></LI
648
><LI
649
><P
650
>In any call which can sleep, such as
651
<TT
652
CLASS="FUNCTION"
653
>get_blk()</TT
654
>
655
: return codes E_TMOUT, E_RLWAI, E_DLT
656
or of course E_OK are returned depending on the reason
657
for terminating the sleep</P
658
></LI
659
><LI
660
><P
661
>In polling functions such as
662
<TT
663
CLASS="FUNCTION"
664
>pget_blk()</TT
665
>
666
return codes E_TMOUT or E_OK are returned depending
667
on the state of the synchronization object</P
668
></LI
669
><LI
670
><P
671
>In creation functions, the attributes must be compatible
672
with the selected underlying kernel configuration: in
673
<TT
674
CLASS="FUNCTION"
675
>cre_mpl()</TT
676
>
677
 
678
<TT
679
CLASS="LITERAL"
680
>pk_cmpl-&gt;mplatr</TT
681
>
682
 must be equal to
683
<TT
684
CLASS="LITERAL"
685
>TA_TFIFO</TT
686
>
687
 else E_RSATR.</P
688
></LI
689
><LI
690
><P
691
>In
692
<TT
693
CLASS="FUNCTION"
694
>cre_mpf()</TT
695
>
696
 
697
<TT
698
CLASS="LITERAL"
699
>pk_cmpf-&gt;mpfatr</TT
700
>
701
 must be equal to
702
<TT
703
CLASS="LITERAL"
704
>TA_TFIFO</TT
705
>
706
 else E_RSATR.</P
707
></LI
708
><LI
709
><P
710
>In creation functions, the requested size of the memory
711
pool must not be larger than that statically configured for the
712
pool else E_RSATR; see the configuration option
713
&#8220;Option: Static initializers&#8221;.
714
 In
715
<TT
716
CLASS="FUNCTION"
717
>cre_mpl()</TT
718
>
719
 
720
<TT
721
CLASS="LITERAL"
722
>pk_cmpl-&gt;mplsz</TT
723
>
724
 is the field of interest</P
725
></LI
726
><LI
727
><P
728
>In
729
<TT
730
CLASS="FUNCTION"
731
>cre_mpf()</TT
732
>
733
 the product of
734
<TT
735
CLASS="LITERAL"
736
>pk_cmpf-&gt;blfsz</TT
737
>
738
 and
739
<TT
740
CLASS="LITERAL"
741
>pk_cmpf-&gt;mpfcnt</TT
742
>
743
 must be smaller than the memory statically configured for the pool
744
else E_RSATR</P
745
></LI
746
><LI
747
><P
748
>In functions which return memory to the pool
749
<TT
750
CLASS="FUNCTION"
751
>rel_blk()</TT
752
>
753
 and
754
<TT
755
CLASS="FUNCTION"
756
>rel_blf()</TT
757
>
758
, if the free fails, for example because the memory did not come
759
from that pool originally, then E_PAR is returned</P
760
></LI
761
></UL
762
></DIV
763
></DIV
764
><DIV
765
CLASS="NAVFOOTER"
766
><HR
767
ALIGN="LEFT"
768
WIDTH="100%"><TABLE
769
SUMMARY="Footer navigation table"
770
WIDTH="100%"
771
BORDER="0"
772
CELLPADDING="0"
773
CELLSPACING="0"
774
><TR
775
><TD
776
WIDTH="33%"
777
ALIGN="left"
778
VALIGN="top"
779
><A
780
HREF="compat-uitron-interrupt-management-functions.html"
781
ACCESSKEY="P"
782
>Prev</A
783
></TD
784
><TD
785
WIDTH="34%"
786
ALIGN="center"
787
VALIGN="top"
788
><A
789
HREF="ecos-ref.html"
790
ACCESSKEY="H"
791
>Home</A
792
></TD
793
><TD
794
WIDTH="33%"
795
ALIGN="right"
796
VALIGN="top"
797
><A
798
HREF="compat-uitron-time-mgmt-functions.html"
799
ACCESSKEY="N"
800
>Next</A
801
></TD
802
></TR
803
><TR
804
><TD
805
WIDTH="33%"
806
ALIGN="left"
807
VALIGN="top"
808
>Interrupt management functions</TD
809
><TD
810
WIDTH="34%"
811
ALIGN="center"
812
VALIGN="top"
813
><A
814
HREF="compat-uitron-microitron-api.html"
815
ACCESSKEY="U"
816
>Up</A
817
></TD
818
><TD
819
WIDTH="33%"
820
ALIGN="right"
821
VALIGN="top"
822
>Time Management Functions</TD
823
></TR
824
></TABLE
825
></DIV
826
></BODY
827
></HTML
828
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.