Repartition some message queue logic: sched/mqueue should have all mqueue knowledge; fs/mqueue should deal only with inodes
This commit is contained in:
parent
f934db2db5
commit
71b574f26c
@ -48,5 +48,28 @@ Serial Console
|
||||
UART1 may be convenient because of its built-in RS232 drivers. But if you
|
||||
have a standard RS-232 shield, then UART0 may be the better choice.
|
||||
|
||||
Running from SRAM
|
||||
=================
|
||||
|
||||
The Host Bridge contains an interface to 512KB of on-chip, low latency,
|
||||
embedded SRAM (eSRAM). The eSRAM memory may be used as either 128 x 4KB
|
||||
pages, or in block mode as a single contiguous 512KB block page. The
|
||||
eSRAM pages may be mapped anywhere in the physical address space as a
|
||||
DRAM overlay.
|
||||
|
||||
To map the eSRAM as a single 512KB block page, the register
|
||||
ESRAMPGCTRL_BLOCK is used. If any of the 4KB pages are already enabled,
|
||||
it is not possible to enable the block page.
|
||||
|
||||
To map and enable the 512KB block page, the following steps should be
|
||||
followed:
|
||||
|
||||
- Set ESRAMPGCTRL_BLOCK.BLOCK_PG_SYSTEM_ADDRESS_16MB to the required
|
||||
address value
|
||||
- Set ESRAMPGCTRL_BLOCK.BLOCK_ENABLE_PG to 1
|
||||
|
||||
Once an eSRAM page is enabled, it is implicitly locked and any further
|
||||
configuration change attempts will fail.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/mqueue.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@ -79,7 +78,7 @@
|
||||
*
|
||||
* Description:
|
||||
* This function is used to indicate that the calling task is finished
|
||||
* with the specified message queued mqdes. The mq_close() deallocates
|
||||
* with the specified message queue mqdes. The mq_close() deallocates
|
||||
* any system resources allocated by the system for use by this task for
|
||||
* its message queue.
|
||||
*
|
||||
@ -104,8 +103,6 @@
|
||||
|
||||
int mq_close(mqd_t mqdes)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = sched_self();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
FAR struct inode *inode;
|
||||
|
||||
@ -117,37 +114,21 @@ int mq_close(mqd_t mqdes)
|
||||
{
|
||||
sched_lock();
|
||||
|
||||
/* Remove the message descriptor from the current task's
|
||||
* list of message descriptors.
|
||||
*/
|
||||
|
||||
sq_rem((FAR sq_entry_t*)mqdes, &group->tg_msgdesq);
|
||||
|
||||
/* Find the message queue associated with the message descriptor */
|
||||
|
||||
msgq = mqdes->msgq;
|
||||
DEBUGASSERT(msgq && msgq->inode);
|
||||
|
||||
/* Check if the calling task has a notification attached to
|
||||
* the message queue via this mqdes.
|
||||
*/
|
||||
/* Close/free the message descriptor */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
if (msgq->ntmqdes == mqdes)
|
||||
{
|
||||
msgq->ntpid = INVALID_PROCESS_ID;
|
||||
msgq->ntsigno = 0;
|
||||
msgq->ntvalue.sival_int = 0;
|
||||
msgq->ntmqdes = NULL;
|
||||
}
|
||||
#endif
|
||||
mq_desclose(mqdes);
|
||||
|
||||
/* Get the inode from the message queue structure */
|
||||
|
||||
inode = msgq->inode;
|
||||
DEBUGASSERT(inode->u.i_mqueue == msgq);
|
||||
|
||||
/* Decrement the reference count on the inode */
|
||||
/* Decrement the reference count on the inode, possibly freeing it */
|
||||
|
||||
mq_inode_release(inode);
|
||||
sched_unlock();
|
||||
|
@ -177,17 +177,24 @@ mqd_t mq_descreate(FAR struct tcb_s* mtcb, FAR struct mqueue_inode_s* msgq,
|
||||
int oflags);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_desfree
|
||||
* Name: mq_desclose
|
||||
*
|
||||
* Description:
|
||||
* Deallocate a message queue descriptor but returning it to the free list
|
||||
* This function performs the portion of the mq_close operation related
|
||||
* to freeing resource used by the message queue descriptor itself.
|
||||
*
|
||||
* Inputs:
|
||||
* mqdes - message queue descriptor to free
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor.
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* - Called only from mq_close() with the scheduler locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_desfree(mqd_t mqdes);
|
||||
void mq_desclose(mqd_t mqdes);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
@ -37,7 +37,7 @@ ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
||||
|
||||
MQUEUE_SRCS = mq_send.c mq_timedsend.c mq_sndinternal.c mq_receive.c
|
||||
MQUEUE_SRCS += mq_timedreceive.c mq_rcvinternal.c mq_initialize.c
|
||||
MQUEUE_SRCS += mq_descreate.c mq_desfree.c mq_msgfree.c mq_msgqalloc.c
|
||||
MQUEUE_SRCS += mq_descreate.c mq_desclose.c mq_msgfree.c mq_msgqalloc.c
|
||||
MQUEUE_SRCS += mq_msgqfree.c mq_release.c mq_recover.c
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/mqueue/mq_desfree.c
|
||||
* sched/mqueue/mq_desclose.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,6 +39,9 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <sched.h>
|
||||
#include <assert.h>
|
||||
#include <queue.h>
|
||||
|
||||
#include <nuttx/mqueue.h>
|
||||
@ -54,7 +57,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -76,7 +79,64 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_desfree(mqd_t mqdes)
|
||||
#define mq_desfree(mqdes) sq_addlast((FAR sq_entry_t*)mqdes, &g_desfree)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_close
|
||||
*
|
||||
* Description:
|
||||
* This function performs the portion of the mq_close operation related
|
||||
* to freeing resource used by the message queue descriptor itself.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor.
|
||||
*
|
||||
* Return Value:
|
||||
* None.
|
||||
*
|
||||
* Assumptions:
|
||||
* - Called only from mq_close() with the scheduler locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_desclose(mqd_t mqdes)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t*)mqdes, &g_desfree);
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)sched_self();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
|
||||
DEBUGASSERT(mqdes && group);
|
||||
|
||||
/* Remove the message descriptor from the current task's list of message
|
||||
* descriptors.
|
||||
*/
|
||||
|
||||
sq_rem((FAR sq_entry_t*)mqdes, &group->tg_msgdesq);
|
||||
|
||||
/* Find the message queue associated with the message descriptor */
|
||||
|
||||
msgq = mqdes->msgq;
|
||||
|
||||
/* Check if the calling task has a notification attached to the message
|
||||
* queue via this mqdes.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
if (msgq->ntmqdes == mqdes)
|
||||
{
|
||||
msgq->ntpid = INVALID_PROCESS_ID;
|
||||
msgq->ntsigno = 0;
|
||||
msgq->ntvalue.sival_int = 0;
|
||||
msgq->ntmqdes = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Deallocate the message descriptor */
|
||||
|
||||
mq_desfree(mqdes);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user