ts-7000
[Top] [All Lists]

[ts-7000] Help me to write a C code for read temperarutere on TS-7200 (N

To:
Subject: [ts-7000] Help me to write a C code for read temperarutere on TS-7200 (NetBSD 3.1)
From: Andres Gomez <>
Date: Wed, 5 Nov 2008 08:39:03 -0800 (PST)
I'm trying to write my own TMP124 (temperature reader) for NetBSD 3.1 on TS-7200. As Jesse off no respond my messages about this question and anyone helps me and I don't know how to read the temperature on TS-7200 with NetBSD 3.1 I'm writting a code to read it, based on Jesse Off's file: tspld.c. This script run on NetBSD 4.0 (NOT IN 3.X releases). This is the original script: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/evbarm/tsarm/tspld.c?rev=1.9&content-type=text/x-cvsweb-markup

And this my program:
#include "kernel.h"
#include <sys/systm.h>

#include "ep93xxvar.h"
#include "ep93xxreg.h"
#include "epgpioreg.h"
#include "sysmonvar.h"


struct tspld_softc {
        struct device           sc_dev;
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_wdogfeed_ioh;
        bus_space_handle_t      sc_wdogctrl_ioh;
        struct sysmon_wdog    sc_wdog;
        bus_space_handle_t      sc_ssph;
        bus_space_handle_t      sc_gpioh;
        unsigned const char *   sc_com2mode;
        unsigned const char *   sc_model;
        unsigned char           sc_pldrev[4];
        uint32_t                sc_rs485;
        uint32_t                sc_adc;
        uint32_t                sc_jp[6];
        uint32_t                sc_blaster_present;
        uint32_t                sc_blaster_boot;
        uint32_t                boardtemp;
        uint32_t                boardtemp_5s;
        uint32_t                boardtemp_30s;
        struct callout          boardtemp_callout;
};

void    tspld_callback __P((struct device *));

#define GPIO_GET(x)     bus_space_read_4(sc->sc_iot, sc->sc_gpioh, \
        (EP93XX_GPIO_ ## x))

#define GPIO_SET(x, y)  bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
        (EP93XX_GPIO_ ## x), (y))

#define GPIO_SETBITS(x, y)      bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
        (EP93XX_GPIO_ ## x), GPIO_GET(x) | (y))

#define GPIO_CLEARBITS(x, y)    bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
        (EP93XX_GPIO_ ## x), GPIO_GET(x) & (~(y)))

#define SSP_GET(x)      bus_space_read_4(sc->sc_iot, sc->sc_ssph, \
        (EP93XX_SSP_ ## x))

#define SSP_SET(x, y)   bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
        (EP93XX_SSP_ ## x), (y))

#define SSP_SETBITS(x, y)       bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
        (EP93XX_SSP_ ## x), SSP_GET(x) | (y))

#define SSP_CLEARBITS(x, y)     bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
        (EP93XX_SSP_ ## x), SSP_GET(x) & (~(y)))


int main(void){
        struct tspld_softc *sc ;
        u_int16_t val;

        GPIO_SET(PFDDR, 0x0);

        /* Disable chip select */
        GPIO_SET(PFDDR, 0x0);

        val = SSP_GET(SSPDR) & 0xffff;
        int boardtemp = ((int16_t)val >> 3) * 62500;

        /* Enable chip select */
        GPIO_SET(PFDDR, 0x4);

        /* Send read command */
        SSP_SET(SSPDR, 0x8000);
}

But, when I run it, it show this messages:

toaster# ./dev
[1]   Segmentation fault (core dumped) ./dev




ÂBuscà desde tu celular! Yahoo! oneSEARCH ahora està en Claro
http://ar.mobile.yahoo.com/onesearch
__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU