kopia lustrzana https://github.com/F5OEO/PiFmRds
Kill the carrier upon exit
rodzic
589e825b33
commit
6d8fe70793
|
@ -236,6 +236,15 @@ udelay(int us)
|
||||||
static void
|
static void
|
||||||
terminate(int num)
|
terminate(int num)
|
||||||
{
|
{
|
||||||
|
// Stop outputting and generating the clock.
|
||||||
|
if (clk_reg && gpio_reg && mbox.virt_addr) {
|
||||||
|
// Set GPIO4 to be an output (instead of ALT FUNC 0, which is the clock).
|
||||||
|
gpio_reg[GPFSEL0] = (gpio_reg[GPFSEL0] & ~(7 << 12)) | (1 << 12);
|
||||||
|
|
||||||
|
// Disable the clock generator.
|
||||||
|
clk_reg[GPCLK_CNTL] = 0x5A;
|
||||||
|
}
|
||||||
|
|
||||||
if (dma_reg && mbox.virt_addr) {
|
if (dma_reg && mbox.virt_addr) {
|
||||||
dma_reg[DMA_CS] = BCM2708_DMA_RESET;
|
dma_reg[DMA_CS] = BCM2708_DMA_RESET;
|
||||||
udelay(10);
|
udelay(10);
|
||||||
|
@ -250,7 +259,7 @@ terminate(int num)
|
||||||
mem_free(mbox.handle, mbox.mem_ref);
|
mem_free(mbox.handle, mbox.mem_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Terminating: cleanly deactivated the DMA engine.\n");
|
printf("Terminating: cleanly deactivated the DMA engine and killed the carrier.\n");
|
||||||
|
|
||||||
exit(num);
|
exit(num);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +344,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
|
||||||
printf("virt_addr = %p\n", mbox.virt_addr);
|
printf("virt_addr = %p\n", mbox.virt_addr);
|
||||||
|
|
||||||
|
|
||||||
// GPIO4 needs to be ALT FUNC 0 to otuput the clock
|
// GPIO4 needs to be ALT FUNC 0 to output the clock
|
||||||
gpio_reg[GPFSEL0] = (gpio_reg[GPFSEL0] & ~(7 << 12)) | (4 << 12);
|
gpio_reg[GPFSEL0] = (gpio_reg[GPFSEL0] & ~(7 << 12)) | (4 << 12);
|
||||||
|
|
||||||
// Program GPCLK to use MASH setting 1, so fractional dividers work
|
// Program GPCLK to use MASH setting 1, so fractional dividers work
|
||||||
|
|
Ładowanie…
Reference in New Issue