Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sharkduino+/otFPGA.h File Reference

FPGA Library for SharkDuino+. More...

#include "otdefs.h"

Defines

#define FPGA_DATA   (*((volatile unsigned char *) 0x20100000))
 FPGA Register data.
#define FPGA_RADD   (*((volatile unsigned char *) 0x20100002))
 FPGA Register address.

Enumerations

enum  FpgaRegisterAddress {
  FPGA_PA, FPGA_PB, FPGA_PC, FPGA_PD,
  FPGA_PE, FPGA_PF, FPGA_PG, FPGA_PH,
  FPGA_PI, FPGA_PK, FPGA_PL, FPGA_PM,
  FPGA_PN, FPGA_PO, FPGA_PP, FPGA_PQ,
  FPGA_PX_DATA, FPGA_PX_DIR, FPGA_PX_FUNL, FPGA_PX_FUNH,
  FPGA_CPL_DATA, FPGA_CPL_DIR, FPGA_CPL_FUNL, FPGA_CPL_FUNH,
  FPGA_CPH_DATA, FPGA_CPH_DIR, FPGA_CPH_FUNL, FPGA_CPH_FUNH,
  FPGA_PR, FPGA_PS, FPGA_PT, FPGA_PU,
  FPGA_PV, FPGA_AUX1, FPGA_AUX2, FPGA_AUX3,
  FPGA_FIFO, FPGA_LB_ADD, FPGA_LB_DATA
}
enum  TimerTimeBase { TTB_1KHZ, TTB_2_5MHZ, TTB_PLLCLK, TTB_25MHZ }
enum  Timers { F_TIMER_0, F_TIMER_1 }
enum  Encoders { ENCODER_0, ENCODER_1, ENCODER_2, ENCODER_3 }
enum  EncoderClock { E_250KHz, E_500KHz, E_2_5MHZ, E_25MHZ }
enum  EncoderZeroEnable { E_0_ZERO = 0x20, E_1_ZERO = 0x40, E_23_ZERO = 0x80 }
enum  EncoderZeroInput { E_0_ZERO_PORTX = 0x01, E_0_ZERO_PCAM = 0x00, E_1_ZERO_PORTX = 0x02, E_1_ZERO_PCAM }
enum  EncoderInput {
  E_0_PCAM = 0x04, E_0_PORTX = 0x00, E_1_PCAM = 0x08, E_1_PORTX = 0x00,
  E_2_PCAM = 0x10, E_2_PORTX = 0x00, E_3_PCAM = 0x20, E_3_PORTX = 0x00
}
enum  EventInput {
  EI_PX_0, EI_PX_1, EI_PX_2, EI_PX_3,
  EI_PX_4, EI_PX_5, EI_PX_6, EI_PX_7,
  EI_PCAM_0, EI_PCAM_1, EI_PCAM_2, EI_PCAM_3,
  EI_PCAM_4, EI_PCAM_5, EI_PCAM_6, EI_PCAM_7
}
enum  EventFunctions { EVF_COUNTER, EVF_FREQUENCY, EVF_PULSEMEASURE }
enum  PortSettings {
  PD_OUTPUT, PD_FUNC_1, PD_FUNC_2, PD_FUNC_3,
  PD_INPUT
}
enum  CameraSocket {
  SOCK_1, SOCK_2, SOCK_3, SOCK_4,
  SOCK_5
}
enum  HiddenPort { HP_STDBY_CTRL = 0x04, HP_STDBY = 0x08, HP_LCD_LED = 0x40, HP_EXT_I2C = 0x10 }
enum  InterruptSignals {
  IS_TOUCH = 1, IS_EXTINT = 2, IS_IMU = 4, IS_TRIGX = 8,
  IS_AUXIN = 16
}

Functions

void FpgaInit ()
 Init the system FPGA. Call this function as first.
void FpgaRegWrite (int reg, U16 val)
 Write a FPGA register.
U16 FpgaRegRead (int reg)
 Read a FPGA register.
void FpgaSetPll (int n, int m, int u, int vco)
 Write registers of the clock synthesizer (PLL) Use FpgaPllConfig instead.
float FpgaPllConfig (int n, int m, int u)
 Clock synthesizer (PLL) configurator. Configure the PLL to set a requested frequency.
Output clock as Mhz = (25 / n * m) / u
Frequency range is 1.5 to 350MHz.
void FpgaSpiSelect (U8 sel)
 Select a chip select for a SPI device.
void FpgaSpiWrite (U8 val)
 Write a byte on the SPI channel reserved on PCAM port.
void FpgaSpiWrite16 (U16 val)
 Write a word on the SPI channel reserved on PCAM port.
void FpgaTimerSet (U8 timer, U8 timeBase, U16 count)
 Set Timer 0/1.
Output frequency 2: timeBase / ((n - 1) * 2). Duty cycle: 50%
Output frequency 1: timeBase / (n - 1). Duty Cycle: asymmetrical.
void FpgaTimerEnable (U8 timer, bool ena)
 Enable Timer 0/1.
.
void FpgaEncoderSetup (U8 signalSource, U8 timeBase, U8 zeroSignals)
 Configure all encoders 3:0.
.
S16 FpgaEncoderRead (U8 encoder)
 Read selected encoder counts.
.
void FpgaEncoderClear (U8 encoder)
 Clear selected encoder counter.
.
void FpgaEventFunction (U8 input, U8 fun, float tb)
 Configure the event counter.
Event counter can be configured as Counter, Frequency meter or Pulse width measurement.
void FpgaEventGate (bool ena)
 Enable the gate of the event counter.
void FpgaEventSignalInvert (bool ena)
 Set the level of the input for the event counter.
void FpgaEventReset ()
 Clear the event counter.
void FpgaEventClearRead ()
 Clear the EVENT DONE flag.
bool FpgaEventDone ()
 Check the EVENT DONE flag.
U32 FpgaEventRead ()
 Read the event read counter.
void FpgaPortPxSet (U8 bit0, U8 bit1, U8 bit2, U8 bit3, U8 bit4, U8 bit5, U8 bit6, U8 bit7)
 Configure the port PX (Y12). Each bit can be configured as bidirectional port or as preset function.
See PortSettings for set of bit and also see PX Port - Signals and functions for all possibilities.
U8 FpgaPxGet ()
 Read the contents of the port signal.
void FpgaPxPut (U8 dat)
 Write a data on the port.
void FpgaPCamlSet (U8 bit0, U8 bit1, U8 bit2, U8 bit3, U8 bit4, U8 bit5, U8 bit6, U8 bit7)
 Configure the port PCAM (Y11) in the range 7:0.
Each bit can be configured as bidirectional port or as preset function.
See PortSettings for set of bit and also see PCAM - Camera port for all possibilities.
U8 FpgaPCamlGet ()
 Read the contents of the port PCAM in the range 7:0.
void FpgaPCamlPut (U8 dat)
 Write a data on the port PCAM in the range 7:0.
void FpgaPCamhSet (U8 bit8, U8 bit9, U8 bit10, U8 bit11, U8 bit12, U8 bit13, U8 bit14, U8 bit15)
 Configure the port PCAM (Y11) in the range 15:8
Each bit can be configured as bidirectional port or as preset function.
See PortSettings for set of bit and also see PCAM - Camera port for all possibilities.
U8 FpgaPCamhGet ()
 Read the contents of the port PCAM in the range 15:8.
void FpgaPCamhPut (U8 dat)
 Write a data on the port PCAM in the range 15:8.
void FpgaSetCamBus (int bus, bool mask10bit)
 Configure the PCAM port a for specific bus of a related camera.
void FpgaSetCamBusWidth (int bus)
 Select a different size of the camera bus.
U8 FpgaIntSource ()
 Identifies the source that generated an interrupt.
void FpgaIntClear ()
 Clear the interrupt request.
void FpgaIntEnable (bool ena)
 Enable/disable interrupt.
void FpgaInterruptSignals (U8 bit, bool invert)
 Invert an interrupt signal level see InterruptSignals.
void FpgaHiddenPort (U8 value, bool ena)
 Enable or disable a bit of the hidden port.
void FpgaSenWrite (U16 add, U16 val)
 Specific function for Tiziano camera. Don't use! Reserved!
void FpgaLocalBusEnable ()
 Enable DSP local bus on Y11 connector. Only with FPGA ver. >= 1.5.
void FpgaLocalBusAddress (U8 add)
 Set the address A[3:0] of the local bus.
void FpgaLocalBusWrite (U8 data)
 Write data on the local bus.
void FpgaLocalBusReadEnable (bool ena)
 Enable/disable local bus direction.
U8 FpgaLocalBusRead ()
 Read data from local bus.


Detailed Description

Version:
1.0.0
Author:
Manuele Turini
footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0