readmetpuapp.txt
来自「mpc564 时钟中断 时钟中断」· 文本 代码 · 共 109 行
TXT
109 行
To All, (et al),
Below is an email that I sent out to give a basic description of the
file structures that we are using for the code examples of the TPU functions.
This is meant to provide a high level road map and description of the
supporting code. Application Program Interface.
***********************************************************************************
I call the levels of code "Groups" here. Customers will only write for Group four.
We will write the code for group three (and an example/test file at the group four
level). Below is a description for all layers of the groups.
The file structure is as follows:
Group One: The basic header files:
These are the basic files that define all of the registers. That way, we can
point to a bit or a whole register with a TPU.TPUMCR.R = 0x0000 kind of call. There
is a more global call that does the same thing: tpu -->TPUMCR.R = 0x0000. This does
the same thing when "tpu" is properly defined (see tpu_fqd_example1).
When you include mpc555.h ---All of the header files will enter the program compile.
mpc565.h
Group Two: The TPU utility header files.
These files were generated by Jeff to provide basic TPU function calls.
File: mpc500_util.h ---> defines the values for the TPU.
File: mpc500_util.c ---> Contains the functions for the TPU. Note that the basic
function will have three inputs. 1) which TPU (A, B,
or C); 2) which channel is being accessed; 3) a
parameter value. There may be different combinations
(more or less) of these inputs.
File: mpc500.c --> Sets up the hardware and clock speed (as an input). This would
take the place of Diab Data's Crt0.s by performing the
following funcitons:
1) Disable watchdog timer; 2) Place the machine in expanded mode;
3) Normal slew rate on pads; 4) Optional: set up chip selects;
5) Set PLL clock speed; 6) Enable timebase and decrementor;
7) Set the IMB to full speed; etc.
File: mpc500.dld --> Link file for compiling the software.
File: makefile --> Used to compile the software with the command: "make -f makefile"
This command is given in a command line window which has access
(paths) to all of the required source files.
Group Three: The function API's.
The example given by Jeff is for the FQD function. These are the files that
"we" are writing for the customer to use. These files are the bridge between
the header files and the customers top level "*.c" code. The customer will
make many one line function calls into these files. There are two files here:
1) tpu_fqd.c ---> contains the functions (which we are calling the API) for
the the fqd function. The functions in your file should
perform the following tasks:
1) Initialization --->There will always be an initialization for the
particular function that is being called. The name in this
example is tpu_fqd_init( ). Just replace your function letters
with the fqd. This function will set up all of the control registers
in the TPU for your function. Follow Jeffs' example where the TPU
channel is disabled, given a function, initialized, and finally,
re-enabled. (By the way, for my TSM function, I had 12 inputs,
one input included a three by eight table.) Your function may
have less inputs than mine.
2) Setting values ---> If any of the parameters need to be specifically
changed, write a function that addresses that channel address
location and sets the value. NOTE: many values may be changed
but might not be the right thing to do. For example: I could
have had (and did) a function that changed the Pin_Sequence for
the TSM. This could be done, but, probably would destroy a real
motor if used while the motor was running! The best way to change
values is to call another initialization call (see #1 above) if
there is a "dangerous" variable to be changed.
3) Reading values ---> These calls are to read any current or set
status for the function. The customer would probably definately
want calls in this category if current values are important to
the program flow. These values can be polled for a match and
change program flow depending on a specific value. My TSM
function is also set to make an interrupt which is what I am
using to determine when I have a match between desired and
current position.
2) tpu_fqd.h ---> defines the constant values for the fqd. Also, the
prototypes for each function in tpu_fqd.c resides here. Note: the
prototype is identical to the function call header.
Group Four: The example file.c. This is the customers application that they
will write. We will need to also write an example file to run the
code for our function. This provides an example for the customer
as well as a test vehicle. The "main()" function is located here.
The file in our example here is called: tpu_fqd_example1.c,
tpu_fqd_example2.c, and tpu_fqd_example3.c. These will also have local
functions that the customer will need to generate for their own
application. My TSM interrupt function is placed in my tpu_tsm_ex1.c
file at this level.
I started with Jeff's example file by just substituting all of the
"fqd's" with "tsm's". My example file is called: tpu_tsm_ex1.c.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?