Skip to content

Commit

Permalink
Revert "automate module installation & device tree update"
Browse files Browse the repository at this point in the history
This reverts commit fd49417.
  • Loading branch information
Rubberazer committed Aug 4, 2024
1 parent fd49417 commit f6e8fd4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 116 deletions.
11 changes: 0 additions & 11 deletions jetgpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,6 @@ For more information, please refer to <http://unlicense.org/>
#define SPI_RESERVED 1
#define SPI_OPENED 2

/* Externel peripheral clocks on Orin */

#define EXTPERIPH3 3
#define EXTPERIPH4 4

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -685,12 +680,6 @@ int spiXfer(unsigned handle, char *txBuf, char *rxBuf, unsigned len);
* @code spiXfer(SPI_init, tx, rx, 7); //transfers tx data with a data lenght of 7 words and receiving rx data from prevously opened connection with handle SPI_init @endcode
*/

int extPeripheralRate(unsigned clk_name, unsigned rate);

int extPeripheralEnable(unsigned clk_name);

int extPeripheralDisable(unsigned clk_name);

#ifdef __cplusplus
}
#endif
Expand Down
104 changes: 1 addition & 103 deletions orin.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ For more information, please refer to <http://unlicense.org/>
#include <pthread.h>
#include <linux/version.h>

#include "Jetclocks/jetclocks.h"
#include "jetgpio.h"

#define BILLION 1000000000L
Expand Down Expand Up @@ -2729,8 +2728,7 @@ int spiClose(unsigned handle) {
int spiXfer(unsigned handle, char *txBuf, char *rxBuf, unsigned len) {
int ret = 0;
struct spi_ioc_transfer tr;
memset(&tr, 0, sizeof(tr));


if (handle > 2) {
printf( "Bad handle (%d)\n", handle);
return -1;
Expand All @@ -2753,103 +2751,3 @@ int spiXfer(unsigned handle, char *txBuf, char *rxBuf, unsigned len) {
}
return ret;
}

int extPeripheralRate(unsigned clk_name, unsigned rate) {
struct jetclk clock;
memset(&clock, 0, sizeof(clock));

if (rate < 3200000 || rate > 51000000) {
printf( "Clock rate should be a number between 81600000 and 3875000 Hz\n");
return -1;
}
clock.clk_set_rate = rate;

int dev = open("/dev/jetclocks", O_WRONLY);
if(dev < 0) {
printf("Opening /dev/jetclocks not possible\n");
return -2;
}

switch (clk_name) {

case EXTPERIPH3:
strncpy(clock.clk, "extperiph3", sizeof(clock.clk));
ioctl(dev, CLK_SET_RATE, &clock);
break;
case EXTPERIPH4:
strncpy(clock.clk, "extperiph4", sizeof(clock.clk));
ioctl(dev, CLK_SET_RATE, &clock);
break;
default:
printf("Only EXTPERIPH3 and EXTPERIPH4 values are accepted\n");
break;
}
close(dev);
return 0;
}

int extPeripheralEnable(unsigned clk_name) {
struct jetclk clock;
memset(&clock, 0, sizeof(clock));

int dev = open("/dev/jetclocks", O_WRONLY);
if(dev < 0) {
printf("Opening /dev/jetclocks not possible\n");
return -2;
}

switch (clk_name) {

case EXTPERIPH3:
strncpy(clock.clk, "extperiph3", sizeof(clock.clk));
ioctl(dev, CLK_ENABLE, &clock);
*pinmux29 = 0x401;
*pincfg29 = CFGO_OUT;
pin29->CNF[0] = 0x3;
break;
case EXTPERIPH4:
strncpy(clock.clk, "extperiph4", sizeof(clock.clk));
ioctl(dev, CLK_ENABLE, &clock);
*pinmux31 = 0x401;
*pincfg31 = CFGO_OUT;
pin31->CNF[0] = 0x3;
break;
default:
printf("Only EXTPERIPH3 and EXTPERIPH4 values are accepted\n");
break;
}
close(dev);
return 0;
}

int extPeripheralDisable(unsigned clk_name) {
struct jetclk clock;
memset(&clock, 0, sizeof(clock));

int dev = open("/dev/jetclocks", O_WRONLY);
if(dev < 0) {
printf("Opening /dev/jetclocks not possible\n");
return -2;
}

switch (clk_name) {

case EXTPERIPH3:
strncpy(clock.clk, "extperiph3", sizeof(clock.clk));
ioctl(dev, CLK_DISABLE, &clock);
*pinmux29 = 0x0;
pin29->CNF[0] = 0x0;
break;
case EXTPERIPH4:
strncpy(clock.clk, "extperiph4", sizeof(clock.clk));
ioctl(dev, CLK_DISABLE, &clock);
*pinmux31 = 0x0;
pin31->CNF[0] = 0x0;
break;
default:
printf("Only EXTPERIPH3 and EXTPERIPH4 values are accepted\n");
break;
}
close(dev);
return 0;
}
3 changes: 1 addition & 2 deletions orinagx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2713,8 +2713,7 @@ int spiClose(unsigned handle) {
int spiXfer(unsigned handle, char *txBuf, char *rxBuf, unsigned len) {
int ret = 0;
struct spi_ioc_transfer tr;
memset(&tr, 0, sizeof(tr));


if (!(handle == 0) ) {
printf( "Bad handle (%d)\n", handle);
return -1;
Expand Down

0 comments on commit f6e8fd4

Please sign in to comment.