This is the uClinux driver for the Freescale CPU32 (basic) TPU (TPU: Time Processing Unit) developed for the 68332 cpu. (C) Copyright 2004, Sieghard Schicktanz (S.Schicktanz@Kanis.de) It is distributed under the GNU General Public License - see the accompanying COPYING file for more details. This driver is concerned with setting up the TPU registers and parameter RAM areas and retrieving the gathered data. It makes use of the standard read and write interface routines as well as the ioctl function, on which it relies quite heavily. It is NOT concerned with programming the TPU itself, it only provides an interface to the available TPU functions, allowing for set up and data retrieval. The driver uses character device major number 125, the minor numbers select the channel to use. Add some entry to your Makefile DEVICE statement like the following: tpu0,c,125,0 tpu1,c,125,1 tpu2,c,125,2 tpu3,c,125,3 \ tpu4,c,125,4 tpu5,c,125,5 tpu6,c,125,6 tpu7,c,125,7 \ tpu8,c,125,8 tpu9,c,125,9 tpua,c,125,10 tpub,c,125,11 \ tpuc,c,125,12 tpud,c,125,13 tpue,c,125,14 tpuf,c,125,15 The driver basically works as follows: The device minor number defines the tpu channel to use. After opening, the device is initialized, but not active. Writing to the device defines the parameter RAM data to set, only data according to the set_mask are used. The first write action activates the tpu channel. Reading the device returns data as defined by the get_mask and collected by interrupts executed since activation or the last read action. Reading data clears the data buffer. Writing does NOT clear the buffer. Several ioctl functions allow for controlling the channel functions. All channel specific ioctls change only the pertaining data, which in many cases are just parts of registers. Appropriate masking is performed. There's one quirk of the TPU which has to be taken care of for proper use: The TPU MAY NOT be touched if the MCR register is not yet set up, and this register can be set ONLY ONCE after reset! (There's an ioctl available for that purpose) And so NONE of the other TPU registers may be set before either, as doing so without the TPU enabled will require activating the RESET signal - it will hang the cpu. The following files belong to the driver proper: 25240 2005-05-17 12:04 cpu32tpu.c 5610 2005-05-17 12:04 cpu32tpu.h 3233 2005-05-17 12:05 tpu_ioctl.h 10172 2005-05-17 12:04 m68332_exts.h Use of the driver's functions is exemplified by two little programs to set up any or all the TPU channels with basic parameters (TPUset.c) and to read out the data buffer of any TPU channel (TPUget.c). The TPUset program gets its data from a configuration file, an example of which is given by the file "TPUsetup". The following files comprise the example programs: 2469 2005-05-17 12:03 TPUget.c 6884 2005-05-17 12:04 TPUset.c The following files contain additional data: 2806 2005-05-17 12:02 TPUsetup 3409 2005-05-17 12:05 tpu_pram.h