how to use chain in rtems?

Chan Kim ckim at etri.re.kr
Tue Aug 25 08:39:58 UTC 2015


Hello, all,

To use chain, I added rtems_chain_control queue; in the host structure. 
Also, mrq has rtems_chain_node node; as the first element.

The method I used is 
to initialize : 
        rtems_chain_initialize_empty(&host->queue);
to append mrq to the queue : 
                rtems_chain_append(&host->queue, &mrq->node);
to get the first node : 
                mrq = (struct mmc_request *)host->queue.Chain.Head.fill;  (method 1)                
                mrq = (struct mmc_reequest *)rtems_chain_head(&host->queue);  (method 2)
                 
                rtems_chain_extract(&mrq->node);   (after method1 or method 2 I did this to distroy the node from the chain)

Is this correct method? I put WR mrq and when I was about to extract that, I enqueued RD mrq, then, when I read the first element,
it is RD mrq (using method 1) or some other value (using method 2).
Please someone tell me how to use it.

Thanks in advance.
Chan


More information about the users mailing list