Skip to content

Commit

Permalink
First build.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamichal committed Dec 21, 2014
0 parents commit f138f26
Show file tree
Hide file tree
Showing 57 changed files with 7,390 additions and 0 deletions.
59 changes: 59 additions & 0 deletions eZ_include/usbstk5515.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* Board Setup
*
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "usbstk5515.h"

/* ------------------------------------------------------------------------ *
* *
* USBSTK5515_wait( delay ) *
* *
* Wait in a software loop for 'x' delay *
* *
* ------------------------------------------------------------------------ */
void USBSTK5515_wait( Uint32 delay )
{
volatile Uint32 i;
for ( i = 0 ; i < delay ; i++ ){ };
}

/* ------------------------------------------------------------------------ *
* *
* _waitusec( usec ) *
* *
* Wait in a software loop for 'x' microseconds *
* *
* ------------------------------------------------------------------------ */
void USBSTK5515_waitusec( Uint32 usec )
{
USBSTK5515_wait( (Uint32)usec * 8 );
}

/* ------------------------------------------------------------------------ *
* *
* USBSTK5515_init( ) *
* *
* Setup board board functions *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_init( )
{
/* Enable clocks to all peripherals */
SYS_PCGCR1 = 0x0000;
SYS_PCGCR2 = 0x0000;

return 0;
}
#ifdef __cplusplus
} // extern "C" {
#endif
117 changes: 117 additions & 0 deletions eZ_include/usbstk5515.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* Definitions & Register
*
*/

/* ------------------------------------------------------------------------ *
* Variable types *
* ------------------------------------------------------------------------ */

#ifdef __cplusplus
extern "C" {
#endif


#define Uint32 unsigned long
#define Uint16 unsigned short
#define Uint8 unsigned char
#define Int32 int
#define Int16 short
#define Int8 char

#define SW_BREAKPOINT while(1);
/* ------------------------------------------------------------------------ *
* System Module *
* ------------------------------------------------------------------------ */
#define SYS_EXBUSSEL *(volatile ioport Uint16*)(0x1c00)
#define SYS_PCGCR1 *(volatile ioport Uint16*)(0x1c02)
#define SYS_PCGCR2 *(volatile ioport Uint16*)(0x1c03)
#define SYS_PRCNTR *(volatile ioport Uint16*)(0x1c04)
#define SYS_PRCNTRLR *(volatile ioport Uint16*)(0x1c05)
#define SYS_GPIO_DIR0 *(volatile ioport Uint16*)(0x1c06)
#define SYS_GPIO_DIR1 *(volatile ioport Uint16*)(0x1c07)
#define SYS_GPIO_DATAIN0 *(volatile ioport Uint16*)(0x1c08)
#define SYS_GPIO_DATAIN1 *(volatile ioport Uint16*)(0x1c09)
#define SYS_GPIO_DATAOUT0 *(volatile ioport Uint16*)(0x1c0a)
#define SYS_GPIO_DATAOUT1 *(volatile ioport Uint16*)(0x1c0b)
#define SYS_OUTDRSTR *(volatile ioport Uint16*)(0x1c16)
#define SYS_SPPDIR *(volatile ioport Uint16*)(0x1c17)

/* ------------------------------------------------------------------------ *
* I2C Module *
* ------------------------------------------------------------------------ */

#define I2C_IER *(volatile ioport Uint16*)(0x1A04)
#define I2C_STR *(volatile ioport Uint16*)(0x1A08)
#define I2C_CLKL *(volatile ioport Uint16*)(0x1A0C)
#define I2C_CLKH *(volatile ioport Uint16*)(0x1A10)
#define I2C_CNT *(volatile ioport Uint16*)(0x1A14)
#define I2C_DRR *(volatile ioport Uint16*)(0x1A18)
#define I2C_SAR *(volatile ioport Uint16*)(0x1A1C)
#define I2C_DXR *(volatile ioport Uint16*)(0x1A20)
#define I2C_MDR *(volatile ioport Uint16*)(0x1A24)
#define I2C_EDR *(volatile ioport Uint16*)(0x1A2C)
#define I2C_PSC *(volatile ioport Uint16*)(0x1A30)
/* ------------------------------------------------------------------------ *
* I2S Module *
* ------------------------------------------------------------------------ */
#define I2S0_CR *(volatile ioport Uint16*)(0x2800)
#define I2S0_SRGR *(volatile ioport Uint16*)(0x2804)
#define I2S0_W0_LSW_W *(volatile ioport Uint16*)(0x2808)
#define I2S0_W0_MSW_W *(volatile ioport Uint16*)(0x2809)
#define I2S0_W1_LSW_W *(volatile ioport Uint16*)(0x280C)
#define I2S0_W1_MSW_W *(volatile ioport Uint16*)(0x280D)
#define I2S0_IR *(volatile ioport Uint16*)(0x2810)
#define I2S0_ICMR *(volatile ioport Uint16*)(0x2814)
#define I2S0_W0_LSW_R *(volatile ioport Uint16*)(0x2828)
#define I2S0_W0_MSW_R *(volatile ioport Uint16*)(0x2829)
#define I2S0_W1_LSW_R *(volatile ioport Uint16*)(0x282C)
#define I2S0_W1_MSW_R *(volatile ioport Uint16*)(0x282D)
/* I2S2 */
#define I2S2_CR *(volatile ioport Uint16*)(0x2A00)
#define I2S2_SRGR *(volatile ioport Uint16*)(0x2A04)
#define I2S2_W0_LSW_W *(volatile ioport Uint16*)(0x2A08)
#define I2S2_W0_MSW_W *(volatile ioport Uint16*)(0x2A09)
#define I2S2_W1_LSW_W *(volatile ioport Uint16*)(0x2A0C)
#define I2S2_W1_MSW_W *(volatile ioport Uint16*)(0x2A0D)
#define I2S2_IR *(volatile ioport Uint16*)(0x2A10)
#define I2S2_ICMR *(volatile ioport Uint16*)(0x2A14)
#define I2S2_W0_LSW_R *(volatile ioport Uint16*)(0x2A28)
#define I2S2_W0_MSW_R *(volatile ioport Uint16*)(0x2A29)
#define I2S2_W1_LSW_R *(volatile ioport Uint16*)(0x2A2C)
#define I2S2_W1_MSW_R *(volatile ioport Uint16*)(0x2A2D)

/* ------------------------------------------------------------------------ *
* UART Module *
* ------------------------------------------------------------------------ */
#define UART_RBR *(volatile ioport Uint16*)(0x1B00)
#define UART_THR *(volatile ioport Uint16*)(0x1B00)
#define UART_IER *(volatile ioport Uint16*)(0x1B02)
#define UART_IIR *(volatile ioport Uint16*)(0x1B04)
#define UART_FCR *(volatile ioport Uint16*)(0x1B04)
#define UART_LCR *(volatile ioport Uint16*)(0x1B06)
#define UART_MCR *(volatile ioport Uint16*)(0x1B08)
#define UART_LSR *(volatile ioport Uint16*)(0x1B0A)
#define UART_SCR *(volatile ioport Uint16*)(0x1B0E)
#define UART_DLL *(volatile ioport Uint16*)(0x1B10)
#define UART_DLH *(volatile ioport Uint16*)(0x1B12)
#define UART_PWREMU_MGMT *(volatile ioport Uint16*)(0x1B18)

/* ------------------------------------------------------------------------ *
* Prototypes *
* ------------------------------------------------------------------------ */
/* Board Initialization */
Int16 USBSTK5515_init( );

/* Wait Functions */
void USBSTK5515_wait( Uint32 delay );
void USBSTK5515_waitusec( Uint32 usec );

#ifdef __cplusplus
} // extern "C" {
#endif
35 changes: 35 additions & 0 deletions eZ_include/usbstk5515_emif.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* EMIF Header file
*
*/


/* ------------------------------------------------------------------------ *
* Registers *
* ------------------------------------------------------------------------ */

#define EMIF_REV *(volatile ioport Uint16*)(0x1000)
#define EMIF_STATUS *(volatile ioport Uint16*)(0x1001)
#define EMIF_AWCCR1 *(volatile ioport Uint16*)(0x1004)
#define EMIF_AWCCR2 *(volatile ioport Uint16*)(0x1005)
#define EMIF_ACS2CR1 *(volatile ioport Uint16*)(0x1010)
#define EMIF_ACS2CR2 *(volatile ioport Uint16*)(0x1011)
#define EMIF_ACS3CR1 *(volatile ioport Uint16*)(0x1014)
#define EMIF_ACS3CR2 *(volatile ioport Uint16*)(0x1015)
#define EMIF_ACS4CR1 *(volatile ioport Uint16*)(0x1018)
#define EMIF_ACS4CR2 *(volatile ioport Uint16*)(0x1019)
#define EMIF_ACS5CR1 *(volatile ioport Uint16*)(0x101C)
#define EMIF_ACS5CR2 *(volatile ioport Uint16*)(0x101D)
#define EMIF_EIRR *(volatile ioport Uint16*)(0x1040)
#define EMIF_EIMR *(volatile ioport Uint16*)(0x1044)
#define EMIF_EIMSR *(volatile ioport Uint16*)(0x1048)
#define EMIF_EIMCR *(volatile ioport Uint16*)(0x104C)
#define EMIF_NANDFCR *(volatile ioport Uint16*)(0x1060)
#define EMIF_NANDFSR1 *(volatile ioport Uint16*)(0x1064)
#define EMIF_NANDFSR2 *(volatile ioport Uint16*)(0x1065)

102 changes: 102 additions & 0 deletions eZ_include/usbstk5515_gpio.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* GPIO implementation
*
*/

#include "usbstk5515_gpio.h"

/* ------------------------------------------------------------------------ *
* *
* _GPIO_init( ) *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_GPIO_init()
{
return 0;
}

/* ------------------------------------------------------------------------ *
* *
* _GPIO_setDirection( number, direction ) *
* *
* number <- GPIO# *
* direction <- 1:OUT 0:IN *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_GPIO_setDirection( Uint16 number, Uint16 direction )
{

Uint32 bank_id = ( number >> 4);
Uint32 pin_id = ( 1 << ( number & 0xF ) );

if (bank_id == 0)
if ((direction & 1) == GPIO_IN)
SYS_GPIO_DIR0 &= ~pin_id;
else
SYS_GPIO_DIR0 |= pin_id;

if (bank_id == 1)
if ((direction & 1) == GPIO_IN)
SYS_GPIO_DIR1 &= ~pin_id;
else
SYS_GPIO_DIR1 |= pin_id;

return 0;
}

/* ------------------------------------------------------------------------ *
* *
* _GPIO_setOutput( number, output ) *
* *
* number <- GPIO# *
* value <- 0:LOW 1:HIGH *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_GPIO_setOutput( Uint16 number, Uint16 output )
{
Uint32 bank_id = ( number >> 4 );
Uint32 pin_id = ( 1 << ( number & 0xF ) );

if (bank_id == 0)
if ((output & 1) == 0)
SYS_GPIO_DATAOUT0 &= ~pin_id;
else
SYS_GPIO_DATAOUT0 |= pin_id;

if (bank_id == 1)
if ((output & 1) == 0)
SYS_GPIO_DATAOUT1 &= ~pin_id;
else
SYS_GPIO_DATAOUT1 |= pin_id;

return 0;
}

/* ------------------------------------------------------------------------ *
* *
* _GPIO_getInput( number ) *
* *
* number <- GPIO# *
* *
* Returns: 0:LOW *
* 1:HIGH *
* *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_GPIO_getInput( Uint16 number )
{
Uint32 input;
Uint32 bank_id = ( number >> 4 );
Uint32 pin_id = ( number & 0xF );

if (bank_id == 0)
input = (SYS_GPIO_DATAIN0 >> pin_id) & 1;
if (bank_id == 1)
input = (SYS_GPIO_DATAIN1 >> pin_id) & 1;

return input;
}
64 changes: 64 additions & 0 deletions eZ_include/usbstk5515_gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* GPIO header file
*
*/

#ifndef GPIO_
#define GPIO_

#include "usbstk5515.h"

#define GPIO_IN 0
#define GPIO_OUT 1

#define GPIO0 0x00
#define GPIO1 0x01
#define GPIO2 0x02
#define GPIO3 0x03
#define GPIO4 0x04
#define GPIO5 0x05
#define GPIO6 0x06
#define GPIO7 0x07
#define GPIO8 0x08
#define GPIO9 0x09

#define GPIO10 0x0A
#define GPIO11 0x0B
#define GPIO12 0x0C
#define GPIO13 0x0D
#define GPIO14 0x0E
#define GPIO15 0x0F
#define GPIO16 0x10
#define GPIO17 0x11
#define GPIO18 0x12
#define GPIO19 0x13

#define GPIO20 0x14
#define GPIO21 0x15
#define GPIO22 0x16
#define GPIO23 0x17
#define GPIO24 0x18
#define GPIO25 0x19
#define GPIO26 0x1A
#define GPIO27 0x1B
#define GPIO28 0x1C
#define GPIO29 0x1D

#define GPIO30 0x1E
#define GPIO31 0x1F


/* ------------------------------------------------------------------------ *
* Prototypes *
* ------------------------------------------------------------------------ */
Int16 USBSTK5515_GPIO_init ( );
Int16 USBSTK5515_GPIO_setDirection ( Uint16 number, Uint16 direction );
Int16 USBSTK5515_GPIO_setOutput ( Uint16 number, Uint16 output );
Int16 USBSTK5515_GPIO_getInput ( Uint16 number );

#endif
Loading

0 comments on commit f138f26

Please sign in to comment.