am243x/am64x: SDFM: Enable continuous mode
- Add support for continuous mode Fixes: PINDSW-7112 Signed-off-by: Achala Ram <a-ram@ti.com>
This commit is contained in:
parent
b35879bd82
commit
3c5cc57d30
@ -305,6 +305,11 @@ uint64_t SDFM_getFirmwareVersion(sdfm_handle h_sdfm)
|
|||||||
{
|
{
|
||||||
return h_sdfm->p_sdfm_interface->firmwareVersion;
|
return h_sdfm->p_sdfm_interface->firmwareVersion;
|
||||||
}
|
}
|
||||||
|
/*Enable free run NC */
|
||||||
|
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm)
|
||||||
|
{
|
||||||
|
h_sdfm->p_sdfm_interface->sdfm_cfg_trigger.en_continuous_mode = 1;
|
||||||
|
}
|
||||||
/*FD block confiuration */
|
/*FD block confiuration */
|
||||||
void SDFM_configFastDetect(sdfm_handle h_sdfm, uint8_t ch, uint8_t *fdParms)
|
void SDFM_configFastDetect(sdfm_handle h_sdfm, uint8_t ch, uint8_t *fdParms)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -196,7 +196,8 @@
|
|||||||
|
|
||||||
|
|
||||||
/*Sample timing offset*/
|
/*Sample timing offset*/
|
||||||
#define SDFM_CFG_EN_DOUBLE_UPDATE ( 0xE8 )
|
#define SDFM_CFG_EN_CONT_NC_MODE ( 0xE8 )
|
||||||
|
#define SDFM_CFG_EN_DOUBLE_UPDATE ( 0xEA )
|
||||||
#define FW_REG_SDFM_CFG_FIRST_TRIG_SAMPLE_TIME ( 0xEC )
|
#define FW_REG_SDFM_CFG_FIRST_TRIG_SAMPLE_TIME ( 0xEC )
|
||||||
#define FW_REG_SDFM_CFG_SECOND_TRIG_SAMPLE_TIME ( 0xF0 )
|
#define FW_REG_SDFM_CFG_SECOND_TRIG_SAMPLE_TIME ( 0xF0 )
|
||||||
#define SDFM_CFG_NC_PRD_IEP_CNT_OFFSET ( 0xF4)
|
#define SDFM_CFG_NC_PRD_IEP_CNT_OFFSET ( 0xF4)
|
||||||
|
|||||||
@ -216,6 +216,11 @@ init_sdfm_cont:
|
|||||||
LDI32 OUT_SAMP_BUF_REG, OUT_SAMP_BUF
|
LDI32 OUT_SAMP_BUF_REG, OUT_SAMP_BUF
|
||||||
LDI SAMP_CNT_REG, 0
|
LDI SAMP_CNT_REG, 0
|
||||||
LBCO &EN_DOUBLE_UPDATE, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_EN_DOUBLE_UPDATE, 1
|
LBCO &EN_DOUBLE_UPDATE, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_EN_DOUBLE_UPDATE, 1
|
||||||
|
;NC continuous mode status
|
||||||
|
LBCO &TEMP_REG0.b0, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_EN_CONT_NC_MODE,1
|
||||||
|
LSL TEMP_REG0.b0, TEMP_REG0.b0,1
|
||||||
|
OR EN_DOUBLE_UPDATE, EN_DOUBLE_UPDATE, TEMP_REG0.b0
|
||||||
|
|
||||||
LDI SAMP_NAME, 0
|
LDI SAMP_NAME, 0
|
||||||
|
|
||||||
|
|
||||||
@ -606,6 +611,28 @@ wait_sample_count_incr_oc:
|
|||||||
; Save output sample to local output sample buffer
|
; Save output sample to local output sample buffer
|
||||||
SBBO &CN5, OUT_SAMP_BUF_REG, 8, 4
|
SBBO &CN5, OUT_SAMP_BUF_REG, 8, 4
|
||||||
|
|
||||||
|
;continuous mode check
|
||||||
|
QBBC TRIGGER_MODE, EN_DOUBLE_UPDATE, 1
|
||||||
|
|
||||||
|
;update IEP0 CMP4
|
||||||
|
LBCO &TEMP_REG0, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_NC_PRD_IEP_CNT_OFFSET, 4
|
||||||
|
LBCO &TEMP_REG1, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4 ;
|
||||||
|
ADD TEMP_REG0, TEMP_REG1, TEMP_REG0
|
||||||
|
;read iep counter maximum value
|
||||||
|
LDI TEMP_REG1, 0
|
||||||
|
LBCO &TEMP_REG1, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_IEP_CFG_SIM_EPWM_PRD_OFFSET, 4
|
||||||
|
QBLE UPDATE_CMP_FOR_IEP_RESET, TEMP_REG0, TEMP_REG1
|
||||||
|
;update Cmp4 with old value + next sample time value
|
||||||
|
SBCO &TEMP_REG0, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4
|
||||||
|
JMP END_CMP_UPDATE
|
||||||
|
UPDATE_CMP_FOR_IEP_RESET:
|
||||||
|
;Update cmp4 according to iep reset
|
||||||
|
SUB TEMP_REG0, TEMP_REG0, TEMP_REG1
|
||||||
|
SBCO &TEMP_REG0, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4
|
||||||
|
END_CMP_UPDATE:
|
||||||
|
JMP END_RESET_NC_FRAME
|
||||||
|
|
||||||
|
TRIGGER_MODE:
|
||||||
;Check NC sample count
|
;Check NC sample count
|
||||||
QBLE RESET_NC_FRAME, SAMP_CNT_REG, NC_SAMP_CNT-1
|
QBLE RESET_NC_FRAME, SAMP_CNT_REG, NC_SAMP_CNT-1
|
||||||
; NC sample count < NC_SAMP_CNT-1
|
; NC sample count < NC_SAMP_CNT-1
|
||||||
|
|||||||
@ -66,7 +66,10 @@ const uint32_t pru_SDFM_PRU0_image_0[] = {
|
|||||||
0x240000d4,
|
0x240000d4,
|
||||||
0x24020094,
|
0x24020094,
|
||||||
0x2400001c,
|
0x2400001c,
|
||||||
0x91e8187c,
|
0x91ea187c,
|
||||||
|
0x91e81801,
|
||||||
|
0x09010101,
|
||||||
|
0x12017c7c,
|
||||||
0x2400003c,
|
0x2400003c,
|
||||||
0x91001a01,
|
0x91001a01,
|
||||||
0x1f00e1e1,
|
0x1f00e1e1,
|
||||||
@ -237,6 +240,18 @@ const uint32_t pru_SDFM_PRU0_image_0[] = {
|
|||||||
0x10e7e7f1,
|
0x10e7e7f1,
|
||||||
0x10f5e8e8,
|
0x10f5e8e8,
|
||||||
0xe1083488,
|
0xe1083488,
|
||||||
|
0xc9017c0c,
|
||||||
|
0x91f43881,
|
||||||
|
0x91983a82,
|
||||||
|
0x00e1e2e1,
|
||||||
|
0x240000e2,
|
||||||
|
0x91083882,
|
||||||
|
0x58e2e103,
|
||||||
|
0x81983a81,
|
||||||
|
0x2100f400,
|
||||||
|
0x04e2e1e1,
|
||||||
|
0x81983a81,
|
||||||
|
0x21010700,
|
||||||
0x59031c07,
|
0x59031c07,
|
||||||
0x91f43881,
|
0x91f43881,
|
||||||
0x91983a82,
|
0x91983a82,
|
||||||
|
|||||||
@ -328,6 +328,39 @@ uint32_t SDFM_getPwmTripStatus(sdfm_handle h_sdfm, uint8_t pwmIns);
|
|||||||
void SDFM_clearPwmTripStatus(sdfm_handle h_sdfm, uint8_t pwmIns);
|
void SDFM_clearPwmTripStatus(sdfm_handle h_sdfm, uint8_t pwmIns);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \brief This API enbale continuous normal current sampling
|
||||||
|
*
|
||||||
|
* \param[in] h_sdfm SDFM handle
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \brief This API enbale continuous normal current sampling
|
||||||
|
*
|
||||||
|
* \param[in] h_sdfm SDFM handle
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \brief This API enbale continuous normal current sampling
|
||||||
|
*
|
||||||
|
* \param[in] h_sdfm SDFM handle
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* \brief Measure Clock phase compensation
|
* \brief Measure Clock phase compensation
|
||||||
|
|||||||
@ -153,8 +153,9 @@ typedef struct SDFM_CfgSdClk_s
|
|||||||
*/
|
*/
|
||||||
typedef struct SDFM_CfgTrigger_s
|
typedef struct SDFM_CfgTrigger_s
|
||||||
{
|
{
|
||||||
|
volatile uint8_t en_continuous_mode;
|
||||||
/**< bit-field for enable double update */
|
/**< bit-field for enable double update */
|
||||||
volatile uint16_t en_double_nc_sampling;
|
volatile uint8_t en_double_nc_sampling;
|
||||||
/**< First sample starting point */
|
/**< First sample starting point */
|
||||||
volatile uint32_t first_samp_trig_time;
|
volatile uint32_t first_samp_trig_time;
|
||||||
/**<Second sample starting point*/
|
/**<Second sample starting point*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user