Search
lxdream.org :: lxdream/src/sh4/dmac.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/dmac.h
changeset 736:a02d1475ccfd
prev561:533f6b478071
author nkeynes
date Mon Aug 04 06:00:11 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Fix x86-64 bugs (only visible on OS X)
file annotate diff log raw
nkeynes@58
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@58
     3
 *
nkeynes@58
     4
 * SH4 onboard DMA controller (DMAC) definitions.
nkeynes@58
     5
 *
nkeynes@58
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@58
     7
 *
nkeynes@58
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@58
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@58
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@58
    11
 * (at your option) any later version.
nkeynes@58
    12
 *
nkeynes@58
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@58
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@58
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@58
    16
 * GNU General Public License for more details.
nkeynes@58
    17
 */
nkeynes@58
    18
nkeynes@736
    19
#ifndef lxdream_dmac_H
nkeynes@736
    20
#define lxdream_dmac_H 1
nkeynes@58
    21
nkeynes@58
    22
#include <stdint.h>
nkeynes@58
    23
nkeynes@58
    24
#ifdef __cplusplus
nkeynes@58
    25
extern "C" {
nkeynes@58
    26
#endif
nkeynes@58
    27
nkeynes@58
    28
/* External DREQ. Note only used for DMA memory-to-memory - for single 
nkeynes@58
    29
 * address transfers the device uses DMAC_get_buffer/DMAC_put_buffer.
nkeynes@58
    30
 */
nkeynes@58
    31
#define DMAC_EXTERNAL 0 
nkeynes@58
    32
#define DMAC_SCI_TDE 1  /* SCI Transmit data empty */
nkeynes@58
    33
#define DMAC_SCI_RDF 2  /* SCI Receive data full */
nkeynes@58
    34
#define DMAC_SCIF_TDE 3 /* SCIF Transmit data empty */
nkeynes@58
    35
#define DMAC_SCIF_RDF 4 /* SCIF Receive data full */
nkeynes@58
    36
#define DMAC_TMU_ICI 5  /* TMU Input capture interrupt (not used?) */
nkeynes@58
    37
nkeynes@58
    38
/**
nkeynes@58
    39
 * Trigger a DMAC transfer by asserting one of the above DMA request lines
nkeynes@58
    40
 * (from the onboard peripherals). Actual transfer is dependent on the 
nkeynes@58
    41
 * relevant channel configuration.
nkeynes@58
    42
 */
nkeynes@58
    43
void DMAC_trigger( int dmac_trigger );
nkeynes@58
    44
nkeynes@58
    45
/**
nkeynes@58
    46
 * Execute a memory-to-external-device transfer. Copies data into the supplied
nkeynes@58
    47
 * buffer up to a maximum of bytecount bytes. 
nkeynes@58
    48
 * @return Actual number of bytes copied.
nkeynes@58
    49
 */
nkeynes@430
    50
uint32_t DMAC_get_buffer( int channel, unsigned char *buf, uint32_t bytecount );
nkeynes@58
    51
nkeynes@58
    52
/**
nkeynes@58
    53
 * execute an external-device-to-memory transfer. Copies data from the 
nkeynes@58
    54
 * supplied buffer into memory up to a maximum of bytecount bytes. 
nkeynes@58
    55
 * @return Actual number of bytes copied.
nkeynes@58
    56
 */
nkeynes@430
    57
uint32_t DMAC_put_buffer( int channel, unsigned char *buf, uint32_t bytecount );
nkeynes@58
    58
nkeynes@58
    59
#ifdef __cplusplus
nkeynes@58
    60
}
nkeynes@58
    61
#endif
nkeynes@736
    62
nkeynes@736
    63
#endif /* !lxdream_dmac_H */
.