mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2024-12-26 22:30:54 +00:00
Update to PSoC Creator 4.0
This commit is contained in:
parent
1bff0effdb
commit
50538385af
@ -1,7 +1,8 @@
|
||||
20170429 4.7.1
|
||||
20170501 4.7.1
|
||||
- Fix scsi2sd-util size and sector-size inputs
|
||||
- Fix crash when configured scsi disk starting sector is less than
|
||||
SD card size
|
||||
- Update to PSoC Creator 4.0
|
||||
|
||||
20170312 4.7
|
||||
- Fix bug in SCSI Inquiry command for SCSI2 hosts
|
||||
|
218
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Bootloadable_1.c
Normal file → Executable file
218
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Bootloadable_1.c
Normal file → Executable file
@ -1,13 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* File Name: Bootloadable_1.c
|
||||
* Version 1.30
|
||||
/****************************************************************************//**
|
||||
* \file Bootloadable_1.c
|
||||
* \version 1.50
|
||||
*
|
||||
* Description:
|
||||
* Provides an API for the Bootloadable application. The API includes a
|
||||
* single function for starting the bootloader.
|
||||
* \brief
|
||||
* Provides an API for the Bootloadable application.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -15,17 +15,25 @@
|
||||
|
||||
#include "Bootloadable_1.h"
|
||||
|
||||
/**
|
||||
\defgroup functions_group Functions
|
||||
@{
|
||||
*/
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
static cystatus Bootloadable_1_WriteFlashByte(const uint32 address, const uint8 inputValue) CYLARGE \
|
||||
;
|
||||
#endif /*(CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Bootloadable_1_Load
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Begins the bootloading algorithm downloading a new ACD image from the host.
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief
|
||||
* Schedules the Bootloader/Launcher to be launched and then performs
|
||||
* a software reset to launch it
|
||||
*
|
||||
* Returns:
|
||||
* \return
|
||||
* This method will never return. It will load a new application and reset
|
||||
* the device.
|
||||
*
|
||||
@ -33,11 +41,186 @@
|
||||
void Bootloadable_1_Load(void)
|
||||
{
|
||||
/* Schedule Bootloader to start after reset */
|
||||
Bootloadable_1_SET_RUN_TYPE(Bootloadable_1_START_BTLDR);
|
||||
Bootloadable_1_SET_RUN_TYPE(Bootloadable_1_SCHEDULE_BTLDR);
|
||||
|
||||
CySoftwareReset();
|
||||
}
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
/*******************************************************************************
|
||||
* Function Name: Bootloadable_1_GetActiveApplication
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief
|
||||
* Gets the application which will be loaded after a next reset event.
|
||||
* NOTE Intended for the combination project type ONLY!
|
||||
*
|
||||
* \return
|
||||
* A number of the current active application set in the metadata section.
|
||||
* \n 0 - app#0 is set as active.
|
||||
* \n 1 - app#1 is set as active.
|
||||
*
|
||||
* \note If neither of the applications is set active, then the API returns 0x02.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 Bootloadable_1_GetActiveApplication(void) CYSMALL \
|
||||
|
||||
{
|
||||
uint8 result = Bootloadable_1_MD_BTLDB_ACTIVE_NONE;
|
||||
|
||||
if (0u != Bootloadable_1_GET_CODE_DATA( \
|
||||
Bootloadable_1_MD_BTLDB_ACTIVE_OFFSET(Bootloadable_1_MD_BTLDB_ACTIVE_0)))
|
||||
{
|
||||
result = Bootloadable_1_MD_BTLDB_ACTIVE_0;
|
||||
}
|
||||
else if (0u != Bootloadable_1_GET_CODE_DATA( \
|
||||
Bootloadable_1_MD_BTLDB_ACTIVE_OFFSET(Bootloadable_1_MD_BTLDB_ACTIVE_1)))
|
||||
{
|
||||
result = Bootloadable_1_MD_BTLDB_ACTIVE_1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Do nothing, result is none*/
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Bootloadable_1_SetActiveApplication
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief
|
||||
* Sets the application which will be loaded after a next reset event.
|
||||
*
|
||||
* \details
|
||||
* Theory:
|
||||
* This API sets in the Flash (metadata section) the given active application
|
||||
* number.
|
||||
*
|
||||
* NOTE The active application number is not set directly, but the boolean
|
||||
* mark instead means that the application is active or not for the relative
|
||||
* metadata. Both metadata sections are updated. For example, if the second
|
||||
* application is to be set active, then in the metadata section for the first
|
||||
* application there will be a "0" written, which means that it is not active, and
|
||||
* for the second metadata section there will be a "1" written, which means that it is
|
||||
* active.
|
||||
*
|
||||
* NOTE Intended for the combination project type ONLY!
|
||||
*
|
||||
* \param appId
|
||||
* The active application number to be written to flash (metadata section)
|
||||
* NOTE Possible values are:
|
||||
* 0 - for the first application
|
||||
* 1 - for the second application.
|
||||
* Any other number is considered invalid.
|
||||
*
|
||||
* \return
|
||||
* A status of writing to flash operation.
|
||||
* \n CYRET_SUCCESS - Returned if appId was successfully changed.
|
||||
* \n CYRET_BAD_PARAM - Returned if the parameter appID passed to the function has the
|
||||
* same value as the active application ID.
|
||||
* \note - The other non-zero value is considered as a failure during writing to flash.
|
||||
*
|
||||
* \note - This API does not update Bootloader_activeApp variable.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus Bootloadable_1_SetActiveApplication(uint8 appId) CYSMALL \
|
||||
|
||||
{
|
||||
cystatus result = CYRET_SUCCESS;
|
||||
|
||||
uint8 CYDATA idx;
|
||||
|
||||
/* If invalid application number */
|
||||
if (appId > Bootloadable_1_MD_BTLDB_ACTIVE_1)
|
||||
{
|
||||
result = CYRET_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If appID has same value as active application ID */
|
||||
if (1u == Bootloadable_1_GET_CODE_DATA(Bootloadable_1_MD_BTLDB_ACTIVE_OFFSET(appId)))
|
||||
{
|
||||
result = CYRET_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Updating metadata section */
|
||||
for(idx = 0u; idx < Bootloadable_1_MAX_NUM_OF_BTLDB; idx++)
|
||||
{
|
||||
result |= Bootloadable_1_WriteFlashByte((uint32) Bootloadable_1_MD_BTLDB_ACTIVE_OFFSET(idx), \
|
||||
(uint8)(idx == appId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Bootloadable_1_WriteFlashByte
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief
|
||||
* This API writes to flash the specified data.
|
||||
*
|
||||
* \param address
|
||||
* The address in flash.
|
||||
*
|
||||
* \param inputValue
|
||||
* One-byte data.
|
||||
*
|
||||
* \return
|
||||
* A status of the writing to flash procedure.
|
||||
*
|
||||
*******************************************************************************/
|
||||
static cystatus Bootloadable_1_WriteFlashByte(const uint32 address, const uint8 inputValue) CYLARGE \
|
||||
|
||||
{
|
||||
cystatus result = CYRET_SUCCESS;
|
||||
uint32 flsAddr = address - CYDEV_FLASH_BASE;
|
||||
uint8 rowData[CYDEV_FLS_ROW_SIZE];
|
||||
|
||||
#if !(CY_PSOC4)
|
||||
uint8 arrayId = ( uint8 )(flsAddr / CYDEV_FLS_SECTOR_SIZE);
|
||||
#endif /* !(CY_PSOC4) */
|
||||
|
||||
#if (CY_PSOC4)
|
||||
uint16 rowNum = ( uint16 )(flsAddr / CYDEV_FLS_ROW_SIZE);
|
||||
#else
|
||||
uint16 rowNum = ( uint16 )((flsAddr % CYDEV_FLS_SECTOR_SIZE) / CYDEV_FLS_ROW_SIZE);
|
||||
#endif /* (CY_PSOC4) */
|
||||
|
||||
uint32 baseAddr = address - (address % CYDEV_FLS_ROW_SIZE);
|
||||
uint16 idx;
|
||||
|
||||
for(idx = 0u; idx < CYDEV_FLS_ROW_SIZE; idx++)
|
||||
{
|
||||
rowData[idx] = (uint8)Bootloadable_1_GET_CODE_DATA(baseAddr + idx);
|
||||
}
|
||||
|
||||
rowData[address % CYDEV_FLS_ROW_SIZE] = inputValue;
|
||||
|
||||
#if(CY_PSOC4)
|
||||
result = CySysFlashWriteRow((uint32) rowNum, rowData);
|
||||
#else
|
||||
result = CyWriteRowData(arrayId, rowNum, rowData);
|
||||
#endif /* (CY_PSOC4) */
|
||||
|
||||
#if(CY_PSOC5)
|
||||
/***************************************************************************
|
||||
* When writing to flash, data in the instruction cache can become stale.
|
||||
* Therefore, the cache data does not correlate to the data just written to
|
||||
* flash. A call to CyFlushCache() is required to invalidate the data in the
|
||||
* cache and force fresh information to be loaded from flash.
|
||||
***************************************************************************/
|
||||
CyFlushCache();
|
||||
#endif /* (CY_PSOC5) */
|
||||
return (result);
|
||||
}
|
||||
#endif /*(CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)*/
|
||||
/** @} functions_group */
|
||||
|
||||
/*******************************************************************************
|
||||
* The following code is OBSOLETE and must not be used.
|
||||
@ -75,14 +258,13 @@ void Bootloadable_1_SetFlashByte(uint32 address, uint8 runType)
|
||||
|
||||
#if(CY_PSOC5)
|
||||
/***************************************************************************
|
||||
* When writing Flash, data in the instruction cache can become stale.
|
||||
* When writing to flash, data in the instruction cache can become obsolete.
|
||||
* Therefore, the cache data does not correlate to the data just written to
|
||||
* Flash. A call to CyFlushCache() is required to invalidate the data in the
|
||||
* cache and force fresh information to be loaded from Flash.
|
||||
* flash. A call to CyFlushCache() is required to invalidate the data in the
|
||||
* cache and force fresh information to be loaded from flash.
|
||||
***************************************************************************/
|
||||
CyFlushCache();
|
||||
#endif /* (CY_PSOC5) */
|
||||
}
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
63
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Bootloadable_1.h
Normal file → Executable file
63
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Bootloadable_1.h
Normal file → Executable file
@ -1,13 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: Bootloadable_1.h
|
||||
* Version 1.30
|
||||
/****************************************************************************//**
|
||||
* \file Bootloadable_1.c
|
||||
* \version 1.50
|
||||
*
|
||||
* Description:
|
||||
* \brief
|
||||
* Provides an API for the Bootloadable application. The API includes a
|
||||
* single function for starting bootloader.
|
||||
* single function for starting the Bootloader.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,7 +25,7 @@
|
||||
/* Check to see if required defines such as CY_PSOC5LP are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5LP)
|
||||
#error Component Bootloadable_v1_30 requires cy_boot v3.0 or later
|
||||
#error Component Bootloadable_v1_50 requires cy_boot v3.0 or later
|
||||
#endif /* !defined (CY_PSOC5LP) */
|
||||
|
||||
|
||||
@ -41,8 +42,8 @@
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* This variable is used by Bootloader/Bootloadable components to schedule what
|
||||
* application will be started after software reset.
|
||||
* This variable is used by the Bootloader/Bootloadable components to schedule which
|
||||
* application will be started after a software reset.
|
||||
*******************************************************************************/
|
||||
#if (CY_PSOC4)
|
||||
#if defined(__ARMCC_VERSION)
|
||||
@ -57,7 +58,7 @@
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Get the reason of the device reset
|
||||
* Gets the reason for a device reset
|
||||
*******************************************************************************/
|
||||
#if(CY_PSOC4)
|
||||
#define Bootloadable_1_RES_CAUSE_RESET_SOFT (0x10u)
|
||||
@ -72,7 +73,7 @@
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Schedule Bootloader/Bootloadable to be run after software reset
|
||||
* Schedule the Bootloader/Bootloadable to be run after a software reset.
|
||||
*******************************************************************************/
|
||||
#if(CY_PSOC4)
|
||||
#define Bootloadable_1_SET_RUN_TYPE(x) (cyBtldrRunType = (x))
|
||||
@ -89,10 +90,41 @@ extern void Bootloadable_1_Load(void) ;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* The following code is OBSOLETE and must not be used starting from version 1.10
|
||||
* The following code is OBSOLETE and must not be used starting from version 1.10.
|
||||
*******************************************************************************/
|
||||
#define CYBTDLR_SET_RUN_TYPE(x) Bootloadable_1_SET_RUN_TYPE(x)
|
||||
|
||||
/*******************************************************************************
|
||||
* Bootloadable's declarations for in-app bootloading.
|
||||
*******************************************************************************/
|
||||
#define Bootloadable_1_MD_BTLDB_ACTIVE_0 (0x00u)
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
#define Bootloadable_1_MAX_NUM_OF_BTLDB (0x02u)
|
||||
#define Bootloadable_1_MD_BTLDB_ACTIVE_1 (0x01u)
|
||||
#define Bootloadable_1_MD_BTLDB_ACTIVE_NONE (0x02u)
|
||||
#define Bootloadable_1_MD_SIZEOF (64u)
|
||||
#define Bootloadable_1_MD_BASE_ADDR(appId) (CYDEV_FLASH_BASE + (CYDEV_FLASH_SIZE - ((uint32)(appId) * CYDEV_FLS_ROW_SIZE) - \
|
||||
Bootloadable_1_MD_SIZEOF))
|
||||
#define Bootloadable_1_MD_BTLDB_ACTIVE_OFFSET(appId) (Bootloadable_1_MD_BASE_ADDR(appId) + 16u)
|
||||
|
||||
#else
|
||||
#define Bootloadable_1_MAX_NUM_OF_BTLDB (0x01u)
|
||||
#endif /* (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)*/
|
||||
|
||||
/* Mask used to indicate starting application */
|
||||
#define Bootloadable_1_SCHEDULE_BTLDB (0x80u)
|
||||
#define Bootloadable_1_SCHEDULE_BTLDR (0x40u)
|
||||
#define Bootloadable_1_SCHEDULE_MASK (0xC0u)
|
||||
/*******************************************************************************
|
||||
* API prototypes
|
||||
*******************************************************************************/
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
uint8 Bootloadable_1_GetActiveApplication(void) CYSMALL \
|
||||
;
|
||||
cystatus Bootloadable_1_SetActiveApplication(uint8 appId) CYSMALL \
|
||||
;
|
||||
#endif /* (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)*/
|
||||
|
||||
/*******************************************************************************
|
||||
* The following code is OBSOLETE and must not be used starting from version 1.20
|
||||
@ -107,7 +139,7 @@ extern void Bootloadable_1_Load(void) ;
|
||||
#define Bootloadable_1_APP_ADDRESS uint16
|
||||
#define Bootloadable_1_GET_CODE_WORD(idx) (*((uint32 CYCODE *) (idx)))
|
||||
|
||||
/* Offset by 2 from 32 bit start because only need 16 bits */
|
||||
/* Offset by 2 from 32 bit start because only 16 bits are needed */
|
||||
#define Bootloadable_1_META_APP_ADDR_OFFSET (3u)
|
||||
#define Bootloadable_1_META_APP_BL_LAST_ROW_OFFSET (7u)
|
||||
#define Bootloadable_1_META_APP_BYTE_LEN_OFFSET (11u)
|
||||
@ -136,18 +168,17 @@ extern void Bootloadable_1_Load(void) ;
|
||||
#define Bootloadable_1_SetFlashRunType(runType) \
|
||||
Bootloadable_1_SetFlashByte(Bootloadable_1_MD_APP_RUN_ADDR(0), (runType))
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* The following code is OBSOLETE and must not be used.
|
||||
*
|
||||
* If the obsoleted macro definitions intended for use in the application use the
|
||||
* If the obsoleted macro definitions are intended for the application, use the
|
||||
* following scheme, redefine your own versions of these definitions:
|
||||
* #ifdef <OBSOLETED_DEFINE>
|
||||
* #undef <OBSOLETED_DEFINE>
|
||||
* #define <OBSOLETED_DEFINE> (<New Value>)
|
||||
* #endif
|
||||
*
|
||||
* Note: Redefine obsoleted macro definitions with caution. They might still be
|
||||
* NOTE Redefine obsoleted macro definitions with caution. They might still be
|
||||
* used in the application and their modification might lead to unexpected
|
||||
* consequences.
|
||||
*******************************************************************************/
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CFG_EEPROM.c
|
||||
* Version 2.10
|
||||
* Version 3.0
|
||||
*
|
||||
* Description:
|
||||
* Provides the source code to the API for the EEPROM component.
|
||||
* Description:
|
||||
* Provides the source code to the API for the EEPROM component.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -15,129 +15,129 @@
|
||||
#include "CFG_EEPROM.h"
|
||||
|
||||
|
||||
#if (CY_PSOC3 || CY_PSOC5LP)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Enable
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Enable the EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Enable(void)
|
||||
{
|
||||
CyEEPROM_Start();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Start
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Starts EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Start(void)
|
||||
{
|
||||
/* Enable the EEPROM */
|
||||
CFG_EEPROM_Enable();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Stop
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Stops and powers down EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Stop (void)
|
||||
{
|
||||
/* Disable EEPROM */
|
||||
CyEEPROM_Stop();
|
||||
}
|
||||
|
||||
#endif /* (CY_PSOC3 || CY_PSOC5LP) */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_EraseSector
|
||||
* Function Name: CFG_EEPROM_Enable
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Erases a sector of memory. This function blocks until the operation is
|
||||
* complete.
|
||||
* Enable the EEPROM block. Also reads the temperature and stores it for
|
||||
* future writes.
|
||||
*
|
||||
* Parameters:
|
||||
* sectorNumber: Sector number to erase.
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Enable(void)
|
||||
{
|
||||
/* Read temperature value */
|
||||
(void)CySetTemp();
|
||||
|
||||
/* Start EEPROM block */
|
||||
CyEEPROM_Start();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Start
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Starts EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Start(void)
|
||||
{
|
||||
CFG_EEPROM_Enable();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Stop
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Stops and powers down EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CFG_EEPROM_Stop (void)
|
||||
{
|
||||
/* Stop and power down EEPROM block */
|
||||
CyEEPROM_Stop();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_WriteByte
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Writes a byte of data to the EEPROM. This function blocks until
|
||||
* the function is complete. For a reliable write procedure to occur you should
|
||||
* call CFG_EEPROM_UpdateTemperature() function if the temperature of the
|
||||
* silicon has been changed for more than 10C since the component was started.
|
||||
*
|
||||
* Parameters:
|
||||
* dataByte: The byte of data to write to the EEPROM
|
||||
* address: The address of data to be written. The maximum address is dependent
|
||||
* on the EEPROM size.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS, if the operation was successful.
|
||||
* CYRET_BAD_PARAM, if the parameter sectorNumber out of range.
|
||||
* CYRET_LOCKED, if the spc is being used.
|
||||
* CYRET_BAD_PARAM, if the parameter sectorNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_EraseSector(uint8 sectorNumber)
|
||||
cystatus CFG_EEPROM_WriteByte(uint8 dataByte, uint16 address)
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
/* Start the SPC */
|
||||
uint16 rowNumber;
|
||||
uint16 byteNumber;
|
||||
|
||||
CySpcStart();
|
||||
|
||||
if(sectorNumber < (uint8) CY_EEPROM_NUMBER_ARRAYS)
|
||||
if (address < CY_EEPROM_SIZE)
|
||||
{
|
||||
/* See if we can get the SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
rowNumber = address/(uint16)CY_EEPROM_SIZEOF_ROW;
|
||||
byteNumber = address - (rowNumber * ((uint16)CY_EEPROM_SIZEOF_ROW));
|
||||
if(CYRET_SUCCESS == CySpcLock())
|
||||
{
|
||||
#if(CY_PSOC5A)
|
||||
|
||||
status = CySpcLoadMultiByte(CY_SPC_FIRST_EE_ARRAYID, byteNumber, &dataByte, \
|
||||
CFG_EEPROM_SPC_BYTE_WRITE_SIZE);
|
||||
if (CYRET_STARTED == status)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
|
||||
/* Command to load a row of data */
|
||||
if(CySpcLoadRow(CY_SPC_FIRST_EE_ARRAYID, 0, CYDEV_EEPROM_ROW_SIZE) == CYRET_STARTED)
|
||||
while(CY_SPC_BUSY)
|
||||
{
|
||||
while(CY_SPC_BUSY)
|
||||
{
|
||||
/* Wait until SPC becomes idle */
|
||||
}
|
||||
|
||||
/* SPC is idle now */
|
||||
if(CY_SPC_STATUS_SUCCESS == CY_SPC_READ_STATUS)
|
||||
{
|
||||
status = CYRET_SUCCESS;
|
||||
}
|
||||
/* Wait until SPC becomes idle */
|
||||
}
|
||||
|
||||
/* Command to erase a sector */
|
||||
if(status == CYRET_SUCCESS)
|
||||
if(CY_SPC_STATUS_SUCCESS == CY_SPC_READ_STATUS)
|
||||
{
|
||||
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
if(CySpcEraseSector(CY_SPC_FIRST_EE_ARRAYID, sectorNumber) == CYRET_STARTED)
|
||||
status = CYRET_SUCCESS;
|
||||
}
|
||||
/* Command to erase and program the row. */
|
||||
if(CYRET_SUCCESS == status)
|
||||
{
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0u],
|
||||
dieTemperature[1u]) == CYRET_STARTED)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
@ -157,19 +157,153 @@ cystatus CFG_EEPROM_EraseSector(uint8 sectorNumber)
|
||||
{
|
||||
status = CYRET_UNKNOWN;
|
||||
}
|
||||
|
||||
#if(CY_PSOC5A)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CYRET_BAD_PARAM != status)
|
||||
{
|
||||
status = CYRET_UNKNOWN;
|
||||
}
|
||||
}
|
||||
CySpcUnlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_LOCKED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_BAD_PARAM;
|
||||
}
|
||||
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* Unlock the SPC so someone else can use it. */
|
||||
CySpcUnlock();
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_ReadByte
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Reads and returns a byte of data from the on-chip EEPROM memory. Although
|
||||
* the data is present in the CPU memory space, this function provides an
|
||||
* intuitive user interface, addressing the EEPROM memory as a separate block with
|
||||
* the first EERPOM byte address equal to 0x0000.
|
||||
*
|
||||
* Parameters:
|
||||
* address: The address of data to be read. The maximum address is limited by the
|
||||
* size of the EEPROM array on a specific device.
|
||||
*
|
||||
* Return:
|
||||
* Data located at an address.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 CFG_EEPROM_ReadByte(uint16 address)
|
||||
{
|
||||
uint8 retByte;
|
||||
uint8 interruptState;
|
||||
|
||||
interruptState = CyEnterCriticalSection();
|
||||
|
||||
/* Request access to EEPROM for reading.
|
||||
This is needed to reserve PHUB for read operation from EEPROM */
|
||||
CyEEPROM_ReadReserve();
|
||||
|
||||
retByte = *((reg8 *) (CYDEV_EE_BASE + address));
|
||||
|
||||
/* Release EEPROM array */
|
||||
CyEEPROM_ReadRelease();
|
||||
|
||||
CyExitCriticalSection(interruptState);
|
||||
|
||||
return (retByte);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_UpdateTemperature
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Updates and stores the temperature value. This function should be called
|
||||
* before EEPROM writes if the temperature may have been changed by more than
|
||||
* 10 degrees Celsius.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* Status of operation, 0 if operation complete, non-zero value if error
|
||||
* was detected.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 CFG_EEPROM_UpdateTemperature(void)
|
||||
{
|
||||
return ((uint8)CySetTemp());
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_EraseSector
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Erase an EEPROM sector (64 rows). This function blocks until the erase
|
||||
* operation is complete. Using this API helps to erase the EEPROM sector at
|
||||
* a time. This is faster than using individual writes but affects a cycle
|
||||
* recourse of the whole EEPROM row.
|
||||
*
|
||||
* Parameters:
|
||||
* sectorNumber: The sector number to erase.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS, if the operation was successful.
|
||||
* CYRET_BAD_PARAM, if the parameter sectorNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_EraseSector(uint8 sectorNumber)
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
CySpcStart();
|
||||
|
||||
if(sectorNumber < (uint8) CFG_EEPROM_SECTORS_NUMBER)
|
||||
{
|
||||
/* See if we can get SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
{
|
||||
if(CySpcEraseSector(CY_SPC_FIRST_EE_ARRAYID, sectorNumber) == CYRET_STARTED)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
|
||||
while(CY_SPC_BUSY)
|
||||
{
|
||||
/* Wait until SPC becomes idle */
|
||||
}
|
||||
|
||||
/* SPC is idle now */
|
||||
if(CY_SPC_STATUS_SUCCESS == CY_SPC_READ_STATUS)
|
||||
{
|
||||
status = CYRET_SUCCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Unlock SPC so that someone else can use it. */
|
||||
CySpcUnlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -190,30 +324,33 @@ cystatus CFG_EEPROM_EraseSector(uint8 sectorNumber)
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Writes a row, CYDEV_EEPROM_ROW_SIZE of data to the EEPROM. This is
|
||||
* a blocking call. It will not return until the function succeeds or fails.
|
||||
* Writes a row (16 bytes) of data to the EEPROM. This function blocks until
|
||||
* the write operation is complete. Compared to functions that write one byte,
|
||||
* this function allows writing a whole row (16 bytes) at a time. For
|
||||
* a reliable write procedure to occur you should call the
|
||||
* CFG_EEPROM_UpdateTemperature() function if the temperature of the
|
||||
* silicon has changed for more than 10C since component was started.
|
||||
*
|
||||
* Parameters:
|
||||
* rowData: Address of the data to write to the EEPROM.
|
||||
* rowNumber: EEPROM row number to program.
|
||||
* rowData: The address of the data to write to the EEPROM.
|
||||
* rowNumber: The row number to write.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS, if the operation was successful.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber out of range.
|
||||
* CYRET_LOCKED, if the spc is being used.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_Write(const uint8 * rowData, uint8 rowNumber)
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
/* Start the SPC */
|
||||
|
||||
CySpcStart();
|
||||
|
||||
if(rowNumber < (uint8) CY_EEPROM_NUMBER_ROWS)
|
||||
{
|
||||
/* See if we can get the SPC. */
|
||||
/* See if we can get SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
{
|
||||
/* Plan for failure */
|
||||
@ -236,8 +373,8 @@ cystatus CFG_EEPROM_Write(const uint8 * rowData, uint8 rowNumber)
|
||||
/* Command to erase and program the row. */
|
||||
if(status == CYRET_SUCCESS)
|
||||
{
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0],
|
||||
dieTemperature[1]) == CYRET_STARTED)
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0u],
|
||||
dieTemperature[1u]) == CYRET_STARTED)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
@ -264,7 +401,7 @@ cystatus CFG_EEPROM_Write(const uint8 * rowData, uint8 rowNumber)
|
||||
}
|
||||
}
|
||||
|
||||
/* Unlock the SPC so someone else can use it. */
|
||||
/* Unlock SPC so that someone else can use it. */
|
||||
CySpcUnlock();
|
||||
}
|
||||
else
|
||||
@ -286,31 +423,44 @@ cystatus CFG_EEPROM_Write(const uint8 * rowData, uint8 rowNumber)
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Starts the SPC write function. This function does not block, it returns
|
||||
* once the command has begun the SPC write function. This function must be used
|
||||
* in combination with CFG_EEPROM_QueryWrite(). Once this function has
|
||||
* been called the SPC will be locked until CFG_EEPROM_QueryWrite()
|
||||
* returns CYRET_SUCCESS.
|
||||
* Starts a write of a row (16 bytes) of data to the EEPROM.
|
||||
* This function does not block. The function returns once the SPC has begun
|
||||
* writing the data. This function must be used in combination with
|
||||
* CFG_EEPROM_Query(). CFG_EEPROM_Query() must be called
|
||||
* until it returns a status other than CYRET_STARTED. That indicates that the
|
||||
* write has completed. Until CFG_EEPROM_Query() detects that
|
||||
* the write is complete, the SPC is marked as locked to prevent another
|
||||
* SPC operation from being performed. For a reliable write procedure to occur
|
||||
* you should call CFG_EEPROM_UpdateTemperature() API if the temperature
|
||||
* of the silicon has changed for more than 10C since component was started.
|
||||
*
|
||||
* Parameters:
|
||||
* rowData: Address of buffer containing a row of data to write to the EEPROM.
|
||||
* rowNumber: EEPROM row number to program.
|
||||
* rowData: The address of the data to write to the EEPROM.
|
||||
* rowNumber: The row number to write.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_STARTED, if the spc command to write was successfuly started.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber out of range.
|
||||
* CYRET_LOCKED, if the spc is being used.
|
||||
* CYRET_STARTED, if the SPC command to write was successfully started.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
* Side effects:
|
||||
* After calling this API, the device should not be powered down, reset or switched
|
||||
* to low power modes until EEPROM operation is complete.
|
||||
* Ignoring this recommendation may lead to data corruption or silicon
|
||||
* unexpected behavior.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_StartWrite(const uint8 * rowData, uint8 rowNumber) \
|
||||
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
CySpcStart();
|
||||
|
||||
if(rowNumber < (uint8) CY_EEPROM_NUMBER_ROWS)
|
||||
{
|
||||
/* See if we can get the SPC. */
|
||||
/* See if we can get SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
{
|
||||
/* Plan for failure */
|
||||
@ -333,8 +483,8 @@ cystatus CFG_EEPROM_StartWrite(const uint8 * rowData, uint8 rowNumber) \
|
||||
/* Command to erase and program the row. */
|
||||
if(status == CYRET_SUCCESS)
|
||||
{
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0],
|
||||
dieTemperature[1]) == CYRET_STARTED)
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0u],
|
||||
dieTemperature[1u]) == CYRET_STARTED)
|
||||
{
|
||||
status = CYRET_STARTED;
|
||||
}
|
||||
@ -364,25 +514,94 @@ cystatus CFG_EEPROM_StartWrite(const uint8 * rowData, uint8 rowNumber) \
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_QueryWrite
|
||||
* Function Name: CFG_EEPROM_StartErase
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Checks the state of write to EEPROM. This function must be called until
|
||||
* the return value is not CYRET_STARTED.
|
||||
* Starts the EEPROM sector erase. This function does not block.
|
||||
* The function returns once the SPC has begun writing the data. This function
|
||||
* must be used in combination with CFG_EEPROM_Query().
|
||||
* CFG_EEPROM_Query() must be called until it returns a status
|
||||
* other than CYRET_STARTED. That indicates the erase has been completed.
|
||||
* Until CFG_EEPROM_Query() detects that the erase is
|
||||
* complete, the SPC is marked as locked to prevent another SPC operation
|
||||
* from being performed.
|
||||
*
|
||||
* Parameters:
|
||||
* sectorNumber: The sector number to erase.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_STARTED, if the SPC command to erase was successfully started.
|
||||
* CYRET_BAD_PARAM, if the parameter sectorNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
* Side effects:
|
||||
* After calling this API, the device should not be powered down, reset or switched
|
||||
* to low power modes until EEPROM operation is complete.
|
||||
* Ignoring this recommendation may lead to data corruption or silicon
|
||||
* unexpected behavior.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_StartErase(uint8 sectorNumber)
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
CySpcStart();
|
||||
|
||||
if(sectorNumber < (uint8) CY_EEPROM_NUMBER_ARRAYS)
|
||||
{
|
||||
/* See if we can get SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
|
||||
/* Command to load a row of data */
|
||||
if(CySpcEraseSector(CY_SPC_FIRST_EE_ARRAYID, sectorNumber) == CYRET_STARTED)
|
||||
{
|
||||
status = CYRET_SUCCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_LOCKED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CYRET_BAD_PARAM;
|
||||
}
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_Query
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Checks the status of an earlier call to CFG_EEPROM_StartWrite() or
|
||||
* CFG_EEPROM_StartErase().
|
||||
* This function must be called until it returns a value other than
|
||||
* CYRET_STARTED. Once that occurs, the write or erase has been completed and
|
||||
* the SPC is unlocked.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* CYRET_STARTED, if the spc command is still processing.
|
||||
* CYRET_SUCCESS, if the operation was successful.
|
||||
* CYRET_STARTED, if the SPC command is still processing.
|
||||
* CYRET_SUCCESS, if the operation was completed successfully.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_QueryWrite(void)
|
||||
cystatus CFG_EEPROM_Query(void)
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
CySpcStart();
|
||||
|
||||
/* Check if SPC is idle */
|
||||
if(CY_SPC_IDLE)
|
||||
@ -397,7 +616,7 @@ cystatus CFG_EEPROM_QueryWrite(void)
|
||||
status = CYRET_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Unlock the SPC so someone else can use it. */
|
||||
/* Unlock SPC so that someone else can use it. */
|
||||
CySpcUnlock();
|
||||
}
|
||||
else
|
||||
@ -410,42 +629,42 @@ cystatus CFG_EEPROM_QueryWrite(void)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CFG_EEPROM_ByteWrite
|
||||
* Function Name: CFG_EEPROM_ByteWritePos
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Writes a byte of data to the EEPROM. This is a blocking call. It will not
|
||||
* return until the function succeeds or fails.
|
||||
* return until the write operation succeeds or fails.
|
||||
*
|
||||
* Parameters:
|
||||
* dataByte: Byte of data to write to the EEPROM.
|
||||
* rowNumber: EEPROM row number to program.
|
||||
* byteNumber: Byte number within the row to program.
|
||||
* dataByte: The byte of data to write to the EEPROM.
|
||||
* rowNumber: The EEPROM row number to program.
|
||||
* byteNumber: The byte number within the row to program.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS, if the operation was successful.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber or byteNumber out of range.
|
||||
* CYRET_LOCKED, if the spc is being used.
|
||||
* CYRET_BAD_PARAM, if the parameter rowNumber or byteNumber is out of range.
|
||||
* CYRET_LOCKED, if the SPC is being used.
|
||||
* CYRET_UNKNOWN, if there was an SPC error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CFG_EEPROM_ByteWrite(uint8 dataByte, uint8 rowNumber, uint8 byteNumber) \
|
||||
cystatus CFG_EEPROM_ByteWritePos(uint8 dataByte, uint8 rowNumber, uint8 byteNumber) \
|
||||
|
||||
{
|
||||
cystatus status;
|
||||
|
||||
/* Start the SPC */
|
||||
/* Start SPC */
|
||||
CySpcStart();
|
||||
|
||||
if((rowNumber < (uint8) CY_EEPROM_NUMBER_ROWS) && (byteNumber < (uint8) SIZEOF_EEPROM_ROW))
|
||||
{
|
||||
/* See if we can get the SPC. */
|
||||
/* See if we can get SPC. */
|
||||
if(CySpcLock() == CYRET_SUCCESS)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
|
||||
/* Command to load a byte of data */
|
||||
/* Command to load byte of data */
|
||||
if(CySpcLoadMultiByte(CY_SPC_FIRST_EE_ARRAYID, (uint16)byteNumber, &dataByte,\
|
||||
CFG_EEPROM_SPC_BYTE_WRITE_SIZE) == CYRET_STARTED)
|
||||
{
|
||||
@ -463,8 +682,8 @@ cystatus CFG_EEPROM_ByteWrite(uint8 dataByte, uint8 rowNumber, uint8 byteNumber)
|
||||
/* Command to erase and program the row. */
|
||||
if(status == CYRET_SUCCESS)
|
||||
{
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0],
|
||||
dieTemperature[1]) == CYRET_STARTED)
|
||||
if(CySpcWriteRow(CY_SPC_FIRST_EE_ARRAYID, (uint16)rowNumber, dieTemperature[0u],
|
||||
dieTemperature[1u]) == CYRET_STARTED)
|
||||
{
|
||||
/* Plan for failure */
|
||||
status = CYRET_UNKNOWN;
|
||||
@ -491,7 +710,7 @@ cystatus CFG_EEPROM_ByteWrite(uint8 dataByte, uint8 rowNumber, uint8 byteNumber)
|
||||
}
|
||||
}
|
||||
|
||||
/* Unlock the SPC so someone else can use it. */
|
||||
/* Unlock SPC so that someone else can use it. */
|
||||
CySpcUnlock();
|
||||
}
|
||||
else
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CFG_EEPROM.h
|
||||
* Version 2.10
|
||||
* Version 3.0
|
||||
*
|
||||
* Description:
|
||||
* Provides the function definitions for the EEPROM APIs.
|
||||
* Description:
|
||||
* Provides the function definitions for the EEPROM APIs.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "CyFlash.h"
|
||||
|
||||
#if !defined(CY_PSOC5LP)
|
||||
#error Component EEPROM_v2_10 requires cy_boot v3.0 or later
|
||||
#error Component EEPROM_v3_0 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5LP) */
|
||||
|
||||
|
||||
@ -27,33 +27,52 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
#if (CY_PSOC3 || CY_PSOC5LP)
|
||||
void CFG_EEPROM_Enable(void) ;
|
||||
void CFG_EEPROM_Start(void);
|
||||
void CFG_EEPROM_Stop(void) ;
|
||||
#endif /* (CY_PSOC3 || CY_PSOC5LP) */
|
||||
|
||||
void CFG_EEPROM_Enable(void) ;
|
||||
void CFG_EEPROM_Start(void) ;
|
||||
void CFG_EEPROM_Stop (void) ;
|
||||
cystatus CFG_EEPROM_WriteByte(uint8 dataByte, uint16 address) \
|
||||
;
|
||||
uint8 CFG_EEPROM_ReadByte(uint16 address) ;
|
||||
uint8 CFG_EEPROM_UpdateTemperature(void) ;
|
||||
cystatus CFG_EEPROM_EraseSector(uint8 sectorNumber) ;
|
||||
cystatus CFG_EEPROM_Write(const uint8 * rowData, uint8 rowNumber) ;
|
||||
cystatus CFG_EEPROM_StartWrite(const uint8 * rowData, uint8 rowNumber) \
|
||||
;
|
||||
cystatus CFG_EEPROM_QueryWrite(void) ;
|
||||
cystatus CFG_EEPROM_ByteWrite(uint8 dataByte, uint8 rowNumber, uint8 byteNumber) \
|
||||
;
|
||||
;
|
||||
cystatus CFG_EEPROM_StartErase(uint8 sectorNumber) ;
|
||||
cystatus CFG_EEPROM_Query(void) ;
|
||||
cystatus CFG_EEPROM_ByteWritePos(uint8 dataByte, uint8 rowNumber, uint8 byteNumber) \
|
||||
;
|
||||
|
||||
|
||||
/****************************************
|
||||
* API Constants
|
||||
****************************************/
|
||||
|
||||
#define CFG_EEPROM_EEPROM_SIZE CYDEV_EE_SIZE
|
||||
#define CFG_EEPROM_EEPROM_SIZE CYDEV_EE_SIZE
|
||||
#define CFG_EEPROM_SPC_BYTE_WRITE_SIZE (0x01u)
|
||||
|
||||
#define CFG_EEPROM_SECTORS_NUMBER (CYDEV_EE_SIZE / CYDEV_EEPROM_SECTOR_SIZE)
|
||||
|
||||
/*******************************************************************************
|
||||
* Following code are OBSOLETE and must not be used starting from EEPROM 2.10
|
||||
*******************************************************************************/
|
||||
#define SPC_BYTE_WRITE_SIZE (CFG_EEPROM_SPC_BYTE_WRITE_SIZE)
|
||||
#define CFG_EEPROM_AHB_REQ_SHIFT (0x00u)
|
||||
#define CFG_EEPROM_AHB_REQ ((uint8)(0x01u << CFG_EEPROM_AHB_REQ_SHIFT))
|
||||
#define CFG_EEPROM_AHB_ACK_SHIFT (0x01u)
|
||||
#define CFG_EEPROM_AHB_ACK_MASK ((uint8)(0x01u << CFG_EEPROM_AHB_ACK_SHIFT))
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
***************************************/
|
||||
#define CFG_EEPROM_SPC_EE_SCR_REG (*(reg8 *) CYREG_SPC_EE_SCR)
|
||||
#define CFG_EEPROM_SPC_EE_SCR_PTR ( (reg8 *) CYREG_SPC_EE_SCR)
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* The following code is DEPRECATED and
|
||||
* should not be used in new projects.
|
||||
***************************************/
|
||||
#define CFG_EEPROM_ByteWrite CFG_EEPROM_ByteWritePos
|
||||
#define CFG_EEPROM_QueryWrite CFG_EEPROM_Query
|
||||
|
||||
#endif /* CY_EEPROM_CFG_EEPROM_H */
|
||||
|
||||
|
55
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3Iar.icf
Normal file → Executable file
55
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3Iar.icf
Normal file → Executable file
@ -20,6 +20,7 @@ define symbol CY_APPL_LOADER = 0;
|
||||
define symbol CY_APPL_NUM = 1;
|
||||
define symbol CY_APPL_MAX = 1;
|
||||
define symbol CY_METADATA_SIZE = 64;
|
||||
define symbol CY_CHECKSUM_EXCLUDE_SIZE = 0;
|
||||
define symbol CY_EE_IN_BTLDR = 0x00;
|
||||
define symbol CY_EE_SIZE = 2048;
|
||||
include "cybootloader.icf";
|
||||
@ -28,7 +29,7 @@ if (!CY_APPL_LOADABLE) {
|
||||
}
|
||||
|
||||
define symbol CY_FLASH_SIZE = 131072;
|
||||
define symbol CY_APPL_ORIGIN = 0;
|
||||
define symbol CY_APPL_ORIGIN = 0;
|
||||
define symbol CY_FLASH_ROW_SIZE = 256;
|
||||
define symbol CY_ECC_ROW_SIZE = 32;
|
||||
|
||||
@ -46,7 +47,7 @@ define block LOADER { readonly section .cybootloader };
|
||||
}
|
||||
define block APPL with fixed order {readonly section .romvectors, readonly};
|
||||
|
||||
/* The address of Flash row next after Bootloader image */
|
||||
/* The address of the Flash row next after the Bootloader image */
|
||||
define symbol CY_BTLDR_END = CYDEV_BTLDR_SIZE +
|
||||
((CYDEV_BTLDR_SIZE % CY_FLASH_ROW_SIZE) ?
|
||||
(CY_FLASH_ROW_SIZE - (CYDEV_BTLDR_SIZE % CY_FLASH_ROW_SIZE)) : 0);
|
||||
@ -97,21 +98,57 @@ if (CY_APPL_LOADABLE)
|
||||
"readwrite" : place in RAM_region { readwrite };
|
||||
"HSTACK" : place at end of RAM_region { block HSTACK};
|
||||
|
||||
keep { section .cybootloader,
|
||||
section .cyloadermeta,
|
||||
keep { section .cybootloader,
|
||||
section .cyloadermeta,
|
||||
section .cyloadablemeta,
|
||||
section .cyconfigecc,
|
||||
section .cycustnvl,
|
||||
section .cyconfigecc,
|
||||
section .cy_checksum_exclude,
|
||||
section .cycustnvl,
|
||||
section .cywolatch,
|
||||
section .cyeeprom,
|
||||
section .cyeeprom,
|
||||
section .cyflashprotect,
|
||||
section .cymeta };
|
||||
|
||||
".cyloadermeta" : place at address mem : (CY_APPL_LOADER ? (CY_FLASH_SIZE - CY_METADATA_SIZE) : 0xF0000000) { readonly section .cyloadermeta };
|
||||
".cyloadermeta" : place at address mem : ((CY_APPL_LOADER && !CY_APPL_LOADABLE) ? (CY_FLASH_SIZE - CY_METADATA_SIZE) : 0xF0000000) { readonly section .cyloadermeta };
|
||||
if (CY_APPL_LOADABLE)
|
||||
{
|
||||
".cyloadablemeta" : place at address mem : (CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * (CY_APPL_NUM - 1) - CY_METADATA_SIZE) { readonly section .cyloadablemeta };
|
||||
".cyloadablemeta" : place at address mem : (CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * (CY_APPL_NUM - 1) - CY_METADATA_SIZE) { readonly section .cyloadablemeta };
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Checksum Exclude Section. See cm0gcc.ld on placement details.
|
||||
*******************************************************************************/
|
||||
if (CY_APPL_LOADABLE)
|
||||
{
|
||||
/* Align size to the flash row size */
|
||||
define symbol CY_CHECKSUM_EXCLUDE_SIZE_ALIGNED = CY_CHECKSUM_EXCLUDE_SIZE + ((CY_CHECKSUM_EXCLUDE_SIZE % CY_FLASH_ROW_SIZE) ? (CY_FLASH_ROW_SIZE - (CY_CHECKSUM_EXCLUDE_SIZE % CY_FLASH_ROW_SIZE)) : 0);
|
||||
|
||||
if (CY_CHECKSUM_EXCLUDE_SIZE != 0)
|
||||
{
|
||||
|
||||
/* General case */
|
||||
if ((CY_APPL_NUM == 1) && (CY_APPL_MAX == 2))
|
||||
{
|
||||
define symbol CY_CHECKSUM_EXCLUDE_START = CY_APPL2_START - CY_CHECKSUM_EXCLUDE_SIZE_ALIGNED;
|
||||
}
|
||||
else
|
||||
{
|
||||
define symbol CY_CHECKSUM_EXCLUDE_START = (CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * CY_APPL_MAX) - CY_CHECKSUM_EXCLUDE_SIZE_ALIGNED;
|
||||
}
|
||||
|
||||
define symbol CY_CHECKSUM_EXCLUDE_START_ALIGNED = CY_CHECKSUM_EXCLUDE_START + ((CY_CHECKSUM_EXCLUDE_START % CY_FLASH_ROW_SIZE) ? (CY_FLASH_ROW_SIZE - (CY_CHECKSUM_EXCLUDE_START % CY_FLASH_ROW_SIZE)) : 0);
|
||||
|
||||
".cy_checksum_exclude" : place at address mem : (CY_CHECKSUM_EXCLUDE_START_ALIGNED) { readonly section .cy_checksum_exclude };
|
||||
|
||||
} /* (CY_CHECKSUM_EXCLUDE_SIZE_ALIGNED != 0) */
|
||||
}
|
||||
else
|
||||
{
|
||||
".cy_checksum_exclude" : place in ROM_region { readonly section .cy_checksum_exclude };
|
||||
}
|
||||
|
||||
|
||||
".cyconfigecc" : place at address mem : (0x80000000 + CY_ECC_OFFSET) { readonly section .cyconfigecc };
|
||||
".cycustnvl" : place at address mem : 0x90000000 { readonly section .cycustnvl };
|
||||
".cywolatch" : place at address mem : 0x90100000 { readonly section .cywolatch };
|
||||
|
100
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3RealView.scat
Normal file → Executable file
100
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3RealView.scat
Normal file → Executable file
@ -1,31 +1,24 @@
|
||||
#! armcc -E
|
||||
; The first line specifies a preprocessor command that the linker invokes
|
||||
; The first line specifies a preprocessor command that the linker invokes
|
||||
; to pass a scatter file through a C preprocessor.
|
||||
|
||||
;********************************************************************************
|
||||
;* File Name: Cm3RealView.scat
|
||||
;* Version 4.20
|
||||
;* \file Cm3RealView.scat
|
||||
;* \version 5.50
|
||||
;*
|
||||
;* Description:
|
||||
;* This Linker Descriptor file describes the memory layout of the PSoC5
|
||||
;* device. The memory layout of the final binary and hex images as well as
|
||||
;* the placement in PSoC5 memory is described.
|
||||
;*
|
||||
;*
|
||||
;* Note:
|
||||
;* \brief
|
||||
;* This Linker Descriptor file describes the memory layout of the PSoC5
|
||||
;* device. The memory layout of the final binary and hex images as well as
|
||||
;* the placement in PSoC5 memory is described.
|
||||
;*
|
||||
;* romvectors: Cypress default Interrupt service routine vector table.
|
||||
;*
|
||||
;* This is the ISR vector table at bootup. Used only for the reset vector.
|
||||
;*
|
||||
;*
|
||||
;* ramvectors: Cypress ram interrupt service routine vector table.
|
||||
;*
|
||||
;* This is the ISR vector table used by the application.
|
||||
;*
|
||||
;*
|
||||
;********************************************************************************
|
||||
;* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
;* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
;* You may use this file only in accordance with the license, terms, conditions,
|
||||
;* disclaimers, and limitations in the end user license agreement accompanying
|
||||
;* the software package with which this file was provided.
|
||||
@ -39,12 +32,16 @@
|
||||
#define CY_EE_SIZE 2048
|
||||
#define CY_METADATA_SIZE 64
|
||||
|
||||
#define CY_CHECKSUM_EXCLUDE_SIZE AlignExpr(0, CY_FLASH_ROW_SIZE)
|
||||
#define CY_APPL_NUM 1
|
||||
#define CY_APPL_MAX 1
|
||||
|
||||
|
||||
; Define application base address
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE)
|
||||
#define CY_APPL_NUM 1
|
||||
#define CY_APPL_MAX 1
|
||||
#define CY_EE_IN_BTLDR 0
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE || \
|
||||
CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
#define CY_EE_IN_BTLDR 0
|
||||
|
||||
#if CY_APPL_ORIGIN
|
||||
#define APPL1_START CY_APPL_ORIGIN
|
||||
@ -68,7 +65,8 @@
|
||||
|
||||
|
||||
; Place Bootloader at the beginning of Flash
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE)
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE || \
|
||||
CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
CYBOOTLOADER 0
|
||||
{
|
||||
@ -79,7 +77,7 @@
|
||||
}
|
||||
|
||||
#if CY_APPL_ORIGIN
|
||||
ScatterAssert(APPL_START > LoadLimit(CYBOOTLOADER))
|
||||
ScatterAssert(APPL_START >= LoadLimit(CYBOOTLOADER))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -122,26 +120,62 @@ APPLICATION APPL_START (CY_FLASH_SIZE - APPL_START)
|
||||
}
|
||||
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_BOOTLOADER || CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_MULTIAPPBOOTLOADER)
|
||||
/*******************************************************************************
|
||||
* Bootloader Metadata Section. See cm0gcc.ld on placement details.
|
||||
*******************************************************************************/
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_BOOTLOADER || \
|
||||
CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_MULTIAPPBOOTLOADER || \
|
||||
CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LAUNCHER)
|
||||
|
||||
CYLOADERMETA (CY_FLASH_SIZE - CY_METADATA_SIZE)
|
||||
{
|
||||
.cyloadermeta +0 { * (.cyloadermeta) }
|
||||
}
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE)
|
||||
|
||||
CYLOADABLEMETA (CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * (CY_APPL_NUM - 1) - CY_METADATA_SIZE)
|
||||
{
|
||||
.cyloadablemeta +0 { * (.cyloadablemeta) }
|
||||
}
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
* Bootloadable Metadata Section. See cm0gcc.ld on placement details.
|
||||
*******************************************************************************/
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE || \
|
||||
CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
CYLOADABLEMETA (CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * (CY_APPL_NUM - 1) - CY_METADATA_SIZE)
|
||||
{
|
||||
.cyloadablemeta +0 { * (.cyloadablemeta) }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Checksum Exclude Section. See cm0gcc.ld on placement details.
|
||||
*******************************************************************************/
|
||||
#if ((CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE) || (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER))
|
||||
|
||||
#if (0 != 0)
|
||||
|
||||
#if ((CY_APPL_NUM == 1) && (CY_APPL_MAX == 2))
|
||||
#define CY_CHECKSUM_APPL2_START (APPL1_START + AlignExpr(((CY_FLASH_SIZE - APPL1_START - 2 * CY_FLASH_ROW_SIZE) / 2 ), CY_FLASH_ROW_SIZE))
|
||||
#define CY_CHECKSUM_EXCLUDE_START AlignExpr(CY_CHECKSUM_APPL2_START - CY_CHECKSUM_EXCLUDE_SIZE, CY_FLASH_ROW_SIZE)
|
||||
#else
|
||||
#define CY_CHECKSUM_EXCLUDE_START AlignExpr((CY_FLASH_SIZE - CY_FLASH_ROW_SIZE * CY_APPL_MAX) - CY_CHECKSUM_EXCLUDE_SIZE, CY_FLASH_ROW_SIZE)
|
||||
#endif
|
||||
|
||||
CY_CHECKSUM_EXCLUDE (CY_CHECKSUM_EXCLUDE_START)
|
||||
{
|
||||
.cy_checksum_exclude +0
|
||||
{
|
||||
* (.cy_checksum_exclude)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* (0 != 0) */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if (CYDEV_ECC_ENABLE == 0)
|
||||
|
||||
CYCONFIGECC (0x80000000 + ECC_OFFSET)
|
||||
@ -180,7 +214,11 @@ CYMETA 0x90500000
|
||||
.cymeta +0 { * (.cymeta) }
|
||||
}
|
||||
|
||||
#if (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE)
|
||||
|
||||
/*******************************************************************************
|
||||
* Bootloader Metadata Section. Must be part of the image, but beyond rom memory.
|
||||
*******************************************************************************/
|
||||
#if ((CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLE) || (CYDEV_PROJ_TYPE == CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER))
|
||||
|
||||
CYLOADERMETA +0
|
||||
{
|
||||
|
176
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3Start.c
Normal file → Executable file
176
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Cm3Start.c
Normal file → Executable file
@ -1,12 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* File Name: Cm3Start.c
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file Cm3Start.c
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* \brief
|
||||
* Startup code for the ARM CM3.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -20,6 +21,7 @@
|
||||
#include "CyDmac.h"
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
#define CY_NUM_INTERRUPTS (32u)
|
||||
#define CY_NUM_VECTORS (CYINT_IRQ_BASE + CY_NUM_INTERRUPTS)
|
||||
#define CY_NUM_ROM_VECTORS (4u)
|
||||
@ -29,16 +31,6 @@
|
||||
#define CY_NVIC_APINT_VECTKEY (0x05FA0000u) /* This key is required in order to write the NVIC_APINT register */
|
||||
#define CY_NVIC_CFG_STACKALIGN (0x00000200u) /* This specifies that the exception stack must be 8 byte aligned */
|
||||
|
||||
|
||||
/* Extern functions */
|
||||
extern void CyBtldr_CheckLaunch(void);
|
||||
|
||||
/* Function prototypes */
|
||||
void initialize_psoc(void);
|
||||
CY_ISR(IntDefaultHandler);
|
||||
void Reset(void);
|
||||
CY_ISR(IntDefaultHandler);
|
||||
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#define INITIAL_STACK_POINTER ((cyisraddress)(uint32)&Image$$ARM_LIB_STACK$$ZI$$Limit)
|
||||
#elif defined (__GNUC__)
|
||||
@ -58,6 +50,14 @@ CY_ISR(IntDefaultHandler);
|
||||
extern int end;
|
||||
#endif /* defined(__GNUC__) */
|
||||
|
||||
/* Extern functions */
|
||||
extern void CyBtldr_CheckLaunch(void);
|
||||
|
||||
/* Function prototypes */
|
||||
void initialize_psoc(void);
|
||||
CY_ISR(IntDefaultHandler);
|
||||
void Reset(void);
|
||||
|
||||
/* Global variables */
|
||||
#if !defined (__ICCARM__)
|
||||
CY_NOINIT static uint32 cySysNoInitDataValid;
|
||||
@ -79,32 +79,48 @@ cyisraddress CyRamVectors[CY_NUM_VECTORS];
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: IntDefaultHandler
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function is called for all interrupts, other than a reset that gets
|
||||
* called before the system is setup.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* Theory:
|
||||
* Any value other than zero is acceptable.
|
||||
*
|
||||
*******************************************************************************/
|
||||
CY_ISR(IntDefaultHandler)
|
||||
{
|
||||
/***************************************************************************
|
||||
* We must not get here. If we do, a serious problem occurs, so go into
|
||||
* an infinite loop.
|
||||
***************************************************************************/
|
||||
|
||||
while(1)
|
||||
{
|
||||
/***********************************************************************
|
||||
* We must not get here. If we do, a serious problem occurs, so go
|
||||
* into an infinite loop.
|
||||
***********************************************************************/
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
if (errno == ENOMEM)
|
||||
{
|
||||
#ifdef CY_BOOT_INT_DEFAULT_HANDLER_ENOMEM_EXCEPTION_CALLBACK
|
||||
CyBoot_IntDefaultHandler_Enomem_Exception_Callback();
|
||||
#endif /* CY_BOOT_INT_DEFAULT_HANDLER_ENOMEM_EXCEPTION_CALLBACK */
|
||||
|
||||
while(1)
|
||||
{
|
||||
/* Out Of Heap Space
|
||||
* This can be increased in the System tab of the Design Wide Resources.
|
||||
*/
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK
|
||||
CyBoot_IntDefaultHandler_Exception_EntryCallback();
|
||||
#endif /* CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK */
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -125,22 +141,15 @@ extern int __main(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Reset
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function handles the reset interrupt for the RVDS/MDK toolchains.
|
||||
* This is the first bit of code that is executed at startup.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void Reset(void)
|
||||
{
|
||||
#if(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE)
|
||||
#if(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
/* For PSoC 5LP, debugging is enabled by default */
|
||||
#if(CYDEV_DEBUGGING_ENABLE == 0)
|
||||
@ -152,11 +161,11 @@ void Reset(void)
|
||||
*/
|
||||
*(reg32 *)(CYREG_PHUB_CFGMEM23_CFG1) = *(reg32 *)(CYREG_RESET_SR0);
|
||||
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE) */
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER) */
|
||||
|
||||
#if(CYDEV_BOOTLOADER_ENABLE)
|
||||
#if ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER))
|
||||
CyBtldr_CheckLaunch();
|
||||
#endif /* (CYDEV_BOOTLOADER_ENABLE) */
|
||||
#endif /* ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)) */
|
||||
|
||||
__main();
|
||||
}
|
||||
@ -164,17 +173,10 @@ void Reset(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: $Sub$$main
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function is called immediately before the users main
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void $Sub$$main(void)
|
||||
{
|
||||
@ -224,27 +226,19 @@ extern const char __cy_region_num __attribute__((weak));
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: _exit
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Exit a program without cleaning up files. If your system doesn't provide
|
||||
* this, it is best to avoid linking with subroutines that require it (exit,
|
||||
* system).
|
||||
*
|
||||
* Parameters:
|
||||
* status: Status caused program exit.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param status: Status caused program exit.
|
||||
*
|
||||
*******************************************************************************/
|
||||
__attribute__((weak))
|
||||
void _exit(int status)
|
||||
{
|
||||
/* Cause divide by 0 exception */
|
||||
int x = status / (int) INT_MAX;
|
||||
x = 4 / x;
|
||||
|
||||
CyHalt((uint8) status);
|
||||
while(1)
|
||||
{
|
||||
|
||||
@ -254,22 +248,17 @@ void _exit(int status)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: _sbrk
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Increase program data space. As malloc and related functions depend on this,
|
||||
* it is useful to have a working implementation. The following suffices for a
|
||||
* standalone system; it exploits the symbol end automatically defined by the
|
||||
* GNU linker.
|
||||
*
|
||||
* Parameters:
|
||||
* nbytes: The number of bytes requested (if the parameter value is positive)
|
||||
* \param nbytes: The number of bytes requested (if the parameter value is positive)
|
||||
* from the heap or returned back to the heap (if the parameter value is
|
||||
* negative).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
__attribute__((weak))
|
||||
void * _sbrk (int nbytes)
|
||||
@ -297,22 +286,15 @@ void * _sbrk (int nbytes)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Reset
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function handles the reset interrupt for the GCC toolchain. This is the
|
||||
* first bit of code that is executed at startup.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void Reset(void)
|
||||
{
|
||||
#if(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE)
|
||||
#if(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
/* For PSoC 5LP, debugging is enabled by default */
|
||||
#if(CYDEV_DEBUGGING_ENABLE == 0)
|
||||
@ -324,11 +306,11 @@ void Reset(void)
|
||||
*/
|
||||
*(reg32 *)(CYREG_PHUB_CFGMEM23_CFG1) = *(reg32 *)(CYREG_RESET_SR0);
|
||||
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE) */
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER) */
|
||||
|
||||
#if(CYDEV_BOOTLOADER_ENABLE)
|
||||
#if ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER))
|
||||
CyBtldr_CheckLaunch();
|
||||
#endif /* (CYDEV_BOOTLOADER_ENABLE) */
|
||||
#endif /* ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)) */
|
||||
|
||||
Start_c();
|
||||
}
|
||||
@ -336,19 +318,12 @@ void Reset(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: Start_c
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function handles initializing the .data and .bss sections in
|
||||
* preparation for running the standard C code. Once initialization is complete
|
||||
* it will call main(). This function will never return.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void Start_c(void) __attribute__ ((noreturn));
|
||||
void Start_c(void)
|
||||
@ -395,17 +370,13 @@ void Start_c(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: __low_level_init
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function performs early initializations for the IAR Embedded
|
||||
* Workbench IDE. It is executed in the context of a reset interrupt handler
|
||||
* before the data sections are initialized.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* The value that determines whether or not data sections should be initialized
|
||||
* by the system startup code:
|
||||
* 0 - skip data sections initialization;
|
||||
@ -414,7 +385,7 @@ void Start_c(void)
|
||||
*******************************************************************************/
|
||||
int __low_level_init(void)
|
||||
{
|
||||
#if(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE)
|
||||
#if (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)
|
||||
|
||||
/* For PSoC 5LP, debugging is enabled by default */
|
||||
#if(CYDEV_DEBUGGING_ENABLE == 0)
|
||||
@ -426,11 +397,11 @@ int __low_level_init(void)
|
||||
*/
|
||||
*(reg32 *)(CYREG_PHUB_CFGMEM23_CFG1) = *(reg32 *)(CYREG_RESET_SR0);
|
||||
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE) */
|
||||
#endif /* (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLE && CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER) */
|
||||
|
||||
#if (CYDEV_BOOTLOADER_ENABLE)
|
||||
#if ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER))
|
||||
CyBtldr_CheckLaunch();
|
||||
#endif /* CYDEV_BOOTLOADER_ENABLE */
|
||||
#endif /* ((CYDEV_BOOTLOADER_ENABLE) && (CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER)) */
|
||||
|
||||
/* Initialize data sections */
|
||||
__iar_data_init3();
|
||||
@ -478,17 +449,10 @@ int __low_level_init(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: initialize_psoc
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function used to initialize the PSoC chip before calling main.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
#if (defined(__GNUC__) && !defined(__ARMCC_VERSION))
|
||||
__attribute__ ((constructor(101)))
|
||||
|
37
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmGnu.s
Normal file → Executable file
37
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmGnu.s
Normal file → Executable file
@ -1,12 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyBootAsmGnu.s
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyBootAsmGnu.s
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* \brief
|
||||
* Assembly routines for GNU as.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2010-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2010-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,16 +22,11 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDelayCycles
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Delays for the specified number of cycles.
|
||||
*
|
||||
* Parameters:
|
||||
* uint32 cycles: number of cycles to delay.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param uint32 cycles: number of cycles to delay.
|
||||
*
|
||||
*******************************************************************************/
|
||||
/* void CyDelayCycles(uint32 cycles) */
|
||||
@ -107,9 +103,8 @@ cy_flash_cycles:
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyEnterCriticalSection
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* CyEnterCriticalSection disables interrupts and returns a value indicating
|
||||
* whether interrupts were previously enabled (the actual value depends on
|
||||
* whether the device is PSoC 3 or PSoC 5).
|
||||
@ -120,10 +115,7 @@ cy_flash_cycles:
|
||||
* corrupting processor state, it must be the policy that all interrupt routines
|
||||
* restore the interrupt enable bits as they were found on entry.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* uint8
|
||||
* Returns 0 if interrupts were previously enabled or 1 if interrupts
|
||||
* were previously disabled.
|
||||
@ -143,20 +135,15 @@ CyEnterCriticalSection:
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyExitCriticalSection
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* CyExitCriticalSection re-enables interrupts if they were enabled before
|
||||
* CyEnterCriticalSection was called. The argument should be the value returned
|
||||
* from CyEnterCriticalSection.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 savedIntrStatus:
|
||||
* \param uint8 savedIntrStatus:
|
||||
* Saved interrupt status returned by the CyEnterCriticalSection function.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
/* void CyExitCriticalSection(uint8 savedIntrStatus) */
|
||||
.global CyExitCriticalSection
|
||||
|
4
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmIar.s
Normal file → Executable file
4
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmIar.s
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
; FILENAME: CyBootAsmIar.s
|
||||
; Version 4.20
|
||||
; Version 5.50
|
||||
;
|
||||
; DESCRIPTION:
|
||||
; Assembly routines for IAR Embedded Workbench IDE.
|
||||
;
|
||||
;-------------------------------------------------------------------------------
|
||||
; Copyright 2013-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; Copyright 2013-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; You may use this file only in accordance with the license, terms, conditions,
|
||||
; disclaimers, and limitations in the end user license agreement accompanying
|
||||
; the software package with which this file was provided.
|
||||
|
4
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmRv.s
Normal file → Executable file
4
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyBootAsmRv.s
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
; FILENAME: CyBootAsmRv.s
|
||||
; Version 4.20
|
||||
; Version 5.50
|
||||
;
|
||||
; DESCRIPTION:
|
||||
; Assembly routines for RealView.
|
||||
;
|
||||
;-------------------------------------------------------------------------------
|
||||
; Copyright 2010-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; Copyright 2010-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; You may use this file only in accordance with the license, terms, conditions,
|
||||
; disclaimers, and limitations in the end user license agreement accompanying
|
||||
; the software package with which this file was provided.
|
||||
|
422
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyDmac.c
Normal file → Executable file
422
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyDmac.c
Normal file → Executable file
@ -1,27 +1,26 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyDmac.c
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyDmac.c
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides an API for the DMAC component. The API includes functions for the
|
||||
* DMA controller, DMA channels and Transfer Descriptors.
|
||||
* \brief
|
||||
* Provides an API for the DMAC component. The API includes functions for the
|
||||
* DMA controller, DMA channels and Transfer Descriptors. This API is the library
|
||||
* version not the auto generated code that gets generated when the user places a
|
||||
* DMA component on the schematic.
|
||||
*
|
||||
* This API is the library version not the auto generated code that gets
|
||||
* generated when the user places a DMA component on the schematic.
|
||||
* The auto generated code would use the APi's in this module.
|
||||
*
|
||||
* The auto generated code would use the APi's in this module.
|
||||
* \note This code is endian agnostic.
|
||||
*
|
||||
* Note:
|
||||
* This code is endian agnostic.
|
||||
* \note The Transfer Descriptor memory can be used as regular memory if the
|
||||
* TD's are not being used.
|
||||
*
|
||||
* The Transfer Descriptor memory can be used as regular memory if the TD's are
|
||||
* not being used.
|
||||
*
|
||||
* This code uses the first byte of each TD to manage the free list of TD's.
|
||||
* The user can overwrite this once the TD is allocated.
|
||||
* \note This code uses the first byte of each TD to manage the free list of
|
||||
* TD's. The user can overwrite this once the TD is allocated.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -44,18 +43,11 @@ static uint32 CyDmaChannels = DMA_CHANNELS_USED__MASK0; /* Bit map
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmacConfigure
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Creates a linked list of all the TDs to be allocated. This function is called
|
||||
* by the startup code; you do not normally need to call it. You can call this
|
||||
* function if all of the DMA channels are inactive.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* Creates a linked list of all the TDs to be allocated. This function is called
|
||||
* by the startup code; you do not normally need to call it. You can call this
|
||||
* function if all of the DMA channels are inactive.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyDmacConfigure(void)
|
||||
@ -79,16 +71,11 @@ void CyDmacConfigure(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmacError
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Returns errors of the last failed DMA transaction.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* Errors of the last failed DMA transaction.
|
||||
* \return Errors of the last failed DMA transaction.
|
||||
*
|
||||
* DMAC_PERIPH_ERR:
|
||||
* Set to 1 when a peripheral responds to a bus transaction with an error
|
||||
@ -102,43 +89,38 @@ void CyDmacConfigure(void)
|
||||
* are determined by the BUS_TIMEOUT field in the PHUBCFG register.
|
||||
*
|
||||
* Theory:
|
||||
* Once an error occurs the error bits are sticky and are only cleared by
|
||||
* Once an error occurs the error bits are sticky and are only cleared by
|
||||
* writing 1 to the error register.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 CyDmacError(void)
|
||||
{
|
||||
return((uint8)(((uint32) 0x0Fu) & *CY_DMA_ERR_PTR));
|
||||
return((uint8)(((uint32) 0x0Eu) & *CY_DMA_ERR_PTR));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmacClearError
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Clears the error bits in the error register of the DMAC.
|
||||
*
|
||||
* Parameters:
|
||||
* error:
|
||||
* \param error:
|
||||
* Clears the error bits in the DMAC error register.
|
||||
*
|
||||
* DMAC_PERIPH_ERR:
|
||||
* \param DMAC_PERIPH_ERR:
|
||||
* Set to 1 when a peripheral responds to a bus transaction with an error
|
||||
* response.
|
||||
*
|
||||
* DMAC_UNPOP_ACC:
|
||||
* \param DMAC_UNPOP_ACC:
|
||||
* Set to 1 when an access is attempted to an invalid address.
|
||||
*
|
||||
* DMAC_BUS_TIMEOUT:
|
||||
* \param DMAC_BUS_TIMEOUT:
|
||||
* Set to 1 when a bus timeout occurs. Cleared by writing 1. Timeout values
|
||||
* are determined by the BUS_TIMEOUT field in the PHUBCFG register.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* Theory:
|
||||
* Once an error occurs the error bits are sticky and are only cleared by
|
||||
* Once an error occurs the error bits are sticky and are only cleared by
|
||||
* writing 1 to the error register.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -150,20 +132,15 @@ void CyDmacClearError(uint8 error)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmacErrorAddress
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* When DMAC_BUS_TIMEOUT, DMAC_UNPOP_ACC, and DMAC_PERIPH_ERR occur the
|
||||
* address of the error is written to the error address register and can be read
|
||||
* with this function.
|
||||
*
|
||||
* If there are multiple errors, only the address of the first is saved.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* The address that caused the error.
|
||||
* \return The address that caused the error.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint32 CyDmacErrorAddress(void)
|
||||
@ -174,17 +151,12 @@ uint32 CyDmacErrorAddress(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChAlloc
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Allocates a channel from the DMAC to be used in all functions that require a
|
||||
* channel handle.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* The allocated channel number. Zero is a valid channel number.
|
||||
* \return The allocated channel number. Zero is a valid channel number.
|
||||
* DMA_INVALID_CHANNEL is returned if there are no channels available.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -225,18 +197,15 @@ uint8 CyDmaChAlloc(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChFree
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Frees a channel allocated by DmaChAlloc().
|
||||
* Frees a channel allocated by \ref DmaChAlloc().
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* The handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle The handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChFree(uint8 chHandle)
|
||||
@ -263,19 +232,16 @@ cystatus CyDmaChFree(uint8 chHandle)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChEnable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Enables the DMA channel. A software or hardware request still must happen
|
||||
* before the channel is executed.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* uint8 preserveTds:
|
||||
* Preserves the original TD state when the TD has completed. This parameter
|
||||
* applies to all TDs in the channel.
|
||||
* \param preserveTds Preserves the original TD state when the TD has completed.
|
||||
* This parameter applies to all TDs in the channel.
|
||||
*
|
||||
* 0 - When TD is completed, the DMAC leaves the TD configuration values in
|
||||
* their current state, and does not restore them to their original state.
|
||||
@ -288,7 +254,7 @@ cystatus CyDmaChFree(uint8 chHandle)
|
||||
* if you are using CH06 and preserveTds is set, you are not allowed to use TD
|
||||
* slot 6. That is reclaimed by the DMA engine for its private use.
|
||||
*
|
||||
* Note Do not chain back to a completed TD if the preserveTds for the channel
|
||||
* \note Do not chain back to a completed TD if the preserveTds for the channel
|
||||
* is set to 0. When a TD has completed preserveTds for the channel set to 0,
|
||||
* the transfer count will be at 0. If a TD with a transfer count of 0 is
|
||||
* started, the TD will transfer an indefinite amount of data.
|
||||
@ -296,9 +262,8 @@ cystatus CyDmaChFree(uint8 chHandle)
|
||||
* Take extra precautions when using the hardware request (DRQ) option when the
|
||||
* preserveTds is set to 0, as you might be requesting the wrong data.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChEnable(uint8 chHandle, uint8 preserveTds)
|
||||
@ -332,23 +297,20 @@ cystatus CyDmaChEnable(uint8 chHandle, uint8 preserveTds)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChDisable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disables the DMA channel. Once this function is called, CyDmaChStatus() may
|
||||
* be called to determine when the channel is disabled and which TDs were being
|
||||
* executed.
|
||||
* Disables the DMA channel. Once this function is called, CyDmaChStatus() may
|
||||
* be called to determine when the channel is disabled and which TDs were being
|
||||
* executed.
|
||||
*
|
||||
* If it is currently executing it will allow the current burst to finish
|
||||
* naturally.
|
||||
* If it is currently executing it will allow the current burst to finish
|
||||
* naturally.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChDisable(uint8 chHandle)
|
||||
@ -376,18 +338,14 @@ cystatus CyDmaChDisable(uint8 chHandle)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaClearPendingDrq
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Clears pending the DMA data request.
|
||||
* Clears pending the DMA data request.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* Handle to the dma channel.
|
||||
* \param chHandle Handle to the dma channel.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaClearPendingDrq(uint8 chHandle)
|
||||
@ -407,23 +365,19 @@ cystatus CyDmaClearPendingDrq(uint8 chHandle)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChPriority
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the priority of a DMA channel. You can use this function when you want
|
||||
* to change the priority at run time. If the priority remains the same for a
|
||||
* DMA channel, then you can configure the priority in the .cydwr file.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* uint8 priority:
|
||||
* Priority to set the channel to, 0 - 7.
|
||||
* \param priority Priority to set the channel to, 0 - 7.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChPriority(uint8 chHandle, uint8 priority)
|
||||
@ -446,25 +400,20 @@ cystatus CyDmaChPriority(uint8 chHandle, uint8 priority)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChSetExtendedAddress
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the high 16 bits of the source and destination addresses for the DMA
|
||||
* channel (valid for all TDs in the chain).
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* uint16 source:
|
||||
* Upper 16 bit address of the DMA transfer source.
|
||||
* \param source Upper 16 bit address of the DMA transfer source.
|
||||
*
|
||||
* uint16 destination:
|
||||
* Upper 16 bit address of the DMA transfer destination.
|
||||
* \param destination Upper 16 bit address of the DMA transfer destination.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChSetExtendedAddress(uint8 chHandle, uint16 source, uint16 destination) \
|
||||
@ -507,23 +456,19 @@ cystatus CyDmaChSetExtendedAddress(uint8 chHandle, uint16 source, uint16 destina
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChSetInitialTd
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the initial TD to be executed for the channel when the CyDmaChEnable()
|
||||
* function is called.
|
||||
* Sets the initial TD to be executed for the channel when the \ref CyDmaChEnable()
|
||||
* function is called.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitialize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or
|
||||
* \ref DMA_DmaInitialize().
|
||||
*
|
||||
* uint8 startTd:
|
||||
* Set the TD index as the first TD associated with the channel. Zero is
|
||||
* a valid TD index.
|
||||
* \param startTd Set the TD index as the first TD associated with the
|
||||
* channel. Zero is a valid TD index.
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChSetInitialTd(uint8 chHandle, uint8 startTd)
|
||||
@ -542,26 +487,22 @@ cystatus CyDmaChSetInitialTd(uint8 chHandle, uint8 startTd)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChSetRequest
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Allows the caller to terminate a chain of TDs, terminate one TD, or create a
|
||||
* direct request to start the DMA channel.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
*
|
||||
* uint8 request:
|
||||
* One of the following constants. Each of the constants is a three-bit value.
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* \param request One of the following constants. Each of the constants is a
|
||||
* three-bit value.
|
||||
* CPU_REQ - Create a direct request to start the DMA channel
|
||||
* CPU_TERM_TD - Terminate one TD
|
||||
* CPU_TERM_CHAIN - Terminate a chain of TDs
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChSetRequest(uint8 chHandle, uint8 request)
|
||||
@ -580,21 +521,18 @@ cystatus CyDmaChSetRequest(uint8 chHandle, uint8 request)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChGetRequest
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This function allows the caller of CyDmaChSetRequest() to determine if the
|
||||
* request was completed.
|
||||
* This function allows the caller of \ref CyDmaChSetRequest() to determine if the
|
||||
* request was completed.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* Return:
|
||||
* Returns a three-bit field, corresponding to the three bits of the request,
|
||||
* which describes the state of the previously posted request. If the value is
|
||||
* zero, the request was completed. CY_DMA_INVALID_CHANNEL if the handle is
|
||||
* invalid.
|
||||
* \return Returns a three-bit field, corresponding to the three bits of the
|
||||
* request, which describes the state of the previously posted request. If the
|
||||
* value is zero, the request was completed. CY_DMA_INVALID_CHANNEL if the handle
|
||||
* is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChGetRequest(uint8 chHandle)
|
||||
@ -613,35 +551,30 @@ cystatus CyDmaChGetRequest(uint8 chHandle)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChStatus
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Determines the status of the DMA channel.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
|
||||
* \param chHandle A handle previously returned by \ref CyDmaChAlloc() or \ref
|
||||
* DMA_DmaInitalize().
|
||||
*
|
||||
* uint8 * currentTd:
|
||||
* The address to store the index of the current TD. Can be NULL if the value
|
||||
* is not needed.
|
||||
* \param currentTd The address to store the index of the current TD. Can be NULL
|
||||
* if the value is not needed.
|
||||
*
|
||||
* uint8 * state:
|
||||
* The address to store the state of the channel. Can be NULL if the value is
|
||||
* not needed.
|
||||
* \param state The address to store the state of the channel. Can be NULL if the
|
||||
* value is not needed.
|
||||
*
|
||||
* STATUS_TD_ACTIVE
|
||||
* 0: Channel is not currently being serviced by DMAC
|
||||
* 1: Channel is currently being serviced by DMAC
|
||||
* \param 0: Channel is not currently being serviced by DMAC
|
||||
* \param 1: Channel is currently being serviced by DMAC
|
||||
*
|
||||
* STATUS_CHAIN_ACTIVE
|
||||
* 0: TD chain is inactive; either no DMA requests have triggered a new chain
|
||||
* \param 0: TD chain is inactive; either no DMA requests have triggered a new chain
|
||||
* or the previous chain has completed.
|
||||
* 1: TD chain has been triggered by a DMA request
|
||||
* \param 1: TD chain has been triggered by a DMA request
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return CYRET_SUCCESS if successful.
|
||||
* \return CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
* Theory:
|
||||
* The caller can check on the activity of the Current TD and the Chain.
|
||||
@ -672,43 +605,41 @@ cystatus CyDmaChStatus(uint8 chHandle, uint8 * currentTd, uint8 * state)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChSetConfiguration
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets configuration information of the channel.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* \param uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or DMA_DmaInitialize().
|
||||
*
|
||||
* uint8 burstCount:
|
||||
* \param uint8 burstCount:
|
||||
* Specifies the size of bursts (1 to 127) the data transfer should be divided
|
||||
* into. If this value is zero then the whole transfer is done in one burst.
|
||||
*
|
||||
* uint8 requestPerBurst:
|
||||
* \param uint8 requestPerBurst:
|
||||
* The whole of the data can be split into multiple bursts, if this is
|
||||
* required to complete the transaction:
|
||||
* 0: All subsequent bursts after the first burst will be automatically
|
||||
* \param required to complete the transaction:
|
||||
* \param 0: All subsequent bursts after the first burst will be automatically
|
||||
* requested and carried out
|
||||
* 1: All subsequent bursts after the first burst must also be individually
|
||||
* \param 1: All subsequent bursts after the first burst must also be individually
|
||||
* requested.
|
||||
*
|
||||
* uint8 tdDone0:
|
||||
* \param uint8 tdDone0:
|
||||
* Selects one of the TERMOUT0 interrupt lines to signal completion. The line
|
||||
* connected to the nrq terminal will determine the TERMOUT0_SEL definition and
|
||||
* should be used as supplied by cyfitter.h
|
||||
*
|
||||
* uint8 tdDone1:
|
||||
* \param uint8 tdDone1:
|
||||
* Selects one of the TERMOUT1 interrupt lines to signal completion. The line
|
||||
* connected to the nrq terminal will determine the TERMOUT1_SEL definition and
|
||||
* should be used as supplied by cyfitter.h
|
||||
*
|
||||
* uint8 tdStop:
|
||||
* \param uint8 tdStop:
|
||||
* Selects one of the TERMIN interrupt lines to signal to the DMAC that the TD
|
||||
* should terminate. The signal connected to the trq terminal will determine
|
||||
* which TERMIN (termination request) is used.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
@ -734,15 +665,11 @@ cystatus CyDmaChSetConfiguration(uint8 chHandle, uint8 burstCount, uint8 request
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdAllocate
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Allocates a TD for use with an allocated DMA channel.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* Zero-based index of the TD to be used by the caller. Since there are 128 TDs
|
||||
* minus the reserved TDs (0 to 23), the value returned would range from 24 to
|
||||
* 127 not 24 to 128. DMA_INVALID_TD is returned if there are no free TDs
|
||||
@ -778,18 +705,13 @@ uint8 CyDmaTdAllocate(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdFree
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Returns a TD to the free list.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 tdHandle:
|
||||
* \param uint8 tdHandle:
|
||||
* The TD handle returned by the CyDmaTdAllocate().
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyDmaTdFree(uint8 tdHandle)
|
||||
{
|
||||
@ -815,15 +737,11 @@ void CyDmaTdFree(uint8 tdHandle)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdFreeCount
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Returns the number of free TDs available to be allocated.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* The number of free TDs.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -835,28 +753,26 @@ uint8 CyDmaTdFreeCount(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdSetConfiguration
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Configures the TD.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 tdHandle:
|
||||
* \param uint8 tdHandle:
|
||||
* A handle previously returned by CyDmaTdAlloc().
|
||||
*
|
||||
* uint16 transferCount:
|
||||
* \param uint16 transferCount:
|
||||
* The size of the data transfer (in bytes) for this TD. A size of zero will
|
||||
* cause the transfer to continue indefinitely. This parameter is limited to
|
||||
* 4095 bytes; the TD is not initialized at all when a higher value is passed.
|
||||
*
|
||||
* uint8 nextTd:
|
||||
* \param uint8 nextTd:
|
||||
* Zero based index of the next Transfer Descriptor in the TD chain. Zero is a
|
||||
* valid pointer to the next TD; DMA_END_CHAIN_TD is the end of the chain.
|
||||
* DMA_DISABLE_TD indicates an end to the chain and the DMA is disabled. No
|
||||
* further TDs are fetched. DMA_DISABLE_TD is only supported on PSoC3 and
|
||||
* PSoC 5LP silicons.
|
||||
*
|
||||
* uint8 configuration:
|
||||
* \param uint8 configuration:
|
||||
* Stores the Bit field of configuration bits.
|
||||
*
|
||||
* CY_DMA_TD_SWAP_EN - Perform endian swap
|
||||
@ -883,7 +799,7 @@ uint8 CyDmaTdFreeCount(void)
|
||||
* CY_DMA_TD_INC_SRC_ADR - Increment SRC_ADR according to the size of each
|
||||
* data transaction in the burst.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if tdHandle or transferCount is invalid.
|
||||
*
|
||||
@ -914,34 +830,32 @@ cystatus CyDmaTdSetConfiguration(uint8 tdHandle, uint16 transferCount, uint8 nex
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdGetConfiguration
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Retrieves the configuration of the TD. If a NULL pointer is passed as a
|
||||
* parameter, that parameter is skipped. You may request only the values you are
|
||||
* interested in.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 tdHandle:
|
||||
* \param uint8 tdHandle:
|
||||
* A handle previously returned by CyDmaTdAlloc().
|
||||
*
|
||||
* uint16 * transferCount:
|
||||
* \param uint16 * transferCount:
|
||||
* The address to store the size of the data transfer (in bytes) for this TD.
|
||||
* A size of zero could indicate that the TD has completed its transfer, or
|
||||
* that the TD is doing an indefinite transfer.
|
||||
*
|
||||
* uint8 * nextTd:
|
||||
* \param uint8 * nextTd:
|
||||
* The address to store the index of the next TD in the TD chain.
|
||||
*
|
||||
* uint8 * configuration:
|
||||
* \param uint8 * configuration:
|
||||
* The address to store the Bit field of configuration bits.
|
||||
* See CyDmaTdSetConfiguration() function description.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if tdHandle is invalid.
|
||||
*
|
||||
* Side Effects:
|
||||
* \sideeffect
|
||||
* If TD has a transfer count of N and is executed, the transfer count becomes
|
||||
* 0. If it is reexecuted, the Transfer count of zero will be interpreted as a
|
||||
* request for indefinite transfer. Be careful when requesting TD with a
|
||||
@ -986,23 +900,21 @@ cystatus CyDmaTdGetConfiguration(uint8 tdHandle, uint16 * transferCount, uint8 *
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdSetAddress
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the lower 16 bits of the source and destination addresses for this TD
|
||||
* only.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 tdHandle:
|
||||
* \param uint8 tdHandle:
|
||||
* A handle previously returned by CyDmaTdAlloc().
|
||||
*
|
||||
* uint16 source:
|
||||
* \param uint16 source:
|
||||
* The lower 16 address bits of the source of the data transfer.
|
||||
*
|
||||
* uint16 destination:
|
||||
* \param uint16 destination:
|
||||
* The lower 16 address bits of the destination of the data transfer.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if tdHandle is invalid.
|
||||
*
|
||||
@ -1031,26 +943,24 @@ cystatus CyDmaTdSetAddress(uint8 tdHandle, uint16 source, uint16 destination)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaTdGetAddress
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Retrieves the lower 16 bits of the source and/or destination addresses for
|
||||
* this TD only. If NULL is passed for a pointer parameter, that value is
|
||||
* skipped. You may request only the values of interest.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 tdHandle:
|
||||
* \param uint8 tdHandle:
|
||||
* A handle previously returned by CyDmaTdAlloc().
|
||||
*
|
||||
* uint16 * source:
|
||||
* \param uint16 * source:
|
||||
* The address to store the lower 16 address bits of the source of the data
|
||||
* transfer.
|
||||
*
|
||||
* uint16 * destination:
|
||||
* \param uint16 * destination:
|
||||
* The address to store the lower 16 address bits of the destination of the
|
||||
* data transfer.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if tdHandle is invalid.
|
||||
*
|
||||
@ -1087,23 +997,21 @@ cystatus CyDmaTdGetAddress(uint8 tdHandle, uint16 * source, uint16 * destination
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChRoundRobin
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Either enables or disables the Round-Robin scheduling enforcement algorithm.
|
||||
* Within a priority level a Round-Robin fairness algorithm is enforced.
|
||||
* Either enables or disables the Round-Robin scheduling enforcement algorithm.
|
||||
* Within a priority level a Round-Robin fairness algorithm is enforced.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or Dma_DmaInitialize().
|
||||
* \param uint8 chHandle:
|
||||
* A handle previously returned by CyDmaChAlloc() or Dma_DmaInitialize().
|
||||
*
|
||||
* uint8 enableRR:
|
||||
* 0: Disable Round-Robin fairness algorithm
|
||||
* 1: Enable Round-Robin fairness algorithm
|
||||
* \param uint8 enableRR:
|
||||
* \param 0: Disable Round-Robin fairness algorithm
|
||||
* \param 1: Enable Round-Robin fairness algorithm
|
||||
*
|
||||
* Return:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if chHandle is invalid.
|
||||
*
|
||||
*******************************************************************************/
|
||||
cystatus CyDmaChRoundRobin(uint8 chHandle, uint8 enableRR)
|
||||
|
17
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyDmac.h
Normal file → Executable file
17
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyDmac.h
Normal file → Executable file
@ -1,16 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyDmac.h
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyDmac.h
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides the function definitions for the DMA Controller.
|
||||
* \brief Provides the function definitions for the DMA Controller.
|
||||
*
|
||||
* Note:
|
||||
* Documentation of the API's in this file is located in the
|
||||
* System Reference Guide provided with PSoC Creator.
|
||||
* \note Documentation of the API's in this file is located in the System
|
||||
* Reference Guide provided with PSoC Creator.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
|
173
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyFlash.c
Normal file → Executable file
173
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyFlash.c
Normal file → Executable file
@ -1,19 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyFlash.c
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyFlash.c
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides an API for the FLASH/EEPROM.
|
||||
* \brief Provides an API for the FLASH/EEPROM.
|
||||
*
|
||||
* Note:
|
||||
* This code is endian agnostic.
|
||||
* \note This code is endian agnostic.
|
||||
*
|
||||
* Note:
|
||||
* Documentation of the API's in this file is located in the
|
||||
* System Reference Guide provided with PSoC Creator.
|
||||
* \note Documentation of the API's in this file is located in the System
|
||||
* Reference Guide provided with PSoC Creator.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -43,17 +41,10 @@ static cystatus CyFlashGetSpcAlgorithm(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyFlash_Start
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Enable the Flash.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyFlash_Start(void)
|
||||
{
|
||||
@ -104,18 +95,11 @@ void CyFlash_Start(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyFlash_Stop
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disable the Flash.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* Side Effects:
|
||||
* \sideeffect
|
||||
* This setting is ignored as long as the CPU is currently running. This will
|
||||
* only take effect when the CPU is later disabled.
|
||||
*
|
||||
@ -135,17 +119,13 @@ void CyFlash_Stop(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySetTempInt
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sends a command to the SPC to read the die temperature. Sets a global value
|
||||
* used by the Write function. This function must be called once before
|
||||
* executing a series of Flash writing functions.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS - if successful
|
||||
* CYRET_LOCKED - if Flash writing already in use
|
||||
@ -197,15 +177,11 @@ static cystatus CySetTempInt(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyFlashGetSpcAlgorithm
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sends a command to the SPC to download code into RAM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS - if successful
|
||||
* CYRET_LOCKED - if Flash writing already in use
|
||||
@ -249,16 +225,12 @@ static cystatus CyFlashGetSpcAlgorithm(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySetTemp
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This is a wraparound for CySetTempInt(). It is used to return the second
|
||||
* successful read of the temperature value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_LOCKED if Flash writing already in use
|
||||
@ -285,19 +257,17 @@ cystatus CySetTemp(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySetFlashEEBuffer
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the user supplied temporary buffer to store SPC data while performing
|
||||
* Flash and EEPROM commands. This buffer is only necessary when the Flash ECC is
|
||||
* disabled.
|
||||
* Flash and EEPROM commands. This buffer is only necessary when the Flash ECC
|
||||
* is disabled.
|
||||
*
|
||||
* Parameters:
|
||||
* buffer:
|
||||
* The address of a block of memory to store temporary memory. The size of the block
|
||||
* of memory is CYDEV_FLS_ROW_SIZE + CYDEV_ECC_ROW_SIZE.
|
||||
* \param buffer:
|
||||
* The address of a block of memory to store temporary memory. The size of the
|
||||
* block of memory is CYDEV_FLS_ROW_SIZE + CYDEV_ECC_ROW_SIZE.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_BAD_PARAM if the buffer is NULL
|
||||
@ -340,22 +310,20 @@ cystatus CySetFlashEEBuffer(uint8 * buffer)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyWriteRowData
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sends a command to the SPC to load and program a row of data in
|
||||
* Flash or EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* arrayID: ID of the array to write.
|
||||
* \param arrayID: ID of the array to write.
|
||||
* The type of write, Flash or EEPROM, is determined from the array ID.
|
||||
* The arrays in the part are sequential starting at the first ID for the
|
||||
* specific memory type. The array ID for the Flash memory lasts from 0x00 to
|
||||
* 0x3F and for the EEPROM memory it lasts from 0x40 to 0x7F.
|
||||
* rowAddress: rowAddress of flash row to program.
|
||||
* rowData: Array of bytes to write.
|
||||
* \param rowAddress: rowAddress of flash row to program.
|
||||
* \param rowData: Array of bytes to write.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_LOCKED if the SPC is already in use.
|
||||
@ -384,21 +352,19 @@ cystatus CyWriteRowData(uint8 arrayId, uint16 rowAddress, const uint8 * rowData)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyWriteRowConfig
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sends a command to the SPC to load and program a row of config data in the Flash.
|
||||
* This function is only valid for Flash array IDs (not for EEPROM).
|
||||
* Sends a command to the SPC to load and program a row of config data in the
|
||||
* Flash. This function is only valid for Flash array IDs (not for EEPROM).
|
||||
*
|
||||
* Parameters:
|
||||
* arrayId: ID of the array to write
|
||||
* \param arrayId: ID of the array to write
|
||||
* The arrays in the part are sequential starting at the first ID for the
|
||||
* specific memory type. The array ID for the Flash memory lasts
|
||||
* from 0x00 to 0x3F.
|
||||
* rowAddress: The address of the sector to erase.
|
||||
* rowECC: The array of bytes to write.
|
||||
* \param rowAddress: The address of the sector to erase.
|
||||
* \param rowECC: The array of bytes to write.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* status:
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_LOCKED if the SPC is already in use.
|
||||
@ -422,18 +388,16 @@ cystatus CyWriteRowData(uint8 arrayId, uint16 rowAddress, const uint8 * rowData)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyWriteRowFull
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Sends a command to the SPC to load and program a row of data in the Flash.
|
||||
* rowData array is expected to contain Flash and ECC data if needed.
|
||||
*
|
||||
* Parameters:
|
||||
* arrayId: FLASH or EEPROM array id.
|
||||
* rowData: Pointer to a row of data to write.
|
||||
* rowNumber: Zero based number of the row.
|
||||
* rowSize: Size of the row.
|
||||
* \param arrayId: FLASH or EEPROM array id.
|
||||
* \param rowData: Pointer to a row of data to write.
|
||||
* \param rowNumber: Zero based number of the row.
|
||||
* \param rowSize: Size of the row.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS if successful.
|
||||
* CYRET_LOCKED if the SPC is already in use.
|
||||
* CYRET_CANCELED if command not accepted
|
||||
@ -552,21 +516,16 @@ cystatus CyWriteRowFull(uint8 arrayId, uint16 rowNumber, const uint8* rowData, u
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyFlash_SetWaitCycles
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Sets the number of clock cycles the cache will wait before it samples data
|
||||
* coming back from the Flash. This function must be called before increasing the CPU
|
||||
* clock frequency. It can optionally be called after lowering the CPU clock
|
||||
* frequency in order to improve the CPU performance.
|
||||
* coming back from the Flash. This function must be called before increasing
|
||||
* the CPU clock frequency. It can optionally be called after lowering the CPU
|
||||
* clock frequency in order to improve the CPU performance.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 freq:
|
||||
* \param uint8 freq:
|
||||
* Frequency of operation in Megahertz.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyFlash_SetWaitCycles(uint8 freq)
|
||||
{
|
||||
@ -621,17 +580,10 @@ void CyFlash_SetWaitCycles(uint8 freq)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyEEPROM_Start
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Enable the EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyEEPROM_Start(void)
|
||||
{
|
||||
@ -679,17 +631,10 @@ void CyEEPROM_Start(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyEEPROM_Stop
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disable the EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyEEPROM_Stop (void)
|
||||
{
|
||||
@ -706,17 +651,10 @@ void CyEEPROM_Stop (void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyEEPROM_ReadReserve
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Request access to the EEPROM for reading and wait until access is available.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyEEPROM_ReadReserve(void)
|
||||
{
|
||||
@ -732,17 +670,10 @@ void CyEEPROM_ReadReserve(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyEEPROM_ReadRelease
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Release the read reservation of the EEPROM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CyEEPROM_ReadRelease(void)
|
||||
{
|
||||
|
23
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyFlash.h
Normal file → Executable file
23
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyFlash.h
Normal file → Executable file
@ -1,16 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyFlash.h
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyFlash.h
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides the function definitions for the FLASH/EEPROM.
|
||||
* \brief Provides the function definitions for the FLASH/EEPROM.
|
||||
*
|
||||
* Note:
|
||||
* Documentation of the API's in this file is located in the
|
||||
* System Reference Guide provided with PSoC Creator.
|
||||
* \note Documentation of the API's in this file is located in the System
|
||||
* Reference Guide provided with PSoC Creator.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -48,7 +47,7 @@ extern uint8 dieTemperature[CY_FLASH_DIE_TEMP_DATA_SIZE];
|
||||
#endif /* (CYDEV_ECC_ENABLE == 0) */
|
||||
#define CY_EEPROM_BASE (CYDEV_EE_BASE)
|
||||
#define CY_EEPROM_SIZE (CYDEV_EE_SIZE)
|
||||
#define CY_EEPROM_SIZEOF_ARRAY (CYDEV_EEPROM_SECTOR_SIZE)
|
||||
#define CY_EEPROM_SIZEOF_ARRAY (CYDEV_EE_SIZE) /* EEPROM has one array */
|
||||
#define CY_EEPROM_SIZEOF_ROW (CYDEV_EEPROM_ROW_SIZE)
|
||||
#define CY_EEPROM_NUMBER_ROWS (CYDEV_EE_SIZE / CYDEV_EEPROM_ROW_SIZE)
|
||||
#define CY_EEPROM_NUMBER_ARRAYS (CYDEV_EE_SIZE / CY_EEPROM_SIZEOF_ARRAY)
|
||||
@ -260,9 +259,9 @@ void CyEEPROM_ReadRelease(void) ;
|
||||
#define FLASH_NUMBER_ROWS (CY_FLASH_NUMBER_ROWS)
|
||||
#define FLASH_NUMBER_SECTORS (CY_FLASH_NUMBER_ARRAYS)
|
||||
#define EEPROM_SIZE (CY_EEPROM_SIZE)
|
||||
#define EEPROM_SIZEOF_SECTOR (CY_EEPROM_SIZEOF_ARRAY)
|
||||
#define EEPROM_SIZEOF_SECTOR (CYDEV_EEPROM_SECTOR_SIZE)
|
||||
#define EEPROM_NUMBER_ROWS (CY_EEPROM_NUMBER_ROWS)
|
||||
#define EEPROM_NUMBER_SECTORS (CY_EEPROM_NUMBER_ARRAYS)
|
||||
#define EEPROM_NUMBER_SECTORS (CY_EEPROM_NUMBER_SECTORS)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
1327
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyLib.c
Normal file → Executable file
1327
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyLib.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyLib.h
Normal file → Executable file
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CyLib.h
Normal file → Executable file
@ -1,17 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CyLib.h
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CyLib.h
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides the function definitions for the system, clocking, interrupts and
|
||||
* watchdog timer API.
|
||||
* \brief Provides the function definitions for the system, clocking, interrupts
|
||||
* and watchdog timer API.
|
||||
*
|
||||
* Note:
|
||||
* Documentation of the API's in this file is located in the System Reference
|
||||
* Guide provided with PSoC Creator.
|
||||
* \note Documentation of the API's in this file is located in the System
|
||||
* Reference Guide provided with PSoC Creator.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -169,7 +168,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
#endif /* (CY_PSOC5) */
|
||||
|
||||
#if(CY_PSOC5)
|
||||
/* System tick timer APIs */
|
||||
/** System tick timer APIs */
|
||||
typedef void (*cySysTickCallback)(void);
|
||||
|
||||
void CySysTickStart(void);
|
||||
@ -188,6 +187,9 @@ void CySetScPumps(uint8 enable) ;
|
||||
void CySysTickClear(void);
|
||||
#endif /* (CY_PSOC5) */
|
||||
|
||||
void CyGetUniqueId(uint32* uniqueId);
|
||||
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
@ -290,6 +292,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
#define CY_VD_HVIA (0x04u)
|
||||
|
||||
#define CY_VD_LVI_TRIP_LVID_MASK (0x0Fu)
|
||||
#define CY_VD_INT_MASK ((uint32) (0x01u))
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -435,7 +438,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#define CY_SYS_ISB __isb(0x0f)
|
||||
#else /* ASM for GCC & IAR */
|
||||
#define CY_SYS_ISB asm volatile ("isb \n")
|
||||
#define CY_SYS_ISB __asm volatile ("isb \n")
|
||||
#endif /* (__ARMCC_VERSION) */
|
||||
|
||||
#endif /* (CY_PSOC5) */
|
||||
@ -805,8 +808,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyAssert
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* The macro that evaluates the expression and if it is false (evaluates to 0)
|
||||
* then the processor is halted.
|
||||
*
|
||||
@ -816,11 +818,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
* defined by default for a Release build setting and not defined for a Debug
|
||||
* build setting.
|
||||
*
|
||||
* Parameters:
|
||||
* expr: Logical expression. Asserts if false.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param expr: Logical expression. Asserts if false.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#if !defined(NDEBUG)
|
||||
@ -907,6 +905,7 @@ void CySetScPumps(uint8 enable) ;
|
||||
#define CY_SYS_SYST_CSR_CLK_SRC_SYSCLK ((uint32) (1u))
|
||||
#define CY_SYS_SYST_CSR_CLK_SRC_LFCLK ((uint32) (0u))
|
||||
#define CY_SYS_SYST_RVR_CNT_MASK ((uint32) (0x00FFFFFFu))
|
||||
#define CY_SYS_SYST_CVR_CNT_MASK ((uint32) (0x00FFFFFFu))
|
||||
#define CY_SYS_SYST_NUM_OF_CALLBACKS ((uint32) (5u))
|
||||
#endif /* (CY_PSOC5) */
|
||||
|
||||
@ -966,32 +965,22 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntEnable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Enables the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntEnable(number) CY_SET_REG32(CY_INT_ENABLE_PTR, ((uint32)((uint32)1u << (0x1Fu & (number)))))
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntDisable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disables the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntDisable(number) CY_SET_REG32(CY_INT_CLEAR_PTR, ((uint32)((uint32)1u << (0x1Fu & (number)))))
|
||||
@ -999,16 +988,11 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntSetPending
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Forces the specified interrupt number to be pending.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntSetPending(number) CY_SET_REG32(CY_INT_SET_PEND_PTR, ((uint32)((uint32)1u << (0x1Fu & (number)))))
|
||||
@ -1016,16 +1000,11 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntClearPending
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Clears any pending interrupt for the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntClearPending(number) CY_SET_REG32(CY_INT_CLR_PEND_PTR, ((uint32)((uint32)1u << (0x1Fu & (number)))))
|
||||
@ -1036,16 +1015,11 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntEnable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Enables the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntEnable(number) CY_SET_REG8(CY_INT_SET_EN_INDX_PTR((number)), \
|
||||
@ -1054,16 +1028,11 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntDisable
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disables the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntDisable(number) CY_SET_REG8(CY_INT_CLR_EN_INDX_PTR((number)), \
|
||||
@ -1072,16 +1041,11 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntSetPending
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Forces the specified interrupt number to be pending.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntSetPending(number) CY_SET_REG8(CY_INT_SET_PEND_INDX_PTR((number)), \
|
||||
@ -1090,15 +1054,10 @@ void CySetScPumps(uint8 enable) ;
|
||||
|
||||
/*******************************************************************************
|
||||
* Macro Name: CyIntClearPending
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Clears any pending interrupt for the specified interrupt number.
|
||||
*
|
||||
* Parameters:
|
||||
* number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
* \param number: Valid range [0-31]. Interrupt number.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define CyIntClearPending(number) CY_SET_REG8(CY_INT_CLR_PEND_INDX_PTR((number)), \
|
||||
|
149
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CySpc.c
Normal file → Executable file
149
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CySpc.c
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CySpc.c
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CySpc.c
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides an API for the System Performance Component.
|
||||
* The SPC functions are not meant to be called directly by the user
|
||||
* application.
|
||||
* \brief Provides an API for the System Performance Component.
|
||||
* The SPC functions are not meant to be called directly by the user
|
||||
* application.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -64,16 +64,9 @@ uint8 SpcLockState = CY_SPC_UNLOCKED;
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcStart
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Starts the SPC.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CySpcStart(void)
|
||||
{
|
||||
@ -90,16 +83,9 @@ void CySpcStart(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcStop
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Stops the SPC.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CySpcStop(void)
|
||||
{
|
||||
@ -116,18 +102,16 @@ void CySpcStop(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcReadData
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Reads data from the SPC.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 buffer:
|
||||
* \param uint8 buffer:
|
||||
* Address to store data read.
|
||||
*
|
||||
* uint8 size:
|
||||
* \param uint8 size:
|
||||
* Number of bytes to read from the SPC.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* uint8:
|
||||
* The number of bytes read from the SPC.
|
||||
*
|
||||
@ -151,24 +135,22 @@ uint8 CySpcReadData(uint8 buffer[], uint8 size)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcLoadMultiByte
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Loads 1 to 32 bytes of data into the row latch of a Flash/EEPROM array.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 array:
|
||||
* \param uint8 array:
|
||||
* Id of the array.
|
||||
*
|
||||
* uint16 address:
|
||||
* \param uint16 address:
|
||||
* Flash/eeprom addrress
|
||||
*
|
||||
* uint8* buffer:
|
||||
* \param uint8* buffer:
|
||||
* Data to load to the row latch
|
||||
*
|
||||
* uint16 number:
|
||||
* \param uint16 number:
|
||||
* Number bytes to load.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -227,8 +209,7 @@ cystatus CySpcLoadMultiByte(uint8 array, uint16 address, const uint8 buffer[], u
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcLoadRow
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Loads a row of data into the row latch of a Flash/EEPROM array.
|
||||
*
|
||||
* The buffer pointer should point to the data that should be written to the
|
||||
@ -236,20 +217,19 @@ cystatus CySpcLoadMultiByte(uint8 array, uint16 address, const uint8 buffer[], u
|
||||
* responsibility to prepare data: the preserved data are copied from flash into
|
||||
* array with the modified data.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 array:
|
||||
* \param uint8 array:
|
||||
* Id of the array.
|
||||
*
|
||||
* uint8* buffer:
|
||||
* \param uint8* buffer:
|
||||
* Data to be loaded to the row latch
|
||||
*
|
||||
* uint8 size:
|
||||
* \param uint8 size:
|
||||
* The number of data bytes that the SPC expects to be written. Depends on the
|
||||
* type of the array and, if the array is Flash, whether ECC is being enabled
|
||||
* or not. There are following values: flash row latch size with ECC enabled,
|
||||
* flash row latch size with ECC disabled and EEPROM row latch size.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -293,31 +273,29 @@ cystatus CySpcLoadRow(uint8 array, const uint8 buffer[], uint16 size)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcLoadRowFull
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Loads a row of data into the row latch of a Flash/EEPROM array.
|
||||
*
|
||||
* The only data that are going to be changed should be passed. The function
|
||||
* will handle unmodified data preservation based on DWR settings and input
|
||||
* parameters.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 array:
|
||||
* \param uint8 array:
|
||||
* Id of the array.
|
||||
*
|
||||
* uint16 row:
|
||||
* \param uint16 row:
|
||||
* Flash row number to be loaded.
|
||||
*
|
||||
* uint8* buffer:
|
||||
* \param uint8* buffer:
|
||||
* Data to be loaded to the row latch
|
||||
*
|
||||
* uint8 size:
|
||||
* \param uint8 size:
|
||||
* The number of data bytes that the SPC expects to be written. Depends on the
|
||||
* type of the array and, if the array is Flash, whether ECC is being enabled
|
||||
* or not. There are following values: flash row latch size with ECC enabled,
|
||||
* flash row latch size with ECC disabled and EEPROM row latch size.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -436,26 +414,24 @@ cystatus CySpcLoadRowFull(uint8 array, uint16 row, const uint8 buffer[], uint16
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcWriteRow
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Erases then programs a row in Flash/EEPROM with data in row latch.
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 array:
|
||||
* \param uint8 array:
|
||||
* Id of the array.
|
||||
*
|
||||
* uint16 address:
|
||||
* \param uint16 address:
|
||||
* flash/eeprom addrress
|
||||
*
|
||||
* uint8 tempPolarity:
|
||||
* \param uint8 tempPolarity:
|
||||
* temperature polarity.
|
||||
* 1: the Temp Magnitude is interpreted as a positive value
|
||||
* 0: the Temp Magnitude is interpreted as a negative value
|
||||
* \param 1: the Temp Magnitude is interpreted as a positive value
|
||||
* \param 0: the Temp Magnitude is interpreted as a negative value
|
||||
*
|
||||
* uint8 tempMagnitude:
|
||||
* \param uint8 tempMagnitude:
|
||||
* temperature magnitude.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -498,18 +474,16 @@ cystatus CySpcWriteRow(uint8 array, uint16 address, uint8 tempPolarity, uint8 te
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcEraseSector
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Erases all data in the addressed sector (block of 64 rows).
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 array:
|
||||
* \param uint8 array:
|
||||
* Id of the array.
|
||||
*
|
||||
* uint8 sectorNumber:
|
||||
* \param uint8 sectorNumber:
|
||||
* Zero based sector number within Flash/EEPROM array
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -548,23 +522,21 @@ cystatus CySpcEraseSector(uint8 array, uint8 sectorNumber)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcGetTemp
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Returns the internal die temperature
|
||||
*
|
||||
* Parameters:
|
||||
* uint8 numSamples:
|
||||
* \param uint8 numSamples:
|
||||
* Number of samples. Valid values are 1-5, resulting in 2 - 32 samples
|
||||
* respectively.
|
||||
*
|
||||
* uint16 timerPeriod:
|
||||
* \param uint16 timerPeriod:
|
||||
* Number of ADC ACLK cycles. A valid 14 bit value is accepted, higher 2 bits
|
||||
* of 16 bit values are ignored.
|
||||
*
|
||||
* uint8 clkDivSelect:
|
||||
* \param uint8 clkDivSelect:
|
||||
* ADC ACLK clock divide value. Valid values are 2 - 225.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_CANCELED
|
||||
* CYRET_LOCKED
|
||||
@ -602,15 +574,11 @@ cystatus CySpcGetTemp(uint8 numSamples)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcLock
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Locks the SPC so it can not be used by someone else:
|
||||
* - Saves wait-pipeline enable state and enable pipeline (PSoC5)
|
||||
*
|
||||
* Parameters:
|
||||
* Note
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_SUCCESS - if the resource was free.
|
||||
* CYRET_LOCKED - if the SPC is in use.
|
||||
*
|
||||
@ -655,17 +623,10 @@ cystatus CySpcLock(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcUnlock
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Unlocks the SPC so it can be used by someone else:
|
||||
* - Restores wait-pipeline enable state (PSoC5)
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void CySpcUnlock(void)
|
||||
{
|
||||
@ -701,14 +662,10 @@ void CySpcUnlock(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CySpcGetAlgorithm
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Downloads SPC algorithm from SPC SROM into SRAM.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* CYRET_STARTED
|
||||
* CYRET_LOCKED
|
||||
*
|
||||
|
12
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CySpc.h
Normal file → Executable file
12
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/CySpc.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: CySpc.c
|
||||
* Version 4.20
|
||||
/***************************************************************************//**
|
||||
* \file CySpc.c
|
||||
* \version 5.50
|
||||
*
|
||||
* Description:
|
||||
* Provides definitions for the System Performance Component API.
|
||||
* \brief Provides definitions for the System Performance Component API.
|
||||
* The SPC functions are not meant to be called directly by the user
|
||||
* application.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Debug_Timer.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Debug_Timer.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Debug_Timer_PM.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/Debug_Timer_PM.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: LED1.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_Write
|
||||
*******************************************************************************/
|
||||
void LED1_Write(uint8 value)
|
||||
void LED1_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (LED1_DR & (uint8)(~LED1_MASK));
|
||||
LED1_DR = staticBits | ((uint8)(value << LED1_SHIFT) & LED1_MASK);
|
||||
@ -45,28 +63,31 @@ void LED1_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* LED1_DM_STRONG Strong Drive
|
||||
* LED1_DM_OD_HI Open Drain, Drives High
|
||||
* LED1_DM_OD_LO Open Drain, Drives Low
|
||||
* LED1_DM_RES_UP Resistive Pull Up
|
||||
* LED1_DM_RES_DWN Resistive Pull Down
|
||||
* LED1_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* LED1_DM_DIG_HIZ High Impedance Digital
|
||||
* LED1_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void LED1_SetDriveMode(uint8 mode)
|
||||
void LED1_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(LED1_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void LED1_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro LED1_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_Read
|
||||
*******************************************************************************/
|
||||
uint8 LED1_Read(void)
|
||||
uint8 LED1_Read(void)
|
||||
{
|
||||
return (LED1_PS & LED1_MASK) >> LED1_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 LED1_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred LED1_Read() API because the
|
||||
* LED1_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 LED1_ReadDataReg(void)
|
||||
uint8 LED1_ReadDataReg(void)
|
||||
{
|
||||
return (LED1_DR & LED1_MASK) >> LED1_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(LED1_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: LED1_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use LED1_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - LED1_0_INTR (First pin in the list)
|
||||
* - LED1_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - LED1_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 LED1_ClearInterrupt(void)
|
||||
void LED1_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & LED1_0_INTR) != 0u)
|
||||
{
|
||||
LED1_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: LED1_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet LED1_SUT.c usage_LED1_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 LED1_ClearInterrupt(void)
|
||||
{
|
||||
return (LED1_INTSTAT & LED1_MASK) >> LED1_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: LED1.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "LED1_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
LED1__PORT == 15 && ((LED1__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void LED1_Write(uint8 value) ;
|
||||
void LED1_SetDriveMode(uint8 mode) ;
|
||||
uint8 LED1_ReadDataReg(void) ;
|
||||
uint8 LED1_Read(void) ;
|
||||
uint8 LED1_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void LED1_Write(uint8 value);
|
||||
void LED1_SetDriveMode(uint8 mode);
|
||||
uint8 LED1_ReadDataReg(void);
|
||||
uint8 LED1_Read(void);
|
||||
void LED1_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 LED1_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define LED1_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define LED1_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define LED1_DM_RES_UP PIN_DM_RES_UP
|
||||
#define LED1_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define LED1_DM_OD_LO PIN_DM_OD_LO
|
||||
#define LED1_DM_OD_HI PIN_DM_OD_HI
|
||||
#define LED1_DM_STRONG PIN_DM_STRONG
|
||||
#define LED1_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the LED1_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define LED1_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define LED1_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define LED1_DM_RES_UP PIN_DM_RES_UP
|
||||
#define LED1_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define LED1_DM_OD_LO PIN_DM_OD_LO
|
||||
#define LED1_DM_OD_HI PIN_DM_OD_HI
|
||||
#define LED1_DM_STRONG PIN_DM_STRONG
|
||||
#define LED1_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define LED1_MASK LED1__MASK
|
||||
#define LED1_SHIFT LED1__SHIFT
|
||||
#define LED1_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(LED1__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in LED1_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define LED1_INTR_NONE (uint16)(0x0000u)
|
||||
#define LED1_INTR_RISING (uint16)(0x0001u)
|
||||
#define LED1_INTR_FALLING (uint16)(0x0002u)
|
||||
#define LED1_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define LED1_INTR_MASK (0x01u)
|
||||
#endif /* (LED1__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 LED1_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define LED1_PRTDSI__SYNC_OUT (* (reg8 *) LED1__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(LED1__SIO_CFG)
|
||||
#define LED1_SIO_HYST_EN (* (reg8 *) LED1__SIO_HYST_EN)
|
||||
#define LED1_SIO_REG_HIFREQ (* (reg8 *) LED1__SIO_REG_HIFREQ)
|
||||
#define LED1_SIO_CFG (* (reg8 *) LED1__SIO_CFG)
|
||||
#define LED1_SIO_DIFF (* (reg8 *) LED1__SIO_DIFF)
|
||||
#endif /* (LED1__SIO_CFG) */
|
||||
|
||||
#if defined(LED1__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define LED1_INTSTAT (* (reg8 *) LED1__INTSTAT)
|
||||
#define LED1_SNAP (* (reg8 *) LED1__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(LED1__INTSTAT)
|
||||
#define LED1_INTSTAT (* (reg8 *) LED1__INTSTAT)
|
||||
#define LED1_SNAP (* (reg8 *) LED1__SNAP)
|
||||
|
||||
#define LED1_0_INTTYPE_REG (* (reg8 *) LED1__0__INTTYPE)
|
||||
#endif /* (LED1__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/LED1_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: LED1.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define LED1_0 (LED1__0__PC)
|
||||
#define LED1_0 (LED1__0__PC)
|
||||
#define LED1_0_INTR ((uint16)((uint16)0x0001u << LED1__0__SHIFT))
|
||||
|
||||
#define LED1_INTR_ALL ((uint16)(LED1_0_INTR))
|
||||
|
||||
#endif /* End Pins LED1_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CLK.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CLK.c
Normal file → Executable file
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE.c
Normal file → Executable file
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_CTL_PHASE.c
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Control Register.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -16,8 +16,10 @@
|
||||
|
||||
#include "SCSI_CTL_PHASE.h"
|
||||
|
||||
#if !defined(SCSI_CTL_PHASE_Sync_ctrl_reg__REMOVED) /* Check for removal by optimization */
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_CTL_PHASE_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_CTL_PHASE_Write
|
||||
********************************************************************************
|
||||
|
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE.h
Normal file → Executable file
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_CTL_PHASE.h
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -19,6 +19,18 @@
|
||||
|
||||
#include "cytypes.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 controlState;
|
||||
|
||||
} SCSI_CTL_PHASE_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
@ -27,6 +39,11 @@
|
||||
void SCSI_CTL_PHASE_Write(uint8 control) ;
|
||||
uint8 SCSI_CTL_PHASE_Read(void) ;
|
||||
|
||||
void SCSI_CTL_PHASE_SaveConfig(void) ;
|
||||
void SCSI_CTL_PHASE_RestoreConfig(void) ;
|
||||
void SCSI_CTL_PHASE_Sleep(void) ;
|
||||
void SCSI_CTL_PHASE_Wakeup(void) ;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
|
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE_PM.c
Executable file
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_CTL_PHASE_PM.c
Executable file
@ -0,0 +1,109 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_CTL_PHASE_PM.c
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains the setup, control, and status commands to support
|
||||
* the component operation in the low power mode.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SCSI_CTL_PHASE.h"
|
||||
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_CTL_PHASE_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
static SCSI_CTL_PHASE_BACKUP_STRUCT SCSI_CTL_PHASE_backup = {0u};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_CTL_PHASE_SaveConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Saves the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_CTL_PHASE_SaveConfig(void)
|
||||
{
|
||||
SCSI_CTL_PHASE_backup.controlState = SCSI_CTL_PHASE_Control;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_CTL_PHASE_RestoreConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_CTL_PHASE_RestoreConfig(void)
|
||||
{
|
||||
SCSI_CTL_PHASE_Control = SCSI_CTL_PHASE_backup.controlState;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_CTL_PHASE_Sleep
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Prepares the component for entering the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_CTL_PHASE_Sleep(void)
|
||||
{
|
||||
SCSI_CTL_PHASE_SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_CTL_PHASE_Wakeup
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the component after waking up from the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_CTL_PHASE_Wakeup(void)
|
||||
{
|
||||
SCSI_CTL_PHASE_RestoreConfig();
|
||||
}
|
||||
|
||||
#endif /* End check for removal by optimization */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
6
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Filtered.c
Normal file → Executable file
6
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Filtered.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Filtered.c
|
||||
* Version 1.80
|
||||
* Version 1.90
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware to read the value of a Status
|
||||
@ -9,7 +9,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -103,7 +103,7 @@ void SCSI_Filtered_InterruptDisable(void)
|
||||
void SCSI_Filtered_WriteMask(uint8 mask)
|
||||
{
|
||||
#if(SCSI_Filtered_INPUTS < 8u)
|
||||
mask &= (uint8)((((uint8)1u) << SCSI_Filtered_INPUTS) - 1u);
|
||||
mask &= ((uint8)(1u << SCSI_Filtered_INPUTS) - 1u);
|
||||
#endif /* End SCSI_Filtered_INPUTS < 8u */
|
||||
SCSI_Filtered_Status_Mask = mask;
|
||||
}
|
||||
|
16
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Filtered.h
Normal file → Executable file
16
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Filtered.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Filtered.h
|
||||
* Version 1.80
|
||||
* Version 1.90
|
||||
*
|
||||
* Description:
|
||||
* This file containts Status Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -20,6 +20,18 @@
|
||||
#include "cytypes.h"
|
||||
#include "CyLib.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 statusState;
|
||||
|
||||
} SCSI_Filtered_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
|
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl.c
Normal file → Executable file
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Glitch_Ctl.c
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Control Register.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -16,8 +16,10 @@
|
||||
|
||||
#include "SCSI_Glitch_Ctl.h"
|
||||
|
||||
#if !defined(SCSI_Glitch_Ctl_Sync_ctrl_reg__REMOVED) /* Check for removal by optimization */
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Glitch_Ctl_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Glitch_Ctl_Write
|
||||
********************************************************************************
|
||||
|
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl.h
Normal file → Executable file
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Glitch_Ctl.h
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -19,6 +19,18 @@
|
||||
|
||||
#include "cytypes.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 controlState;
|
||||
|
||||
} SCSI_Glitch_Ctl_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
@ -27,6 +39,11 @@
|
||||
void SCSI_Glitch_Ctl_Write(uint8 control) ;
|
||||
uint8 SCSI_Glitch_Ctl_Read(void) ;
|
||||
|
||||
void SCSI_Glitch_Ctl_SaveConfig(void) ;
|
||||
void SCSI_Glitch_Ctl_RestoreConfig(void) ;
|
||||
void SCSI_Glitch_Ctl_Sleep(void) ;
|
||||
void SCSI_Glitch_Ctl_Wakeup(void) ;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
|
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl_PM.c
Executable file
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Glitch_Ctl_PM.c
Executable file
@ -0,0 +1,109 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Glitch_Ctl_PM.c
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains the setup, control, and status commands to support
|
||||
* the component operation in the low power mode.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SCSI_Glitch_Ctl.h"
|
||||
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Glitch_Ctl_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
static SCSI_Glitch_Ctl_BACKUP_STRUCT SCSI_Glitch_Ctl_backup = {0u};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Glitch_Ctl_SaveConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Saves the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Glitch_Ctl_SaveConfig(void)
|
||||
{
|
||||
SCSI_Glitch_Ctl_backup.controlState = SCSI_Glitch_Ctl_Control;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Glitch_Ctl_RestoreConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Glitch_Ctl_RestoreConfig(void)
|
||||
{
|
||||
SCSI_Glitch_Ctl_Control = SCSI_Glitch_Ctl_backup.controlState;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Glitch_Ctl_Sleep
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Prepares the component for entering the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Glitch_Ctl_Sleep(void)
|
||||
{
|
||||
SCSI_Glitch_Ctl_SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Glitch_Ctl_Wakeup
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the component after waking up from the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Glitch_Ctl_Wakeup(void)
|
||||
{
|
||||
SCSI_Glitch_Ctl_RestoreConfig();
|
||||
}
|
||||
|
||||
#endif /* End check for removal by optimization */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
72
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_In_DBx_aliases.h
Normal file → Executable file
72
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_In_DBx_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_In_DBx.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,28 +22,59 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SCSI_In_DBx_0 (SCSI_In_DBx__0__PC)
|
||||
#define SCSI_In_DBx_1 (SCSI_In_DBx__1__PC)
|
||||
#define SCSI_In_DBx_2 (SCSI_In_DBx__2__PC)
|
||||
#define SCSI_In_DBx_3 (SCSI_In_DBx__3__PC)
|
||||
#define SCSI_In_DBx_4 (SCSI_In_DBx__4__PC)
|
||||
#define SCSI_In_DBx_5 (SCSI_In_DBx__5__PC)
|
||||
#define SCSI_In_DBx_6 (SCSI_In_DBx__6__PC)
|
||||
#define SCSI_In_DBx_7 (SCSI_In_DBx__7__PC)
|
||||
#define SCSI_In_DBx_0 (SCSI_In_DBx__0__PC)
|
||||
#define SCSI_In_DBx_0_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__0__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB0 (SCSI_In_DBx__DB0__PC)
|
||||
#define SCSI_In_DBx_DB1 (SCSI_In_DBx__DB1__PC)
|
||||
#define SCSI_In_DBx_DB2 (SCSI_In_DBx__DB2__PC)
|
||||
#define SCSI_In_DBx_DB3 (SCSI_In_DBx__DB3__PC)
|
||||
#define SCSI_In_DBx_DB4 (SCSI_In_DBx__DB4__PC)
|
||||
#define SCSI_In_DBx_DB5 (SCSI_In_DBx__DB5__PC)
|
||||
#define SCSI_In_DBx_DB6 (SCSI_In_DBx__DB6__PC)
|
||||
#define SCSI_In_DBx_DB7 (SCSI_In_DBx__DB7__PC)
|
||||
#define SCSI_In_DBx_1 (SCSI_In_DBx__1__PC)
|
||||
#define SCSI_In_DBx_1_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__1__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_2 (SCSI_In_DBx__2__PC)
|
||||
#define SCSI_In_DBx_2_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__2__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_3 (SCSI_In_DBx__3__PC)
|
||||
#define SCSI_In_DBx_3_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__3__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_4 (SCSI_In_DBx__4__PC)
|
||||
#define SCSI_In_DBx_4_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__4__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_5 (SCSI_In_DBx__5__PC)
|
||||
#define SCSI_In_DBx_5_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__5__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_6 (SCSI_In_DBx__6__PC)
|
||||
#define SCSI_In_DBx_6_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__6__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_7 (SCSI_In_DBx__7__PC)
|
||||
#define SCSI_In_DBx_7_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__7__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_INTR_ALL ((uint16)(SCSI_In_DBx_0_INTR| SCSI_In_DBx_1_INTR| SCSI_In_DBx_2_INTR| SCSI_In_DBx_3_INTR| SCSI_In_DBx_4_INTR| SCSI_In_DBx_5_INTR| SCSI_In_DBx_6_INTR| SCSI_In_DBx_7_INTR))
|
||||
#define SCSI_In_DBx_DB0 (SCSI_In_DBx__DB0__PC)
|
||||
#define SCSI_In_DBx_DB0_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__0__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB1 (SCSI_In_DBx__DB1__PC)
|
||||
#define SCSI_In_DBx_DB1_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__1__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB2 (SCSI_In_DBx__DB2__PC)
|
||||
#define SCSI_In_DBx_DB2_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__2__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB3 (SCSI_In_DBx__DB3__PC)
|
||||
#define SCSI_In_DBx_DB3_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__3__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB4 (SCSI_In_DBx__DB4__PC)
|
||||
#define SCSI_In_DBx_DB4_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__4__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB5 (SCSI_In_DBx__DB5__PC)
|
||||
#define SCSI_In_DBx_DB5_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__5__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB6 (SCSI_In_DBx__DB6__PC)
|
||||
#define SCSI_In_DBx_DB6_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__6__SHIFT))
|
||||
|
||||
#define SCSI_In_DBx_DB7 (SCSI_In_DBx__DB7__PC)
|
||||
#define SCSI_In_DBx_DB7_INTR ((uint16)((uint16)0x0001u << SCSI_In_DBx__7__SHIFT))
|
||||
|
||||
#endif /* End Pins SCSI_In_DBx_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
48
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_In_aliases.h
Normal file → Executable file
48
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_In_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_In.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,22 +22,41 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SCSI_In_0 (SCSI_In__0__PC)
|
||||
#define SCSI_In_1 (SCSI_In__1__PC)
|
||||
#define SCSI_In_2 (SCSI_In__2__PC)
|
||||
#define SCSI_In_3 (SCSI_In__3__PC)
|
||||
#define SCSI_In_4 (SCSI_In__4__PC)
|
||||
#define SCSI_In_0 (SCSI_In__0__PC)
|
||||
#define SCSI_In_0_INTR ((uint16)((uint16)0x0001u << SCSI_In__0__SHIFT))
|
||||
|
||||
#define SCSI_In_DBP (SCSI_In__DBP__PC)
|
||||
#define SCSI_In_MSG (SCSI_In__MSG__PC)
|
||||
#define SCSI_In_CD (SCSI_In__CD__PC)
|
||||
#define SCSI_In_REQ (SCSI_In__REQ__PC)
|
||||
#define SCSI_In_IO (SCSI_In__IO__PC)
|
||||
#define SCSI_In_1 (SCSI_In__1__PC)
|
||||
#define SCSI_In_1_INTR ((uint16)((uint16)0x0001u << SCSI_In__1__SHIFT))
|
||||
|
||||
#define SCSI_In_2 (SCSI_In__2__PC)
|
||||
#define SCSI_In_2_INTR ((uint16)((uint16)0x0001u << SCSI_In__2__SHIFT))
|
||||
|
||||
#define SCSI_In_3 (SCSI_In__3__PC)
|
||||
#define SCSI_In_3_INTR ((uint16)((uint16)0x0001u << SCSI_In__3__SHIFT))
|
||||
|
||||
#define SCSI_In_4 (SCSI_In__4__PC)
|
||||
#define SCSI_In_4_INTR ((uint16)((uint16)0x0001u << SCSI_In__4__SHIFT))
|
||||
|
||||
#define SCSI_In_INTR_ALL ((uint16)(SCSI_In_0_INTR| SCSI_In_1_INTR| SCSI_In_2_INTR| SCSI_In_3_INTR| SCSI_In_4_INTR))
|
||||
#define SCSI_In_DBP (SCSI_In__DBP__PC)
|
||||
#define SCSI_In_DBP_INTR ((uint16)((uint16)0x0001u << SCSI_In__0__SHIFT))
|
||||
|
||||
#define SCSI_In_MSG (SCSI_In__MSG__PC)
|
||||
#define SCSI_In_MSG_INTR ((uint16)((uint16)0x0001u << SCSI_In__1__SHIFT))
|
||||
|
||||
#define SCSI_In_CD (SCSI_In__CD__PC)
|
||||
#define SCSI_In_CD_INTR ((uint16)((uint16)0x0001u << SCSI_In__2__SHIFT))
|
||||
|
||||
#define SCSI_In_REQ (SCSI_In__REQ__PC)
|
||||
#define SCSI_In_REQ_INTR ((uint16)((uint16)0x0001u << SCSI_In__3__SHIFT))
|
||||
|
||||
#define SCSI_In_IO (SCSI_In__IO__PC)
|
||||
#define SCSI_In_IO_INTR ((uint16)((uint16)0x0001u << SCSI_In__4__SHIFT))
|
||||
|
||||
#endif /* End Pins SCSI_In_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
48
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Noise_aliases.h
Normal file → Executable file
48
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Noise_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Noise.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,22 +22,41 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SCSI_Noise_0 (SCSI_Noise__0__PC)
|
||||
#define SCSI_Noise_1 (SCSI_Noise__1__PC)
|
||||
#define SCSI_Noise_2 (SCSI_Noise__2__PC)
|
||||
#define SCSI_Noise_3 (SCSI_Noise__3__PC)
|
||||
#define SCSI_Noise_4 (SCSI_Noise__4__PC)
|
||||
#define SCSI_Noise_0 (SCSI_Noise__0__PC)
|
||||
#define SCSI_Noise_0_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__0__SHIFT))
|
||||
|
||||
#define SCSI_Noise_ATN (SCSI_Noise__ATN__PC)
|
||||
#define SCSI_Noise_BSY (SCSI_Noise__BSY__PC)
|
||||
#define SCSI_Noise_SEL (SCSI_Noise__SEL__PC)
|
||||
#define SCSI_Noise_RST (SCSI_Noise__RST__PC)
|
||||
#define SCSI_Noise_ACK (SCSI_Noise__ACK__PC)
|
||||
#define SCSI_Noise_1 (SCSI_Noise__1__PC)
|
||||
#define SCSI_Noise_1_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__1__SHIFT))
|
||||
|
||||
#define SCSI_Noise_2 (SCSI_Noise__2__PC)
|
||||
#define SCSI_Noise_2_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__2__SHIFT))
|
||||
|
||||
#define SCSI_Noise_3 (SCSI_Noise__3__PC)
|
||||
#define SCSI_Noise_3_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__3__SHIFT))
|
||||
|
||||
#define SCSI_Noise_4 (SCSI_Noise__4__PC)
|
||||
#define SCSI_Noise_4_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__4__SHIFT))
|
||||
|
||||
#define SCSI_Noise_INTR_ALL ((uint16)(SCSI_Noise_0_INTR| SCSI_Noise_1_INTR| SCSI_Noise_2_INTR| SCSI_Noise_3_INTR| SCSI_Noise_4_INTR))
|
||||
#define SCSI_Noise_ATN (SCSI_Noise__ATN__PC)
|
||||
#define SCSI_Noise_ATN_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__0__SHIFT))
|
||||
|
||||
#define SCSI_Noise_BSY (SCSI_Noise__BSY__PC)
|
||||
#define SCSI_Noise_BSY_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__1__SHIFT))
|
||||
|
||||
#define SCSI_Noise_SEL (SCSI_Noise__SEL__PC)
|
||||
#define SCSI_Noise_SEL_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__2__SHIFT))
|
||||
|
||||
#define SCSI_Noise_RST (SCSI_Noise__RST__PC)
|
||||
#define SCSI_Noise_RST_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__3__SHIFT))
|
||||
|
||||
#define SCSI_Noise_ACK (SCSI_Noise__ACK__PC)
|
||||
#define SCSI_Noise_ACK_INTR ((uint16)((uint16)0x0001u << SCSI_Noise__4__SHIFT))
|
||||
|
||||
#endif /* End Pins SCSI_Noise_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits.c
Normal file → Executable file
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Bits.c
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Control Register.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -16,8 +16,10 @@
|
||||
|
||||
#include "SCSI_Out_Bits.h"
|
||||
|
||||
#if !defined(SCSI_Out_Bits_Sync_ctrl_reg__REMOVED) /* Check for removal by optimization */
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Out_Bits_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Bits_Write
|
||||
********************************************************************************
|
||||
|
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits.h
Normal file → Executable file
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Bits.h
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -19,6 +19,18 @@
|
||||
|
||||
#include "cytypes.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 controlState;
|
||||
|
||||
} SCSI_Out_Bits_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
@ -27,6 +39,11 @@
|
||||
void SCSI_Out_Bits_Write(uint8 control) ;
|
||||
uint8 SCSI_Out_Bits_Read(void) ;
|
||||
|
||||
void SCSI_Out_Bits_SaveConfig(void) ;
|
||||
void SCSI_Out_Bits_RestoreConfig(void) ;
|
||||
void SCSI_Out_Bits_Sleep(void) ;
|
||||
void SCSI_Out_Bits_Wakeup(void) ;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
|
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits_PM.c
Executable file
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Bits_PM.c
Executable file
@ -0,0 +1,109 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Bits_PM.c
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains the setup, control, and status commands to support
|
||||
* the component operation in the low power mode.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SCSI_Out_Bits.h"
|
||||
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Out_Bits_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
static SCSI_Out_Bits_BACKUP_STRUCT SCSI_Out_Bits_backup = {0u};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Bits_SaveConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Saves the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Bits_SaveConfig(void)
|
||||
{
|
||||
SCSI_Out_Bits_backup.controlState = SCSI_Out_Bits_Control;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Bits_RestoreConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Bits_RestoreConfig(void)
|
||||
{
|
||||
SCSI_Out_Bits_Control = SCSI_Out_Bits_backup.controlState;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Bits_Sleep
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Prepares the component for entering the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Bits_Sleep(void)
|
||||
{
|
||||
SCSI_Out_Bits_SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Bits_Wakeup
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the component after waking up from the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Bits_Wakeup(void)
|
||||
{
|
||||
SCSI_Out_Bits_RestoreConfig();
|
||||
}
|
||||
|
||||
#endif /* End check for removal by optimization */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl.c
Normal file → Executable file
8
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Ctl.c
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Control Register.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -16,8 +16,10 @@
|
||||
|
||||
#include "SCSI_Out_Ctl.h"
|
||||
|
||||
#if !defined(SCSI_Out_Ctl_Sync_ctrl_reg__REMOVED) /* Check for removal by optimization */
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Out_Ctl_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Ctl_Write
|
||||
********************************************************************************
|
||||
|
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl.h
Normal file → Executable file
21
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Ctl.h
|
||||
* Version 1.70
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -19,6 +19,18 @@
|
||||
|
||||
#include "cytypes.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 controlState;
|
||||
|
||||
} SCSI_Out_Ctl_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
@ -27,6 +39,11 @@
|
||||
void SCSI_Out_Ctl_Write(uint8 control) ;
|
||||
uint8 SCSI_Out_Ctl_Read(void) ;
|
||||
|
||||
void SCSI_Out_Ctl_SaveConfig(void) ;
|
||||
void SCSI_Out_Ctl_RestoreConfig(void) ;
|
||||
void SCSI_Out_Ctl_Sleep(void) ;
|
||||
void SCSI_Out_Ctl_Wakeup(void) ;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
|
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl_PM.c
Executable file
109
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_Ctl_PM.c
Executable file
@ -0,0 +1,109 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_Ctl_PM.c
|
||||
* Version 1.80
|
||||
*
|
||||
* Description:
|
||||
* This file contains the setup, control, and status commands to support
|
||||
* the component operation in the low power mode.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SCSI_Out_Ctl.h"
|
||||
|
||||
/* Check for removal by optimization */
|
||||
#if !defined(SCSI_Out_Ctl_Sync_ctrl_reg__REMOVED)
|
||||
|
||||
static SCSI_Out_Ctl_BACKUP_STRUCT SCSI_Out_Ctl_backup = {0u};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Ctl_SaveConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Saves the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Ctl_SaveConfig(void)
|
||||
{
|
||||
SCSI_Out_Ctl_backup.controlState = SCSI_Out_Ctl_Control;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Ctl_RestoreConfig
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the control register value.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Ctl_RestoreConfig(void)
|
||||
{
|
||||
SCSI_Out_Ctl_Control = SCSI_Out_Ctl_backup.controlState;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Ctl_Sleep
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Prepares the component for entering the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Ctl_Sleep(void)
|
||||
{
|
||||
SCSI_Out_Ctl_SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SCSI_Out_Ctl_Wakeup
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores the component after waking up from the low power mode.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SCSI_Out_Ctl_Wakeup(void)
|
||||
{
|
||||
SCSI_Out_Ctl_RestoreConfig();
|
||||
}
|
||||
|
||||
#endif /* End check for removal by optimization */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
72
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_DBx_aliases.h
Normal file → Executable file
72
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_DBx_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out_DBx.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,28 +22,59 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SCSI_Out_DBx_0 (SCSI_Out_DBx__0__PC)
|
||||
#define SCSI_Out_DBx_1 (SCSI_Out_DBx__1__PC)
|
||||
#define SCSI_Out_DBx_2 (SCSI_Out_DBx__2__PC)
|
||||
#define SCSI_Out_DBx_3 (SCSI_Out_DBx__3__PC)
|
||||
#define SCSI_Out_DBx_4 (SCSI_Out_DBx__4__PC)
|
||||
#define SCSI_Out_DBx_5 (SCSI_Out_DBx__5__PC)
|
||||
#define SCSI_Out_DBx_6 (SCSI_Out_DBx__6__PC)
|
||||
#define SCSI_Out_DBx_7 (SCSI_Out_DBx__7__PC)
|
||||
#define SCSI_Out_DBx_0 (SCSI_Out_DBx__0__PC)
|
||||
#define SCSI_Out_DBx_0_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__0__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB0 (SCSI_Out_DBx__DB0__PC)
|
||||
#define SCSI_Out_DBx_DB1 (SCSI_Out_DBx__DB1__PC)
|
||||
#define SCSI_Out_DBx_DB2 (SCSI_Out_DBx__DB2__PC)
|
||||
#define SCSI_Out_DBx_DB3 (SCSI_Out_DBx__DB3__PC)
|
||||
#define SCSI_Out_DBx_DB4 (SCSI_Out_DBx__DB4__PC)
|
||||
#define SCSI_Out_DBx_DB5 (SCSI_Out_DBx__DB5__PC)
|
||||
#define SCSI_Out_DBx_DB6 (SCSI_Out_DBx__DB6__PC)
|
||||
#define SCSI_Out_DBx_DB7 (SCSI_Out_DBx__DB7__PC)
|
||||
#define SCSI_Out_DBx_1 (SCSI_Out_DBx__1__PC)
|
||||
#define SCSI_Out_DBx_1_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__1__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_2 (SCSI_Out_DBx__2__PC)
|
||||
#define SCSI_Out_DBx_2_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__2__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_3 (SCSI_Out_DBx__3__PC)
|
||||
#define SCSI_Out_DBx_3_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__3__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_4 (SCSI_Out_DBx__4__PC)
|
||||
#define SCSI_Out_DBx_4_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__4__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_5 (SCSI_Out_DBx__5__PC)
|
||||
#define SCSI_Out_DBx_5_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__5__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_6 (SCSI_Out_DBx__6__PC)
|
||||
#define SCSI_Out_DBx_6_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__6__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_7 (SCSI_Out_DBx__7__PC)
|
||||
#define SCSI_Out_DBx_7_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__7__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_INTR_ALL ((uint16)(SCSI_Out_DBx_0_INTR| SCSI_Out_DBx_1_INTR| SCSI_Out_DBx_2_INTR| SCSI_Out_DBx_3_INTR| SCSI_Out_DBx_4_INTR| SCSI_Out_DBx_5_INTR| SCSI_Out_DBx_6_INTR| SCSI_Out_DBx_7_INTR))
|
||||
#define SCSI_Out_DBx_DB0 (SCSI_Out_DBx__DB0__PC)
|
||||
#define SCSI_Out_DBx_DB0_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__0__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB1 (SCSI_Out_DBx__DB1__PC)
|
||||
#define SCSI_Out_DBx_DB1_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__1__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB2 (SCSI_Out_DBx__DB2__PC)
|
||||
#define SCSI_Out_DBx_DB2_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__2__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB3 (SCSI_Out_DBx__DB3__PC)
|
||||
#define SCSI_Out_DBx_DB3_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__3__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB4 (SCSI_Out_DBx__DB4__PC)
|
||||
#define SCSI_Out_DBx_DB4_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__4__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB5 (SCSI_Out_DBx__DB5__PC)
|
||||
#define SCSI_Out_DBx_DB5_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__5__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB6 (SCSI_Out_DBx__DB6__PC)
|
||||
#define SCSI_Out_DBx_DB6_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__6__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBx_DB7 (SCSI_Out_DBx__DB7__PC)
|
||||
#define SCSI_Out_DBx_DB7_INTR ((uint16)((uint16)0x0001u << SCSI_Out_DBx__7__SHIFT))
|
||||
|
||||
#endif /* End Pins SCSI_Out_DBx_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
88
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_aliases.h
Normal file → Executable file
88
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Out_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Out.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,32 +22,71 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SCSI_Out_0 (SCSI_Out__0__PC)
|
||||
#define SCSI_Out_1 (SCSI_Out__1__PC)
|
||||
#define SCSI_Out_2 (SCSI_Out__2__PC)
|
||||
#define SCSI_Out_3 (SCSI_Out__3__PC)
|
||||
#define SCSI_Out_4 (SCSI_Out__4__PC)
|
||||
#define SCSI_Out_5 (SCSI_Out__5__PC)
|
||||
#define SCSI_Out_6 (SCSI_Out__6__PC)
|
||||
#define SCSI_Out_7 (SCSI_Out__7__PC)
|
||||
#define SCSI_Out_8 (SCSI_Out__8__PC)
|
||||
#define SCSI_Out_9 (SCSI_Out__9__PC)
|
||||
#define SCSI_Out_0 (SCSI_Out__0__PC)
|
||||
#define SCSI_Out_0_INTR ((uint16)((uint16)0x0001u << SCSI_Out__0__SHIFT))
|
||||
|
||||
#define SCSI_Out_DBP_raw (SCSI_Out__DBP_raw__PC)
|
||||
#define SCSI_Out_ATN (SCSI_Out__ATN__PC)
|
||||
#define SCSI_Out_BSY (SCSI_Out__BSY__PC)
|
||||
#define SCSI_Out_ACK (SCSI_Out__ACK__PC)
|
||||
#define SCSI_Out_RST (SCSI_Out__RST__PC)
|
||||
#define SCSI_Out_MSG_raw (SCSI_Out__MSG_raw__PC)
|
||||
#define SCSI_Out_SEL (SCSI_Out__SEL__PC)
|
||||
#define SCSI_Out_CD_raw (SCSI_Out__CD_raw__PC)
|
||||
#define SCSI_Out_REQ (SCSI_Out__REQ__PC)
|
||||
#define SCSI_Out_IO_raw (SCSI_Out__IO_raw__PC)
|
||||
#define SCSI_Out_1 (SCSI_Out__1__PC)
|
||||
#define SCSI_Out_1_INTR ((uint16)((uint16)0x0001u << SCSI_Out__1__SHIFT))
|
||||
|
||||
#define SCSI_Out_2 (SCSI_Out__2__PC)
|
||||
#define SCSI_Out_2_INTR ((uint16)((uint16)0x0001u << SCSI_Out__2__SHIFT))
|
||||
|
||||
#define SCSI_Out_3 (SCSI_Out__3__PC)
|
||||
#define SCSI_Out_3_INTR ((uint16)((uint16)0x0001u << SCSI_Out__3__SHIFT))
|
||||
|
||||
#define SCSI_Out_4 (SCSI_Out__4__PC)
|
||||
#define SCSI_Out_4_INTR ((uint16)((uint16)0x0001u << SCSI_Out__4__SHIFT))
|
||||
|
||||
#define SCSI_Out_5 (SCSI_Out__5__PC)
|
||||
#define SCSI_Out_5_INTR ((uint16)((uint16)0x0001u << SCSI_Out__5__SHIFT))
|
||||
|
||||
#define SCSI_Out_6 (SCSI_Out__6__PC)
|
||||
#define SCSI_Out_6_INTR ((uint16)((uint16)0x0001u << SCSI_Out__6__SHIFT))
|
||||
|
||||
#define SCSI_Out_7 (SCSI_Out__7__PC)
|
||||
#define SCSI_Out_7_INTR ((uint16)((uint16)0x0001u << SCSI_Out__7__SHIFT))
|
||||
|
||||
#define SCSI_Out_8 (SCSI_Out__8__PC)
|
||||
#define SCSI_Out_8_INTR ((uint16)((uint16)0x0001u << SCSI_Out__8__SHIFT))
|
||||
|
||||
#define SCSI_Out_9 (SCSI_Out__9__PC)
|
||||
#define SCSI_Out_9_INTR ((uint16)((uint16)0x0001u << SCSI_Out__9__SHIFT))
|
||||
|
||||
#define SCSI_Out_INTR_ALL ((uint16)(SCSI_Out_0_INTR| SCSI_Out_1_INTR| SCSI_Out_2_INTR| SCSI_Out_3_INTR| SCSI_Out_4_INTR| SCSI_Out_5_INTR| SCSI_Out_6_INTR| SCSI_Out_7_INTR| SCSI_Out_8_INTR| SCSI_Out_9_INTR))
|
||||
#define SCSI_Out_DBP_raw (SCSI_Out__DBP_raw__PC)
|
||||
#define SCSI_Out_DBP_raw_INTR ((uint16)((uint16)0x0001u << SCSI_Out__0__SHIFT))
|
||||
|
||||
#define SCSI_Out_ATN (SCSI_Out__ATN__PC)
|
||||
#define SCSI_Out_ATN_INTR ((uint16)((uint16)0x0001u << SCSI_Out__1__SHIFT))
|
||||
|
||||
#define SCSI_Out_BSY (SCSI_Out__BSY__PC)
|
||||
#define SCSI_Out_BSY_INTR ((uint16)((uint16)0x0001u << SCSI_Out__2__SHIFT))
|
||||
|
||||
#define SCSI_Out_ACK (SCSI_Out__ACK__PC)
|
||||
#define SCSI_Out_ACK_INTR ((uint16)((uint16)0x0001u << SCSI_Out__3__SHIFT))
|
||||
|
||||
#define SCSI_Out_RST (SCSI_Out__RST__PC)
|
||||
#define SCSI_Out_RST_INTR ((uint16)((uint16)0x0001u << SCSI_Out__4__SHIFT))
|
||||
|
||||
#define SCSI_Out_MSG_raw (SCSI_Out__MSG_raw__PC)
|
||||
#define SCSI_Out_MSG_raw_INTR ((uint16)((uint16)0x0001u << SCSI_Out__5__SHIFT))
|
||||
|
||||
#define SCSI_Out_SEL (SCSI_Out__SEL__PC)
|
||||
#define SCSI_Out_SEL_INTR ((uint16)((uint16)0x0001u << SCSI_Out__6__SHIFT))
|
||||
|
||||
#define SCSI_Out_CD_raw (SCSI_Out__CD_raw__PC)
|
||||
#define SCSI_Out_CD_raw_INTR ((uint16)((uint16)0x0001u << SCSI_Out__7__SHIFT))
|
||||
|
||||
#define SCSI_Out_REQ (SCSI_Out__REQ__PC)
|
||||
#define SCSI_Out_REQ_INTR ((uint16)((uint16)0x0001u << SCSI_Out__8__SHIFT))
|
||||
|
||||
#define SCSI_Out_IO_raw (SCSI_Out__IO_raw__PC)
|
||||
#define SCSI_Out_IO_raw_INTR ((uint16)((uint16)0x0001u << SCSI_Out__9__SHIFT))
|
||||
|
||||
#endif /* End Pins SCSI_Out_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
6
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Parity_Error.c
Normal file → Executable file
6
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Parity_Error.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Parity_Error.c
|
||||
* Version 1.80
|
||||
* Version 1.90
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware to read the value of a Status
|
||||
@ -9,7 +9,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -103,7 +103,7 @@ void SCSI_Parity_Error_InterruptDisable(void)
|
||||
void SCSI_Parity_Error_WriteMask(uint8 mask)
|
||||
{
|
||||
#if(SCSI_Parity_Error_INPUTS < 8u)
|
||||
mask &= (uint8)((((uint8)1u) << SCSI_Parity_Error_INPUTS) - 1u);
|
||||
mask &= ((uint8)(1u << SCSI_Parity_Error_INPUTS) - 1u);
|
||||
#endif /* End SCSI_Parity_Error_INPUTS < 8u */
|
||||
SCSI_Parity_Error_Status_Mask = mask;
|
||||
}
|
||||
|
16
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Parity_Error.h
Normal file → Executable file
16
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_Parity_Error.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SCSI_Parity_Error.h
|
||||
* Version 1.80
|
||||
* Version 1.90
|
||||
*
|
||||
* Description:
|
||||
* This file containts Status Register function prototypes and register defines
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -20,6 +20,18 @@
|
||||
#include "cytypes.h"
|
||||
#include "CyLib.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Struct Definitions
|
||||
***************************************/
|
||||
|
||||
/* Sleep Mode API Support */
|
||||
typedef struct
|
||||
{
|
||||
uint8 statusState;
|
||||
|
||||
} SCSI_Parity_Error_BACKUP_STRUCT;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_RX_DMA_dma.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_RX_DMA_dma.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_TX_DMA_dma.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SCSI_TX_DMA_dma.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SDCard.c
|
||||
* Version 2.40
|
||||
* Version 2.50
|
||||
*
|
||||
* Description:
|
||||
* This file provides all API functionality of the SPI Master component.
|
||||
@ -9,7 +9,7 @@
|
||||
* None.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -18,14 +18,14 @@
|
||||
#include "SDCard_PVT.h"
|
||||
|
||||
#if(SDCard_TX_SOFTWARE_BUF_ENABLED)
|
||||
volatile uint8 SDCard_txBuffer[SDCard_TX_BUFFER_SIZE] = {0u};
|
||||
volatile uint8 SDCard_txBuffer[SDCard_TX_BUFFER_SIZE];
|
||||
volatile uint8 SDCard_txBufferFull;
|
||||
volatile uint8 SDCard_txBufferRead;
|
||||
volatile uint8 SDCard_txBufferWrite;
|
||||
#endif /* (SDCard_TX_SOFTWARE_BUF_ENABLED) */
|
||||
|
||||
#if(SDCard_RX_SOFTWARE_BUF_ENABLED)
|
||||
volatile uint8 SDCard_rxBuffer[SDCard_RX_BUFFER_SIZE] = {0u};
|
||||
volatile uint8 SDCard_rxBuffer[SDCard_RX_BUFFER_SIZE];
|
||||
volatile uint8 SDCard_rxBufferFull;
|
||||
volatile uint8 SDCard_rxBufferRead;
|
||||
volatile uint8 SDCard_rxBufferWrite;
|
||||
@ -523,7 +523,7 @@ void SDCard_WriteTxData(uint8 txData)
|
||||
if((SDCard_txBufferRead == SDCard_txBufferWrite) &&
|
||||
(0u != (SDCard_swStatusTx & SDCard_STS_TX_FIFO_NOT_FULL)))
|
||||
{
|
||||
/* Add directly to the TX FIFO */
|
||||
/* Put data element into the TX FIFO */
|
||||
CY_SET_REG8(SDCard_TXDATA_PTR, txData);
|
||||
}
|
||||
else
|
||||
@ -553,13 +553,12 @@ void SDCard_WriteTxData(uint8 txData)
|
||||
SDCard_EnableTxInt();
|
||||
|
||||
#else
|
||||
|
||||
/* Wait until TX FIFO has a place */
|
||||
while(0u == (SDCard_TX_STATUS_REG & SDCard_STS_TX_FIFO_NOT_FULL))
|
||||
{
|
||||
; /* Wait for room in FIFO */
|
||||
}
|
||||
|
||||
/* Put byte in TX FIFO */
|
||||
/* Put data element into the TX FIFO */
|
||||
CY_SET_REG8(SDCard_TXDATA_PTR, txData);
|
||||
|
||||
#endif /* (SDCard_TX_SOFTWARE_BUF_ENABLED) */
|
||||
|
36
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SDCard.h
Normal file → Executable file
36
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SDCard.h
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SDCard.h
|
||||
* Version 2.40
|
||||
* Version 2.50
|
||||
*
|
||||
* Description:
|
||||
* Contains the function prototypes, constants and register definition
|
||||
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -26,7 +26,7 @@
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component SPI_Master_v2_40 requires cy_boot v3.0 or later
|
||||
#error Component SPI_Master_v2_50 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
|
||||
@ -71,11 +71,6 @@ typedef struct
|
||||
{
|
||||
uint8 enableState;
|
||||
uint8 cntrPeriod;
|
||||
#if(CY_UDB_V0)
|
||||
uint8 saveSrTxIntMask;
|
||||
uint8 saveSrRxIntMask;
|
||||
#endif /* (CY_UDB_V0) */
|
||||
|
||||
} SDCard_BACKUP_STRUCT;
|
||||
|
||||
|
||||
@ -123,9 +118,9 @@ CY_ISR_PROTO(SDCard_TX_ISR);
|
||||
CY_ISR_PROTO(SDCard_RX_ISR);
|
||||
|
||||
|
||||
/**********************************
|
||||
/***************************************
|
||||
* Variable with external linkage
|
||||
**********************************/
|
||||
***************************************/
|
||||
|
||||
extern uint8 SDCard_initVar;
|
||||
|
||||
@ -181,7 +176,6 @@ extern uint8 SDCard_initVar;
|
||||
/***************************************
|
||||
* Registers
|
||||
***************************************/
|
||||
|
||||
#if(CY_PSOC3 || CY_PSOC5)
|
||||
#define SDCard_TXDATA_REG (* (reg8 *) \
|
||||
SDCard_BSPIM_sR8_Dp_u0__F0_REG)
|
||||
@ -199,7 +193,7 @@ extern uint8 SDCard_initVar;
|
||||
SDCard_BSPIM_sR8_Dp_u0__16BIT_F0_REG)
|
||||
#define SDCard_RXDATA_REG (* (reg16 *) \
|
||||
SDCard_BSPIM_sR8_Dp_u0__16BIT_F1_REG)
|
||||
#define SDCard_RXDATA_PTR ( (reg16 *) \
|
||||
#define SDCard_RXDATA_PTR ( (reg16 *) \
|
||||
SDCard_BSPIM_sR8_Dp_u0__16BIT_F1_REG)
|
||||
#else
|
||||
#define SDCard_TXDATA_REG (* (reg8 *) \
|
||||
@ -236,9 +230,9 @@ extern uint8 SDCard_initVar;
|
||||
#define SDCard_RX_STATUS_PTR ( (reg8 *) SDCard_BSPIM_RxStsReg__STATUS_REG)
|
||||
|
||||
#define SDCard_CONTROL_REG (* (reg8 *) \
|
||||
SDCard_BSPIM_BidirMode_SyncCtl_CtrlReg__CONTROL_REG)
|
||||
SDCard_BSPIM_BidirMode_CtrlReg__CONTROL_REG)
|
||||
#define SDCard_CONTROL_PTR ( (reg8 *) \
|
||||
SDCard_BSPIM_BidirMode_SyncCtl_CtrlReg__CONTROL_REG)
|
||||
SDCard_BSPIM_BidirMode_CtrlReg__CONTROL_REG)
|
||||
|
||||
#define SDCard_TX_STATUS_MASK_REG (* (reg8 *) SDCard_BSPIM_TxStsReg__MASK_REG)
|
||||
#define SDCard_TX_STATUS_MASK_PTR ( (reg8 *) SDCard_BSPIM_TxStsReg__MASK_REG)
|
||||
@ -323,14 +317,10 @@ extern uint8 SDCard_initVar;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Obsolete definitions
|
||||
* The following code is DEPRECATED and
|
||||
* should not be used in new projects.
|
||||
***************************************/
|
||||
|
||||
/* Following definitions are for version compatibility.
|
||||
* They are obsolete in SPIM v2_30.
|
||||
* Please do not use it in new projects
|
||||
*/
|
||||
|
||||
#define SDCard_WriteByte SDCard_WriteTxData
|
||||
#define SDCard_ReadByte SDCard_ReadRxData
|
||||
void SDCard_SetInterruptMode(uint8 intSrc) ;
|
||||
@ -338,7 +328,6 @@ uint8 SDCard_ReadStatus(void) ;
|
||||
void SDCard_EnableInt(void) ;
|
||||
void SDCard_DisableInt(void) ;
|
||||
|
||||
/* Obsolete register names. Not to be used in new designs */
|
||||
#define SDCard_TXDATA (SDCard_TXDATA_REG)
|
||||
#define SDCard_RXDATA (SDCard_RXDATA_REG)
|
||||
#define SDCard_AUX_CONTROLDP0 (SDCard_AUX_CONTROL_DP0_REG)
|
||||
@ -362,11 +351,6 @@ void SDCard_DisableInt(void) ;
|
||||
SDCard_INT_ON_RX_OVER | \
|
||||
SDCard_INT_ON_BYTE_COMP)
|
||||
|
||||
/* Following definitions are for version Compatibility.
|
||||
* They are obsolete in SPIM v2_40.
|
||||
* Please do not use it in new projects
|
||||
*/
|
||||
|
||||
#define SDCard_DataWidth (SDCard_DATA_WIDTH)
|
||||
#define SDCard_InternalClockUsed (SDCard_INTERNAL_CLOCK)
|
||||
#define SDCard_InternalTxInterruptEnabled (SDCard_INTERNAL_TX_INT_ENABLED)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SDCard_INT.c
|
||||
* Version 2.40
|
||||
* Version 2.50
|
||||
*
|
||||
* Description:
|
||||
* This file provides all Interrupt Service Routine (ISR) for the SPI Master
|
||||
@ -10,7 +10,7 @@
|
||||
* None.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include "SDCard_PVT.h"
|
||||
|
||||
|
||||
/* User code required at start of ISR */
|
||||
/* `#START SDCard_ISR_START_DEF` */
|
||||
|
||||
@ -54,11 +55,15 @@ CY_ISR(SDCard_TX_ISR)
|
||||
uint8 tmpStatus;
|
||||
#endif /* (SDCard_TX_SOFTWARE_BUF_ENABLED) */
|
||||
|
||||
#ifdef SDCard_TX_ISR_ENTRY_CALLBACK
|
||||
SDCard_TX_ISR_EntryCallback();
|
||||
#endif /* SDCard_TX_ISR_ENTRY_CALLBACK */
|
||||
|
||||
/* User code required at start of ISR */
|
||||
/* `#START SDCard_TX_ISR_START` */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
|
||||
#if(SDCard_TX_SOFTWARE_BUF_ENABLED)
|
||||
/* Check if TX data buffer is not empty and there is space in TX FIFO */
|
||||
while(SDCard_txBufferRead != SDCard_txBufferWrite)
|
||||
@ -82,9 +87,9 @@ CY_ISR(SDCard_TX_ISR)
|
||||
SDCard_txBufferFull = 0u;
|
||||
}
|
||||
|
||||
/* Move data from the Buffer to the FIFO */
|
||||
CY_SET_REG8(SDCard_TXDATA_PTR,
|
||||
SDCard_txBuffer[SDCard_txBufferRead]);
|
||||
/* Put data element into the TX FIFO */
|
||||
CY_SET_REG8(SDCard_TXDATA_PTR,
|
||||
SDCard_txBuffer[SDCard_txBufferRead]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,6 +109,10 @@ CY_ISR(SDCard_TX_ISR)
|
||||
/* `#START SDCard_TX_ISR_END` */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef SDCard_TX_ISR_EXIT_CALLBACK
|
||||
SDCard_TX_ISR_ExitCallback();
|
||||
#endif /* SDCard_TX_ISR_EXIT_CALLBACK */
|
||||
}
|
||||
|
||||
|
||||
@ -138,11 +147,15 @@ CY_ISR(SDCard_RX_ISR)
|
||||
uint8 rxData;
|
||||
#endif /* (SDCard_RX_SOFTWARE_BUF_ENABLED) */
|
||||
|
||||
#ifdef SDCard_RX_ISR_ENTRY_CALLBACK
|
||||
SDCard_RX_ISR_EntryCallback();
|
||||
#endif /* SDCard_RX_ISR_ENTRY_CALLBACK */
|
||||
|
||||
/* User code required at start of ISR */
|
||||
/* `#START SDCard_RX_ISR_START` */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
|
||||
#if(SDCard_RX_SOFTWARE_BUF_ENABLED)
|
||||
|
||||
tmpStatus = SDCard_GET_STATUS_RX(SDCard_swStatusRx);
|
||||
@ -184,6 +197,10 @@ CY_ISR(SDCard_RX_ISR)
|
||||
/* `#START SDCard_RX_ISR_END` */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef SDCard_RX_ISR_EXIT_CALLBACK
|
||||
SDCard_RX_ISR_ExitCallback();
|
||||
#endif /* SDCard_RX_ISR_EXIT_CALLBACK */
|
||||
}
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SDCard_PM.c
|
||||
* Version 2.40
|
||||
* Version 2.50
|
||||
*
|
||||
* Description:
|
||||
* This file contains the setup, control and status commands to support
|
||||
@ -9,7 +9,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,10 +21,6 @@ static SDCard_BACKUP_STRUCT SDCard_backup =
|
||||
{
|
||||
SDCard_DISABLED,
|
||||
SDCard_BITCTR_INIT,
|
||||
#if(CY_UDB_V0)
|
||||
SDCard_TX_INIT_INTERRUPTS_MASK,
|
||||
SDCard_RX_INIT_INTERRUPTS_MASK
|
||||
#endif /* CY_UDB_V0 */
|
||||
};
|
||||
|
||||
|
||||
@ -33,7 +29,7 @@ static SDCard_BACKUP_STRUCT SDCard_backup =
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Saves SPIM configuration.
|
||||
* Empty function. Included for consistency with other components.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
@ -41,21 +37,10 @@ static SDCard_BACKUP_STRUCT SDCard_backup =
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global Variables:
|
||||
* SDCard_backup - modified when non-retention registers are saved.
|
||||
*
|
||||
* Reentrant:
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SDCard_SaveConfig(void)
|
||||
{
|
||||
/* Store Status Mask registers */
|
||||
#if(CY_UDB_V0)
|
||||
SDCard_backup.cntrPeriod = SDCard_COUNTER_PERIOD_REG;
|
||||
SDCard_backup.saveSrTxIntMask = SDCard_TX_STATUS_MASK_REG;
|
||||
SDCard_backup.saveSrRxIntMask = SDCard_RX_STATUS_MASK_REG;
|
||||
#endif /* (CY_UDB_V0) */
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +49,7 @@ void SDCard_SaveConfig(void)
|
||||
********************************************************************************
|
||||
*
|
||||
* Summary:
|
||||
* Restores SPIM configuration.
|
||||
* Empty function. Included for consistency with other components.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
@ -72,23 +57,10 @@ void SDCard_SaveConfig(void)
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global Variables:
|
||||
* SDCard_backup - used when non-retention registers are restored.
|
||||
*
|
||||
* Side Effects:
|
||||
* If this API is called without first calling SaveConfig then in the following
|
||||
* registers will be default values from Customizer:
|
||||
* SDCard_STATUS_MASK_REG and SDCard_COUNTER_PERIOD_REG.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void SDCard_RestoreConfig(void)
|
||||
{
|
||||
/* Restore the data, saved by SaveConfig() function */
|
||||
#if(CY_UDB_V0)
|
||||
SDCard_COUNTER_PERIOD_REG = SDCard_backup.cntrPeriod;
|
||||
SDCard_TX_STATUS_MASK_REG = ((uint8) SDCard_backup.saveSrTxIntMask);
|
||||
SDCard_RX_STATUS_MASK_REG = ((uint8) SDCard_backup.saveSrRxIntMask);
|
||||
#endif /* (CY_UDB_V0) */
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +90,6 @@ void SDCard_Sleep(void)
|
||||
SDCard_backup.enableState = ((uint8) SDCard_IS_ENABLED);
|
||||
|
||||
SDCard_Stop();
|
||||
SDCard_SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
@ -152,8 +123,6 @@ void SDCard_Sleep(void)
|
||||
*******************************************************************************/
|
||||
void SDCard_Wakeup(void)
|
||||
{
|
||||
SDCard_RestoreConfig();
|
||||
|
||||
#if(SDCard_RX_SOFTWARE_BUF_ENABLED)
|
||||
SDCard_rxBufferFull = 0u;
|
||||
SDCard_rxBufferRead = 0u;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: .h
|
||||
* Version 2.40
|
||||
* Version 2.50
|
||||
*
|
||||
* Description:
|
||||
* This private header file contains internal definitions for the SPIM
|
||||
@ -9,7 +9,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2012, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2012-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CD.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_Write
|
||||
*******************************************************************************/
|
||||
void SD_CD_Write(uint8 value)
|
||||
void SD_CD_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_CD_DR & (uint8)(~SD_CD_MASK));
|
||||
SD_CD_DR = staticBits | ((uint8)(value << SD_CD_SHIFT) & SD_CD_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_CD_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_CD_DM_STRONG Strong Drive
|
||||
* SD_CD_DM_OD_HI Open Drain, Drives High
|
||||
* SD_CD_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_CD_DM_RES_UP Resistive Pull Up
|
||||
* SD_CD_DM_RES_DWN Resistive Pull Down
|
||||
* SD_CD_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_CD_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_CD_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_CD_SetDriveMode(uint8 mode)
|
||||
void SD_CD_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_CD_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_CD_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_CD_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_CD_Read(void)
|
||||
uint8 SD_CD_Read(void)
|
||||
{
|
||||
return (SD_CD_PS & SD_CD_MASK) >> SD_CD_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_CD_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_CD_Read() API because the
|
||||
* SD_CD_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_CD_ReadDataReg(void)
|
||||
uint8 SD_CD_ReadDataReg(void)
|
||||
{
|
||||
return (SD_CD_DR & SD_CD_MASK) >> SD_CD_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_CD_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_CD_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_CD_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_CD_0_INTR (First pin in the list)
|
||||
* - SD_CD_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_CD_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_CD_ClearInterrupt(void)
|
||||
void SD_CD_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_CD_0_INTR) != 0u)
|
||||
{
|
||||
SD_CD_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CD_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CD_SUT.c usage_SD_CD_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_CD_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_CD_INTSTAT & SD_CD_MASK) >> SD_CD_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CD.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_CD_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_CD__PORT == 15 && ((SD_CD__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_CD_Write(uint8 value) ;
|
||||
void SD_CD_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_CD_ReadDataReg(void) ;
|
||||
uint8 SD_CD_Read(void) ;
|
||||
uint8 SD_CD_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_CD_Write(uint8 value);
|
||||
void SD_CD_SetDriveMode(uint8 mode);
|
||||
uint8 SD_CD_ReadDataReg(void);
|
||||
uint8 SD_CD_Read(void);
|
||||
void SD_CD_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_CD_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_CD_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_CD_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_CD_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_CD_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_CD_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_CD_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_CD_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_CD_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_CD_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_CD_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_CD_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_CD_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_CD_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_CD_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_CD_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_CD_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_CD_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_CD_MASK SD_CD__MASK
|
||||
#define SD_CD_SHIFT SD_CD__SHIFT
|
||||
#define SD_CD_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_CD__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_CD_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_CD_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_CD_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_CD_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_CD_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_CD_INTR_MASK (0x01u)
|
||||
#endif /* (SD_CD__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_CD_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_CD_PRTDSI__SYNC_OUT (* (reg8 *) SD_CD__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_CD__SIO_CFG)
|
||||
#define SD_CD_SIO_HYST_EN (* (reg8 *) SD_CD__SIO_HYST_EN)
|
||||
#define SD_CD_SIO_REG_HIFREQ (* (reg8 *) SD_CD__SIO_REG_HIFREQ)
|
||||
#define SD_CD_SIO_CFG (* (reg8 *) SD_CD__SIO_CFG)
|
||||
#define SD_CD_SIO_DIFF (* (reg8 *) SD_CD__SIO_DIFF)
|
||||
#endif /* (SD_CD__SIO_CFG) */
|
||||
|
||||
#if defined(SD_CD__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_CD_INTSTAT (* (reg8 *) SD_CD__INTSTAT)
|
||||
#define SD_CD_SNAP (* (reg8 *) SD_CD__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_CD__INTSTAT)
|
||||
#define SD_CD_INTSTAT (* (reg8 *) SD_CD__INTSTAT)
|
||||
#define SD_CD_SNAP (* (reg8 *) SD_CD__SNAP)
|
||||
|
||||
#define SD_CD_0_INTTYPE_REG (* (reg8 *) SD_CD__0__INTTYPE)
|
||||
#endif /* (SD_CD__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CD_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CD.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_CD_0 (SD_CD__0__PC)
|
||||
#define SD_CD_0 (SD_CD__0__PC)
|
||||
#define SD_CD_0_INTR ((uint16)((uint16)0x0001u << SD_CD__0__SHIFT))
|
||||
|
||||
#define SD_CD_INTR_ALL ((uint16)(SD_CD_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_CD_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CS.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_Write
|
||||
*******************************************************************************/
|
||||
void SD_CS_Write(uint8 value)
|
||||
void SD_CS_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_CS_DR & (uint8)(~SD_CS_MASK));
|
||||
SD_CS_DR = staticBits | ((uint8)(value << SD_CS_SHIFT) & SD_CS_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_CS_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_CS_DM_STRONG Strong Drive
|
||||
* SD_CS_DM_OD_HI Open Drain, Drives High
|
||||
* SD_CS_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_CS_DM_RES_UP Resistive Pull Up
|
||||
* SD_CS_DM_RES_DWN Resistive Pull Down
|
||||
* SD_CS_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_CS_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_CS_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_CS_SetDriveMode(uint8 mode)
|
||||
void SD_CS_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_CS_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_CS_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_CS_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_CS_Read(void)
|
||||
uint8 SD_CS_Read(void)
|
||||
{
|
||||
return (SD_CS_PS & SD_CS_MASK) >> SD_CS_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_CS_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_CS_Read() API because the
|
||||
* SD_CS_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_CS_ReadDataReg(void)
|
||||
uint8 SD_CS_ReadDataReg(void)
|
||||
{
|
||||
return (SD_CS_DR & SD_CS_MASK) >> SD_CS_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_CS_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_CS_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_CS_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_CS_0_INTR (First pin in the list)
|
||||
* - SD_CS_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_CS_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_CS_ClearInterrupt(void)
|
||||
void SD_CS_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_CS_0_INTR) != 0u)
|
||||
{
|
||||
SD_CS_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_CS_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_CS_SUT.c usage_SD_CS_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_CS_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_CS_INTSTAT & SD_CS_MASK) >> SD_CS_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CS.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_CS_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_CS__PORT == 15 && ((SD_CS__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_CS_Write(uint8 value) ;
|
||||
void SD_CS_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_CS_ReadDataReg(void) ;
|
||||
uint8 SD_CS_Read(void) ;
|
||||
uint8 SD_CS_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_CS_Write(uint8 value);
|
||||
void SD_CS_SetDriveMode(uint8 mode);
|
||||
uint8 SD_CS_ReadDataReg(void);
|
||||
uint8 SD_CS_Read(void);
|
||||
void SD_CS_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_CS_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_CS_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_CS_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_CS_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_CS_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_CS_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_CS_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_CS_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_CS_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_CS_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_CS_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_CS_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_CS_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_CS_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_CS_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_CS_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_CS_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_CS_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_CS_MASK SD_CS__MASK
|
||||
#define SD_CS_SHIFT SD_CS__SHIFT
|
||||
#define SD_CS_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_CS__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_CS_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_CS_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_CS_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_CS_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_CS_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_CS_INTR_MASK (0x01u)
|
||||
#endif /* (SD_CS__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_CS_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_CS_PRTDSI__SYNC_OUT (* (reg8 *) SD_CS__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_CS__SIO_CFG)
|
||||
#define SD_CS_SIO_HYST_EN (* (reg8 *) SD_CS__SIO_HYST_EN)
|
||||
#define SD_CS_SIO_REG_HIFREQ (* (reg8 *) SD_CS__SIO_REG_HIFREQ)
|
||||
#define SD_CS_SIO_CFG (* (reg8 *) SD_CS__SIO_CFG)
|
||||
#define SD_CS_SIO_DIFF (* (reg8 *) SD_CS__SIO_DIFF)
|
||||
#endif /* (SD_CS__SIO_CFG) */
|
||||
|
||||
#if defined(SD_CS__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_CS_INTSTAT (* (reg8 *) SD_CS__INTSTAT)
|
||||
#define SD_CS_SNAP (* (reg8 *) SD_CS__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_CS__INTSTAT)
|
||||
#define SD_CS_INTSTAT (* (reg8 *) SD_CS__INTSTAT)
|
||||
#define SD_CS_SNAP (* (reg8 *) SD_CS__SNAP)
|
||||
|
||||
#define SD_CS_0_INTTYPE_REG (* (reg8 *) SD_CS__0__INTTYPE)
|
||||
#endif /* (SD_CS__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_CS_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_CS.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_CS_0 (SD_CS__0__PC)
|
||||
#define SD_CS_0 (SD_CS__0__PC)
|
||||
#define SD_CS_0_INTR ((uint16)((uint16)0x0001u << SD_CS__0__SHIFT))
|
||||
|
||||
#define SD_CS_INTR_ALL ((uint16)(SD_CS_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_CS_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT1.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_Write
|
||||
*******************************************************************************/
|
||||
void SD_DAT1_Write(uint8 value)
|
||||
void SD_DAT1_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_DAT1_DR & (uint8)(~SD_DAT1_MASK));
|
||||
SD_DAT1_DR = staticBits | ((uint8)(value << SD_DAT1_SHIFT) & SD_DAT1_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_DAT1_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_DAT1_DM_STRONG Strong Drive
|
||||
* SD_DAT1_DM_OD_HI Open Drain, Drives High
|
||||
* SD_DAT1_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_DAT1_DM_RES_UP Resistive Pull Up
|
||||
* SD_DAT1_DM_RES_DWN Resistive Pull Down
|
||||
* SD_DAT1_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_DAT1_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_DAT1_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_DAT1_SetDriveMode(uint8 mode)
|
||||
void SD_DAT1_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_DAT1_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_DAT1_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_DAT1_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT1_Read(void)
|
||||
uint8 SD_DAT1_Read(void)
|
||||
{
|
||||
return (SD_DAT1_PS & SD_DAT1_MASK) >> SD_DAT1_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_DAT1_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_DAT1_Read() API because the
|
||||
* SD_DAT1_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT1_ReadDataReg(void)
|
||||
uint8 SD_DAT1_ReadDataReg(void)
|
||||
{
|
||||
return (SD_DAT1_DR & SD_DAT1_MASK) >> SD_DAT1_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_DAT1_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_DAT1_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_DAT1_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_DAT1_0_INTR (First pin in the list)
|
||||
* - SD_DAT1_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_DAT1_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT1_ClearInterrupt(void)
|
||||
void SD_DAT1_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_DAT1_0_INTR) != 0u)
|
||||
{
|
||||
SD_DAT1_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT1_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT1_SUT.c usage_SD_DAT1_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT1_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_DAT1_INTSTAT & SD_DAT1_MASK) >> SD_DAT1_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT1.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_DAT1_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_DAT1__PORT == 15 && ((SD_DAT1__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_DAT1_Write(uint8 value) ;
|
||||
void SD_DAT1_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_DAT1_ReadDataReg(void) ;
|
||||
uint8 SD_DAT1_Read(void) ;
|
||||
uint8 SD_DAT1_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_DAT1_Write(uint8 value);
|
||||
void SD_DAT1_SetDriveMode(uint8 mode);
|
||||
uint8 SD_DAT1_ReadDataReg(void);
|
||||
uint8 SD_DAT1_Read(void);
|
||||
void SD_DAT1_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_DAT1_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_DAT1_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_DAT1_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_DAT1_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_DAT1_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_DAT1_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_DAT1_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_DAT1_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_DAT1_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_DAT1_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_DAT1_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_DAT1_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_DAT1_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_DAT1_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_DAT1_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_DAT1_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_DAT1_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_DAT1_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_DAT1_MASK SD_DAT1__MASK
|
||||
#define SD_DAT1_SHIFT SD_DAT1__SHIFT
|
||||
#define SD_DAT1_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_DAT1__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_DAT1_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_DAT1_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_DAT1_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_DAT1_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_DAT1_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_DAT1_INTR_MASK (0x01u)
|
||||
#endif /* (SD_DAT1__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_DAT1_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_DAT1_PRTDSI__SYNC_OUT (* (reg8 *) SD_DAT1__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_DAT1__SIO_CFG)
|
||||
#define SD_DAT1_SIO_HYST_EN (* (reg8 *) SD_DAT1__SIO_HYST_EN)
|
||||
#define SD_DAT1_SIO_REG_HIFREQ (* (reg8 *) SD_DAT1__SIO_REG_HIFREQ)
|
||||
#define SD_DAT1_SIO_CFG (* (reg8 *) SD_DAT1__SIO_CFG)
|
||||
#define SD_DAT1_SIO_DIFF (* (reg8 *) SD_DAT1__SIO_DIFF)
|
||||
#endif /* (SD_DAT1__SIO_CFG) */
|
||||
|
||||
#if defined(SD_DAT1__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_DAT1_INTSTAT (* (reg8 *) SD_DAT1__INTSTAT)
|
||||
#define SD_DAT1_SNAP (* (reg8 *) SD_DAT1__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_DAT1__INTSTAT)
|
||||
#define SD_DAT1_INTSTAT (* (reg8 *) SD_DAT1__INTSTAT)
|
||||
#define SD_DAT1_SNAP (* (reg8 *) SD_DAT1__SNAP)
|
||||
|
||||
#define SD_DAT1_0_INTTYPE_REG (* (reg8 *) SD_DAT1__0__INTTYPE)
|
||||
#endif /* (SD_DAT1__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT1_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT1.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_DAT1_0 (SD_DAT1__0__PC)
|
||||
#define SD_DAT1_0 (SD_DAT1__0__PC)
|
||||
#define SD_DAT1_0_INTR ((uint16)((uint16)0x0001u << SD_DAT1__0__SHIFT))
|
||||
|
||||
#define SD_DAT1_INTR_ALL ((uint16)(SD_DAT1_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_DAT1_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT2.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_Write
|
||||
*******************************************************************************/
|
||||
void SD_DAT2_Write(uint8 value)
|
||||
void SD_DAT2_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_DAT2_DR & (uint8)(~SD_DAT2_MASK));
|
||||
SD_DAT2_DR = staticBits | ((uint8)(value << SD_DAT2_SHIFT) & SD_DAT2_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_DAT2_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_DAT2_DM_STRONG Strong Drive
|
||||
* SD_DAT2_DM_OD_HI Open Drain, Drives High
|
||||
* SD_DAT2_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_DAT2_DM_RES_UP Resistive Pull Up
|
||||
* SD_DAT2_DM_RES_DWN Resistive Pull Down
|
||||
* SD_DAT2_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_DAT2_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_DAT2_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_DAT2_SetDriveMode(uint8 mode)
|
||||
void SD_DAT2_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_DAT2_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_DAT2_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_DAT2_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT2_Read(void)
|
||||
uint8 SD_DAT2_Read(void)
|
||||
{
|
||||
return (SD_DAT2_PS & SD_DAT2_MASK) >> SD_DAT2_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_DAT2_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_DAT2_Read() API because the
|
||||
* SD_DAT2_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT2_ReadDataReg(void)
|
||||
uint8 SD_DAT2_ReadDataReg(void)
|
||||
{
|
||||
return (SD_DAT2_DR & SD_DAT2_MASK) >> SD_DAT2_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_DAT2_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_DAT2_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_DAT2_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_DAT2_0_INTR (First pin in the list)
|
||||
* - SD_DAT2_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_DAT2_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT2_ClearInterrupt(void)
|
||||
void SD_DAT2_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_DAT2_0_INTR) != 0u)
|
||||
{
|
||||
SD_DAT2_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_DAT2_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_DAT2_SUT.c usage_SD_DAT2_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_DAT2_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_DAT2_INTSTAT & SD_DAT2_MASK) >> SD_DAT2_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT2.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_DAT2_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_DAT2__PORT == 15 && ((SD_DAT2__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_DAT2_Write(uint8 value) ;
|
||||
void SD_DAT2_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_DAT2_ReadDataReg(void) ;
|
||||
uint8 SD_DAT2_Read(void) ;
|
||||
uint8 SD_DAT2_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_DAT2_Write(uint8 value);
|
||||
void SD_DAT2_SetDriveMode(uint8 mode);
|
||||
uint8 SD_DAT2_ReadDataReg(void);
|
||||
uint8 SD_DAT2_Read(void);
|
||||
void SD_DAT2_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_DAT2_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_DAT2_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_DAT2_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_DAT2_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_DAT2_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_DAT2_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_DAT2_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_DAT2_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_DAT2_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_DAT2_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_DAT2_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_DAT2_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_DAT2_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_DAT2_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_DAT2_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_DAT2_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_DAT2_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_DAT2_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_DAT2_MASK SD_DAT2__MASK
|
||||
#define SD_DAT2_SHIFT SD_DAT2__SHIFT
|
||||
#define SD_DAT2_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_DAT2__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_DAT2_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_DAT2_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_DAT2_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_DAT2_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_DAT2_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_DAT2_INTR_MASK (0x01u)
|
||||
#endif /* (SD_DAT2__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_DAT2_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_DAT2_PRTDSI__SYNC_OUT (* (reg8 *) SD_DAT2__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_DAT2__SIO_CFG)
|
||||
#define SD_DAT2_SIO_HYST_EN (* (reg8 *) SD_DAT2__SIO_HYST_EN)
|
||||
#define SD_DAT2_SIO_REG_HIFREQ (* (reg8 *) SD_DAT2__SIO_REG_HIFREQ)
|
||||
#define SD_DAT2_SIO_CFG (* (reg8 *) SD_DAT2__SIO_CFG)
|
||||
#define SD_DAT2_SIO_DIFF (* (reg8 *) SD_DAT2__SIO_DIFF)
|
||||
#endif /* (SD_DAT2__SIO_CFG) */
|
||||
|
||||
#if defined(SD_DAT2__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_DAT2_INTSTAT (* (reg8 *) SD_DAT2__INTSTAT)
|
||||
#define SD_DAT2_SNAP (* (reg8 *) SD_DAT2__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_DAT2__INTSTAT)
|
||||
#define SD_DAT2_INTSTAT (* (reg8 *) SD_DAT2__INTSTAT)
|
||||
#define SD_DAT2_SNAP (* (reg8 *) SD_DAT2__SNAP)
|
||||
|
||||
#define SD_DAT2_0_INTTYPE_REG (* (reg8 *) SD_DAT2__0__INTTYPE)
|
||||
#endif /* (SD_DAT2__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_DAT2_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_DAT2.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_DAT2_0 (SD_DAT2__0__PC)
|
||||
#define SD_DAT2_0 (SD_DAT2__0__PC)
|
||||
#define SD_DAT2_0_INTR ((uint16)((uint16)0x0001u << SD_DAT2__0__SHIFT))
|
||||
|
||||
#define SD_DAT2_INTR_ALL ((uint16)(SD_DAT2_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_DAT2_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_Data_Clk.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_Data_Clk.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MISO.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_Write
|
||||
*******************************************************************************/
|
||||
void SD_MISO_Write(uint8 value)
|
||||
void SD_MISO_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_MISO_DR & (uint8)(~SD_MISO_MASK));
|
||||
SD_MISO_DR = staticBits | ((uint8)(value << SD_MISO_SHIFT) & SD_MISO_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_MISO_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_MISO_DM_STRONG Strong Drive
|
||||
* SD_MISO_DM_OD_HI Open Drain, Drives High
|
||||
* SD_MISO_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_MISO_DM_RES_UP Resistive Pull Up
|
||||
* SD_MISO_DM_RES_DWN Resistive Pull Down
|
||||
* SD_MISO_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_MISO_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_MISO_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_MISO_SetDriveMode(uint8 mode)
|
||||
void SD_MISO_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_MISO_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_MISO_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_MISO_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_MISO_Read(void)
|
||||
uint8 SD_MISO_Read(void)
|
||||
{
|
||||
return (SD_MISO_PS & SD_MISO_MASK) >> SD_MISO_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_MISO_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_MISO_Read() API because the
|
||||
* SD_MISO_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_MISO_ReadDataReg(void)
|
||||
uint8 SD_MISO_ReadDataReg(void)
|
||||
{
|
||||
return (SD_MISO_DR & SD_MISO_MASK) >> SD_MISO_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_MISO_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_MISO_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_MISO_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_MISO_0_INTR (First pin in the list)
|
||||
* - SD_MISO_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_MISO_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_MISO_ClearInterrupt(void)
|
||||
void SD_MISO_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_MISO_0_INTR) != 0u)
|
||||
{
|
||||
SD_MISO_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MISO_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MISO_SUT.c usage_SD_MISO_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_MISO_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_MISO_INTSTAT & SD_MISO_MASK) >> SD_MISO_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MISO.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_MISO_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_MISO__PORT == 15 && ((SD_MISO__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_MISO_Write(uint8 value) ;
|
||||
void SD_MISO_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_MISO_ReadDataReg(void) ;
|
||||
uint8 SD_MISO_Read(void) ;
|
||||
uint8 SD_MISO_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_MISO_Write(uint8 value);
|
||||
void SD_MISO_SetDriveMode(uint8 mode);
|
||||
uint8 SD_MISO_ReadDataReg(void);
|
||||
uint8 SD_MISO_Read(void);
|
||||
void SD_MISO_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_MISO_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_MISO_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_MISO_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_MISO_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_MISO_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_MISO_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_MISO_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_MISO_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_MISO_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_MISO_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_MISO_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_MISO_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_MISO_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_MISO_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_MISO_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_MISO_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_MISO_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_MISO_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_MISO_MASK SD_MISO__MASK
|
||||
#define SD_MISO_SHIFT SD_MISO__SHIFT
|
||||
#define SD_MISO_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_MISO__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_MISO_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_MISO_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_MISO_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_MISO_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_MISO_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_MISO_INTR_MASK (0x01u)
|
||||
#endif /* (SD_MISO__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_MISO_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_MISO_PRTDSI__SYNC_OUT (* (reg8 *) SD_MISO__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_MISO__SIO_CFG)
|
||||
#define SD_MISO_SIO_HYST_EN (* (reg8 *) SD_MISO__SIO_HYST_EN)
|
||||
#define SD_MISO_SIO_REG_HIFREQ (* (reg8 *) SD_MISO__SIO_REG_HIFREQ)
|
||||
#define SD_MISO_SIO_CFG (* (reg8 *) SD_MISO__SIO_CFG)
|
||||
#define SD_MISO_SIO_DIFF (* (reg8 *) SD_MISO__SIO_DIFF)
|
||||
#endif /* (SD_MISO__SIO_CFG) */
|
||||
|
||||
#if defined(SD_MISO__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_MISO_INTSTAT (* (reg8 *) SD_MISO__INTSTAT)
|
||||
#define SD_MISO_SNAP (* (reg8 *) SD_MISO__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_MISO__INTSTAT)
|
||||
#define SD_MISO_INTSTAT (* (reg8 *) SD_MISO__INTSTAT)
|
||||
#define SD_MISO_SNAP (* (reg8 *) SD_MISO__SNAP)
|
||||
|
||||
#define SD_MISO_0_INTTYPE_REG (* (reg8 *) SD_MISO__0__INTTYPE)
|
||||
#endif /* (SD_MISO__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MISO_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MISO.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_MISO_0 (SD_MISO__0__PC)
|
||||
#define SD_MISO_0 (SD_MISO__0__PC)
|
||||
#define SD_MISO_0_INTR ((uint16)((uint16)0x0001u << SD_MISO__0__SHIFT))
|
||||
|
||||
#define SD_MISO_INTR_ALL ((uint16)(SD_MISO_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_MISO_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MOSI.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_Write
|
||||
*******************************************************************************/
|
||||
void SD_MOSI_Write(uint8 value)
|
||||
void SD_MOSI_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_MOSI_DR & (uint8)(~SD_MOSI_MASK));
|
||||
SD_MOSI_DR = staticBits | ((uint8)(value << SD_MOSI_SHIFT) & SD_MOSI_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_MOSI_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_MOSI_DM_STRONG Strong Drive
|
||||
* SD_MOSI_DM_OD_HI Open Drain, Drives High
|
||||
* SD_MOSI_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_MOSI_DM_RES_UP Resistive Pull Up
|
||||
* SD_MOSI_DM_RES_DWN Resistive Pull Down
|
||||
* SD_MOSI_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_MOSI_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_MOSI_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_MOSI_SetDriveMode(uint8 mode)
|
||||
void SD_MOSI_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_MOSI_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_MOSI_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_MOSI_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_MOSI_Read(void)
|
||||
uint8 SD_MOSI_Read(void)
|
||||
{
|
||||
return (SD_MOSI_PS & SD_MOSI_MASK) >> SD_MOSI_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_MOSI_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_MOSI_Read() API because the
|
||||
* SD_MOSI_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_MOSI_ReadDataReg(void)
|
||||
uint8 SD_MOSI_ReadDataReg(void)
|
||||
{
|
||||
return (SD_MOSI_DR & SD_MOSI_MASK) >> SD_MOSI_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_MOSI_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_MOSI_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_MOSI_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_MOSI_0_INTR (First pin in the list)
|
||||
* - SD_MOSI_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_MOSI_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_MOSI_ClearInterrupt(void)
|
||||
void SD_MOSI_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_MOSI_0_INTR) != 0u)
|
||||
{
|
||||
SD_MOSI_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_MOSI_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_MOSI_SUT.c usage_SD_MOSI_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_MOSI_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_MOSI_INTSTAT & SD_MOSI_MASK) >> SD_MOSI_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MOSI.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_MOSI_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_MOSI__PORT == 15 && ((SD_MOSI__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_MOSI_Write(uint8 value) ;
|
||||
void SD_MOSI_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_MOSI_ReadDataReg(void) ;
|
||||
uint8 SD_MOSI_Read(void) ;
|
||||
uint8 SD_MOSI_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_MOSI_Write(uint8 value);
|
||||
void SD_MOSI_SetDriveMode(uint8 mode);
|
||||
uint8 SD_MOSI_ReadDataReg(void);
|
||||
uint8 SD_MOSI_Read(void);
|
||||
void SD_MOSI_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_MOSI_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_MOSI_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_MOSI_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_MOSI_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_MOSI_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_MOSI_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_MOSI_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_MOSI_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_MOSI_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_MOSI_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_MOSI_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_MOSI_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_MOSI_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_MOSI_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_MOSI_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_MOSI_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_MOSI_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_MOSI_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_MOSI_MASK SD_MOSI__MASK
|
||||
#define SD_MOSI_SHIFT SD_MOSI__SHIFT
|
||||
#define SD_MOSI_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_MOSI__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_MOSI_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_MOSI_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_MOSI_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_MOSI_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_MOSI_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_MOSI_INTR_MASK (0x01u)
|
||||
#endif /* (SD_MOSI__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_MOSI_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_MOSI_PRTDSI__SYNC_OUT (* (reg8 *) SD_MOSI__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_MOSI__SIO_CFG)
|
||||
#define SD_MOSI_SIO_HYST_EN (* (reg8 *) SD_MOSI__SIO_HYST_EN)
|
||||
#define SD_MOSI_SIO_REG_HIFREQ (* (reg8 *) SD_MOSI__SIO_REG_HIFREQ)
|
||||
#define SD_MOSI_SIO_CFG (* (reg8 *) SD_MOSI__SIO_CFG)
|
||||
#define SD_MOSI_SIO_DIFF (* (reg8 *) SD_MOSI__SIO_DIFF)
|
||||
#endif /* (SD_MOSI__SIO_CFG) */
|
||||
|
||||
#if defined(SD_MOSI__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_MOSI_INTSTAT (* (reg8 *) SD_MOSI__INTSTAT)
|
||||
#define SD_MOSI_SNAP (* (reg8 *) SD_MOSI__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_MOSI__INTSTAT)
|
||||
#define SD_MOSI_INTSTAT (* (reg8 *) SD_MOSI__INTSTAT)
|
||||
#define SD_MOSI_SNAP (* (reg8 *) SD_MOSI__SNAP)
|
||||
|
||||
#define SD_MOSI_0_INTTYPE_REG (* (reg8 *) SD_MOSI__0__INTTYPE)
|
||||
#endif /* (SD_MOSI__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_MOSI_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_MOSI.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_MOSI_0 (SD_MOSI__0__PC)
|
||||
#define SD_MOSI_0 (SD_MOSI__0__PC)
|
||||
#define SD_MOSI_0_INTR ((uint16)((uint16)0x0001u << SD_MOSI__0__SHIFT))
|
||||
|
||||
#define SD_MOSI_INTR_ALL ((uint16)(SD_MOSI_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_MOSI_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_RX_DMA_dma.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_RX_DMA_dma.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_SCK.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_Write
|
||||
*******************************************************************************/
|
||||
void SD_SCK_Write(uint8 value)
|
||||
void SD_SCK_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (SD_SCK_DR & (uint8)(~SD_SCK_MASK));
|
||||
SD_SCK_DR = staticBits | ((uint8)(value << SD_SCK_SHIFT) & SD_SCK_MASK);
|
||||
@ -45,28 +63,31 @@ void SD_SCK_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* SD_SCK_DM_STRONG Strong Drive
|
||||
* SD_SCK_DM_OD_HI Open Drain, Drives High
|
||||
* SD_SCK_DM_OD_LO Open Drain, Drives Low
|
||||
* SD_SCK_DM_RES_UP Resistive Pull Up
|
||||
* SD_SCK_DM_RES_DWN Resistive Pull Down
|
||||
* SD_SCK_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* SD_SCK_DM_DIG_HIZ High Impedance Digital
|
||||
* SD_SCK_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void SD_SCK_SetDriveMode(uint8 mode)
|
||||
void SD_SCK_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(SD_SCK_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void SD_SCK_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro SD_SCK_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_Read
|
||||
*******************************************************************************/
|
||||
uint8 SD_SCK_Read(void)
|
||||
uint8 SD_SCK_Read(void)
|
||||
{
|
||||
return (SD_SCK_PS & SD_SCK_MASK) >> SD_SCK_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 SD_SCK_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred SD_SCK_Read() API because the
|
||||
* SD_SCK_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 SD_SCK_ReadDataReg(void)
|
||||
uint8 SD_SCK_ReadDataReg(void)
|
||||
{
|
||||
return (SD_SCK_DR & SD_SCK_MASK) >> SD_SCK_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(SD_SCK_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: SD_SCK_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use SD_SCK_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - SD_SCK_0_INTR (First pin in the list)
|
||||
* - SD_SCK_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - SD_SCK_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 SD_SCK_ClearInterrupt(void)
|
||||
void SD_SCK_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & SD_SCK_0_INTR) != 0u)
|
||||
{
|
||||
SD_SCK_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: SD_SCK_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet SD_SCK_SUT.c usage_SD_SCK_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 SD_SCK_ClearInterrupt(void)
|
||||
{
|
||||
return (SD_SCK_INTSTAT & SD_SCK_MASK) >> SD_SCK_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_SCK.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "SD_SCK_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
SD_SCK__PORT == 15 && ((SD_SCK__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void SD_SCK_Write(uint8 value) ;
|
||||
void SD_SCK_SetDriveMode(uint8 mode) ;
|
||||
uint8 SD_SCK_ReadDataReg(void) ;
|
||||
uint8 SD_SCK_Read(void) ;
|
||||
uint8 SD_SCK_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void SD_SCK_Write(uint8 value);
|
||||
void SD_SCK_SetDriveMode(uint8 mode);
|
||||
uint8 SD_SCK_ReadDataReg(void);
|
||||
uint8 SD_SCK_Read(void);
|
||||
void SD_SCK_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 SD_SCK_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define SD_SCK_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_SCK_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_SCK_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_SCK_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_SCK_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_SCK_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_SCK_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_SCK_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the SD_SCK_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_SCK_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define SD_SCK_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define SD_SCK_DM_RES_UP PIN_DM_RES_UP
|
||||
#define SD_SCK_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define SD_SCK_DM_OD_LO PIN_DM_OD_LO
|
||||
#define SD_SCK_DM_OD_HI PIN_DM_OD_HI
|
||||
#define SD_SCK_DM_STRONG PIN_DM_STRONG
|
||||
#define SD_SCK_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define SD_SCK_MASK SD_SCK__MASK
|
||||
#define SD_SCK_SHIFT SD_SCK__SHIFT
|
||||
#define SD_SCK_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(SD_SCK__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in SD_SCK_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define SD_SCK_INTR_NONE (uint16)(0x0000u)
|
||||
#define SD_SCK_INTR_RISING (uint16)(0x0001u)
|
||||
#define SD_SCK_INTR_FALLING (uint16)(0x0002u)
|
||||
#define SD_SCK_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define SD_SCK_INTR_MASK (0x01u)
|
||||
#endif /* (SD_SCK__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 SD_SCK_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define SD_SCK_PRTDSI__SYNC_OUT (* (reg8 *) SD_SCK__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(SD_SCK__SIO_CFG)
|
||||
#define SD_SCK_SIO_HYST_EN (* (reg8 *) SD_SCK__SIO_HYST_EN)
|
||||
#define SD_SCK_SIO_REG_HIFREQ (* (reg8 *) SD_SCK__SIO_REG_HIFREQ)
|
||||
#define SD_SCK_SIO_CFG (* (reg8 *) SD_SCK__SIO_CFG)
|
||||
#define SD_SCK_SIO_DIFF (* (reg8 *) SD_SCK__SIO_DIFF)
|
||||
#endif /* (SD_SCK__SIO_CFG) */
|
||||
|
||||
#if defined(SD_SCK__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define SD_SCK_INTSTAT (* (reg8 *) SD_SCK__INTSTAT)
|
||||
#define SD_SCK_SNAP (* (reg8 *) SD_SCK__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(SD_SCK__INTSTAT)
|
||||
#define SD_SCK_INTSTAT (* (reg8 *) SD_SCK__INTSTAT)
|
||||
#define SD_SCK_SNAP (* (reg8 *) SD_SCK__SNAP)
|
||||
|
||||
#define SD_SCK_0_INTTYPE_REG (* (reg8 *) SD_SCK__0__INTTYPE)
|
||||
#endif /* (SD_SCK__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_SCK_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: SD_SCK.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define SD_SCK_0 (SD_SCK__0__PC)
|
||||
#define SD_SCK_0 (SD_SCK__0__PC)
|
||||
#define SD_SCK_0_INTR ((uint16)((uint16)0x0001u << SD_SCK__0__SHIFT))
|
||||
|
||||
#define SD_SCK_INTR_ALL ((uint16)(SD_SCK_0_INTR))
|
||||
|
||||
#endif /* End Pins SD_SCK_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_TX_DMA_dma.c
Normal file → Executable file
0
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/SD_TX_DMA_dma.c
Normal file → Executable file
3119
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.c
Normal file → Executable file
3119
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
2180
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.h
Normal file → Executable file
2180
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.h
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dm.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_Write
|
||||
*******************************************************************************/
|
||||
void USBFS_Dm_Write(uint8 value)
|
||||
void USBFS_Dm_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (USBFS_Dm_DR & (uint8)(~USBFS_Dm_MASK));
|
||||
USBFS_Dm_DR = staticBits | ((uint8)(value << USBFS_Dm_SHIFT) & USBFS_Dm_MASK);
|
||||
@ -45,28 +63,31 @@ void USBFS_Dm_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* USBFS_Dm_DM_STRONG Strong Drive
|
||||
* USBFS_Dm_DM_OD_HI Open Drain, Drives High
|
||||
* USBFS_Dm_DM_OD_LO Open Drain, Drives Low
|
||||
* USBFS_Dm_DM_RES_UP Resistive Pull Up
|
||||
* USBFS_Dm_DM_RES_DWN Resistive Pull Down
|
||||
* USBFS_Dm_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* USBFS_Dm_DM_DIG_HIZ High Impedance Digital
|
||||
* USBFS_Dm_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void USBFS_Dm_SetDriveMode(uint8 mode)
|
||||
void USBFS_Dm_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(USBFS_Dm_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void USBFS_Dm_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro USBFS_Dm_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_Read
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dm_Read(void)
|
||||
uint8 USBFS_Dm_Read(void)
|
||||
{
|
||||
return (USBFS_Dm_PS & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 USBFS_Dm_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred USBFS_Dm_Read() API because the
|
||||
* USBFS_Dm_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dm_ReadDataReg(void)
|
||||
uint8 USBFS_Dm_ReadDataReg(void)
|
||||
{
|
||||
return (USBFS_Dm_DR & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(USBFS_Dm_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: USBFS_Dm_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use USBFS_Dm_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - USBFS_Dm_0_INTR (First pin in the list)
|
||||
* - USBFS_Dm_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - USBFS_Dm_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dm_ClearInterrupt(void)
|
||||
void USBFS_Dm_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & USBFS_Dm_0_INTR) != 0u)
|
||||
{
|
||||
USBFS_Dm_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dm_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dm_SUT.c usage_USBFS_Dm_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dm_ClearInterrupt(void)
|
||||
{
|
||||
return (USBFS_Dm_INTSTAT & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dm.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "USBFS_Dm_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
USBFS_Dm__PORT == 15 && ((USBFS_Dm__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void USBFS_Dm_Write(uint8 value) ;
|
||||
void USBFS_Dm_SetDriveMode(uint8 mode) ;
|
||||
uint8 USBFS_Dm_ReadDataReg(void) ;
|
||||
uint8 USBFS_Dm_Read(void) ;
|
||||
uint8 USBFS_Dm_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void USBFS_Dm_Write(uint8 value);
|
||||
void USBFS_Dm_SetDriveMode(uint8 mode);
|
||||
uint8 USBFS_Dm_ReadDataReg(void);
|
||||
uint8 USBFS_Dm_Read(void);
|
||||
void USBFS_Dm_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 USBFS_Dm_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define USBFS_Dm_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define USBFS_Dm_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define USBFS_Dm_DM_RES_UP PIN_DM_RES_UP
|
||||
#define USBFS_Dm_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define USBFS_Dm_DM_OD_LO PIN_DM_OD_LO
|
||||
#define USBFS_Dm_DM_OD_HI PIN_DM_OD_HI
|
||||
#define USBFS_Dm_DM_STRONG PIN_DM_STRONG
|
||||
#define USBFS_Dm_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the USBFS_Dm_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define USBFS_Dm_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define USBFS_Dm_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define USBFS_Dm_DM_RES_UP PIN_DM_RES_UP
|
||||
#define USBFS_Dm_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define USBFS_Dm_DM_OD_LO PIN_DM_OD_LO
|
||||
#define USBFS_Dm_DM_OD_HI PIN_DM_OD_HI
|
||||
#define USBFS_Dm_DM_STRONG PIN_DM_STRONG
|
||||
#define USBFS_Dm_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define USBFS_Dm_MASK USBFS_Dm__MASK
|
||||
#define USBFS_Dm_SHIFT USBFS_Dm__SHIFT
|
||||
#define USBFS_Dm_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(USBFS_Dm__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in USBFS_Dm_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define USBFS_Dm_INTR_NONE (uint16)(0x0000u)
|
||||
#define USBFS_Dm_INTR_RISING (uint16)(0x0001u)
|
||||
#define USBFS_Dm_INTR_FALLING (uint16)(0x0002u)
|
||||
#define USBFS_Dm_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define USBFS_Dm_INTR_MASK (0x01u)
|
||||
#endif /* (USBFS_Dm__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 USBFS_Dm_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define USBFS_Dm_PRTDSI__SYNC_OUT (* (reg8 *) USBFS_Dm__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(USBFS_Dm__SIO_CFG)
|
||||
#define USBFS_Dm_SIO_HYST_EN (* (reg8 *) USBFS_Dm__SIO_HYST_EN)
|
||||
#define USBFS_Dm_SIO_REG_HIFREQ (* (reg8 *) USBFS_Dm__SIO_REG_HIFREQ)
|
||||
#define USBFS_Dm_SIO_CFG (* (reg8 *) USBFS_Dm__SIO_CFG)
|
||||
#define USBFS_Dm_SIO_DIFF (* (reg8 *) USBFS_Dm__SIO_DIFF)
|
||||
#endif /* (USBFS_Dm__SIO_CFG) */
|
||||
|
||||
#if defined(USBFS_Dm__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define USBFS_Dm_INTSTAT (* (reg8 *) USBFS_Dm__INTSTAT)
|
||||
#define USBFS_Dm_SNAP (* (reg8 *) USBFS_Dm__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(USBFS_Dm__INTSTAT)
|
||||
#define USBFS_Dm_INTSTAT (* (reg8 *) USBFS_Dm__INTSTAT)
|
||||
#define USBFS_Dm_SNAP (* (reg8 *) USBFS_Dm__SNAP)
|
||||
|
||||
#define USBFS_Dm_0_INTTYPE_REG (* (reg8 *) USBFS_Dm__0__INTTYPE)
|
||||
#endif /* (USBFS_Dm__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dm.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define USBFS_Dm_0 (USBFS_Dm__0__PC)
|
||||
#define USBFS_Dm_0 (USBFS_Dm__0__PC)
|
||||
#define USBFS_Dm_0_INTR ((uint16)((uint16)0x0001u << USBFS_Dm__0__SHIFT))
|
||||
|
||||
#define USBFS_Dm_INTR_ALL ((uint16)(USBFS_Dm_0_INTR))
|
||||
|
||||
#endif /* End Pins USBFS_Dm_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.c
Normal file → Executable file
198
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.c
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dp.c
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file contains API to enable firmware control of a Pins component.
|
||||
@ -8,7 +8,7 @@
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -24,19 +24,37 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_Write
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Assign a new value to the digital port's data output register.
|
||||
* \brief Writes the value to the physical port (data output register), masking
|
||||
* and shifting the bits appropriately.
|
||||
*
|
||||
* Parameters:
|
||||
* prtValue: The value to be assigned to the Digital Port.
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This function avoids changing
|
||||
* other bits in the port by using the appropriate method (read-modify-write or
|
||||
* bit banding).
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* <b>Note</b> This function should not be used on a hardware digital output pin
|
||||
* as it is driven by the hardware signal attached to it.
|
||||
*
|
||||
* \param value
|
||||
* Value to write to the component instance.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic; the Interrupt
|
||||
* Service Routines (ISR) can cause corruption of this function. An ISR that
|
||||
* interrupts this function and performs writes to the Pins component data
|
||||
* register can cause corrupted port data. To avoid this issue, you should
|
||||
* either use the Per-Pin APIs (primary method) or disable interrupts around
|
||||
* this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_Write
|
||||
*******************************************************************************/
|
||||
void USBFS_Dp_Write(uint8 value)
|
||||
void USBFS_Dp_Write(uint8 value)
|
||||
{
|
||||
uint8 staticBits = (USBFS_Dp_DR & (uint8)(~USBFS_Dp_MASK));
|
||||
USBFS_Dp_DR = staticBits | ((uint8)(value << USBFS_Dp_SHIFT) & USBFS_Dp_MASK);
|
||||
@ -45,28 +63,31 @@ void USBFS_Dp_Write(uint8 value)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_SetDriveMode
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Change the drive mode on the pins of the port.
|
||||
* \brief Sets the drive mode for each of the Pins component's pins.
|
||||
*
|
||||
* Parameters:
|
||||
* mode: Change the pins to one of the following drive modes.
|
||||
* <b>Note</b> This affects all pins in the Pins component instance. Use the
|
||||
* Per-Pin APIs if you wish to control individual pin's drive modes.
|
||||
*
|
||||
* USBFS_Dp_DM_STRONG Strong Drive
|
||||
* USBFS_Dp_DM_OD_HI Open Drain, Drives High
|
||||
* USBFS_Dp_DM_OD_LO Open Drain, Drives Low
|
||||
* USBFS_Dp_DM_RES_UP Resistive Pull Up
|
||||
* USBFS_Dp_DM_RES_DWN Resistive Pull Down
|
||||
* USBFS_Dp_DM_RES_UPDWN Resistive Pull Up/Down
|
||||
* USBFS_Dp_DM_DIG_HIZ High Impedance Digital
|
||||
* USBFS_Dp_DM_ALG_HIZ High Impedance Analog
|
||||
* \param mode
|
||||
* Mode for the selected signals. Valid options are documented in
|
||||
* \ref driveMode.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* If you use read-modify-write operations that are not atomic, the ISR can
|
||||
* cause corruption of this function. An ISR that interrupts this function
|
||||
* and performs writes to the Pins component Drive Mode registers can cause
|
||||
* corrupted port data. To avoid this issue, you should either use the Per-Pin
|
||||
* APIs (primary method) or disable interrupts around this function.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_SetDriveMode
|
||||
*******************************************************************************/
|
||||
void USBFS_Dp_SetDriveMode(uint8 mode)
|
||||
void USBFS_Dp_SetDriveMode(uint8 mode)
|
||||
{
|
||||
CyPins_SetPinDriveMode(USBFS_Dp_0, mode);
|
||||
}
|
||||
@ -74,23 +95,22 @@ void USBFS_Dp_SetDriveMode(uint8 mode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_Read
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value on the pins of the Digital Port in right justified
|
||||
* form.
|
||||
* \brief Reads the associated physical port (pin status register) and masks
|
||||
* the required bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The pin's status register returns the current logic level present on the
|
||||
* physical pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value of the Digital Port as a right justified number
|
||||
*
|
||||
* Note:
|
||||
* Macro USBFS_Dp_ReadPS calls this function.
|
||||
*
|
||||
* \return
|
||||
* The current value for the pins in the component as a right justified number.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_Read
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dp_Read(void)
|
||||
uint8 USBFS_Dp_Read(void)
|
||||
{
|
||||
return (USBFS_Dp_PS & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT;
|
||||
}
|
||||
@ -98,42 +118,102 @@ uint8 USBFS_Dp_Read(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_ReadDataReg
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Read the current value assigned to a Digital Port's data output register
|
||||
* \brief Reads the associated physical port's data output register and masks
|
||||
* the correct bits according to the width and bit position of the component
|
||||
* instance.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* The data output register controls the signal applied to the physical pin in
|
||||
* conjunction with the drive mode parameter. This is not the same as the
|
||||
* preferred USBFS_Dp_Read() API because the
|
||||
* USBFS_Dp_ReadDataReg() reads the data register instead of the status
|
||||
* register. For output pins this is a useful function to determine the value
|
||||
* just written to the pin.
|
||||
*
|
||||
* Return:
|
||||
* Returns the current value assigned to the Digital Port's data output register
|
||||
*
|
||||
* \return
|
||||
* The current value of the data register masked and shifted into a right
|
||||
* justified number for the component instance.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_ReadDataReg
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dp_ReadDataReg(void)
|
||||
uint8 USBFS_Dp_ReadDataReg(void)
|
||||
{
|
||||
return (USBFS_Dp_DR & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
/* If Interrupts Are Enabled for this Pins component */
|
||||
/* If interrupt is connected for this Pins component */
|
||||
#if defined(USBFS_Dp_INTSTAT)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_ClearInterrupt
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
* Clears any active interrupts attached to port and returns the value of the
|
||||
* interrupt status register.
|
||||
* Function Name: USBFS_Dp_SetInterruptMode
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
* \brief Configures the interrupt mode for each of the Pins component's
|
||||
* pins. Alternatively you may set the interrupt mode for all the pins
|
||||
* specified in the Pins component.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value of the interrupt status register
|
||||
* <b>Note</b> The interrupt is port-wide and therefore any enabled pin
|
||||
* interrupt may trigger it.
|
||||
*
|
||||
* \param position
|
||||
* The pin position as listed in the Pins component. You may OR these to be
|
||||
* able to configure the interrupt mode of multiple pins within a Pins
|
||||
* component. Or you may use USBFS_Dp_INTR_ALL to configure the
|
||||
* interrupt mode of all the pins in the Pins component.
|
||||
* - USBFS_Dp_0_INTR (First pin in the list)
|
||||
* - USBFS_Dp_1_INTR (Second pin in the list)
|
||||
* - ...
|
||||
* - USBFS_Dp_INTR_ALL (All pins in Pins component)
|
||||
*
|
||||
* \param mode
|
||||
* Interrupt mode for the selected pins. Valid options are documented in
|
||||
* \ref intrMode.
|
||||
*
|
||||
* \return
|
||||
* None
|
||||
*
|
||||
* \sideeffect
|
||||
* It is recommended that the interrupt be disabled before calling this
|
||||
* function to avoid unintended interrupt requests. Note that the interrupt
|
||||
* type is port wide, and therefore will trigger for any enabled pin on the
|
||||
* port.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_SetInterruptMode
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dp_ClearInterrupt(void)
|
||||
void USBFS_Dp_SetInterruptMode(uint16 position, uint16 mode)
|
||||
{
|
||||
if((position & USBFS_Dp_0_INTR) != 0u)
|
||||
{
|
||||
USBFS_Dp_0_INTTYPE_REG = (uint8)mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_Dp_ClearInterrupt
|
||||
****************************************************************************//**
|
||||
*
|
||||
* \brief Clears any active interrupts attached with the component and returns
|
||||
* the value of the interrupt status register allowing determination of which
|
||||
* pins generated an interrupt event.
|
||||
*
|
||||
* \return
|
||||
* The right-shifted current value of the interrupt status register. Each pin
|
||||
* has one bit set if it generated an interrupt event. For example, bit 0 is
|
||||
* for pin 0 and bit 1 is for pin 1 of the Pins component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Clears all bits of the physical port's interrupt status register, not just
|
||||
* those associated with the Pins component.
|
||||
*
|
||||
* \funcusage
|
||||
* \snippet USBFS_Dp_SUT.c usage_USBFS_Dp_ClearInterrupt
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_Dp_ClearInterrupt(void)
|
||||
{
|
||||
return (USBFS_Dp_INTSTAT & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT;
|
||||
}
|
||||
|
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.h
Normal file → Executable file
99
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.h
Normal file → Executable file
@ -1,14 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dp.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains Pin function prototypes and register defines
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -22,12 +22,6 @@
|
||||
#include "cypins.h"
|
||||
#include "USBFS_Dp_aliases.h"
|
||||
|
||||
/* Check to see if required defines such as CY_PSOC5A are available */
|
||||
/* They are defined starting with cy_boot v3.0 */
|
||||
#if !defined (CY_PSOC5A)
|
||||
#error Component cy_pins_v2_10 requires cy_boot v3.0 or later
|
||||
#endif /* (CY_PSOC5A) */
|
||||
|
||||
/* APIs are not generated for P15[7:6] */
|
||||
#if !(CY_PSOC5A &&\
|
||||
USBFS_Dp__PORT == 15 && ((USBFS_Dp__MASK & 0xC0) != 0))
|
||||
@ -37,32 +31,65 @@
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void USBFS_Dp_Write(uint8 value) ;
|
||||
void USBFS_Dp_SetDriveMode(uint8 mode) ;
|
||||
uint8 USBFS_Dp_ReadDataReg(void) ;
|
||||
uint8 USBFS_Dp_Read(void) ;
|
||||
uint8 USBFS_Dp_ClearInterrupt(void) ;
|
||||
|
||||
/**
|
||||
* \addtogroup group_general
|
||||
* @{
|
||||
*/
|
||||
void USBFS_Dp_Write(uint8 value);
|
||||
void USBFS_Dp_SetDriveMode(uint8 mode);
|
||||
uint8 USBFS_Dp_ReadDataReg(void);
|
||||
uint8 USBFS_Dp_Read(void);
|
||||
void USBFS_Dp_SetInterruptMode(uint16 position, uint16 mode);
|
||||
uint8 USBFS_Dp_ClearInterrupt(void);
|
||||
/** @} general */
|
||||
|
||||
/***************************************
|
||||
* API Constants
|
||||
***************************************/
|
||||
|
||||
/* Drive Modes */
|
||||
#define USBFS_Dp_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define USBFS_Dp_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define USBFS_Dp_DM_RES_UP PIN_DM_RES_UP
|
||||
#define USBFS_Dp_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define USBFS_Dp_DM_OD_LO PIN_DM_OD_LO
|
||||
#define USBFS_Dp_DM_OD_HI PIN_DM_OD_HI
|
||||
#define USBFS_Dp_DM_STRONG PIN_DM_STRONG
|
||||
#define USBFS_Dp_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup driveMode Drive mode constants
|
||||
* \brief Constants to be passed as "mode" parameter in the USBFS_Dp_SetDriveMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define USBFS_Dp_DM_ALG_HIZ PIN_DM_ALG_HIZ
|
||||
#define USBFS_Dp_DM_DIG_HIZ PIN_DM_DIG_HIZ
|
||||
#define USBFS_Dp_DM_RES_UP PIN_DM_RES_UP
|
||||
#define USBFS_Dp_DM_RES_DWN PIN_DM_RES_DWN
|
||||
#define USBFS_Dp_DM_OD_LO PIN_DM_OD_LO
|
||||
#define USBFS_Dp_DM_OD_HI PIN_DM_OD_HI
|
||||
#define USBFS_Dp_DM_STRONG PIN_DM_STRONG
|
||||
#define USBFS_Dp_DM_RES_UPDWN PIN_DM_RES_UPDWN
|
||||
/** @} driveMode */
|
||||
/** @} group_constants */
|
||||
|
||||
/* Digital Port Constants */
|
||||
#define USBFS_Dp_MASK USBFS_Dp__MASK
|
||||
#define USBFS_Dp_SHIFT USBFS_Dp__SHIFT
|
||||
#define USBFS_Dp_WIDTH 1u
|
||||
|
||||
/* Interrupt constants */
|
||||
#if defined(USBFS_Dp__INTSTAT)
|
||||
/**
|
||||
* \addtogroup group_constants
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup intrMode Interrupt constants
|
||||
* \brief Constants to be passed as "mode" parameter in USBFS_Dp_SetInterruptMode() function.
|
||||
* @{
|
||||
*/
|
||||
#define USBFS_Dp_INTR_NONE (uint16)(0x0000u)
|
||||
#define USBFS_Dp_INTR_RISING (uint16)(0x0001u)
|
||||
#define USBFS_Dp_INTR_FALLING (uint16)(0x0002u)
|
||||
#define USBFS_Dp_INTR_BOTH (uint16)(0x0003u)
|
||||
/** @} intrMode */
|
||||
/** @} group_constants */
|
||||
|
||||
#define USBFS_Dp_INTR_MASK (0x01u)
|
||||
#endif /* (USBFS_Dp__INTSTAT) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Registers
|
||||
@ -114,13 +141,21 @@ uint8 USBFS_Dp_ClearInterrupt(void) ;
|
||||
/* Sync Output Enable Registers */
|
||||
#define USBFS_Dp_PRTDSI__SYNC_OUT (* (reg8 *) USBFS_Dp__PRTDSI__SYNC_OUT)
|
||||
|
||||
/* SIO registers */
|
||||
#if defined(USBFS_Dp__SIO_CFG)
|
||||
#define USBFS_Dp_SIO_HYST_EN (* (reg8 *) USBFS_Dp__SIO_HYST_EN)
|
||||
#define USBFS_Dp_SIO_REG_HIFREQ (* (reg8 *) USBFS_Dp__SIO_REG_HIFREQ)
|
||||
#define USBFS_Dp_SIO_CFG (* (reg8 *) USBFS_Dp__SIO_CFG)
|
||||
#define USBFS_Dp_SIO_DIFF (* (reg8 *) USBFS_Dp__SIO_DIFF)
|
||||
#endif /* (USBFS_Dp__SIO_CFG) */
|
||||
|
||||
#if defined(USBFS_Dp__INTSTAT) /* Interrupt Registers */
|
||||
|
||||
#define USBFS_Dp_INTSTAT (* (reg8 *) USBFS_Dp__INTSTAT)
|
||||
#define USBFS_Dp_SNAP (* (reg8 *) USBFS_Dp__SNAP)
|
||||
|
||||
#endif /* Interrupt Registers */
|
||||
/* Interrupt Registers */
|
||||
#if defined(USBFS_Dp__INTSTAT)
|
||||
#define USBFS_Dp_INTSTAT (* (reg8 *) USBFS_Dp__INTSTAT)
|
||||
#define USBFS_Dp_SNAP (* (reg8 *) USBFS_Dp__SNAP)
|
||||
|
||||
#define USBFS_Dp_0_INTTYPE_REG (* (reg8 *) USBFS_Dp__0__INTTYPE)
|
||||
#endif /* (USBFS_Dp__INTSTAT) */
|
||||
|
||||
#endif /* CY_PSOC5A... */
|
||||
|
||||
|
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp_aliases.h
Normal file → Executable file
14
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp_aliases.h
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_Dp.h
|
||||
* Version 2.10
|
||||
* Version 2.20
|
||||
*
|
||||
* Description:
|
||||
* This file containts Control Register function prototypes and register defines
|
||||
* This file contains the Alias definitions for Per-Pin APIs in cypins.h.
|
||||
* Information on using these APIs can be found in the System Reference Guide.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* Copyright 2008-2015, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -21,12 +22,15 @@
|
||||
#include "cyfitter.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
#define USBFS_Dp_0 (USBFS_Dp__0__PC)
|
||||
#define USBFS_Dp_0 (USBFS_Dp__0__PC)
|
||||
#define USBFS_Dp_0_INTR ((uint16)((uint16)0x0001u << USBFS_Dp__0__SHIFT))
|
||||
|
||||
#define USBFS_Dp_INTR_ALL ((uint16)(USBFS_Dp_0_INTR))
|
||||
|
||||
#endif /* End Pins USBFS_Dp_ALIASES_H */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
@ -1,32 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_audio.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_audio.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* USB AUDIO Class request handler.
|
||||
* \brief
|
||||
* This file contains the USB AUDIO Class request handler.
|
||||
*
|
||||
* Related Document:
|
||||
* Universal Serial Bus Device Class Definition for Audio Devices Release 1.0
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
#include "USBFS_audio.h"
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
|
||||
#if defined(USBFS_ENABLE_AUDIO_CLASS)
|
||||
|
||||
#include "USBFS_audio.h"
|
||||
#include "USBFS_pvt.h"
|
||||
#if defined(USBFS_ENABLE_MIDI_STREAMING)
|
||||
#include "USBFS_midi.h"
|
||||
#endif /* USBFS_ENABLE_MIDI_STREAMING*/
|
||||
|
||||
|
||||
/***************************************
|
||||
* Custom Declarations
|
||||
***************************************/
|
||||
@ -38,15 +33,24 @@
|
||||
|
||||
#if !defined(USER_SUPPLIED_AUDIO_HANDLER)
|
||||
|
||||
|
||||
/***************************************
|
||||
* AUDIO Variables
|
||||
***************************************/
|
||||
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
/** Contains the current audio sample frequency. It is set by the host using a SET_CUR request to the endpoint.*/
|
||||
volatile uint8 USBFS_currentSampleFrequency[USBFS_MAX_EP][USBFS_SAMPLE_FREQ_LEN];
|
||||
/** Used as a flag for the user code, to inform it that the host has been sent a request
|
||||
* to change the sample frequency. The sample frequency will be sent on the next OUT transaction.
|
||||
* It contains the endpoint address when set. The following code is recommended for
|
||||
* detecting new sample frequency in main code:
|
||||
* \snippet /USBFS_sut_02.cydsn/main.c Detecting new Sample Frequency
|
||||
*
|
||||
* The USBFS_transferState variable is checked to make sure that the transfer completes. */
|
||||
volatile uint8 USBFS_frequencyChanged;
|
||||
/** Contains the mute configuration set by the host.*/
|
||||
volatile uint8 USBFS_currentMute;
|
||||
/** Contains the volume level set by the host.*/
|
||||
volatile uint8 USBFS_currentVolume[USBFS_VOLUME_LEN];
|
||||
volatile uint8 USBFS_minimumVolume[USBFS_VOLUME_LEN] = {USBFS_VOL_MIN_LSB,
|
||||
USBFS_VOL_MIN_MSB};
|
||||
@ -59,18 +63,16 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_DispatchAUDIOClassRqst
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine dispatches class requests
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
* \return
|
||||
* Results of Audio Class request handling:
|
||||
* - USBFS_TRUE - request was handled without errors
|
||||
* - USBFS_FALSE - error occurs during handling of request
|
||||
*
|
||||
* Return:
|
||||
* requestHandled
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_currentSampleFrequency: Contains the current audio Sample
|
||||
* Frequency. It is set by the Host using SET_CUR request to the endpoint.
|
||||
* USBFS_frequencyChanged: This variable is used as a flag for the
|
||||
@ -78,99 +80,103 @@
|
||||
* Sample Frequency. Sample frequency will be sent on the next OUT
|
||||
* transaction. It is contains endpoint address when set. The following
|
||||
* code is recommended for detecting new Sample Frequency in main code:
|
||||
* if((USBFS_frequencyChanged != 0) &&
|
||||
* (USBFS_transferState == USBFS_TRANS_STATE_IDLE))
|
||||
* {
|
||||
* USBFS_frequencyChanged = 0;
|
||||
* }
|
||||
* USBFS_transferState variable is checked to be sure that
|
||||
* transfer completes.
|
||||
*
|
||||
* \snippet /USBFS_sut_02.cydsn/main.c Detecting new Sample Frequency
|
||||
*
|
||||
* USBFS_transferState variable is checked to be sure that transfer
|
||||
* completes.
|
||||
* USBFS_currentMute: Contains mute configuration set by Host.
|
||||
* USBFS_currentVolume: Contains volume level set by Host.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_DispatchAUDIOClassRqst(void)
|
||||
{
|
||||
uint8 requestHandled = USBFS_FALSE;
|
||||
uint8 bmRequestType = CY_GET_REG8(USBFS_bmRequestType);
|
||||
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
uint8 epNumber;
|
||||
epNumber = CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED;
|
||||
#endif /* USBFS_ENABLE_AUDIO_STREAMING */
|
||||
|
||||
|
||||
if ((bmRequestType & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H)
|
||||
|
||||
uint8 RqstRcpt = (uint8)(USBFS_bmRequestTypeReg & USBFS_RQST_RCPT_MASK);
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
uint8 wValueHi = (uint8) USBFS_wValueHiReg;
|
||||
uint8 epNumber = (uint8) USBFS_wIndexLoReg & USBFS_DIR_UNUSED;
|
||||
#endif /* (USBFS_ENABLE_AUDIO_STREAMING) */
|
||||
|
||||
/* Check request direction: D2H or H2D. */
|
||||
if (0u != (USBFS_bmRequestTypeReg & USBFS_RQST_DIR_D2H))
|
||||
{
|
||||
/* Control Read */
|
||||
if((bmRequestType & USBFS_RQST_RCPT_MASK) == USBFS_RQST_RCPT_EP)
|
||||
/* Handle direction from device to host. */
|
||||
|
||||
if (USBFS_RQST_RCPT_EP == RqstRcpt)
|
||||
{
|
||||
/* Endpoint */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
/* Request recipient is to endpoint. */
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_GET_CUR:
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_SAMPLING_FREQ_CONTROL)
|
||||
if (wValueHi == USBFS_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
/* point Control Selector is Sampling Frequency */
|
||||
USBFS_currentTD.wCount = USBFS_SAMPLE_FREQ_LEN;
|
||||
USBFS_currentTD.pData = USBFS_currentSampleFrequency[epNumber];
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
#endif /* USBFS_ENABLE_AUDIO_STREAMING */
|
||||
|
||||
/* `#START AUDIO_READ_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#END` */
|
||||
#endif /* (USBFS_ENABLE_AUDIO_STREAMING) */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_AUDIO_READ_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_AUDIO_READ_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_AUDIO_READ_REQUESTS_CALLBACK */
|
||||
/* `#START AUDIO_READ_REQUESTS` Place other request handler here */
|
||||
|
||||
break;
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_AUDIO_READ_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_AUDIO_READ_REQUESTS_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_AUDIO_READ_REQUESTS_CALLBACK) */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Do not handle this request unless callback is defined. */
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if((bmRequestType & USBFS_RQST_RCPT_MASK) == USBFS_RQST_RCPT_IFC)
|
||||
else if (USBFS_RQST_RCPT_IFC == RqstRcpt)
|
||||
{
|
||||
/* Interface or Entity ID */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
/* Request recipient is interface or entity ID. */
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_GET_CUR:
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_MUTE_CONTROL)
|
||||
if (wValueHi == USBFS_MUTE_CONTROL)
|
||||
{
|
||||
/* `#START MUTE_CONTROL_GET_REQUEST` Place multi-channel handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_MUTE_CONTROL_GET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_MUTE_CONTROL_GET_REQUEST_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_MUTE_CONTROL_GET_REQUEST_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_MUTE_CONTROL_GET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_MUTE_CONTROL_GET_REQUEST_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_MUTE_CONTROL_GET_REQUEST_CALLBACK) */
|
||||
|
||||
/* Entity ID Control Selector is MUTE */
|
||||
USBFS_currentTD.wCount = 1u;
|
||||
USBFS_currentTD.pData = &USBFS_currentMute;
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
else if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL)
|
||||
else if (wValueHi == USBFS_VOLUME_CONTROL)
|
||||
{
|
||||
/* `#START VOLUME_CONTROL_GET_REQUEST` Place multi-channel handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_GET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_VOLUME_CONTROL_GET_REQUEST_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_GET_REQUEST_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_GET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_VOLUME_CONTROL_GET_REQUEST_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_GET_REQUEST_CALLBACK) */
|
||||
|
||||
/* Entity ID Control Selector is VOLUME, */
|
||||
USBFS_currentTD.wCount = USBFS_VOLUME_LEN;
|
||||
USBFS_currentTD.pData = USBFS_currentVolume;
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -178,134 +184,149 @@ uint8 USBFS_DispatchAUDIOClassRqst(void)
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_OTHER_GET_CUR_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_OTHER_GET_CUR_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_OTHER_GET_CUR_REQUESTS_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_OTHER_GET_CUR_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_OTHER_GET_CUR_REQUESTS_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_OTHER_GET_CUR_REQUESTS_CALLBACK) */
|
||||
}
|
||||
break;
|
||||
case USBFS_GET_MIN: /* GET_MIN */
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL)
|
||||
|
||||
case USBFS_GET_MIN:
|
||||
if (wValueHi == USBFS_VOLUME_CONTROL)
|
||||
{
|
||||
/* Entity ID Control Selector is VOLUME, */
|
||||
USBFS_currentTD.wCount = USBFS_VOLUME_LEN;
|
||||
USBFS_currentTD.pData = &USBFS_minimumVolume[0];
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
break;
|
||||
case USBFS_GET_MAX: /* GET_MAX */
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL)
|
||||
|
||||
case USBFS_GET_MAX:
|
||||
if (wValueHi == USBFS_VOLUME_CONTROL)
|
||||
{
|
||||
/* Entity ID Control Selector is VOLUME, */
|
||||
USBFS_currentTD.wCount = USBFS_VOLUME_LEN;
|
||||
USBFS_currentTD.pData = &USBFS_maximumVolume[0];
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
break;
|
||||
case USBFS_GET_RES: /* GET_RES */
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL)
|
||||
|
||||
case USBFS_GET_RES:
|
||||
if (wValueHi == USBFS_VOLUME_CONTROL)
|
||||
{
|
||||
/* Entity ID Control Selector is VOLUME, */
|
||||
USBFS_currentTD.wCount = USBFS_VOLUME_LEN;
|
||||
USBFS_currentTD.pData = &USBFS_resolutionVolume[0];
|
||||
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
break;
|
||||
|
||||
/* The contents of the status message is reserved for future use.
|
||||
* For the time being, a null packet should be returned in the data stage of the
|
||||
* control transfer, and the received null packet should be ACKed.
|
||||
* For the time being, a null packet should be returned in the data stage of the
|
||||
* control transfer, and the received null packet should be ACKed.
|
||||
*/
|
||||
case USBFS_GET_STAT:
|
||||
USBFS_currentTD.wCount = 0u;
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
USBFS_currentTD.wCount = 0u;
|
||||
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
|
||||
#endif /* USBFS_ENABLE_AUDIO_STREAMING */
|
||||
|
||||
/* `#START AUDIO_WRITE_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#END` */
|
||||
#endif /* (USBFS_ENABLE_AUDIO_STREAMING) */
|
||||
|
||||
/* `#START AUDIO_WRITE_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_AUDIO_WRITE_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_AUDIO_WRITE_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_AUDIO_WRITE_REQUESTS_CALLBACK */
|
||||
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_AUDIO_WRITE_REQUESTS_CALLBACK) */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Do not handle this request. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* USBFS_RQST_RCPT_OTHER */
|
||||
{
|
||||
/* Do not handle other requests recipients. */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Control Write */
|
||||
if((bmRequestType & USBFS_RQST_RCPT_MASK) == USBFS_RQST_RCPT_EP)
|
||||
/* Handle direction from host to device. */
|
||||
|
||||
if (USBFS_RQST_RCPT_EP == RqstRcpt)
|
||||
{
|
||||
/* point */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
/* Request recipient is endpoint. */
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_SET_CUR:
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_SAMPLING_FREQ_CONTROL)
|
||||
if (wValueHi == USBFS_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
/* point Control Selector is Sampling Frequency */
|
||||
USBFS_currentTD.wCount = USBFS_SAMPLE_FREQ_LEN;
|
||||
USBFS_currentTD.pData = USBFS_currentSampleFrequency[epNumber];
|
||||
USBFS_frequencyChanged = (uint8) epNumber;
|
||||
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
USBFS_frequencyChanged = epNumber;
|
||||
}
|
||||
#endif /* USBFS_ENABLE_AUDIO_STREAMING */
|
||||
#endif /* (USBFS_ENABLE_AUDIO_STREAMING) */
|
||||
|
||||
/* `#START AUDIO_SAMPLING_FREQ_REQUESTS` Place other request handler here */
|
||||
/* `#START AUDIO_SAMPLING_FREQ_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#END` */
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_AUDIO_SAMPLING_FREQ_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_AUDIO_SAMPLING_FREQ_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_AUDIO_SAMPLING_FREQ_REQUESTS_CALLBACK */
|
||||
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_AUDIO_SAMPLING_FREQ_REQUESTS_CALLBACK) */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Do not handle this request. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if((bmRequestType & USBFS_RQST_RCPT_MASK) == USBFS_RQST_RCPT_IFC)
|
||||
else if(USBFS_RQST_RCPT_IFC == RqstRcpt)
|
||||
{
|
||||
/* Interface or Entity ID */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
/* Request recipient is interface or entity ID. */
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_SET_CUR:
|
||||
#if defined(USBFS_ENABLE_AUDIO_STREAMING)
|
||||
if(CY_GET_REG8(USBFS_wValueHi) == USBFS_MUTE_CONTROL)
|
||||
if (wValueHi == USBFS_MUTE_CONTROL)
|
||||
{
|
||||
/* `#START MUTE_SET_REQUEST` Place multi-channel handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_MUTE_SET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_MUTE_SET_REQUEST_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_MUTE_SET_REQUEST_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_MUTE_SET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_MUTE_SET_REQUEST_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_MUTE_SET_REQUEST_CALLBACK) */
|
||||
|
||||
/* Entity ID Control Selector is MUTE */
|
||||
USBFS_currentTD.wCount = 1u;
|
||||
USBFS_currentTD.pData = &USBFS_currentMute;
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
}
|
||||
else if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL)
|
||||
else if (wValueHi == USBFS_VOLUME_CONTROL)
|
||||
{
|
||||
/* `#START VOLUME_CONTROL_SET_REQUEST` Place multi-channel handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_SET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_VOLUME_CONTROL_SET_REQUEST_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_SET_REQUEST_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_SET_REQUEST_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_VOLUME_CONTROL_SET_REQUEST_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_VOLUME_CONTROL_SET_REQUEST_CALLBACK) */
|
||||
|
||||
/* Entity ID Control Selector is VOLUME */
|
||||
USBFS_currentTD.wCount = USBFS_VOLUME_LEN;
|
||||
USBFS_currentTD.pData = USBFS_currentVolume;
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -313,35 +334,36 @@ uint8 USBFS_DispatchAUDIOClassRqst(void)
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_OTHER_SET_CUR_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_OTHER_SET_CUR_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_OTHER_SET_CUR_REQUESTS_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_OTHER_SET_CUR_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_OTHER_SET_CUR_REQUESTS_Callback();
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_OTHER_SET_CUR_REQUESTS_CALLBACK) */
|
||||
}
|
||||
#endif /* USBFS_ENABLE_AUDIO_STREAMING */
|
||||
|
||||
|
||||
/* `#START AUDIO_CONTROL_SEL_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#START AUDIO_CONTROL_SEL_REQUESTS` Place other request handler here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_AUDIO_CLASS_AUDIO_CONTROL_SEL_REQUESTS_CALLBACK
|
||||
USBFS_DispatchAUDIOClass_AUDIO_CONTROL_SEL_REQUESTS_Callback();
|
||||
#endif /* USBFS_DISPATCH_AUDIO_CLASS_AUDIO_CONTROL_SEL_REQUESTS_CALLBACK */
|
||||
#endif /* (USBFS_DISPATCH_AUDIO_CLASS_AUDIO_CONTROL_SEL_REQUESTS_CALLBACK) */
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
/* Do not handle this request. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* USBFS_RQST_RCPT_OTHER */
|
||||
/* Do not handle other requests recipients. */
|
||||
}
|
||||
}
|
||||
|
||||
return(requestHandled);
|
||||
return (requestHandled);
|
||||
}
|
||||
|
||||
#endif /* USER_SUPPLIED_AUDIO_HANDLER */
|
||||
#endif /* (USER_SUPPLIED_AUDIO_HANDLER) */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -352,7 +374,7 @@ uint8 USBFS_DispatchAUDIOClassRqst(void)
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#endif /* USBFS_ENABLE_AUDIO_CLASS */
|
||||
#endif /* (USBFS_ENABLE_AUDIO_CLASS) */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
26
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.h
Normal file → Executable file
26
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.h
Normal file → Executable file
@ -1,15 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_audio.h
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_audio.h
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Header File for the USBFS component. Contains prototypes and constant values.
|
||||
* \brief
|
||||
* This file provides function prototypes and constants for the USBFS component
|
||||
* Audio class.
|
||||
*
|
||||
* Related Document:
|
||||
* Universal Serial Bus Device Class Definition for Audio Devices Release 1.0
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -18,7 +20,7 @@
|
||||
#if !defined(CY_USBFS_USBFS_audio_H)
|
||||
#define CY_USBFS_USBFS_audio_H
|
||||
|
||||
#include "cytypes.h"
|
||||
#include "USBFS.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
@ -82,12 +84,16 @@
|
||||
/***************************************
|
||||
* External data references
|
||||
***************************************/
|
||||
|
||||
extern volatile uint8 USBFS_currentSampleFrequency[USBFS_MAX_EP]
|
||||
[USBFS_SAMPLE_FREQ_LEN];
|
||||
/**
|
||||
* \addtogroup group_audio
|
||||
* @{
|
||||
*/
|
||||
extern volatile uint8 USBFS_currentSampleFrequency[USBFS_MAX_EP][USBFS_SAMPLE_FREQ_LEN];
|
||||
extern volatile uint8 USBFS_frequencyChanged;
|
||||
extern volatile uint8 USBFS_currentMute;
|
||||
extern volatile uint8 USBFS_currentVolume[USBFS_VOLUME_LEN];
|
||||
/** @} audio */
|
||||
|
||||
extern volatile uint8 USBFS_minimumVolume[USBFS_VOLUME_LEN];
|
||||
extern volatile uint8 USBFS_maximumVolume[USBFS_VOLUME_LEN];
|
||||
extern volatile uint8 USBFS_resolutionVolume[USBFS_VOLUME_LEN];
|
||||
|
173
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_boot.c
Normal file → Executable file
173
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_boot.c
Normal file → Executable file
@ -1,76 +1,67 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_boot.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_boot.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Boot loader API for USBFS Component.
|
||||
*
|
||||
* Note:
|
||||
* \brief
|
||||
* This file contains the Bootloader API for USBFS Component.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
#if defined(CYDEV_BOOTLOADER_IO_COMP) && ((CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS) || \
|
||||
(CYDEV_BOOTLOADER_IO_COMP == CyBtldr_Custom_Interface))
|
||||
|
||||
(CYDEV_BOOTLOADER_IO_COMP == CyBtldr_Custom_Interface))
|
||||
|
||||
/***************************************
|
||||
* Bootloader Variables
|
||||
***************************************/
|
||||
|
||||
|
||||
static uint8 USBFS_started = 0u;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyBtldrCommStart
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Starts the component and enables the interrupt.
|
||||
* This function performs all required initialization for the USBFS component,
|
||||
* waits on enumeration, and enables communication.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Side Effects:
|
||||
* \sideeffect
|
||||
* This function starts the USB with 3V or 5V operation.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_CyBtldrCommStart(void)
|
||||
{
|
||||
CyGlobalIntEnable; /* Enable Global Interrupts */
|
||||
/* Enable Global Interrupts. Interrupts are mandatory for USBFS component operation. */
|
||||
CyGlobalIntEnable;
|
||||
|
||||
/*Start USBFS Operation/device 0 and with 5V or 3V operation depend on Voltage Configuration in DWR */
|
||||
USBFS_Start(0u, USBFS_DWR_VDDD_OPERATION);
|
||||
/* Start USBFS Operation: device 0 and with 5V or 3V operation depend on Voltage Configuration in DWR. */
|
||||
USBFS_Start(0u, USBFS_DWR_POWER_OPERATION);
|
||||
|
||||
/* USB component started, the correct enumeration will be checked in first Read operation */
|
||||
/* USB component started, the correct enumeration will be checked in the first Read operation. */
|
||||
USBFS_started = 1u;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyBtldrCommStop.
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Disable the component and disable the interrupt.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
* This function performs all necessary shutdown tasks required for the USBFS
|
||||
* component.
|
||||
*
|
||||
* \sideeffect
|
||||
* Calls the USBFS_Stop() function.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_CyBtldrCommStop(void)
|
||||
@ -81,47 +72,40 @@ void USBFS_CyBtldrCommStop(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyBtldrCommReset.
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Resets the receive and transmit communication Buffers.
|
||||
* This function resets receive and transmit communication buffers.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_CyBtldrCommReset(void)
|
||||
{
|
||||
USBFS_EnableOutEP(USBFS_BTLDR_OUT_EP); /* Enable the OUT endpoint */
|
||||
USBFS_EnableOutEP(USBFS_BTLDR_OUT_EP);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyBtldrCommWrite.
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Allows the caller to write data to the boot loader host. The function will
|
||||
* handle polling to allow a block of data to be completely sent to the host
|
||||
* This function allows the caller to write data to the bootloader host. It
|
||||
* handles polling to allow a block of data to be completely sent to the host
|
||||
* device.
|
||||
*
|
||||
* Parameters:
|
||||
* pData: A pointer to the block of data to send to the device
|
||||
* size: The number of bytes to write.
|
||||
* count: Pointer to an unsigned short variable to write the number of
|
||||
* bytes actually written.
|
||||
* timeOut: Number of units to wait before returning because of a timeout.
|
||||
* \param pData A pointer to the block of data to send to the device
|
||||
* \param size The number of bytes to write.
|
||||
* \param count Pointer to an unsigned short variable to write the number of
|
||||
* bytes actually written.
|
||||
* \param timeOut Number of units to wait before returning because of a timeout.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value that best describes the problem.
|
||||
* \return
|
||||
* Returns CYRET_SUCCESS if no problem was encountered or returns the value that
|
||||
* best describes the problem. For more information, see the “Return Codes”
|
||||
* section of the System Reference Guide.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -131,12 +115,13 @@ cystatus USBFS_CyBtldrCommWrite(const uint8 pData[], uint16 size, uint16 *count,
|
||||
cystatus retCode;
|
||||
uint16 timeoutMs;
|
||||
|
||||
timeoutMs = ((uint16) 10u * timeOut); /* Convert from 10mS check to number 1mS checks */
|
||||
/* Convert 10mS checks into 1mS checks. */
|
||||
timeoutMs = ((uint16) 10u * timeOut);
|
||||
|
||||
/* Enable IN transfer */
|
||||
/* Load data into IN endpoint to be read by host. */
|
||||
USBFS_LoadInEP(USBFS_BTLDR_IN_EP, pData, USBFS_BTLDR_SIZEOF_READ_BUFFER);
|
||||
|
||||
/* Wait for the master to read it. */
|
||||
/* Wait unitl host reads data from IN endpoint. */
|
||||
while ((USBFS_GetEPState(USBFS_BTLDR_IN_EP) == USBFS_IN_BUFFER_FULL) &&
|
||||
(0u != timeoutMs))
|
||||
{
|
||||
@ -154,32 +139,32 @@ cystatus USBFS_CyBtldrCommWrite(const uint8 pData[], uint16 size, uint16 *count,
|
||||
retCode = CYRET_SUCCESS;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
return (retCode);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyBtldrCommRead.
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Allows the caller to read data from the boot loader host. The function will
|
||||
* handle polling to allow a block of data to be completely received from the
|
||||
* This function allows the caller to read data from the bootloader host. It
|
||||
* handles polling to allow a block of data to be completely received from the
|
||||
* host device.
|
||||
*
|
||||
* Parameters:
|
||||
* pData: A pointer to the area to store the block of data received
|
||||
* from the device.
|
||||
* size: The number of bytes to read.
|
||||
* count: Pointer to an unsigned short variable to write the number
|
||||
* of bytes actually read.
|
||||
* timeOut: Number of units to wait before returning because of a timeOut.
|
||||
* Timeout is measured in 10s of ms.
|
||||
* \param pData A pointer to the area to store the block of data received
|
||||
* from the device.
|
||||
* \param size The number of bytes to read.
|
||||
* \param count Pointer to an unsigned short variable to write the number
|
||||
* of bytes actually read.
|
||||
* \param timeOut Number of units to wait before returning because of a timeOut.
|
||||
* Timeout is measured in 10s of ms.
|
||||
*
|
||||
* Return:
|
||||
* Returns the value that best describes the problem.
|
||||
* \return
|
||||
* Returns CYRET_SUCCESS if no problem was encountered or returns the value that
|
||||
* best describes the problem. For more information, see the “Return Codes”
|
||||
* section of the System Reference Guide.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -189,36 +174,38 @@ cystatus USBFS_CyBtldrCommRead(uint8 pData[], uint16 size, uint16 *count, uint8
|
||||
cystatus retCode;
|
||||
uint16 timeoutMs;
|
||||
|
||||
timeoutMs = ((uint16) 10u * timeOut); /* Convert from 10mS check to number 1mS checks */
|
||||
/* Convert 10mS checks into 1mS checks. */
|
||||
timeoutMs = ((uint16) 10u * timeOut);
|
||||
|
||||
if (size > USBFS_BTLDR_SIZEOF_WRITE_BUFFER)
|
||||
{
|
||||
size = USBFS_BTLDR_SIZEOF_WRITE_BUFFER;
|
||||
}
|
||||
|
||||
/* Wait on enumeration in first time */
|
||||
/* Wait for enumeration first time. */
|
||||
if (0u != USBFS_started)
|
||||
{
|
||||
/* Wait for Device to enumerate */
|
||||
while ((0u ==USBFS_GetConfiguration()) && (0u != timeoutMs))
|
||||
/* Wait for device enumeration. */
|
||||
while ((0u == USBFS_GetConfiguration()) && (0u != timeoutMs))
|
||||
{
|
||||
CyDelay(USBFS_BTLDR_WAIT_1_MS);
|
||||
timeoutMs--;
|
||||
}
|
||||
|
||||
/* Enable first OUT, if enumeration complete */
|
||||
/* Enable OUT after enumeration. */
|
||||
if (0u != USBFS_GetConfiguration())
|
||||
{
|
||||
(void) USBFS_IsConfigurationChanged(); /* Clear configuration changes state status */
|
||||
(void) USBFS_IsConfigurationChanged(); /* Clear configuration changes state status. */
|
||||
USBFS_CyBtldrCommReset();
|
||||
|
||||
USBFS_started = 0u;
|
||||
}
|
||||
}
|
||||
else /* Check for configuration changes, has been done by Host */
|
||||
else /* Check for configuration changes, has been done by Host. */
|
||||
{
|
||||
if (0u != USBFS_IsConfigurationChanged()) /* Host could send double SET_INTERFACE request or RESET */
|
||||
if (0u != USBFS_IsConfigurationChanged()) /* Host could send double SET_INTERFACE request or RESET. */
|
||||
{
|
||||
if (0u != USBFS_GetConfiguration()) /* Init OUT endpoints when device reconfigured */
|
||||
if (0u != USBFS_GetConfiguration()) /* Init OUT endpoints when device reconfigured. */
|
||||
{
|
||||
USBFS_CyBtldrCommReset();
|
||||
}
|
||||
@ -227,15 +214,15 @@ cystatus USBFS_CyBtldrCommRead(uint8 pData[], uint16 size, uint16 *count, uint8
|
||||
|
||||
timeoutMs = ((uint16) 10u * timeOut); /* Re-arm timeout */
|
||||
|
||||
/* Wait on next packet */
|
||||
while((USBFS_GetEPState(USBFS_BTLDR_OUT_EP) != USBFS_OUT_BUFFER_FULL) && \
|
||||
(0u != timeoutMs))
|
||||
/* Wait unitl host writes data into OUT endpoint. */
|
||||
while ((USBFS_GetEPState(USBFS_BTLDR_OUT_EP) != USBFS_OUT_BUFFER_FULL) && \
|
||||
(0u != timeoutMs))
|
||||
{
|
||||
CyDelay(USBFS_BTLDR_WAIT_1_MS);
|
||||
timeoutMs--;
|
||||
}
|
||||
|
||||
/* OUT EP has completed */
|
||||
/* Read data from OUT endpoint if host wrote data into it. */
|
||||
if (USBFS_GetEPState(USBFS_BTLDR_OUT_EP) == USBFS_OUT_BUFFER_FULL)
|
||||
{
|
||||
*count = USBFS_ReadOutEP(USBFS_BTLDR_OUT_EP, pData, size);
|
||||
@ -247,10 +234,10 @@ cystatus USBFS_CyBtldrCommRead(uint8 pData[], uint16 size, uint16 *count, uint8
|
||||
retCode = CYRET_TIMEOUT;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
return (retCode);
|
||||
}
|
||||
|
||||
#endif /* CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS */
|
||||
#endif /* (CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS) */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
File diff suppressed because it is too large
Load Diff
118
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.h
Normal file → Executable file
118
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.h
Normal file → Executable file
@ -1,16 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_cdc.h
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_cdc.h
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Header File for the USBFS component.
|
||||
* Contains CDC class prototypes and constant values.
|
||||
* \brief
|
||||
* This file provides function prototypes and constants for the USBFS component
|
||||
* CDC class.
|
||||
*
|
||||
* Related Document:
|
||||
* Universal Serial Bus Class Definitions for Communication Devices Version 1.1
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2012-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2012-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -19,43 +20,55 @@
|
||||
#if !defined(CY_USBFS_USBFS_cdc_H)
|
||||
#define CY_USBFS_USBFS_cdc_H
|
||||
|
||||
#include "cytypes.h"
|
||||
#include "USBFS.h"
|
||||
|
||||
|
||||
/***************************************
|
||||
/*******************************************************************************
|
||||
* Prototypes of the USBFS_cdc API.
|
||||
***************************************/
|
||||
|
||||
*******************************************************************************/
|
||||
/**
|
||||
* \addtogroup group_cdc
|
||||
* @{
|
||||
*/
|
||||
#if (USBFS_ENABLE_CDC_CLASS_API != 0u)
|
||||
void USBFS_CDC_Init(void) ;
|
||||
uint8 USBFS_CDC_Init(void) ;
|
||||
void USBFS_PutData(const uint8* pData, uint16 length) ;
|
||||
void USBFS_PutString(const char8 string[]) ;
|
||||
void USBFS_PutString(const char8 string[]) ;
|
||||
void USBFS_PutChar(char8 txDataByte) ;
|
||||
void USBFS_PutCRLF(void) ;
|
||||
uint16 USBFS_GetCount(void) ;
|
||||
uint8 USBFS_CDCIsReady(void) ;
|
||||
uint8 USBFS_DataIsReady(void) ;
|
||||
uint16 USBFS_GetData(uint8* pData, uint16 length) ;
|
||||
uint16 USBFS_GetAll(uint8* pData) ;
|
||||
uint8 USBFS_GetChar(void) ;
|
||||
uint8 USBFS_IsLineChanged(void) ;
|
||||
uint32 USBFS_GetDTERate(void) ;
|
||||
uint8 USBFS_GetCharFormat(void) ;
|
||||
uint8 USBFS_GetParityType(void) ;
|
||||
uint8 USBFS_GetDataBits(void) ;
|
||||
uint16 USBFS_GetLineControl(void) ;
|
||||
#endif /* USBFS_ENABLE_CDC_CLASS_API */
|
||||
void USBFS_PutCRLF(void) ;
|
||||
uint16 USBFS_GetCount(void) ;
|
||||
uint8 USBFS_CDCIsReady(void) ;
|
||||
uint8 USBFS_DataIsReady(void) ;
|
||||
uint16 USBFS_GetData(uint8* pData, uint16 length) ;
|
||||
uint16 USBFS_GetAll(uint8* pData) ;
|
||||
uint8 USBFS_GetChar(void) ;
|
||||
uint8 USBFS_IsLineChanged(void) ;
|
||||
uint32 USBFS_GetDTERate(void) ;
|
||||
uint8 USBFS_GetCharFormat(void) ;
|
||||
uint8 USBFS_GetParityType(void) ;
|
||||
uint8 USBFS_GetDataBits(void) ;
|
||||
uint16 USBFS_GetLineControl(void) ;
|
||||
void USBFS_SendSerialState (uint16 serialState) ;
|
||||
uint16 USBFS_GetSerialState (void) ;
|
||||
void USBFS_SetComPort (uint8 comNumber) ;
|
||||
uint8 USBFS_GetComPort (void) ;
|
||||
uint8 USBFS_NotificationIsReady(void) ;
|
||||
|
||||
#endif /* (USBFS_ENABLE_CDC_CLASS_API) */
|
||||
/** @} cdc */
|
||||
|
||||
/***************************************
|
||||
/*******************************************************************************
|
||||
* Constants for USBFS_cdc API.
|
||||
***************************************/
|
||||
*******************************************************************************/
|
||||
|
||||
/* CDC Class-Specific Request Codes (CDC ver 1.2 Table 19) */
|
||||
#define USBFS_CDC_SET_LINE_CODING (0x20u)
|
||||
#define USBFS_CDC_GET_LINE_CODING (0x21u)
|
||||
#define USBFS_CDC_SET_CONTROL_LINE_STATE (0x22u)
|
||||
|
||||
/*PSTN Subclass Specific Notifications (CDC ver 1.2 Table 30)*/
|
||||
#define USBFS_SERIAL_STATE (0x20u)
|
||||
|
||||
#define USBFS_LINE_CODING_CHANGED (0x01u)
|
||||
#define USBFS_LINE_CONTROL_CHANGED (0x02u)
|
||||
|
||||
@ -78,18 +91,49 @@
|
||||
#define USBFS_LINE_CONTROL_DTR (0x01u)
|
||||
#define USBFS_LINE_CONTROL_RTS (0x02u)
|
||||
|
||||
#define USBFS_MAX_MULTI_COM_NUM (2u)
|
||||
|
||||
/***************************************
|
||||
#define USBFS_COM_PORT1 (0u)
|
||||
#define USBFS_COM_PORT2 (1u)
|
||||
|
||||
#define USBFS_SUCCESS (0u)
|
||||
#define USBFS_FAILURE (1u)
|
||||
|
||||
#define USBFS_SERIAL_STATE_SIZE (10u)
|
||||
|
||||
/* SerialState constants*/
|
||||
#define USBFS_SERIAL_STATE_REQUEST_TYPE (0xA1u)
|
||||
#define USBFS_SERIAL_STATE_LENGTH (0x2u)
|
||||
|
||||
/*******************************************************************************
|
||||
* External data references
|
||||
***************************************/
|
||||
*******************************************************************************/
|
||||
/**
|
||||
* \addtogroup group_cdc
|
||||
* @{
|
||||
*/
|
||||
extern volatile uint8 USBFS_linesCoding[USBFS_MAX_MULTI_COM_NUM][USBFS_LINE_CODING_SIZE];
|
||||
extern volatile uint8 USBFS_linesChanged[USBFS_MAX_MULTI_COM_NUM];
|
||||
extern volatile uint16 USBFS_linesControlBitmap[USBFS_MAX_MULTI_COM_NUM];
|
||||
extern volatile uint16 USBFS_serialStateBitmap[USBFS_MAX_MULTI_COM_NUM];
|
||||
extern volatile uint8 USBFS_cdcDataInEp[USBFS_MAX_MULTI_COM_NUM];
|
||||
extern volatile uint8 USBFS_cdcDataOutEp[USBFS_MAX_MULTI_COM_NUM];
|
||||
extern volatile uint8 USBFS_cdcCommInInterruptEp[USBFS_MAX_MULTI_COM_NUM];
|
||||
/** @} cdc */
|
||||
|
||||
extern volatile uint8 USBFS_lineCoding[USBFS_LINE_CODING_SIZE];
|
||||
extern volatile uint8 USBFS_lineChanged;
|
||||
extern volatile uint16 USBFS_lineControlBitmap;
|
||||
extern volatile uint8 USBFS_cdc_data_in_ep;
|
||||
extern volatile uint8 USBFS_cdc_data_out_ep;
|
||||
/*******************************************************************************
|
||||
* The following code is DEPRECATED and
|
||||
* must not be used.
|
||||
*******************************************************************************/
|
||||
|
||||
#endif /* CY_USBFS_USBFS_cdc_H */
|
||||
|
||||
#define USBFS_lineCoding USBFS_linesCoding[0]
|
||||
#define USBFS_lineChanged USBFS_linesChanged[0]
|
||||
#define USBFS_lineControlBitmap USBFS_linesControlBitmap[0]
|
||||
#define USBFS_cdc_data_in_ep USBFS_cdcDataInEp[0]
|
||||
#define USBFS_cdc_data_out_ep USBFS_cdcDataOutEp[0]
|
||||
|
||||
#endif /* (CY_USBFS_USBFS_cdc_H) */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
19
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.inf
Normal file → Executable file
19
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.inf
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
;******************************************************************************
|
||||
; File Name: USBFS_cdc.inf
|
||||
; Version 2.80
|
||||
; Version 3.10
|
||||
;
|
||||
; Description:
|
||||
; Windows USB CDC setup file for USBUART Device.
|
||||
;
|
||||
;******************************************************************************
|
||||
; Copyright 2007-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; Copyright 2007-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
; You may use this file only in accordance with the license, terms, conditions,
|
||||
; disclaimers, and limitations in the end user license agreement accompanying
|
||||
; the software package with which this file was provided.
|
||||
@ -32,12 +32,27 @@ DefaultDestDir=12
|
||||
|
||||
[DeviceList.NTx86]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_01
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_02
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_03
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_04
|
||||
|
||||
[DeviceList.NTia64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_01
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_02
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_03
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_04
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_01
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_02
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_03
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232&MI_04
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -1,26 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_cls.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_cls.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* USB Class request handler.
|
||||
*
|
||||
* Note:
|
||||
* \brief
|
||||
* This file contains the USB Class request handler.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
|
||||
#if(USBFS_EXTERN_CLS == USBFS_FALSE)
|
||||
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
|
||||
#if(USBFS_EXTERN_CLS == USBFS_FALSE)
|
||||
|
||||
/***************************************
|
||||
* User Implemented Class Driver Declarations.
|
||||
@ -32,69 +28,110 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_DispatchClassRqst
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* This routine dispatches class specific requests depend on interface class.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* requestHandled.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_DispatchClassRqst(void)
|
||||
{
|
||||
uint8 requestHandled = USBFS_FALSE;
|
||||
uint8 interfaceNumber = 0u;
|
||||
uint8 requestHandled;
|
||||
uint8 interfaceNumber;
|
||||
|
||||
switch(CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK)
|
||||
/* Get interface to which request is intended. */
|
||||
switch (USBFS_bmRequestTypeReg & USBFS_RQST_RCPT_MASK)
|
||||
{
|
||||
case USBFS_RQST_RCPT_IFC: /* Class-specific request directed to an interface */
|
||||
interfaceNumber = CY_GET_REG8(USBFS_wIndexLo); /* wIndexLo contain Interface number */
|
||||
case USBFS_RQST_RCPT_IFC:
|
||||
/* Class-specific request directed to interface: wIndexLoReg
|
||||
* contains interface number.
|
||||
*/
|
||||
interfaceNumber = (uint8) USBFS_wIndexLoReg;
|
||||
break;
|
||||
case USBFS_RQST_RCPT_EP: /* Class-specific request directed to the endpoint */
|
||||
/* Find related interface to the endpoint, wIndexLo contain EP number */
|
||||
interfaceNumber = USBFS_EP[CY_GET_REG8(USBFS_wIndexLo) &
|
||||
USBFS_DIR_UNUSED].interface;
|
||||
|
||||
case USBFS_RQST_RCPT_EP:
|
||||
/* Class-specific request directed to endpoint: wIndexLoReg contains
|
||||
* endpoint number. Find interface related to endpoint,
|
||||
*/
|
||||
interfaceNumber = USBFS_EP[USBFS_wIndexLoReg & USBFS_DIR_UNUSED].interface;
|
||||
break;
|
||||
default: /* RequestHandled is initialized as FALSE by default */
|
||||
|
||||
default:
|
||||
/* Default interface is zero. */
|
||||
interfaceNumber = 0u;
|
||||
break;
|
||||
}
|
||||
/* Handle Class request depend on interface type */
|
||||
switch(USBFS_interfaceClass[interfaceNumber])
|
||||
|
||||
#if (defined(USBFS_ENABLE_HID_CLASS) ||\
|
||||
defined(USBFS_ENABLE_AUDIO_CLASS) ||\
|
||||
defined(USBFS_ENABLE_CDC_CLASS) ||\
|
||||
USBFS_ENABLE_MSC_CLASS)
|
||||
|
||||
/* Handle class request depends on interface type. */
|
||||
switch (USBFS_interfaceClass[interfaceNumber])
|
||||
{
|
||||
#if defined(USBFS_ENABLE_HID_CLASS)
|
||||
case USBFS_CLASS_HID:
|
||||
#if defined(USBFS_ENABLE_HID_CLASS)
|
||||
requestHandled = USBFS_DispatchHIDClassRqst();
|
||||
#endif /* USBFS_ENABLE_HID_CLASS */
|
||||
requestHandled = USBFS_DispatchHIDClassRqst();
|
||||
break;
|
||||
#endif /* (USBFS_ENABLE_HID_CLASS) */
|
||||
|
||||
#if defined(USBFS_ENABLE_AUDIO_CLASS)
|
||||
case USBFS_CLASS_AUDIO:
|
||||
#if defined(USBFS_ENABLE_AUDIO_CLASS)
|
||||
requestHandled = USBFS_DispatchAUDIOClassRqst();
|
||||
#endif /* USBFS_CLASS_AUDIO */
|
||||
requestHandled = USBFS_DispatchAUDIOClassRqst();
|
||||
break;
|
||||
#endif /* (USBFS_CLASS_AUDIO) */
|
||||
|
||||
#if defined(USBFS_ENABLE_CDC_CLASS)
|
||||
case USBFS_CLASS_CDC:
|
||||
#if defined(USBFS_ENABLE_CDC_CLASS)
|
||||
requestHandled = USBFS_DispatchCDCClassRqst();
|
||||
#endif /* USBFS_ENABLE_CDC_CLASS */
|
||||
requestHandled = USBFS_DispatchCDCClassRqst();
|
||||
break;
|
||||
default: /* requestHandled is initialized as FALSE by default */
|
||||
#endif /* (USBFS_ENABLE_CDC_CLASS) */
|
||||
|
||||
#if (USBFS_ENABLE_MSC_CLASS)
|
||||
case USBFS_CLASS_MSD:
|
||||
#if (USBFS_HANDLE_MSC_REQUESTS)
|
||||
/* MSC requests are handled by the component. */
|
||||
requestHandled = USBFS_DispatchMSCClassRqst();
|
||||
#elif defined(USBFS_DISPATCH_MSC_CLASS_RQST_CALLBACK)
|
||||
/* MSC requests are handled by user defined callbcak. */
|
||||
requestHandled = USBFS_DispatchMSCClassRqst_Callback();
|
||||
#else
|
||||
/* MSC requests are not handled. */
|
||||
requestHandled = USBFS_FALSE;
|
||||
#endif /* (USBFS_HANDLE_MSC_REQUESTS) */
|
||||
break;
|
||||
#endif /* (USBFS_ENABLE_MSC_CLASS) */
|
||||
|
||||
default:
|
||||
/* Request is not handled: unknown class request type. */
|
||||
requestHandled = USBFS_FALSE;
|
||||
break;
|
||||
}
|
||||
#else /*No class is defined*/
|
||||
if (0u != interfaceNumber)
|
||||
{
|
||||
/* Suppress warning message */
|
||||
}
|
||||
requestHandled = USBFS_FALSE;
|
||||
#endif /*HID or AUDIO or MSC or CDC class enabled*/
|
||||
|
||||
/* `#START USER_DEFINED_CLASS_CODE` Place your Class request here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_DISPATCH_CLASS_RQST_CALLBACK
|
||||
USBFS_DispatchClassRqst_Callback();
|
||||
#endif /* USBFS_DISPATCH_CLASS_RQST_CALLBACK */
|
||||
#ifdef USBFS_DISPATCH_CLASS_RQST_CALLBACK
|
||||
if (USBFS_FALSE == requestHandled)
|
||||
{
|
||||
requestHandled = USBFS_DispatchClassRqst_Callback(interfaceNumber);
|
||||
}
|
||||
#endif /* (USBFS_DISPATCH_CLASS_RQST_CALLBACK) */
|
||||
|
||||
return(requestHandled);
|
||||
return (requestHandled);
|
||||
}
|
||||
|
||||
|
||||
|
278
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cydmac.h
Executable file
278
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cydmac.h
Executable file
@ -0,0 +1,278 @@
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_cydmac.h
|
||||
* \version 3.10
|
||||
*
|
||||
* \brief
|
||||
* This file provides macros implemenation of DMA_P4 functions.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#if !defined(CY_USBFS_USBFS_cydmac_H)
|
||||
#define CY_USBFS_USBFS_cydmac_H
|
||||
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaSetConfiguration
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Sets configuration information for the specified descriptor.
|
||||
*
|
||||
* \param ch: DMA ch modified by this function.
|
||||
* \param descr: Descriptor (0 or 1) modified by this function.
|
||||
* \param cfg: Descriptor control register.
|
||||
*
|
||||
* \sideeffect
|
||||
* The status register associated with the specified descriptor is reset to
|
||||
* zero after this function call. This function should not be called while
|
||||
* the descriptor is active. This can be checked by calling CyDmaGetStatus().
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetConfiguration(ch, descr, cfg) \
|
||||
do{ \
|
||||
CYDMA_DESCR_BASE.descriptor[ch][descr].ctl = (cfg); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaSetInterruptMask
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Enables the DMA channel interrupt.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetInterruptMask(ch) \
|
||||
do{ \
|
||||
CYDMA_INTR_MASK_REG |= ((uint32)(1UL << (ch))); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name:USBFS_CyDmaSetDescriptor0Next
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Sets the descriptor 0 that should be run the next time the channel is
|
||||
* triggered.
|
||||
*
|
||||
* \param channel: Channel used by this function.
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetDescriptor0Next(ch) \
|
||||
do{ \
|
||||
CYDMA_CH_CTL_BASE.ctl[(ch)] &= (uint32) ~CYDMA_DESCRIPTOR; \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaSetNumDataElements
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Sets the number of data elements to transfer for specified descriptor.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Descriptor (0 or 1) modified by this function.
|
||||
* \param numEl: Total number of data elements this descriptor transfers - 1u.
|
||||
* Valid ranges are 0 to 65535.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* This function should not be called when the specified descriptor is active
|
||||
* in the DMA transfer engine. This can be checked by calling CyDmaGetStatus().
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetNumDataElements(ch, descr, numEl) \
|
||||
do{ \
|
||||
CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].ctl = \
|
||||
((CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].ctl & (uint32) ~CYDMA_DATA_NR) | ((uint32) (numEl))); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaGetSrcAddress
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Returns the source address for the specified descriptor.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Specifies descriptor (0 or 1) used by this function.
|
||||
*
|
||||
* \return
|
||||
* Source address written to specified descriptor.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaGetSrcAddress(ch, descr) CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].src
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaSetSrcAddress
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Configures the source address for the specified descriptor.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Descriptor (0 or 1) modified by this function.
|
||||
* \param srcAddress: Address of DMA transfer source.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* This function should not be called when the specified descriptor is active
|
||||
* in the DMA transfer engine. This can be checked by calling CyDmaGetStatus().
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetSrcAddress(ch, descr, srcAddress) \
|
||||
do{ \
|
||||
CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].src = (srcAddress); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaGetDstAddress
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Returns the destination address for the specified descriptor, set by
|
||||
* CyDmaSetDstAddress().
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Specifies descriptor (0 or 1) used by this function.
|
||||
*
|
||||
* \return
|
||||
* Destination address written to specified descriptor.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaGetDstAddress(ch, descr) CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].dst
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaSetDstAddress
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Configures the destination address for the specified descriptor.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Descriptor (0 or 1) modified by this function.
|
||||
* \param dstAddress: Address of DMA transfer destination.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* This function should not be called when the specified descriptor is active
|
||||
* in the DMA transfer engine. This can be checked by calling CyDmaGetStatus().
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaSetDstAddress(ch, descr, dstAddress) \
|
||||
do{ \
|
||||
CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].dst = (dstAddress); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaValidateDescriptor
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Validates the specified descriptor after it has been invalidated.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
* \param descr: Descriptor (0 or 1) modified by this function.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* The status register associated with the specified descriptor is reset to
|
||||
* zero after this function call.
|
||||
* This function should not be called when the specified descriptor is active
|
||||
* in the DMA transfer engine. This can be checked by calling CyDmaGetStatus().
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaValidateDescriptor(ch, descr) \
|
||||
do{ \
|
||||
CYDMA_DESCR_BASE.descriptor[(ch)][(descr)].status = CYDMA_VALID; \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaChEnable
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Enables the DMA ch.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* If this function is called before DMA is completely configured the operation
|
||||
* of the DMA is undefined and could result in system data corruption.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaChEnable(ch) \
|
||||
do{ \
|
||||
CYDMA_CH_CTL_BASE.ctl[(ch)] |= CYDMA_ENABLED; \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: CyDmaChDisable
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Disables the DMA ch.
|
||||
*
|
||||
* \param ch: Channel used by this function.
|
||||
*
|
||||
*
|
||||
* \sideeffect
|
||||
* If this function is called during a DMA transfer the transfer is aborted.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_CyDmaChDisable(ch) \
|
||||
do{ \
|
||||
CYDMA_CH_CTL_BASE.ctl[(ch)] &= (uint32) ~CYDMA_ENABLED; \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaTriggerIn
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Triggers the DMA channel to execute a transfer. The tr_in signal is
|
||||
* triggered.
|
||||
*
|
||||
* \param trSel: trigger to be activated.
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_DMA_USB_REQ_TR_OUT (0xC0020100U)
|
||||
#define USBFS_CyDmaTriggerIn(trSel) \
|
||||
do{ \
|
||||
CYDMA_TR_CTL_REG = USBFS_DMA_USB_REQ_TR_OUT | (uint32)(trSel); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_CyDmaTriggerOut
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Triggers the DMA channel to generate a transfer completion signal without
|
||||
* actual transfer executed. The tr_out signal is triggered.
|
||||
*
|
||||
* \param trSel: trigger to be activated.
|
||||
*
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define USBFS_DMA_USB_BURST_END_TR_OUT (0xC0020300U)
|
||||
#define USBFS_CyDmaTriggerOut(trSel) \
|
||||
do{ \
|
||||
CYDMA_TR_CTL_REG = USBFS_DMA_USB_BURST_END_TR_OUT | (uint32)(trSel); \
|
||||
}while(0)
|
||||
|
||||
|
||||
#endif /* (CY_USBFS_USBFS_cydmac_H) */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
19
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_descr.c
Normal file → Executable file
19
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_descr.c
Normal file → Executable file
@ -1,20 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_descr.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_descr.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* USB descriptors and storage.
|
||||
*
|
||||
* Note:
|
||||
* \brief
|
||||
* This file contains the USB descriptors and storage.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
|
||||
@ -384,8 +382,9 @@ const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_TABLE[5u] = {
|
||||
* Device Dispatch Table -- Points to the Device Descriptor and each of
|
||||
* and Configuration Tables for this Device
|
||||
*********************************************************************/
|
||||
const T_USBFS_LUT CYCODE USBFS_DEVICE0_TABLE[2u] = {
|
||||
const T_USBFS_LUT CYCODE USBFS_DEVICE0_TABLE[3u] = {
|
||||
{0x01u, &USBFS_DEVICE0_DESCR},
|
||||
{0x00u, NULL},
|
||||
{0x01u, &USBFS_DEVICE0_CONFIGURATION0_TABLE}
|
||||
};
|
||||
/*********************************************************************
|
||||
|
@ -1,20 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_drv.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_drv.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Endpoint 0 Driver for the USBFS Component.
|
||||
*
|
||||
* Note:
|
||||
* \brief
|
||||
* This file contains the Endpoint 0 Driver for the USBFS Component.
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
|
||||
@ -24,15 +22,42 @@
|
||||
***************************************/
|
||||
|
||||
volatile T_USBFS_EP_CTL_BLOCK USBFS_EP[USBFS_MAX_EP];
|
||||
|
||||
/** Contains the current configuration number, which is set by the host using a
|
||||
* SET_CONFIGURATION request. This variable is initialized to zero in
|
||||
* USBFS_InitComponent() API and can be read by the USBFS_GetConfiguration()
|
||||
* API.*/
|
||||
volatile uint8 USBFS_configuration;
|
||||
|
||||
/** Contains the current interface number.*/
|
||||
volatile uint8 USBFS_interfaceNumber;
|
||||
|
||||
/** This variable is set to one after SET_CONFIGURATION and SET_INTERFACE
|
||||
*requests. It can be read by the USBFS_IsConfigurationChanged() API */
|
||||
volatile uint8 USBFS_configurationChanged;
|
||||
|
||||
/** Contains the current device address.*/
|
||||
volatile uint8 USBFS_deviceAddress;
|
||||
|
||||
/** This is a two-bit variable that contains power status in the bit 0
|
||||
* (DEVICE_STATUS_BUS_POWERED or DEVICE_STATUS_SELF_POWERED) and remote wakeup
|
||||
* status (DEVICE_STATUS_REMOTE_WAKEUP) in the bit 1. This variable is
|
||||
* initialized to zero in USBFS_InitComponent() API, configured by the
|
||||
* USBFS_SetPowerStatus() API. The remote wakeup status cannot be set using the
|
||||
* API SetPowerStatus(). */
|
||||
volatile uint8 USBFS_deviceStatus;
|
||||
|
||||
volatile uint8 USBFS_interfaceSetting[USBFS_MAX_INTERFACES_NUMBER];
|
||||
volatile uint8 USBFS_interfaceSetting_last[USBFS_MAX_INTERFACES_NUMBER];
|
||||
volatile uint8 USBFS_interfaceStatus[USBFS_MAX_INTERFACES_NUMBER];
|
||||
|
||||
/** Contains the started device number. This variable is set by the
|
||||
* USBFS_Start() or USBFS_InitComponent() APIs.*/
|
||||
volatile uint8 USBFS_device;
|
||||
|
||||
/** Initialized class array for each interface. It is used for handling Class
|
||||
* specific requests depend on interface class. Different classes in multiple
|
||||
* alternate settings are not supported.*/
|
||||
const uint8 CYCODE *USBFS_interfaceClass;
|
||||
|
||||
|
||||
@ -40,64 +65,68 @@ const uint8 CYCODE *USBFS_interfaceClass;
|
||||
* Local data allocation
|
||||
***************************************/
|
||||
|
||||
volatile uint8 USBFS_ep0Toggle;
|
||||
volatile uint8 USBFS_lastPacketSize;
|
||||
volatile uint8 USBFS_transferState;
|
||||
volatile uint8 USBFS_ep0Toggle;
|
||||
volatile uint8 USBFS_lastPacketSize;
|
||||
|
||||
/** This variable is used by the communication functions to handle the current
|
||||
* transfer state.
|
||||
* Initialized to TRANS_STATE_IDLE in the USBFS_InitComponent() API and after a
|
||||
* complete transfer in the status stage.
|
||||
* Changed to the TRANS_STATE_CONTROL_READ or TRANS_STATE_CONTROL_WRITE in setup
|
||||
* transaction depending on the request type.
|
||||
*/
|
||||
volatile uint8 USBFS_transferState;
|
||||
volatile T_USBFS_TD USBFS_currentTD;
|
||||
volatile uint8 USBFS_ep0Mode;
|
||||
volatile uint8 USBFS_ep0Count;
|
||||
volatile uint8 USBFS_ep0Mode;
|
||||
volatile uint8 USBFS_ep0Count;
|
||||
volatile uint16 USBFS_transferByteCount;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_ep_0_Interrupt
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This Interrupt Service Routine handles Endpoint 0 (Control Pipe) traffic.
|
||||
* It dispatches setup requests and handles the data and status stages.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
*******************************************************************************/
|
||||
CY_ISR(USBFS_EP_0_ISR)
|
||||
{
|
||||
uint8 bRegTemp;
|
||||
uint8 tempReg;
|
||||
uint8 modifyReg;
|
||||
|
||||
#ifdef USBFS_EP_0_ISR_ENTRY_CALLBACK
|
||||
USBFS_EP_0_ISR_EntryCallback();
|
||||
#endif /* USBFS_EP_0_ISR_ENTRY_CALLBACK */
|
||||
#ifdef USBFS_EP_0_ISR_ENTRY_CALLBACK
|
||||
USBFS_EP_0_ISR_EntryCallback();
|
||||
#endif /* (USBFS_EP_0_ISR_ENTRY_CALLBACK) */
|
||||
|
||||
bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR);
|
||||
if ((bRegTemp & USBFS_MODE_ACKD) != 0u)
|
||||
tempReg = USBFS_EP0_CR_REG;
|
||||
if ((tempReg & USBFS_MODE_ACKD) != 0u)
|
||||
{
|
||||
modifyReg = 1u;
|
||||
if ((bRegTemp & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
if ((tempReg & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
{
|
||||
if((bRegTemp & USBFS_MODE_MASK) != USBFS_MODE_NAK_IN_OUT)
|
||||
if ((tempReg & USBFS_MODE_MASK) != USBFS_MODE_NAK_IN_OUT)
|
||||
{
|
||||
modifyReg = 0u; /* When mode not NAK_IN_OUT => invalid setup */
|
||||
/* Mode not equal to NAK_IN_OUT: invalid setup */
|
||||
modifyReg = 0u;
|
||||
}
|
||||
else
|
||||
{
|
||||
USBFS_HandleSetup();
|
||||
if((USBFS_ep0Mode & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
|
||||
if ((USBFS_ep0Mode & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
{
|
||||
modifyReg = 0u; /* if SETUP bit set -> exit without modifying the mode */
|
||||
/* SETUP bit set: exit without mode modificaiton */
|
||||
modifyReg = 0u;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if ((bRegTemp & USBFS_MODE_IN_RCVD) != 0u)
|
||||
else if ((tempReg & USBFS_MODE_IN_RCVD) != 0u)
|
||||
{
|
||||
USBFS_HandleIN();
|
||||
}
|
||||
else if ((bRegTemp & USBFS_MODE_OUT_RCVD) != 0u)
|
||||
else if ((tempReg & USBFS_MODE_OUT_RCVD) != 0u)
|
||||
{
|
||||
USBFS_HandleOUT();
|
||||
}
|
||||
@ -105,87 +134,109 @@ CY_ISR(USBFS_EP_0_ISR)
|
||||
{
|
||||
modifyReg = 0u;
|
||||
}
|
||||
if(modifyReg != 0u)
|
||||
|
||||
/* Modify the EP0_CR register */
|
||||
if (modifyReg != 0u)
|
||||
{
|
||||
bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR); /* unlock registers */
|
||||
if((bRegTemp & USBFS_MODE_SETUP_RCVD) == 0u) /* Check if SETUP bit is not set, otherwise exit */
|
||||
|
||||
tempReg = USBFS_EP0_CR_REG;
|
||||
|
||||
/* Make sure that SETUP bit is cleared before modification */
|
||||
if ((tempReg & USBFS_MODE_SETUP_RCVD) == 0u)
|
||||
{
|
||||
/* Update the count register */
|
||||
bRegTemp = USBFS_ep0Toggle | USBFS_ep0Count;
|
||||
CY_SET_REG8(USBFS_EP0_CNT_PTR, bRegTemp);
|
||||
if(bRegTemp == CY_GET_REG8(USBFS_EP0_CNT_PTR)) /* continue if writing was successful */
|
||||
/* Update count register */
|
||||
tempReg = (uint8) USBFS_ep0Toggle | USBFS_ep0Count;
|
||||
USBFS_EP0_CNT_REG = tempReg;
|
||||
|
||||
/* Make sure that previous write operaiton was successful */
|
||||
if (tempReg == USBFS_EP0_CNT_REG)
|
||||
{
|
||||
/* Repeat until next successful write operation */
|
||||
do
|
||||
{
|
||||
modifyReg = USBFS_ep0Mode; /* Init temporary variable */
|
||||
/* Unlock registers */
|
||||
bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR) & USBFS_MODE_SETUP_RCVD;
|
||||
if(bRegTemp == 0u) /* Check if SETUP bit is not set */
|
||||
/* Init temporary variable */
|
||||
modifyReg = USBFS_ep0Mode;
|
||||
|
||||
/* Unlock register */
|
||||
tempReg = (uint8) (USBFS_EP0_CR_REG & USBFS_MODE_SETUP_RCVD);
|
||||
|
||||
/* Check if SETUP bit is not set */
|
||||
if (0u == tempReg)
|
||||
{
|
||||
/* Set the Mode Register */
|
||||
CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_ep0Mode);
|
||||
USBFS_EP0_CR_REG = USBFS_ep0Mode;
|
||||
|
||||
/* Writing check */
|
||||
modifyReg = CY_GET_REG8(USBFS_EP0_CR_PTR) & USBFS_MODE_MASK;
|
||||
modifyReg = USBFS_EP0_CR_REG & USBFS_MODE_MASK;
|
||||
}
|
||||
}while(modifyReg != USBFS_ep0Mode); /* Repeat if writing was not successful */
|
||||
}
|
||||
while (modifyReg != USBFS_ep0Mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef USBFS_EP_0_ISR_EXIT_CALLBACK
|
||||
USBFS_EP_0_ISR_ExitCallback();
|
||||
#endif /* USBFS_EP_0_ISR_EXIT_CALLBACK */
|
||||
|
||||
USBFS_ClearSieInterruptSource(USBFS_INTR_SIE_EP0_INTR);
|
||||
|
||||
#ifdef USBFS_EP_0_ISR_EXIT_CALLBACK
|
||||
USBFS_EP_0_ISR_ExitCallback();
|
||||
#endif /* (USBFS_EP_0_ISR_EXIT_CALLBACK) */
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_HandleSetup
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This Routine dispatches requests for the four USB request types
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_HandleSetup(void)
|
||||
{
|
||||
uint8 requestHandled;
|
||||
|
||||
/* Clear register lock by SIE (read register) and clear setup bit
|
||||
* (write any value in register).
|
||||
*/
|
||||
requestHandled = (uint8) USBFS_EP0_CR_REG;
|
||||
USBFS_EP0_CR_REG = (uint8) requestHandled;
|
||||
requestHandled = (uint8) USBFS_EP0_CR_REG;
|
||||
|
||||
requestHandled = CY_GET_REG8(USBFS_EP0_CR_PTR); /* unlock registers */
|
||||
CY_SET_REG8(USBFS_EP0_CR_PTR, requestHandled); /* clear setup bit */
|
||||
requestHandled = CY_GET_REG8(USBFS_EP0_CR_PTR); /* reread register */
|
||||
if((requestHandled & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
if ((requestHandled & USBFS_MODE_SETUP_RCVD) != 0u)
|
||||
{
|
||||
USBFS_ep0Mode = requestHandled; /* if SETUP bit set -> exit without modifying the mode */
|
||||
/* SETUP bit is set: exit without mode modification. */
|
||||
USBFS_ep0Mode = requestHandled;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In case the previous transfer did not complete, close it out */
|
||||
USBFS_UpdateStatusBlock(USBFS_XFER_PREMATURE);
|
||||
|
||||
switch (CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_TYPE_MASK)
|
||||
/* Check request type. */
|
||||
switch (USBFS_bmRequestTypeReg & USBFS_RQST_TYPE_MASK)
|
||||
{
|
||||
case USBFS_RQST_TYPE_STD:
|
||||
requestHandled = USBFS_HandleStandardRqst();
|
||||
break;
|
||||
|
||||
case USBFS_RQST_TYPE_CLS:
|
||||
requestHandled = USBFS_DispatchClassRqst();
|
||||
break;
|
||||
|
||||
case USBFS_RQST_TYPE_VND:
|
||||
requestHandled = USBFS_HandleVendorRqst();
|
||||
break;
|
||||
|
||||
default:
|
||||
requestHandled = USBFS_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If request is not recognized. Stall endpoint 0 IN and OUT. */
|
||||
if (requestHandled == USBFS_FALSE)
|
||||
{
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
@ -196,18 +247,12 @@ void USBFS_HandleSetup(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_HandleIN
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine handles EP0 IN transfers.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -217,15 +262,19 @@ void USBFS_HandleIN(void)
|
||||
{
|
||||
case USBFS_TRANS_STATE_IDLE:
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_CONTROL_READ:
|
||||
USBFS_ControlReadDataStage();
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_CONTROL_WRITE:
|
||||
USBFS_ControlWriteStatusStage();
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_NO_DATA_CONTROL:
|
||||
USBFS_NoDataControlStatusStage();
|
||||
break;
|
||||
|
||||
default: /* there are no more states */
|
||||
break;
|
||||
}
|
||||
@ -234,18 +283,12 @@ void USBFS_HandleIN(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_HandleOUT
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine handles EP0 OUT transfers.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -255,19 +298,25 @@ void USBFS_HandleOUT(void)
|
||||
{
|
||||
case USBFS_TRANS_STATE_IDLE:
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_CONTROL_READ:
|
||||
USBFS_ControlReadStatusStage();
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_CONTROL_WRITE:
|
||||
USBFS_ControlWriteDataStage();
|
||||
break;
|
||||
|
||||
case USBFS_TRANS_STATE_NO_DATA_CONTROL:
|
||||
/* Update the completion block */
|
||||
USBFS_UpdateStatusBlock(USBFS_XFER_ERROR);
|
||||
|
||||
/* We expect no more data, so stall INs and OUTs */
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
break;
|
||||
default: /* There are no more states */
|
||||
|
||||
default:
|
||||
/* There are no more states */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -275,10 +324,9 @@ void USBFS_HandleOUT(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_LoadEP0
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine loads the EP0 data registers for OUT transfers. It uses the
|
||||
* This routine loads the EP0 data registers for OUT transfers. It uses the
|
||||
* currentTD (previously initialized by the _InitControlWrite function and
|
||||
* updated for each OUT transfer, and the bLastPacketSize) to determine how
|
||||
* many uint8s to transfer on the current OUT.
|
||||
@ -288,13 +336,8 @@ void USBFS_HandleOUT(void)
|
||||
* of the control endpoint size (8) or remaining number of uint8s for the
|
||||
* transaction.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_transferByteCount - Update the transfer byte count from the
|
||||
* last transaction.
|
||||
* USBFS_ep0Count - counts the data loaded to the SIE memory in
|
||||
@ -307,7 +350,7 @@ void USBFS_HandleOUT(void)
|
||||
* USBFS_ep0Mode - prepare for mode register content.
|
||||
* USBFS_transferState - set to TRANS_STATE_CONTROL_READ
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -317,16 +360,18 @@ void USBFS_LoadEP0(void)
|
||||
|
||||
/* Update the transfer byte count from the last transaction */
|
||||
USBFS_transferByteCount += USBFS_lastPacketSize;
|
||||
|
||||
/* Now load the next transaction */
|
||||
while ((USBFS_currentTD.count > 0u) && (ep0Count < 8u))
|
||||
{
|
||||
CY_SET_REG8((reg8 *)(USBFS_EP0_DR0_IND + ep0Count), *USBFS_currentTD.pData);
|
||||
USBFS_EP0_DR_BASE.epData[ep0Count] = (uint8) *USBFS_currentTD.pData;
|
||||
USBFS_currentTD.pData = &USBFS_currentTD.pData[1u];
|
||||
ep0Count++;
|
||||
USBFS_currentTD.count--;
|
||||
}
|
||||
/* Support zero-length packet*/
|
||||
if( (USBFS_lastPacketSize == 8u) || (ep0Count > 0u) )
|
||||
|
||||
/* Support zero-length packet */
|
||||
if ((USBFS_lastPacketSize == 8u) || (ep0Count > 0u))
|
||||
{
|
||||
/* Update the data toggle */
|
||||
USBFS_ep0Toggle ^= USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
@ -344,39 +389,37 @@ void USBFS_LoadEP0(void)
|
||||
}
|
||||
|
||||
/* Save the packet size for next time */
|
||||
USBFS_lastPacketSize = ep0Count;
|
||||
USBFS_ep0Count = ep0Count;
|
||||
USBFS_ep0Count = (uint8) ep0Count;
|
||||
USBFS_lastPacketSize = (uint8) ep0Count;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_InitControlRead
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Initialize a control read transaction, usable to send data to the host.
|
||||
* Initialize a control read transaction. It is used to send data to the host.
|
||||
* The following global variables should be initialized before this function
|
||||
* called. To send zero length packet use InitZeroLengthControlTransfer
|
||||
* function.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* requestHandled state.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_currentTD.count - counts of data to be sent.
|
||||
* USBFS_currentTD.pData - data pointer.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_InitControlRead(void)
|
||||
{
|
||||
uint16 xferCount;
|
||||
if(USBFS_currentTD.count == 0u)
|
||||
|
||||
if (USBFS_currentTD.count == 0u)
|
||||
{
|
||||
(void) USBFS_InitZeroLengthControlTransfer();
|
||||
}
|
||||
@ -384,44 +427,44 @@ uint8 USBFS_InitControlRead(void)
|
||||
{
|
||||
/* Set up the state machine */
|
||||
USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ;
|
||||
|
||||
/* Set the toggle, it gets updated in LoadEP */
|
||||
USBFS_ep0Toggle = 0u;
|
||||
|
||||
/* Initialize the Status Block */
|
||||
USBFS_InitializeStatusBlock();
|
||||
xferCount = (((uint16)CY_GET_REG8(USBFS_lengthHi) << 8u) | (CY_GET_REG8(USBFS_lengthLo)));
|
||||
|
||||
xferCount = ((uint16)((uint16) USBFS_lengthHiReg << 8u) | ((uint16) USBFS_lengthLoReg));
|
||||
|
||||
if (USBFS_currentTD.count > xferCount)
|
||||
{
|
||||
USBFS_currentTD.count = xferCount;
|
||||
}
|
||||
|
||||
USBFS_LoadEP0();
|
||||
}
|
||||
|
||||
return(USBFS_TRUE);
|
||||
return (USBFS_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_InitZeroLengthControlTransfer
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Initialize a zero length data IN transfer.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* requestHandled state.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE
|
||||
* USBFS_ep0Mode - prepare for mode register content.
|
||||
* USBFS_transferState - set to TRANS_STATE_CONTROL_READ
|
||||
* USBFS_ep0Count - cleared, means the zero-length packet.
|
||||
* USBFS_lastPacketSize - cleared.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -430,32 +473,30 @@ uint8 USBFS_InitZeroLengthControlTransfer(void)
|
||||
{
|
||||
/* Update the state */
|
||||
USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ;
|
||||
|
||||
/* Set the data toggle */
|
||||
USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
|
||||
/* Set the Mode Register */
|
||||
USBFS_ep0Mode = USBFS_MODE_ACK_IN_STATUS_OUT;
|
||||
|
||||
/* Save the packet size for next time */
|
||||
USBFS_lastPacketSize = 0u;
|
||||
|
||||
USBFS_ep0Count = 0u;
|
||||
|
||||
return(USBFS_TRUE);
|
||||
return (USBFS_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_ControlReadDataStage
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Handle the Data Stage of a control read transfer.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -468,23 +509,17 @@ void USBFS_ControlReadDataStage(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_ControlReadStatusStage
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Handle the Status Stage of a control read transfer.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_USBFS_transferByteCount - updated with last packet size.
|
||||
* USBFS_transferState - set to TRANS_STATE_IDLE.
|
||||
* USBFS_ep0Mode - set to MODE_STALL_IN_OUT.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -492,34 +527,33 @@ void USBFS_ControlReadStatusStage(void)
|
||||
{
|
||||
/* Update the transfer byte count */
|
||||
USBFS_transferByteCount += USBFS_lastPacketSize;
|
||||
|
||||
/* Go Idle */
|
||||
USBFS_transferState = USBFS_TRANS_STATE_IDLE;
|
||||
|
||||
/* Update the completion block */
|
||||
USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK);
|
||||
|
||||
/* We expect no more data, so stall INs and OUTs */
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_InitControlWrite
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Initialize a control write transaction
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* requestHandled state.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_USBFS_transferState - set to TRANS_STATE_CONTROL_WRITE
|
||||
* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE
|
||||
* USBFS_ep0Mode - set to MODE_ACK_OUT_STATUS_IN
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -529,12 +563,14 @@ uint8 USBFS_InitControlWrite(void)
|
||||
|
||||
/* Set up the state machine */
|
||||
USBFS_transferState = USBFS_TRANS_STATE_CONTROL_WRITE;
|
||||
|
||||
/* This might not be necessary */
|
||||
USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
|
||||
/* Initialize the Status Block */
|
||||
USBFS_InitializeStatusBlock();
|
||||
|
||||
xferCount = (((uint16)CY_GET_REG8(USBFS_lengthHi) << 8u) | (CY_GET_REG8(USBFS_lengthLo)));
|
||||
xferCount = ((uint16)((uint16) USBFS_lengthHiReg << 8u) | ((uint16) USBFS_lengthLoReg));
|
||||
|
||||
if (USBFS_currentTD.count > xferCount)
|
||||
{
|
||||
@ -550,21 +586,15 @@ uint8 USBFS_InitControlWrite(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_ControlWriteDataStage
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Handle the Data Stage of a control write transfer
|
||||
* 1. Get the data (We assume the destination was validated previously)
|
||||
* 2. Update the count and data toggle
|
||||
* 3. Update the mode register for the next transaction
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_transferByteCount - Update the transfer byte count from the
|
||||
* last transaction.
|
||||
* USBFS_ep0Count - counts the data loaded from the SIE memory
|
||||
@ -574,7 +604,7 @@ uint8 USBFS_InitControlWrite(void)
|
||||
* USBFS_ep0Toggle - inverted
|
||||
* USBFS_ep0Mode - set to MODE_ACK_OUT_STATUS_IN.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -583,22 +613,24 @@ void USBFS_ControlWriteDataStage(void)
|
||||
uint8 ep0Count;
|
||||
uint8 regIndex = 0u;
|
||||
|
||||
ep0Count = (CY_GET_REG8(USBFS_EP0_CNT_PTR) & USBFS_EPX_CNT0_MASK) -
|
||||
USBFS_EPX_CNTX_CRC_COUNT;
|
||||
ep0Count = (USBFS_EP0_CNT_REG & USBFS_EPX_CNT0_MASK) - USBFS_EPX_CNTX_CRC_COUNT;
|
||||
|
||||
USBFS_transferByteCount += ep0Count;
|
||||
USBFS_transferByteCount += (uint8)ep0Count;
|
||||
|
||||
while ((USBFS_currentTD.count > 0u) && (ep0Count > 0u))
|
||||
{
|
||||
*USBFS_currentTD.pData = CY_GET_REG8((reg8 *)(USBFS_EP0_DR0_IND + regIndex));
|
||||
*USBFS_currentTD.pData = (uint8) USBFS_EP0_DR_BASE.epData[regIndex];
|
||||
USBFS_currentTD.pData = &USBFS_currentTD.pData[1u];
|
||||
regIndex++;
|
||||
ep0Count--;
|
||||
USBFS_currentTD.count--;
|
||||
}
|
||||
USBFS_ep0Count = ep0Count;
|
||||
|
||||
USBFS_ep0Count = (uint8)ep0Count;
|
||||
|
||||
/* Update the data toggle */
|
||||
USBFS_ep0Toggle ^= USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
|
||||
/* Expect Data or Status Stage */
|
||||
USBFS_ep0Mode = USBFS_MODE_ACK_OUT_STATUS_IN;
|
||||
}
|
||||
@ -606,22 +638,15 @@ void USBFS_ControlWriteDataStage(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_ControlWriteStatusStage
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Handle the Status Stage of a control write transfer
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_transferState - set to TRANS_STATE_IDLE.
|
||||
* USBFS_USBFS_ep0Mode - set to MODE_STALL_IN_OUT.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -629,8 +654,10 @@ void USBFS_ControlWriteStatusStage(void)
|
||||
{
|
||||
/* Go Idle */
|
||||
USBFS_transferState = USBFS_TRANS_STATE_IDLE;
|
||||
/* Update the completion block */
|
||||
|
||||
/* Update the completion block */
|
||||
USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK);
|
||||
|
||||
/* We expect no more data, so stall INs and OUTs */
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
}
|
||||
@ -638,102 +665,89 @@ void USBFS_ControlWriteStatusStage(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_InitNoDataControlTransfer
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Initialize a no data control transfer
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* requestHandled state.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_transferState - set to TRANS_STATE_NO_DATA_CONTROL.
|
||||
* USBFS_ep0Mode - set to MODE_STATUS_IN_ONLY.
|
||||
* USBFS_ep0Count - cleared.
|
||||
* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_InitNoDataControlTransfer(void)
|
||||
{
|
||||
USBFS_transferState = USBFS_TRANS_STATE_NO_DATA_CONTROL;
|
||||
USBFS_ep0Mode = USBFS_MODE_STATUS_IN_ONLY;
|
||||
USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
USBFS_ep0Count = 0u;
|
||||
USBFS_ep0Mode = USBFS_MODE_STATUS_IN_ONLY;
|
||||
USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE;
|
||||
USBFS_ep0Count = 0u;
|
||||
|
||||
return(USBFS_TRUE);
|
||||
return (USBFS_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_NoDataControlStatusStage
|
||||
********************************************************************************
|
||||
* Summary:
|
||||
****************************************************************************//**
|
||||
* Handle the Status Stage of a no data control transfer.
|
||||
*
|
||||
* SET_ADDRESS is special, since we need to receive the status stage with
|
||||
* the old address.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_transferState - set to TRANS_STATE_IDLE.
|
||||
* USBFS_ep0Mode - set to MODE_STALL_IN_OUT.
|
||||
* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE
|
||||
* USBFS_deviceAddress - used to set new address and cleared
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_NoDataControlStatusStage(void)
|
||||
{
|
||||
/* Change the USB address register if we got a SET_ADDRESS. */
|
||||
if (USBFS_deviceAddress != 0u)
|
||||
if (0u != USBFS_deviceAddress)
|
||||
{
|
||||
CY_SET_REG8(USBFS_CR0_PTR, USBFS_deviceAddress | USBFS_CR0_ENABLE);
|
||||
/* Update device address if we got new address. */
|
||||
USBFS_CR0_REG = (uint8) USBFS_deviceAddress | USBFS_CR0_ENABLE;
|
||||
USBFS_deviceAddress = 0u;
|
||||
}
|
||||
/* Go Idle */
|
||||
|
||||
USBFS_transferState = USBFS_TRANS_STATE_IDLE;
|
||||
/* Update the completion block */
|
||||
|
||||
/* Update the completion block. */
|
||||
USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK);
|
||||
/* We expect no more data, so stall INs and OUTs */
|
||||
|
||||
/* Stall IN and OUT, no more data is expected. */
|
||||
USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_UpdateStatusBlock
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Update the Completion Status Block for a Request. The block is updated
|
||||
* with the completion code the USBFS_transferByteCount. The
|
||||
* StatusBlock Pointer is set to NULL.
|
||||
*
|
||||
* Parameters:
|
||||
* completionCode - status.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_currentTD.pStatusBlock->status - updated by the
|
||||
* completionCode parameter.
|
||||
* USBFS_currentTD.pStatusBlock->length - updated.
|
||||
* USBFS_currentTD.pStatusBlock - cleared.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -750,34 +764,28 @@ void USBFS_UpdateStatusBlock(uint8 completionCode)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_InitializeStatusBlock
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Initialize the Completion Status Block for a Request. The completion
|
||||
* code is set to USB_XFER_IDLE.
|
||||
*
|
||||
* Also, initializes USBFS_transferByteCount. Save some space,
|
||||
* this is the only consumer.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* None.
|
||||
*
|
||||
* Global variables:
|
||||
* \globalvars
|
||||
* USBFS_currentTD.pStatusBlock->status - set to XFER_IDLE.
|
||||
* USBFS_currentTD.pStatusBlock->length - cleared.
|
||||
* USBFS_transferByteCount - cleared.
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void USBFS_InitializeStatusBlock(void)
|
||||
{
|
||||
USBFS_transferByteCount = 0u;
|
||||
if(USBFS_currentTD.pStatusBlock != NULL)
|
||||
|
||||
if (USBFS_currentTD.pStatusBlock != NULL)
|
||||
{
|
||||
USBFS_currentTD.pStatusBlock->status = USBFS_XFER_IDLE;
|
||||
USBFS_currentTD.pStatusBlock->length = 0u;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +1,44 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_hid.c
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_hid.c
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* USB HID Class request handler.
|
||||
* \brief
|
||||
* This file contains the USB HID Class request handler.
|
||||
*
|
||||
* Related Document:
|
||||
* Device Class Definition for Human Interface Devices (HID) Version 1.11
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "USBFS.h"
|
||||
#include "USBFS_hid.h"
|
||||
#include "USBFS_pvt.h"
|
||||
|
||||
|
||||
|
||||
#if defined(USBFS_ENABLE_HID_CLASS)
|
||||
|
||||
#include "USBFS_pvt.h"
|
||||
#include "USBFS_hid.h"
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
* HID Variables
|
||||
***************************************/
|
||||
/** This variable is initialized in the USBFS_InitComponent() API to the
|
||||
* PROTOCOL_REPORT value. It is controlled by the host using the
|
||||
* HID_SET_PROTOCOL request. The value is returned to the user code by the
|
||||
* USBFS_GetProtocol() API.*/
|
||||
volatile uint8 USBFS_hidProtocol[USBFS_MAX_INTERFACES_NUMBER];
|
||||
|
||||
volatile uint8 USBFS_hidProtocol[USBFS_MAX_INTERFACES_NUMBER]; /* HID device protocol status */
|
||||
volatile uint8 USBFS_hidIdleRate[USBFS_MAX_INTERFACES_NUMBER]; /* HID device idle reload value */
|
||||
/** This variable controls the HID report rate. It is controlled by the host
|
||||
* using the HID_SET_IDLE request and used by the USBFS_UpdateHIDTimer() API to
|
||||
* reload timer.*/
|
||||
volatile uint8 USBFS_hidIdleRate[USBFS_MAX_INTERFACES_NUMBER];
|
||||
|
||||
/** This variable contains the timer counter, which is decremented and reloaded
|
||||
* by the USBFS_UpdateHIDTimer() API.*/
|
||||
volatile uint8 USBFS_hidIdleTimer[USBFS_MAX_INTERFACES_NUMBER]; /* HID device idle rate value */
|
||||
|
||||
|
||||
@ -46,18 +53,23 @@ volatile uint8 USBFS_hidIdleTimer[USBFS_MAX_INTERFACES_NUMBER]; /* HID device id
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_UpdateHIDTimer
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Updates the HID report timer and reloads it if expired
|
||||
* This function updates the HID Report idle timer and returns the status and
|
||||
* reloads the timer if it expires.
|
||||
*
|
||||
* Parameters:
|
||||
* interface: Interface Number.
|
||||
* \param interface Contains the interface number.
|
||||
*
|
||||
* Return:
|
||||
* status.
|
||||
* \return
|
||||
* Returns the state of the HID timer. Symbolic names and their associated values are given here:
|
||||
* Return Value |Notes
|
||||
* ---------------------------|------------------------------------------------
|
||||
* USBFS_IDLE_TIMER_EXPIRED | The timer expired.
|
||||
* USBFS_IDLE_TIMER_RUNNING | The timer is running.
|
||||
* USBFS_IDLE_TIMER_IDEFINITE | The report is sent when data or state changes.
|
||||
*
|
||||
* Reentrant:
|
||||
*
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -79,22 +91,20 @@ uint8 USBFS_UpdateHIDTimer(uint8 interface)
|
||||
}
|
||||
}
|
||||
|
||||
return(stat);
|
||||
return((uint8)stat);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_GetProtocol
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* Returns the selected protocol value to the application
|
||||
* This function returns the HID protocol value for the selected interface.
|
||||
*
|
||||
* Parameters:
|
||||
* interface: Interface Number.
|
||||
* \param interface: Contains the interface number.
|
||||
*
|
||||
* Return:
|
||||
* Interface protocol.
|
||||
* \return
|
||||
* Returns the protocol value.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_GetProtocol(uint8 interface)
|
||||
@ -105,33 +115,34 @@ uint8 USBFS_GetProtocol(uint8 interface)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_DispatchHIDClassRqst
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine dispatches class requests
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
* \return
|
||||
* Results of HID Class request handling:
|
||||
* - USBFS_TRUE - request was handled without errors
|
||||
* - USBFS_FALSE - error occurs during handling of request
|
||||
*
|
||||
* Return:
|
||||
* requestHandled
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
{
|
||||
uint8 requestHandled = USBFS_FALSE;
|
||||
uint8 interfaceNumber;
|
||||
|
||||
interfaceNumber = CY_GET_REG8(USBFS_wIndexLo);
|
||||
if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H)
|
||||
{ /* Control Read */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
uint8 interfaceNumber = (uint8) USBFS_wIndexLoReg;
|
||||
|
||||
/* Check request direction: D2H or H2D. */
|
||||
if (0u != (USBFS_bmRequestTypeReg & USBFS_RQST_DIR_D2H))
|
||||
{
|
||||
/* Handle direction from device to host. */
|
||||
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_GET_DESCRIPTOR:
|
||||
if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_HID_CLASS)
|
||||
if (USBFS_wValueHiReg == USBFS_DESCR_HID_CLASS)
|
||||
{
|
||||
USBFS_FindHidClassDecriptor();
|
||||
if (USBFS_currentTD.count != 0u)
|
||||
@ -139,7 +150,7 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
}
|
||||
else if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_HID_REPORT)
|
||||
else if (USBFS_wValueHiReg == USBFS_DESCR_HID_REPORT)
|
||||
{
|
||||
USBFS_FindReportDescriptor();
|
||||
if (USBFS_currentTD.count != 0u)
|
||||
@ -148,9 +159,11 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* requestHandled is initialezed as FALSE by default */
|
||||
{
|
||||
/* Do not handle this request. */
|
||||
}
|
||||
break;
|
||||
|
||||
case USBFS_HID_GET_REPORT:
|
||||
USBFS_FindReport();
|
||||
if (USBFS_currentTD.count != 0u)
|
||||
@ -161,15 +174,15 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
|
||||
case USBFS_HID_GET_IDLE:
|
||||
/* This function does not support multiple reports per interface*/
|
||||
/* Validate interfaceNumber and Report ID (should be 0) */
|
||||
if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) &&
|
||||
(CY_GET_REG8(USBFS_wValueLo) == 0u ) ) /* Do not support Idle per Report ID */
|
||||
/* Validate interfaceNumber and Report ID (should be 0): Do not support Idle per Report ID */
|
||||
if ((interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && (USBFS_wValueLoReg == 0u))
|
||||
{
|
||||
USBFS_currentTD.count = 1u;
|
||||
USBFS_currentTD.pData = &USBFS_hidIdleRate[interfaceNumber];
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
break;
|
||||
|
||||
case USBFS_HID_GET_PROTOCOL:
|
||||
/* Validate interfaceNumber */
|
||||
if( interfaceNumber < USBFS_MAX_INTERFACES_NUMBER)
|
||||
@ -179,14 +192,16 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
requestHandled = USBFS_InitControlRead();
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* requestHandled is initialized as FALSE by default */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) ==
|
||||
USBFS_RQST_DIR_H2D)
|
||||
{ /* Control Write */
|
||||
switch (CY_GET_REG8(USBFS_bRequest))
|
||||
else
|
||||
{
|
||||
/* Handle direction from host to device. */
|
||||
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_HID_SET_REPORT:
|
||||
USBFS_FindReport();
|
||||
@ -195,13 +210,13 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
requestHandled = USBFS_InitControlWrite();
|
||||
}
|
||||
break;
|
||||
|
||||
case USBFS_HID_SET_IDLE:
|
||||
/* This function does not support multiple reports per interface */
|
||||
/* Validate interfaceNumber and Report ID (should be 0) */
|
||||
if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) &&
|
||||
(CY_GET_REG8(USBFS_wValueLo) == 0u ) ) /* Do not support Idle per Report ID */
|
||||
/* Validate interfaceNumber and Report ID (should be 0): Do not support Idle per Report ID */
|
||||
if ((interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && (USBFS_wValueLoReg == 0u))
|
||||
{
|
||||
USBFS_hidIdleRate[interfaceNumber] = CY_GET_REG8(USBFS_wValueHi);
|
||||
USBFS_hidIdleRate[interfaceNumber] = (uint8)USBFS_wValueHiReg;
|
||||
/* With regards to HID spec: "7.2.4 Set_Idle Request"
|
||||
* Latency. If the current period has gone past the
|
||||
* newly proscribed time duration, then a report
|
||||
@ -235,42 +250,36 @@ uint8 USBFS_DispatchHIDClassRqst(void)
|
||||
|
||||
case USBFS_HID_SET_PROTOCOL:
|
||||
/* Validate interfaceNumber and protocol (must be 0 or 1) */
|
||||
if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) &&
|
||||
(CY_GET_REG8(USBFS_wValueLo) <= 1u) )
|
||||
if ((interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && (USBFS_wValueLoReg <= 1u))
|
||||
{
|
||||
USBFS_hidProtocol[interfaceNumber] = CY_GET_REG8(USBFS_wValueLo);
|
||||
USBFS_hidProtocol[interfaceNumber] = (uint8)USBFS_wValueLoReg;
|
||||
requestHandled = USBFS_InitNoDataControlTransfer();
|
||||
}
|
||||
break;
|
||||
default: /* requestHandled is initialized as FALSE by default */
|
||||
|
||||
default:
|
||||
/* Unknown class request is not handled. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* requestHandled is initialized as FALSE by default */
|
||||
}
|
||||
|
||||
return(requestHandled);
|
||||
return (requestHandled);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USB_FindHidClassDescriptor
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine find Hid Class Descriptor pointer based on the Interface number
|
||||
* and Alternate setting then loads the currentTD structure with the address of
|
||||
* the buffer and the size.
|
||||
* The HID Class Descriptor resides inside the config descriptor.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* currentTD
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -281,19 +290,25 @@ void USBFS_FindHidClassDecriptor(void)
|
||||
uint8 interfaceN;
|
||||
|
||||
pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u);
|
||||
interfaceN = CY_GET_REG8(USBFS_wIndexLo);
|
||||
|
||||
interfaceN = (uint8) USBFS_wIndexLoReg;
|
||||
/* Third entry in the LUT starts the Interface Table pointers */
|
||||
/* Now use the request interface number*/
|
||||
pTmp = &pTmp[interfaceN + 2u];
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
|
||||
/* Now use Alternate setting number */
|
||||
pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]];
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
|
||||
/* Fifth entry in the LUT points to Hid Class Descriptor in Configuration Descriptor */
|
||||
pTmp = &pTmp[4u];
|
||||
pDescr = (volatile uint8 *)pTmp->p_list;
|
||||
|
||||
/* The first byte contains the descriptor length */
|
||||
USBFS_currentTD.count = *pDescr;
|
||||
USBFS_currentTD.pData = pDescr;
|
||||
@ -302,21 +317,17 @@ void USBFS_FindHidClassDecriptor(void)
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USB_FindReportDescriptor
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine find Hid Report Descriptor pointer based on the Interface
|
||||
* number, then loads the currentTD structure with the address of the buffer
|
||||
* and the size.
|
||||
* Hid Report Descriptor is located after IN/OUT/FEATURE reports.
|
||||
*
|
||||
* Parameters:
|
||||
* void
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* currentTD
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -327,42 +338,44 @@ void USBFS_FindReportDescriptor(void)
|
||||
uint8 interfaceN;
|
||||
|
||||
pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u);
|
||||
interfaceN = CY_GET_REG8(USBFS_wIndexLo);
|
||||
interfaceN = (uint8) USBFS_wIndexLoReg;
|
||||
|
||||
/* Third entry in the LUT starts the Interface Table pointers */
|
||||
/* Now use the request interface number */
|
||||
pTmp = &pTmp[interfaceN + 2u];
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
|
||||
/* Now use Alternate setting number */
|
||||
pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]];
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
|
||||
/* Fourth entry in the LUT starts the Hid Report Descriptor */
|
||||
pTmp = &pTmp[3u];
|
||||
pDescr = (volatile uint8 *)pTmp->p_list;
|
||||
|
||||
/* The 1st and 2nd bytes of descriptor contain its length. LSB is 1st. */
|
||||
USBFS_currentTD.count = (((uint16)pDescr[1u] << 8u) | pDescr[0u]);
|
||||
USBFS_currentTD.count = ((uint16)((uint16) pDescr[1u] << 8u) | pDescr[0u]);
|
||||
USBFS_currentTD.pData = &pDescr[2u];
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_FindReport
|
||||
********************************************************************************
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Summary:
|
||||
* This routine sets up a transfer based on the Interface number, Report Type
|
||||
* and Report ID, then loads the currentTD structure with the address of the
|
||||
* buffer and the size. The caller has to decide if it is a control read or
|
||||
* control write.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Return:
|
||||
* \return
|
||||
* currentTD
|
||||
*
|
||||
* Reentrant:
|
||||
* \reentrant
|
||||
* No.
|
||||
*
|
||||
*******************************************************************************/
|
||||
@ -370,41 +383,48 @@ void USBFS_FindReport(void)
|
||||
{
|
||||
const T_USBFS_LUT CYCODE *pTmp;
|
||||
T_USBFS_TD *pTD;
|
||||
uint8 interfaceN;
|
||||
uint8 reportType;
|
||||
|
||||
uint8 interfaceN;
|
||||
|
||||
/* `#START HID_FINDREPORT` Place custom handling here */
|
||||
|
||||
/* `#END` */
|
||||
|
||||
#ifdef USBFS_FIND_REPORT_CALLBACK
|
||||
USBFS_FindReport_Callback();
|
||||
#endif /* USBFS_FIND_REPORT_CALLBACK */
|
||||
#ifdef USBFS_FIND_REPORT_CALLBACK
|
||||
USBFS_FindReport_Callback();
|
||||
#endif /* (USBFS_FIND_REPORT_CALLBACK) */
|
||||
|
||||
USBFS_currentTD.count = 0u; /* Init not supported condition */
|
||||
pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u);
|
||||
reportType = CY_GET_REG8(USBFS_wValueHi);
|
||||
interfaceN = CY_GET_REG8(USBFS_wIndexLo);
|
||||
/* Third entry in the LUT COnfiguration Table starts the Interface Table pointers */
|
||||
reportType = (uint8) USBFS_wValueHiReg;
|
||||
interfaceN = (uint8) USBFS_wIndexLoReg;
|
||||
|
||||
/* Third entry in the LUT Configuration Table starts the Interface Table pointers */
|
||||
/* Now use the request interface number */
|
||||
pTmp = &pTmp[interfaceN + 2u];
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE*/
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
if(interfaceN < USBFS_MAX_INTERFACES_NUMBER)
|
||||
if (interfaceN < USBFS_MAX_INTERFACES_NUMBER)
|
||||
{
|
||||
/* Now use Alternate setting number */
|
||||
pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]];
|
||||
|
||||
/* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */
|
||||
pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list;
|
||||
|
||||
/* Validate reportType to comply with "7.2.1 Get_Report Request" */
|
||||
if((reportType >= USBFS_HID_GET_REPORT_INPUT) &&
|
||||
(reportType <= USBFS_HID_GET_REPORT_FEATURE))
|
||||
if ((reportType >= USBFS_HID_GET_REPORT_INPUT) &&
|
||||
(reportType <= USBFS_HID_GET_REPORT_FEATURE))
|
||||
{
|
||||
/* Get the entry proper TD (IN, OUT or Feature Report Table)*/
|
||||
pTmp = &pTmp[reportType - 1u];
|
||||
reportType = CY_GET_REG8(USBFS_wValueLo); /* Get reportID */
|
||||
|
||||
/* Get reportID */
|
||||
reportType = (uint8) USBFS_wValueLoReg;
|
||||
|
||||
/* Validate table support by the HID descriptor, compare table count with reportID */
|
||||
if(pTmp->c >= reportType)
|
||||
if (pTmp->c >= reportType)
|
||||
{
|
||||
pTD = (T_USBFS_TD *) pTmp->p_list;
|
||||
pTD = &pTD[reportType]; /* select entry depend on report ID*/
|
||||
|
28
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.h
Normal file → Executable file
28
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.h
Normal file → Executable file
@ -1,15 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_hid.h
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_hid.h
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Header File for the USBFS component. Contains prototypes and constant values.
|
||||
* \brief
|
||||
* This file provides function prototypes and constants for the USBFS component
|
||||
* HID class.
|
||||
*
|
||||
* Related Document:
|
||||
* Device Class Definition for Human Interface Devices (HID) Version 1.11
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -18,22 +20,24 @@
|
||||
#if !defined(CY_USBFS_USBFS_hid_H)
|
||||
#define CY_USBFS_USBFS_hid_H
|
||||
|
||||
#include "cytypes.h"
|
||||
|
||||
#include "USBFS.h"
|
||||
|
||||
/***************************************
|
||||
* Prototypes of the USBFS_hid API.
|
||||
***************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hid
|
||||
* @{
|
||||
*/
|
||||
uint8 USBFS_UpdateHIDTimer(uint8 interface) ;
|
||||
uint8 USBFS_GetProtocol(uint8 interface) ;
|
||||
|
||||
uint8 USBFS_GetProtocol(uint8 interface) ;
|
||||
/** @} hid */
|
||||
|
||||
/***************************************
|
||||
*Renamed Functions for backward compatible
|
||||
***************************************/
|
||||
|
||||
#define USBFS_bGetProtocol USBFS_GetProtocol
|
||||
#define USBFS_bGetProtocol USBFS_GetProtocol
|
||||
|
||||
|
||||
/***************************************
|
||||
|
File diff suppressed because it is too large
Load Diff
204
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.h
Normal file → Executable file
204
software/SCSI2SD/v3/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.h
Normal file → Executable file
@ -1,17 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* File Name: USBFS_midi.h
|
||||
* Version 2.80
|
||||
/***************************************************************************//**
|
||||
* \file USBFS_midi.h
|
||||
* \version 3.10
|
||||
*
|
||||
* Description:
|
||||
* Header File for the USBFS MIDI module.
|
||||
* Contains prototypes and constant values.
|
||||
* \brief
|
||||
* This file provides function prototypes and constants for the USBFS component
|
||||
* MIDI class support.
|
||||
*
|
||||
* Related Document:
|
||||
* Universal Serial Bus Device Class Definition for MIDI Devices Release 1.0
|
||||
* MIDI 1.0 Detailed Specification Document Version 4.2
|
||||
*
|
||||
********************************************************************************
|
||||
* Copyright 2008-2014, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* \copyright
|
||||
* Copyright 2008-2016, Cypress Semiconductor Corporation. All rights reserved.
|
||||
* You may use this file only in accordance with the license, terms, conditions,
|
||||
* disclaimers, and limitations in the end user license agreement accompanying
|
||||
* the software package with which this file was provided.
|
||||
@ -20,33 +21,106 @@
|
||||
#if !defined(CY_USBFS_USBFS_midi_H)
|
||||
#define CY_USBFS_USBFS_midi_H
|
||||
|
||||
#include "cytypes.h"
|
||||
#include "USBFS.h"
|
||||
|
||||
/***************************************
|
||||
* Initial Parameter Constants
|
||||
***************************************/
|
||||
|
||||
#define USBFS_ENABLE_MIDI_API (0u != (1u))
|
||||
#define USBFS_MIDI_EXT_MODE (0u)
|
||||
|
||||
|
||||
/* Number of external interfaces (UARTs). */
|
||||
#define USBFS_ONE_EXT_INTRF (0x01u)
|
||||
#define USBFS_TWO_EXT_INTRF (0x02u)
|
||||
|
||||
#define USBFS_ISR_SERVICE_MIDI_OUT \
|
||||
((USBFS_ENABLE_MIDI_API != 0u) && (USBFS_MIDI_OUT_BUFF_SIZE > 0) && \
|
||||
(USBFS_EP_MANAGEMENT_DMA_AUTO))
|
||||
|
||||
#define USBFS_ISR_SERVICE_MIDI_IN \
|
||||
((USBFS_ENABLE_MIDI_API != 0u) && (USBFS_MIDI_IN_BUFF_SIZE > 0))
|
||||
|
||||
|
||||
/***************************************
|
||||
* External References
|
||||
***************************************/
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF)
|
||||
#include "MIDI1_UART.h"
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) */
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF)
|
||||
#include "MIDI2_UART.h"
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Data Structure Definition
|
||||
***************************************/
|
||||
|
||||
/* The following structure is used to hold status information for
|
||||
building and parsing incoming MIDI messages. */
|
||||
* building and parsing incoming MIDI messages.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8 length; /* expected length */
|
||||
uint8 count; /* current byte count */
|
||||
uint8 size; /* complete size */
|
||||
uint8 runstat; /* running status */
|
||||
uint8 msgBuff[4]; /* message buffer */
|
||||
uint8 msgBuff[4u]; /* message buffer */
|
||||
} USBFS_MIDI_RX_STATUS;
|
||||
|
||||
|
||||
/***************************************
|
||||
* Function Prototypes
|
||||
***************************************/
|
||||
/**
|
||||
* \addtogroup group_midi
|
||||
* @{
|
||||
*/
|
||||
#if defined(USBFS_ENABLE_MIDI_STREAMING) && (USBFS_ENABLE_MIDI_API != 0u)
|
||||
void USBFS_MIDI_Init(void) ;
|
||||
|
||||
#if (USBFS_MIDI_IN_BUFF_SIZE > 0u)
|
||||
void USBFS_MIDI_IN_Service(void) ;
|
||||
uint8 USBFS_PutUsbMidiIn(uint8 ic, const uint8 midiMsg[], uint8 cable) ;
|
||||
#endif /* (USBFS_MIDI_IN_BUFF_SIZE > 0u) */
|
||||
|
||||
#if (USBFS_MIDI_OUT_BUFF_SIZE > 0u)
|
||||
void USBFS_MIDI_OUT_Service(void) ;
|
||||
#endif /* (USBFS_MIDI_OUT_BUFF_SIZE > 0u) */
|
||||
#endif /* (USBFS_ENABLE_MIDI_API != 0u) */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Callback Function Prototypes
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: USBFS_callbackLocalMidiEvent
|
||||
****************************************************************************//**
|
||||
*
|
||||
* This is a callback function that locally processes data received from the PC
|
||||
* in main.c. You should implement this function if you want to use it. It is
|
||||
* called from the USB output processing routine for each MIDI output event
|
||||
* processed (decoded) from the output endpoint buffer.
|
||||
*
|
||||
* \param cable: Cable number
|
||||
*
|
||||
* \param midiMsg: Pointer to the 3-byte MIDI message
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
void USBFS_callbackLocalMidiEvent(uint8 cable, uint8 *midiMsg)
|
||||
;
|
||||
/** @} midi */
|
||||
|
||||
/***************************************
|
||||
* MIDI Constants.
|
||||
***************************************/
|
||||
|
||||
#define USBFS_ONE_EXT_INTRF (0x01u)
|
||||
#define USBFS_TWO_EXT_INTRF (0x02u)
|
||||
|
||||
/* Flag definitions for use with MIDI device inquiry */
|
||||
#define USBFS_INQ_SYSEX_FLAG (0x01u)
|
||||
#define USBFS_INQ_IDENTITY_REQ_FLAG (0x02u)
|
||||
@ -102,104 +176,102 @@ typedef struct
|
||||
/* MIDI Universal System Exclusive defines */
|
||||
#define USBFS_MIDI_SYSEX_NON_REAL_TIME (0x7Eu)
|
||||
#define USBFS_MIDI_SYSEX_REALTIME (0x7Fu)
|
||||
|
||||
/* ID of target device */
|
||||
#define USBFS_MIDI_SYSEX_ID_ALL (0x7Fu)
|
||||
|
||||
/* Sub-ID#1*/
|
||||
#define USBFS_MIDI_SYSEX_GEN_INFORMATION (0x06u)
|
||||
#define USBFS_MIDI_SYSEX_GEN_MESSAGE (0x09u)
|
||||
|
||||
/* Sub-ID#2*/
|
||||
#define USBFS_MIDI_SYSEX_IDENTITY_REQ (0x01u)
|
||||
#define USBFS_MIDI_SYSEX_IDENTITY_REPLY (0x02u)
|
||||
#define USBFS_MIDI_SYSEX_SYSTEM_ON (0x01u)
|
||||
#define USBFS_MIDI_SYSEX_SYSTEM_OFF (0x02u)
|
||||
|
||||
#define USBFS_CUSTOM_UART_TX_PRIOR_NUM (0x04u)
|
||||
#define USBFS_CUSTOM_UART_RX_PRIOR_NUM (0x02u)
|
||||
|
||||
#define USBFS_ISR_SERVICE_MIDI_OUT \
|
||||
( (USBFS_ENABLE_MIDI_API != 0u) && \
|
||||
(USBFS_MIDI_OUT_BUFF_SIZE > 0) && (USBFS_EP_MM == USBFS__EP_DMAAUTO))
|
||||
#define USBFS_ISR_SERVICE_MIDI_IN \
|
||||
( (USBFS_ENABLE_MIDI_API != 0u) && (USBFS_MIDI_IN_BUFF_SIZE > 0) )
|
||||
/* UART TX and RX interrupt priority. */
|
||||
#if (CY_PSOC4)
|
||||
#define USBFS_CUSTOM_UART_RX_PRIOR_NUM (0x01u)
|
||||
#define USBFS_CUSTOM_UART_TX_PRIOR_NUM (0x02u)
|
||||
#else
|
||||
#define USBFS_CUSTOM_UART_RX_PRIOR_NUM (0x02u)
|
||||
#define USBFS_CUSTOM_UART_TX_PRIOR_NUM (0x04u)
|
||||
#endif /* (CYPSOC4) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* External function references
|
||||
***************************************/
|
||||
|
||||
void USBFS_callbackLocalMidiEvent(uint8 cable, uint8 *midiMsg)
|
||||
;
|
||||
|
||||
|
||||
/***************************************
|
||||
* External references
|
||||
***************************************/
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF)
|
||||
#include "MIDI1_UART.h"
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF)
|
||||
#include "MIDI2_UART.h"
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */
|
||||
#if(USBFS_EP_MM != USBFS__EP_MANUAL)
|
||||
#include <CyDmac.h>
|
||||
#endif /* USBFS_EP_MM */
|
||||
|
||||
|
||||
/***************************************
|
||||
* Private function prototypes
|
||||
* Private Function Prototypes
|
||||
***************************************/
|
||||
|
||||
void USBFS_PrepareInBuffer(uint8 ic, const uint8 srcBuff[], uint8 eventLen, uint8 cable)
|
||||
;
|
||||
;
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF)
|
||||
void USBFS_MIDI_Init(void) ;
|
||||
void USBFS_MIDI_InitInterface(void) ;
|
||||
uint8 USBFS_ProcessMidiIn(uint8 mData, USBFS_MIDI_RX_STATUS *rxStat)
|
||||
;
|
||||
uint8 USBFS_MIDI1_GetEvent(void) ;
|
||||
void USBFS_MIDI1_ProcessUsbOut(const uint8 epBuf[])
|
||||
;
|
||||
uint8 USBFS_MIDI1_GetEvent(void) ;
|
||||
void USBFS_MIDI1_ProcessUsbOut(const uint8 epBuf[])
|
||||
;
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF)
|
||||
uint8 USBFS_MIDI2_GetEvent(void) ;
|
||||
void USBFS_MIDI2_ProcessUsbOut(const uint8 epBuf[])
|
||||
;
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */
|
||||
uint8 USBFS_MIDI2_GetEvent(void) ;
|
||||
void USBFS_MIDI2_ProcessUsbOut(const uint8 epBuf[])
|
||||
;
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) */
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) */
|
||||
|
||||
|
||||
/***************************************
|
||||
* External data references
|
||||
* Vars with External Linkage
|
||||
***************************************/
|
||||
|
||||
#if defined(USBFS_ENABLE_MIDI_STREAMING)
|
||||
|
||||
#if (USBFS_MIDI_IN_BUFF_SIZE > 0)
|
||||
#if (USBFS_MIDI_IN_BUFF_SIZE >= 256)
|
||||
/**
|
||||
* \addtogroup group_midi
|
||||
* @{
|
||||
*/
|
||||
extern volatile uint16 USBFS_midiInPointer; /* Input endpoint buffer pointer */
|
||||
/** @} midi*/
|
||||
#else
|
||||
extern volatile uint8 USBFS_midiInPointer; /* Input endpoint buffer pointer */
|
||||
#endif /* USBFS_MIDI_IN_BUFF_SIZE >=256 */
|
||||
#endif /* (USBFS_MIDI_IN_BUFF_SIZE >=256) */
|
||||
/**
|
||||
* \addtogroup group_midi
|
||||
* @{
|
||||
*/
|
||||
extern volatile uint8 USBFS_midi_in_ep; /* Input endpoint number */
|
||||
extern uint8 USBFS_midiInBuffer[USBFS_MIDI_IN_BUFF_SIZE]; /* Input endpoint buffer */
|
||||
#endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */
|
||||
#endif /* (USBFS_MIDI_IN_BUFF_SIZE > 0) */
|
||||
|
||||
#if (USBFS_MIDI_OUT_BUFF_SIZE > 0)
|
||||
extern volatile uint8 USBFS_midi_out_ep; /* Output endpoint number */
|
||||
extern uint8 USBFS_midiOutBuffer[USBFS_MIDI_OUT_BUFF_SIZE]; /* Output endpoint buffer */
|
||||
#endif /* USBFS_MIDI_OUT_BUFF_SIZE > 0 */
|
||||
#endif /* (USBFS_MIDI_OUT_BUFF_SIZE > 0) */
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF)
|
||||
extern volatile uint8 USBFS_MIDI1_InqFlags; /* Device inquiry flag */
|
||||
extern volatile uint8 USBFS_MIDI1_InqFlags; /* Device inquiry flag */
|
||||
|
||||
#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF)
|
||||
extern volatile uint8 USBFS_MIDI2_InqFlags; /* Device inquiry flag */
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */
|
||||
#endif /* USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */
|
||||
|
||||
#endif /* USBFS_ENABLE_MIDI_STREAMING */
|
||||
extern volatile uint8 USBFS_MIDI2_InqFlags; /* Device inquiry flag */
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) */
|
||||
#endif /* (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) */
|
||||
/** @} midi */
|
||||
#endif /* (USBFS_ENABLE_MIDI_STREAMING) */
|
||||
|
||||
|
||||
#endif /* CY_USBFS_USBFS_midi_H */
|
||||
/***************************************
|
||||
* The following code is DEPRECATED and
|
||||
* must not be used.
|
||||
***************************************/
|
||||
|
||||
#define USBFS_MIDI_EP_Init USBFS_MIDI_Init
|
||||
#define USBFS_MIDI_OUT_EP_Service USBFS_MIDI_OUT_Service
|
||||
|
||||
#endif /* (CY_USBFS_USBFS_midi_H) */
|
||||
|
||||
|
||||
/* [] END OF FILE */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user