10 linux, Programming examples (debian, 1 ti – Kontron KTAM3874-pITX User Manual

Page 36: Am3874 register access, Ktam3874/pitx software guide

Advertising
background image

KTD-S0057-I

Page 32 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide

10 Linux

®

Programming Examples (Debian

TM

)

10.1 TI

®

AM3874 Register Access

With the simple known program

devmem2

you can read and write all registers of TI

®

's AM3874 SoC. The

following sourcecode for

devmem2

contains some differences to the original program (compiled on Ubun-

tu

TM

distribution).

/*
* devmem2.c: Simple program to read/write from/to any location in memory.
* Copyright (C) 2000, Jan-Derk Bakker ([email protected])

* This software has been developed for the LART computing board
* (http://www.lart.tudelft.nl/). The development has been sponsored by
* the Mobile MultiMedia Communications (http://www.mmc.tudelft.nl/)
* and Ubiquitous Communications (http://www.ubicom.tudelft.nl/)
* projects.

* The author can be reached at:
* Jan-Derk Bakker
* Information and Communication Theory Group
* Faculty of Information Technology and Systems
* Delft University of Technology
* P.O. Box 5031
* 2600 GA Delft
* The Netherlands

* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.

* This program 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 General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>

#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \

__LINE__,

__FILE__,

errno,

strerror(errno)); exit(1); } while(0)

#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)

Advertising
This manual is related to the following products: