[haiku-commits] r37013 - in haiku/trunk/src/add-ons/kernel/drivers/audio/echo: . generic

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 5 Jun 2010 00:52:06 +0200 (CEST)

Author: korli
Date: 2010-06-05 00:52:06 +0200 (Sat, 05 Jun 2010)
New Revision: 37013
Changeset: http://dev.haiku-os.org/changeset/37013/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp
   haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.h
   haiku/trunk/src/add-ons/kernel/drivers/audio/echo/generic/OsSupportBeOS.h
   haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.c
   haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.h
Log:
* whitespace cleanup and some style fixes
* fixes TODO about using phys_addr_t instead of void*


Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp  2010-06-04 
22:25:51 UTC (rev 37012)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp  2010-06-04 
22:52:06 UTC (rev 37013)
@@ -122,7 +122,7 @@
 echo_mem_alloc(echo_dev *card, size_t size)
 {
        echo_mem *mem;
-       
+
        mem = echo_mem_new(card, size);
        if (mem == NULL)
                return (NULL);
@@ -136,12 +136,12 @@
 echo_mem_free(echo_dev *card, void *ptr)
 {
        echo_mem                *mem;
-       
+
        LIST_FOREACH(mem, &card->mems, next) {
                if (mem->log_base != ptr)
                        continue;
                LIST_REMOVE(mem, next);
-               
+
                echo_mem_delete(mem);
                break;
        }
@@ -161,11 +161,11 @@
        ECHOGALS_CLOSEAUDIOPARAMETERS  close_params;
        ECHOGALS_AUDIOFORMAT                    format_params;
        ECHOSTATUS status;
-       
+
        LOG(("echo_stream_set_audioparms\n"));
-       
+
        if (stream->pipe >= 0) {
-               close_params.wPipeIndex = stream->pipe; 
+               close_params.wPipeIndex = stream->pipe;
                status = stream->card->pEG->CloseAudio(&close_params);
                if (status != ECHOSTATUS_OK && status != 
ECHOSTATUS_CHANNEL_NOT_OPEN) {
                        PRINT(("echo_stream_set_audioparms : CloseAudio 
failed\n"));
@@ -173,13 +173,13 @@
                        return B_ERROR;
                }
        }
-       
+
        open_params.bIsCyclic = TRUE;
        open_params.Pipe.nPipe = index;
        open_params.Pipe.bIsInput = stream->use == ECHO_USE_RECORD ? TRUE : 
FALSE;
        open_params.Pipe.wInterleave = channels;
        open_params.ProcessId = NULL;
-       
+
        status = stream->card->pEG->OpenAudio(&open_params, &stream->pipe);
        if (status != ECHOSTATUS_OK) {
                PRINT(("echo_stream_set_audioparms : OpenAudio failed\n"));
@@ -197,10 +197,10 @@
 
        if (bitsPerSample == 24)
                bitsPerSample = 32;
-       
-       if ((stream->channels == channels) &&
-               (stream->bitsPerSample == bitsPerSample) && 
-               (stream->sample_rate == sample_rate))
+
+       if ((stream->channels == channels)
+               && (stream->bitsPerSample == bitsPerSample)
+               && (stream->sample_rate == sample_rate))
                return B_OK;
 
        format_params.wBitsPerSample = bitsPerSample;
@@ -214,14 +214,14 @@
                PRINT(("  status: %s \n", pStatusStrs[status]));
                return B_ERROR;
        }
-       
+
        status = stream->card->pEG->SetAudioFormat(stream->pipe, 
&format_params);
        if (status != ECHOSTATUS_OK) {
                PRINT(("echo_stream_set_audioparms : bad format when 
setting\n"));
                PRINT(("  status: %s \n", pStatusStrs[status]));
                return B_ERROR;
        }
-       
+
        /* XXXX : setting sample rate is global in this driver */
        status = stream->card->pEG->QueryAudioSampleRate(sample_rate);
        if (status != ECHOSTATUS_OK) {
@@ -229,7 +229,7 @@
                PRINT(("  status: %s \n", pStatusStrs[status]));
                return B_ERROR;
        }
-               
+
        /* XXXX : setting sample rate is global in this driver */
        status = stream->card->pEG->SetAudioSampleRate(sample_rate);
        if (status != ECHOSTATUS_OK) {
@@ -237,61 +237,61 @@
                PRINT(("  status: %s \n", pStatusStrs[status]));
                return B_ERROR;
        }
-       
+
        if (stream->buffer)
                echo_mem_free(stream->card, stream->buffer->log_base);
-               
+
        stream->bitsPerSample = bitsPerSample;
        stream->sample_rate = sample_rate;
        stream->channels = channels;
-       
+
        sample_size = stream->bitsPerSample / 8;
        frame_size = sample_size * stream->channels;
-       
+
        stream->buffer = echo_mem_alloc(stream->card, stream->bufframes * 
frame_size * stream->bufcount);
-       
+
        stream->trigblk = 1;
        stream->blkmod = stream->bufcount;
        stream->blksize = stream->bufframes * frame_size;
-       
+
        CDaffyDuck *duck = stream->card->pEG->GetDaffyDuck(stream->pipe);
        if (duck == NULL) {
                PRINT(("echo_stream_set_audioparms : Could not get daffy duck 
pointer\n"));
                return B_ERROR;
        }
-       
+
        uint32 dwNumFreeEntries = 0;
 
        for (i = 0; i < stream->bufcount; i++) {
-               duck->AddMapping(((uint32)stream->buffer->phy_base) + 
+               duck->AddMapping(((uint32)stream->buffer->phy_base) +
                        i * stream->blksize, stream->blksize, 0, TRUE, 
dwNumFreeEntries);
        }
-       
+
        duck->Wrap();
-       
+
        if (stream->card->pEG->GetAudioPositionPtr(stream->pipe, 
stream->position)!=ECHOSTATUS_OK) {
                PRINT(("echo_stream_set_audioparms : Could not get audio 
position ptr\n"));
                return B_ERROR;
        }
-       
+
        return B_OK;
 }
 
 
 status_t
-echo_stream_get_nth_buffer(echo_stream *stream, uint8 chan, uint8 buf, 
+echo_stream_get_nth_buffer(echo_stream *stream, uint8 chan, uint8 buf,
        char** buffer, size_t *stride)
 {
        uint8                   sample_size, frame_size;
        LOG(("echo_stream_get_nth_buffer\n"));
-       
+
        sample_size = stream->bitsPerSample / 8;
        frame_size = sample_size * stream->channels;
-       
+
        *buffer = (char*)stream->buffer->log_base + (buf * stream->bufframes * 
frame_size)
                + chan * sample_size;
        *stride = frame_size;
-       
+
        return B_OK;
 }
 
@@ -310,16 +310,16 @@
 {
        LOG(("echo_stream_start\n"));
        ECHOSTATUS status;
-       
+
        stream->inth = inth;
        stream->inthparam = inthparam;
-               
+
        stream->state |= ECHO_STATE_STARTED;
 
        status = stream->card->pEG->Start(stream->pipe);
        if (status!=ECHOSTATUS_OK) {
                PRINT(("echo_stream_start : Could not start the pipe %s\n", 
pStatusStrs[status]));
-       }       
+       }
 }
 
 void
@@ -327,13 +327,13 @@
 {
        LOG(("echo_stream_halt\n"));
        ECHOSTATUS status;
-                       
+
        stream->state &= ~ECHO_STATE_STARTED;
-       
+
        status = stream->card->pEG->Stop(stream->pipe);
        if (status!=ECHOSTATUS_OK) {
                PRINT(("echo_stream_halt : Could not stop the pipe %s\n", 
pStatusStrs[status]));
-       }       
+       }
 }
 
 echo_stream *
@@ -360,18 +360,18 @@
        stream->blksize = 0;
        stream->trigblk = 0;
        stream->blkmod = 0;
-       
+
        stream->pipe = -1;
-       
+
        stream->frames_count = 0;
        stream->real_time = 0;
        stream->buffer_cycle = 0;
        stream->update_needed = false;
-       
+
        status = lock();
        LIST_INSERT_HEAD((&card->streams), stream, next);
        unlock(status);
-       
+
        return stream;
 }
 
@@ -381,25 +381,25 @@
        cpu_status status;
        ECHOGALS_CLOSEAUDIOPARAMETERS close_params;
        LOG(("echo_stream_delete\n"));
-       
+
        echo_stream_halt(stream);
-               
+
        if (stream->pipe >= 0) {
-               close_params.wPipeIndex = stream->pipe; 
+               close_params.wPipeIndex = stream->pipe;
                status = stream->card->pEG->CloseAudio(&close_params);
                if (status != ECHOSTATUS_OK && status != 
ECHOSTATUS_CHANNEL_NOT_OPEN) {
                        PRINT(("echo_stream_set_audioparms : CloseAudio 
failed\n"));
                        PRINT((" status: %s \n", pStatusStrs[status]));
                }
        }
-       
+
        if (stream->buffer)
                echo_mem_free(stream->card, stream->buffer->log_base);
-       
+
        status = lock();
        LIST_REMOVE(stream, next);
        unlock(status);
-       
+
        free(stream);
 }
 
@@ -413,9 +413,9 @@
        ECHOSTATUS err;
        echo_stream* stream;
        uint32 curblk;
-                       
+
        err = card->pEG->ServiceIrq(midiReceived);
-       
+
        if (err != ECHOSTATUS_OK) {
                return B_UNHANDLED_INTERRUPT;
        }
@@ -429,7 +429,7 @@
                if ((stream->state & ECHO_STATE_STARTED) == 0 ||
                        (stream->inth == NULL))
                                continue;
-               
+
                curblk = echo_stream_curaddr(stream);
                //TRACE(("echo_int stream %p at trigblk %lu at stream->trigblk 
%lu\n",
                //         stream, curblk, stream->trigblk));
@@ -451,14 +451,14 @@
 {
        PECHOGALS_CAPS caps = &card->caps;
        PRINT(("name: %s\n", caps->szName));
-       PRINT(("out pipes: %d, in pipes: %d, out busses: %d, in busses: %d, out 
midi: %d, in midi: %d\n", 
+       PRINT(("out pipes: %d, in pipes: %d, out busses: %d, in busses: %d, out 
midi: %d, in midi: %d\n",
                caps->wNumPipesOut, caps->wNumPipesIn, caps->wNumBussesOut, 
caps->wNumBussesIn, caps->wNumMidiOut, caps->wNumMidiIn));
 
 }
 
 
 /* detect presence of our hardware */
-status_t 
+status_t
 init_hardware(void)
 {
 #ifdef CARDBUS
@@ -467,7 +467,7 @@
        int ix=0;
        pci_info info;
        status_t err = ENODEV;
-       
+
        LOG_CREATE();
 
        PRINT(("init_hardware()\n"));
@@ -476,14 +476,14 @@
                return ENOSYS;
 
        while ((*pci->get_nth_pci_info)(ix, &info) == B_OK) {
-               
+
                ushort card_type = info.u.h0.subsystem_id & 0xfff0;
-               
-               if (info.vendor_id == VENDOR_ID &&
-                       ((info.device_id == DEVICE_ID_56301)
-                       || (info.device_id == DEVICE_ID_56361)) &&
-                       (info.u.h0.subsystem_vendor_id == SUBVENDOR_ID) &&
-                       (
+
+               if (info.vendor_id == VENDOR_ID
+                       && ((info.device_id == DEVICE_ID_56301)
+                       || (info.device_id == DEVICE_ID_56361))
+                       && (info.u.h0.subsystem_vendor_id == SUBVENDOR_ID)
+                       && (
 #ifdef ECHOGALS_FAMILY
                        (card_type == DARLA)
                        || (card_type == GINA)
@@ -509,7 +509,7 @@
                }
                ix++;
        }
-               
+
        put_module(B_PCI_MODULE_NAME);
 
        if (err != B_OK) {
@@ -546,22 +546,22 @@
        return B_OK;
 #else
        int ix=0;
-       
+
        pci_info info;
        status_t err;
        num_cards = 0;
-       
+
        if (get_module(B_PCI_MODULE_NAME, (module_info **) &pci))
                return ENOSYS;
-               
+
        while ((*pci->get_nth_pci_info)(ix++, &info) == B_OK) {
                ushort card_type = info.u.h0.subsystem_id & 0xfff0;
-               
-               if (info.vendor_id == VENDOR_ID &&
-                       ((info.device_id == DEVICE_ID_56301)
-                       || (info.device_id == DEVICE_ID_56361)) &&
-                       (info.u.h0.subsystem_vendor_id == SUBVENDOR_ID) &&
-                       (
+
+               if (info.vendor_id == VENDOR_ID
+                       && ((info.device_id == DEVICE_ID_56301)
+                       || (info.device_id == DEVICE_ID_56361))
+                       && (info.u.h0.subsystem_vendor_id == SUBVENDOR_ID)
+                       && (
 #ifdef ECHOGALS_FAMILY
                        (card_type == DARLA)
                        || (card_type == GINA)
@@ -582,8 +582,8 @@
 #ifdef ECHO3G_FAMILY
                        (card_type == ECHO3G)
 #endif
-                       )) {                    
-                       
+                       )) {
+
                        if (num_cards == NUM_CARDS) {
                                PRINT(("Too many "DRIVER_NAME" cards 
installed!\n"));
                                break;
@@ -618,7 +618,7 @@
                PRINT(("no suitable cards found\n"));
                return ENODEV;
        }
-       
+
        return B_OK;
 #endif
 }
@@ -640,7 +640,7 @@
 }
 #else
 
-status_t 
+status_t
 cardbus_device_added(pci_info *info, void **cookie) {
        echo_dev                        * card, *dev;
        uint32                          index;
@@ -657,14 +657,14 @@
        card->info = *info;
        card->plugged = true;
        card->index = 0;
-       
+
        LIST_FOREACH(dev, &devices, next) {
                if (dev->index == card->index) {
                        card->index++;
                        dev = LIST_FIRST(&devices);
                }
        }
-       
+
        // Format device name
        sprintf(card->name, "audio/hmulti/" DRIVER_NAME "/%ld", card->index);
        // Lock the devices
@@ -672,7 +672,7 @@
        LIST_INSERT_HEAD((&devices), card, next);
        // Unlock the devices
        release_sem(device_lock);
-       
+
        echo_setup(card);
        return B_OK;
 }
@@ -680,20 +680,20 @@
 
 // cardbus_device_removed - handle cardbus device removal.
 // status : OK
-void 
+void
 cardbus_device_removed(void *cookie)
 {
        echo_dev                *card = (echo_dev *) cookie;
-       
+
        LOG((": cardbus_device_removed\n"));
        // Check
        if (card == NULL) {
                LOG((": null device 0x%.8x\n", card));
                return;
        }
-       
+
        echo_shutdown(card);
-       
+
        // Lock the devices
        acquire_sem(device_lock);
        // Finalize
@@ -718,19 +718,19 @@
 {
        unsigned char cmd;
        char *name;
-       
+
        PRINT(("echo_setup(%p)\n", card));
 
 #ifndef CARDBUS
-       (*pci->write_pci_config)(card->info.bus, card->info.device, 
+       (*pci->write_pci_config)(card->info.bus, card->info.device,
                card->info.function, PCI_latency, 1, 0xc0 );
-       
+
        make_device_names(card);
 #endif
        card->bmbar = card->info.u.h0.base_registers[0];
        card->irq = card->info.u.h0.interrupt_line;
 
-       card->area_bmbar = map_mem(&card->log_bmbar, (void *)card->bmbar, 
+       card->area_bmbar = map_mem(&card->log_bmbar, card->bmbar,
                card->info.u.h0.base_register_sizes[0], DRIVER_NAME" bmbar io");
        if (card->area_bmbar <= B_OK) {
                LOG(("mapping of bmbar io failed, error = 
%#x\n",card->area_bmbar));
@@ -801,18 +801,18 @@
                        break;
 #endif
                default:
-                       PRINT(("card type 0x%x not supported by 
"DRIVER_NAME"\n", 
+                       PRINT(("card type 0x%x not supported by 
"DRIVER_NAME"\n",
                                card->type));
        }
 
        if (card->pEG == NULL)
                goto err2;
-       
+
 #ifndef CARDBUS
-       cmd = (*pci->read_pci_config)(card->info.bus, card->info.device, 
+       cmd = (*pci->read_pci_config)(card->info.bus, card->info.device,
                card->info.function, PCI_command, 2);
        PRINT(("PCI command before: %x\n", cmd));
-       (*pci->write_pci_config)(card->info.bus, card->info.device, 
+       (*pci->write_pci_config)(card->info.bus, card->info.device,
                card->info.function, PCI_command, 2, cmd | PCI_command_io);
        cmd = (*pci->read_pci_config)(card->info.bus, card->info.device,
                card->info.function, PCI_command, 2);
@@ -830,28 +830,28 @@
 
        /* Init streams list */
        LIST_INIT(&(card->streams));
-                       
+
        /* Init mems list */
        LIST_INIT(&(card->mems));
-       
+
 #ifdef MIDI_SUPPORT
        card->midi.midi_ready_sem = create_sem(0, "midi sem");
 #endif
-       
+
        PRINT(("installing interrupt : %x\n", card->irq));
        status = install_io_interrupt_handler(card->irq, echo_int, card, 0);
        if (status != B_OK) {
                PRINT(("failed to install interrupt\n"));
                goto err2;
        }
-       
+
        PRINT(("echo_setup done\n"));
 
        echo_dump_caps(card);
 
 #ifdef ECHO3G_FAMILY
        if (card->type == ECHO3G) {
-               strncpy(card->caps.szName, ((C3g*)card->pEG)->Get3gBoxName(), 
+               strncpy(card->caps.szName, ((C3g*)card->pEG)->Get3gBoxName(),
                        ECHO_MAXNAMELEN);
        }
 #endif
@@ -894,10 +894,10 @@
 #ifdef MIDI_SUPPORT
        delete_sem(card->midi.midi_ready_sem);
 #endif
-       
+
        delete card->pEG;
        delete card->pOSS;
-       
+
        delete_area(card->area_bmbar);
 }
 
@@ -907,10 +907,10 @@
 uninit_driver(void)
 {
        PRINT(("uninit_driver()\n"));
-               
+
 #ifdef CARDBUS
        echo_dev                        *dev;
-       
+
        LIST_FOREACH(dev, &devices, next) {
                echo_shutdown(dev);
        }
@@ -921,7 +921,7 @@
        for (ix=0; ix<cnt; ix++) {
                echo_shutdown(&cards[ix]);
        }
-       
+
        memset(&cards, 0, sizeof(cards));
        put_module(B_PCI_MODULE_NAME);
 #endif

Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.h    2010-06-04 
22:25:51 UTC (rev 37012)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.h    2010-06-04 
22:52:06 UTC (rev 37013)
@@ -1,6 +1,6 @@
 
//------------------------------------------------------------------------------
 //     EchoGals/Echo24 BeOS Driver for Echo audio cards
-//     
+//
 //  Copyright (c) 2003, Jérôme Duval
 //
 //     Permission is hereby granted, free of charge, to any person obtaining a
@@ -57,7 +57,7 @@
 /*
  * Streams
  */
- 
+
 typedef struct _echo_stream {
        struct _echo_dev        *card;
        uint8                   use;
@@ -67,20 +67,20 @@
        uint8                           channels;
        uint32                          bufframes;
        uint8                           bufcount;
-       
+
        WORD                            pipe;
        PDWORD                          position;
-       
+
        LIST_ENTRY(_echo_stream)        next;
-       
+
        void                    (*inth) (void *);
        void                    *inthparam;
-               
+
        echo_mem        *buffer;
        uint16       blksize;   /* in samples */
        uint16       trigblk;   /* blk on which to trigger inth */
        uint16       blkmod;    /* Modulo value to wrap trigblk */
-       
+
        /* multi_audio */
        volatile int64  frames_count;   // for play or record
        volatile bigtime_t real_time;   // for play or record
@@ -93,32 +93,32 @@
 typedef struct _echo_dev {
        char            name[DEVNAME];  /* used for resources */
        pci_info        info;
-       
+
        uint32  bmbar;
        void *  log_bmbar;
        area_id area_bmbar;
        uint32  irq;
        uint16  type;
-       
+
        PCEchoGals      pEG;
        ECHOGALS_CAPS   caps;
        NUINT           mixer;
        PCOsSupport pOSS;
-               
+
        void    *ptb_log_base;
-       void    *ptb_phy_base;
+       phys_addr_t     ptb_phy_base;
        area_id ptb_area;
-       
+
        sem_id buffer_ready_sem;
-       
+
        LIST_HEAD(, _echo_stream) streams;
        LIST_HEAD(, _echo_mem) mems;
-       
+
        echo_stream             *pstream;
        echo_stream             *rstream;
-       
+
        /* multi_audio */
-       multi_dev       multi;          
+       multi_dev       multi;
 #ifdef MIDI_SUPPORT
        midi_dev        midi;
 #endif
@@ -144,7 +144,7 @@
 
 status_t echo_stream_set_audioparms(echo_stream *stream, uint8 channels,
                             uint8 bitsPerSample, uint32 sample_ratei, uint8 
index);
-status_t echo_stream_get_nth_buffer(echo_stream *stream, uint8 chan, uint8 
buf, 
+status_t echo_stream_get_nth_buffer(echo_stream *stream, uint8 chan, uint8 buf,
                                        char** buffer, size_t *stride);
 void echo_stream_start(echo_stream *stream, void (*inth) (void *), void 
*inthparam);
 void echo_stream_halt(echo_stream *stream);

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/audio/echo/generic/OsSupportBeOS.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/generic/OsSupportBeOS.h   
2010-06-04 22:25:51 UTC (rev 37012)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/generic/OsSupportBeOS.h   
2010-06-04 22:52:06 UTC (rev 37013)
@@ -117,7 +117,7 @@
 typedef struct _echo_mem {
        LIST_ENTRY(_echo_mem) next;
        void            *log_base;
-       void            *phy_base;
+       phys_addr_t     phy_base;
        area_id         area;
        size_t          size;
 } echo_mem;
@@ -130,8 +130,8 @@
 //
 //     Define what a physical address is on this OS
 //
-typedef        unsigned long   PHYS_ADDR;                      // Define 
physical addr type
-typedef        unsigned long*  PPHYS_ADDR;                     // Define 
physical addr pointer type
+typedef        phys_addr_t             PHYS_ADDR;                      // 
Define physical addr type
+typedef        phys_addr_t*    PPHYS_ADDR;                     // Define 
physical addr pointer type
 
 typedef echo_mem* PPAGE_BLOCK;
 
@@ -207,7 +207,7 @@
 // Since static variables are used in place of globals, an instance must
 //     be constructed and initialized by the OS Interface object prior to
 //     constructing the CEchoGals derived object.  The CEchoGals and
-//     CDspCommObject classes must have access to it during their respective 
+//     CDspCommObject classes must have access to it during their respective
 // construction times.
 //
 class COsSupport
@@ -260,7 +260,7 @@
                DWORD                   dwBytes,
                PPAGE_BLOCK     &pPageBlock
        );
-       
+
        //
        // Free a block of physical memory
        //
@@ -269,7 +269,7 @@
                DWORD                   dwBytes,
                PPAGE_BLOCK     pPageBlock
        );
-       
+
        //
        // Get the virtual address for a page block
        //
@@ -308,7 +308,7 @@
        //
        WORD GetDeviceId()
                { return( m_wDeviceId ); }
-               
+
        //
        // Return the hardware revision number
        //
@@ -316,7 +316,7 @@
        {
                return m_wCardRev;
        }
-   
+
        //
        // Get the current timestamp for MIDI input data
        //
@@ -324,9 +324,9 @@
        {
                return system_time();
        }
-               
+
        //
-       //      Overload new & delete so memory for this object is allocated 
+       //      Overload new & delete so memory for this object is allocated
        //      from non-paged memory.
        //
        PVOID operator new( size_t Size );
@@ -344,7 +344,7 @@
 #ifdef ECHO_DEBUG
        DWORD                                   m_dwPageBlockCount;
 #endif
-       
+
 };             // class COsSupport
 
 typedef COsSupport * PCOsSupport;

Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.c    2010-06-04 
22:25:51 UTC (rev 37012)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.c    2010-06-04 
22:52:06 UTC (rev 37013)
@@ -64,9 +64,8 @@
 
 
 area_id
-alloc_mem(void **phy, void **log, size_t size, const char *name)
+alloc_mem(phys_addr_t *phy, void **log, size_t size, const char *name)
 {
-// TODO: phy should be phys_addr_t*!
        physical_entry pe;
        void * logadr;
        area_id area;
@@ -91,7 +90,7 @@
        if (log)
                *log = logadr;
        if (phy)
-               *phy = (void*)(addr_t)pe.address;
+               *phy = pe.address;
        LOG(("area = %d, size = %d, log = %#08X, phy = %#08X\n", area, size, 
logadr,
                pe.address));
        return area;
@@ -99,19 +98,19 @@
 
 
 area_id
-map_mem(void **log, void *phy, size_t size, const char *name)
+map_mem(void **log, phys_addr_t phy, size_t size, const char *name)
 {
        uint32 offset;
-       void *phyadr;
+       phys_addr_t phyadr;
        void *mapadr;
        area_id area;
 
        LOG(("mapping physical address %p with %#x bytes for 
%s\n",phy,size,name));
 
-       offset = (uint32)phy & (B_PAGE_SIZE - 1);
-       phyadr = (void*)((uint32)phy - offset);
+       offset = phy & (B_PAGE_SIZE - 1);
+       phyadr = phy - offset;
        size = round_to_pagesize(size + offset);
-       area = map_physical_memory(name, (addr_t)phyadr, size, 
B_ANY_KERNEL_ADDRESS,
+       area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_ADDRESS,
                0, &mapadr);
        *log = (void*) ((uint32)mapadr + offset);
 

Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.h    2010-06-04 
22:25:51 UTC (rev 37012)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/util.h    2010-06-04 
22:52:06 UTC (rev 37013)
@@ -4,24 +4,24 @@
  * Copyright (c) 2002, Marcus Overhagen <marcus@xxxxxxxxxxxx>
  *
  * All rights reserved.
- * Redistribution and use in source and binary forms, with or without 
modification, 
+ * Redistribution and use in source and binary forms, with or without 
modification,
  * are permitted provided that the following conditions are met:
  *
- * - Redistributions of source code must retain the above copyright notice, 
+ * - Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
  * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
+ *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED 
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
FOR 
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES 
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
ANY 
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
@@ -34,14 +34,14 @@
 
 #include <KernelExport.h>
 
-area_id alloc_mem(void **phy, void **log, size_t size, const char *name);
+area_id alloc_mem(phys_addr_t* phy, void **log, size_t size, const char *name);
 
 cpu_status lock(void);
 void unlock(cpu_status status);
 
 extern spinlock        slock;
 
-area_id map_mem(void **log, void *phy, size_t size, const char *name);
+area_id map_mem(void **log, phys_addr_t phy, size_t size, const char *name);
 
 #ifdef __cplusplus
 }


Other related posts:

  • » [haiku-commits] r37013 - in haiku/trunk/src/add-ons/kernel/drivers/audio/echo: . generic - korli