summaryrefslogtreecommitdiff
path: root/2.3-1/src/c
diff options
context:
space:
mode:
authorimushir2016-02-09 17:00:34 +0530
committerimushir2016-02-09 17:00:34 +0530
commit65ca99dd846281e3d1c3066697ad260df0d0909e (patch)
tree53b01af3e50678970b009c774479bc43b4c15bc4 /2.3-1/src/c
parenta6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e (diff)
parent58b8656a350fed1a1e59caa484e6d9967dd1bc4d (diff)
downloadScilab2C-65ca99dd846281e3d1c3066697ad260df0d0909e.tar.gz
Scilab2C-65ca99dd846281e3d1c3066697ad260df0d0909e.tar.bz2
Scilab2C-65ca99dd846281e3d1c3066697ad260df0d0909e.zip
merged RPi & diag
Diffstat (limited to '2.3-1/src/c')
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c30
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c30
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c38
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h22
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h20
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h27
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h23
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/libraries/libbcm2835.abin0 -> 59846 bytes
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/libraries/libcblas.abin0 -> 261416 bytes
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/libraries/libgfortran.abin0 -> 1569996 bytes
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/libraries/liblapack.abin0 -> 6869860 bytes
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/libraries/librefblas.abin0 -> 441848 bytes
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c29
-rw-r--r--2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c30
14 files changed, 249 insertions, 0 deletions
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
new file mode 100644
index 00000000..6f065586
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c
@@ -0,0 +1,30 @@
+// Function to read the state of the gpio pin
+//
+// Calling Sequence
+// u8RPI_DigitalIn(pin)
+//
+// Parameters
+// pin : pin of RPi to be read
+//
+// Returns
+// state: Current state of the specified gpio pin
+//
+// Description
+// There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. Using this function, current state (low/high) of any gpio pin can be read. 'pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon state of the pin (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
+// Examples
+// u8RPI_DigitalIn(RPI_GPIO_P1_03,1) //Returns the state of pin 3 of header P1
+//
+//
+// Authors
+// Siddhesh Wani
+//
+
+#include "types.h"
+#include "RPIPeripheralDigital.h"
+
+uint8 u8RPIDigitalIns(uint8 pin)
+{
+ uint8 state = 0;
+ state = bcm2835_gpio_lev(pin);
+ return (state);
+}
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
new file mode 100644
index 00000000..375ca891
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c
@@ -0,0 +1,30 @@
+// Function to change the output state of the gpio pin
+//
+// Calling Sequence
+// u8RPI_DigitalOuts(pin,state)
+//
+// Parameters
+// pin : pin of RPi to be used
+// state : desired output state for pin (0 -> LOW, 1 -> HIGH)
+//
+// Description
+// There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. 'Pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon desired output (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function.
+// Examples
+// u8RPI_DigitalOuts(RPI_GPIO_P1_03,1) //Sets pin 3 of header P1 as 'high' output
+//
+//
+// Authors
+// Siddhesh Wani
+//
+
+#include "types.h"
+#include "RPIPeripheralDigital.h"
+
+
+uint8 u8RPIDigitalOuts(uint8 pin, uint8 state)
+{
+ if (state == 0) //low output
+ bcm2835_gpio_clr(pin);
+ if (state == 1) //high output
+ bcm2835_gpio_set(pin);
+}
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
new file mode 100644
index 00000000..277c620f
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
@@ -0,0 +1,38 @@
+// Function to setup digital pins.
+//
+// Calling Sequence
+// u8RPI_DigitalSetup(pin,direction)
+//
+// Parameters
+// pin : pin of RPi to be used
+// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT)
+//
+// Description
+// There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output)
+// Examples
+// RPI_DigitalSetup(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input
+//
+// See also
+// RPI_DigitalIn RPI_DigitalOut
+//
+//
+// Authors
+// Siddhesh Wani
+//
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for RPi.
+#include "types.h"
+#include "RPIPeripheralDigital.h"
+
+uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction)
+{
+ if(direction == 1) //Pin to be used as output
+ {
+ bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_OUTP);
+ }
+ else
+ {
+ bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT);
+ }
+}
diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
new file mode 100644
index 00000000..575a8b43
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h
@@ -0,0 +1,22 @@
+/* This file declares functions and constants related to GPIO pins*/
+
+#ifndef __RPIPERIPHERALGPIO_H__
+#define __RPIPERIPHERALGPIO_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "types.h"
+#include "bcm2835.h"
+
+uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction);
+uint8 u8RPIDigitalOuts(uint8 pin, uint8 state);
+uint8 u8RPIDigitalIns(uint8 pin);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif //__RPIPERIPHERALGPIO_H__
diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h
new file mode 100644
index 00000000..809595f3
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h
@@ -0,0 +1,20 @@
+/* This file declares functions and constants related to rasberrypi*/
+
+#ifndef __RPIPERIPHERALUTIL_H__
+#define __RPIPERIPHERALUTIL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "types.h"
+#include "bcm2835.h"
+
+uint8 u16RPIDelayMillis(uint16 time);
+uint8 u16RPIDelayMicros(uint16 time);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif //__RPIPERIPHERALUTIL_H__
diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
new file mode 100644
index 00000000..022bed56
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h
@@ -0,0 +1,27 @@
+//This file defines constants corresponding to gpios.
+//
+// Authors
+// Siddhesh Wani
+//
+
+#ifndef __INT_RPIPERIPHERALGPIO_H__
+#define __INT_RPIPERIPHERALGPIO_H__
+
+#include "types.h"
+#include "RPIPeripheralDigital.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPI_DigitalSetup(in1,in2) u8RPIDigitalSetups((uint8) in1, (uint8) in2);
+
+#define RPI_DigitalIn(in1,in2) u8RPIDigitalIns((uint8) in1);
+
+#define RPI_DigitalOut(in1,in2) u8RPIDigitalOuts((uint8) in1, (uint8) in2);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !__RPIPERIPHERALGPIO_H__ */
diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h
new file mode 100644
index 00000000..92020f9a
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h
@@ -0,0 +1,23 @@
+//
+// Authors
+// Siddhesh Wani
+//
+
+#ifndef __INT_RPIPERIPHERALUTIL_H__
+#define __INT_RPIPERIPHERALUTIL_H__
+
+#include "types.h"
+#include "RPIPeripheralUtil.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPI_DelayMicro(in1) u16RPIDelayMicros((uint16) in1);
+#define RPI_DelayMilli(in1) u16RPIDelayMillis((uint16) in1);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !__RPIPERIPHERALUTIL_H__ */
diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/libbcm2835.a b/2.3-1/src/c/hardware/rasberrypi/libraries/libbcm2835.a
new file mode 100644
index 00000000..bab5afcf
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/libraries/libbcm2835.a
Binary files differ
diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/libcblas.a b/2.3-1/src/c/hardware/rasberrypi/libraries/libcblas.a
new file mode 100644
index 00000000..7a460be9
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/libraries/libcblas.a
Binary files differ
diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/libgfortran.a b/2.3-1/src/c/hardware/rasberrypi/libraries/libgfortran.a
new file mode 100644
index 00000000..7aacee8f
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/libraries/libgfortran.a
Binary files differ
diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/liblapack.a b/2.3-1/src/c/hardware/rasberrypi/libraries/liblapack.a
new file mode 100644
index 00000000..726f2b99
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/libraries/liblapack.a
Binary files differ
diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/librefblas.a b/2.3-1/src/c/hardware/rasberrypi/libraries/librefblas.a
new file mode 100644
index 00000000..300a0db5
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/libraries/librefblas.a
Binary files differ
diff --git a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c
new file mode 100644
index 00000000..e564d882
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c
@@ -0,0 +1,29 @@
+// Function to insert some delay in code execution.
+//
+// Calling Sequence
+// u16RPIDelayMicros(time)
+//
+// Parameters
+// time: time(microseconds) for which execution is to be delayed
+//
+// Description
+// this function can be used for insertig execution delays. 'time' should be
+// specified in microseconds.'time' should be between (1-65536).
+// Note: Delay inserted by this function is not accurate, but depedent on
+// operating system, other running tasks etc.
+//
+// Examples
+// u16RPIDelayMicros(100) //This will delay the execution of next code by 100 ms.
+//
+//
+// Authors
+// Siddhesh Wani
+//
+#include "types.h"
+#include "RPIPeripheralUtil.h"
+
+uint8 u16RPIDelayMicros(uint16 time)
+{
+ bcm2835_delayMicroseconds(time);
+}
+
diff --git a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c
new file mode 100644
index 00000000..bc2e6dd0
--- /dev/null
+++ b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c
@@ -0,0 +1,30 @@
+// Function to insert some delay in code execution.
+//
+// Calling Sequence
+// u16RPIDelayMillis(time)
+//
+// Parameters
+// time: time(milliseconds) for which execution is to be delayed
+//
+// Description
+// this function can be used for insertig execution delays. 'time' should be
+// specified in milliseconds.'time' should be between (1-65536).
+// Note: Delay inserted by this function is not accurate, but depedent on
+// operating system, other running tasks etc.
+//
+// Examples
+// u16RPIDelayMillis(100) //This will delay the execution of next code by 100 ms.
+//
+//
+// Authors
+// Siddhesh Wani
+//
+#include "types.h"
+#include "RPIPeripheralUtil.h"
+
+uint8 u16RPIDelayMillis(uint16 time)
+{
+ bcm2835_delay(time);
+
+}
+