1 #include <system_def.h>
6 #include "appl_utils.h"
8 #ifdef APPL_WITH_ZYNQ_DRV
9 #include "zynq_3pmdrv1_mc.h"
12 #include "rpi_gpclk.h"
18 fprintf(stderr, "Application abnormal termination\n");
20 /* stop clock pin driving FPGA to ensure failase state */
21 #ifndef APPL_WITH_ZYNQ_DRV
22 rpi_gpio_direction_output(4, 0);
26 /***********************************/
27 int main(int argc, char *argv[])
29 appl_setup_environment(argv[0]);
31 #ifdef APPL_RPI_PMSM_SETUP_CLKOUT
33 /* initialize 50 Mhz clock output on gpio 4 */
34 if (rpi_peripheral_registers_map() < 0) {
35 fprintf(stderr, "%s: rpi_peripheral_registers_map failed\n", argv[0]);
39 if (rpi_gpclk_setup(0, RPI_GPCLK_PLLD_500_MHZ, 10, 0) < 0) {
40 fprintf(stderr, "%s: rpi_gpclk_setup failed\n", argv[0]);
44 if (rpi_gpio_alt_fnc(4 /*gpio*/, 0/*alt_fnc*/) < 0) {
45 fprintf(stderr, "%s: rpi_gpio_alt_fnc failed\n", argv[0]);
49 #endif /* APPL_RPI_PMSM_SETUP_CLKOUT */