csl_mmu.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 693 行 · 第 1/2 页

H
693
字号
 *
 *  The pointer to this, is passed to all MMU CSL APIs.
 */
typedef struct CSL_MmuObj {
	/** This is the instance of MMU being referred to by this object  */
	CSL_InstNum  	perNum;
} CSL_MmuObj;

typedef struct CSL_MmuObj *CSL_MmuHandle;

/** @brief This will have the base-address information for the peripheral
 *  instance
 */
typedef struct {
	/** Base-address of the configuration registers of the peripheral
	 */
	Uint32	regs;
} CSL_MmuBaseAddress;


/** @brief Module specific parameters. Present implementation doesn't have
 *  any module specific parameters.
 */
typedef struct{
	/** Bit mask to be used for module specific parameters.
         *  The below declaration is just a place-holder for future
 	 *  implementation.
	 */
	CSL_BitMask16   flags;
} CSL_MmuParam;

/** @brief Module specific context information. Present implementation doesn't have
 *  any Context information.
 */

typedef struct {
	/** Context information of MMU.
         *  The below declaration is just a place-holder for future
 	 *  implementation.
 	 */
    Uint16	contextInfo;
} CSL_MmuContext;


/** Global function declarations */

/*
 * =============================================================================
 *   @func   CSL_mmuInit
 *   @desc
 *      This is MMU module's initialization function. 
 *      Currently this function is doing nothing.
 *      This needs to be called before using MMU module.
 *
 *   @arg  pContext 
 *          MMU specific context information
 *
 *   @ret  CSL_Status
 *          CSL_SOK : Successful, desired operation is done.
 *          CSL_ESYS_BADHANDLE : Handle pass is INVALID.
 *   @eg
 *      status = CSL_mmuInit(NULL);
 *
 * =============================================================================
*/

CSL_Status CSL_mmuInit(
	/** MMU specific context information
	 */
	CSL_MmuContext * pContext
	);

/*
 * ============================================================================
 *   @func CSL_mmuOPen
 *
 *   @desc
 *   @n This function returns the handle to the specified MMU instance.. 
 *
 *   @arg
 *
 *			pMmuObj    Pointer to the object that holds reference to the 
 *			           instance of MMU requested after the call.
 *
 *			mmuNum     Instance of MMU to which a handle is requested
 *
 *          pMmuParam  Module specific parameters; currently there are no module
 *			           specificparameters and the user should pass 'NULL'.
 *
 *          pStatus    This returns the status (success/error)  of the call. The
 *			           user may pass NULL', if status information is not required.
 *
 *   @ret  CSL_MmuHandle handle to the MMU instance
 *   
 *   @eg
 *          CSL_Status status;
 *			CSL_MmuObj mmuObj;
 *          status = CSL_mmuOpen (&mmuObj, CSL_MMU, NULL, &status);;
 *    
 * =============================================================================
 */

CSL_MmuHandle CSL_mmuOpen (
    /** Pointer to the object that holds reference to the
     *  instance of MMU requested after the call
     */
    CSL_MmuObj*		    pMmuObj,
    /** Instance of MMU to which a handle is requested
     */
    CSL_InstNum              mmuNum,
    /** Module specific parameters;
     * Currently there are none; the user should pass 'NULL'
     */
    CSL_MmuParam          *pMmuParam,
    /** This returns the status (success/errors) of the call.
     * Could be 'NULL' if the user does not want status information.
     */
    CSL_Status              *pStatus
	);
/*
 * =============================================================================
 *   @func   CSL_mmuClose
 *   @desc
 *      Close (Invalidate) MMU Module. The CSL for MMU
 *      cannot be accessed any more until it is explicitly
 *      opened again
 *
 *   @arg  hMmu
 *              Handle to MMU
 *   @ret  CSL_Status
 *          CSL_SOK : Successful, desired operation is done.
 *          CSL_ESYS_BADHANDLE : Handle pass is INVALID.
 *   @eg
 *      status = CSL_mmuClose(hMmu);
 *
 * =============================================================================
*/

CSL_Status  CSL_mmuClose(
    CSL_MmuHandle         hMmu
);


/*
 * =============================================================================
 *   @func   CSL_mmuHwControl
 *   @desc   Controls the runtime behavior of MMU
 *           Usage Constraints:
 *              MMU module should have been opened already
 *
 *      The following commands are supported:
 *       1) Enable MMU
 *       2) Disable MMU
 *       3) Enable address alignment checking
 *       4) Disable address alignment checking
 *       5) Setting translation table base address
 *       6) Invalidate TLB entries
 *       7) Invalidate specific TLB entry
 *       8) Control TLB lock down
 *       9) Setting domain access permission
 *       10)Setting system and ROM protection modes
 *
 *       The function will return an error if cannot complete
 *       the request
 *
 *
 *   @arg  hMmu
 *              Handle to the instance
 *   @arg  cmd
 *              The operation to be performed.
 *   @arg  cmdArg
 *              This is a void pointer, and will be cast to the
 *              required type.
 *   @ret  CSL_Status
 *         CSL_SOK : Successful command execution,
 *         CSL_ESYS_BADHANDLE : Invalid handle
 *         CSL_ESYS_INVCMD : Control Command is not supported.
 *
 *   @eg
 *      status = CSL_mmuHwControl(hMmu,
 *                            CSL_MMU_CMD_MMU_ENABLE,
 *                            NULL);
 *
 * =============================================================================
*/

CSL_Status  CSL_mmuHwControl(
    CSL_MmuHandle        hMmu,
    CSL_MmuHwControlCmd  cmd,
    void                 *cmdArg
);

/*
 * =============================================================================
 *   @func   CSL_mmuGetHwStatus
 *   @desc
 *     Reads various parameters of MMU
 *
 *       Usage Constraints:
 *       MMU should have been opened before with a valid
 *       handle. .
 *
 *       The following querries are supported:
 *       1) Query TTB register value
 *       2) Query the enabled status of MMU
 *       3) Qurey the enable status of alignment checking
 *       4) Query the value in data fault status register
 *       5) Query the value in Instruction fault status register
 *       6) Query the value in fault address register
 *       7) Query the value of protection bits (R and S) of control register
 *
 *       The function will return an error if cannot complete
 *       the request
 *
 *   @arg  hMmu
 *              Handle to the MMU module
 *   @arg  query
 *              Identifies the Value to be read
 *   @arg  response
 *              This is a void pointer, and will be cast to
 *              the required type.
 *   @ret  CSL_Status
 *         CSL_SOK : Successful Retreive, (* response) will have
 *                   the desired value.
 *         CSL_ESYS_BADHANDLE : Invalid handle
 *         CSL_ESYS_INVQUERY : Query Command is not supported.
 *
 *  @eg
 *         status =CSL_mmuGetHwStatus(hMmmu,
 *                         CSL_MMU_QUERY_MMU_STATUS,
 *                         &mmuStatus);
 * =============================================================================
*/

CSL_Status  CSL_mmuGetHwStatus(
    CSL_MmuHandle           hMmu,
    CSL_MmuHwStatusQuery    query,
    void                    *response
);

/*
 * =============================================================================
 *   @func   CSL_mmuAddTtbEntry
 *   @desc
 *     Adds an entry into the level 1 translation table
 *
 *   @arg  hMmu
 *              Handle to MMU module
 *   @arg  ptrTtbEntry
 *              This is pointer to the entry to be added
 *   @ret  CSL_Status
 *         CSL_SOK
 *   @eg
 *      status = CSL_mmuAddTtbEntry (hMmu, &ttbEntry);
 *
 * =============================================================================
*/

CSL_Status CSL_mmuAddTtbEntry (
    CSL_MmuHandle            hMmu,
    CSL_MmuL1Descriptor      *ptrTtbEntry
);

/*
 * =============================================================================
 *   @func   CSL_mmuAddL2cptEntry
 *   @desc
 *      Adds an entry into the coarse page table
 *
 *   @arg  hMmu
 *              Handle to the MMU
 *   @arg  ptrTtbEntry
 *              This is pointer to the entry to be added
 *   @ret  CSL_Status
 *         CSL_SOK
 *   @eg
 *      status = CSL_mmuAddL2cptEntry (hMmu, &l2cpEntry);
 *
 * =============================================================================
*/

CSL_Status CSL_mmuAddL2cptEntry (
    CSL_MmuHandle           hMmu,
    CSL_MmuL2Descriptor     *ptrL2ptEntry
);

/*
 * =============================================================================
 *   @func   CSL_mmuAddL2fptEntry
 *   @desc
 *      Adds an entry into the fine page table
 *
 *   @arg  hMmu
 *              Handle to the MMU module
 *   @arg  ptrL2ptEntry
 *              This is pointer to the entry to be added
 *   @ret  CSL_Status
 *         CSL_SOK
 *   @eg
 *      status = CSL_mmuAddL2fptEntry (hMmu, &l2cpEntry);
 *
 * =============================================================================
*/

CSL_Status CSL_mmuAddL2fptEntry (
    CSL_MmuHandle           hMmu,
    CSL_MmuL2Descriptor     *ptrL2ptEntry
);

/*
 * =============================================================================
 *   @func   CSL_mmuGetBaseAddress
 *   @desc
 *      This function is used for returning the base address of the peripheral
 *      instance. In the case of MMU since it is not controlled using memory 
 *      mapped registers this function is not doing anything currently.
 *
 *   @arg   hMmu             Pointer to the peripheral data object for MMU
 *
 *   @arg   mmuNum           Specifies the instance of the MMU to be opened.
 *
 *   @arg   pMmuParam   	 Module specific parameters.
 *
 *   @arg   pBaseAddress     Pointer to base address structure containing base 
 *           			     address details.
 *
 *   @ret  CSL_Status
 *         CSL_SOK
 *   @eg
 *      status = CSL_mmuGetBaseAddress(CSL_MMU, NULL, &baseAddress);
 *
 * =============================================================================
*/

CSL_Status CSL_mmuGetBaseAddress(      
        CSL_InstNum  			mmuNum,
        CSL_MmuParam		  * pMmuParam,
        CSL_MmuBaseAddress    *	pBaseAddress
);

#ifdef __cplusplus
}
#endif

#endif  /* _CSL_MMU_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?