Its quite simple..
1. You must be able to PWM the clock port of the L297 driver. To do this set a count value of say 255, use another variable and set the desired PWM frequency to say 200 (must not exceed 255), setup a timer, so that it ticks at regular interval of approx. 1-2 msec (the timing is not critical here as we are only setting up the port).
Make the clock port high, use another variable (counter) and increment the value at every interrupt, when the variable reaches the desired PWM frequency of 200 make the clock port low, make counter=0 and count till 55 ( count value-desired frequency or 255-200). When counter reaches 55 make the clock port high, set counter=0 and repeat the process.
By changing the desired frequency value you can adjust the PWM rate, but take care not exceed the max count value of 255.
2. To get the trapezoidal motion first get the maximum revs the motor has to move, then decide on the acceleration and de-acceleration ramps.