URL
https://opencores.org/ocsvn/mb-jpeg/mb-jpeg/trunk
Subversion Repositories mb-jpeg
Compare Revisions
- This comparison shows the changes necessary to convert path
/mb-jpeg/tags/STEP2_2b/drivers
- from Rev 61 to Rev 66
- ↔ Reverse comparison
Rev 61 → Rev 66
/fsl_dct_v1_00_a/src/fsl_dct.c
0,0 → 1,12
////////////////////////////////////////////////////////////////////////////// |
// Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/src/fsl_dct.c |
// Version: 1.00.a |
// Description: fsl_dct (FSL DCT accelerator) Driver Source File |
// Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
////////////////////////////////////////////////////////////////////////////// |
|
#include "fsl_dct.h" |
/* |
* Write your driver implementation in this file. |
*/ |
|
/fsl_dct_v1_00_a/src/fsl_dct.h
0,0 → 1,75
////////////////////////////////////////////////////////////////////////////// |
// Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/src/fsl_dct.h |
// Version: 1.00.a |
// Description: fsl_dct (FSL DCT accelerator) Driver Header File |
// Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
////////////////////////////////////////////////////////////////////////////// |
|
#ifndef FSL_DCT_H |
#define FSL_DCT_H |
|
#include "xstatus.h" |
|
#include "fsl.h" |
#define write_into_fsl(val, id) putfsl(val, id) |
#define read_from_fsl(val, id) getfsl(val, id) |
|
/* |
* A macro for accessing FSL peripheral. |
* |
* This example driver writes all the data in the input arguments |
* into the input FSL bus through blocking writes. FSL peripheral will |
* automatically read from the FSL bus. Once all the inputs |
* have been written, the output from the FSL peripheral is read |
* into output arguments through blocking reads. |
* |
* Arguments: |
* input_slot_id |
* Compile time constant indicating FSL slot from |
* which coprocessor read the input data. Defined in |
* xparameters.h . |
* output_slot_id |
* Compile time constant indicating FSL slot into |
* which the coprocessor write output data. Defined in |
* xparameters.h . |
* input_0 An array of unsigned integers. Array size is 8 |
* output_0 An array of unsigned integers. Array size is 8 |
* |
* Caveats: |
* The output_slot_id and input_slot_id arguments must be |
* constants available at compile time. Do not pass |
* variables for these arguments. |
* |
* Since this is a macro, using it too many times will |
* increase the size of your application. In such cases, |
* or when this macro is too simplistic for your |
* application you may want to create your own instance |
* specific driver function (not a macro) using the |
* macros defined in this file and the slot |
* identifiers defined in xparameters.h . Please see the |
* example code (fsl_dct_app.c) for details. |
*/ |
|
#define fsl_dct(\ |
input_slot_id,\ |
output_slot_id,\ |
input_0, \ |
output_0 \ |
)\ |
{\ |
int i;\ |
\ |
for (i=0; i<8; i++)\ |
{\ |
write_into_fsl(input_0[i], input_slot_id);\ |
}\ |
\ |
for (i=0; i<8; i++)\ |
{\ |
read_from_fsl(output_0[i], output_slot_id);\ |
}\ |
} |
|
XStatus FSL_DCT_SelfTest(); |
|
#endif |
/fsl_dct_v1_00_a/src/fsl_dct_selftest.c
0,0 → 1,47
////////////////////////////////////////////////////////////////////////////// |
// Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/src/fsl_dct_selftest.c |
// Version: 1.00.a |
// Description: |
// Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
////////////////////////////////////////////////////////////////////////////// |
|
#include "xparameters.h" |
#include "fsl_dct.h" |
|
/* IMPORTANT: |
* In order to run this self test, you need to modify the value of following |
* micros according to the slot ID defined in xparameters.h file. |
*/ |
#define input_slot_id XPAR_FSL_FSL_DCT_0_INPUT_SLOT_ID |
#define output_slot_id XPAR_FSL_FSL_DCT_0_OUTPUT_SLOT_ID |
|
XStatus FSL_DCT_SelfTest() |
{ |
unsigned int input_0[8]; |
unsigned int output_0[8]; |
|
//Initialize your input data over here: |
input_0[0] = 12345; |
input_0[1] = 24690; |
input_0[2] = 37035; |
input_0[3] = 49380; |
input_0[4] = 61725; |
input_0[5] = 74070; |
input_0[6] = 86415; |
input_0[7] = 98760; |
|
//Call the macro with instance specific slot IDs |
fsl_dct( |
input_slot_id, |
output_slot_id, |
input_0, |
output_0 |
); |
|
if (output_0[0] != 444420) |
return XST_FAILURE; |
if (output_0[7] != 444420) |
return XST_FAILURE; |
|
return XST_SUCCESS; |
} |
/fsl_dct_v1_00_a/src/Makefile
0,0 → 1,32
############################################################################## |
## Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/src/Makefile |
## Description: Microprocessor Driver Makefile |
## Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
############################################################################## |
|
COMPILER= |
ARCHIVER= |
CP=cp |
COMPILER_FLAGS= |
EXTRA_COMPILER_FLAGS= |
LIB=libxil.a |
|
RELEASEDIR=../../../lib |
INCLUDEDIR=../../../include |
INCLUDES=-I./. -I${INCLUDEDIR} |
|
INCLUDEFILES=*.h |
LIBSOURCES=*.c |
OUTS = *.o |
|
libs: |
echo "Compiling fsl_dct_v1_00_a" |
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES) |
$(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS} |
make clean |
|
include: |
${CP} $(INCLUDEFILES) $(INCLUDEDIR) |
|
clean: |
rm -rf ${OUTS} |
/fsl_dct_v1_00_a/data/fsl_dct_v2_1_0.tcl
0,0 → 1,53
############################################################################## |
## Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/data/fsl_dct_v2_1_0.tcl |
## Description: Tool Command Language |
## Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
############################################################################## |
|
## Note: |
## This tcl file will detect the FSL id number of the connected FSL interface, |
## and define them as macro in xparameters.h file. |
|
proc generate {drv_handle} { |
puts "Generating Macros for FSL peripheral access ..." |
set hw_inst_handle [xget_sw_parameter_handle $drv_handle "HW_INSTANCE"] |
set hw_inst [xget_value $hw_inst_handle "value"] |
set drv_name_handle [xget_sw_parameter_handle $drv_handle "DRIVER_NAME"] |
set ipname [xget_value $drv_name_handle "value"] |
set header_file [format "x%s_fsl.h" $ipname] |
fsl_defines "xparameters.h" $hw_inst $ipname |
} |
|
proc fsl_defines {file_name core_name ipname} { |
set core_def_name [string toupper $core_name] |
if {[string compare -nocase "none" $core_name] != 0} { |
set conffile [xopen_include_file $file_name] |
set sw_prochandle [xget_libgen_proc_handle] |
set ip_handle [xget_sw_ipinst_handle_from_processor $sw_prochandle $core_name] |
set mhs_handle [xget_handle $ip_handle "parent"] |
|
set mfsl_name [xget_value $ip_handle "BUS_INTERFACE" "MFSL"] |
if {$mfsl_name != ""} { |
set mfsl_slave [xget_hw_connected_busifs_handle $mhs_handle $mfsl_name "slave"] |
set mfsl_index [xget_value $mfsl_slave "NAME"] |
set mfsl_index [string toupper $mfsl_index] |
set mfsl_index [string map {SFSL ""} $mfsl_index] |
puts $conffile "#define XPAR_FSL_${core_def_name}_OUTPUT_SLOT_ID ${mfsl_index}" |
} |
|
set sfsl_name [xget_value $ip_handle "BUS_INTERFACE" "SFSL"] |
if {$sfsl_name != ""} { |
set sfsl_master [xget_hw_connected_busifs_handle $mhs_handle $sfsl_name "master"] |
set sfsl_index [xget_value $sfsl_master "NAME"] |
set sfsl_index [string toupper $sfsl_index] |
set sfsl_index [string map {MFSL ""} $sfsl_index] |
puts $conffile "#define XPAR_FSL_${core_def_name}_INPUT_SLOT_ID ${sfsl_index}" |
} |
|
puts $conffile "" |
puts $conffile "/******************************************************************/" |
puts $conffile "" |
close $conffile |
} |
} |
|
/fsl_dct_v1_00_a/data/fsl_dct_v2_1_0.mdd
0,0 → 1,16
############################################################################## |
## Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/data/fsl_dct_v2_1_0.mdd |
## Description: Microprocessor Driver Definition |
## Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
############################################################################## |
|
OPTION psf_version = 2.1.0; |
|
BEGIN DRIVER fsl_dct_v1_00_a |
|
OPTION supported_peripherals = (fsl_dct_v1_00_a); |
OPTION depends = (common_v1_00_a); |
OPTION DESC = FSL DCT accelerator; |
OPTION copyfiles = all; |
|
END DRIVER |
/fsl_dct_v1_00_a/examples/fsl_dct_v2_1_0_app.c
0,0 → 1,88
////////////////////////////////////////////////////////////////////////////// |
// Filename: D:\mb-jpeg\drivers/fsl_dct_v1_00_a/examples/fsl_dct_v2_1_0_app.c |
// Version: 1.00.a |
// Description: fsl_dct (FSL DCT accelerator) Driver Example File |
// Date: Fri Jul 21 08:31:12 2006 (by Create and Import Peripheral Wizard) |
////////////////////////////////////////////////////////////////////////////// |
|
#include "fsl_dct.h" |
|
#include "xparameters.h" |
|
/* |
* Follwing is an example driver function |
* that is called in the main function. |
* |
* This example driver writes all the data in the input arguments |
* into the input FSL bus through blocking writes. FSL peripheral will |
* automatically read from the FSL bus. Once all the inputs |
* have been written, the output from the FSL peripheral is read |
* into output arguments through blocking reads. |
* |
* CAUTION: |
* |
* The sequence of writes and reads in this function should be consistent |
* with the sequence of reads or writes in the HDL implementation of this |
* coprocessor. |
* |
*/ |
// Instance name specific MACROs. Defined for each instance of the peripheral. |
#define WRITE_FSL_DCT_0(val) write_into_fsl(val, XPAR_FSL_FSL_DCT_0_INPUT_SLOT_ID) |
#define READ_FSL_DCT_0(val) read_from_fsl(val, XPAR_FSL_FSL_DCT_0_OUTPUT_SLOT_ID) |
|
void fsl_dct_app( |
unsigned int* input_0, /* Array size = 8 */ |
unsigned int* output_0 /* Array size = 8 */ |
) |
{ |
int i; |
|
//Start writing into the FSL bus |
for (i=0; i<8; i++) |
{ |
WRITE_FSL_DCT_0(input_0[i]); |
} |
|
//Start reading from the FSL bus |
for (i=0; i<8; i++) |
{ |
READ_FSL_DCT_0(output_0[i]); |
} |
} |
|
main() |
{ |
unsigned int input_0[8]; |
unsigned int output_0[8]; |
|
|
#ifdef __PPC__ |
// Enable APU for PowerPC. |
unsigned int msr_i; |
msr_i = mfmsr(); |
msr_i = (msr_i | XREG_MSR_APU_AVAILABLE | XREG_MSR_APU_ENABLE) & ~XREG_MSR_USER_MODE; |
mtmsr(msr_i); |
#endif |
|
//Initialize your input data over here: |
|
|
|
//Call the macro with instance specific slot IDs |
fsl_dct( |
XPAR_FSL_FSL_DCT_0_INPUT_SLOT_ID, |
XPAR_FSL_FSL_DCT_0_OUTPUT_SLOT_ID, |
input_0, |
output_0 |
); |
|
// You can also define your own function to access the peripheral |
// Here you are calling the example function defined above |
// Note the slot ID can not be passed over as function parameters |
fsl_dct_app( |
input_0, |
output_0 |
); |
|
} |
|