The codes P0335 & P0340 can be caused by a bad cam sensor, a bad connection at the sensor, a problem with the wiring to the sensor, or a problem with the computer.
To check if it’s the sensor, insert a stick pin into the back of the sensor connector. On the black wire check for ground. On the red wire check for volltage into the sensor with the ignition switch on. The blue/yellow wire is the signal out from the sensor. But to check for this you’ll need a scopemeter to check the pulse signals out of the sensor while the engine’s running.
The shift control solenoid codes are going to be a little more involved as the solenoids are mounted on the valve body inside the transmission. But try this. Locate the automatic transmission control relay and try swapping the relay with another in the vehicle with the same part number. This relay is what energizes the B & C solenoids.