Search
lxdream.org :: lxdream/src/aica/aica.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/aica.c
changeset 30:89b30313d757
prev23:1ec3acd0594d
next35:21a4be098304
author nkeynes
date Sun Dec 25 05:57:00 2005 +0000 (15 years ago)
permissions -rw-r--r--
last change Change timeslice to nanoseconds (was microseconds)
Generize single step (now steps through active CPU)
Add lots of header blocks
file annotate diff log raw
nkeynes@11
     1
/**
nkeynes@30
     2
 * $Id: aica.c,v 1.5 2005-12-25 05:57:00 nkeynes Exp $
nkeynes@11
     3
 * 
nkeynes@11
     4
 * This is the core sound system (ie the bit which does the actual work)
nkeynes@11
     5
 *
nkeynes@11
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@11
     7
 *
nkeynes@11
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@11
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@11
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@11
    11
 * (at your option) any later version.
nkeynes@11
    12
 *
nkeynes@11
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@11
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@11
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@11
    16
 * GNU General Public License for more details.
nkeynes@11
    17
 */
nkeynes@11
    18
nkeynes@11
    19
#include "dream.h"
nkeynes@15
    20
#include "modules.h"
nkeynes@15
    21
#include "mem.h"
nkeynes@11
    22
#include "aica.h"
nkeynes@11
    23
#define MMIO_IMPL
nkeynes@11
    24
#include "aica.h"
nkeynes@11
    25
nkeynes@11
    26
MMIO_REGION_READ_DEFFN( AICA0 )
nkeynes@11
    27
MMIO_REGION_READ_DEFFN( AICA1 )
nkeynes@11
    28
MMIO_REGION_READ_DEFFN( AICA2 )
nkeynes@11
    29
nkeynes@23
    30
void aica_init( void );
nkeynes@23
    31
void aica_reset( void );
nkeynes@23
    32
void aica_start( void );
nkeynes@23
    33
void aica_stop( void );
nkeynes@30
    34
uint32_t aica_run_slice( uint32_t );
nkeynes@23
    35
nkeynes@23
    36
nkeynes@23
    37
struct dreamcast_module aica_module = { "AICA", aica_init, aica_reset, 
nkeynes@23
    38
					aica_start, aica_run_slice, aica_stop,
nkeynes@23
    39
					NULL, NULL, NULL };
nkeynes@15
    40
nkeynes@11
    41
/**
nkeynes@11
    42
 * Initialize the AICA subsystem. Note requires that 
nkeynes@11
    43
 */
nkeynes@11
    44
void aica_init( void )
nkeynes@11
    45
{
nkeynes@11
    46
    register_io_regions( mmio_list_spu );
nkeynes@11
    47
    MMIO_NOTRACE(AICA0);
nkeynes@11
    48
    MMIO_NOTRACE(AICA1);
nkeynes@11
    49
    arm_mem_init();
nkeynes@11
    50
}
nkeynes@11
    51
nkeynes@11
    52
void aica_reset( void )
nkeynes@11
    53
{
nkeynes@11
    54
nkeynes@11
    55
}
nkeynes@11
    56
nkeynes@23
    57
void aica_start( void )
nkeynes@23
    58
{
nkeynes@23
    59
nkeynes@23
    60
}
nkeynes@23
    61
nkeynes@30
    62
uint32_t aica_run_slice( uint32_t nanosecs )
nkeynes@23
    63
{
nkeynes@23
    64
    /* Run arm instructions */
nkeynes@23
    65
    /* Generate audio buffer */
nkeynes@23
    66
}
nkeynes@23
    67
nkeynes@23
    68
void aica_stop( void )
nkeynes@23
    69
{
nkeynes@23
    70
nkeynes@23
    71
}
nkeynes@23
    72
nkeynes@11
    73
/** Channel register structure:
nkeynes@11
    74
 * 00
nkeynes@11
    75
 * 04
nkeynes@11
    76
 * 08  4  Loop start address
nkeynes@11
    77
 * 0C  4  Loop end address
nkeynes@11
    78
 * 10  4  Volume envelope
nkeynes@11
    79
 * 14
nkeynes@11
    80
 * 18  4  Frequency (floating point 
nkeynes@11
    81
 * 1C
nkeynes@11
    82
 * 20
nkeynes@11
    83
 * 24  1  Pan
nkeynes@11
    84
 * 25  1  ??
nkeynes@11
    85
 * 26  
nkeynes@11
    86
 * 27  
nkeynes@11
    87
 * 28  1  ??
nkeynes@11
    88
 * 29  1  Volume
nkeynes@11
    89
 * 2C
nkeynes@11
    90
 * 30
nkeynes@11
    91
 * 
nkeynes@11
    92
nkeynes@11
    93
/* Write to channels 0-31 */
nkeynes@11
    94
void mmio_region_AICA0_write( uint32_t reg, uint32_t val )
nkeynes@11
    95
{
nkeynes@11
    96
    //    aica_write_channel( reg >> 7, reg % 128, val );
nkeynes@11
    97
nkeynes@11
    98
}
nkeynes@11
    99
nkeynes@11
   100
/* Write to channels 32-64 */
nkeynes@11
   101
void mmio_region_AICA1_write( uint32_t reg, uint32_t val )
nkeynes@11
   102
{
nkeynes@11
   103
    //    aica_write_channel( (reg >> 7) + 32, reg % 128, val );
nkeynes@11
   104
nkeynes@11
   105
}
nkeynes@11
   106
nkeynes@11
   107
/* General registers */
nkeynes@11
   108
void mmio_region_AICA2_write( uint32_t reg, uint32_t val )
nkeynes@11
   109
{
nkeynes@11
   110
nkeynes@11
   111
}
.