URL
https://opencores.org/ocsvn/i2cslave/i2cslave/trunk
Subversion Repositories i2cslave
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 2 to Rev 3
- ↔ Reverse comparison
Rev 2 → Rev 3
/trunk/doc/i2cSlave_IPCore_Specification.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/doc/src/i2cSlave_IPCore_Specification.sxw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/sw/aardvark_xml/readWriteTest.xml
0,0 → 1,10
<aardvark> |
<configure i2c="1" spi="0" gpio="0" tpower="0" pullups="0"/> |
<i2c_bitrate khz="400"/> |
<i2c_write addr="0x3c" count="5" radix="16">00 89 ab cd ef</i2c_write> |
<i2c_write addr="0x3c" count="1" radix="16">00</i2c_write> |
<i2c_read addr="0x3c" count="4"/> |
<i2c_write addr="0x3c" count="1" radix="16">04</i2c_write> |
<i2c_read addr="0x3c" count="4"/> |
<sleep ms="170"/> |
</aardvark> |
/trunk/sw/aardvark_c/aardvark.h
0,0 → 1,925
/*========================================================================= |
| Aardvark Interface Library |
|-------------------------------------------------------------------------- |
| Copyright (c) 2002-2008 Total Phase, Inc. |
| All rights reserved. |
| www.totalphase.com |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions |
| are met: |
| |
| - Redistributions of source code must retain the above copyright |
| notice, this list of conditions and the following disclaimer. |
| |
| - Redistributions in binary form must reproduce the above copyright |
| notice, this list of conditions and the following disclaimer in the |
| documentation and/or other materials provided with the distribution. |
| |
| - Neither the name of Total Phase, Inc. nor the names of its |
| contributors may be used to endorse or promote products derived from |
| this software without specific prior written permission. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| POSSIBILITY OF SUCH DAMAGE. |
|-------------------------------------------------------------------------- |
| To access Aardvark devices through the API: |
| |
| 1) Use one of the following shared objects: |
| aardvark.so -- Linux shared object |
| aardvark.dll -- Windows dynamic link library |
| |
| 2) Along with one of the following language modules: |
| aardvark.c/h -- C/C++ API header file and interface module |
| aardvark_py.py -- Python API |
| aardvark.bas -- Visual Basic 6 API |
| aardvark.cs -- C# .NET source |
| aardvark_net.dll -- Compiled .NET binding |
========================================================================*/ |
|
|
#ifndef __aardvark_h__ |
#define __aardvark_h__ |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
|
/*========================================================================= |
| TYPEDEFS |
========================================================================*/ |
#ifndef TOTALPHASE_DATA_TYPES |
#define TOTALPHASE_DATA_TYPES |
|
#ifndef _MSC_VER |
/* C99-compliant compilers (GCC) */ |
#include <stdint.h> |
typedef uint8_t u08; |
typedef uint16_t u16; |
typedef uint32_t u32; |
typedef uint64_t u64; |
typedef int8_t s08; |
typedef int16_t s16; |
typedef int32_t s32; |
typedef int64_t s64; |
|
#else |
/* Microsoft compilers (Visual C++) */ |
typedef unsigned __int8 u08; |
typedef unsigned __int16 u16; |
typedef unsigned __int32 u32; |
typedef unsigned __int64 u64; |
typedef signed __int8 s08; |
typedef signed __int16 s16; |
typedef signed __int32 s32; |
typedef signed __int64 s64; |
|
#endif /* __MSC_VER */ |
|
#endif /* TOTALPHASE_DATA_TYPES */ |
|
|
/*========================================================================= |
| DEBUG |
========================================================================*/ |
/* Set the following macro to '1' for debugging */ |
#define AA_DEBUG 0 |
|
|
/*========================================================================= |
| VERSION |
========================================================================*/ |
#define AA_HEADER_VERSION 0x0500 /* v5.00 */ |
|
|
/*========================================================================= |
| STATUS CODES |
========================================================================*/ |
/* |
* All API functions return an integer which is the result of the |
* transaction, or a status code if negative. The status codes are |
* defined as follows: |
*/ |
enum AardvarkStatus { |
/* General codes (0 to -99) */ |
AA_OK = 0, |
AA_UNABLE_TO_LOAD_LIBRARY = -1, |
AA_UNABLE_TO_LOAD_DRIVER = -2, |
AA_UNABLE_TO_LOAD_FUNCTION = -3, |
AA_INCOMPATIBLE_LIBRARY = -4, |
AA_INCOMPATIBLE_DEVICE = -5, |
AA_COMMUNICATION_ERROR = -6, |
AA_UNABLE_TO_OPEN = -7, |
AA_UNABLE_TO_CLOSE = -8, |
AA_INVALID_HANDLE = -9, |
AA_CONFIG_ERROR = -10, |
|
/* I2C codes (-100 to -199) */ |
AA_I2C_NOT_AVAILABLE = -100, |
AA_I2C_NOT_ENABLED = -101, |
AA_I2C_READ_ERROR = -102, |
AA_I2C_WRITE_ERROR = -103, |
AA_I2C_SLAVE_BAD_CONFIG = -104, |
AA_I2C_SLAVE_READ_ERROR = -105, |
AA_I2C_SLAVE_TIMEOUT = -106, |
AA_I2C_DROPPED_EXCESS_BYTES = -107, |
AA_I2C_BUS_ALREADY_FREE = -108, |
|
/* SPI codes (-200 to -299) */ |
AA_SPI_NOT_AVAILABLE = -200, |
AA_SPI_NOT_ENABLED = -201, |
AA_SPI_WRITE_ERROR = -202, |
AA_SPI_SLAVE_READ_ERROR = -203, |
AA_SPI_SLAVE_TIMEOUT = -204, |
AA_SPI_DROPPED_EXCESS_BYTES = -205, |
|
/* GPIO codes (-400 to -499) */ |
AA_GPIO_NOT_AVAILABLE = -400, |
|
/* I2C bus monitor codes (-500 to -599) */ |
AA_I2C_MONITOR_NOT_AVAILABLE = -500, |
AA_I2C_MONITOR_NOT_ENABLED = -501 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkStatus AardvarkStatus; |
#endif |
|
|
/*========================================================================= |
| GENERAL TYPE DEFINITIONS |
========================================================================*/ |
/* Aardvark handle type definition */ |
typedef int Aardvark; |
|
/* |
* Deprecated type definitions. |
* |
* These are only for use with legacy code and |
* should not be used for new development. |
*/ |
typedef u08 aa_u08; |
|
typedef u16 aa_u16; |
|
typedef u32 aa_u32; |
|
typedef s08 aa_s08; |
|
typedef s16 aa_s16; |
|
typedef s32 aa_s32; |
|
/* |
* Aardvark version matrix. |
* |
* This matrix describes the various version dependencies |
* of Aardvark components. It can be used to determine |
* which component caused an incompatibility error. |
* |
* All version numbers are of the format: |
* (major << 8) | minor |
* |
* ex. v1.20 would be encoded as: 0x0114 |
*/ |
struct AardvarkVersion { |
/* Software, firmware, and hardware versions. */ |
u16 software; |
u16 firmware; |
u16 hardware; |
|
/* Firmware requires that software must be >= this version. */ |
u16 sw_req_by_fw; |
|
/* Software requires that firmware must be >= this version. */ |
u16 fw_req_by_sw; |
|
/* Software requires that the API interface must be >= this version. */ |
u16 api_req_by_sw; |
}; |
#ifndef __cplusplus |
typedef struct AardvarkVersion AardvarkVersion; |
#endif |
|
|
/*========================================================================= |
| GENERAL API |
========================================================================*/ |
/* |
* Get a list of ports to which Aardvark devices are attached. |
* |
* nelem = maximum number of elements to return |
* devices = array into which the port numbers are returned |
* |
* Each element of the array is written with the port number. |
* Devices that are in-use are ORed with AA_PORT_NOT_FREE (0x8000). |
* |
* ex. devices are attached to ports 0, 1, 2 |
* ports 0 and 2 are available, and port 1 is in-use. |
* array => 0x0000, 0x8001, 0x0002 |
* |
* If the array is NULL, it is not filled with any values. |
* If there are more devices than the array size, only the |
* first nmemb port numbers will be written into the array. |
* |
* Returns the number of devices found, regardless of the |
* array size. |
*/ |
#define AA_PORT_NOT_FREE 0x8000 |
int aa_find_devices ( |
int num_devices, |
u16 * devices |
); |
|
|
/* |
* Get a list of ports to which Aardvark devices are attached. |
* |
* This function is the same as aa_find_devices() except that |
* it returns the unique IDs of each Aardvark device. The IDs |
* are guaranteed to be non-zero if valid. |
* |
* The IDs are the unsigned integer representation of the 10-digit |
* serial numbers. |
*/ |
int aa_find_devices_ext ( |
int num_devices, |
u16 * devices, |
int num_ids, |
u32 * unique_ids |
); |
|
|
/* |
* Open the Aardvark port. |
* |
* The port number is a zero-indexed integer. |
* |
* The port number is the same as that obtained from the |
* aa_find_devices() function above. |
* |
* Returns an Aardvark handle, which is guaranteed to be |
* greater than zero if it is valid. |
* |
* This function is recommended for use in simple applications |
* where extended information is not required. For more complex |
* applications, the use of aa_open_ext() is recommended. |
*/ |
Aardvark aa_open ( |
int port_number |
); |
|
|
/* |
* Open the Aardvark port, returning extended information |
* in the supplied structure. Behavior is otherwise identical |
* to aa_open() above. If 0 is passed as the pointer to the |
* structure, this function is exactly equivalent to aa_open(). |
* |
* The structure is zeroed before the open is attempted. |
* It is filled with whatever information is available. |
* |
* For example, if the firmware version is not filled, then |
* the device could not be queried for its version number. |
* |
* This function is recommended for use in complex applications |
* where extended information is required. For more simple |
* applications, the use of aa_open() is recommended. |
*/ |
struct AardvarkExt { |
/* Version matrix */ |
AardvarkVersion version; |
|
/* Features of this device. */ |
int features; |
}; |
#ifndef __cplusplus |
typedef struct AardvarkExt AardvarkExt; |
#endif |
|
Aardvark aa_open_ext ( |
int port_number, |
AardvarkExt * aa_ext |
); |
|
|
/* Close the Aardvark port. */ |
int aa_close ( |
Aardvark aardvark |
); |
|
|
/* |
* Return the port for this Aardvark handle. |
* |
* The port number is a zero-indexed integer. |
*/ |
int aa_port ( |
Aardvark aardvark |
); |
|
|
/* |
* Return the device features as a bit-mask of values, or |
* an error code if the handle is not valid. |
*/ |
#define AA_FEATURE_SPI 0x00000001 |
#define AA_FEATURE_I2C 0x00000002 |
#define AA_FEATURE_GPIO 0x00000008 |
#define AA_FEATURE_I2C_MONITOR 0x00000010 |
int aa_features ( |
Aardvark aardvark |
); |
|
|
/* |
* Return the unique ID for this Aardvark adapter. |
* IDs are guaranteed to be non-zero if valid. |
* The ID is the unsigned integer representation of the |
* 10-digit serial number. |
*/ |
u32 aa_unique_id ( |
Aardvark aardvark |
); |
|
|
/* |
* Return the status string for the given status code. |
* If the code is not valid or the library function cannot |
* be loaded, return a NULL string. |
*/ |
const char * aa_status_string ( |
int status |
); |
|
|
/* |
* Enable logging to a file. The handle must be standard file |
* descriptor. In C, a file descriptor can be obtained by using |
* the ANSI C function "open" or by using the function "fileno" |
* on a FILE* stream. A FILE* stream can be obtained using "fopen" |
* or can correspond to the common "stdout" or "stderr" -- |
* available when including stdlib.h |
*/ |
int aa_log ( |
Aardvark aardvark, |
int level, |
int handle |
); |
|
|
/* |
* Return the version matrix for the device attached to the |
* given handle. If the handle is 0 or invalid, only the |
* software and required api versions are set. |
*/ |
int aa_version ( |
Aardvark aardvark, |
AardvarkVersion * version |
); |
|
|
/* |
* Configure the device by enabling/disabling I2C, SPI, and |
* GPIO functions. |
*/ |
enum AardvarkConfig { |
AA_CONFIG_GPIO_ONLY = 0x00, |
AA_CONFIG_SPI_GPIO = 0x01, |
AA_CONFIG_GPIO_I2C = 0x02, |
AA_CONFIG_SPI_I2C = 0x03, |
AA_CONFIG_QUERY = 0x80 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkConfig AardvarkConfig; |
#endif |
|
#define AA_CONFIG_SPI_MASK 0x00000001 |
#define AA_CONFIG_I2C_MASK 0x00000002 |
int aa_configure ( |
Aardvark aardvark, |
AardvarkConfig config |
); |
|
|
/* |
* Configure the target power pins. |
* This is only supported on hardware versions >= 2.00 |
*/ |
#define AA_TARGET_POWER_NONE 0x00 |
#define AA_TARGET_POWER_BOTH 0x03 |
#define AA_TARGET_POWER_QUERY 0x80 |
int aa_target_power ( |
Aardvark aardvark, |
u08 power_mask |
); |
|
|
/* |
* Sleep for the specified number of milliseconds |
* Accuracy depends on the operating system scheduler |
* Returns the number of milliseconds slept |
*/ |
u32 aa_sleep_ms ( |
u32 milliseconds |
); |
|
|
|
/*========================================================================= |
| ASYNC MESSAGE POLLING |
========================================================================*/ |
/* |
* Polling function to check if there are any asynchronous |
* messages pending for processing. The function takes a timeout |
* value in units of milliseconds. If the timeout is < 0, the |
* function will block until data is received. If the timeout is 0, |
* the function will perform a non-blocking check. |
*/ |
#define AA_ASYNC_NO_DATA 0x00000000 |
#define AA_ASYNC_I2C_READ 0x00000001 |
#define AA_ASYNC_I2C_WRITE 0x00000002 |
#define AA_ASYNC_SPI 0x00000004 |
#define AA_ASYNC_I2C_MONITOR 0x00000008 |
int aa_async_poll ( |
Aardvark aardvark, |
int timeout |
); |
|
|
|
/*========================================================================= |
| I2C API |
========================================================================*/ |
/* Free the I2C bus. */ |
int aa_i2c_free_bus ( |
Aardvark aardvark |
); |
|
|
/* |
* Set the I2C bit rate in kilohertz. If a zero is passed as the |
* bitrate, the bitrate is unchanged and the current bitrate is |
* returned. |
*/ |
int aa_i2c_bitrate ( |
Aardvark aardvark, |
int bitrate_khz |
); |
|
|
/* |
* Set the bus lock timeout. If a zero is passed as the timeout, |
* the timeout is unchanged and the current timeout is returned. |
*/ |
int aa_i2c_bus_timeout ( |
Aardvark aardvark, |
u16 timeout_ms |
); |
|
|
enum AardvarkI2cFlags { |
AA_I2C_NO_FLAGS = 0x00, |
AA_I2C_10_BIT_ADDR = 0x01, |
AA_I2C_COMBINED_FMT = 0x02, |
AA_I2C_NO_STOP = 0x04, |
AA_I2C_SIZED_READ = 0x10, |
AA_I2C_SIZED_READ_EXTRA1 = 0x20 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkI2cFlags AardvarkI2cFlags; |
#endif |
|
/* Read a stream of bytes from the I2C slave device. */ |
int aa_i2c_read ( |
Aardvark aardvark, |
u16 slave_addr, |
AardvarkI2cFlags flags, |
u16 num_bytes, |
u08 * data_in |
); |
|
|
enum AardvarkI2cStatus { |
AA_I2C_STATUS_OK = 0, |
AA_I2C_STATUS_BUS_ERROR = 1, |
AA_I2C_STATUS_SLA_ACK = 2, |
AA_I2C_STATUS_SLA_NACK = 3, |
AA_I2C_STATUS_DATA_NACK = 4, |
AA_I2C_STATUS_ARB_LOST = 5, |
AA_I2C_STATUS_BUS_LOCKED = 6, |
AA_I2C_STATUS_LAST_DATA_ACK = 7 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkI2cStatus AardvarkI2cStatus; |
#endif |
|
/* |
* Read a stream of bytes from the I2C slave device. |
* This API function returns the number of bytes read into |
* the num_read variable. The return value of the function |
* is a status code. |
*/ |
int aa_i2c_read_ext ( |
Aardvark aardvark, |
u16 slave_addr, |
AardvarkI2cFlags flags, |
u16 num_bytes, |
u08 * data_in, |
u16 * num_read |
); |
|
|
/* Write a stream of bytes to the I2C slave device. */ |
int aa_i2c_write ( |
Aardvark aardvark, |
u16 slave_addr, |
AardvarkI2cFlags flags, |
u16 num_bytes, |
const u08 * data_out |
); |
|
|
/* |
* Write a stream of bytes to the I2C slave device. |
* This API function returns the number of bytes written into |
* the num_written variable. The return value of the function |
* is a status code. |
*/ |
int aa_i2c_write_ext ( |
Aardvark aardvark, |
u16 slave_addr, |
AardvarkI2cFlags flags, |
u16 num_bytes, |
const u08 * data_out, |
u16 * num_written |
); |
|
|
/* Enable/Disable the Aardvark as an I2C slave device */ |
int aa_i2c_slave_enable ( |
Aardvark aardvark, |
u08 addr, |
u16 maxTxBytes, |
u16 maxRxBytes |
); |
|
|
int aa_i2c_slave_disable ( |
Aardvark aardvark |
); |
|
|
/* |
* Set the slave response in the event the Aardvark is put |
* into slave mode and contacted by a Master. |
*/ |
int aa_i2c_slave_set_response ( |
Aardvark aardvark, |
u08 num_bytes, |
const u08 * data_out |
); |
|
|
/* |
* Return number of bytes written from a previous |
* Aardvark->I2C_master transmission. Since the transmission is |
* happening asynchronously with respect to the PC host |
* software, there could be responses queued up from many |
* previous write transactions. |
*/ |
int aa_i2c_slave_write_stats ( |
Aardvark aardvark |
); |
|
|
/* Read the bytes from an I2C slave reception */ |
int aa_i2c_slave_read ( |
Aardvark aardvark, |
u08 * addr, |
u16 num_bytes, |
u08 * data_in |
); |
|
|
/* Extended functions that return status code */ |
int aa_i2c_slave_write_stats_ext ( |
Aardvark aardvark, |
u16 * num_written |
); |
|
|
int aa_i2c_slave_read_ext ( |
Aardvark aardvark, |
u08 * addr, |
u16 num_bytes, |
u08 * data_in, |
u16 * num_read |
); |
|
|
/* |
* Enable the I2C bus monitor |
* This disables all other functions on the Aardvark adapter |
*/ |
int aa_i2c_monitor_enable ( |
Aardvark aardvark |
); |
|
|
/* Disable the I2C bus monitor */ |
int aa_i2c_monitor_disable ( |
Aardvark aardvark |
); |
|
|
/* Read the data collected by the bus monitor */ |
#define AA_I2C_MONITOR_DATA 0x00ff |
#define AA_I2C_MONITOR_NACK 0x0100 |
#define AA_I2C_MONITOR_CMD_START 0xff00 |
#define AA_I2C_MONITOR_CMD_STOP 0xff01 |
int aa_i2c_monitor_read ( |
Aardvark aardvark, |
u16 num_bytes, |
u16 * data |
); |
|
|
/* |
* Configure the I2C pullup resistors. |
* This is only supported on hardware versions >= 2.00 |
*/ |
#define AA_I2C_PULLUP_NONE 0x00 |
#define AA_I2C_PULLUP_BOTH 0x03 |
#define AA_I2C_PULLUP_QUERY 0x80 |
int aa_i2c_pullup ( |
Aardvark aardvark, |
u08 pullup_mask |
); |
|
|
|
/*========================================================================= |
| SPI API |
========================================================================*/ |
/* |
* Set the SPI bit rate in kilohertz. If a zero is passed as the |
* bitrate, the bitrate is unchanged and the current bitrate is |
* returned. |
*/ |
int aa_spi_bitrate ( |
Aardvark aardvark, |
int bitrate_khz |
); |
|
|
/* |
* These configuration parameters specify how to clock the |
* bits that are sent and received on the Aardvark SPI |
* interface. |
* |
* The polarity option specifies which transition |
* constitutes the leading edge and which transition is the |
* falling edge. For example, AA_SPI_POL_RISING_FALLING |
* would configure the SPI to idle the SCK clock line low. |
* The clock would then transition low-to-high on the |
* leading edge and high-to-low on the trailing edge. |
* |
* The phase option determines whether to sample or setup on |
* the leading edge. For example, AA_SPI_PHASE_SAMPLE_SETUP |
* would configure the SPI to sample on the leading edge and |
* setup on the trailing edge. |
* |
* The bitorder option is used to indicate whether LSB or |
* MSB is shifted first. |
* |
* See the diagrams in the Aardvark datasheet for |
* more details. |
*/ |
enum AardvarkSpiPolarity { |
AA_SPI_POL_RISING_FALLING = 0, |
AA_SPI_POL_FALLING_RISING = 1 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkSpiPolarity AardvarkSpiPolarity; |
#endif |
|
enum AardvarkSpiPhase { |
AA_SPI_PHASE_SAMPLE_SETUP = 0, |
AA_SPI_PHASE_SETUP_SAMPLE = 1 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkSpiPhase AardvarkSpiPhase; |
#endif |
|
enum AardvarkSpiBitorder { |
AA_SPI_BITORDER_MSB = 0, |
AA_SPI_BITORDER_LSB = 1 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkSpiBitorder AardvarkSpiBitorder; |
#endif |
|
/* Configure the SPI master or slave interface */ |
int aa_spi_configure ( |
Aardvark aardvark, |
AardvarkSpiPolarity polarity, |
AardvarkSpiPhase phase, |
AardvarkSpiBitorder bitorder |
); |
|
|
/* Write a stream of bytes to the downstream SPI slave device. */ |
int aa_spi_write ( |
Aardvark aardvark, |
u16 out_num_bytes, |
const u08 * data_out, |
u16 in_num_bytes, |
u08 * data_in |
); |
|
|
/* Enable/Disable the Aardvark as an SPI slave device */ |
int aa_spi_slave_enable ( |
Aardvark aardvark |
); |
|
|
int aa_spi_slave_disable ( |
Aardvark aardvark |
); |
|
|
/* |
* Set the slave response in the event the Aardvark is put |
* into slave mode and contacted by a Master. |
*/ |
int aa_spi_slave_set_response ( |
Aardvark aardvark, |
u08 num_bytes, |
const u08 * data_out |
); |
|
|
/* Read the bytes from an SPI slave reception */ |
int aa_spi_slave_read ( |
Aardvark aardvark, |
u16 num_bytes, |
u08 * data_in |
); |
|
|
/* |
* Change the output polarity on the SS line. |
* |
* Note: When configured as an SPI slave, the Aardvark will |
* always be setup with SS as active low. Hence this function |
* only affects the SPI master functions on the Aardvark. |
*/ |
enum AardvarkSpiSSPolarity { |
AA_SPI_SS_ACTIVE_LOW = 0, |
AA_SPI_SS_ACTIVE_HIGH = 1 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkSpiSSPolarity AardvarkSpiSSPolarity; |
#endif |
|
int aa_spi_master_ss_polarity ( |
Aardvark aardvark, |
AardvarkSpiSSPolarity polarity |
); |
|
|
|
/*========================================================================= |
| GPIO API |
========================================================================*/ |
/* |
* The following enumerated type maps the named lines on the |
* Aardvark I2C/SPI line to bit positions in the GPIO API. |
* All GPIO API functions will index these lines through an |
* 8-bit masked value. Thus, each bit position in the mask |
* can be referred back its corresponding line through the |
* enumerated type. |
*/ |
enum AardvarkGpioBits { |
AA_GPIO_SCL = 0x01, |
AA_GPIO_SDA = 0x02, |
AA_GPIO_MISO = 0x04, |
AA_GPIO_SCK = 0x08, |
AA_GPIO_MOSI = 0x10, |
AA_GPIO_SS = 0x20 |
}; |
#ifndef __cplusplus |
typedef enum AardvarkGpioBits AardvarkGpioBits; |
#endif |
|
/* |
* Configure the GPIO, specifying the direction of each bit. |
* |
* A call to this function will not change the value of the pullup |
* mask in the Aardvark. This is illustrated by the following |
* example: |
* (1) Direction mask is first set to 0x00 |
* (2) Pullup is set to 0x01 |
* (3) Direction mask is set to 0x01 |
* (4) Direction mask is later set back to 0x00. |
* |
* The pullup will be active after (4). |
* |
* On Aardvark power-up, the default value of the direction |
* mask is 0x00. |
*/ |
#define AA_GPIO_DIR_INPUT 0 |
#define AA_GPIO_DIR_OUTPUT 1 |
int aa_gpio_direction ( |
Aardvark aardvark, |
u08 direction_mask |
); |
|
|
/* |
* Enable an internal pullup on any of the GPIO input lines. |
* |
* Note: If a line is configured as an output, the pullup bit |
* for that line will be ignored, though that pullup bit will |
* be cached in case the line is later configured as an input. |
* |
* By default the pullup mask is 0x00. |
*/ |
#define AA_GPIO_PULLUP_OFF 0 |
#define AA_GPIO_PULLUP_ON 1 |
int aa_gpio_pullup ( |
Aardvark aardvark, |
u08 pullup_mask |
); |
|
|
/* |
* Read the current digital values on the GPIO input lines. |
* |
* The bits will be ordered as described by AA_GPIO_BITS. If a |
* line is configured as an output, its corresponding bit |
* position in the mask will be undefined. |
*/ |
int aa_gpio_get ( |
Aardvark aardvark |
); |
|
|
/* |
* Set the outputs on the GPIO lines. |
* |
* Note: If a line is configured as an input, it will not be |
* affected by this call, but the output value for that line |
* will be cached in the event that the line is later |
* configured as an output. |
*/ |
int aa_gpio_set ( |
Aardvark aardvark, |
u08 value |
); |
|
|
/* |
* Block until there is a change on the GPIO input lines. |
* Pins configured as outputs will be ignored. |
* |
* The function will return either when a change has occurred or |
* the timeout expires. The timeout, specified in millisecods, has |
* a precision of ~16 ms. The maximum allowable timeout is |
* approximately 4 seconds. If the timeout expires, this function |
* will return the current state of the GPIO lines. |
* |
* This function will return immediately with the current value |
* of the GPIO lines for the first invocation after any of the |
* following functions are called: aa_configure, |
* aa_gpio_direction, or aa_gpio_pullup. |
* |
* If the function aa_gpio_get is called before calling |
* aa_gpio_change, aa_gpio_change will only register any changes |
* from the value last returned by aa_gpio_get. |
*/ |
int aa_gpio_change ( |
Aardvark aardvark, |
u16 timeout |
); |
|
|
|
|
#ifdef __cplusplus |
} |
#endif |
|
#endif /* __aardvark_h__ */ |
/trunk/sw/aardvark_c/aardvark.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
trunk/sw/aardvark_c/aardvark.dll
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/sw/aardvark_c/i2cSlaveTest.c
===================================================================
--- trunk/sw/aardvark_c/i2cSlaveTest.c (nonexistent)
+++ trunk/sw/aardvark_c/i2cSlaveTest.c (revision 3)
@@ -0,0 +1,174 @@
+/*=========================================================================
+|
+|--------------------------------------------------------------------------
+|
+| File : i2cSlaveTest.c
+|--------------------------------------------------------------------------
+|
+|--------------------------------------------------------------------------
+ ========================================================================*/
+
+//=========================================================================
+// INCLUDES
+//=========================================================================
+#include
+#include
+#include
+
+#include "aardvark.h"
+
+#ifdef _MSC_VER
+#define fileno _fileno
+#endif
+
+
+//=========================================================================
+// CONSTANTS
+//=========================================================================
+#define I2C_BITRATE 400 // kHz
+
+
+//=========================================================================
+// STATIC FUNCTIONS
+//=========================================================================
+static int testRegs (Aardvark handle, unsigned char LEDstate)
+{
+ int res, i, count;
+ unsigned char data_out[16];
+ unsigned char data_in[16];
+ unsigned char expected_data [] = {LEDstate, 0xab, 0xcd, 0xef, 0x12, 0x34, 0x56, 0x78};
+
+
+ // Set address reg = 0
+ data_out[0] = 0x00;
+ res = aa_i2c_write(handle, 0x3c, AA_I2C_NO_FLAGS, 1, data_out);
+ if (res < 0) return res;
+
+ if (res == 0) {
+ printf("error: slave device 0x38 not found\n");
+ return -1;
+ }
+
+ // Write to registers 0 through 3
+ data_out[0] = 0x00;
+ data_out[1] = LEDstate;
+ data_out[2] = 0xab;
+ data_out[3] = 0xcd;
+ data_out[4] = 0xef;
+ res = aa_i2c_write(handle, 0x3c, AA_I2C_NO_FLAGS, 5, data_out);
+ if (res < 0) return res;
+
+
+
+ // Set address reg = 0
+ data_out[0] = 0x00;
+ res = aa_i2c_write(handle, 0x3c, AA_I2C_NO_FLAGS, 1, data_out);
+ if (res < 0) return res;
+ if (res == 0) {
+ printf("error: slave device 0x38 not found\n");
+ return -1;
+ }
+ //read 8 bytes
+ count = aa_i2c_read(handle, 0x3c, AA_I2C_NO_FLAGS, 8, data_in);
+ if (count < 0) {
+ printf("error: %s\n", aa_status_string(count));
+ return -1;
+ }
+ if (count == 0) {
+ printf("error: no bytes read\n");
+ printf(" are you sure you have the right slave address?\n");
+ return -1;
+ }
+ else if (count != 8) {
+ printf("error: read %d bytes (expected 8)\n", count);
+ return -1;
+ }
+ // Dump the data to the screen
+ //printf("\nData read from device:");
+ for (i = 0; i < count; ++i) {
+ //printf("Reg[0x%02x] = 0x%02x\n", i, data_in[i]);
+ if (expected_data[i] != data_in[i]) {
+ printf("Reg[0x%02x] expected 0x%02x got 0x%02x\n", i, expected_data[i], data_in[i]);
+ return -1;
+ }
+ }
+ //printf("\n");
+
+ return 0;
+}
+
+
+//=========================================================================
+// MAIN PROGRAM
+//=========================================================================
+int main (int argc, char *argv[]) {
+ Aardvark handle;
+ int port = 0;
+ int bitrate = 100;
+ int res = 0;
+ //FILE *logfile = 0;
+ int i;
+ unsigned char LEDstate;
+
+ if (argc < 2) {
+ printf("usage: i2cSlaveTest PORT\n");
+ return 1;
+ }
+
+ port = atoi(argv[1]);
+
+ // Open the device
+ handle = aa_open(port);
+ if (handle <= 0) {
+ printf("Unable to open Aardvark device on port %d\n", port);
+ printf("Error code = %d\n", handle);
+ return 1;
+ }
+
+ // Enable logging
+ //logfile = fopen("log.txt", "at");
+ //if (logfile != 0) {
+ // aa_log(handle, 3, fileno(logfile));
+ //}
+
+ // Ensure that the I2C subsystem is enabled
+ aa_configure(handle, AA_CONFIG_SPI_I2C);
+
+ // Enable the I2C bus pullup resistors (2.2k resistors).
+ // This command is only effective on v2.0 hardware or greater.
+ // The pullup resistors on the v1.02 hardware are enabled by default.
+ aa_i2c_pullup(handle, AA_I2C_PULLUP_NONE);
+
+ // Power the board using the Aardvark adapter's power supply.
+ // This command is only effective on v2.0 hardware or greater.
+ // The power pins on the v1.02 hardware are not enabled by default.
+ aa_target_power(handle, AA_TARGET_POWER_NONE);
+
+ // Set the bitrate
+ bitrate = aa_i2c_bitrate(handle, I2C_BITRATE);
+ printf("Bitrate set to %d kHz\n", bitrate);
+
+ i = 0;
+ LEDstate = 0x89;
+ do {
+ i++;
+ res = testRegs(handle, LEDstate);
+ if (i % 100 == 0) {
+ if (LEDstate == 0x89) LEDstate = 0x88; else LEDstate = 0x89;
+ printf("Test loop: %d\n", i);
+ fflush(stdout);
+ }
+ } while (i <= 100000 && res >= 0);
+ if (res < 0)
+ printf("error: %s\n", aa_status_string(res));
+ else
+ printf("All tests passed\n");
+
+ // Close the device and exit
+ aa_close(handle);
+
+ // Close the logging file
+ //fclose(logfile);
+
+ return 0;
+}
Index: trunk/sw/aardvark_c/README.txt
===================================================================
--- trunk/sw/aardvark_c/README.txt (nonexistent)
+++ trunk/sw/aardvark_c/README.txt (revision 3)
@@ -0,0 +1,12 @@
+
+Windows gcc-mingw32:
+1) Install GCC MinGW32.
+ The latest version can be downloaded from the MinGW website:
+ http://www.mingw.org/
+2) Install MSYS
+ The latest version can be downloaded from the MinGW website:
+ http://www.mingw.org/
+3) Type 'make' at the MSYS command line
+4) _output/PROGRAM
+
+
Index: trunk/sw/aardvark_c/aardvark.c
===================================================================
--- trunk/sw/aardvark_c/aardvark.c (nonexistent)
+++ trunk/sw/aardvark_c/aardvark.c (revision 3)
@@ -0,0 +1,1013 @@
+/*=========================================================================
+| Aardvark Interface Library
+|--------------------------------------------------------------------------
+| Copyright (c) 2002-2008 Total Phase, Inc.
+| All rights reserved.
+| www.totalphase.com
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions
+| are met:
+|
+| - Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+|
+| - Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+|
+| - Neither the name of Total Phase, Inc. nor the names of its
+| contributors may be used to endorse or promote products derived from
+| this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+| FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+| COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+| INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+| BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+| ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+| POSSIBILITY OF SUCH DAMAGE.
+|--------------------------------------------------------------------------
+| To access Aardvark devices through the API:
+|
+| 1) Use one of the following shared objects:
+| aardvark.so -- Linux shared object
+| aardvark.dll -- Windows dynamic link library
+|
+| 2) Along with one of the following language modules:
+| aardvark.c/h -- C/C++ API header file and interface module
+| aardvark_py.py -- Python API
+| aardvark.bas -- Visual Basic 6 API
+| aardvark.cs -- C# .NET source
+| aardvark_net.dll -- Compiled .NET binding
+ ========================================================================*/
+
+
+/*=========================================================================
+| INCLUDES
+ ========================================================================*/
+/* This #include can be customized to conform to the user's build paths. */
+#include "aardvark.h"
+
+
+/*=========================================================================
+| VERSION CHECK
+ ========================================================================*/
+#define AA_CFILE_VERSION 0x0500 /* v5.00 */
+#define AA_REQ_SW_VERSION 0x0500 /* v5.00 */
+
+/*
+ * Make sure that the header file was included and that
+ * the version numbers match.
+ */
+#ifndef AA_HEADER_VERSION
+# error Unable to include header file. Please check include path.
+
+#elif AA_HEADER_VERSION != AA_CFILE_VERSION
+# error Version mismatch between source and header files.
+
+#endif
+
+
+/*=========================================================================
+| DEFINES
+ ========================================================================*/
+#define API_NAME "aardvark"
+#define API_DEBUG AA_DEBUG
+#define API_OK AA_OK
+#define API_UNABLE_TO_LOAD_LIBRARY AA_UNABLE_TO_LOAD_LIBRARY
+#define API_INCOMPATIBLE_LIBRARY AA_INCOMPATIBLE_LIBRARY
+#define API_UNABLE_TO_LOAD_FUNCTION AA_UNABLE_TO_LOAD_FUNCTION
+#define API_HEADER_VERSION AA_HEADER_VERSION
+#define API_REQ_SW_VERSION AA_REQ_SW_VERSION
+
+
+/*=========================================================================
+| LINUX AND DARWIN SUPPORT
+ ========================================================================*/
+#if defined(__APPLE_CC__) && !defined(DARWIN)
+#define DARWIN
+#endif
+
+#if defined(linux) || defined(DARWIN)
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef DARWIN
+#define DLOPEN_NO_WARN
+extern int _NSGetExecutablePath (char *buf, unsigned long *bufsize);
+#endif
+
+#include
+
+#define DLL_HANDLE void *
+#define MAX_SO_PATH 256
+
+static char SO_NAME[MAX_SO_PATH+1] = API_NAME ".so";
+
+/*
+ * These functions allow the Linux behavior to emulate
+ * the Windows behavior as specified below in the Windows
+ * support section.
+ *
+ * First, search for the shared object in the application
+ * binary path, then in the current working directory.
+ *
+ * Searching the application binary path requires /proc
+ * filesystem support, which is standard in 2.4.x kernels.
+ *
+ * If the /proc filesystem is not present, the shared object
+ * will not be loaded from the execution path unless that path
+ * is either the current working directory or explicitly
+ * specified in LD_LIBRARY_PATH.
+ */
+static int _checkPath (const char *path) {
+ char *filename = (char *)malloc(strlen(path) +1 + strlen(SO_NAME) +1);
+ int fd;
+
+ // Check if the file is readable
+ sprintf(filename, "%s/%s", path, SO_NAME);
+ fd = open(filename, O_RDONLY);
+ if (fd >= 0) {
+ strncpy(SO_NAME, filename, MAX_SO_PATH);
+ close(fd);
+ }
+
+ // Clean up and exit
+ free(filename);
+ return (fd >= 0);
+}
+
+static int _getExecPath (char *path, unsigned long maxlen) {
+#ifdef linux
+ return readlink("/proc/self/exe", path, maxlen);
+#endif
+
+#ifdef DARWIN
+ _NSGetExecutablePath(path, &maxlen);
+ return maxlen;
+#endif
+}
+
+static void _setSearchPath () {
+ char path[MAX_SO_PATH+1];
+ int count;
+ char *p;
+
+ /* Make sure that SO_NAME is not an absolute path. */
+ if (SO_NAME[0] == '/') return;
+
+ /* Check the execution directory name. */
+ memset(path, 0, sizeof(path));
+ count = _getExecPath(path, MAX_SO_PATH);
+
+ if (count > 0) {
+ char *p = strrchr(path, '/');
+ if (p == path) ++p;
+ if (p != 0) *p = '\0';
+
+ /* If there is a match, return immediately. */
+ if (_checkPath(path)) return;
+ }
+
+ /* Check the current working directory. */
+ p = getcwd(path, MAX_SO_PATH);
+ if (p != 0) _checkPath(path);
+}
+
+#endif
+
+
+/*=========================================================================
+| WINDOWS SUPPORT
+ ========================================================================*/
+#if defined(WIN32) || defined(_WIN32)
+
+#include
+#include
+
+#define DLL_HANDLE HINSTANCE
+#define dlopen(name, flags) LoadLibraryA(name)
+#define dlsym(handle, name) GetProcAddress(handle, name)
+#define dlerror() "Exiting program"
+#define SO_NAME API_NAME ".dll"
+
+/*
+ * Use the default Windows DLL loading rules:
+ * 1. The directory from which the application binary was loaded.
+ * 2. The application's current directory.
+ * 3a. [Windows NT/2000/XP only] 32-bit system directory
+ * (default: c:\winnt\System32)
+ * 3b. 16-bit system directory
+ * (default: c:\winnt\System or c:\windows\system)
+ * 4. The windows directory
+ * (default: c:\winnt or c:\windows)
+ * 5. The directories listed in the PATH environment variable
+ */
+static void _setSearchPath () {
+ /* Do nothing */
+}
+
+#endif
+
+
+/*=========================================================================
+| SHARED LIBRARY LOADER
+ ========================================================================*/
+/* The error conditions can be customized depending on the application. */
+static void *_loadFunction (const char *name, int *result) {
+ static DLL_HANDLE handle = 0;
+ void * function = 0;
+
+ /* Load the shared library if necessary */
+ if (handle == 0) {
+ u32 (*version) (void);
+ u16 sw_version;
+ u16 api_version_req;
+
+ _setSearchPath();
+ handle = dlopen(SO_NAME, RTLD_LAZY);
+ if (handle == 0) {
+#if API_DEBUG
+ fprintf(stderr, "Unable to load %s\n", SO_NAME);
+ fprintf(stderr, "%s\n", dlerror());
+#endif
+ *result = API_UNABLE_TO_LOAD_LIBRARY;
+ return 0;
+ }
+
+ version = (void *)dlsym(handle, "c_version");
+ if (version == 0) {
+#if API_DEBUG
+ fprintf(stderr, "Unable to bind c_version() in %s\n",
+ SO_NAME);
+ fprintf(stderr, "%s\n", dlerror());
+#endif
+ handle = 0;
+ *result = API_INCOMPATIBLE_LIBRARY;
+ return 0;
+ }
+
+ sw_version = (u16)((version() >> 0) & 0xffff);
+ api_version_req = (u16)((version() >> 16) & 0xffff);
+ if (sw_version < API_REQ_SW_VERSION ||
+ API_HEADER_VERSION < api_version_req)
+ {
+#if API_DEBUG
+ fprintf(stderr, "\nIncompatible versions:\n");
+
+ fprintf(stderr, " Header version = v%d.%02d ",
+ (API_HEADER_VERSION >> 8) & 0xff, API_HEADER_VERSION & 0xff);
+
+ if (sw_version < API_REQ_SW_VERSION)
+ fprintf(stderr, "(requires library >= %d.%02d)\n",
+ (API_REQ_SW_VERSION >> 8) & 0xff,
+ API_REQ_SW_VERSION & 0xff);
+ else
+ fprintf(stderr, "(library version OK)\n");
+
+
+ fprintf(stderr, " Library version = v%d.%02d ",
+ (sw_version >> 8) & 0xff,
+ (sw_version >> 0) & 0xff);
+
+ if (API_HEADER_VERSION < api_version_req)
+ fprintf(stderr, "(requires header >= %d.%02d)\n",
+ (api_version_req >> 8) & 0xff,
+ (api_version_req >> 0) & 0xff);
+ else
+ fprintf(stderr, "(header version OK)\n");
+#endif
+ handle = 0;
+ *result = API_INCOMPATIBLE_LIBRARY;
+ return 0;
+ }
+ }
+
+ /* Bind the requested function in the shared library */
+ function = (void *)dlsym(handle, name);
+ *result = function ? API_OK : API_UNABLE_TO_LOAD_FUNCTION;
+ return function;
+}
+
+
+/*=========================================================================
+| FUNCTIONS
+ ========================================================================*/
+static int (*c_aa_find_devices) (int, u16 *) = 0;
+int aa_find_devices (
+ int num_devices,
+ u16 * devices
+)
+{
+ if (c_aa_find_devices == 0) {
+ int res = 0;
+ if (!(c_aa_find_devices = _loadFunction("c_aa_find_devices", &res)))
+ return res;
+ }
+ return c_aa_find_devices(num_devices, devices);
+}
+
+
+static int (*c_aa_find_devices_ext) (int, u16 *, int, u32 *) = 0;
+int aa_find_devices_ext (
+ int num_devices,
+ u16 * devices,
+ int num_ids,
+ u32 * unique_ids
+)
+{
+ if (c_aa_find_devices_ext == 0) {
+ int res = 0;
+ if (!(c_aa_find_devices_ext = _loadFunction("c_aa_find_devices_ext", &res)))
+ return res;
+ }
+ return c_aa_find_devices_ext(num_devices, devices, num_ids, unique_ids);
+}
+
+
+static Aardvark (*c_aa_open) (int) = 0;
+Aardvark aa_open (
+ int port_number
+)
+{
+ if (c_aa_open == 0) {
+ int res = 0;
+ if (!(c_aa_open = _loadFunction("c_aa_open", &res)))
+ return res;
+ }
+ return c_aa_open(port_number);
+}
+
+
+static Aardvark (*c_aa_open_ext) (int, AardvarkExt *) = 0;
+Aardvark aa_open_ext (
+ int port_number,
+ AardvarkExt * aa_ext
+)
+{
+ if (c_aa_open_ext == 0) {
+ int res = 0;
+ if (!(c_aa_open_ext = _loadFunction("c_aa_open_ext", &res)))
+ return res;
+ }
+ return c_aa_open_ext(port_number, aa_ext);
+}
+
+
+static int (*c_aa_close) (Aardvark) = 0;
+int aa_close (
+ Aardvark aardvark
+)
+{
+ if (c_aa_close == 0) {
+ int res = 0;
+ if (!(c_aa_close = _loadFunction("c_aa_close", &res)))
+ return res;
+ }
+ return c_aa_close(aardvark);
+}
+
+
+static int (*c_aa_port) (Aardvark) = 0;
+int aa_port (
+ Aardvark aardvark
+)
+{
+ if (c_aa_port == 0) {
+ int res = 0;
+ if (!(c_aa_port = _loadFunction("c_aa_port", &res)))
+ return res;
+ }
+ return c_aa_port(aardvark);
+}
+
+
+static int (*c_aa_features) (Aardvark) = 0;
+int aa_features (
+ Aardvark aardvark
+)
+{
+ if (c_aa_features == 0) {
+ int res = 0;
+ if (!(c_aa_features = _loadFunction("c_aa_features", &res)))
+ return res;
+ }
+ return c_aa_features(aardvark);
+}
+
+
+static u32 (*c_aa_unique_id) (Aardvark) = 0;
+u32 aa_unique_id (
+ Aardvark aardvark
+)
+{
+ if (c_aa_unique_id == 0) {
+ int res = 0;
+ if (!(c_aa_unique_id = _loadFunction("c_aa_unique_id", &res)))
+ return res;
+ }
+ return c_aa_unique_id(aardvark);
+}
+
+
+static const char * (*c_aa_status_string) (int) = 0;
+const char * aa_status_string (
+ int status
+)
+{
+ if (c_aa_status_string == 0) {
+ int res = 0;
+ if (!(c_aa_status_string = _loadFunction("c_aa_status_string", &res)))
+ return 0;
+ }
+ return c_aa_status_string(status);
+}
+
+
+static int (*c_aa_log) (Aardvark, int, int) = 0;
+int aa_log (
+ Aardvark aardvark,
+ int level,
+ int handle
+)
+{
+ if (c_aa_log == 0) {
+ int res = 0;
+ if (!(c_aa_log = _loadFunction("c_aa_log", &res)))
+ return res;
+ }
+ return c_aa_log(aardvark, level, handle);
+}
+
+
+static int (*c_aa_version) (Aardvark, AardvarkVersion *) = 0;
+int aa_version (
+ Aardvark aardvark,
+ AardvarkVersion * version
+)
+{
+ if (c_aa_version == 0) {
+ int res = 0;
+ if (!(c_aa_version = _loadFunction("c_aa_version", &res)))
+ return res;
+ }
+ return c_aa_version(aardvark, version);
+}
+
+
+static int (*c_aa_configure) (Aardvark, AardvarkConfig) = 0;
+int aa_configure (
+ Aardvark aardvark,
+ AardvarkConfig config
+)
+{
+ if (c_aa_configure == 0) {
+ int res = 0;
+ if (!(c_aa_configure = _loadFunction("c_aa_configure", &res)))
+ return res;
+ }
+ return c_aa_configure(aardvark, config);
+}
+
+
+static int (*c_aa_target_power) (Aardvark, u08) = 0;
+int aa_target_power (
+ Aardvark aardvark,
+ u08 power_mask
+)
+{
+ if (c_aa_target_power == 0) {
+ int res = 0;
+ if (!(c_aa_target_power = _loadFunction("c_aa_target_power", &res)))
+ return res;
+ }
+ return c_aa_target_power(aardvark, power_mask);
+}
+
+
+static u32 (*c_aa_sleep_ms) (u32) = 0;
+u32 aa_sleep_ms (
+ u32 milliseconds
+)
+{
+ if (c_aa_sleep_ms == 0) {
+ int res = 0;
+ if (!(c_aa_sleep_ms = _loadFunction("c_aa_sleep_ms", &res)))
+ return res;
+ }
+ return c_aa_sleep_ms(milliseconds);
+}
+
+
+static int (*c_aa_async_poll) (Aardvark, int) = 0;
+int aa_async_poll (
+ Aardvark aardvark,
+ int timeout
+)
+{
+ if (c_aa_async_poll == 0) {
+ int res = 0;
+ if (!(c_aa_async_poll = _loadFunction("c_aa_async_poll", &res)))
+ return res;
+ }
+ return c_aa_async_poll(aardvark, timeout);
+}
+
+
+static int (*c_aa_i2c_free_bus) (Aardvark) = 0;
+int aa_i2c_free_bus (
+ Aardvark aardvark
+)
+{
+ if (c_aa_i2c_free_bus == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_free_bus = _loadFunction("c_aa_i2c_free_bus", &res)))
+ return res;
+ }
+ return c_aa_i2c_free_bus(aardvark);
+}
+
+
+static int (*c_aa_i2c_bitrate) (Aardvark, int) = 0;
+int aa_i2c_bitrate (
+ Aardvark aardvark,
+ int bitrate_khz
+)
+{
+ if (c_aa_i2c_bitrate == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_bitrate = _loadFunction("c_aa_i2c_bitrate", &res)))
+ return res;
+ }
+ return c_aa_i2c_bitrate(aardvark, bitrate_khz);
+}
+
+
+static int (*c_aa_i2c_bus_timeout) (Aardvark, u16) = 0;
+int aa_i2c_bus_timeout (
+ Aardvark aardvark,
+ u16 timeout_ms
+)
+{
+ if (c_aa_i2c_bus_timeout == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_bus_timeout = _loadFunction("c_aa_i2c_bus_timeout", &res)))
+ return res;
+ }
+ return c_aa_i2c_bus_timeout(aardvark, timeout_ms);
+}
+
+
+static int (*c_aa_i2c_read) (Aardvark, u16, AardvarkI2cFlags, u16, u08 *) = 0;
+int aa_i2c_read (
+ Aardvark aardvark,
+ u16 slave_addr,
+ AardvarkI2cFlags flags,
+ u16 num_bytes,
+ u08 * data_in
+)
+{
+ if (c_aa_i2c_read == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_read = _loadFunction("c_aa_i2c_read", &res)))
+ return res;
+ }
+ return c_aa_i2c_read(aardvark, slave_addr, flags, num_bytes, data_in);
+}
+
+
+static int (*c_aa_i2c_read_ext) (Aardvark, u16, AardvarkI2cFlags, u16, u08 *, u16 *) = 0;
+int aa_i2c_read_ext (
+ Aardvark aardvark,
+ u16 slave_addr,
+ AardvarkI2cFlags flags,
+ u16 num_bytes,
+ u08 * data_in,
+ u16 * num_read
+)
+{
+ if (c_aa_i2c_read_ext == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_read_ext = _loadFunction("c_aa_i2c_read_ext", &res)))
+ return res;
+ }
+ return c_aa_i2c_read_ext(aardvark, slave_addr, flags, num_bytes, data_in, num_read);
+}
+
+
+static int (*c_aa_i2c_write) (Aardvark, u16, AardvarkI2cFlags, u16, const u08 *) = 0;
+int aa_i2c_write (
+ Aardvark aardvark,
+ u16 slave_addr,
+ AardvarkI2cFlags flags,
+ u16 num_bytes,
+ const u08 * data_out
+)
+{
+ if (c_aa_i2c_write == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_write = _loadFunction("c_aa_i2c_write", &res)))
+ return res;
+ }
+ return c_aa_i2c_write(aardvark, slave_addr, flags, num_bytes, data_out);
+}
+
+
+static int (*c_aa_i2c_write_ext) (Aardvark, u16, AardvarkI2cFlags, u16, const u08 *, u16 *) = 0;
+int aa_i2c_write_ext (
+ Aardvark aardvark,
+ u16 slave_addr,
+ AardvarkI2cFlags flags,
+ u16 num_bytes,
+ const u08 * data_out,
+ u16 * num_written
+)
+{
+ if (c_aa_i2c_write_ext == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_write_ext = _loadFunction("c_aa_i2c_write_ext", &res)))
+ return res;
+ }
+ return c_aa_i2c_write_ext(aardvark, slave_addr, flags, num_bytes, data_out, num_written);
+}
+
+
+static int (*c_aa_i2c_slave_enable) (Aardvark, u08, u16, u16) = 0;
+int aa_i2c_slave_enable (
+ Aardvark aardvark,
+ u08 addr,
+ u16 maxTxBytes,
+ u16 maxRxBytes
+)
+{
+ if (c_aa_i2c_slave_enable == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_enable = _loadFunction("c_aa_i2c_slave_enable", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_enable(aardvark, addr, maxTxBytes, maxRxBytes);
+}
+
+
+static int (*c_aa_i2c_slave_disable) (Aardvark) = 0;
+int aa_i2c_slave_disable (
+ Aardvark aardvark
+)
+{
+ if (c_aa_i2c_slave_disable == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_disable = _loadFunction("c_aa_i2c_slave_disable", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_disable(aardvark);
+}
+
+
+static int (*c_aa_i2c_slave_set_response) (Aardvark, u08, const u08 *) = 0;
+int aa_i2c_slave_set_response (
+ Aardvark aardvark,
+ u08 num_bytes,
+ const u08 * data_out
+)
+{
+ if (c_aa_i2c_slave_set_response == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_set_response = _loadFunction("c_aa_i2c_slave_set_response", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_set_response(aardvark, num_bytes, data_out);
+}
+
+
+static int (*c_aa_i2c_slave_write_stats) (Aardvark) = 0;
+int aa_i2c_slave_write_stats (
+ Aardvark aardvark
+)
+{
+ if (c_aa_i2c_slave_write_stats == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_write_stats = _loadFunction("c_aa_i2c_slave_write_stats", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_write_stats(aardvark);
+}
+
+
+static int (*c_aa_i2c_slave_read) (Aardvark, u08 *, u16, u08 *) = 0;
+int aa_i2c_slave_read (
+ Aardvark aardvark,
+ u08 * addr,
+ u16 num_bytes,
+ u08 * data_in
+)
+{
+ if (c_aa_i2c_slave_read == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_read = _loadFunction("c_aa_i2c_slave_read", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_read(aardvark, addr, num_bytes, data_in);
+}
+
+
+static int (*c_aa_i2c_slave_write_stats_ext) (Aardvark, u16 *) = 0;
+int aa_i2c_slave_write_stats_ext (
+ Aardvark aardvark,
+ u16 * num_written
+)
+{
+ if (c_aa_i2c_slave_write_stats_ext == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_write_stats_ext = _loadFunction("c_aa_i2c_slave_write_stats_ext", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_write_stats_ext(aardvark, num_written);
+}
+
+
+static int (*c_aa_i2c_slave_read_ext) (Aardvark, u08 *, u16, u08 *, u16 *) = 0;
+int aa_i2c_slave_read_ext (
+ Aardvark aardvark,
+ u08 * addr,
+ u16 num_bytes,
+ u08 * data_in,
+ u16 * num_read
+)
+{
+ if (c_aa_i2c_slave_read_ext == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_slave_read_ext = _loadFunction("c_aa_i2c_slave_read_ext", &res)))
+ return res;
+ }
+ return c_aa_i2c_slave_read_ext(aardvark, addr, num_bytes, data_in, num_read);
+}
+
+
+static int (*c_aa_i2c_monitor_enable) (Aardvark) = 0;
+int aa_i2c_monitor_enable (
+ Aardvark aardvark
+)
+{
+ if (c_aa_i2c_monitor_enable == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_monitor_enable = _loadFunction("c_aa_i2c_monitor_enable", &res)))
+ return res;
+ }
+ return c_aa_i2c_monitor_enable(aardvark);
+}
+
+
+static int (*c_aa_i2c_monitor_disable) (Aardvark) = 0;
+int aa_i2c_monitor_disable (
+ Aardvark aardvark
+)
+{
+ if (c_aa_i2c_monitor_disable == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_monitor_disable = _loadFunction("c_aa_i2c_monitor_disable", &res)))
+ return res;
+ }
+ return c_aa_i2c_monitor_disable(aardvark);
+}
+
+
+static int (*c_aa_i2c_monitor_read) (Aardvark, u16, u16 *) = 0;
+int aa_i2c_monitor_read (
+ Aardvark aardvark,
+ u16 num_bytes,
+ u16 * data
+)
+{
+ if (c_aa_i2c_monitor_read == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_monitor_read = _loadFunction("c_aa_i2c_monitor_read", &res)))
+ return res;
+ }
+ return c_aa_i2c_monitor_read(aardvark, num_bytes, data);
+}
+
+
+static int (*c_aa_i2c_pullup) (Aardvark, u08) = 0;
+int aa_i2c_pullup (
+ Aardvark aardvark,
+ u08 pullup_mask
+)
+{
+ if (c_aa_i2c_pullup == 0) {
+ int res = 0;
+ if (!(c_aa_i2c_pullup = _loadFunction("c_aa_i2c_pullup", &res)))
+ return res;
+ }
+ return c_aa_i2c_pullup(aardvark, pullup_mask);
+}
+
+
+static int (*c_aa_spi_bitrate) (Aardvark, int) = 0;
+int aa_spi_bitrate (
+ Aardvark aardvark,
+ int bitrate_khz
+)
+{
+ if (c_aa_spi_bitrate == 0) {
+ int res = 0;
+ if (!(c_aa_spi_bitrate = _loadFunction("c_aa_spi_bitrate", &res)))
+ return res;
+ }
+ return c_aa_spi_bitrate(aardvark, bitrate_khz);
+}
+
+
+static int (*c_aa_spi_configure) (Aardvark, AardvarkSpiPolarity, AardvarkSpiPhase, AardvarkSpiBitorder) = 0;
+int aa_spi_configure (
+ Aardvark aardvark,
+ AardvarkSpiPolarity polarity,
+ AardvarkSpiPhase phase,
+ AardvarkSpiBitorder bitorder
+)
+{
+ if (c_aa_spi_configure == 0) {
+ int res = 0;
+ if (!(c_aa_spi_configure = _loadFunction("c_aa_spi_configure", &res)))
+ return res;
+ }
+ return c_aa_spi_configure(aardvark, polarity, phase, bitorder);
+}
+
+
+static int (*c_aa_spi_write) (Aardvark, u16, const u08 *, u16, u08 *) = 0;
+int aa_spi_write (
+ Aardvark aardvark,
+ u16 out_num_bytes,
+ const u08 * data_out,
+ u16 in_num_bytes,
+ u08 * data_in
+)
+{
+ if (c_aa_spi_write == 0) {
+ int res = 0;
+ if (!(c_aa_spi_write = _loadFunction("c_aa_spi_write", &res)))
+ return res;
+ }
+ return c_aa_spi_write(aardvark, out_num_bytes, data_out, in_num_bytes, data_in);
+}
+
+
+static int (*c_aa_spi_slave_enable) (Aardvark) = 0;
+int aa_spi_slave_enable (
+ Aardvark aardvark
+)
+{
+ if (c_aa_spi_slave_enable == 0) {
+ int res = 0;
+ if (!(c_aa_spi_slave_enable = _loadFunction("c_aa_spi_slave_enable", &res)))
+ return res;
+ }
+ return c_aa_spi_slave_enable(aardvark);
+}
+
+
+static int (*c_aa_spi_slave_disable) (Aardvark) = 0;
+int aa_spi_slave_disable (
+ Aardvark aardvark
+)
+{
+ if (c_aa_spi_slave_disable == 0) {
+ int res = 0;
+ if (!(c_aa_spi_slave_disable = _loadFunction("c_aa_spi_slave_disable", &res)))
+ return res;
+ }
+ return c_aa_spi_slave_disable(aardvark);
+}
+
+
+static int (*c_aa_spi_slave_set_response) (Aardvark, u08, const u08 *) = 0;
+int aa_spi_slave_set_response (
+ Aardvark aardvark,
+ u08 num_bytes,
+ const u08 * data_out
+)
+{
+ if (c_aa_spi_slave_set_response == 0) {
+ int res = 0;
+ if (!(c_aa_spi_slave_set_response = _loadFunction("c_aa_spi_slave_set_response", &res)))
+ return res;
+ }
+ return c_aa_spi_slave_set_response(aardvark, num_bytes, data_out);
+}
+
+
+static int (*c_aa_spi_slave_read) (Aardvark, u16, u08 *) = 0;
+int aa_spi_slave_read (
+ Aardvark aardvark,
+ u16 num_bytes,
+ u08 * data_in
+)
+{
+ if (c_aa_spi_slave_read == 0) {
+ int res = 0;
+ if (!(c_aa_spi_slave_read = _loadFunction("c_aa_spi_slave_read", &res)))
+ return res;
+ }
+ return c_aa_spi_slave_read(aardvark, num_bytes, data_in);
+}
+
+
+static int (*c_aa_spi_master_ss_polarity) (Aardvark, AardvarkSpiSSPolarity) = 0;
+int aa_spi_master_ss_polarity (
+ Aardvark aardvark,
+ AardvarkSpiSSPolarity polarity
+)
+{
+ if (c_aa_spi_master_ss_polarity == 0) {
+ int res = 0;
+ if (!(c_aa_spi_master_ss_polarity = _loadFunction("c_aa_spi_master_ss_polarity", &res)))
+ return res;
+ }
+ return c_aa_spi_master_ss_polarity(aardvark, polarity);
+}
+
+
+static int (*c_aa_gpio_direction) (Aardvark, u08) = 0;
+int aa_gpio_direction (
+ Aardvark aardvark,
+ u08 direction_mask
+)
+{
+ if (c_aa_gpio_direction == 0) {
+ int res = 0;
+ if (!(c_aa_gpio_direction = _loadFunction("c_aa_gpio_direction", &res)))
+ return res;
+ }
+ return c_aa_gpio_direction(aardvark, direction_mask);
+}
+
+
+static int (*c_aa_gpio_pullup) (Aardvark, u08) = 0;
+int aa_gpio_pullup (
+ Aardvark aardvark,
+ u08 pullup_mask
+)
+{
+ if (c_aa_gpio_pullup == 0) {
+ int res = 0;
+ if (!(c_aa_gpio_pullup = _loadFunction("c_aa_gpio_pullup", &res)))
+ return res;
+ }
+ return c_aa_gpio_pullup(aardvark, pullup_mask);
+}
+
+
+static int (*c_aa_gpio_get) (Aardvark) = 0;
+int aa_gpio_get (
+ Aardvark aardvark
+)
+{
+ if (c_aa_gpio_get == 0) {
+ int res = 0;
+ if (!(c_aa_gpio_get = _loadFunction("c_aa_gpio_get", &res)))
+ return res;
+ }
+ return c_aa_gpio_get(aardvark);
+}
+
+
+static int (*c_aa_gpio_set) (Aardvark, u08) = 0;
+int aa_gpio_set (
+ Aardvark aardvark,
+ u08 value
+)
+{
+ if (c_aa_gpio_set == 0) {
+ int res = 0;
+ if (!(c_aa_gpio_set = _loadFunction("c_aa_gpio_set", &res)))
+ return res;
+ }
+ return c_aa_gpio_set(aardvark, value);
+}
+
+
+static int (*c_aa_gpio_change) (Aardvark, u16) = 0;
+int aa_gpio_change (
+ Aardvark aardvark,
+ u16 timeout
+)
+{
+ if (c_aa_gpio_change == 0) {
+ int res = 0;
+ if (!(c_aa_gpio_change = _loadFunction("c_aa_gpio_change", &res)))
+ return res;
+ }
+ return c_aa_gpio_change(aardvark, timeout);
+}
+
+
Index: trunk/sw/aardvark_c/Makefile
===================================================================
--- trunk/sw/aardvark_c/Makefile (nonexistent)
+++ trunk/sw/aardvark_c/Makefile (revision 3)
@@ -0,0 +1,74 @@
+#==========================================================================
+# (c) 2003-2008 Total Phase, Inc.
+#--------------------------------------------------------------------------
+# Project : Aardvark Sample Code
+# File : Makefile
+#--------------------------------------------------------------------------
+# Redistribution and use of this file in source and binary forms, with
+# or without modification, are permitted.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#==========================================================================
+
+#==========================================================================
+# CONFIGURATION
+#==========================================================================
+OS=$(shell if [ -x /bin/uname ]; then /bin/uname; fi)
+
+ifeq ($(OS),Linux)
+SYSLIBS=-ldl
+endif
+
+
+#==========================================================================
+# CONSTANTS
+#==========================================================================
+OUTDIR=_output
+CC=gcc
+CFLAGS=-Wall -Werror
+LD=$(CC)
+
+
+#==========================================================================
+# TARGETS
+#==========================================================================
+TARGETS= i2cSlaveTest
+
+BINARIES=$(TARGETS:%=$(OUTDIR)/%)
+
+all : $(OUTDIR) $(BINARIES)
+ @if [ -r aardvark.so ]; then cp -f aardvark.so $(OUTDIR); fi
+ @if [ -r aardvark.dll ]; then cp -f aardvark.dll $(OUTDIR); fi
+
+$(BINARIES) : % : $(OUTDIR)/aardvark.o %.o
+ @echo " Linking $@"
+ @$(LD) -o $@ $^ $(SYSLIBS)
+
+
+#==========================================================================
+# RULES
+#==========================================================================
+$(OUTDIR)/%.o : %.c
+ @echo "+++ Compiling $<"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(OUTDIR) :
+ @echo "=== Making output directory."
+ -@mkdir -p $(OUTDIR)
+
+clean:
+ @echo "=== Cleaning output directory."
+ @rm -fr $(OUTDIR)
+ @rm -f MSVC/*.ncb MSVC/*.opt MSVC/*.plg
+ @rm -f .bak* *~
Index: trunk/syn/Altera/pll_48MHz.v
===================================================================
--- trunk/syn/Altera/pll_48MHz.v (nonexistent)
+++ trunk/syn/Altera/pll_48MHz.v (revision 3)
@@ -0,0 +1,278 @@
+// megafunction wizard: %ALTPLL%
+// GENERATION: STANDARD
+// VERSION: WM1.0
+// MODULE: altpll
+
+// ============================================================
+// File Name: pll_48MHz.v
+// Megafunction Name(s):
+// altpll
+//
+// Simulation Library Files(s):
+// altera_mf
+// ============================================================
+// ************************************************************
+// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
+//
+// 7.2 Build 203 02/05/2008 SP 2 SJ Web Edition
+// ************************************************************
+
+
+//Copyright (C) 1991-2007 Altera Corporation
+//Your use of Altera Corporation's design tools, logic functions
+//and other software and tools, and its AMPP partner logic
+//functions, and any output files from any of the foregoing
+//(including device programming or simulation files), and any
+//associated documentation or information are expressly subject
+//to the terms and conditions of the Altera Program License
+//Subscription Agreement, Altera MegaCore Function License
+//Agreement, or other applicable license agreement, including,
+//without limitation, that your use is for the sole purpose of
+//programming logic devices manufactured by Altera and sold by
+//Altera or its authorized distributors. Please refer to the
+//applicable agreement for further details.
+
+
+// synopsys translate_off
+`timescale 1 ps / 1 ps
+// synopsys translate_on
+module pll_48MHz (
+ inclk0,
+ locked);
+
+ input inclk0;
+ output locked;
+
+ wire sub_wire0;
+ wire [0:0] sub_wire3 = 1'h0;
+ wire locked = sub_wire0;
+ wire sub_wire1 = inclk0;
+ wire [1:0] sub_wire2 = {sub_wire3, sub_wire1};
+
+ altpll altpll_component (
+ .inclk (sub_wire2),
+ .locked (sub_wire0),
+ .activeclock (),
+ .areset (1'b0),
+ .clk (),
+ .clkbad (),
+ .clkena ({6{1'b1}}),
+ .clkloss (),
+ .clkswitch (1'b0),
+ .configupdate (1'b0),
+ .enable0 (),
+ .enable1 (),
+ .extclk (),
+ .extclkena ({4{1'b1}}),
+ .fbin (1'b1),
+ .fbmimicbidir (),
+ .fbout (),
+ .pfdena (1'b1),
+ .phasecounterselect ({4{1'b1}}),
+ .phasedone (),
+ .phasestep (1'b1),
+ .phaseupdown (1'b1),
+ .pllena (1'b1),
+ .scanaclr (1'b0),
+ .scanclk (1'b0),
+ .scanclkena (1'b1),
+ .scandata (1'b0),
+ .scandataout (),
+ .scandone (),
+ .scanread (1'b0),
+ .scanwrite (1'b0),
+ .sclkout0 (),
+ .sclkout1 (),
+ .vcooverrange (),
+ .vcounderrange ());
+ defparam
+ altpll_component.gate_lock_signal = "NO",
+ altpll_component.inclk0_input_frequency = 20833,
+ altpll_component.intended_device_family = "Cyclone II",
+ altpll_component.invalid_lock_multiplier = 5,
+ altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll_48MHz",
+ altpll_component.lpm_type = "altpll",
+ altpll_component.operation_mode = "NO_COMPENSATION",
+ altpll_component.port_activeclock = "PORT_UNUSED",
+ altpll_component.port_areset = "PORT_UNUSED",
+ altpll_component.port_clkbad0 = "PORT_UNUSED",
+ altpll_component.port_clkbad1 = "PORT_UNUSED",
+ altpll_component.port_clkloss = "PORT_UNUSED",
+ altpll_component.port_clkswitch = "PORT_UNUSED",
+ altpll_component.port_configupdate = "PORT_UNUSED",
+ altpll_component.port_fbin = "PORT_UNUSED",
+ altpll_component.port_inclk0 = "PORT_USED",
+ altpll_component.port_inclk1 = "PORT_UNUSED",
+ altpll_component.port_locked = "PORT_USED",
+ altpll_component.port_pfdena = "PORT_UNUSED",
+ altpll_component.port_phasecounterselect = "PORT_UNUSED",
+ altpll_component.port_phasedone = "PORT_UNUSED",
+ altpll_component.port_phasestep = "PORT_UNUSED",
+ altpll_component.port_phaseupdown = "PORT_UNUSED",
+ altpll_component.port_pllena = "PORT_UNUSED",
+ altpll_component.port_scanaclr = "PORT_UNUSED",
+ altpll_component.port_scanclk = "PORT_UNUSED",
+ altpll_component.port_scanclkena = "PORT_UNUSED",
+ altpll_component.port_scandata = "PORT_UNUSED",
+ altpll_component.port_scandataout = "PORT_UNUSED",
+ altpll_component.port_scandone = "PORT_UNUSED",
+ altpll_component.port_scanread = "PORT_UNUSED",
+ altpll_component.port_scanwrite = "PORT_UNUSED",
+ altpll_component.port_clk0 = "PORT_UNUSED",
+ altpll_component.port_clk1 = "PORT_UNUSED",
+ altpll_component.port_clk2 = "PORT_UNUSED",
+ altpll_component.port_clk3 = "PORT_UNUSED",
+ altpll_component.port_clk4 = "PORT_UNUSED",
+ altpll_component.port_clk5 = "PORT_UNUSED",
+ altpll_component.port_clkena0 = "PORT_UNUSED",
+ altpll_component.port_clkena1 = "PORT_UNUSED",
+ altpll_component.port_clkena2 = "PORT_UNUSED",
+ altpll_component.port_clkena3 = "PORT_UNUSED",
+ altpll_component.port_clkena4 = "PORT_UNUSED",
+ altpll_component.port_clkena5 = "PORT_UNUSED",
+ altpll_component.port_extclk0 = "PORT_UNUSED",
+ altpll_component.port_extclk1 = "PORT_UNUSED",
+ altpll_component.port_extclk2 = "PORT_UNUSED",
+ altpll_component.port_extclk3 = "PORT_UNUSED",
+ altpll_component.valid_lock_multiplier = 1;
+
+
+endmodule
+
+// ============================================================
+// CNX file retrieval info
+// ============================================================
+// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
+// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
+// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "0"
+// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
+// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low"
+// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1"
+// Retrieval info: PRIVATE: BANDWIDTH_USE_CUSTOM STRING "0"
+// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0"
+// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0"
+// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0"
+// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "1"
+// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "1"
+// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
+// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
+// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
+// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "e0"
+// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "8"
+// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
+// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
+// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
+// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "1"
+// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
+// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
+// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
+// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "48.000"
+// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
+// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000"
+// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
+// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
+// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
+// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone II"
+// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1"
+// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1"
+// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1"
+// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
+// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
+// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "0"
+// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "0"
+// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
+// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
+// Retrieval info: PRIVATE: PLL_ENA_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0"
+// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0"
+// Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0"
+// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
+// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
+// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
+// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll_48MHz.mif"
+// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
+// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "0"
+// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
+// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
+// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0"
+// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000"
+// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
+// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
+// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
+// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0"
+// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
+// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
+// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
+// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
+// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
+// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
+// Retrieval info: CONSTANT: GATE_LOCK_SIGNAL STRING "NO"
+// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "20833"
+// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone II"
+// Retrieval info: CONSTANT: INVALID_LOCK_MULTIPLIER NUMERIC "5"
+// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
+// Retrieval info: CONSTANT: OPERATION_MODE STRING "NO_COMPENSATION"
+// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
+// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED"
+// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
+// Retrieval info: CONSTANT: VALID_LOCK_MULTIPLIER NUMERIC "1"
+// Retrieval info: USED_PORT: @clk 0 0 6 0 OUTPUT_CLK_EXT VCC "@clk[5..0]"
+// Retrieval info: USED_PORT: @extclk 0 0 4 0 OUTPUT_CLK_EXT VCC "@extclk[3..0]"
+// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
+// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked"
+// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
+// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
+// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz.v TRUE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz.ppf TRUE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz.inc FALSE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz.cmp FALSE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz.bsf FALSE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz_inst.v TRUE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz_bb.v FALSE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz_waveforms.html TRUE FALSE
+// Retrieval info: GEN_FILE: TYPE_NORMAL pll_48MHz_wave*.jpg FALSE FALSE
+// Retrieval info: LIB_FILE: altera_mf
+// Retrieval info: CBX_MODULE_PREFIX: ON
Index: trunk/syn/Altera/i2cSlaveTopAltera.v
===================================================================
--- trunk/syn/Altera/i2cSlaveTopAltera.v (nonexistent)
+++ trunk/syn/Altera/i2cSlaveTopAltera.v (revision 3)
@@ -0,0 +1,97 @@
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// i2cSlaveTopAltera.v ////
+//// ////
+//// This file is part of the i2cSlave opencores effort.
+//// ////
+//// ////
+//// Module Description: ////
+//// You will need to modify this file to implement your
+//// interface.
+//// ////
+//// To Do: ////
+////
+//// ////
+//// Author(s): ////
+//// - Steve Fielding, sfielding@base2designs.com ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//// ////
+//// Copyright (C) 2008 Steve Fielding and OPENCORES.ORG ////
+//// ////
+//// This source file may be used and distributed without ////
+//// restriction provided that this copyright statement is not ////
+//// removed from the file and that any derivative work contains ////
+//// the original copyright notice and the associated disclaimer. ////
+//// ////
+//// This source file is free software; you can redistribute it ////
+//// and/or modify it under the terms of the GNU Lesser General ////
+//// Public License as published by the Free Software Foundation; ////
+//// either version 2.1 of the License, or (at your option) any ////
+//// later version. ////
+//// ////
+//// This source is distributed in the hope that it will be ////
+//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
+//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
+//// PURPOSE. See the GNU Lesser General Public License for more ////
+//// details. ////
+//// ////
+//// You should have received a copy of the GNU Lesser General ////
+//// Public License along with this source; if not, download it ////
+//// from ////
+//// ////
+//////////////////////////////////////////////////////////////////////
+//
+`include "i2cSlave_define.v"
+
+
+module i2cSlaveTopAltera (
+ clk,
+ sda,
+ scl,
+ LED
+);
+input clk;
+inout sda;
+input scl;
+output LED;
+
+//local wires and regs
+reg [1:0] rstReg;
+wire rst;
+wire pll_locked;
+wire [7:0] myReg0;
+
+assign LED = myReg0[0];
+
+i2cSlave u_i2cSlave(
+ .clk(clk),
+ .rst(rst),
+ .sda(sda),
+ .scl(scl),
+ .myReg0(myReg0),
+ .myReg1(),
+ .myReg2(),
+ .myReg3(),
+ .myReg4(8'h12),
+ .myReg5(8'h34),
+ .myReg6(8'h56),
+ .myReg7(8'h78)
+
+);
+
+pll_48MHz pll_48MHz_inst (
+ .inclk0 ( clk ),
+ .locked( pll_locked)
+ );
+
+//generate sync reset from pll lock signal
+always @(posedge clk) begin
+ rstReg[1:0] <= {rstReg[0], ~pll_locked};
+end
+assign rst = rstReg[1];
+
+endmodule
+
+
+
Index: trunk/syn/Altera/i2cSlaveTopAltera.qpf
===================================================================
--- trunk/syn/Altera/i2cSlaveTopAltera.qpf (nonexistent)
+++ trunk/syn/Altera/i2cSlaveTopAltera.qpf (revision 3)
@@ -0,0 +1,23 @@
+# Copyright (C) 1991-2007 Altera Corporation
+# Your use of Altera Corporation's design tools, logic functions
+# and other software and tools, and its AMPP partner logic
+# functions, and any output files from any of the foregoing
+# (including device programming or simulation files), and any
+# associated documentation or information are expressly subject
+# to the terms and conditions of the Altera Program License
+# Subscription Agreement, Altera MegaCore Function License
+# Agreement, or other applicable license agreement, including,
+# without limitation, that your use is for the sole purpose of
+# programming logic devices manufactured by Altera and sold by
+# Altera or its authorized distributors. Please refer to the
+# applicable agreement for further details.
+
+
+
+QUARTUS_VERSION = "7.2"
+DATE = "20:22:13 December 16, 2008"
+
+
+# Revisions
+
+PROJECT_REVISION = "i2cSlaveTopAltera"
Index: trunk/syn/Altera/i2cSlaveTopAltera.cof
===================================================================
--- trunk/syn/Altera/i2cSlaveTopAltera.cof (nonexistent)
+++ trunk/syn/Altera/i2cSlaveTopAltera.cof (revision 3)
@@ -0,0 +1,17 @@
+
+
+ NONE
+ i2cSlaveTopAltera.rbf
+ 1
+ 1
+ 0
+
+ 1
+
+ i2cSlaveTopAltera.sof
+
+
+ 4
+
+
+
\ No newline at end of file
Index: trunk/syn/Altera/download.bat
===================================================================
--- trunk/syn/Altera/download.bat (nonexistent)
+++ trunk/syn/Altera/download.bat (revision 3)
@@ -0,0 +1,3 @@
+fpgaConfig -i i2cSlaveTopAltera.rbf -r -w -l -a 0
+pause
+
Index: trunk/syn/Altera/i2cSlaveAlteraTop.sdc
===================================================================
--- trunk/syn/Altera/i2cSlaveAlteraTop.sdc (nonexistent)
+++ trunk/syn/Altera/i2cSlaveAlteraTop.sdc (revision 3)
@@ -0,0 +1,114 @@
+## Generated SDC file "i2cSlaveAlteraTop.sdc"
+
+## Copyright (C) 1991-2007 Altera Corporation
+## Your use of Altera Corporation's design tools, logic functions
+## and other software and tools, and its AMPP partner logic
+## functions, and any output files from any of the foregoing
+## (including device programming or simulation files), and any
+## associated documentation or information are expressly subject
+## to the terms and conditions of the Altera Program License
+## Subscription Agreement, Altera MegaCore Function License
+## Agreement, or other applicable license agreement, including,
+## without limitation, that your use is for the sole purpose of
+## programming logic devices manufactured by Altera and sold by
+## Altera or its authorized distributors. Please refer to the
+## applicable agreement for further details.
+
+
+## VENDOR "Altera"
+## PROGRAM "Quartus II"
+## VERSION "Version 7.2 Build 203 02/05/2008 Service Pack 2 SJ Web Edition"
+
+## DATE "Fri May 16 09:55:20 2008"
+
+##
+## DEVICE "EP2C20Q240C8"
+##
+
+
+#**************************************************************
+# Time Information
+#**************************************************************
+
+set_time_format -unit ns -decimal_places 3
+
+
+
+#**************************************************************
+# Create Clock
+#**************************************************************
+
+create_clock -name {clk} -period 20.830 -waveform { 0.000 10.415 } [get_ports {clk}] -add
+
+
+#**************************************************************
+# Create Generated Clock
+#**************************************************************
+
+derive_pll_clocks -use_tan_name
+
+
+#**************************************************************
+# Set Clock Latency
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Clock Uncertainty
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Input Delay
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Output Delay
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Clock Groups
+#**************************************************************
+
+
+
+#**************************************************************
+# Set False Path
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Multicycle Path
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Maximum Delay
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Minimum Delay
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Input Transition
+#**************************************************************
+
+
+
+#**************************************************************
+# Set Load
+#**************************************************************
+
Index: trunk/syn/Altera/i2cSlaveTopAltera.qsf
===================================================================
--- trunk/syn/Altera/i2cSlaveTopAltera.qsf (nonexistent)
+++ trunk/syn/Altera/i2cSlaveTopAltera.qsf (revision 3)
@@ -0,0 +1,67 @@
+# Copyright (C) 1991-2007 Altera Corporation
+# Your use of Altera Corporation's design tools, logic functions
+# and other software and tools, and its AMPP partner logic
+# functions, and any output files from any of the foregoing
+# (including device programming or simulation files), and any
+# associated documentation or information are expressly subject
+# to the terms and conditions of the Altera Program License
+# Subscription Agreement, Altera MegaCore Function License
+# Agreement, or other applicable license agreement, including,
+# without limitation, that your use is for the sole purpose of
+# programming logic devices manufactured by Altera and sold by
+# Altera or its authorized distributors. Please refer to the
+# applicable agreement for further details.
+
+
+# The default values for assignments are stored in the file
+# i2cSlaveTopAltera_assignment_defaults.qdf
+# If this file doesn't exist, and for assignments not listed, see file
+# assignment_defaults.qdf
+
+# Altera recommends that you do not modify this file. This
+# file is updated automatically by the Quartus II software
+# and any changes you make may be lost or overwritten.
+
+
+set_global_assignment -name FAMILY "Cyclone II"
+set_global_assignment -name DEVICE EP2C20Q240C8
+set_global_assignment -name TOP_LEVEL_ENTITY i2cSlaveTopAltera
+set_global_assignment -name ORIGINAL_QUARTUS_VERSION "7.2 SP3"
+set_global_assignment -name PROJECT_CREATION_TIME_DATE "20:22:13 DECEMBER 16, 2008"
+set_global_assignment -name LAST_QUARTUS_VERSION "7.2 SP3"
+set_global_assignment -name USE_GENERATED_PHYSICAL_CONSTRAINTS OFF -section_id eda_palace
+set_global_assignment -name USER_LIBRARIES ../../rtl/
+set_global_assignment -name VERILOG_FILE ../../rtl/timescale.v
+set_global_assignment -name VERILOG_FILE ../../rtl/i2cSlave.v
+set_global_assignment -name VERILOG_FILE ../../rtl/i2cSlave_define.v
+set_global_assignment -name VERILOG_FILE ../../rtl/i2cSlaveTop.v
+set_global_assignment -name VERILOG_FILE ../../rtl/registerInterface.v
+set_global_assignment -name VERILOG_FILE ../../rtl/serialInterface.v
+set_global_assignment -name VERILOG_FILE pll_48MHz.v
+set_global_assignment -name VERILOG_FILE i2cSlaveTopAltera.v
+
+
+set_global_assignment -name NUMBER_OF_PATHS_TO_REPORT 1000
+set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS OFF
+set_global_assignment -name USE_TIMEQUEST_TIMING_ANALYZER ON
+set_global_assignment -name TIMEQUEST_DO_REPORT_TIMING ON
+set_global_assignment -name SDC_FILE i2cSlaveAlteraTop.sdc
+
+set_global_assignment -name RESERVE_PIN "AS INPUT TRI-STATED"
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED WITH WEAK PULL-UP"
+set_global_assignment -name CYCLONEII_CONFIGURATION_SCHEME "PASSIVE SERIAL"
+set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
+
+
+set_location_assignment PIN_30 -to clk
+set_location_assignment PIN_46 -to LED
+set_location_assignment PIN_41 -to scl
+set_location_assignment PIN_42 -to sda
+
+
+
+set_instance_assignment -name PARTITION_HIERARCHY no_file_for_top_partition -to | -section_id Top
+set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
+set_global_assignment -name PARTITION_COLOR 2147039 -section_id Top
+set_global_assignment -name LL_ROOT_REGION ON -section_id "Root Region"
+set_global_assignment -name LL_MEMBER_STATE LOCKED -section_id "Root Region"
Index: trunk/progFiles/2008_12_17/aardvark_sw/run_i2cSlaveTest.bat
===================================================================
--- trunk/progFiles/2008_12_17/aardvark_sw/run_i2cSlaveTest.bat (nonexistent)
+++ trunk/progFiles/2008_12_17/aardvark_sw/run_i2cSlaveTest.bat (revision 3)
@@ -0,0 +1,3 @@
+i2cSlaveTest.exe 0
+pause
+
Index: trunk/progFiles/2008_12_17/aardvark_sw/aardvark.dll
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/progFiles/2008_12_17/aardvark_sw/aardvark.dll
===================================================================
--- trunk/progFiles/2008_12_17/aardvark_sw/aardvark.dll (nonexistent)
+++ trunk/progFiles/2008_12_17/aardvark_sw/aardvark.dll (revision 3)
trunk/progFiles/2008_12_17/aardvark_sw/aardvark.dll
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/progFiles/2008_12_17/aardvark_sw/readWriteTest.xml
===================================================================
--- trunk/progFiles/2008_12_17/aardvark_sw/readWriteTest.xml (nonexistent)
+++ trunk/progFiles/2008_12_17/aardvark_sw/readWriteTest.xml (revision 3)
@@ -0,0 +1,10 @@
+
+
+
+ 00 89 ab cd ef
+ 00
+
+ 04
+
+
+
Index: trunk/progFiles/2008_12_17/aardvark_sw/i2cSlaveTest.exe
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/progFiles/2008_12_17/aardvark_sw/i2cSlaveTest.exe
===================================================================
--- trunk/progFiles/2008_12_17/aardvark_sw/i2cSlaveTest.exe (nonexistent)
+++ trunk/progFiles/2008_12_17/aardvark_sw/i2cSlaveTest.exe (revision 3)
trunk/progFiles/2008_12_17/aardvark_sw/i2cSlaveTest.exe
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf.b2d.bin
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf.b2d.bin
===================================================================
--- trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf.b2d.bin (nonexistent)
+++ trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf.b2d.bin (revision 3)
trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf.b2d.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/progFiles/2008_12_17/download.bat
===================================================================
--- trunk/progFiles/2008_12_17/download.bat (nonexistent)
+++ trunk/progFiles/2008_12_17/download.bat (revision 3)
@@ -0,0 +1,3 @@
+fpgaConfig -i i2cSlaveTopAltera.rbf -r -w -l -a 0
+pause
+
Index: trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf
===================================================================
--- trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf (nonexistent)
+++ trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf (revision 3)
trunk/progFiles/2008_12_17/i2cSlaveTopAltera.rbf
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property