📄 csl_ataopen.c
字号:
/* ============================================================================ * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005 * * Use of this software is controlled by the terms and conditions found in the * license agreement under which this software has been supplied. * =========================================================================== *//** @file csl_ataOpen.c * * @brief File for functional layer of CSL API @a CSL_ataOpen() * * Description * - @a CSL_ataOpen(..) function definition * * Path: \\(CSLPATH)\\ipmodules\\ata\\src * * Modification 1 * - modified on: 2004/03/08 * - reason: creation * * Date 2004/03/08 * * Author RG Kiran *//* ============================================================================= * Revision History * =============== * 08-Oct-2004 kpn Added code to check for invalid parameters * 24-Sep-2004 kpn Updated according to CSL Upgradation guidelines * ============================================================================ */#include <csl_ata.h>/** ============================================================================ * @n@b CSL_ataOpen * * @b Description * @n This function populates the peripheral data object for the ATA instance * and returns a handle to the instance. * The open call sets up the data structures for the particular instance * of ATA device. The device can be re-opened anytime after it has been * normally closed if so required. The handle returned by this call is * input as an essential argument for rest of the APIs described * for this module. * * @b Arguments * @verbatim pAtaObj Pointer to the ATA instance object ataNum Instance of the ATA to be opened pAtaParam Pointer to module specific parameters pStatus pointer for returning status of the function call @endverbatim * * <b> Return Value </b> CSL_AtaHandle * @n Valid ATA instance handle will be returned if status value is equal to CSL_SOK. * * <b> Pre Condition </b> * @n None * * <b> Post Condition </b> * @n 1. ATA object structure is populated * @n 2. The status is returned in the status variable. If status * returned is * @li CSL_SOK Valid ata handle is returned * @li CSL_ESYS_FAIL The ata instance is invalid * @li CSL_ESYS_INVPARAMS Invalid parameter * * @b Modifies * @n 1. The status variable * @n 2. ATA object structure * * @b Example * @verbatim CSL_status status; CSL_AtaObj ataObj; CSL_AtaHandle hAta; ... hAta = CSL_ataOpen (&ataObj, CSL_ATA_PER_CNT, NULL, &status); ... @endverbatim * ============================================================================ */#pragma CODE_SECTION (CSL_ataOpen, ".text:csl_section:ata");CSL_AtaHandle CSL_ataOpen ( CSL_AtaObj *pAtaObj, CSL_InstNum ataNum, CSL_AtaParam *pAtaParam, CSL_Status *pStatus){ CSL_Status status; CSL_AtaHandle hAta; CSL_AtaBaseAddress baseAddress; if (pStatus == NULL) { hAta = (CSL_AtaHandle)NULL; return hAta; } if (pAtaObj == NULL) { *pStatus = CSL_ESYS_INVPARAMS; hAta = (CSL_AtaHandle)NULL; return hAta; } status = CSL_ataGetBaseAddress (ataNum, pAtaParam, &baseAddress); if (status == CSL_SOK) { pAtaObj->regs = baseAddress.regs; pAtaObj->ataNum = (CSL_InstNum)ataNum; hAta = (CSL_AtaHandle)pAtaObj; } else { pAtaObj->regs = (CSL_AtaRegsOvly)NULL; pAtaObj->ataNum = (CSL_InstNum)-1; hAta = (CSL_AtaHandle)NULL; } if (pStatus) { *pStatus = status; } return hAta;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -