For changing the state machine you need to use CyU3PGpifDisable (1); to disable the current state machine, CyU3PGpifLoad (DOWNLOAD), to load the new state machine and then CyU3PGpifStart.
Also, make sure that the DMA Channels are also modified (or make sure that the DMA Channels are suitable for the new state machine also. You might have to destroy the old DMA Channel and create new channel for the new state machine, if necessary (according to your design. )
Your approach is fine.
- Madhu Sudhan